CN110162510A - Transcription comparison method, device, computer equipment and storage medium - Google Patents
Transcription comparison method, device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN110162510A CN110162510A CN201910346060.1A CN201910346060A CN110162510A CN 110162510 A CN110162510 A CN 110162510A CN 201910346060 A CN201910346060 A CN 201910346060A CN 110162510 A CN110162510 A CN 110162510A
- Authority
- CN
- China
- Prior art keywords
- text
- original
- target
- contrast
- character string
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000013518 transcription Methods 0.000 title claims abstract description 76
- 230000035897 transcription Effects 0.000 title claims abstract description 76
- 238000000034 method Methods 0.000 title claims abstract description 51
- 238000003860 storage Methods 0.000 title claims abstract description 17
- 238000013515 script Methods 0.000 claims description 44
- 230000009466 transformation Effects 0.000 claims description 33
- 238000004590 computer program Methods 0.000 claims description 16
- 238000006243 chemical reaction Methods 0.000 claims description 13
- 241001269238 Data Species 0.000 claims description 6
- 238000010586 diagram Methods 0.000 description 10
- 230000006870 function Effects 0.000 description 6
- 238000012545 processing Methods 0.000 description 4
- 239000000203 mixture Substances 0.000 description 3
- 238000004364 calculation method Methods 0.000 description 2
- 230000001965 increasing effect Effects 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 1
- 230000006399 behavior Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000000052 comparative effect Effects 0.000 description 1
- 230000010485 coping Effects 0.000 description 1
- 238000013497 data interchange Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000005538 encapsulation Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000002708 enhancing effect Effects 0.000 description 1
- 230000014759 maintenance of location Effects 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 238000000926 separation method Methods 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 230000001360 synchronised effect Effects 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/16—File or folder operations, e.g. details of user interfaces specifically adapted to file systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/17—Details of further file system functions
- G06F16/1734—Details of monitoring file system events, e.g. by the use of hooks, filter drivers, logs
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/10—Text processing
- G06F40/194—Calculation of difference between files
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- Human Computer Interaction (AREA)
- Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Computational Linguistics (AREA)
- General Health & Medical Sciences (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a kind of transcription comparison method, device, computer equipment and storage mediums, and by obtaining transcription comparison's request, transcription comparison's request includes urtext mark and target text mark;Then it is identified according to urtext mark and the target text, obtains urtext and target text respectively;Again urtext and target text are converted to json data format respectively, obtain original Contrast's text and targeted contrast text;Institute's original Contrast's text and targeted contrast text are compared finally by the mode of recursive traversal, and each different information of original Contrast's text and targeted contrast text is exported in real time, wherein, different information is json data format, to solve the problems, such as that transcription comparison is inefficient.
Description
Technical field
The present invention relates to system monitoring field more particularly to a kind of transcription comparison method, device, computer equipment and storages
Medium.
Background technique
With the development of computer technology, higher and higher, current transcription comparison is required the comparison of different content of text
Tool mainly has Beyond Compare, Changes, Diff, json comparison tool and some online comparison tools etc..It passes
Transcription comparison method in system transcription comparison's tool is typically all simply to carry out simply to the content of text that needs compare
Ground matching, and the content of difference is exported.However, transcription comparison method in these transcription comparison's tools to specific efficiency compared with
It is low.
Summary of the invention
The embodiment of the present invention provides a kind of transcription comparison method, device, computer equipment and storage medium, to solve text
Compare inefficient problem.
A kind of transcription comparison method, comprising:
Transcription comparison's request is obtained, transcription comparison's request includes urtext mark and target text mark;
According to urtext mark and target text mark, urtext and target text are obtained respectively;
The urtext and the target text are converted to json data format respectively, obtain original Contrast's text and
Targeted contrast text;
Original Contrast's text and the targeted contrast text are compared by way of recursive traversal, and by institute
The each different information for stating original Contrast's text and the targeted contrast text is exported in real time, wherein the different information
For json data format.
A kind of transcription comparison's device, comprising:
Transcription comparison's request module, for obtaining transcription comparison's request, transcription comparison's request includes original text
This mark and target text identify;
Text obtains module, for being identified according to urtext mark and the target text, obtains respectively original
Text and target text;
Data format conversion module, for the urtext and the target text to be converted to json data lattice respectively
Formula obtains original Contrast's text and targeted contrast text;
Contrast module, for by way of recursive traversal by original Contrast's text and the targeted contrast text into
Row comparison, and each different information of original Contrast's text and the targeted contrast text is exported in real time, wherein
The different information is json data format.
A kind of computer equipment, including memory, processor and storage are in the memory and can be in the processing
The computer program run on device, the processor realize above-mentioned transcription comparison method when executing the computer program.
A kind of computer readable storage medium, the computer-readable recording medium storage have computer program, the meter
Calculation machine program realizes above-mentioned transcription comparison method when being executed by processor.
Above-mentioned transcription comparison method, device, computer equipment and storage medium, by obtaining transcription comparison's request, text
Comparison request includes urtext mark and target text mark;According to urtext mark and target text mark, obtain respectively
Take urtext and target text;Then urtext and target text are converted to json data format respectively, obtained original
Compare text and targeted contrast text;Original Contrast's text and targeted contrast text are carried out finally by the mode of recursive traversal
Comparison, and each different information of original Contrast's text and targeted contrast text is exported in real time, wherein different information is
Json data format;The accuracy of transcription comparison's efficiency and comparison is not only increased, also directly the difference exported in real time can be believed
Breath carries out operation processing.
Detailed description of the invention
In order to illustrate the technical solution of the embodiments of the present invention more clearly, below by institute in the description to the embodiment of the present invention
Attached drawing to be used is needed to be briefly described, it should be apparent that, the accompanying drawings in the following description is only some implementations of the invention
Example, for those of ordinary skill in the art, without any creative labor, can also be according to these attached drawings
Obtain other attached drawings.
Fig. 1 is the application environment schematic diagram of transcription comparison method in one embodiment of the invention;
Fig. 2 is the exemplary diagram of transcription comparison method in one embodiment of the invention;
Fig. 3 is another exemplary diagram of transcription comparison method in one embodiment of the invention;
Fig. 4 is another exemplary diagram of transcription comparison method in one embodiment of the invention;
Fig. 5 is another exemplary diagram of transcription comparison method in one embodiment of the invention;
Fig. 6 is another exemplary diagram of transcription comparison method in one embodiment of the invention;
Fig. 7 is a functional block diagram of transcription comparison's device in one embodiment of the invention;
Fig. 8 is another functional block diagram of transcription comparison's device in one embodiment of the invention;
Fig. 9 is another functional block diagram of transcription comparison's device in one embodiment of the invention;
Figure 10 is a schematic diagram of computer equipment in one embodiment of the invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description, it is clear that described embodiments are some of the embodiments of the present invention, instead of all the embodiments.Based on this hair
Embodiment in bright, every other implementation obtained by those of ordinary skill in the art without making creative efforts
Example, shall fall within the protection scope of the present invention.
Transcription comparison method provided in an embodiment of the present invention, text control methods can apply ring using as shown in Figure 1
In border.Specifically, text control methods is applied in transcription comparison's system, and text comparison system includes as shown in Figure 1
Client and server-side, client are communicated with server-side by network, for solving the problems, such as that transcription comparison is inefficient.
Wherein, client is also known as user terminal, refers to corresponding with server-side, provides the program of local service for client.Client can
It is mounted on but is not limited to various personal computers, laptop, smart phone, tablet computer and portable wearable device
On.Server-side can be realized with the server cluster of the either multiple server compositions of independent server.
In one embodiment, as shown in Fig. 2, providing a kind of transcription comparison method, the service in Fig. 1 is applied in this way
It is illustrated, includes the following steps: for end
S10: obtaining transcription comparison's request, and transcription comparison's request includes urtext mark and target text mark.
Wherein, transcription comparison's request refers to the request for obtaining and being triggered when comparing text.Text comparison request includes original
Beginning Text Flag and target text mark.Text Flag refers to a kind of symbol for identifying different texts, corresponding to each text
Text Flag all uniquely determine.Urtext mark refers to mark corresponding to the urtext of pending comparison.Target
Text Flag refers to mark corresponding to the comparison text of pending comparison.Specifically, urtext mark and target text mark
It can be made of at least one in number, letter, text or symbol.It is alternatively possible to using different text titles
Respectively as urtext mark and target text mark.
Specifically, the operation of text to be compared is obtained when user executes, after triggering transcription comparison's request, server-side can be from
Client obtains text comparison request.Such as: in an application scenarios, the operation of this method be based on user's smart phone or
On the computer page, the trigger control for obtaining urtext and comparing text is respectively equipped on the page, click on as user or
It touches urtext and compares the trigger control of text, obtain the page into urtext and target text obtains the page, and point
Corresponding urtext mark and target text mark are hit, after generating transcription comparison's request, the text is compared and requested by client
It is sent to server-side, server-side can obtain corresponding transcription comparison's request from client.
S20: it is identified according to urtext mark and target text, obtains urtext and target text respectively.
Wherein, urtext and target text refer to two texts to be compared of pending comparison, and urtext is wait compare
Cross reference file in text, target text are and another text to be compared discrepant on raw text content.Specifically, pass through
Urtext mark and target text mark, obtain urtext respectively and target text refers to through different Text Flags, point
The process of corresponding urtext and target text is not got from corresponding file or text path.
Preferably, it is identified for convenience according to urtext mark and target text, obtains urtext and target respectively
Text, can preset a file, and urtext and target text are pre-stored in this document folder, when getting
When the entrained urtext mark of transcription comparison's request and target text identify, it can be directly entered this document folder, then basis
Urtext mark and target text mark, get corresponding urtext and target text from this document folder.
S30: urtext and target text are converted to json data format respectively, obtain original Contrast's text and target
Compare text.
Wherein, json data format is a kind of data interchange format of lightweight, it uses and is totally independent of programming language
Text formatting store and indicate data.Succinctly and clearly hierarchical structure is not only easy to people's reading and compiles json data format
It writes, while being also easy to machine parsing and generating, and can effectively promote network transmission efficiency.Therefore, by by original document and
File destination is converted to json data format respectively, is conducive to subsequent quickly and accurately carry out transcription comparison.
Specifically, urtext and target text can be the text of the data formats such as map, xml or yaml, can be pre-
It first writes and various data formats (map, xml or yaml etc.) is converted to the class or function of json data format, and encapsulate
At conversion script, urtext and target text are converted to json data format respectively, obtain original Contrast's text and mesh
Mark comparison text.When carrying out text conversion, correspondence is first got according to the data format of urtext and target text respectively
Conversion script, then execute corresponding conversion script respectively for urtext and target text and be converted to json data lattice respectively
Formula obtains original Contrast's text and targeted contrast text.It is to be appreciated that urtext and the data format of target text can be with
Be it is identical, be also possible to it is different, but respectively after text converts obtained original Contrast's text and targeted contrast text
Originally json data format is belonged to.
S40: being compared original Contrast's text and targeted contrast text by way of recursive traversal, and will be original right
Each different information than text and targeted contrast text is exported in real time, wherein different information is json data format.
After obtaining original Contrast's text and targeted contrast text, by original Contrast's text by way of recursive traversal
It is compared with targeted contrast text, and the progress of each different information of original Contrast's text and targeted contrast text is defeated in real time
Out.Wherein, different information refers in the comparison process for carrying out recursive traversal to original Contrast's text and targeted contrast text, and institute is right
Than existing different specific content of text between original Contrast's text and targeted contrast text out.Optionally, different information
It may include the information such as difference content, difference type, differential position.Wherein, difference content, which refers to, has difference in two texts
Specific content of text, difference content may include the difference in difference section and targeted contrast text in original Contrast's text
Portion is in two sub-sections.Difference type can may include increasing, modifying for the type of difference section in two texts, difference type
Or delete, it is possible to understand that ground is added, modified or deleted both for for original Contrast's text.Differential position body
Existing difference content is the location of in original Contrast's text and targeted contrast text, and optionally, differential position can be by line number
To embody.
Specifically, in the process for being compared original Contrast's text and targeted contrast text by way of recursive traversal
In, if one contrasts and has differences information between original Contrast's text and targeted contrast text, immediately first by corresponding difference
Different Information encapsulation after json data format at exporting;Then again to other contents in original Contrast's text and targeted contrast text
Continue to compare.In the present embodiment, different information is packaged into after json data format and is exported again, subsequent call directly can be facilitated
The different information, and other processing operations are executed to the different information.
Illustratively, if including A1 in original Contrast's text is { " name ": " xia ", " info ": { " age ": " 18 ", "
Id ": " 1 " }, it include A2 in targeted contrast text is { " name ": " xia ", " info ": { " age ": " 19 ", " id ": "
1 " } }, A2 in targeted contrast text is found in the comparison process of recursive traversal " age ": " 19 " with A1 in original Contrast text
" age ": " 18 " differences, then first A1 and A2 is compared after resulting different information is packaged into json data format and is exported, example
Property, the different information of the json data format of output are as follows: " info ": { original " age ": " 18 " and target " age ": "
19"}};Then it is further continued for comparing other contents in original Contrast's text and targeted contrast text.
In the present embodiment, by obtaining transcription comparison's request, transcription comparison's request includes urtext mark and target
Text Flag;According to urtext mark and target text mark, urtext and target text are obtained respectively;It then will be original
Text and target text are converted to json data format respectively, obtain original Contrast's text and targeted contrast text;Finally by
The mode of recursive traversal compares original Contrast's text and targeted contrast text, and by original Contrast's text and targeted contrast
Each different information of text is exported in real time, further improves the Efficiency and accuracy of transcription comparison;Additionally, due to
The different information of output is json data format, also directly can carry out other operation processings to the different information of output.
In one embodiment, as shown in figure 3, by original Contrast's text and targeted contrast text by way of recursive traversal
Compare, and each different information of original Contrast's text and targeted contrast text exported in real time, specifically include as
Lower step:
S401: the target json in the original json character string and targeted contrast text in original Contrast's text is read line by line
Character string.
In json data format, data are all to exist in the form of json character string, therefore getting original Contrast's text
This respectively carries out line by line original Contrast's text and targeted contrast text in the form of json character string with after targeted contrast text
It reads, obtains the original json character string of original Contrast's text and the target json character string of targeted contrast text.It is understood that
The quantity of ground, original json character string and target json character string is at least one, and particular number is depending on real data.
S402: original json character string and target json character string are matched, and obtain correlation data, each comparison number
According to including original json character string and target json character string.
Wherein, correlation data refers to composed by after original json character string and the progress successful matching of target json character string
Json character string group, each correlation data include original json character string and target json character string.Specifically, by original json
Character string and target json character string carry out pairing and refer to original json character string and target json character string according to setting in advance
The process that fixed pairing rules are matched.Optionally, which can be by original json character string and target json
Character string is matched with behavior radix, or by original json character string and target json character string with single json word
Symbol string is that radix is matched.
Preferably, in order to improve the matching efficiency and accuracy of original json character string and target json character string.At this
In embodiment, pairing rules are to match original json character string and target json character string by radix of sentence, i.e., with text
Each branch in this is separation, and corresponding each original json character string and each target json character string are matched
It is right, obtain correlation data.
Illustratively: it can be by the first original json character string: if (!"&&!"consumes"equals
(newList.get(i))&&!" tags " equals (newList.get (i))) and first object json character string: if (!"
produces"equals(newList.get(i))&&!"consumes"equals(newList.get(i))&&!"tags"
Equals (newList.get (i))) matched, obtained by the first original json character string and first object json word
The correlation data of symbol string composition.
S403: in each correlation data original json character string and target json character string carry out contrast difference, obtain
To comparing result, comparing result includes identical and different.
Wherein, comparing result is to judge that original json character string in correlation data and target json character string whether there is
The result of difference.Comparing result includes identical and different.Optionally, after forming comparison data, string matching can be used
Method in each correlation data original json character string and target json character string carry out contrast difference, to judge each comparison
Original json character string and target json character string in data whether there is difference, obtain comparing result.If in correlation data
Original json character string and target json string matching success, then it represents that original json character string in the correlation data and
Target json character string is identical, difference is not present, i.e. comparing result is identical.If the original json character in correlation data
String and target json string matching failure, then it represents that original json character string and target json character string in the correlation data
It has differences, i.e., comparing result is not identical.
S404: obtaining comparing result is the original json character string and target json character string in different correlation datas
Variance data.
Wherein, variance data refers to the number that original json character string in correlation data and target json character string have differences
According to.Specifically, according in each correlation data of step S403 original json character string and target json character string carry out it is poor
After different comparison, can directly acquire comparing result is the original json character string and target json character string in different correlation datas
Variance data.
S405: variance data is packaged into json data format, obtains different information.
Specifically, each variance data obtained according to step S404 is packaged into json character string, and will be packaged
The different information of json data format exports in time.Optionally, variance data being packaged into json data format can compile in advance
One data packet being made of the class or function of json data structure, it is after obtaining variance data, each variance data is defeated
Enter into the data packet of the json data structure and handled, finally exports the different information of json data format one by one.
In the present embodiment, by being read in original json character string and targeted contrast text in original Contrast's text line by line
Target json character string, then original json character string and target json character string are matched, obtain correlation data, often
One comparison data packet includes original json character string and target json character string;Again to the original json character in each correlation data
String and target json character string carry out contrast difference, obtain comparing result, comparing result includes identical and different;And obtain comparison
It as a result is the variance data of original json character string and target json character string in different correlation datas, finally by difference number
According to json data format is packaged into, different information is obtained;Not only realize output original Contrast's text in real time and targeted contrast text
This different information also improves the accuracy for comparing original Contrast's text and targeted contrast text.
In one embodiment, it as shown in figure 4, urtext and target text are converted to json data format respectively, obtains
To original Contrast's text and targeted contrast text, specifically comprise the following steps:
S301: the raw data format of urtext and the target data format of target text are obtained respectively.
Wherein, raw data format is data format corresponding to urtext.Target data format is target text institute
Corresponding data format.Optionally, raw data format and target data format can be any in map, xml or yaml
One kind, i.e. urtext and target text can be the text of same or different data format.Such as: urtext it is original
The target data format of data format and target text is all that the raw data format of xml or urtext is xml, target
The target data format of text is yaml.Specifically, can by respectively by the extension name of original document and file destination come
Judge data format corresponding to original document and file destination.For example, the extension entitled " xml " by original document obtains
Raw data format to urtext is xml;Extension entitled " yaml " by target text gets target text
Target data format is yaml.
S302: it according to the target data format of the raw data format of urtext and target text, obtains correspond to respectively
Original transformation script and targeted transformation script.
Wherein, original transformation script is the pre-configured script for converting urtext to json data format.Mesh
Mark conversion script is the pre-configured script for converting target text to json data format.In the present embodiment, each
Original transformation script is all associated with corresponding raw data format in advance, each targeted transformation script all in advance with corresponding mesh
It is associated to mark data format.Therefore corresponding original transformation script, root can be got according to the raw data format of urtext
According to the target data format of target text, corresponding targeted transformation script can be got.It is to be appreciated that original transformation script and
Targeted transformation script can be identical, can not also be identical, the raw data format and target text with specific reference to urtext
Target data format determines, original if the raw data format of urtext is identical with the target data format of target text
It converts script and targeted transformation script is also identical, otherwise original transformation script and targeted transformation script be not identical.
S303: original transformation script and targeted transformation script are used, is respectively packaged into urtext and target text
Json data format obtains original Contrast's text and targeted contrast text.
Specifically, after obtaining original transformation script and targeted transformation script, by executing the two conversion scripts, just
Urtext and target text json data format be can be packaged into respectively, original Contrast's text and targeted contrast text obtained
This.
In the present embodiment, by obtaining the raw data format of urtext and the target data lattice of target text respectively
Formula;Then it according to the target data format of the raw data format of urtext and target text, obtains respectively corresponding original
Convert script and targeted transformation script;Original transformation script and targeted transformation script are finally used, respectively by urtext and mesh
Mark text is packaged into json data format, obtains original Contrast's text and targeted contrast text;It ensure that different data format
Urtext and target text can rapidly carry out the conversion of data format.
In one embodiment, as shown in figure 5, to the original json character string and target json character in each correlation data
String carries out contrast difference, specifically comprises the following steps:
S4031: if the original json character string and target json character string in correlation data be respectively original object and
Target object then reads original key and target key in original object and target object, and to original key and target
Key carries out contrast difference, obtains comparing result.
Wherein, object is the base class of all classes in json character string, and all classes are all inherited from object.Specifically, if
Original json character string and target json character string in correlation data are respectively original object and target object, then read
The target key in original key and target object in original object, and judge whether original key and target key are identical,
If original key is different with target key, directly exporting original key and target key is different comparing results;And it jumps out original
Circulation where key and target key, i.e., the value for no longer being included to original key and target key carry out contrast difference.If former
Beginning key is identical with target key, then continues all sub- value for reading original key and target key is included, and comparison is obtained
Different value export in time;Then the comparison of next json character string is executed again.
S4032: if the original json character string and target json character string in correlation data are respectively original value and mesh
Value is marked, then original value and target value is directly subjected to contrast difference, obtains comparing result.
Specifically, if original json character string and target json character string in correlation data be respectively original value and
Original value and target value then directly can be carried out contrast difference, judge original value and target value by target value
It is whether identical;If original value is identical with target value, obtained comparing result is identical, and continues to execute next json
The comparison of character string;If original value and target value be not identical, obtained comparing result is difference, and will first be compared
To different original value and target value be packaged into after json data format and export in time, then execute next json character
The comparison of string.
S4033: if the original json character string and target json character string in correlation data are respectively original array and mesh
Array is marked, then original array and target array is traversed, obtains original sub- value and the target in original array
The sub- value of target in array, and original sub- value and the sub- value of target are subjected to contrast difference, obtain comparing result.
Specifically, if original json character string and target json character string in correlation data be respectively original array and
Target array then traverses original array and target array, is original until reading the element in original array
When element in sub- value, target array is target sub- value, then original sub- value and the sub- value of target are subjected to difference
Comparison, obtains comparing result, and first exports the different original sub- value and the sub- value of target that comparison obtains in time, then hold
The comparison of the next json character string of row.
In the present embodiment, if the original json character string and target json character string in correlation data are respectively original
Object and target object then reads original key and target key in original object and target object, and to original
Key and target key carries out contrast difference, obtains comparing result;If original json character string and target json in correlation data
Character string is respectively original value and target value, then original value and target value is directly carried out contrast difference, obtained
To comparing result;If the original json character string and target json character string in correlation data are respectively original array and target
Array then traverses original array and target array, obtains original sub- value and the target in original array
The sub- value of target in array, and original sub- value and the sub- value of target are subjected to contrast difference, obtain comparing result;Into
One step improves the accuracy and actual effect for comparing original Contrast's file and targeted contrast file
In one embodiment, as shown in fig. 6, by way of recursive traversal to original Contrast's text and the target pair
Before the step of comparing than text, transcription comparison method further includes following steps:
S41: original Contrast's text and targeted contrast text are obtained.
Specifically, original transformation script and targeted transformation script are being used according to step S303, respectively by urtext and
Target text is packaged into json data format, and after obtaining original Contrast's text and targeted contrast text, it is original right to directly acquire
Than text and targeted contrast text.
S42: the similarity between original Contrast's text and targeted contrast text is calculated.
Specifically, calculate the similarity between original Contrast's text and targeted contrast text refer to calculate original Contrast's text and
Overall similarity between targeted contrast text.Optionally, text similarity comparison tool can be used and calculate original Contrast's text
Similarity between targeted contrast text can also calculate original Contrast's text and targeted contrast text by java compiler language
Similarity between this can also calculate original Contrast's text and targeted contrast text using Python text similarity analysis method
Similarity between this.This programme, which does not do the method for calculating the similarity between original Contrast's text and targeted contrast text, to be had
Body limitation, user can customized selection according to the actual situation.
S43: if the similarity between original Contrast's text and targeted contrast text is less than threshold similarity, comparison is issued
Error message.
Wherein, threshold similarity, which refers to, judges whether the similarity between original Contrast's text and targeted contrast text conforms to
The lowest critical value asked.Such as: threshold similarity can be 10%, 15% or 20% etc..Preferably, in order to improve original Contrast
The accuracy compared between text and targeted contrast text sets 20% for threshold similarity in the present embodiment, if calculating
The similarity between original Contrast's text and targeted contrast text is obtained less than 20%, then not to original Contrast's text and target pair
It is compared than text, but issues comparison error message to client.Comparison error message refers to prompt user original Contrast text
This targeted contrast text between similarity it is too low, without comparative information.
In the present embodiment, by obtaining original Contrast's text and targeted contrast text;Calculate original Contrast's text and target
The similarity between text is compared, if the similarity between original Contrast's text and targeted contrast text is less than threshold similarity,
Then issue comparison error message;Improve the subsequent efficiency compared to original Contrast's text and targeted contrast text.
It should be understood that the size of the serial number of each step is not meant that the order of the execution order in above-described embodiment, each process
Execution sequence should be determined by its function and internal logic, the implementation process without coping with the embodiment of the present invention constitutes any limit
It is fixed.
In one embodiment, a kind of transcription comparison's device is provided, the text compares text pair in device and above-described embodiment
Ratio method corresponds.As shown in fig. 7, text comparison device includes transcription comparison's request module 10, text acquisition mould
Block 20, data format conversion module 30 and contrast module 40.Detailed description are as follows for each functional module:
Transcription comparison's request module 10, for obtaining transcription comparison's request, transcription comparison's request includes urtext
Mark and target text mark;
Text obtain module 20, for according to urtext mark and target text identify, respectively obtain urtext and
Target text;
Data format conversion module 30 is obtained for urtext and target text to be converted to json data format respectively
To original Contrast's text and targeted contrast text;
Contrast module 40, for being carried out original Contrast's text and targeted contrast text pair by way of recursive traversal
Than and each different information of original Contrast's text and targeted contrast text being exported in real time, wherein different information is
Json data format.
Preferably, as shown in figure 8, contrast module 40 includes:
Character string reading submodule 401, for reading original json character string and target in original Contrast's text line by line
Compare the target json character string in text;
Character string pairing submodule 402 is obtained for matching original json character string and target json character string
Correlation data, each correlation data include original json character string and target json character string;
Contrast difference's submodule 403, for the original json character string and target json character in each correlation data
String carries out contrast difference, obtains comparing result, comparing result includes identical and different;
Variance data acquisition submodule 404 is the original json word in different correlation datas for obtaining comparing result
The variance data of symbol string and target json character string;
Variance data encapsulates submodule 405 and obtains different information for variance data to be packaged into json data format.
Preferably, as shown in figure 9, data format conversion module 30 includes:
Data format acquisition submodule 301, for respectively obtaining the raw data format and target text of urtext
Target data format;
Script acquisition submodule 302 is converted, for according to the raw data format of urtext and the target of target text
Data format obtains corresponding original transformation script and targeted transformation script respectively;
Text encapsulates submodule 303, for using original transformation script and targeted transformation script, respectively by urtext and
Target text is packaged into json data format, obtains original Contrast's text and targeted contrast text.
Preferably, contrast difference's submodule 403 includes:
Key comparison unit, for the original json character string and target json character string respectively original in correlation data
When beginning object and target object, the original key and target key in original object and target object are read, and to original
Beginning key and target key carries out contrast difference, obtains comparing result;
Value comparison unit, in correlation data original json character string and target json character string be respectively
When original value and target value, original value and target value is directly subjected to contrast difference, obtains comparing result;
Array comparison unit, in correlation data original json character string and target json character string be respectively
When original array and target array, original array and target array are traversed, obtain the original son in original array
The sub- value of target in value and target array, and original sub- value and the sub- value of target are subjected to contrast difference, it obtains
Comparing result.
Preferably, the text compares device further include:
It compares text and obtains module, for obtaining original Contrast's text and targeted contrast text;
Similarity calculation module, for calculating the similarity between original Contrast's text and targeted contrast text;
Error message sending module is compared, is less than for the similarity between original Contrast's text and targeted contrast text
When threshold similarity, comparison error message is issued.
Specific about transcription comparison's device limits the restriction that may refer to above for transcription comparison method, herein not
It repeats again.Modules in above-mentioned transcription comparison's device can be realized fully or partially through software, hardware and combinations thereof.On
Stating each module can be embedded in the form of hardware or independently of in the processor in computer equipment, can also store in a software form
In memory in computer equipment, the corresponding operation of the above modules is executed in order to which processor calls.
In one embodiment, a kind of computer equipment is provided, which can be server, internal junction
Composition can be as shown in Figure 10.The computer equipment include by system bus connect processor, memory, network interface and
Database.Wherein, the processor of the computer equipment is for providing calculating and control ability.The memory packet of the computer equipment
Include non-volatile memory medium, built-in storage.The non-volatile memory medium is stored with operating system, computer program and data
Library.The built-in storage provides environment for the operation of operating system and computer program in non-volatile memory medium.The calculating
The database of machine equipment is used to store the data used in the transcription comparison method in above-described embodiment.The computer equipment
Network interface is used to communicate with external terminal by network connection.To realize one kind when the computer program is executed by processor
Transcription comparison method.
In one embodiment, a kind of computer equipment is provided, including memory, processor and storage are on a memory
And the computer program that can be run on a processor, processor realize the text ratio in above-described embodiment when executing computer program
To method.
In one embodiment, a kind of computer readable storage medium is provided, computer program is stored thereon with, is calculated
Machine program realizes the text comparison method in above-described embodiment when being executed by processor.
Those of ordinary skill in the art will appreciate that realizing all or part of the process in above-described embodiment method, being can be with
Relevant hardware is instructed to complete by computer program, the computer program can be stored in a non-volatile computer
In read/write memory medium, the computer program is when being executed, it may include such as the process of the embodiment of above-mentioned each method.Wherein,
To any reference of memory, storage, database or other media used in each embodiment provided herein,
Including non-volatile and/or volatile memory.Nonvolatile memory may include read-only memory (ROM), programming ROM
(PROM), electrically programmable ROM (EPROM), electrically erasable ROM (EEPROM) or flash memory.Volatile memory may include
Random access memory (RAM) or external cache.By way of illustration and not limitation, RAM is available in many forms,
Such as static state RAM (SRAM), dynamic ram (DRAM), synchronous dram (SDRAM), double data rate sdram (DDRSDRAM), enhancing
Type SDRAM (ESDRAM), synchronization link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM
(RDRAM), direct memory bus dynamic ram (DRDRAM) and memory bus dynamic ram (RDRAM) etc..
It is apparent to those skilled in the art that for convenience of description and succinctly, only with above-mentioned each function
Can unit, module division progress for example, in practical application, can according to need and by above-mentioned function distribution by different
Functional unit, module are completed, i.e., the internal structure of described device is divided into different functional unit or module, more than completing
The all or part of function of description.
Embodiment described above is merely illustrative of the technical solution of the present invention, rather than its limitations;Although referring to aforementioned reality
Applying example, invention is explained in detail, those skilled in the art should understand that: it still can be to aforementioned each
Technical solution documented by embodiment is modified or equivalent replacement of some of the technical features;And these are modified
Or replacement, the spirit and scope for technical solution of various embodiments of the present invention that it does not separate the essence of the corresponding technical solution should all
It is included within protection scope of the present invention.
Claims (10)
1. a kind of transcription comparison method characterized by comprising
Transcription comparison's request is obtained, transcription comparison's request includes urtext mark and target text mark;
According to urtext mark and target text mark, urtext and target text are obtained respectively;
The urtext and the target text are converted to json data format respectively, obtain original Contrast's text and target
Compare text;
Original Contrast's text and the targeted contrast text are compared by way of recursive traversal, and by the original
Begin comparison text and each different information of the targeted contrast text is exported in real time, wherein the different information is
Json data format.
2. transcription comparison method as described in claim 1, which is characterized in that it is described will be original right by way of recursive traversal
It is compared than text and targeted contrast text, and each different information of original Contrast's text and targeted contrast text is carried out
Output in real time, specifically includes:
The target json in the original json character string and the targeted contrast text in original Contrast's text is read line by line
Character string;
The original json character string and the target json character string are matched, correlation data is obtained, it is each described right
It include the original json character string and the target json character string than data;
To in each correlation data the original json character string and the target json character string carry out contrast difference,
Comparing result is obtained, the comparing result includes identical and different;
Obtaining the comparing result is the original json character string and the target json in the different correlation datas
The variance data of character string;
The variance data is packaged into json data format, obtains different information.
3. transcription comparison method as described in claim 1, which is characterized in that described to turn urtext and target text respectively
It is melted into json data format, original Contrast's text and targeted contrast text is obtained, specifically includes:
The raw data format of the urtext and the target data format of the target text are obtained respectively;
According to the target data format of the raw data format of the urtext and the target text, obtain respectively
Take corresponding original transformation script and targeted transformation script;
Using the original transformation script and the targeted transformation script, the urtext and the target text are sealed respectively
Json data format is dressed up, original Contrast's text and targeted contrast text are obtained.
4. transcription comparison method as claimed in claim 2, which is characterized in that the original json in each correlation data
Character string and target json character string carry out contrast difference, specifically include:
If the original json character string and the target json character string in the correlation data are respectively original object
With target object, then the original object and original key and target key in the target object are read, and to institute
It states the original key and target key and carries out contrast difference, obtain comparing result;
If the original json character string and the target json character string in the correlation data be respectively original value and
The original value and target value is then directly carried out contrast difference, obtains comparing result by target value;
If the original json character string and the target json character string in the correlation data be respectively original array and
Target array then traverses the original array and the target array, obtains original in the original array
The sub- value of target in sub- value and the target array, and by the original sub- value and sub- value of the target into
Row contrast difference, obtains comparing result.
5. transcription comparison method as described in claim 1, which is characterized in that it is described by way of recursive traversal to described
Before the step of original Contrast's text and the targeted contrast text compare, the transcription comparison method further include:
Obtain original Contrast's text and the targeted contrast text;
Calculate the similarity between original Contrast's text and the targeted contrast text;
If the similarity between original Contrast's text and the targeted contrast text is less than threshold similarity, comparison is issued
Error message.
6. a kind of transcription comparison's device characterized by comprising
Transcription comparison's request module, for obtaining transcription comparison's request, transcription comparison's request includes urtext mark
Know and target text identifies;
Text obtains module, for identifying according to urtext mark and the target text, obtains urtext respectively
And target text;
Data format conversion module, for the urtext and the target text to be converted to json data format respectively,
Obtain original Contrast's text and targeted contrast text;
Contrast module, for being carried out original Contrast's text and the targeted contrast text pair by way of recursive traversal
Than, and each different information of original Contrast's text and the targeted contrast text is exported in real time, wherein it is described
Different information is json data format.
7. transcription comparison's device as claimed in claim 6, which is characterized in that the contrast module includes:
Character string reading submodule, for reading original json character string and the target in original Contrast's text line by line
Compare the target json character string in text;
Character string pairing submodule is obtained for matching the original json character string and the target json character string
To correlation data, each correlation data includes the original json character string and the target json character string;
Contrast difference's submodule, for in each correlation data the original json character string and the target json
Character string carries out contrast difference, obtains comparing result, the comparing result includes identical and different;
Variance data acquisition submodule is described original in the different correlation datas for obtaining the comparing result
The variance data of json character string and the target json character string;
Variance data encapsulates submodule and obtains different information for the variance data to be packaged into json data format.
8. transcription comparison's device as claimed in claim 6, which is characterized in that the data format conversion module includes:
Data format acquisition submodule, for obtaining the raw data format and the target text of the urtext respectively
Target data format;
Script acquisition submodule is converted, for according to the raw data format of the urtext and the target text
The target data format obtains corresponding original transformation script and targeted transformation script respectively;
Text encapsulates submodule, respectively will be described original for using the original transformation script and the targeted transformation script
Text and the target text are packaged into json data format, obtain original Contrast's text and targeted contrast text.
9. a kind of computer equipment, including memory, processor and storage are in the memory and can be in the processor
The computer program of upper operation, which is characterized in that the processor realized when executing the computer program as claim 1 to
Any one of 5 transcription comparison methods.
10. a kind of computer readable storage medium, the computer-readable recording medium storage has computer program, and feature exists
In realization transcription comparison method as described in any one of claim 1 to 5 when the computer program is executed by processor.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910346060.1A CN110162510A (en) | 2019-04-26 | 2019-04-26 | Transcription comparison method, device, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910346060.1A CN110162510A (en) | 2019-04-26 | 2019-04-26 | Transcription comparison method, device, computer equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110162510A true CN110162510A (en) | 2019-08-23 |
Family
ID=67640208
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910346060.1A Pending CN110162510A (en) | 2019-04-26 | 2019-04-26 | Transcription comparison method, device, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110162510A (en) |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111090788A (en) * | 2019-12-03 | 2020-05-01 | 广州品唯软件有限公司 | Json file comparison method and device, storage medium and computer equipment |
CN111103635A (en) * | 2019-12-04 | 2020-05-05 | 上海眼控科技股份有限公司 | Meteorological data processing method, system, electronic equipment and storage medium |
CN113590467A (en) * | 2021-06-30 | 2021-11-02 | 平安健康保险股份有限公司 | Data comparison method, system, computer equipment and computer readable storage medium |
CN115455950A (en) * | 2022-09-27 | 2022-12-09 | 中科雨辰科技有限公司 | Data processing system for acquiring text |
CN116644083A (en) * | 2023-07-24 | 2023-08-25 | 苏州浪潮智能科技有限公司 | Data updating method, device, equipment and storage medium |
CN117370398A (en) * | 2023-11-15 | 2024-01-09 | 航天信息(广东)有限公司 | Comparison method and device for changing data |
CN117852521A (en) * | 2024-03-07 | 2024-04-09 | 成都中科合迅科技有限公司 | Data calculation result file comparison method, system and comparison configuration system |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103034622A (en) * | 2012-12-05 | 2013-04-10 | 北京奇虎科技有限公司 | Rich text content processing method and server |
CN107707415A (en) * | 2017-11-23 | 2018-02-16 | 成都知道创宇信息技术有限公司 | A kind of automatic monitoring of server configuration and alarm method based on SaltStack |
CN109190092A (en) * | 2018-08-15 | 2019-01-11 | 深圳平安综合金融服务有限公司上海分公司 | The consistency checking method of separate sources file |
-
2019
- 2019-04-26 CN CN201910346060.1A patent/CN110162510A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103034622A (en) * | 2012-12-05 | 2013-04-10 | 北京奇虎科技有限公司 | Rich text content processing method and server |
CN107707415A (en) * | 2017-11-23 | 2018-02-16 | 成都知道创宇信息技术有限公司 | A kind of automatic monitoring of server configuration and alarm method based on SaltStack |
CN109190092A (en) * | 2018-08-15 | 2019-01-11 | 深圳平安综合金融服务有限公司上海分公司 | The consistency checking method of separate sources file |
Cited By (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111090788A (en) * | 2019-12-03 | 2020-05-01 | 广州品唯软件有限公司 | Json file comparison method and device, storage medium and computer equipment |
CN111090788B (en) * | 2019-12-03 | 2023-10-13 | 广州品唯软件有限公司 | json file comparison method and device, storage medium and computer equipment |
CN111103635A (en) * | 2019-12-04 | 2020-05-05 | 上海眼控科技股份有限公司 | Meteorological data processing method, system, electronic equipment and storage medium |
CN113590467A (en) * | 2021-06-30 | 2021-11-02 | 平安健康保险股份有限公司 | Data comparison method, system, computer equipment and computer readable storage medium |
CN113590467B (en) * | 2021-06-30 | 2023-07-21 | 平安健康保险股份有限公司 | Data comparison method, system, computer device and computer readable storage medium |
CN115455950A (en) * | 2022-09-27 | 2022-12-09 | 中科雨辰科技有限公司 | Data processing system for acquiring text |
CN116644083A (en) * | 2023-07-24 | 2023-08-25 | 苏州浪潮智能科技有限公司 | Data updating method, device, equipment and storage medium |
CN116644083B (en) * | 2023-07-24 | 2023-11-03 | 苏州浪潮智能科技有限公司 | Data updating method, device, equipment and storage medium |
CN117370398A (en) * | 2023-11-15 | 2024-01-09 | 航天信息(广东)有限公司 | Comparison method and device for changing data |
CN117370398B (en) * | 2023-11-15 | 2024-05-28 | 航天信息(广东)有限公司 | Comparison method and device for changing data |
CN117852521A (en) * | 2024-03-07 | 2024-04-09 | 成都中科合迅科技有限公司 | Data calculation result file comparison method, system and comparison configuration system |
CN117852521B (en) * | 2024-03-07 | 2024-06-07 | 成都中科合迅科技有限公司 | Data calculation result file comparison method, system and comparison configuration system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110162510A (en) | Transcription comparison method, device, computer equipment and storage medium | |
CN108932122B (en) | Interface document generation method, device, computer equipment and storage medium | |
US10824691B2 (en) | Page rendering method, device, and data storage medium | |
CN110083790A (en) | Page editing method, page output method, device, computer equipment and medium | |
CN109445842A (en) | Rule generating method, device, computer equipment and storage medium | |
CN110162509A (en) | File comparison method, device, computer equipment and storage medium | |
US10977159B2 (en) | Instrumentation of user actions in software applications | |
CN112559354A (en) | Front-end code specification detection method and device, computer equipment and storage medium | |
US20110289486A1 (en) | System and Method for Debugging Dynamically Generated Code of an Application | |
CN111078555B (en) | Test file generation method, system, server and storage medium | |
CN109460220A (en) | The predefined code generating method of message, device, electronic equipment and storage medium | |
CN110650091B (en) | Routing configuration information processing method and device, computer equipment and storage medium | |
CN111581920A (en) | Document conversion method, device, equipment and computer storage medium | |
CN112187713B (en) | Message conversion method, device, computer equipment and storage medium | |
CN110134397A (en) | Code snippet interpretation method, device, computer equipment and storage medium | |
CN113312108A (en) | SWIFT message checking method and device, electronic equipment and storage medium | |
CN109685668A (en) | Order batch processing method, device, computer equipment and storage medium | |
CN106919374B (en) | Script generation method and device | |
CN112433929A (en) | Webpage debugging method and device, computer equipment and storage medium | |
CN112800194B (en) | Interface change identification method, device, equipment and storage medium | |
CN114020589B (en) | Buried point processing method, buried point processing device, computer equipment and storage medium | |
CN117076410A (en) | PDF file generation method, processing method, device and storage medium | |
CN112597023A (en) | Case management method and device based on guide picture, computer equipment and storage medium | |
CN111240790A (en) | Multi-language adaptation method and device for application, client and storage medium | |
CN109614188A (en) | A kind of page online help method, apparatus, computer equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20190823 |
|
WD01 | Invention patent application deemed withdrawn after publication |