Table content comparison method and system
By comparing the structural transformation and cell position changes of data tables, combined with the overall and secondary comparison methods, the accuracy of data table structure changes and cell content changes in the existing technology is solved, and efficient and accurate data comparison effect is achieved .
Patent Information
- Application Number
- CN202011026085.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-25
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2040-09-25
AI Technical Summary
When comparing the differences between two Excel data tables, the applicable scenario range is small, and it is impossible to accurately process changes in the data table structure, and only consider the overall data changes without specifically comparing the changes in cell content.
First confirm the structure transformation of the data table, then compare one by one according to the position of the cells, calculate the coordinates of the previous and next versions of the cells, and then compare the cells. For the data transformation situation inside the cell, first perform an overall comparison, and then perform a secondary comparison of the cells that have been transformed to find a more specific difference situation.
Accurate comparison of data table structure changes and cell content changes is achieved, improving the efficiency and accuracy of data comparison and reducing labor costs.
Smart Images

Figure CN114254594B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to table content processing, and in particular to comparison of data tables. Background Art
[0002] In office scenarios, data tables such as Excel spreadsheets are often used, and managing data table versions between different versions is a very troublesome task. The conventional solution is to manually check the two versions of the data table to find the updates and changes, but the efficiency and accuracy are very low. Although the Microsoft Office add-on tool SpreadsheetCompare can be used to compare the differences between two Excel data tables, it is not ideal in terms of scope of application and result expression. Summary of the invention
[0003] After long-term observation and experiments, the inventor found that Spreadsheet Compare has at least the following defects:
[0004] (1) Spreadsheet Compare is applicable to a narrow range of scenarios for comparing data tables. It can only process Excel spreadsheet files and can only compare data tables with similar table structures, performing a one-to-one comparison based on the position of cells. However, when the structure of the data table is different, such as deleting, adding, or moving columns or rows, Spreadsheet Compare cannot accurately calculate the comparison results.
[0005] (2) Spreadsheet Compare will calculate the data or content in the cell as a whole, without specifically comparing or describing the changes in the data or content in the cell. In other words, it only considers the whole, not the specific content. For example, the data in the table of version 1 is "2020-01", and the data in the table of version 2 is "2020-02". The actual change should be "2020-0 2 ” (The deleted part indicates the deleted content, and the underlined part indicates the added content, the same below), that is, the last character "1" in the version 1 table is modified or replaced with "2" in the version 2 table. However, Spreadsheet Compare can only compare the overall changes in the data in the cell. 2020-02 ”, that is, the “2020-01” in the version 1 table is modified or replaced as a whole with “2020-02” in the version 2 table. This overall comparison method can only preliminarily prompt the user that the cell has changed, and the user needs to further compare the changes in the content. When there is a lot of content in the cell itself, comparing the cell content will significantly increase the user's operation.
[0006] In view of the above-mentioned defects of the prior art, the present application provides a table content comparison method and system, which first confirms the structural transformation of the data table and then makes a one-to-one comparison based on the position of the cell, that is, to judge the structural transformation of the data table, first clarify the basic row and column transformation, and then calculate the coordinates of the actual before and after versions of the cell according to the position transformation of the row and column changes, and finally compare the cells. For the data transformation inside the cell, you can first compare the whole, and after the first step of the overall comparison is completed, do a second comparison of the contents of the two versions before and after the transformed cell to further find more specific differences. When comparing the cells as a whole, first pack the contents of the cell into a single packing character, and then compare the changes in the cell by comparing the packing characters, so as to standardize the cell contents of different data amounts, so as to reduce or eliminate the impact of different cell content data amounts on subsequent processing.
[0007] The present application provides a table content comparison method, comprising: packing the content of a first cell in a first table into a first packed character, and packing the content of a second cell in a second table into a second packed character; comparing the first packed character and the second packed character; and judging the overall change of the second cell relative to the first cell based on the comparison result of the first packed character and the second packed character.
[0008] In some embodiments, optionally, the position of the first cell in the first table corresponds to the position of the second cell in the second table.
[0009] In some embodiments, optionally, the same content is packaged into the same packing character, and different content is packaged into different packing characters.
[0010] In some embodiments, optionally, the first packed character and the second packed character are both single characters.
[0011] In some embodiments, optionally, the overall change of the second cell relative to the first cell includes the addition, deletion or modification of the cell.
[0012] In some embodiments, optionally, it further includes: unpacking the first packed character to obtain the content of the first cell, and unpacking the second packed character to obtain the content of the second cell.
[0013] In some embodiments, optionally, if the overall change of the second cell relative to the first cell is modification, the first packed character is unpacked to obtain the content of the first cell, and the second packed character is unpacked to obtain the content of the second cell; and the content of the first cell and the content of the second cell are compared to obtain the content change of the second cell relative to the first cell.
[0014] In some embodiments, optionally, the content of the first cell and the content of the second cell are compared in the form of a string, wherein the first cell and the second cell respectively include a string consisting of one or more characters.
[0015] In some embodiments, optionally, the change in the content of the second cell relative to the first cell includes the addition, deletion or modification of characters contained in the cell content.
[0016] In some embodiments, optionally, a comparison result of the first cell and the second cell is output in combination with the content of the first cell, the content of the second cell, and the overall change and / or content change of the second cell relative to the first cell.
[0017] In some embodiments, optionally, if the overall change of the second cell relative to the first cell is a new addition, the content of the second cell obtained by unpacking the second packed character is displayed in the second cell, and an identifier indicating the new addition is marked in the second cell.
[0018] In some embodiments, optionally, if the overall change of the second cell relative to the first cell is deletion, the content of the first cell obtained by unpacking the first packaged character is displayed at the first cell, and an identifier indicating deletion is marked at the first cell.
[0019] In some embodiments, optionally, if the overall change of the second cell relative to the first cell is a modification, the content of the first cell obtained by unpacking the first packed character is displayed at the first cell, the content of the second cell obtained by unpacking the second packed character is displayed at the second cell, and an identifier indicating the modification is marked at the first cell and / or the second cell.
[0020] In some embodiments, optionally, based on the content change of the second cell relative to the first cell, an identifier for indicating the content change is marked at the changed characters in the content of the first cell and the content of the second cell, respectively.
[0021] In some embodiments, optionally, if the change in the content of the second cell relative to the first cell is the addition of characters, an identifier indicating the addition is placed at the newly added characters in the content of the second cell.
[0022] In some embodiments, optionally, if the change in the content of the second cell relative to the first cell is the deletion of a character, an indicator for indicating deletion is marked at the deleted character in the content of the first cell.
[0023] In some embodiments, optionally, if the change in the content of the second cell relative to the first cell is a modification of characters, an identifier for indicating deletion is marked at the modified characters in the content of the first cell, and an identifier for indicating new addition is marked at the modified characters in the content of the second cell.
[0024] In some embodiments, optionally, the first table includes at least one first table row consisting of one or more first cells, and the second table includes at least one second table row consisting of one or more second cells; the content of each first cell in the first table row is replaced with a corresponding first packed character to obtain a first packed table row consisting of one or more first packed characters, and the content of each second cell in the second table row is replaced with a corresponding second packed character to obtain a second packed table row consisting of one or more second packed characters; the first packed table row and the second packed table row are compared; and based on the comparison result of the first packed table row and the second packed table row, the change of the second table row relative to the first table row is determined.
[0025] In some embodiments, optionally, the position of the first table row in the first table corresponds to the position of the second table row in the second table.
[0026] In some embodiments, optionally, each cell in the first packing table row includes a first packing character, and each cell in the second packing table row includes a second packing character.
[0027] In some embodiments, optionally, the change of the second table row relative to the first table row includes one or more of the following: addition of an entire row; deletion of an entire row; replacement of an entire row; addition of a cell; deletion of a cell; or modification of a cell.
[0028] In some embodiments, optionally, a first packing table row and a second packing table row are compared in the form of strings, wherein the first packing table row includes a string consisting of one or more first packing characters, and the second packing table row includes a string consisting of one or more second packing characters.
[0029] In some embodiments, optionally, according to the arrangement order of one or more first cells in the first table row, one or more first packed characters corresponding to the first cells are combined into a string corresponding to the first packed table row; and according to the arrangement order of one or more second cells in the second table row, one or more second packed characters corresponding to the second cells are combined into a string corresponding to the second packed table row.
[0030] In some embodiments, optionally, if the change of the second table row relative to the first table row is that the entire row is added, a virtual table row is inserted into the first table, and the position of the virtual table row in the first table corresponds to the position of the second table row in the second table.
[0031] In some embodiments, optionally, if the change of the second table row relative to the first table row is deletion of the entire row, a virtual table row is inserted into the second table, and the position of the virtual table row in the second table corresponds to the position of the first table row in the first table.
[0032] In some embodiments, optionally, a virtual table row is composed of one or more virtual cells, each of which includes a virtual character.
[0033] In some embodiments, optionally, the first table includes at least one first table column consisting of one or more first cells, and the second table includes at least one second table column consisting of one or more second cells; the content of each first cell in the first table column is replaced with a corresponding first packed character to obtain a first packed table column consisting of one or more first packed characters, and the content of each second cell in the second table row is replaced with a corresponding second packed character to obtain a second packed table column consisting of one or more second packed characters; the first packed table column and the second packed table column are compared; and based on the comparison result of the first packed table column and the second packed table column, the change of the second table column relative to the first table column is determined.
[0034] In some embodiments, optionally, the position of the first column in the first table corresponds to the position of the second column in the second table.
[0035] In some embodiments, optionally, each cell in the first packing table column includes a first packing character, and each cell in the second packing table column includes a second packing character.
[0036] In some embodiments, optionally, the changes in the second table column relative to the first table column include one or more of the following: addition of an entire column; deletion of an entire column; replacement of an entire column; addition of a cell; deletion of a cell; or modification of a cell.
[0037] In some embodiments, optionally, the first packed list column and the second packed list column are compared in the form of strings, wherein the first packed list column includes a string consisting of one or more first packed characters, and the second packed list column includes a string consisting of one or more second packed characters.
[0038] In some embodiments, optionally, according to the arrangement order of one or more first cells in the first table column, one or more first packed characters corresponding to the first cells are combined into a string corresponding to the first packed table column; and according to the arrangement order of one or more second cells in the second table column, one or more second packed characters corresponding to the second cells are combined into a string corresponding to the second packed table column.
[0039] In some embodiments, optionally, if the change of the second table column relative to the first table column is that the entire column is added, a virtual table column is inserted into the first table, and the position of the virtual table column in the first table corresponds to the position of the second table column in the second table.
[0040] In some embodiments, optionally, if the change of the second table column relative to the first table column is deletion of the entire column, a virtual table column is inserted into the second table, and the position of the virtual table column in the second table corresponds to the position of the first table column in the first table.
[0041] In some embodiments, optionally, the virtual table column is composed of one or more virtual cells, and each virtual cell includes a virtual character.
[0042] In some embodiments, optionally, the first packed table column and the second packed table column are transposed into a first transposed table row and a second transposed table row, respectively; and the first transposed table row and the second transposed table row are compared to compare the first packed table column and the second packed table column.
[0043] In some embodiments, optionally, the first table includes one or more first cells arranged in rows and columns, and the second table includes one or more second cells arranged in rows and columns; the content of each first cell in the first table is replaced by the corresponding first packed character, thereby obtaining a first packed table composed of one or more first packed characters arranged in rows and columns, and the content of each second cell in the second table is replaced by the corresponding second packed character, thereby obtaining a second packed table composed of one or more second packed characters arranged in rows and columns; each corresponding row in the first packed table and the second packed table is compared to determine the row changes of the second table relative to the first table; the first packed table and the second packed table are transposed into a first transposed table and a second transposed table, respectively, wherein each row in the first transposed table and the second transposed table corresponds to each column in the first packed table and the second packed table, respectively; and each corresponding row in the first transposed table and the second transposed table is compared to determine the column changes of the second table relative to the first table.
[0044] In some embodiments, optionally, each cell in the first packing table includes a first packing character, and each cell in the second packing table includes a second packing character.
[0045] In some embodiments, optionally, changes in rows of the second table relative to the first table include one or more of the following: addition of an entire row; deletion of an entire row; replacement of an entire row; addition of cells; deletion of cells; modification of cells; and changes in columns of the second table relative to the first table include one or more of the following: addition of an entire column; deletion of an entire column; replacement of an entire column; addition of cells; deletion of cells; modification of cells.
[0046] In some embodiments, optionally, if the row change of the second table relative to the first table is that the entire row is added, a virtual table row is inserted into the first packed table, and the position of the virtual table row in the first packed table corresponds to the position of the newly added row in the second table.
[0047] In some embodiments, optionally, if the row change of the second table relative to the first table is the deletion of the entire row, a virtual table row is inserted into the second packed table, and the position of the virtual table row in the second packed table corresponds to the position of the deleted row in the first table.
[0048] In some embodiments, optionally, after inserting the virtual table row, the first packed table and the second packed table are transposed into a first transposed table and a second transposed table, respectively.
[0049] In some embodiments, optionally, if the column change of the second table relative to the first table is the addition of a whole column, that is, the row change of the second transposed table relative to the first transposed table is the addition of a whole row, then a row of virtual table rows is inserted into the first transposed table, and the position of the virtual table row in the first transposed table corresponds to the position of the newly added row in the second transposed table.
[0050] In some embodiments, optionally, if the column change of the second table relative to the first table is the deletion of the entire column, that is, the row change of the second transposed table relative to the first transposed table is the deletion of the entire row, then a virtual table row is inserted into the second transposed table, and the position of the virtual table row in the second transposed table corresponds to the position of the row deleted in the first transposed table.
[0051] In some embodiments, optionally, after inserting the virtual table row, the first transposed table and the second transposed table are transposed into the first comparison table and the second comparison table respectively; and each corresponding cell in the first comparison table and the second comparison table is compared.
[0052] In some embodiments, optionally, a virtual table row is composed of one or more virtual cells, and the content of each virtual cell includes a virtual character.
[0053] In some embodiments, optionally, when comparing between rows: if (delete_part-insert_part)>=(1-virtual_part), the row change is the deletion of the entire row; and / or if (insert_part-delete_part)>=(1-virtual_part), the row change is the addition of the entire row; wherein, delete_part=the total number of characters deleted in a row / the total number of characters in the row; insert_part=the total number of characters added in a row / the total number of characters in the row; virtual_part=(the total number of virtual characters in a row + the number of blank cells in the row) / the total number of characters in the row.
[0054] On the other hand, the present application also provides a table content comparison method for comparing the content changes of a second table relative to a first table, including: packing the cell content of each cell in the first table and the second table into corresponding packing characters, wherein the same cell content corresponds to the same packing character, and different cell content corresponds to different packing characters; replacing the cell content of each cell in the first table and the second table with the corresponding packing character, and obtaining a first packed table after replacing the first table and a second packed table after replacing the second table respectively; comparing whether the packing characters in the second packed table are the same as the corresponding packing characters in the first packed table, thereby obtaining a comparison result between the first packed table and the second packed table; and obtaining a comparison result between the first packed table and the second packed table based on the comparison result between the first packed table and the second packed table.
[0055] In some embodiments, optionally, each cell in the first packing table and the second packing table includes a packing character.
[0056] In some embodiments, optionally, when the comparison result of the first table and the second table is obtained, the packed characters are unpacked into corresponding cell contents.
[0057] In some embodiments, optionally, if the packed characters in the second packing table are different from the corresponding packed characters in the first packing table, the packed characters are unpacked into corresponding cell contents, and then the cell contents are compared.
[0058] In some embodiments, optionally, each corresponding row in the first packaged table and the second packaged table is compared to determine the change of rows in the second table relative to the first table.
[0059] In some embodiments, optionally, if the row change of the second table relative to the first table is that the entire row is added, a virtual table row is inserted into the first packed table, and the position of the virtual table row in the first packed table corresponds to the position of the newly added row in the second table.
[0060] In some embodiments, optionally, if the row change of the second table relative to the first table is the deletion of the entire row, a virtual table row is inserted into the second packed table, and the position of the virtual table row in the second packed table corresponds to the position of the deleted row in the first table.
[0061] In some embodiments, optionally, the first packed table and the second packed table are transposed into a first transposed table and a second transposed table, respectively, wherein each row in the first transposed table and the second transposed table corresponds to each column in the first packed table and the second packed table, respectively; and each corresponding row in the first transposed table and the second transposed table is compared to determine the column changes of the second table relative to the first table.
[0062] In some embodiments, optionally, if the column change of the second table relative to the first table is the addition of a whole column, that is, the row change of the second transposed table relative to the first transposed table is the addition of a whole row, then a row of virtual table rows is inserted into the first transposed table, and the position of the virtual table row in the first transposed table corresponds to the position of the newly added row in the second transposed table.
[0063] In some embodiments, optionally, if the column change of the second table relative to the first table is the deletion of the entire column, that is, the row change of the second transposed table relative to the first transposed table is the deletion of the entire row, then a virtual table row is inserted into the second transposed table, and the position of the virtual table row in the second transposed table corresponds to the position of the row deleted in the first transposed table.
[0064] In some embodiments, optionally, the first transposed table and the second transposed table are transposed into a first comparison table and a second comparison table respectively; and each corresponding cell in the first comparison table and the second comparison table is compared.
[0065] In some embodiments, optionally, a virtual table row is composed of one or more virtual cells, and the content of each virtual cell includes a virtual character.
[0066] In some embodiments, optionally, when comparing between rows: if (delete_part-insert_part)>=(1-virtual_part), the row change is the deletion of the entire row; and / or if (insert_part-delete_part)>=(1-virtual_part), the row change is the addition of the entire row; wherein, delete_part=the total number of characters deleted in a row / the total number of characters in the row; insert_part=the total number of characters added in a row / the total number of characters in the row; virtual_part=(the total number of virtual characters in a row + the number of blank cells in the row) / the total number of characters in the row.
[0067] In some embodiments, optionally, if the overall change of the cells in the second table relative to the cells in the first table is new additions, the cell content of the new cells obtained by unpacking the packed characters is displayed at the new cells in the second table, and an identifier is marked to indicate the new addition.
[0068] In some embodiments, optionally, if the overall change of the cells in the second table relative to the cells in the first table is deletion, the cell content of the deleted cell obtained by unpacking the packed characters is displayed at the deleted cell of the first table, and an identifier is marked to indicate deletion.
[0069] In some embodiments, optionally, if the overall change of the cells in the second table relative to the cells in the first table is modification, the packed characters in the first table and the second table are unpacked respectively to obtain the cell contents; and the cell contents in the first table and the cell contents in the second table are compared to obtain the content changes of the second table relative to the first table.
[0070] In some embodiments, optionally, the cell contents are displayed at the modified cells of the first table and the second table, respectively, and marked with an identifier indicating the modification.
[0071] On the other hand, the present application also provides a table content comparison system, including: a packing module, which is configured to pack the cell content of each cell in the table into corresponding packing characters, and to unpack the packed characters into corresponding cell contents, so that the overall change of the cell can be judged based on the comparison results of the packed characters.
[0072] In some embodiments, optionally, it further includes: a cell comparison module configured to compare the cell content of each corresponding cell in two tables to determine the change of the cell content.
[0073] In some embodiments, optionally, if the overall change status of the cell is modification, the cell content is compared by the cell comparison module.
[0074] In some embodiments, optionally, it further includes: a row comparison module, which is configured to compare each corresponding row in the two tables to determine the change of the rows of the two tables.
[0075] In some embodiments, optionally, the row comparison module is further configured to compare each corresponding row in the two tables by comparing character strings composed of packed characters, and determine the row change of the two tables according to the change of the packed characters.
[0076] In some embodiments, optionally, the row comparison module is configured to determine the row changes of two tables by the following method: if (delete_part-insert_part)>=(1-virtual_part), the row change is the deletion of the entire row; and / or if (insert_part-delete_part)>=(1-virtual_part), the row change is the addition of the entire row; wherein, delete_part=the total number of characters deleted in a row / the total number of characters in the row; insert_part=the total number of characters added in a row / the total number of characters in the row; virtual_part=(the total number of virtual characters in a row + the number of blank cells in the row) / the total number of characters in the row.
[0077] In some embodiments, optionally, it further includes: a virtual row filling module configured to fill virtual table rows into the two tables respectively according to the row changes of the two tables.
[0078] In some embodiments, optionally, each cell in the virtual table row includes a virtual character.
[0079] In some embodiments, optionally, if the row change of the two tables is the addition of a whole row, the virtual row filling module fills the virtual table row at the position in the original table corresponding to the newly added row in the new table.
[0080] In some embodiments, optionally, if the row change of the two tables is the deletion of the entire row, the virtual row filling module fills the virtual table rows into the positions in the new table corresponding to the rows deleted in the original table.
[0081] In some embodiments, optionally, the method further includes: a transposition module configured to be able to transpose rows and columns of a table to obtain a transposed table.
[0082] In some embodiments, optionally, the transposition module is further configured to be able to transpose the table after filling the virtual table rows to obtain a transposed table.
[0083] In some embodiments, optionally, the row comparison module is further configured to compare each corresponding row in the transposed tables of the two tables, and determine the column changes of the two tables by determining the row changes of the transposed tables of the two tables.
[0084] In some embodiments, optionally, if the row change of the transposed table of the two tables is the addition of a whole row, the virtual row filling module fills the virtual table row into the position in the transposed table of the original table corresponding to the newly added row in the transposed table of the new table.
[0085] In some embodiments, optionally, if the row change of the transposed table of the two tables is the deletion of the entire row, the virtual row filling module fills the virtual table rows into the positions in the transposed table of the new table corresponding to the rows deleted in the transposed table of the original table.
[0086] In some embodiments, optionally, the transposition module is further configured to be able to transpose the transposition tables of the two tables respectively to obtain the comparison tables of the two tables, so as to enable comparison of the comparison tables of the two tables.
[0087] In some embodiments, optionally, the transposition module is further configured to be able to transpose the transposed table after filling the virtual table rows to obtain the comparison table.
[0088] In some embodiments, optionally, the cell comparison module is further configured to compare each corresponding cell in the comparison table of the two tables.
[0089] In some embodiments, optionally, it further includes: an output module configured to output the comparison results of the two tables according to the comparison results of the two tables.
[0090] In some embodiments, optionally, the output module is further configured to display the comparison result of the two tables on a layout of a comparison table of the two tables.
[0091] In some embodiments, optionally, if the overall change of the cell is a new addition, the cell content of the new addition is displayed in the corresponding cell of the comparison table of the new table, and an identifier indicating the new addition is marked.
[0092] In some embodiments, optionally, if the overall change status of a cell is deletion, the cell content of the deleted cell is displayed in a corresponding cell of the comparison table of the original table, and an indicator for indicating deletion is marked.
[0093] In some embodiments, optionally, if the overall change of the cell is modification, the respective cell contents are displayed in the corresponding cells of the comparison table of the original table and the new table, and are marked with an identifier indicating the modification.
[0094] In some embodiments, optionally, if a cell in the comparison table is a virtual cell, the cell content is displayed as empty.
[0095] On the other hand, the present application also provides a table content comparison device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor, and the processor is configured to implement the steps of the above-mentioned table content comparison method when executing the computer program.
[0096] On the other hand, the present application also provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the above-mentioned table content comparison method can be implemented.
[0097] The table content comparison method and system provided by the present application have at least the following advantages over the prior art:
[0098] (1) Pack cells into single characters to reduce the impact of multiple characters in cells on subsequent processing such as judgment of data table structure changes.
[0099] (2) Filling in virtual rows and columns makes the judgment of the data table structure more accurate.
[0100] (3) Secondary comparison and judgment of the data in the cell enables it to more clearly show the data change points.
[0101] Compared with traditional manual data comparison or one-to-one comparison of cells, the table content comparison method and system provided in this application can more accurately find the changes between two versions of data tables, greatly improve the efficiency and accuracy of data comparison, and significantly reduce labor costs.
[0102] The concept, specific structure and technical effects of the present application will be further described below in conjunction with the accompanying drawings to fully understand the purpose, characteristics and effects of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0103] The present application will be more readily understood when the following detailed description is read in conjunction with the accompanying drawings, in which like reference numerals represent like parts throughout, and in which:
[0104] Figure 1 is a schematic diagram of an embodiment of a table in the present application.
[0105] Figure 2Ais a schematic diagram of an embodiment of the first table in this application, Figure 2B is a schematic diagram of an embodiment of the second table in this application, Figure 2C It is a schematic diagram of an embodiment of the comparison result of the first table and the second table in the present application.
[0106] Figure 3A is a schematic diagram of an embodiment of the first packaging table in this application, Figure 3B is a schematic diagram of an embodiment of the second packaging table in this application, Figure 3C is a schematic diagram of an embodiment of the first transposition table in the present application, Figure 3D It is a schematic diagram of an embodiment of the second transposition table in the present application.
[0107] Figure 4A is a schematic diagram of an embodiment of the first packaging table in this application, Figure 4B is a schematic diagram of an embodiment of the second packaging table in this application, Figure 4C is a schematic diagram of an embodiment of the first row filling table in this application, Figure 4D It is a schematic diagram of an embodiment of the second row filling table in the present application.
[0108] Figure 5A is a schematic diagram of an embodiment of the first packaging table in this application, Figure 5B is a schematic diagram of an embodiment of the second packaging table in this application, Figure 5C is a schematic diagram of an embodiment of the first transposition table in the present application, Figure 5D is a schematic diagram of an embodiment of the second transposition table in the present application, Figure 5E is a schematic diagram of an embodiment of the first column filling table in this application, Fig. 5F is a schematic diagram of an embodiment of the second column filling table in this application, Figure 5G is a schematic diagram of an embodiment of the first comparison table in this application, Figure 5H It is a schematic diagram of an embodiment of the second comparison table in this application.
[0109] Fig. 6A is a schematic diagram of an embodiment of converting the first comparison table and the second comparison table into multiple lines of text for comparison in the present application, Figure 6B is a schematic diagram of an embodiment of the comparison result of the first comparison table and the second comparison table in the present application, Figure 6C It is a schematic diagram of an embodiment of marking according to the comparison result in the present application.
[0110] Fig. 7A is a schematic diagram of an embodiment of the first table 710 in this application, Figure 7Bis a schematic diagram of an embodiment of the second table 720 in the present application, Figure 7C is a schematic diagram of an embodiment of the first packaging table 730 in the present application, Fig.7D is a schematic diagram of an embodiment of the second packaging table 740 in the present application, Fig. 7E is a schematic diagram of an embodiment of the first transposition table in the present application, Figure 7F is a schematic diagram of an embodiment of the second transposition table in the present application, Figure 7G is a schematic diagram of an embodiment of judging the change of a column in the present application, Figure 7H is a schematic diagram of an embodiment of the second comparison table in this application, Fig.7I is a schematic diagram of an embodiment of the comparison result of the packed characters in the present application, Figure 7J It is a schematic diagram of an embodiment of the final comparison result in this application.
[0111] Figure 8 It is a structural diagram of an embodiment of a computer device, equipment or terminal in the present application. DETAILED DESCRIPTION
[0112] The technical solutions in the embodiments of the present application will be described clearly and completely below. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. The present application can be embodied by many different forms of embodiments, and the protection scope of the present application is not limited to the embodiments mentioned in the text. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work should belong to the scope of protection of the present application.
[0113] Technologies, methods, and apparatus known to ordinary technicians in the relevant art may not be discussed in detail, but where appropriate, these technologies, methods, and apparatus should be considered part of the specification.
[0114] Various specific embodiments of the present application will be described below with reference to the accompanying drawings that form a part of this specification. It should be understood that although terms indicating directions are used in this application, such as "front", "back", "up", "down", "left", "right", "inside", "outside", "top", "bottom", "positive", "negative", "near", "far", "lateral", "longitudinal", "width direction", "length direction", "height direction", "axial", "radial", "clockwise", "counterclockwise", etc., to describe various example structural parts and elements of the present application, these terms are used here only for the purpose of convenience of description, and these terms are determined based on the exemplary orientations shown in the accompanying drawings. The embodiments disclosed in the present application can be set in different directions, so these terms indicating directions are only for illustration and should not be regarded as limitations.
[0115] For the convenience of description, the connection relationship between the modules or parts shown in the drawings is only an exemplary description, and those skilled in the art can adopt other equivalent connection relationships, as long as the modules or parts can also realize the functions of the technical solution of the present application under such connection relationships. The embodiments disclosed in the present application can be arranged according to different equivalent connection relationships, so the connection relationships shown in the drawings and the relevant contents of the specification are only for illustration and should not be regarded as limitations.
[0116] The size of each component shown in the drawings is arbitrarily shown, and the present application does not limit the specific size of each component unless there is a clear record or description in the specification and drawings. In order to make the illustration clearer, the size of the components in some places in the drawings is appropriately exaggerated or the corresponding proportional relationship is adjusted.
[0117] Ordinal numbers such as "first" and "second" used in this application are only used for distinction and identification, and do not have any other meanings. If not specifically specified, they do not indicate a specific order or have a specific association. For example, the term "first component" itself does not imply the existence of the "second component", and the term "second component" itself does not imply the existence of the "first component".
[0118] The singular forms of "a", "said" and "the" used in this application are intended to include both singular and plural forms, unless the context clearly indicates otherwise. "Multiple" or "a plurality" generally include at least two or more. The term "and / or" used in this application is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this application generally indicates that the associated objects before and after are in an "or" relationship.
[0119] The terms "comprises", "includes" or any other variation thereof are intended to cover non-exclusive inclusion, so that a process, method, article or apparatus that includes a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or apparatus. In the absence of more restrictions, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or apparatus that includes the element.
[0120] The technical solution of this application is used for comparing the content of tables, that is, to compare what changes have occurred in the content of two tables. Unless otherwise specified below, the "first table" refers to the original table (or the original table, the table before modification, etc.), and the "second table" refers to the new table (or the new table, the modified table, etc.). The technical solution of this application is used to compare the first table and the second table, or rather, to compare what changes the second table has made relative to the first table.
[0121] The "table" in this application is composed of one or more cells arranged in a row and column position relationship. In some embodiments, the first table may include cells with M rows and N columns, that is, each row includes N cells and each column includes M cells, where both M and N are natural numbers; the second table may include cells with X rows and Y columns, that is, each row includes X cells and each column includes Y cells, where both X and Y are natural numbers.
[0122] Figure 1 It is a schematic diagram of an embodiment of table 100 in this application. As Figure 1 shown, table 100 includes a total of 12 cells with 4 rows and 3 columns. To facilitate the distinction of cells in different positions, different columns are represented by letters such as A, B, C, etc., different rows are represented by numbers such as 1, 2, 3, 4, etc., and the identifiers of columns and rows are combined to represent cells in different positions. For example: The A1 cell represents the cell at the position of the first row in the first column, and the B3 cell represents the cell at the position of the third row in the second column, etc. In some embodiments, table 100 may also have other numbers of rows and columns. The cell at the position of the xth row and the yth column can be represented as the yx cell, where y can be a letter or a combination of letters, and x can be a natural number.
[0123] Figure 2A It is a schematic diagram of an embodiment of the first table 210 in this application, Figure 2B It is a schematic diagram of an embodiment of the second table 220 in this application. As Figure 2A shown, the first table 210 includes a total of 4 cells with 1 row and 4 columns, and the cell contents are "Fei Liu", "Zhi Xia", "San", and "Qian Chi" respectively. As Figure 2B shown, the second table 220 includes a total of 4 cells with 1 row and 4 columns, and the cell contents are "Fei", "Liu Zhi Xia", "San", and "" (the cell content is empty) respectively.
[0124] In some embodiments, the changes in a table can be determined by converting the data or content included in the table into text and comparing based on the text. In this embodiment, the content included in the first table 210 becomes "The torrent dashes down three thousand feet" after being converted into text, and the content included in the second table 220 becomes "The torrent dashes down three" after being converted into text. By comparing these two texts, it can be known that the first table 210 and the second table 220 are different, and the second table 220 has changed or been modified relative to the first table 210. For a table containing multiple rows, the content of each row can be separately converted into text, so as to convert the table into multiple lines of text and then compare.
[0125] After converting the table into text, the constraints of the cells are lost, which will have a certain impact on the comparison result. In this embodiment, the contents of cell A1 of the first table 210 and the second table 220 are different, which are "The torrent" and "The fly" respectively. However, due to the loss of the restriction of the cell boundary when converting to text, it is difficult to compare each cell separately.
[0126] In some embodiments, the boundary of the cell can be marked by adding a delimiter when converting into text and then comparing. For example: adding the symbol "-" as the delimiter, the first table 210 becomes "The torrent - dashes down - three - thousand feet" after being converted into text, and the second table 220 becomes "The fly - dashes down - three -" after being converted into text. In this way, by using the symbol "-" to separate and mark the boundary of the cell, the changes in each cell can be compared. After the comparison is completed, the original table structure can be restored.
[0127] This method of comparing by adding a delimiter is restricted in some embodiments. For example:
[0128] (1) If there is a character in the original cell content that is the same as the delimiter, for example, the original cell content itself contains "-", then there will be problems in the subsequent comparison process, and errors will also occur in the process of restoring to the original table.
[0129] (2) Different comparison algorithms may recognize different delimiter characters. If a certain comparison algorithm cannot recognize a specific delimiter character, the delimiter character will be treated as ordinary text, and the generality is limited.
[0130] (3) It is difficult to process cells with empty content. For example: if the contents of several consecutive cells are all empty, the converted text may become consecutive delimiter symbols "---", which is difficult to process.
[0131] This application provides a method for comparing table content, which may include the following steps:
[0132] Step 1: Pack the content of the first cell in the first table into a first packing character, and pack the content of the second cell in the second table into a second packing character. The position of the first cell in the first table corresponds to the position of the second cell in the second table. The same content is packed into the same packing character, and different content is packed into different packing characters. In some embodiments, the first packing character and the second packing character are both single characters.
[0133] Step 2: compare the first packaged character and the second packaged character.
[0134] Step 3: According to the comparison result of the first packaged character and the second packaged character, determine the overall change of the second cell relative to the first cell. If the first packaged character and the second packaged character are the same, it means that the second cell has not changed relative to the first cell; conversely, if the first packaged character and the second packaged character are different, it means that the second cell has changed relative to the first cell. In some embodiments, the overall change of the second cell relative to the first cell may include the addition, deletion or modification of the cell.
[0135] In some embodiments, the first table may include at least one first table row consisting of one or more first cells, and the second table may include at least one second table row consisting of one or more second cells. The table content comparison method provided in the present application may include the following steps:
[0136] Step 1: Replace the content of each first cell in the first table row with the corresponding first packing character, thereby obtaining a first packing table row consisting of one or more first packing characters, and replace the content of each second cell in the second table row with the corresponding second packing character, thereby obtaining a second packing table row consisting of one or more second packing characters. The position of the first table row in the first table corresponds to the position of the second table row in the second table. Each cell in the first packing table row includes a first packing character, and each cell in the second packing table row includes a second packing character.
[0137] Step 2: Compare the first packing table row and the second packing table row. In some embodiments, the first packing table row and the second packing table row can be compared in the form of a string, wherein the first packing table row includes a string consisting of one or more first packing characters, and the second packing table row includes a string consisting of one or more second packing characters. According to the arrangement order of the one or more first cells in the first table row, one or more first packing characters corresponding to the first cells are combined into a string corresponding to the first packing table row.
[0138] According to the arrangement order of the one or more second cells in the second table row, one or more second packed characters corresponding to the second cells are combined into a character string corresponding to the second packed table row.
[0139] Step 3: According to the comparison result of the first packed table row and the second packed table row, determine the change of the second table row relative to the first table row. In some embodiments, the change of the second table row relative to the first table row may include one or more of the following: adding a whole row; deleting a whole row; replacing a whole row; adding a cell; deleting a cell; or modifying a cell.
[0140] Similarly, the columns in the table may be compared separately. In some embodiments, the first table includes at least one first table column consisting of one or more first cells, and the second table includes at least one second table column consisting of one or more second cells. The table content comparison method provided in the present application may include the following steps:
[0141] Step 1: Replace the content of each first cell in the first table column with the corresponding first packing character, thereby obtaining a first packing table column consisting of one or more first packing characters, and replace the content of each second cell in the second table row with the corresponding second packing character, thereby obtaining a second packing table column consisting of one or more second packing characters. The position of the first table column in the first table corresponds to the position of the second table column in the second table. Each cell in the first packing table column includes a first packing character, and each cell in the second packing table column includes a second packing character.
[0142] Step 2: Compare the first packed list column and the second packed list column. In some embodiments, the first packed list column and the second packed list column can be compared in the form of strings, wherein the first packed list column includes a string composed of one or more first packed characters, and the second packed list column includes a string composed of one or more second packed characters. According to the arrangement order of the one or more first cells in the first list column, one or more first packed characters corresponding to the first cells are combined into a string corresponding to the first packed list column.
[0143] According to the arrangement order of the one or more second cells in the second table column, one or more second packed characters corresponding to the second cells are combined into a character string corresponding to the second packed table column.
[0144] Step 3: Based on the comparison result of the first packaged list and the second packaged list, determine the change of the second list relative to the first list. In some embodiments, the change of the second list relative to the first list includes one or more of the following: adding a whole column; deleting a whole column; replacing a whole column; adding a cell; deleting a cell; or modifying a cell.
[0145] In some embodiments, after comparing and determining the overall changes in the cells, the first packed characters may be unpacked to obtain the content of the first cell, and the second packed characters may be unpacked to obtain the content of the second cell, thereby restoring the content of the original table.
[0146] In some embodiments, on the basis of restoring the original table content, the content of the changed cells may be further compared a second time to obtain more specific changes in the cell content.
[0147] If the overall change of the second cell relative to the first cell is modification, the first packaged character is unpacked to obtain the content of the first cell, and the second packaged character is unpacked to obtain the content of the second cell; and the content of the first cell and the content of the second cell are compared to obtain the content change of the second cell relative to the first cell. In some embodiments, the content of the first cell and the content of the second cell are compared in the form of a string, wherein the first cell and the second cell respectively include a string consisting of one or more characters. The content change of the second cell relative to the first cell may include the addition, deletion or modification of the characters contained in the cell content.
[0148] In some embodiments, the comparison result may also be output or displayed in a specific form according to different changes in the cell content.
[0149] The comparison result between the first cell and the second cell is outputted based on the content of the first cell, the content of the second cell, and the overall change and / or content change of the second cell relative to the first cell.
[0150] If the overall change of the second cell relative to the first cell is new addition, the content of the second cell obtained by unpacking the second packed character is displayed in the second cell, and an identifier indicating new addition is marked in the second cell.
[0151] If the overall change of the second cell relative to the first cell is deletion, the content of the first cell obtained by unpacking the first packed character is displayed at the first cell, and an identifier indicating deletion is marked at the first cell.
[0152] If the overall change of the second cell relative to the first cell is modification, the content of the first cell obtained by unpacking the first packed character will be displayed at the first cell, the content of the second cell obtained by unpacking the second packed character will be displayed at the second cell, and an identifier indicating the modification will be marked at the first cell and / or the second cell.
[0153] In some embodiments, based on the content change of the second cell relative to the first cell, an identifier for indicating the content change may be marked at the changed characters in the content of the first cell and the content of the second cell.
[0154] If the change in the content of the second cell relative to the first cell is the addition of characters, then the newly added characters in the content of the second cell are marked with a flag indicating the addition. If the change in the content of the second cell relative to the first cell is the deletion of characters, then the deleted characters in the content of the first cell are marked with a flag indicating the deletion. If the change in the content of the second cell relative to the first cell is the modification of characters, then the modified characters in the content of the first cell are marked with a flag indicating the deletion, and the modified characters in the content of the second cell are marked with a flag indicating the addition.
[0155] exist Figure 2A and 2B In the embodiment of the present invention, the first table 210 can be packaged according to the corresponding relationship in the following table:
[0156] Cell content Packing Characters A1 Flying Stream A B1 straight down B C1 three C D1 Thousand feet D
[0157] Thus, the first packing table row "ABCD" consisting of the first packing character is obtained.
[0158] The second table 220 can be packaged according to the corresponding relationship in the following table:
[0159] Cell content Packing Characters A1 fly E B1 flow down F C1 three C D1 (empty cell) G
[0160] Thus, a second packing table row "EFCG" consisting of the second packing characters is obtained.
[0161] The contents of the C1 cells of the first table 210 and the second table 220 are both “three”, so the cells correspond to the same packing character “C”; the contents of the other cells are different, and thus correspond to different packing characters respectively.
[0162] Then the first packed table row "ABCD" and the second packed table row "EFCG" can be compared. Through this comparison, it can be found that in the second table 220, compared with the first table 210, the A1 cell changes from A to E, the B1 cell changes from B to F, the C1 cell remains unchanged from C, and the D1 cell changes from D to G. Therefore, the changes of the second table 220 compared with the first table 210 are: the A1 cell, the B1 cell, and the D1 cell have changed; the C1 cell has not changed.
[0163] In some embodiments, if the cells with empty contents are preset to correspond to fixed packing characters, it is possible to further determine whether the cell change is addition or deletion. For example, if the packing character "G" is preset to represent an empty cell, it is possible to further determine in this embodiment that the change of the D1 cell is deletion.
[0164] Then, the cell contents can be restored by unpacking the packed characters, and the comparison results can be output in a specific form. Among them, for the A1 and B1 cells that have changed but are neither added nor deleted, the cell contents can be compared again after unpacking.
[0165] Figure 2C FIG. 2 is a schematic diagram of an embodiment of the comparison result of the first table 210 and the second table 220 in the present application. Figure 2C As shown, different marks can be used to indicate different changes. In this embodiment, a strikethrough indicates deleted content, and an underline indicates newly added content.
[0166] In some embodiments, cells may be further marked with different colors to more prominently show different changes in cells. For example, as an embodiment, deleted cells are marked in red, newly added cells are marked in green, cells with modified content are marked in blue, and unchanged cells are marked in white.
[0167] In some embodiments, the output comparison results can be presented in HTML, for example, by presenting the comparison results as described above through various tags, colors or formats. HTML is called Hypertext Markup Language, which is an identification language. It can include a series of tags, through which the document format on the network can be unified, so that scattered Internet resources can be connected into a logical whole. HTML text is a descriptive text composed of HTML commands, which can describe text, graphics, animations, sounds, tables, links, etc.
[0168] In the above method, the content of each cell can be packaged into a whole character, and then the whole character can be compared to find the basic cell transformation relationship. After the transformation relationship is found, the whole mapped character is unpacked to get the final comparison result. In this way, the cell boundary can be identified without adding separator characters, so that the comparison can be performed effectively. All kinds of comparison algorithms can be applied, with good versatility, and empty cells can be processed simply and efficiently.
[0169] In some embodiments, the specific packaging steps can be implemented as follows:
[0170] (1) Establish a global mapping dictionary table (such as a hash table HashMap) globalMap, where the globalMap table can include multiple pairs of key values (key) and content values (value) with a one-to-one correspondence. A hash table is a data structure that is directly accessed based on a key code value (key-value), that is, it can access records by mapping the key code value to a position in the table, thereby speeding up the search. This mapping function can be called a hash function, and the array that stores records can be called a hash table.
[0171] (2) Traverse the cell data between the two version data tables in sequence, where:
[0172] (i) If the data in the cell does not exist in the globalMap (i.e., the same content value is not found), a unique character that does not exist in the globalMap is created (i.e., a different packed character is created) as the key of the globalMap, and the cell data is inserted into the globalMap as the value, and the key is used to replace the data in the cell, thereby establishing a one-to-one key-value pairing relationship in the globalMap.
[0173] (ii) If the data in the cell already exists in the globalMap (i.e., the same content value is found), the key corresponding to the data value is obtained and used as the packing character to replace the data in the cell.
[0174] After packing the cell contents and comparing them, there are three situations for the data changes of a certain cell:
[0175] (1) Delete a cell, that is, delete the content of the original cell and turn it into a cell with empty content.
[0176] (2) Add a new cell. The original cell is empty. New content is added to make the cell non-empty.
[0177] (3) Modifying a cell means modifying the content of the original cell. It can also be considered as deleting the content of the original cell and then adding new content, or replacing the original content with the new content.
[0178] For the above cases (1) and (2), the comparison results can be directly output. For the above case (3), if the actual situation is that the content in the cell has partially changed, it will appear that the entire content has been deleted and then newly added. At this time, a second comparison can be made on the content inside the cell.
[0179] In some embodiments, two strings can be compared by Myers algorithm. Myers algorithm is a difference algorithm that can be used to solve the problem of finding the longest common subsequence and the shortest edit script of two sequences A and B. Two texts A and B are input, and the modification steps of transforming text A to text B with the least change can be obtained by Myers algorithm. For more details of Myers algorithm, please refer to the paper "Eugene W.Myers, An O(ND) Difference Algorithmand Its Variations, Algorithmica, 1986, 1(1-4): 251-266", which is hereby introduced into this application and made a part of the specification.
[0180] As an example, for the transformation of text 1 "ABCABBA" to text 2 "CBABAC", the Myers algorithm can be used to compare text 1 and text 2, and the comparison result can be returned: (-1, 'A'), (1, 'C'), (0, 'B'), (-1, 'C'), (0, 'AB'), (-1, 'B'), (0, 'A'), (1, 'C'), where -1 indicates deletion, 1 indicates addition, and 0 indicates unchanged. That is, from text 1 to text 2, the modification steps are: delete A, add C, keep B unchanged, delete C, keep AB unchanged, delete B, keep A unchanged, and add C.
[0181] In some embodiments, the table to be compared may contain multiple rows, and each row may be converted into a string consisting of packed characters by packing, thereby converting the table containing multiple rows into multiple lines of text. Then, by comparing the multiple lines of text, the change of the row and / or the change of the cell can be obtained. The change of the row may include: adding a new row, deleting a row, etc.
[0182] In some embodiments, multiple lines of text may be compared via the diff_match_patch method.
[0183] diff_match_patch is an open source Myers algorithm implementation library that can be used to compare multiple lines of text to find the differences between multiple lines of text. For more detailed content and source code of the diff_match_patch method, please refer to the relevant documents in the open source community (open source community link https: / / github.com / google / diff-match-patch). The relevant content, description documents and source code of the diff_match_patch method in the open source community are introduced into this application and serve as part of the specification.
[0184] As an example, text 1 is the following three lines of text:
[0185] Purple smoke from the incense burner in the sun
[0186] Watching the waterfall hanging in front of the river
[0187] The waterfall drops three thousand feet
[0188] Text 2 consists of the following three lines of text:
[0189] Watching the waterfall hanging in front of the river
[0190] The waterfall drops three hundred feet
[0191] I suspect it is the Milky Way falling for seven days
[0192] By comparing text 1 and text 2 using the diff_match_patch method, we can get the following comparison results:
[0193]
[0194] Watching the waterfall hanging in front of the river
[0195] Three Hundred ruler
[0196] I suspect it is the Milky Way falling for seven days
[0197] Among them, the deleted content is indicated by the deleted content, and the underline is indicated by the added content. That is, from text one to text two, the modification steps are: delete the first line "The sun shines on the incense burner and produces purple smoke", keep the second line "Looking at the waterfall hanging in front of the river from a distance" unchanged, change the "thousand" in the third line "The waterfall falls straight down three thousand feet" to "hundred", and finally add a new line "It seems that the Milky Way falls for seven days".
[0198] Similarly, in some embodiments, the table to be compared may contain multiple columns, and each column may be converted into a string consisting of packed characters by packing, thereby converting the table containing multiple columns into multiple columns of text. Then, by comparing the multiple columns of text, the changes in the columns and / or the changes in the cells are obtained. The changes in the columns may include: adding new columns, deleting columns, etc.
[0199] By comparing the rows and columns respectively, the changes in the rows and columns of the table can be obtained respectively. In some embodiments, different comparison methods or algorithms can be used to compare the rows and columns respectively. In other embodiments, in order to further save research and development resources and computing resources, the columns can also be converted into rows first, and then the comparison method or algorithm used for comparing rows can be used for comparison.
[0200] In some embodiments, the first packed table column and the second packed table column can be transposed into a first transposed table row and a second transposed table row, respectively; the first transposed table row and the second transposed table row are compared to compare the first packed table column and the second packed table column, and the change of the second transposed table row relative to the first transposed table row reflects the change of the second packed table column relative to the first packed table column.
[0201] In some embodiments, the first table may include one or more first cells arranged in rows and columns, and the second table may include one or more second cells arranged in rows and columns. The table content comparison method provided in the present application may include the following steps:
[0202] Step 1: Replace the content of each first cell in the first table with a corresponding first packed character, thereby obtaining a first packed table consisting of one or more first packed characters arranged in rows and columns, and replace the content of each second cell in the second table with a corresponding second packed character, thereby obtaining a second packed table consisting of one or more second packed characters arranged in rows and columns. In some embodiments, each cell in the first packed table includes a first packed character, and each cell in the second packed table includes a second packed character.
[0203] Step 2: Compare each corresponding row in the first packaged table and the second packaged table to determine the row changes of the second table relative to the first table. The row changes of the second table relative to the first table may include one or more of the following: adding a whole row; deleting a whole row; replacing a whole row; adding a cell; deleting a cell; or modifying a cell.
[0204] Step three: transpose the first packing table and the second packing table into a first transposed table and a second transposed table respectively, wherein each row in the first transposed table and the second transposed table corresponds to each column in the first packing table and the second packing table respectively.
[0205] Step 4: Compare each corresponding row in the first transposed table and the second transposed table to determine the column changes of the second table relative to the first table. The column changes of the second table relative to the first table may include one or more of the following: adding a whole column; deleting a whole column; replacing a whole column; adding a cell; deleting a cell; or modifying a cell.
[0206] Figure 3A is a schematic diagram of an embodiment of the first packaging table 310 in the present application, Figure 3B is a schematic diagram of an embodiment of the second packaging table 320 in the present application, Figure 3C is a schematic diagram of an embodiment of the first transposition table 330 in the present application, Figure 3D is a schematic diagram of an embodiment of the second transposition table 340 in the present application.
[0207] like Figure 3A and 3B As shown, the first packed table 310 and the second packed table 320 are tables after cell packing, each containing 4 rows and 4 columns.
[0208] From the perspective of columns, the change of the second packaged table 320 relative to the first packaged table 310 is that after deleting the entire C column data (C1-C4), a new column of data (E1-E4) is added on the far right. However, from the perspective of rows, for example, the data in row 3 has changed from A3B3C3C3 to A3B3C3E3. According to the method of comparing rows, the comparison result is that the last C3 has changed to E3, which cannot reflect the change of columns.
[0209] like Figure 3C and 3D As shown, in this embodiment, the first packing table 310 can be rotated 90 degrees counterclockwise (i.e., transposed) to obtain a first transposed table 330, and the columns in the first packing table 310 become the rows in the first transposed table 330. Similarly, the second packing table 320 can be rotated 90 degrees counterclockwise (i.e., transposed) to obtain a second transposed table 340, and the rows in the second packing table 320 become the rows in the second transposed table 340.
[0210] Then, the first transposed table 330 and the second transposed table 340 can be compared using a row comparison method or algorithm, so as to obtain the following changes of the second transposed table 340 relative to the first transposed table 330: after deleting the entire third row of data (C1-C4), a new row of data (E1-E4) is added at the bottom.
[0211] Since the rows in the first transposed table 330 and the second transposed table 340 are derived from the columns in the first packed table 310 and the second packed table 320, the changes in the rows of the first transposed table 330 and the second transposed table 340 represent the changes in the columns of the first packed table 310 and the second packed table 320. In some embodiments, the first transposed table 330 and the second transposed table 340 may be transposed again to restore and output the comparison result.
[0212] The inventors have discovered through long-term practice and a large number of tests that changes in table rows will affect comparisons of columns, and vice versa. Figure 4A is a schematic diagram of an embodiment of the first packaging table 410 in the present application, Figure 4B is a schematic diagram of an embodiment of the second packaging table 420 in the present application, Figure 4C is a schematic diagram of an embodiment of the first row filling table 430 in the present application, Figure 4D 4 is a schematic diagram of an embodiment of the second row filling table 440 in the present application.
[0213] like Figure 4A and 4B As shown, the first packed table 410 and the second packed table 420 are tables after cell packing, each containing 5 rows and 4 columns.
[0214] From the perspective of rows, the change of the second packaged table 420 relative to the first packaged table 410 is that after deleting the entire second row of data (A2-D2), a new row of data (A6-D6) is added at the bottom.
[0215] If you directly compare the columns using the method of transposing first and then comparing, the changes in column A are: from A1A2A3A4A5 to A1A3A4A5A6. In this case, the deleted A2 and the newly added A6 will affect the judgment of the comparison result, and it is difficult to distinguish whether a row is deleted and a new row is added, or every cell except A1 has changed. In addition, when there are more changes in the rows (for example: deleting and / or adding more rows), the impact is greater, and it is more difficult to accurately distinguish and judge.
[0216] In some embodiments, the table content comparison method provided by the present application can introduce a virtual row mechanism to mark a row as a filled or deleted row. When a row is deleted or added, a virtual table row is filled in the corresponding position to reduce the impact of row changes on column comparison.
[0217] In some embodiments, if the change of the second table row relative to the first table row is the addition of the entire row, a virtual table row is inserted into the first table, and the position of the virtual table row in the first table corresponds to the position of the second table row in the second table. If the change of the second table row relative to the first table row is the deletion of the entire row, a virtual table row is inserted into the second table, and the position of the virtual table row in the second table corresponds to the position of the first table row in the first table. The virtual table row may be composed of one or more virtual cells, and each virtual cell includes a virtual character.
[0218] like Figure 4C and 4D As shown, when it is found through row comparison that the change of the second packed table 420 relative to the first packed table 410 is that after the entire second row of data (A2-D2) is deleted, a new row of data (A6-D6) is added at the bottom, then a virtual table row is filled at the position of the second row (i.e., the deleted row) of the second packed table 420, thereby obtaining the second row filled table 440; and a virtual table row is filled at the position of the sixth row (i.e., the newly added row at the bottom) of the first packed table 410, thereby obtaining the first row filled table 430.
[0219] Each cell in the filled virtual table row is a virtual cell, and each virtual cell includes a virtual character. In the second row filling table 440, the second row is a virtual table row, and its filling data is A2', B2', C2', D2', all of which are virtual characters; in the first row filling table 430, the sixth row is a virtual table row, and its filling data is A6', B6', C6', D6', all of which are virtual characters. In some embodiments, these virtual characters can be the same characters.
[0220] At this time, the columns of the first row of the table 430 and the second row of the table 440 are compared according to the method of first transposing and then comparing the rows, and the change of the A column is: from A1A2A3A4A5A6' to A1A2'A3A4A5A6. Among them, A6' and A2' are virtual characters, so the change can be accurately judged: from A2 to A2', it means that A2 is deleted, and from A6' to A6, it means that A6 is added.
[0221] In this embodiment, the first row filling table 430 and the second row filling table 440 after row filling are transposed, and can be compared by the diff_match_patch method to obtain a set of data change sequences. For example, the comparison result of the above-mentioned column A is: (0, A1), (-1, A2), (1, A2'), (0, A3-A4-A5), (-1, A6'), (1, A6), where -1 indicates deletion, 1 indicates addition, and 0 indicates unchanged.
[0222] In some embodiments, when using the diff_match_patch method for comparison, the change in the row can be determined by one or more parameters including the number of characters deleted, the number of characters added, the number of virtual characters, the number of blank cells, and the total number of characters in the row.
[0223] As an embodiment, a method for determining a row change includes:
[0224] If (delete_part-insert_part)>=(1-virtual_part), the row change is the deletion of the entire row;
[0225] If (insert_part-delete_part)>=(1-virtual_part), the row change is the addition of the entire row;
[0226] In other cases, it can be assumed that there is no whole row deletion or whole row addition.
[0227] Where, delete_part = the total number of characters deleted in a row / the total number of characters in the row;
[0228] insert_part = total number of characters added in a row / total number of characters in the row;
[0229] virtual_part=(total number of virtual characters in a row+number of blank cells in the row) / total number of characters in the row.
[0230] The total number of characters deleted in a row can be obtained by counting the number of characters marked with "-1" in the comparison results; the total number of characters added in a row can be obtained by counting the number of characters marked with "1" in the comparison results; the total number of virtual characters in a row, the number of blank cells in the row, and the total number of characters in the row can all be obtained by analyzing and counting the character string corresponding to the row.
[0231] Similar to inserting a virtual table row, in some embodiments, if the change of the second table column relative to the first table column is the addition of the entire column, a virtual table column is inserted into the first table, and the position of the virtual table column in the first table corresponds to the position of the second table column in the second table. If the change of the second table column relative to the first table column is the deletion of the entire column, a virtual table column is inserted into the second table, and the position of the virtual table column in the second table corresponds to the position of the first table column in the first table. The virtual table column can be composed of one or more virtual cells, and each virtual cell includes a virtual character.
[0232] For the entire table, in some embodiments, if the row change of the second table relative to the first table is the addition of a whole row, a row of virtual table rows is inserted into the first packed table, and the position of the virtual table row in the first packed table corresponds to the position of the newly added row in the second table. If the row change of the second table relative to the first table is the deletion of a whole row, a row of virtual table rows is inserted into the second packed table, and the position of the virtual table row in the second packed table corresponds to the position of the deleted row in the first table.
[0233] After inserting virtual table rows into the first packing table and / or the second packing table, the first packing table and the second packing table are transposed into the first transposed table and the second transposed table, respectively. If the column change of the second table relative to the first table is the addition of the entire column, that is, the row change of the second transposed table relative to the first transposed table is the addition of the entire row, then insert a row of virtual table rows into the first transposed table, and the position of the virtual table row in the first transposed table corresponds to the position of the newly added row in the second transposed table. If the column change of the second table relative to the first table is the deletion of the entire column, that is, the row change of the second transposed table relative to the first transposed table is the deletion of the entire row, then insert a row of virtual table rows into the second transposed table, and the position of the virtual table row in the second transposed table corresponds to the position of the deleted row in the first transposed table.
[0234] After inserting virtual table rows into the first transposed table and / or the second transposed table (the virtual table rows inserted here become virtual table columns after restoration), the first transposed table and the second transposed table are transposed into the first comparison table and the second comparison table respectively; and each corresponding cell in the first comparison table and the second comparison table is compared.
[0235] According to the above method, by judging the change of rows before transposition and inserting virtual table rows accordingly, and judging the change of columns after transposition and inserting virtual table columns accordingly (inserting virtual table rows in the transposed table is equivalent to inserting virtual table columns after restoration), the influence of adding / deleting entire rows and adding / deleting entire columns on the table structure and comparison results is eliminated, thereby obtaining two comparison tables with unified table row and column structures. Then, the changes of the two comparison tables can be easily compared row by row and / or cell by cell.
[0236] Figure 5A is a schematic diagram of an embodiment of the first packaging table 510 in the present application, Figure 5B is a schematic diagram of an embodiment of the second packaging table 520 in the present application, Figure 5C is a schematic diagram of an embodiment of the first transposition table 530 in the present application, Figure 5D is a schematic diagram of an embodiment of the second transposition table 540 in the present application, Figure 5Eis a schematic diagram of an embodiment of the first column filling table 550 in the present application, Fig. 5F is a schematic diagram of an embodiment of the second column filling table 560 in the present application, Figure 5G is a schematic diagram of an embodiment of the first comparison table 570 in the present application, Figure 5H is a schematic diagram of an embodiment of the second comparison table 580 in the present application.
[0237] like Figure 5A and 5B As shown, the first packed table 510 and the second packed table 520 are tables after cell packing, each containing 4 rows and 4 columns. By comparing the rows of the first packed table 510 and the second packed table 520, no addition or deletion of the entire row is found, so there is no need to insert a virtual table row.
[0238] like Figure 5C and 5D As shown, the first packing table 510 and the second packing table 520 are transposed into the first transposed table 530 and the second transposed table 540. By comparing the rows of the first transposed table 530 and the second transposed table 540, it is found that the changes are: the third row (C1-C4) is deleted, and the fourth row (E1-E4) is added at the bottom. The changes in the rows of the first transposed table 530 and the second transposed table 540 represent the changes in the columns of the first packing table 510 and the second packing table 520.
[0239] like Figure 5E and 5F As shown, a virtual table row (E1′-E4′) is inserted into the 5th row at the bottom of the first transposed table 530 to obtain a first column filling table 550 , and a virtual table row (C1′-C2′) is inserted into the 3rd row of the second transposed table 540 to obtain a second column filling table 560 .
[0240] like Figure 5G and 5H As shown, the first column filling table 550 and the second column filling table 560 are respectively transposed into the first comparison table 570 and the second comparison table 580. The first comparison table 570 and the second comparison table 580 both contain 4 rows and 5 columns, have a unified table structure, and have eliminated the impact of the deletion / addition of the entire column, so as to facilitate the comparison of row by row and cell by cell.
[0241] Fig. 6A is a schematic diagram of an embodiment of converting the first comparison table 570 and the second comparison table 580 into multiple lines of text for comparison in the present application, Figure 6B is a schematic diagram of an embodiment of the comparison result of the first comparison table 570 and the second comparison table 580 in the present application, Figure 6CIt is a schematic diagram of an embodiment of marking according to the comparison result in the present application.
[0242] like Fig. 6A As shown, the first comparison table 570 (data table 1) and the second comparison table 580 (data table 2) are converted into multiple lines of text, and compared line by line. In this embodiment, the diff_match_patch method can be used to calculate or compare each line, and the following is obtained: Figure 6B The comparison results are shown in the figure. The brackets [] indicate the comparison result of a cell, the brackets () indicate the change of the characters, "-1" indicates deletion, "1" indicates addition, and "0" indicates no change.
[0243] like Figure 6C As shown, it can be based on Figure 6B The calculation results in the table are combined with the recognition of the virtual characters to obtain the changes in the table, and are marked with specific identifiers. In some embodiments, the changes in the virtual characters can be removed from the final output results.
[0244] For a single cell, the packing characters can change in three ways:
[0245] (1) Delete: Delete the contents of the original cell, for example Figure 6C C1 in.
[0246] (2) New: The original cell content is empty, and new characters are added, for example Figure 6C E1 in.
[0247] (3) Modification: The original cell contents are deleted and new characters are added, or the original cell contents are replaced with new contents, for example Figure 6C B1 in the picture becomes F1.
[0248] For the above two situations (1) and (2), the contents in the cell can be directly restored by unpacking the packed characters. In some embodiments, a specific identifier can be used to mark whether it is a deleted character or a newly added character.
[0249] In the case (3) above, since the contents of the entire cell are packaged, we can only determine that the cell as a whole has changed, but we cannot determine the details of the changes in the specific contents of the cell. For example, the data represented by the packaged character B1 is "2020-01-01", and the data represented by the packaged character F1 is "2020-01-02". After unpacking and restoring, we can use diff_match_patch to compare the cell contents again, and get the comparison result of the cell contents: "2020-01-012 ”, that is, the last character “1” is deleted and the character “2” is added.
[0250] This method can be used to unpack all packed characters in the table to obtain the final comparison result.
[0251] In some embodiments, the comparison results can be displayed directly in Excel or other spreadsheet tools, and the changed content or text can be specifically rendered. In other embodiments, the comparison results can also be displayed in HTML. Compared with directly expressing the data change points in Excel tools, HTML can express the comparison results more flexibly and accurately, and can include the following steps:
[0252] (1) Render the html-table using the comparison result cells as the boundaries.
[0253] (2) All deleted parts of the text are wrapped in HTML <del>Labels are marked and rendered with a red background.
[0254] (3) All newly added text is written in HTML <ins>Labels are marked and rendered with a green background.
[0255] You can get an easy-to-observe display of data changes.
[0256] The present application provides a table content comparison method for comparing content changes of a second table relative to a first table, which may include the following steps:
[0257] Step 1: Pack the cell content of each cell in the first table and the second table into corresponding packing characters, wherein the same cell content corresponds to the same packing character, and different cell content corresponds to different packing characters. In some embodiments, each cell in the first packing table and the second packing table includes a packing character.
[0258] Step 2: Replace the cell content of each cell in the first table and the second table with corresponding packing characters, and obtain a first packing table after replacing the first table and a second packing table after replacing the second table.
[0259] Step three: compare whether the packing characters in the second packing table are the same as the corresponding packing characters in the first packing table, so as to obtain a comparison result between the first packing table and the second packing table.
[0260] Step 4: According to the comparison result of the first packaged table and the second packaged table, a comparison result of the first table and the second table is obtained.
[0261] In some embodiments, when the comparison result of the first table and the second table is obtained, the packed characters can be unpacked into corresponding cell contents. If the packed characters in the second packed table are different from the corresponding packed characters in the first packed table, the packed characters are unpacked into corresponding cell contents, and then the cell contents are compared.
[0262] In some embodiments, each corresponding row in the first packaged table and the second packaged table may be compared to determine the row change of the second table relative to the first table. If the row change of the second table relative to the first table is the addition of a whole row, a row of virtual table rows is inserted into the first packaged table, and the position of the virtual table row in the first packaged table corresponds to the position of the newly added row in the second table. If the row change of the second table relative to the first table is the deletion of a whole row, a row of virtual table rows is inserted into the second packaged table, and the position of the virtual table row in the second packaged table corresponds to the position of the deleted row in the first table.
[0263] In some embodiments, the first packed table and the second packed table can be transposed into a first transposed table and a second transposed table, respectively, wherein each row in the first transposed table and the second transposed table corresponds to each column in the first packed table and the second packed table, respectively; and each corresponding row in the first transposed table and the second transposed table is compared to determine the column changes of the second table relative to the first table.
[0264] If the change in the columns of the second table relative to the first table is the addition of a whole column, that is, the change in the rows of the second transposed table relative to the first transposed table is the addition of a whole row, then a row of virtual table rows is inserted into the first transposed table, and the position of the virtual table row in the first transposed table corresponds to the position of the newly added row in the second transposed table. If the change in the columns of the second table relative to the first table is the deletion of a whole column, that is, the change in the rows of the second transposed table relative to the first transposed table is the deletion of a whole row, then a row of virtual table rows is inserted into the second transposed table, and the position of the virtual table row in the second transposed table corresponds to the position of the deleted row in the first transposed table. A virtual table row can be composed of one or more virtual cells, and the content of each virtual cell includes a virtual character.
[0265] In some embodiments, the first transposed table and the second transposed table may be transposed into a first comparison table and a second comparison table, respectively; and each corresponding cell in the first comparison table and the second comparison table may be compared.
[0266] In some embodiments, if the overall change of the cells in the second table relative to the cells in the first table is addition, the cell content of the added cells obtained by unpacking the packed characters is displayed at the added cells of the second table, and a mark is marked to indicate addition. If the overall change of the cells in the second table relative to the cells in the first table is deletion, the cell content of the deleted cells obtained by unpacking the packed characters is displayed at the deleted cells of the first table, and a mark is marked to indicate deletion. If the overall change of the cells in the second table relative to the cells in the first table is modification, the packed characters in the first table and the second table are unpacked to obtain the cell content respectively; and the cell content in the first table and the cell content in the second table are compared to obtain the content change of the second table relative to the first table. And the cell content can be displayed at the modified cells of the first table and the second table respectively, and a mark is marked to indicate modification.
[0267] The present application also provides a table content comparison system that can execute various table content comparison methods as described above, and can include a packing module, which is configured to pack the cell content of each cell in the table into corresponding packing characters, and to unpack the packed characters into corresponding cell contents, so that the overall change of the cell can be judged based on the comparison results of the packed characters.
[0268] In some embodiments, the table content comparison system may further include a cell comparison module configured to compare the cell content of each corresponding cell in the two tables to determine the cell content change. If the overall change of the cell is modification, the cell content may be compared by the cell comparison module.
[0269] In some embodiments, the table content comparison system may further include a row comparison module configured to compare each corresponding row in the two tables to determine the row changes in the two tables. The row comparison module may further be configured to compare each corresponding row in the two tables by comparing strings composed of packed characters, and determine the row changes in the two tables according to the changes in the packed characters.
[0270] In some embodiments, the row comparison module may be configured to determine the row changes of the two tables by:
[0271] If (delete_part-insert_part)>=(1-virtual_part), the row change is the deletion of the entire row;
[0272] If (insert_part-delete_part)>=(1-virtual_part), the row change is the addition of the entire row;
[0273] Where, delete_part = the total number of characters deleted in a row / the total number of characters in the row;
[0274] insert_part = total number of characters added in a row / total number of characters in the row;
[0275] virtual_part=(total number of virtual characters in a row+number of blank cells in the row) / total number of characters in the row.
[0276] In some embodiments, the table content comparison system may further include a virtual row filling module configured to fill virtual table rows in the two tables according to row changes in the two tables. Each cell in the virtual table row may include a virtual character.
[0277] If the row changes of the two tables are complete row additions, the virtual row filling module fills the virtual table rows in the original table corresponding to the newly added rows in the new table. If the row changes of the two tables are complete row deletions, the virtual row filling module fills the virtual table rows in the new table corresponding to the deleted rows in the original table.
[0278] In some embodiments, the table content comparison system may further include a transposition module configured to transpose the rows and columns of the table to obtain a transposed table. The transposition module may be further configured to transpose the table after filling the virtual table rows to obtain a transposed table.
[0279] In some embodiments, the row comparison module can be further configured to compare each corresponding row in the transposed table of the two tables, and determine the change of the columns of the two tables by determining the change of the rows of the transposed table of the two tables. If the change of the row of the transposed table of the two tables is the addition of a whole row, the virtual row filling module fills the virtual table rows in the transposed table of the original table corresponding to the newly added rows in the transposed table of the new table. If the change of the row of the transposed table of the two tables is the deletion of a whole row, the virtual row filling module fills the virtual table rows in the transposed table of the new table corresponding to the deleted rows in the transposed table of the original table.
[0280] The transposition module can be further configured to transpose the transposition tables of the two tables respectively to obtain the comparison tables of the two tables, so as to enable the comparison tables of the two tables to be compared. In some embodiments, the transposition module can be further configured to transpose the transposition table after filling the virtual table row to obtain the comparison table. The cell comparison module can be further configured to compare each corresponding cell in the comparison table of the two tables.
[0281] In some embodiments, the table content comparison system may further include an output module configured to output the comparison results of the two tables according to the comparison results of the comparison table of the two tables. The output module may be further configured to display the comparison results of the two tables on the layout of the comparison table of the two tables.
[0282] If the overall change of the cell is addition, the cell content of the added cell is displayed in the corresponding cell of the comparison table of the new table, and the mark used to indicate addition is marked. If the overall change of the cell is deletion, the cell content of the deleted cell is displayed in the corresponding cell of the comparison table of the original table, and the mark used to indicate deletion is marked. If the overall change of the cell is modification, the cell content of each cell is displayed in the corresponding cell of the comparison table of the original table and the new table, and the mark used to indicate modification is marked.
[0283] In some embodiments, if the cell in the comparison table is a virtual cell, the cell content is displayed as empty.
[0284] The following uses a specific embodiment to further illustrate the table content comparison method provided in this application.
[0285] Fig. 7A is a schematic diagram of an embodiment of the first table 710 in this application, Figure 7B is a schematic diagram of an embodiment of the second table 720 in this application, Figure 7C is a schematic diagram of an embodiment of the first packaged table 730 in this application, Fig.7D is a schematic diagram of an embodiment of the second packaged table 740 in this application, Fig. 7E is a schematic diagram of an embodiment of the first transposed table 750 in this application, Figure 7F is a schematic diagram of an embodiment of the second transposed table 760 in this application, Figure 7G is a schematic diagram of an embodiment of judging the change situation of columns in this application, Figure 7H is a schematic diagram of an embodiment of the second comparison table 780 in this application, Fig.7I is a schematic diagram of an embodiment of the comparison result of the packaged characters in this application, Figure 7J is a schematic diagram of an embodiment of the final comparison result in this application.
[0286] The following uses the table content comparison method provided in this application to compare the first table 710 and the second table 720.
[0287] (1) Package the cells of the first table 710 and the second table 720 to obtain two new data tables (packaged tables) as shown in Figure 7C and 7D . In the packaged table, each cell is packaged into a packaged character. The same cell content is packaged into the same packaged character, and different cell contents are packaged into different packaged characters. The cell with empty content is also packaged into the same packaged character corresponding to the empty cell. In this embodiment, the empty cell is packaged into the character "丂".
[0288] (2) According to the change situation of the rows in the packaged table, perform row filling, and then flip (transpose) the data table to obtain two new data tables (transposed tables) as shown in Fig. 7E and 7F . In this embodiment, there is no situation of adding or deleting an entire row, so there is no need to perform row filling, and the packaged table is directly transposed.
[0289] (3) Determine the changes in the columns of the packed table based on the changes in the transposed variant rows, and perform column filling. Among them, the change values of each column can be calculated through the diff_match_patch method, and the change situation of the column can be judged according to the judgment method described above (see Figure 7G ).
[0290] According to the judgment result, if it is determined that the 5th column is deleted, a virtual column is filled in the corresponding position of the second packed table, so as to obtain the second comparison table as shown in Figure 7H . Among them, the E column is the filled virtual table column, and the virtual character is "丸". The first packed table does not need to fill the virtual column, and the first packed table can be used as the first comparison table.
[0291] (4) Compare the first comparison table and the second comparison table to obtain the comparison result of the packed characters as shown in Fig.7I . Among them, the deleted content is represented by a strikethrough, the added content is represented by an underline, and the overall addition or deletion of the cell can be further represented by the color of the cell to prominently prompt the user's attention. For example: red represents deletion, and green represents addition (in Fig.7I , the deleted and added cells are displayed in gray).
[0292] (5) Unpack the packed characters and perform a secondary comparison to obtain the final comparison result as shown in Figure 7J .
[0293] For cells with overall addition or overall deletion, the cell content is displayed after unpacking, and the same color as in step (4) can be further used for identification. For example: for the cell in the E column with overall deletion, the deleted content can be represented by a strikethrough, and the cell color is set to red; for the cells B10, C10, D10, F10, G10, H10, which have added content on the basis of the original empty cells, the added content can be represented by an underline, and the cell color is set to green.
[0294] For cells with unchanged content, the cell content is displayed after unpacking, and no special identification is required. For example: for the cells in the A column, the original cell content is displayed after unpacking. In some embodiments, no special identification is required, or an inconspicuous color such as white or gray is used for identification.
[0295] For cells with changed content, the cell content is compared again after unpacking, and a more specific comparison result is displayed. For example: the content of cell B3 has changed to " Wang Wu ", that is, "张三" is deleted and "王五" is added. Similar colors can also be further used for identification, such as using red font, " Wang Wu ” uses green font.
[0296] The table content comparison method and system provided by the present application can reduce the impact of multiple characters in a cell on the judgment of changes in the data table structure by packaging the cell into a single character; can make the judgment of the data table structure more accurate by filling in virtual rows and columns; and can make a secondary comparison and judgment of the data in the cell so that it can more clearly show the data change points. Compared with traditional manual data comparison or one-to-one cell solutions, this solution can more accurately find the changes between two versions of the data table, greatly improving the efficiency and accuracy of data comparison and significantly reducing labor costs.
[0297] The technical solution provided by the present application may be a system, method, device and / or computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for enabling a processor to implement various aspects of the present application.
[0298] In some embodiments, the present application also provides a computer device, apparatus or terminal, the internal structure of which can be as follows: Figure 8 As shown. The computer device, equipment or terminal includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor is used to provide computing and control capabilities, and the memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the various methods, processes, and steps disclosed in the present application are implemented, or when the processor executes the computer program, the functions of each module or unit in the embodiment disclosed in the present application are implemented. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the shell, or an external keyboard, touchpad or mouse, etc.
[0299] Exemplarily, a computer program may be divided into one or more modules or units, which are stored in a memory and can be executed by a processor to implement the technical solution of the present application. These modules or units may be a series of computer program instruction segments that can perform specific functions, and the instruction segments are used to describe the execution process of the computer program in a device, equipment or terminal.
[0300] The above-mentioned devices, equipment or terminals may be computing devices such as desktop computers, notebooks, mobile electronic devices, PDAs and cloud servers. Those skilled in the art should understand that the structure shown in the figure is only a block diagram of a part of the structure related to the present application scheme, and does not constitute a limitation on the device, equipment or terminal to which the present application scheme is applied. The specific device, equipment or terminal may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0301] The processor may be a central processing unit (CPU), or other general or special processors, microprocessors, digital signal processors (DSP), application specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The processor is the control center of the above-mentioned device, equipment or terminal, and uses various interfaces and lines to connect various parts of the device, equipment or terminal.
[0302] The memory can be used to store computer programs, modules and data. The processor realizes various functions of the device, equipment or terminal by running or executing the computer programs and / or modules stored in the memory and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store various types of data created according to the application (such as multimedia data, documents, operation history records, etc.), etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), a disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0303] The present application also provides a computer-readable storage medium on which a computer program is stored, and the steps of the above method are implemented when the computer program is executed by a processor. A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in the present application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0304] The modules and units integrated in the above-mentioned devices or terminal equipment, if implemented in the form of software functional units and sold or used as independent products, can be stored in a computer-readable storage medium. Based on such an understanding, the present application implements all or part of the processes in the various methods disclosed, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned methods when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction.
[0305] In some embodiments, the various methods, processes, modules, devices, equipment or systems disclosed in the present application may be implemented or executed in one or more processing devices (e.g., digital processors, analog processors, digital circuits designed to process information, analog circuits designed to process information, state machines, computing devices, computers and / or other mechanisms for electronically processing information). The one or more processing devices may include one or more devices that perform some or all operations of the method in response to instructions stored electronically on an electronic storage medium. The one or more processing devices may include one or more devices that are configured by hardware, firmware and / or software and are specifically designed to perform one or more operations of the method. The above is only a preferred specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field within the technical scope disclosed in the present application, according to the technical solution and its inventive concept of the present application, shall be equivalently replaced or changed, and shall be covered within the protection scope of the present application.
[0306] The embodiments of the present application can be carried out in hardware, firmware, software or various combinations thereof, and can also be implemented as instructions stored on machine-readable media and can be read and executed using one or more processing devices. In some embodiments, the machine-readable medium may include various mechanisms for storing and / or transmitting information in a machine (e.g., computing device) readable form. For example, a machine-readable storage medium may include a read-only memory, a random access memory, a disk storage medium, an optical storage medium, a flash memory device, and other media for storing information, and a machine-readable transmission medium may include various forms of propagation signals (including carrier waves, infrared signals, digital signals) and other media for transmitting information. Although firmware, software, routines or instructions can be described in the above disclosure in terms of specific exemplary aspects and embodiments of performing certain actions, it will be apparent that such descriptions are only for convenience purposes and such actions are actually generated by machine equipment, computing devices, processing devices, processors, controllers, or other devices or machines that execute firmware, software, routines or instructions.
[0307] In the claims and specification of the present application, a module used to perform a specified function or a module described using functional features is intended to cover any way of performing the function, such as: a combination of circuit elements that perform the function, software, hardware, and a combination of software and hardware that perform or implement the function, or any form of software, firmware, code, and a combination thereof with appropriate circuits or other devices. The functions provided by various modules are combined together in the manner claimed in the claims, and it should be considered that any module, component, or element that can provide these functions is equivalent or equivalent to the module defined in the claims. According to the principle of equivalent transformation of circuits, the circuit structure of some embodiments in the present application can also be changed and modified, for example: a current source is converted into a voltage source, a series structure is converted into a parallel structure, etc., so as to obtain more diverse embodiments, but these changes and modifications are all within the scope of disclosure of the present application.
[0308] This specification uses examples to disclose the present application, one or more of which are described or illustrated in the specification and its drawings. Each example is provided for the purpose of explaining the present application, not for limiting the present application. In fact, it is obvious to those skilled in the art that various modifications and variations can be made to the present application without departing from the scope or spirit of the present application. For example, the illustrated or described features as part of one embodiment can be used together with another embodiment to obtain a further embodiment. Therefore, it is intended that the present application covers modifications and variations within the scope of the attached claims and their equivalents. The above is only a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any technical solution that can be obtained by logical analysis, reasoning or limited experiments based on the concept of the present application by any technician familiar with the art, or easily conceivable changes or replacements, should be included in the scope of protection of the present application.< / ins> < / del>
Claims
1. A table content comparison method, characterized in that: include: Packing the content of a first cell in the first table into a first packing character, and packing the content of a second cell in the second table into a second packing character; comparing the first packed character and the second packed character; as well as According to the comparison result of the first packaged character and the second packaged character, the overall change of the second cell relative to the first cell is determined.
2. The table content comparison method according to claim 1, characterized in that: The same content is packed into the same packing character, and different content is packed into different packing characters.
3. The table content comparison method according to claim 1, characterized in that: If the overall change of the second cell relative to the first cell is modification, unpacking the first packed character to obtain the content of the first cell, and unpacking the second packed character to obtain the content of the second cell; as well as Compare the content of the first cell with the content of the second cell to obtain a change in the content of the second cell relative to the content of the first cell.
4. The table content comparison method according to any one of claims 1-2, characterized in that: Based on the content of the first cell, the content of the second cell, and the overall change and / or content change of the second cell relative to the first cell, a comparison result of the first cell and the second cell is output.
5. The table content comparison method according to any one of claims 1-2, characterized in that: According to the content change of the second cell relative to the first cell, an identifier for indicating the content change is marked at the changed characters in the content of the first cell and the content of the second cell respectively.
6. The table content comparison method according to any one of claims 1-2, characterized in that: The first table includes at least one first table row consisting of one or more first cells, and the second table includes at least one second table row consisting of one or more second cells; Replacing the content of each of the first cells in the first table row with the corresponding first packed characters, thereby obtaining a first packed table row consisting of one or more of the first packed characters, and replacing the content of each of the second cells in the second table row with the corresponding second packed characters, thereby obtaining a second packed table row consisting of one or more of the second packed characters; comparing the first packing table row and the second packing table row; and According to the comparison result of the first packing table row and the second packing table row, the change of the second table row relative to the first table row is determined.
7. The table content comparison method according to claim 6, characterized in that: If the change of the second table row relative to the first table row is that the entire row is added, inserting a virtual table row into the first table, the position of the virtual table row in the first table corresponds to the position of the second table row in the second table; and / or If the change of the second table row relative to the first table row is the deletion of the entire row, a virtual table row is inserted into the second table, and the position of the virtual table row in the second table corresponds to the position of the first table row in the first table.
8. A table content comparison method for comparing changes in the content of a second table relative to a first table, characterized in that include: Packing the cell content of each cell in the first table and the second table into corresponding packing characters, wherein the same cell content corresponds to the same packing character, and different cell content corresponds to different packing characters; Replacing the cell content of each cell in the first table and the second table with the corresponding packing character, to obtain a first packing table after the first table is replaced and a second packing table after the second table is replaced; comparing whether the packing characters in the second packing table are the same as the corresponding packing characters in the first packing table, thereby obtaining a comparison result of the first packing table and the second packing table; and According to the comparison result of the first packaging table and the second packaging table, the comparison result of the first table and the second table is obtained.
9. The table content comparison method according to claim 8, characterized in that: When the comparison result of the first table and the second table is obtained, the packed characters are unpacked into the corresponding cell contents.
10. The table content comparison method according to claim 8, characterized in that: If the packing characters in the second packing table are different from the corresponding packing characters in the first packing table, the packing characters are unpacked into the corresponding cell contents, and then the cell contents are compared.
11. The table content comparison method according to claim 8, characterized in that: Compare each corresponding row in the first packing table and the second packing table to determine the change of rows in the second table relative to the first table.
12. The table content comparison method according to claim 8, characterized in that: transposing the first packing table and the second packing table into a first transposed table and a second transposed table, respectively, wherein each row in the first transposed table and the second transposed table corresponds to each column in the first packing table and the second packing table, respectively; and Compare each corresponding row in the first transposed table and the second transposed table to determine changes in columns of the second table relative to the first table.
13. The table content comparison method according to claim 12, characterized in that: transposing the first transposed table and the second transposed table into a first comparison table and a second comparison table respectively; and Compare each corresponding cell in the first comparison table and the second comparison table.
14. The table content comparison method according to claim 8, characterized in that: The cell contents are displayed at the modified cells of the first table and the second table respectively, and are marked with an identification indicating the modification.
15. A table content comparison system, characterized in that: include: The packing module is configured to pack the cell content of each cell in the table into corresponding packing characters, and to unpack the packing characters into the corresponding cell content, so that the cell comparison module can judge the overall change of the cell according to the comparison result of the packing characters.
16. The table content comparison system according to claim 15, characterized in that: Also includes: The cell comparison module is configured to compare the cell content of each corresponding cell in two tables to determine the change of the cell content.
17. The table content comparison system according to claim 15, characterized in that: Also includes: The row comparison module is configured to compare each corresponding row in the two tables to determine the change of the rows in the two tables.
18. The table content comparison system according to claim 15, characterized in that: Also includes: The virtual row filling module is configured to fill virtual table rows into the two tables respectively according to the change of rows of the two tables.
19. A table content comparison device, comprising a memory, a processor, and a computer program stored in the memory and capable of running on the processor, characterized in that: The processor is configured to implement the steps of the table content comparison method according to any one of claims 1 to 14 when executing the computer program.
20. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the table content comparison method according to any one of claims 1 to 14 can be implemented.
Citation Information
Patent Citations
Table differentiation content analysis method and system for pharmaceutical industry and storage medium
CN111626030A