Document comparison method, apparatus, device, and medium

By comparing and contrasting screenshots and text recognition of documents of different formats, the errors introduced by format conversion in document comparison were resolved, and accurate document content comparison was achieved.

CN115937888BActive Publication Date: 2026-02-17SOUNDAI TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202211740633.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-30
Publication Date
2026-02-17
Estimated Expiration
2042-12-30

AI Technical Summary

Technical Problem

In existing technologies, content deviations and conversion errors caused by format conversion during document comparison result in discrepancies between the comparison results and the actual results, requiring manual intervention.

Method used

By taking screenshots of documents of different formats to be compared, obtaining screenshot images, and using optical character recognition technology to identify the text, text comparison is performed to obtain document comparison results, thus avoiding errors introduced by format conversion.

Benefits of technology

It enables accurate comparison of document content without format conversion, avoiding conversion errors and improving the accuracy and efficiency of comparison results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115937888B_ABST
    Figure CN115937888B_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure provide a document comparison method, device, equipment and medium. The document comparison method comprises: in response to determining two documents to be compared, judging whether the document formats of the two documents to be compared are the same; in the case that the document formats of the two documents to be compared are different, performing a screen capture operation on the rendered display pages of the two documents to be compared to obtain two groups of screen capture images corresponding to the two documents to be compared; performing text recognition on the two groups of screen capture images respectively to obtain first recognized texts corresponding to the two groups of screen capture images; comparing the first recognized texts corresponding to the two groups of screen capture images to obtain a first text comparison result, and taking the first text comparison result as the document comparison result of the two documents to be compared. By using the embodiments of the present disclosure, the conversion error problem introduced when using a document format converter for format conversion is avoided, and then the problem that the document comparison result is different from the actual result due to the conversion error is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of software testing, and specifically to a document comparison method, apparatus, device, and storage medium. Background Technology

[0002] Various application software programs undergo upgrades during use due to changes and increases in requirements. To enable adaptive software testing of the upgraded software, testers need to determine whether the upgrade changes match the requirements documents provided by the client. This can be achieved through document comparison.

[0003] Currently, document comparison is mostly performed manually or by document comparison software. When using comparison software, if the two documents have different formats, a document format converter is first needed to convert one of the comparison documents to a format identical to the other. Then, the converted document is compared with the other document. However, because document format converters can alter the content of the comparison documents, causing significant discrepancies, the comparison results obtained using the converted document may not match the actual results. In such cases, manual content comparison is still necessary. Summary of the Invention

[0004] To address the aforementioned technical problems, embodiments of this disclosure provide a document comparison method, apparatus, device, and medium.

[0005] In a first aspect, embodiments of this disclosure provide a document comparison method, including:

[0006] In response to identifying two documents to be compared, it is determined whether the document formats of the two documents to be compared are the same;

[0007] When the two documents to be compared have different document formats, a screen capture operation is performed on the rendered display pages of the two documents to be compared to obtain two sets of corresponding screen capture images;

[0008] Text recognition is performed on the two sets of screen capture images to obtain the corresponding first recognized text;

[0009] The first text comparison result is obtained by comparing the first recognized text corresponding to the two sets of screen capture images, and the first text comparison result is used as the document comparison result of the two documents to be compared.

[0010] Optionally, the step of performing text recognition on the two sets of screen capture images to obtain the corresponding first recognized text includes:

[0011] The two sets of screen capture images are processed using optical character recognition technology to obtain the recognized characters included in the two sets of screen capture images, and the recognition positions of the recognized characters in the screen capture images;

[0012] The identified characters are concatenated according to the identified positions to obtain the corresponding first identified text.

[0013] Optionally, after obtaining the first text comparison result by comparing the first recognized text corresponding to the two sets of screen capture images, the method further includes:

[0014] Obtain the differing text from the first text comparison result;

[0015] Based on the identification position of the difference text in a set of captured images, difference marking is performed to form a difference marking map and the difference marking map is output.

[0016] Optionally, if the two documents to be compared have different document formats and neither document is an image format, the method further includes:

[0017] The format of one document to be compared is converted to that of another document to be compared, resulting in a converted document.

[0018] The text content of the converted document and the document to be compared is compared to obtain a second text comparison result;

[0019] The step of using the first text comparison result as the document comparison result of the two documents to be compared includes:

[0020] The first text comparison result and the second text comparison result are combined, and the combined text comparison result is used as the document comparison result of the two documents to be compared.

[0021] Optionally, before obtaining the first text comparison result by comparing the first recognized text corresponding to the two sets of screen capture images, the method further includes:

[0022] Image similarity is calculated for the two sets of screen capture images to determine the image similarity between the two sets of screen capture images;

[0023] If the image similarity is greater than a preset similarity, the operation of comparing the first recognized text corresponding to the two sets of screen capture images to obtain the first text comparison result is performed.

[0024] Optionally, the step of calculating the image similarity between the two sets of screen capture images to determine the image similarity between the two sets of screen capture images includes:

[0025] The two sets of screen capture images are processed using a pre-trained image recognition model to obtain text object detection boxes in the two sets of screen capture images;

[0026] Calculate the grayscale gradient vector of the text object detection boxes in the two sets of screen capture images;

[0027] The similarity of the text object detection boxes is matched using the gray-level gradient vector, and the image similarity between the two sets of screen capture images is determined based on the difference in the gray-level gradient vectors of the matched text object detection boxes.

[0028] Optionally, determining the two documents to be compared includes:

[0029] In response to receiving a document uploaded by a user for comparison, a document version query interface is displayed to the user, which is used to show the user the version of the document to be queried;

[0030] In response to the user's selection of a target document in the document version query interface, the target document is used as another document to be compared.

[0031] Secondly, embodiments of this disclosure provide a document comparison apparatus, comprising:

[0032] The format comparison unit is used to determine whether the document formats of the two documents to be compared are the same in response to receiving two documents to be compared.

[0033] The screen capture unit is used to perform screen capture operations on the rendered display pages of the two documents to be compared when the document formats of the two documents to be compared are different, so as to obtain two sets of corresponding screen capture images.

[0034] The text recognition unit is used to perform text recognition on the two sets of screen capture images respectively to obtain the corresponding first recognized text;

[0035] The document comparison unit is used to compare the first recognized text corresponding to the two sets of screen capture images to obtain a first text comparison result, and use the first text comparison result as the document comparison result of the two documents to be compared.

[0036] Thirdly, embodiments of this disclosure provide a computing device, including a processor and a memory, the memory being used to store a computer program; when the computer program is loaded by the processor, it causes the processor to execute the document comparison method as described above.

[0037] Fourthly, embodiments of this disclosure provide a computer-readable storage medium storing a computer program that, when executed by a processor, causes the processor to implement the document comparison method as described above.

[0038] The technical solution provided in this disclosure has the following advantages compared with the prior art:

[0039] Using the solution provided in this embodiment, when it is determined that the document formats of two documents to be compared are different, a screen capture operation is performed on the rendered display pages of the two documents to obtain two sets of screen capture images. Then, text recognition is performed on the screen capture images to obtain the corresponding first recognized text. After obtaining the first recognized text corresponding to the two sets of screen capture images and comparing the first recognized text corresponding to the two sets of screen capture images to obtain the first text comparison result, the first text comparison result can be used as the document comparison result of the two documents to be compared. In this way, the comparison of the content of the two documents to be compared and the document comparison result are obtained without using a document format converter to perform document format conversion. This avoids the conversion error problem introduced when using a document format converter, and thus avoids the problem of the document comparison result differing from the actual result due to conversion errors. Attached Figure Description

[0040] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.

[0041] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, those skilled in the art can obtain other drawings based on these drawings without any creative effort, wherein:

[0042] Figure 1 This is a flowchart of the document comparison method provided in the embodiments of this disclosure;

[0043] Figure 2 This is a flowchart of a document comparison method provided in another embodiment of this disclosure;

[0044] Figure 3 This is a flowchart of a document comparison method provided in some embodiments of this disclosure;

[0045] Figure 4 This is a schematic diagram of the document comparison device provided in the embodiments of this disclosure;

[0046] Figure 5 This is a schematic diagram of the structure of a computing device provided in some embodiments of this disclosure. Detailed Implementation

[0047] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.

[0048] The term "comprising" and its variations as used herein are open-ended, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below. It should be noted that the concepts of "first", "second", etc., used in this disclosure are only used to distinguish different devices, modules, or units, and are not intended to limit the order of functions performed by these devices, modules, or units or their interdependencies.

[0049] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0050] This disclosure provides a document comparison method, which, in response to the determination that two documents to be compared have different document formats, determines the document comparison result of the two documents to be compared by means of screen capture processing.

[0051] Figure 1 This is a flowchart of the document comparison method provided in an embodiment of this disclosure. Figure 1 As shown, the document comparison method provided in this embodiment includes S110-S150.

[0052] It should be noted that the software interface testing method provided in this embodiment is executed by a computing device. The aforementioned computing device can be a server or a terminal device. When the computing device is a terminal device, it can be a smartphone, tablet computer, or other similar device.

[0053] S110: In response to identifying two documents to be compared, determine whether the document formats of the two documents are the same. If they are different, proceed to S120; if they are the same, proceed to S150.

[0054] In this embodiment of the disclosure, after determining two documents to be compared, the computing device can read the header files of the two documents to be compared and obtain the document format fields of the two documents. After obtaining the document format information of the two documents to be compared, the computing device can then compare the document format fields of the two documents to determine whether the document formats of the two documents to be compared are the same.

[0055] In specific embodiments, the document formats of the two documents to be compared can be various possible document formats such as txt, pdf, doc, html, xml, etc., and may also be image formats such as jpeg. This disclosure does not impose any particular limitation.

[0056] S120: Perform a screen capture operation on the rendered display pages of the two documents to be compared, and obtain two sets of corresponding screen capture images.

[0057] If the two documents to be compared are not in the same format, using an existing document format converter to convert the document format of one of the documents to be compared may cause changes in the document content, resulting in inaccurate document comparison results in the later stage.

[0058] To avoid the aforementioned problems, in this embodiment, the computing device does not perform format conversion on the documents to be compared. Instead, it renders and displays the documents to be compared, and during the rendering and display process, it performs a screen capture operation on the corresponding display page to obtain a screen capture image of the corresponding document to be compared. Since the screen capture operation is performed on the rendered display page of the document to be compared, it can be determined that the screen capture image of each document to be compared includes all the information of the normally rendered and displayed output of that document.

[0059] S130: Perform text recognition on the two sets of screen capture images respectively to obtain the corresponding first recognized text.

[0060] After acquiring screen capture images corresponding to two documents to be compared, the computing device performs content recognition on the screen capture images according to a pre-set content processing method, thereby obtaining the corresponding first recognized text. The first recognized text is the text obtained by recognizing and processing characters in various image forms in the screen capture images and then concatenating them.

[0061] In some embodiments, the computing device may use S131-S132 dB to perform text recognition on two sets of screen capture images to obtain the corresponding first recognized text.

[0062] S131: The two sets of screen capture images are processed using optical character recognition technology to obtain the recognized characters included in the two sets of screen capture images, as well as the recognition positions of the recognized characters in the screen capture images.

[0063] The screen capture image is processed using optical character recognition technology to obtain the recognition characters included in the screen capture image, which includes: (1) preprocessing the screen capture image to obtain the processed screen capture image. The preprocessing includes binarization, noise removal, and white border removal. The aforementioned noise removal includes removing and cleaning up non-character boxes and lines. (2) Subsequently, the processed screen capture image is segmented to obtain the segmented single-character image. (3) The single-character image is feature extracted to obtain the corresponding feature vector. (4) The extracted feature vector is matched with the template in the feature template library to determine the matching template, and the character associated with the matching template is used as the recognition character corresponding to the single-character image. It should be noted that in this embodiment of the present disclosure, for two sets of screen capture images, the computing device uses the same optical character recognition technology to perform character recognition and obtain the corresponding recognition characters.

[0064] While obtaining the recognized character using the aforementioned method, the computing device simultaneously obtains the position of the single-character image in the screen capture image. After determining the recognized character corresponding to the single-character image, the recognition position of this single-character image in the screen capture image can be used as the recognition position of the recognized character in the screen capture image.

[0065] S132: Concatenate the recognized characters according to their recognition positions to obtain the corresponding first recognized text.

[0066] After acquiring the characters and their positions, the computing device can then concatenate the characters according to their positions to obtain the corresponding first recognized text. Considering that in the current writing system, various characters are written and displayed from left to right and from top to bottom, the computing device can concatenate the characters according to their positions in the same manner to obtain the corresponding first recognized text.

[0067] S140: Compare the first recognized text corresponding to the two sets of screen capture images to obtain the first text comparison result, and determine the document comparison result of the two documents to be compared based on the first text comparison result.

[0068] After obtaining the first recognized text corresponding to the two screen capture images, the computing device can then compare the first recognized text corresponding to the two screen capture images to determine the first text comparison result. The computing device compares the first recognized text corresponding to the two screen capture images using a character matching method. Based on one first recognized text, it determines the addition, modification, and deletion of characters in the other recognized text, thereby obtaining the first document comparison result.

[0069] After obtaining the first text comparison result, the computing device can then use the first text comparison result as the document comparison result of the two documents to be compared, and output the document comparison result.

[0070] S150: Directly compare the two documents to be compared to obtain the document comparison results.

[0071] If the two comparison documents have the same document format, then no format conversion is required, and the two comparison documents can be directly compared to obtain the document comparison result.

[0072] The document comparison method provided in this disclosure, when determining that the document formats of two documents to be compared are different, involves taking screenshots of the rendered display pages of the two documents to obtain two sets of screenshot images. Then, text recognition is performed on the screenshot images to obtain the corresponding first recognized text. After obtaining the first recognized text corresponding to the two sets of screenshot images and comparing them to obtain the first text comparison result, this first text comparison result can be used as the document comparison result for the two documents to be compared. Using the method provided in this disclosure, the comparison of the contents of two documents to be compared and the document comparison result are achieved without using a document format converter, avoiding the conversion errors introduced when using a document format converter, and thus avoiding the problem of the document comparison result differing from the actual result due to conversion errors.

[0073] Figure 2 This is a flowchart of a document comparison method provided in another embodiment of this disclosure. For example... Figure 2 As shown, some embodiments of this disclosure provide document comparison methods including S210-S260.

[0074] S210: In response to identifying two documents to be compared, determine whether the document formats of the two documents are the same. If they are different, proceed to S220; if they are the same, proceed to S260.

[0075] S220: When the document formats of the two documents to be compared are different, perform a screen capture operation on the rendered display pages of the two documents to be compared to obtain two sets of corresponding screen capture images.

[0076] S230: Perform text recognition on the two sets of screen capture images respectively to obtain the corresponding first recognized text.

[0077] S240: Compare the first recognized text corresponding to the two sets of screen capture images to obtain the first text comparison result, and obtain the difference text in the first text comparison result.

[0078] The specific execution process of S210-S240 is the same as that in the previous embodiment, and will not be repeated here. For details, please refer to the previous description.

[0079] After determining the first text comparison result, the computing device then queries the difference text within the first text comparison result. The difference text is the text in the first text comparison result that represents the difference between the two first identified texts. In specific implementations, the difference text in the first text comparison result is identified using special characters; the difference text can be determined by searching for these special characters.

[0080] S250: Based on the recognition position of the differing text in a set of screen capture images, perform difference marking to form a difference marking map and output the difference marking map as the document comparison result.

[0081] S260: Directly compare the two documents to be compared to obtain the document comparison results.

[0082] After identifying the differing text, the computing device can then determine the recognition location of the differing text within a set of screen capture images. Specifically, the computing device can find the corresponding single-character image based on the differing text, and then use the location of the corresponding single-character image as the recognition location of the differing text in the screen capture images. After determining the recognition location, the computing device can then add a difference marker at the recognition location. This difference marker can be a symbol such as a triangle or a circle added to the recognition location corresponding to the differing text. After adding the difference marker, the corresponding screen capture image becomes a difference-marked image. The computing device can then output the difference-marked image as the document comparison result.

[0083] By outputting the difference map as the document comparison result, document comparison personnel can quickly identify the differences between two documents to be compared, and then quickly find the difference content in the original documents to be compared.

[0084] Figure 3 This is a flowchart of a document comparison method provided in some embodiments of this disclosure. For example... Figure 3 As shown, some embodiments of this disclosure provide document comparison methods including S310-S380.

[0085] S310: In response to identifying two documents to be compared, determine whether the document formats of the two documents to be compared are the same; if they are the same, execute S320; if they are different, execute S330.

[0086] S320: Directly compare the two documents to be compared to obtain the document comparison results.

[0087] S330: Determine whether neither of the two documents to be compared is an image format document; if so, execute S340 and S370.

[0088] S340: Perform a screen capture operation on the rendered display pages of the two documents to be compared, and obtain two sets of corresponding screen capture images.

[0089] S350: Perform text recognition on the two sets of screen capture images respectively to obtain the corresponding first recognized text.

[0090] S360: Compare the first recognized text corresponding to the two sets of screen capture images to obtain the first text comparison result.

[0091] The methods of S310-S360 described above are the same as the corresponding steps in the previous embodiments, and will not be repeated here. For details, please refer to the previous description.

[0092] S370: Convert the format of one document to be compared according to the document format of the other document to be compared, and obtain the converted document.

[0093] In this embodiment of the disclosure, if the two documents to be compared have different document formats, and neither document is an image file, then both documents are determined to be text files. In this case, the computing device can convert the format of one document to the other, obtaining a converted document. Specifically, the computing device can determine which format conversion would result in the least change to the document content, and then determine which document to convert. For example, if the documents to be compared are in doc and pdf formats, and converting from doc to pdf might result in less change to the document content, then the doc document is converted to pdf.

[0094] S380: Compare the text content of the converted document with another document to be compared, and obtain the second text comparison result.

[0095] After obtaining the converted document, the converted document and the document to be compared without document format conversion can be compared using the direct comparison method adopted in S320 to obtain the second text comparison result.

[0096] S390: Combine the first text comparison result and the second text comparison result, and use the combined text comparison result as the document comparison result of the two documents to be compared.

[0097] After obtaining the first text comparison result and the second text comparison result, the computing device then integrates the two comparison results to obtain a comprehensive comparison result, and uses the comprehensive comparison result as the document comparison result of the two documents to be compared. In some embodiments, the computing device may calculate the intersection of the first text comparison result and the second text comparison result, and use the intersection as the aforementioned second text comparison result.

[0098] In the document comparison method provided in this disclosure, in addition to considering screen capture images to determine the document comparison results, the computing device also considers document format conversion to determine the document comparison results, so as to make the determined document comparison results more accurate.

[0099] In a specific embodiment, the computing device requires significant resource overhead to obtain the first text comparison result by comparing the first recognized text corresponding to two sets of screen capture images, resulting in slow computation. Furthermore, as the number of differing texts in the two first recognized texts increases, memory overhead grows exponentially, easily causing process crashes. To avoid this problem, in this embodiment, before performing the aforementioned comparison of the first recognized text corresponding to two sets of screen capture images to obtain the first text comparison result, the computing device may also perform the following steps S410-S420.

[0100] S410: Calculate the image similarity between the two sets of screen capture images to determine the image similarity between the two sets of screen capture images.

[0101] In this embodiment of the disclosure, the methods that can be used to calculate the image similarity between two sets of screen capture images include image pixel comparison method and image grayscale gradient change comparison method.

[0102] Image pixel comparison is a method that compares the grayscale of individual pixels in two sets of screen capture images to determine the difference pixels when the image pixels are the same, and determines the image similarity based on the number of difference pixels.

[0103] Methods based on image gray-level gradient change comparison include the following S411-S412.

[0104] S411: Calculate the grayscale gradient vectors of the two sets of screen capture images respectively.

[0105] S412: Determine the image similarity between two sets of screen capture images based on the gray-level gradient vector.

[0106] The computing device calculates the grayscale gradient vector of the screen capture image using the following method: it calculates the grayscale gradient of the screen capture image in each direction and writes the grayscale gradient in each direction into the corresponding position in the gradient vector, thereby obtaining the grayscale gradient vector.

[0107] After obtaining the grayscale gradient vector, the computing device can then use the following formula to calculate the image similarity between the two screenshot images. Where s represents image similarity, t1 is the gray-level gradient vector of one screenshot image, and t2 is the gray-level gradient vector of another screenshot image.

[0108] S420: Determine whether the image similarity is greater than the preset similarity; if so, perform the operation of comparing the first recognized text corresponding to the two sets of screen capture images to obtain the first text comparison result.

[0109] After calculating the image similarity, if the image similarity is greater than the preset similarity, it is determined that comparing the first recognized text corresponding to the screen capture image will not cause much memory overhead and the possibility of the corresponding process crashing is small. Therefore, the operation of comparing the first recognized text corresponding to the two sets of screen capture images to obtain the first text comparison result can be performed.

[0110] In some applications of the embodiments of this disclosure, the aforementioned document comparison method is executed by a plugin installed in a software version management client program. This plugin performs the corresponding file loading and result output based on the software version management client. In this case, determining the two documents to be compared in the aforementioned S110, S210, and S310 may include the following S111-S113.

[0111] S111: In response to receiving a document uploaded by a user for comparison, display a document version query interface to the user. The document version query interface is used to display the version of the document to be queried to the user.

[0112] S112: In response to the user's selection of the target document in the document version query interface, the target document is used as another document to be compared.

[0113] In this embodiment of the disclosure, when a user wants to compare a newly acquired document, they use a computing device to open the corresponding interface of the software version management client and upload the document. After uploading the document, the computing device displays the document version query interface of the software version management client to the user, showing the version of the document to be queried. The user then selects the target document by browsing the document version query interface. Upon receiving the user's selection of the target document in the document version query interface, the computing device selects the target document as another document to be compared and executes subsequent operation steps.

[0114] In addition to providing the aforementioned software interface testing method, this disclosure also provides a document comparison device 400. Figure 4 This is a schematic diagram of the document comparison device provided in an embodiment of this disclosure. Figure 4 As shown, the document comparison device 400 includes a format comparison unit 401, a screen capture unit 402, a text recognition unit 403, and a document comparison unit 404.

[0115] The format comparison unit 401 is used to determine whether the document formats of the two documents to be compared are the same in response to receiving two documents to be compared; the screen capture unit 402 is used to perform screen capture operation on the rendered display pages of the two documents to be compared when the document formats of the two documents to be compared are different, and obtain two sets of corresponding screen capture images; the text recognition unit 403 is used to perform text recognition on the two sets of screen capture images respectively, and obtain the corresponding first recognized text; the document comparison unit 404 is used to compare the first recognized text corresponding to the two sets of screen capture images to obtain a first text comparison result, and use the first text comparison result as the document comparison result of the two documents to be compared.

[0116] In some embodiments, the text recognition unit 403 includes a character recognition subunit and a splicing subunit. The character recognition subunit is used to process two sets of screen capture images using optical character recognition technology to obtain the recognized characters included in the two sets of screen capture images and the recognition positions of the recognized characters in the screen capture images; the splicing subunit is used to splice the recognized characters according to the recognition positions to obtain the corresponding first recognized text.

[0117] In some embodiments, the document comparison unit 404 acquires the difference text in the first text comparison result, marks the difference according to the recognition position of the difference text in a set of screen capture images, forms a difference mark map, and outputs the difference mark map as the document comparison result.

[0118] In some embodiments, the document comparison device 400 further includes a format conversion unit. The format conversion unit converts the format of one document to be compared according to the document format of the document to be compared, to obtain a converted document. The document comparison unit 404 is further configured to compare the text content of the converted document and the document to be compared, to obtain a second text comparison result; correspondingly, the document comparison unit refines the first text comparison result as the document comparison result of the two documents to be compared into: combining the first text comparison result and the second text comparison result, and using the combined text comparison result as the document comparison result of the two documents to be compared.

[0119] In some embodiments, the document comparison device 400 further includes a similarity comparison unit. The similarity comparison unit is used to calculate the image similarity between the two sets of screen capture images before comparing the first recognized text corresponding to the two sets of screen capture images to obtain a first text comparison result. If the similarity comparison unit determines that the image similarity is greater than a preset similarity, the document comparison unit 404 performs the operation of comparing the first recognized text corresponding to the two sets of screen capture images to obtain the first text comparison result.

[0120] In some embodiments, the similarity comparison unit calculates the grayscale gradient vectors of the two sets of screen capture images respectively, and then determines the image similarity between the two sets of screen capture images based on the grayscale gradient vectors.

[0121] In some embodiments, the format comparison unit 401, in response to receiving a document to be compared uploaded by a user, displays a document version query interface to the user. The document version query interface is used to display the document version to be queried to the user. In response to the user's selection operation for the target document in the document version query interface, the target document is used as another document to be compared.

[0122] This disclosure also provides a computing device for implementing the aforementioned software interface testing method. Figure 5 This is a schematic diagram of the structure of a computing device provided in some embodiments of this disclosure. See below for details. Figure 5 It shows a schematic diagram of a structure suitable for implementing the computing device 500 in the embodiments of this disclosure. Figure 5 The computing device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.

[0123] like Figure 5 As shown, the computing device 500 may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory ROM 502 or a program loaded from a storage device 508 into a random access memory RAM 503. The RAM 503 also stores various programs and data required for the operation of the computing device 500. The processing unit 501, ROM 502, and RAM 503 are interconnected via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0124] Typically, the following devices can be connected to I / O interface 505: input devices 506 including, for example, a touchscreen, touchpad, camera, microphone, accelerometer, gyroscope, etc.; output devices 507 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 508 including, for example, magnetic tape, hard disk, etc.; and communication devices 509. Communication device 509 allows computing device 500 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 5 A computing device 500 with various devices is shown; however, it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or included alternatively.

[0125] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 509, or installed from a storage device 508, or installed from a ROM 502. When the computer program is executed by the processing device 501, it performs the functions defined in the methods of embodiments of this disclosure.

[0126] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0127] In some implementations, clients and computing devices can communicate using any currently known or future-developed network protocol, such as HTTP (Hypertext Transfer Protocol), and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.

[0128] The aforementioned computer-readable medium may be included in the aforementioned computing device; or it may exist independently and not assembled into the computing device.

[0129] The aforementioned computer-readable medium carries one or more programs, which, when executed by the computing device, cause the computing device to: in response to determining two documents to be compared, determine whether the document formats of the two documents to be compared are the same; if the document formats of the two documents to be compared are different, perform screen capture operations on the rendered display pages of the two documents to be compared to obtain two sets of corresponding screen capture images; perform text recognition on the two sets of screen capture images respectively to obtain corresponding first recognized text; compare the first recognized text corresponding to the two sets of screen capture images to obtain a first text comparison result, and use the first text comparison result as the document comparison result of the two documents to be compared.

[0130] Computer program code for performing the operations of this disclosure can be written in one or more programming languages ​​or a combination thereof, including but not limited to object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or computing device. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0131] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0132] The units described in the embodiments of this disclosure can be implemented in software or hardware. The names of the units are not, in some cases, intended to limit the specific unit.

[0133] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.

[0134] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include, based on electrical connections of one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0135] This disclosure also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it can implement the methods of any of the above method embodiments. The execution method and beneficial effects are similar, and will not be described again here.

[0136] This disclosure also provides a vehicle that includes the aforementioned computing device. The vehicle can be a gasoline-powered vehicle, a pure electric vehicle, etc., and this disclosure does not limit the scope of the vehicle.

[0137] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0138] The above description is merely a specific embodiment of this disclosure, enabling those skilled in the art to understand or implement it. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this disclosure. Therefore, this disclosure is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method of document alignment, characterized by, The method comprises the following steps: in response to determining two documents to be compared, determining whether the document formats of the two documents to be compared are the same; in the case that the document formats of the two documents to be compared are different, performing a screen capture operation on the rendered display pages of the two documents to be compared to obtain two groups of screen capture images corresponding to the two documents to be compared; performing text recognition on the two groups of screen capture images respectively to obtain corresponding first recognized texts; comparing the first recognized texts corresponding to the two groups of screen capture images to obtain a first text comparison result, and determining a document comparison result of the two documents to be compared based on the first text comparison result; in the case that the document formats of the two documents to be compared are different and neither of the two documents to be compared is a picture format document, the method further comprises the following steps: performing format conversion on one of the two documents to be compared according to the document format of the other document to be compared to obtain a converted document; performing text content comparison on the converted document and the one of the two documents to be compared to obtain a second text comparison result; the step of determining the document comparison result of the two documents to be compared based on the first text comparison result comprises the following steps: integrating the first text comparison result and the second text comparison result, and taking the integrated text comparison result as the document comparison result of the two documents to be compared, wherein the integrated text comparison result is the intersection of the first text comparison result and the second text comparison result; the step of performing text recognition on the two groups of screen capture images respectively to obtain corresponding first recognized texts comprises the following steps: processing the two groups of screen capture images respectively by using an optical character recognition technology to obtain recognized characters included in the two groups of screen capture images and recognition positions of the recognized characters in the screen capture images; splicing the recognized characters according to the recognition positions to obtain the corresponding first recognized texts; the step of determining the document comparison result of the two documents to be compared based on the first text comparison result comprises the following steps: obtaining difference texts in the first text comparison result; performing difference marking according to the recognition positions of the difference texts in one of the two groups of screen capture images to form a difference marking image and outputting the difference marking image as the document comparison result.

2. The method of claim 1, wherein, before the step of comparing the first recognized texts corresponding to the two groups of screen capture images to obtain a first text comparison result, the method further comprises the following steps: performing image similarity calculation on the two groups of screen capture images to determine the image similarity of the two groups of screen capture images; in the case that the image similarity is greater than a preset similarity, performing the operation of comparing the first recognized texts corresponding to the two groups of screen capture images to obtain a first text comparison result.

3. The method of claim 2, wherein, the step of performing image similarity calculation on the two groups of screen capture images to determine the image similarity of the two groups of screen capture images comprises the following steps: calculating the gray gradient vectors of the two groups of screen capture images respectively; determining the image similarity of the two groups of screen capture images based on the gray gradient vectors.

4. The method of claim 1, wherein, the step of determining two documents to be compared comprises the following steps: in response to receiving one document to be compared uploaded by a user, displaying a document version query interface to the user, wherein the document version query interface is used to show the user a document version to be queried; In response to a selection operation of the user on the document version query interface for a target document, the target document is taken as another document to be compared.

5. A document alignment apparatus, characterized by, The method comprises the following steps: a format comparison unit is configured to, in response to a determination that two documents to be compared, judge whether the document formats of the two documents to be compared are the same; a screen capture unit is configured to, in the case that the document formats of the two documents to be compared are different, perform a screen capture operation on the rendered display pages of the two documents to be compared to obtain two groups of screen capture images corresponding to the two documents to be compared; a text recognition unit is configured to perform text recognition on the two groups of screen capture images respectively to obtain first recognized texts corresponding to the two groups of screen capture images; a document comparison unit is configured to compare the first recognized texts corresponding to the two groups of screen capture images to obtain a first text comparison result, and determine a document comparison result of the two documents to be compared based on the first text comparison result; the document comparison apparatus further comprises a format conversion unit, which is configured to, in the case that the document formats of the two documents to be compared are different and neither of the two documents to be compared is a picture format document, perform format conversion on one of the two documents to be compared according to the document format of the other document to be compared to obtain a converted document; the document comparison unit is further configured to perform text content comparison on the converted document and the one of the two documents to be compared to obtain a second text comparison result; the determination of the document comparison result of the two documents to be compared based on the first text comparison result comprises: synthesizing the first text comparison result and the second text comparison result, and taking the synthesized text comparison result as the document comparison result of the two documents to be compared, wherein the synthesized text comparison result is the intersection of the first text comparison result and the second text comparison result; the text recognition on the two groups of screen capture images respectively to obtain the first recognized texts corresponding to the two groups of screen capture images comprises: processing the two groups of screen capture images respectively by using an optical character recognition technology to obtain recognized characters included in the two groups of screen capture images and recognition positions of the recognized characters in the screen capture images; splicing the recognized characters according to the recognition positions to obtain the first recognized texts corresponding to the two groups of screen capture images; the determination of the document comparison result of the two documents to be compared based on the first text comparison result comprises: obtaining difference texts in the first text comparison result; performing difference marking according to the recognition positions of the difference texts in one of the two groups of screen capture images to form a difference marking map and outputting the difference marking map as the document comparison result.

6. A computing device, comprising: The apparatus comprises a processor and a memory, and the memory is configured to store a computer program; the computer program, when loaded by the processor, causes the processor to execute the document comparison method according to any one of claims 1-4.

7. A computer readable storage medium characterized in that, The storage medium stores a computer program, and when the computer program is executed by the processor, the processor implements the document comparison method according to any one of claims 1-4.

Citation Information

Patent Citations

  • Image similarity detection method and device, storage medium and electronic equipment

    CN111694978A

  • File comparison method and device

    CN112632952A

  • Contract comparison method and device and storage medium

    CN115376153A