A two-dimensional data sequence alignment method based on similarity matching

By combining one-dimensional data sequence similarity matching and data set similarity matching with a similarity matching optimization algorithm, the difficulty of comparison caused by changes in row or column positions in two-dimensional data sequences is solved, achieving efficient and accurate data recognition.

CN115952214BActive Publication Date: 2026-04-28李永强 +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
李永强
Filing Date
2022-10-10
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively identify the smallest differences caused by changes in the position of data elements in two-dimensional data sequences, especially when row or column positions are adjusted, added, or deleted. Traditional comparison methods based on natural index coordinates are ineffective in these cases.

Method used

By employing a one-dimensional data sequence similarity matching method and a data set similarity matching method, combined with a similarity matching optimization algorithm, the index coordinates are repositioned based on data features and structure to identify the minimum difference between two-dimensional data sequences.

Benefits of technology

It improves the efficiency and accuracy of two-dimensional data sequence alignment, and can accurately identify the smallest differences when the row or column position changes. The processing is comprehensive and efficient.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115952214B_ABST
    Figure CN115952214B_ABST
Patent Text Reader

Abstract

The application provides a two-dimensional data sequence comparison method based on similarity matching, comprising similarity matching of each row and each column of a target two-dimensional data sequence obtained; through a one-dimensional data sequence similarity matching method and a data set similarity matching method, index coordinates of data elements are repositioned by means of data characteristics and data structures; and according to pairing results between rows and between columns obtained, comparison of data elements between target two-dimensional data sequences is carried out in a targeted manner. The method fully considers the influence of data element positions on data comparison, and overcomes defects of the prior art in minimum difference identification between two-dimensional data sequences under conditions of index coordinate variation such as adjustment, increase and deletion of row or column positions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data comparison technology, specifically to a two-dimensional data sequence comparison method based on similarity matching. Background Technology

[0002] Data comparison is a common task in work and life. It refers to identifying identical and different data between two sets or sequences of data. The data being compared can be numbers or strings.

[0003] Understandably, the simplest data comparison is between two single data items (numbers or strings). For example, "0" and "1" or "a" and "b" are different data; while "0" and "0" or "a" and "a" are the same data. If the objects to be compared are sets of data, the comparison process is relatively easy. For example, between {0,1,2,3,4,5,6} and {0,1,2,3,4,a,b}, the same data is 0,1,2,3,4; the different data are 5,6 and a,b. If the objects to be compared are one-dimensional data sequences, the comparison process is slightly more complex. For example, between [0,1,2,3,4,5,6] and [0,1,6,3,2,5,a], considering the order of the data elements, the same data is the 1st, 2nd, 4th, and 6th positions: 0,1,3,5; the different data are the 3rd, 5th, and 7th positions: 2,4,6 and 6,2,a, respectively. Although both contain 2 and 6, they cannot be considered the same data because of their different positions in the sequence. Similarly, if data element comparison is performed solely based on the natural index order or natural index coordinates, the process and difficulty of comparing two-dimensional or multi-dimensional data sequences are no different.

[0004] However, for two-dimensional data sequences, comparison methods relying solely on the natural index coordinates of data elements often fail to achieve satisfactory results. This is because, in practical applications of two-dimensional data sequences, the positions of data elements frequently change. For example, adjustments, additions, and deletions occur in the row and column positions of worksheets. In such cases, if the content of the data elements is further modified, this method becomes even more ineffective, failing to identify the smallest differences between the two-dimensional data sequences. Summary of the Invention

[0005] To address the shortcomings of existing technologies, the present invention aims to provide a two-dimensional data sequence alignment method based on similarity matching. By proposing a one-dimensional data sequence similarity matching method and a data set similarity matching method, this invention can identify the minimum differences between two-dimensional data sequences while comprehensively considering both the data elements themselves and their surrounding data environment. Furthermore, by proposing a similarity matching optimization algorithm, the present invention achieves both high efficiency and accuracy. This addresses the problems mentioned in the background section.

[0006] To achieve the above objectives, the present invention provides a two-dimensional data sequence alignment method based on similarity matching, comprising the following steps:

[0007] The first step is to select, based on the acquired target two-dimensional data sequence, a data sequence or a data set guided by a single index coordinate as the similarity matching object of the target two-dimensional data sequence; wherein, the data sequence guided by the single index coordinate is a data sequence of a row or a data sequence arranged in a certain order, and the data set guided by the single index coordinate is a data set of a row or a data set regardless of the data order.

[0008] The second step involves using the data set guided by the single index coordinates as the main component to perform similarity matching on each column of the target two-dimensional data sequence, thereby obtaining the pairing results between columns of the target two-dimensional data sequence.

[0009] The third step involves using the data sequence guided by the single index coordinate as the main component to perform similarity matching on each row of the target two-dimensional data sequence, thereby obtaining the pairing results between rows of the target two-dimensional data sequence.

[0010] The fourth step is to compare the content of each data element in the target two-dimensional data sequence one by one based on the pairing results between rows and columns of the acquired target two-dimensional data sequence, and to identify and record the results.

[0011] The fifth step is to obtain the minimum difference between the target two-dimensional data sequences based on the comparison results obtained in the fourth step.

[0012] As an improvement to the similarity-based two-dimensional data sequence alignment method described in this invention, the target two-dimensional data sequence is any data sequence with row and column two-dimensional features, and its file range includes: files in .xls, .xlsx, .xlsm, .xlsb, .xla, .xlam, .XML, .CSV, .ods, and .txt formats, as well as databases with row and column two-dimensional features.

[0013] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0014] This invention proposes a "one-dimensional data sequence similarity matching method" and a "data set similarity matching method," which use data features and data structures to match the index coordinates of data elements. It fully considers the impact of data element positions on data comparison and overcomes the shortcomings of existing technologies in identifying the minimum difference in two-dimensional data sequences (especially when there are changes in index coordinates due to row or column position adjustments, additions, or deletions).

[0015] This invention significantly improves the efficiency of data comparison between two-dimensional data sequences by proposing a "similarity matching optimization algorithm." Unlike existing technologies that suffer from insufficient global coverage and inefficient, repetitive processing, this invention employs a global, many-to-many matching approach. It solves the data matching problem between multiple rows or columns in a single step, resulting in a more comprehensive and efficient process that provides strong support for obtaining ideal comparison results. Attached Figure Description

[0016] The disclosure of this invention is illustrated with reference to the accompanying drawings. It should be understood that the drawings are for illustrative purposes only and are not intended to limit the scope of protection of this invention. In the drawings, the same reference numerals are used to refer to the same parts. Wherein:

[0017] Figure 1 This is a schematic diagram of the overall time-series steps in one embodiment of the present invention, which involves applying a data set similarity matching method to column data and a one-dimensional data sequence similarity matching method to row data to obtain pairing results between columns, between rows, and comparison results of the target two-dimensional data sequence. Figure 1 ;

[0018] Figure 2 This is a schematic diagram of the overall time-series steps in one embodiment of the present invention, which involves applying a data set similarity matching method to column data and a one-dimensional data sequence similarity matching method to row data to obtain pairing results between columns, between rows, and comparison results of the target two-dimensional data sequence. Figure 2 ;

[0019] Figure 3 This is a schematic diagram of the overall time-series steps in one embodiment of the present invention, which involves applying a data set similarity matching method to column data and a one-dimensional data sequence similarity matching method to row data to obtain pairing results between columns, between rows, and comparison results of the target two-dimensional data sequence. Figure 3 ;

[0020] Figure 4 This is a schematic diagram of the overall temporal steps of applying a data set similarity matching method to row data and a one-dimensional data sequence similarity matching method to column data, in another embodiment of the present invention, to obtain pairing results between rows and columns, as well as comparison results of the target two-dimensional data sequence. Figure 1 ;

[0021] Figure 5This is a schematic diagram of the overall temporal steps of applying a data set similarity matching method to row data and a one-dimensional data sequence similarity matching method to column data, in another embodiment of the present invention, to obtain pairing results between rows and columns, as well as comparison results of the target two-dimensional data sequence. Figure 2 ;

[0022] Figure 6 This is a schematic diagram of the overall temporal steps of applying a data set similarity matching method to row data and a one-dimensional data sequence similarity matching method to column data, in another embodiment of the present invention, to obtain pairing results between rows and columns, as well as comparison results of the target two-dimensional data sequence. Figure 3 ;

[0023] Figure 7 This is a schematic diagram of a two-dimensional data sequence 5 containing “100 rows × 100 columns” in one embodiment of the present invention;

[0024] Figure 8 This is a schematic diagram of a two-dimensional data sequence 6 containing “101 rows × 100 columns” in one embodiment of the present invention;

[0025] Figure 9 This is a schematic diagram showing the result of comparing two-dimensional data sequence 5 containing “100 rows × 100 columns” and two-dimensional data sequence 6 containing “101 rows × 100 columns” in one embodiment of the present invention. Detailed Implementation

[0026] It is readily understood that, based on the technical solution of this invention, those skilled in the art can propose various interchangeable structural methods and implementations without altering the essential spirit of the invention. Therefore, the following detailed embodiments and accompanying drawings are merely illustrative examples of the technical solution of this invention and should not be considered as the entirety of the invention or as limitations or restrictions on the technical solution of this invention.

[0027] The present invention will be further described in detail below with reference to the accompanying drawings, but this is not intended to limit the invention.

[0028] As an understanding of the technical concept and implementation principle of this invention, in the practical application of two-dimensional data sequences, there are often situations where the position of data elements changes, such as adjusting, adding, or deleting rows and columns in a worksheet; in this case, if the content of the data elements is further changed, then comparing data based on the natural index coordinates of the data elements will have little effect.

[0029] Therefore, to address the issue that existing methods relying solely on the natural index coordinates of data elements for data comparison fail to achieve the desired comparison results when the position of data elements changes, this invention proposes a method that utilizes both one-dimensional data sequence similarity matching and data set similarity matching. By leveraging data features and data structure, the index coordinates of data elements are repositioned, fully considering the impact of data element position on data comparison. This overcomes the shortcomings of existing technologies in identifying the minimum difference in two-dimensional data sequences (especially when index coordinates change due to row or column position adjustments, additions, or deletions). The technical principles of this invention are shown in Tables 1 and 2 below:

[0030]

[0031] The positions of the data elements in Table 2 are completely different from those in Table 1 after adjustment. If compared solely based on the natural index coordinates of the data elements, the data in the two tables would appear entirely different. However, this is not the case. The data in rows 2 and 3 of Table 1 is exactly the same as the data in rows 1 and 4 of Table 2; the data in columns 1, 2, and 3 of row 1 of Table 1 is the same as the data in columns 1, 2, and 3 of row 3 of Table 2; the data in columns 1, 3, and 4 of row 4 of Table 1 is the same as the data in columns 1, 3, and 4 of row 2 of Table 2; the only difference between the two tables is the data in columns 4 and 4 of row 1 and 2 of row 4 of table 1, and the data in columns 4 and 2 of row 2 of table 2. This is the smallest difference between the two tables (this result is also the design objective of this invention, namely, to identify the smallest difference between two-dimensional data sequences).

[0032] Therefore, as Figure 1-3 As shown, a two-dimensional data sequence alignment method based on similarity matching is proposed, which specifically includes the following steps:

[0033] The first step is to select, based on the acquired target two-dimensional data sequence, a data sequence or a data set guided by a single index coordinate as the similarity matching object of the target two-dimensional data sequence. The data sequence guided by a single index coordinate is a data sequence of a row or a data sequence arranged in a certain order, and the data set guided by a single index coordinate is a data set of a row or a data set regardless of the data order.

[0034] It should be noted that, in specific implementation, the target two-dimensional data sequence obtained includes at least two-dimensional data sequence 1 with m rows × n columns and two-dimensional data sequence 2 with M rows × N columns. Next, it is also necessary to select the data set guided by the column index coordinates in two-dimensional data sequence 1 and the data set guided by the column index coordinates in two-dimensional data sequence 2, as well as the data sequence guided by the row index coordinates in two-dimensional data sequence 1 and the data sequence guided by the row index coordinates in two-dimensional data sequence 2, as similarity matching objects, and regard the data sequence guided by the row index coordinates as a one-dimensional data sequence.

[0035] The present invention also includes: a second step, which is to achieve similarity matching between all columns in two-dimensional data sequence 1 and two-dimensional data sequence 2 based on the data set similarity matching method.

[0036] like Figure 1 As shown, based on the above technical concept, the second step requires using a data set similarity matching method to achieve similarity matching between all columns of two-dimensional data sequence 1 and two-dimensional data sequence 2. The specific implementation method is as follows:

[0037] S2-1 compares the contents of all data elements in the i-th column of the two-dimensional data sequence 2 with the contents of all data elements in the j-th column of the two-dimensional data sequence 1 without regard to order. It can be understood that 1≤i≤N, 1≤j≤n. The number of times the contents of the data elements overlap is counted as the similarity between the i-th column of the two-dimensional data sequence 2 and the j-th column of the two-dimensional data sequence 1.

[0038] S2-2, based on S2-1, after completing the similarity calculation between all columns of two-dimensional data sequence 2 and two-dimensional data sequence 1, an N×n two-dimensional similarity array is obtained, where the row and column coordinate values ​​in the two-dimensional similarity array correspond to the column index coordinate values ​​of two-dimensional data sequence 2 and two-dimensional data sequence 1, respectively.

[0039] S2-3, Based on the currently obtained two-dimensional similarity array, find the maximum value in it. At this time, the row and column coordinates of the two-dimensional similarity array where the maximum value is located are the column index coordinates of the two most similar columns between two-dimensional data sequence 2 and two-dimensional data sequence 1. Thus, one column similarity matching between two-dimensional data sequence 2 and two-dimensional data sequence 1 is completed.

[0040] S2-4: Based on the two-dimensional similarity array currently obtained in S2-3, delete the row and column containing the maximum value to obtain a two-dimensional similarity array of (N-1)×(n-1).

[0041] S2-5, return to step S2-3 until the current two-dimensional similarity array is empty. It can be understood that at this point, if there are still unmatched columns in two-dimensional data sequence 2, they are either newly added columns in two-dimensional data sequence 2 or columns deleted from two-dimensional data sequence 1; conversely, the same applies to two-dimensional data sequence 1.

[0042] S2-6, end the similarity matching between all columns of two-dimensional data sequence 1 and two-dimensional data sequence 2, and obtain the pairing results between columns of two-dimensional data sequence 2 and two-dimensional data sequence 1.

[0043] It should be noted that this technical solution uses the data set similarity matching method proposed in this invention to achieve similarity matching between data sets guided by column index coordinates. However, the data set similarity matching method is also applicable to similarity matching between data sets guided by row index coordinates, which will not be described separately here. The data set similarity matching method is extremely useful for comparing two-dimensional data sequences where index coordinates change (such as adjusting, adding, or deleting rows or columns in an Excel worksheet).

[0044] The present invention also includes: a third step, which is to achieve similarity matching between all rows in two-dimensional data sequence 1 and two-dimensional data sequence 2 based on the one-dimensional data sequence similarity matching method.

[0045] like Figure 3 As shown, based on the above technical concept, in the third step, it is necessary to use a one-dimensional data sequence similarity matching method to achieve similarity matching between all rows of two-dimensional data sequence 1 and two-dimensional data sequence 2. The specific implementation method is as follows:

[0046] S3-1, compare the contents of all data elements in the i-th row of the two-dimensional data sequence 2 and the contents of all data elements in the j-th row of the two-dimensional data sequence 1 one by one according to the pairing results between columns of the target two-dimensional data sequence obtained in the second step, and count the number of times the data element contents are the same as the similarity between the i-th row of the two-dimensional data sequence 2 and the j-th row of the two-dimensional data sequence 1.

[0047] S3-2, based on S3-1, after completing the similarity calculation between all rows of two-dimensional data sequence 2 and two-dimensional data sequence 1, an M×m two-dimensional similarity array is obtained, where the row and column coordinate values ​​of the two-dimensional similarity array correspond to the row index coordinate values ​​of two-dimensional data sequence 2 and two-dimensional data sequence 1, respectively.

[0048] S3-3, based on the currently obtained two-dimensional similarity array, find the maximum value in it. At this time, the row and column coordinates of the two-dimensional similarity array where the maximum value is located are the row index coordinates of the two most similar rows between two-dimensional data sequence 2 and two-dimensional data sequence 1. Thus, one row similarity matching between two-dimensional data sequence 2 and two-dimensional data sequence 1 is completed.

[0049] S3-4: Based on the two-dimensional similarity array currently obtained in S3-3, delete the row and column containing the maximum value to obtain a two-dimensional similarity array of (M-1)×(m-1).

[0050] S3-5, return to step S3-3 until the current M×m two-dimensional similarity array is empty. It can be understood that at this point, if there are still unmatched rows in two-dimensional data sequence 2, they are either newly added rows in two-dimensional data sequence 2 or rows deleted in two-dimensional data sequence 1; conversely, the same applies to two-dimensional data sequence 1.

[0051] S3-6, end the similarity matching between all rows of two-dimensional data sequence 1 and two-dimensional data sequence 2, and obtain the pairing results between rows of two-dimensional data sequence 2 and two-dimensional data sequence 1.

[0052] It should be noted that this technical solution uses the one-dimensional data sequence similarity matching method proposed in this invention to achieve similarity matching between one-dimensional data sequences guided by row index coordinates. However, the one-dimensional data sequence similarity matching method is also applicable to similarity matching between one-dimensional data sequences guided by column index coordinates, which will not be described separately here. The one-dimensional data sequence similarity matching method is extremely useful for comparing two-dimensional data sequences where index coordinates change (such as adjusting, adding, or deleting rows or columns in an Excel worksheet).

[0053] It is understandable that after S2-5 and S3-5 are completed, the similarity matching between all rows and columns of the two-dimensional data sequence 1 and the two-dimensional data sequence 2 is completed, and the pairing results of the target two-dimensional data sequence between all columns and the pairing results of the target two-dimensional data sequence between all rows are obtained.

[0054] It should be noted that both dataset similarity matching and one-dimensional data sequence similarity matching can be used to pair rows and columns in a two-dimensional data sequence. However, these are not the only two methods for pairing rows and columns in a two-dimensional data sequence. Understandably, pairing rows and columns in a two-dimensional data sequence can also be accomplished through natural ordering or by deliberate designation. For example, one could manually pair the first column of two-dimensional data sequence 2 with the first column of two-dimensional data sequence 1, the second column of two-dimensional data sequence 2 with the second column of two-dimensional data sequence 1, the third column of two-dimensional data sequence 2 with the third column of two-dimensional data sequence 1, the first row of two-dimensional data sequence 2 with the first row of two-dimensional data sequence 1, the second row of two-dimensional data sequence 2 with the second row of two-dimensional data sequence 1, and the third row of two-dimensional data sequence 2 with the third row of two-dimensional data sequence 1.

[0055] For steps two and three, during the similarity matching process of each column and row of the target two-dimensional data sequence, it is necessary to reduce the amount of similarity calculations in this process based on a similarity matching optimization algorithm, so as to improve the comparison efficiency of the target two-dimensional data sequence. The purpose of this design is to address the fact that, for two-dimensional data sequences containing a large amount of data, both of the above similarity matching methods (one-dimensional data sequence similarity matching and dataset similarity matching) require a large number of similarity calculations during execution. For example, for two-dimensional data sequences 3 and 4, both containing "1000 rows × 1000 columns", regardless of whether the one-dimensional data sequence similarity matching method or the dataset similarity matching method is used, the matching process between rows and between columns requires 1000 × 1000 = 1,000,000 similarity calculations. This process is extremely cumbersome, time-consuming, and inefficient. Therefore, it is necessary to optimize the two similarity matching methods mentioned above to reduce the amount of similarity calculation between "one-dimensional data sequences" or "data sets" and improve the comparison efficiency between two-dimensional data sequence 3 and two-dimensional data sequence 4.

[0056] To address this, the present invention proposes a similarity matching optimization algorithm to reduce the computational cost of similarity matching. The specific implementation method is as follows:

[0057] For the second step: in the process of similarity matching of each column of the target two-dimensional data sequence, the specific implementation method based on the similarity matching optimization algorithm to reduce the similarity calculation and improve the comparison efficiency of the target two-dimensional data sequence is as follows:

[0058] First, select one row from two-dimensional data sequence 1 and two-dimensional data sequence 2 as its identifier row;

[0059] Secondly, the data elements in the identifier row are classified according to their content, and based on this classification, the two-dimensional data sequence 1 and the two-dimensional data sequence 2 are divided into multiple smaller two-dimensional data sequences.

[0060] Finally, for each type of smaller two-dimensional data sequence, the similarity matching method of the data set is used to achieve similarity matching between all columns of each type of smaller two-dimensional data sequence, thereby obtaining the pairing results between columns of two-dimensional data sequence 1 and two-dimensional data sequence 2.

[0061] For example, for two-dimensional data sequences 3 and 4, both containing "1000 rows × 1000 columns", assuming a certain row is used as the identifier row, both sequences are divided into 100 smaller two-dimensional data sequences, each containing all rows and 10 columns. Based on this, it can be concluded that the number of similarity calculations in the similarity matching process for each column of two-dimensional data sequences 3 and 4 is reduced to (10 × 10) × 100 = 10000 times, improving computational efficiency by 100 times.

[0062] For the third step: in the process of similarity matching for each row of the target two-dimensional data sequence, the specific implementation method based on the similarity matching optimization algorithm to reduce the similarity calculation and improve the comparison efficiency of the target two-dimensional data sequence is as follows:

[0063] First, select one column from two-dimensional data sequence 1 and two-dimensional data sequence 2 as its identifier column;

[0064] Secondly, the data elements in the identifier column are classified according to their content, and based on this classification, the two-dimensional data sequence 1 and the two-dimensional data sequence 2 are divided into multiple smaller two-dimensional data sequences.

[0065] Finally, for each type of smaller two-dimensional data sequence, the similarity between all rows of each type of smaller two-dimensional data sequence is matched by the one-dimensional data sequence similarity matching method, thereby obtaining the pairing results between rows of two-dimensional data sequence 1 and two-dimensional data sequence 2.

[0066] For example, for two-dimensional data sequences 3 and 4, both containing "1000 rows × 1000 columns", assuming a certain column is used as the identifier, both sequences are divided into 100 smaller two-dimensional data sequences, each containing 10 rows and all columns. Based on this, it can be concluded that the number of similarity calculations in the process of matching the similarity of each row of two-dimensional data sequences 3 and 4 is reduced to (10 × 10) × 100 = 10000 times, improving computational efficiency by 100 times.

[0067] Based on the above technical concept, it can be understood that in the second and third steps, the similarity matching optimization algorithm is used to decompose the original large-scale similarity calculation process into multiple small-scale similarity calculation processes, thereby reducing the amount of computation and improving computational efficiency.

[0068] The present invention further includes: a fourth step, which involves comparing the content of matching data elements in the target two-dimensional data sequence one by one based on the pairing results between rows and columns of the acquired target two-dimensional data sequence, and marking the position and recording the content of the comparison results. The specific implementation is as follows:

[0069] S4-1, For any matching data element, first determine whether its content is all numbers;

[0070] S4-2, based on S4-1, if it is determined that the two matching data elements are both numbers, then compare the difference between them. If the absolute value of the difference is within the allowable error, then the two data elements are considered to be the same; otherwise, the two data elements are considered to be different.

[0071] S4-3, based on S4-1, if it is determined that the two matched data elements are not all numbers, then the differences between their contents are compared as strings. If the string contents are completely identical, then the two data elements are considered to be the same; otherwise, the two data elements are considered to be different.

[0072] S4-4, based on the comparison results of S4-2 and S4-3, identifies the matched data elements with different colors and records the matching location information and comparison result information through text.

[0073] As an embodiment of the present invention, it should be noted that in the process of reducing the computational load of similarity between rows or columns based on the similarity matching optimization algorithm (i.e., in the second step of performing similarity matching on each column of the target two-dimensional data sequence and in the third step of performing similarity matching on each row of the target two-dimensional data sequence), representative single rows and columns in two-dimensional data sequence 1 and two-dimensional data sequence 2 are selected as identifier rows or identifier columns to ensure the completeness and accuracy of data matching in the similarity matching process and results. For example, empty rows and empty columns in the target two-dimensional data sequence are representative identifier rows and identifier columns. The stronger the representativeness of the identifier row or identifier column, the higher the completeness and accuracy of its similarity matching; conversely, the weaker the representativeness of the identifier row or identifier column, the lower the completeness and accuracy of its similarity matching.

[0074] The present invention also includes: a fifth step, which is to obtain the minimum difference between the target two-dimensional data sequences based on the comparison results obtained in the fourth step.

[0075] In one embodiment of the present invention, the proposed technical concept is applicable to two-dimensional data sequences whose data structures are arranged in "rows". For example, in a two-dimensional data sequence of "m rows × n columns", any row is a one-dimensional data sequence containing n data attributes, and the one-dimensional data sequence is also an independent and complete element in the two-dimensional data sequence. That is, the two-dimensional data sequence is composed of m one-dimensional data sequences with similar data structures.

[0076] To verify the feasibility of the embodiments described in this invention, two-dimensional data sequences 5 containing "100 rows × 100 columns" and 6 containing "101 rows × 100 columns" are used as examples. Figure 7 and Figure 8 As shown, using the data comparison approach and method described above in this invention, the data in two-dimensional data sequence 5 and two-dimensional data sequence 6 are compared through programming to find the smallest difference between them, which is then marked with color. The comparison results of the two two-dimensional data sequences are as follows. Figure 9 As shown in Figure 6, the differences between two two-dimensional data sequences are marked with color, representing the minimum difference between them. From... Figure 9 As can be seen, compared to two-dimensional data sequence 5, all modified data elements and newly added rows of data elements in two-dimensional data sequence 6 have been identified. This comparison process is extremely fast, highly efficient, and the comparison results are completely correct. Therefore, the correctness and effectiveness of the comparison method proposed in this invention can be proven.

[0077] In addition to the specific embodiments described above, the present invention also provides another specific embodiment, the implementation steps of which are similar to those of the above embodiments. For detailed steps, please refer to [link to detailed embodiments]. Figure 4-6 As shown, it will not be elaborated further here.

[0078] In another embodiment of the present invention, the technical concept proposed in this invention is applicable to two-dimensional data sequences whose data structures are arranged in "columns". For example, for a two-dimensional data sequence containing "m rows × n columns", any column is a one-dimensional data sequence containing m data attributes, and this one-dimensional data sequence is also an independent and complete element in the two-dimensional data sequence, that is, the two-dimensional data sequence is composed of n one-dimensional data sequences with similar data structures.

[0079] Based on the understanding of the above two sets of embodiments of the present invention, Embodiment 1 provided in this application is a technical solution obtained by applying the data set similarity matching method to pairing between columns and the one-dimensional data sequence similarity matching method to pairing between rows; Embodiment 2 provided in this application is a technical solution obtained by applying the data set similarity matching method to pairing between rows and the one-dimensional data sequence similarity matching method to pairing between columns. These two specific embodiments are only two typical implementation schemes in the application of the present invention, but they are not all the implementable technical solutions of the present invention.

[0080] It is understandable that both dataset similarity matching and one-dimensional data sequence similarity matching can be used to achieve pairing between rows and columns in a two-dimensional data sequence. However, these are not the only two methods for pairing rows and columns in a two-dimensional data sequence; they can also be based on natural ordering or user-defined pairing. In principle, by flexibly applying dataset similarity matching, one-dimensional data sequence similarity matching, and methods based on natural ordering or user-defined pairing to pair rows and columns in a two-dimensional data sequence, a variety of easy-to-implement technical solutions can be obtained, which will not be elaborated upon here.

[0081] Furthermore, it can be understood that in the one-dimensional data sequence similarity matching method and data set similarity matching method proposed in this invention, the expression of similarity only needs to emphasize the relative magnitude of the similarity values. Therefore, in S2-4 and S3-4, the processing method of the two-dimensional similarity array is not limited to reducing the size of the two-dimensional similarity array; it can also be achieved by changing the element values ​​in the row and column where the maximum value is located, for example, by assigning them negative numbers. The condition for determining the end of the loop in S2-5 and S3-5 then becomes: the maximum value in the two-dimensional similarity array is negative.

[0082] It should be noted that the target two-dimensional data sequence is any data sequence with row and column two-dimensional features, and its file range includes: .xls, .xlsx, .xlsm, .xlsb, .xla, .xlam, .XML, .CSV, .ods, .txt files, as well as databases with row and column two-dimensional features.

[0083] The technical scope of this invention is not limited to the content described above. Those skilled in the art can make various modifications and variations to the above embodiments without departing from the technical concept of this invention, and all such modifications and variations should fall within the protection scope of this invention.

Claims

1. A two-dimensional data sequence alignment method based on similarity matching, characterized in that: Includes the following steps: The first step is to select, based on the acquired target two-dimensional data sequence, a data sequence guided by a single index coordinate and a data set guided by a single index coordinate as similarity matching objects for the target two-dimensional data sequence; wherein, the data sequence guided by the single index coordinate is a row data sequence or column data sequence arranged in a certain order, and the data set guided by the single index coordinate is a set of a row data or a set of a column data regardless of the data order; The second step involves using the data set guided by the single index coordinates as the main component to perform similarity matching on each column of the target two-dimensional data sequence, thereby obtaining the pairing results between columns of the target two-dimensional data sequence. The third step involves using the data sequence guided by the single index coordinate as the main component to perform similarity matching on each row of the target two-dimensional data sequence, thereby obtaining the pairing results between rows of the target two-dimensional data sequence. The fourth step is to compare the content of each data element in the target two-dimensional data sequence one by one based on the pairing results between rows and columns of the acquired target two-dimensional data sequence, and to identify and record the results. The fifth step is to obtain the minimum difference between the target two-dimensional data sequences based on the comparison results obtained in the fourth step.

2. The two-dimensional data sequence alignment method based on similarity matching according to claim 1, characterized in that: In the first step, after obtaining the target two-dimensional data sequence which at least contains a two-dimensional data sequence 1 with m rows × n columns and a two-dimensional data sequence 2 with M rows × N columns; The data sets guided by column index coordinates in two-dimensional data sequence 1 and the data sets guided by column index coordinates in two-dimensional data sequence 2, as well as the data sequences guided by row index coordinates in two-dimensional data sequence 1 and the data sequences guided by row index coordinates in two-dimensional data sequence 2, are selected as similarity matching objects.

3. A two-dimensional data sequence alignment method based on similarity matching according to claim 1 or 2, characterized in that: In the second step, similarity matching between all columns of two-dimensional data sequence 1 and two-dimensional data sequence 2 is achieved based on the data set similarity matching method. The specific implementation method is as follows: S2-1, compare the contents of all data elements in the i-th column of the two-dimensional data sequence 2 with the contents of all data elements in the j-th column of the two-dimensional data sequence 1 without regard to order, and count the number of times the contents of the data elements overlap as the similarity between the i-th column of the two-dimensional data sequence 2 and the j-th column of the two-dimensional data sequence 1. S2-2, based on S2-1, after completing the similarity calculation between all columns of two-dimensional data sequence 2 and two-dimensional data sequence 1, an N×n two-dimensional similarity array is obtained, where the row and column coordinate values ​​in the two-dimensional similarity array correspond to the column index coordinate values ​​of two-dimensional data sequence 2 and two-dimensional data sequence 1, respectively. S2-3, Based on the currently obtained two-dimensional similarity array, find the maximum value in it. At this time, the row and column coordinates of the two-dimensional similarity array where the maximum value is located are the column index coordinates of the two most similar columns between two-dimensional data sequence 2 and two-dimensional data sequence 1. Thus, one column similarity matching between two-dimensional data sequence 2 and two-dimensional data sequence 1 is completed. S2-4: Based on the two-dimensional similarity array currently obtained in S2-3, delete the row and column containing the maximum value to obtain a two-dimensional similarity array of (N-1)×(n-1). S2-5, return to step S2-3, until the current two-dimensional similarity array is empty; S2-6, end the similarity matching between all columns of two-dimensional data sequence 1 and two-dimensional data sequence 2, and obtain the pairing results between columns of two-dimensional data sequence 2 and two-dimensional data sequence 1.

4. A two-dimensional data sequence alignment method based on similarity matching according to claim 1 or 2, characterized in that: In the third step, the similarity matching between all rows in two-dimensional data sequence 1 and two-dimensional data sequence 2 is achieved based on the one-dimensional data sequence similarity matching method. The specific implementation method is as follows: S3-1, combine the contents of all data elements in the i-th row of two-dimensional data sequence 2 with the contents of the j-th row of two-dimensional data sequence 1. The content containing data elements is processed according to the pairing results between columns of the target two-dimensional data sequence obtained in step two. Compare them one by one, and count the number of times that the data elements are the same as the similarity between the i-th row of the two-dimensional data sequence 2 and the j-th row of the two-dimensional data sequence 1. S3-2, based on S3-1, after completing the similarity calculation between all rows of two-dimensional data sequence 2 and two-dimensional data sequence 1, an M×m two-dimensional similarity array is obtained, where the row and column coordinate values ​​of the two-dimensional similarity array correspond to the row index coordinate values ​​of two-dimensional data sequence 2 and two-dimensional data sequence 1, respectively. S3-3, based on the currently obtained two-dimensional similarity array, find the maximum value in it. At this time, the row and column coordinates of the two-dimensional similarity array where the maximum value is located are the row index coordinates of the two most similar rows between two-dimensional data sequence 2 and two-dimensional data sequence 1. Thus, one row similarity matching between two-dimensional data sequence 2 and two-dimensional data sequence 1 is completed. S3-4: Based on the two-dimensional similarity array currently obtained in S3-3, delete the row and column containing the maximum value to obtain a two-dimensional similarity array of (M-1)×(m-1). S3-5, return to step S3-3, until the current two-dimensional similarity array is an empty array; S3-6, end the similarity matching between all rows of two-dimensional data sequence 1 and two-dimensional data sequence 2, and obtain the pairing results between rows of two-dimensional data sequence 2 and two-dimensional data sequence 1.

5. The two-dimensional data sequence alignment method based on similarity matching according to claim 1, characterized in that: In the fourth step, based on the pairing results between rows and columns of the acquired two-dimensional data sequence 2 and two-dimensional data sequence 1, the content of all matching data elements in two-dimensional data sequence 2 and two-dimensional data sequence 1 is compared one by one, and the comparison results are marked with positions and recorded. The specific implementation method is as follows: S4-1, For any matching data element, first determine whether its content is all numbers; S4-2, based on S4-1, if it is determined that the two matching data elements are both numbers, then compare the difference between them. If the absolute value of the difference is within the allowable error, then the two data elements are considered to be the same; otherwise, the two data elements are considered to be different. S4-3, based on S4-1, if it is determined that the two matched data elements are not all numbers, then the differences between their contents are compared as strings. If the string contents are completely identical, then the two data elements are considered to be the same; otherwise, the two data elements are considered to be different. S4-4, based on the comparison results of S4-2 and S4-3, identifies the matched data elements with different colors and records the matching location information and comparison result information through text.

6. The two-dimensional data sequence alignment method based on similarity matching according to claim 1, characterized in that: In the second step, during the similarity matching process of each column of the target two-dimensional data sequence, it is also necessary to reduce the amount of similarity calculation in this process based on the similarity matching optimization algorithm, so as to improve the comparison efficiency of the target two-dimensional data sequence. The specific implementation method is as follows: First, select one row from two-dimensional data sequence 1 and two-dimensional data sequence 2 as its identifier row; Secondly, the data elements in the identifier row are classified according to their content, and based on this classification, the two-dimensional data sequence 1 and the two-dimensional data sequence 2 are divided into multiple smaller two-dimensional data sequences respectively. Finally, for each type of smaller two-dimensional data sequence, the similarity matching method of the data set is used to achieve similarity matching between all columns of each type of smaller two-dimensional data sequence, thereby obtaining the pairing results between columns of two-dimensional data sequence 1 and two-dimensional data sequence 2.

7. The two-dimensional data sequence alignment method based on similarity matching according to claim 1, characterized in that: In the third step, during the similarity matching process for each row of the target two-dimensional data sequence, it is also necessary to base the similarity on... An optimization algorithm is used to reduce the amount of similarity calculation in this process, thereby improving the alignment efficiency of the target two-dimensional data sequence. Specifically... The implementation method is as follows: First, select one column from two-dimensional data sequence 1 and two-dimensional data sequence 2 as its identifier column; Secondly, the data elements in the identifier column are classified according to their content, and based on this classification, the two-dimensional data sequence 1 and the two-dimensional data sequence 2 are divided into multiple smaller two-dimensional data sequences. Finally, for each type of smaller two-dimensional data sequence, the similarity between all rows of each type of smaller two-dimensional data sequence is matched by the one-dimensional data sequence similarity matching method, thereby obtaining the pairing results between rows of two-dimensional data sequence 1 and two-dimensional data sequence 2.

8. A two-dimensional data sequence alignment method based on similarity matching according to claim 6 or 7, characterized in that: Representative rows and columns from both two-dimensional data sequence 1 and two-dimensional data sequence 2 are selected as identifier rows or columns to ensure the completeness and accuracy of data matching during the similarity matching process and results. The representative rows and columns are as follows: In a target two-dimensional data sequence, the more representative the empty rows and columns are, the higher the completeness and accuracy of similarity matching; conversely, the less representative the empty rows and columns are, the lower the completeness and accuracy of similarity matching.

9. A two-dimensional data sequence alignment method based on similarity matching according to claim 1, characterized in that: The target two-dimensional data sequence is any data sequence with row and column two-dimensional characteristics. Its file range includes: .xls, .xlsx, .xlsm, .xlsb, .xla, .xlam, .XML, .CSV, .ods, .txt files, as well as databases with row and column two-dimensional characteristics.

Citation Information

Patent Citations

  • On-line character detection method based on machine vision and system thereof

    CN101576956A

  • Method for calculating text similarity based on target text

    CN103207905A