CN109710904B - Text accuracy rate calculation method and device based on semantic analysis and computer equipment - Google Patents

Text accuracy rate calculation method and device based on semantic analysis and computer equipment Download PDF

Info

Publication number
CN109710904B
CN109710904B CN201811348583.1A CN201811348583A CN109710904B CN 109710904 B CN109710904 B CN 109710904B CN 201811348583 A CN201811348583 A CN 201811348583A CN 109710904 B CN109710904 B CN 109710904B
Authority
CN
China
Prior art keywords
text
distance matrix
track
edit distance
characters
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.)
Active
Application number
CN201811348583.1A
Other languages
Chinese (zh)
Other versions
CN109710904A (en
Inventor
吴建财
邹芳
邢艳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201811348583.1A priority Critical patent/CN109710904B/en
Priority to PCT/CN2018/124398 priority patent/WO2020098098A1/en
Publication of CN109710904A publication Critical patent/CN109710904A/en
Application granted granted Critical
Publication of CN109710904B publication Critical patent/CN109710904B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G10MUSICAL INSTRUMENTS; ACOUSTICS
    • G10LSPEECH ANALYSIS TECHNIQUES OR SPEECH SYNTHESIS; SPEECH RECOGNITION; SPEECH OR VOICE PROCESSING TECHNIQUES; SPEECH OR AUDIO CODING OR DECODING
    • G10L15/00Speech recognition
    • G10L15/26Speech to text systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Computational Linguistics (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • Acoustics & Sound (AREA)
  • Multimedia (AREA)
  • Machine Translation (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to the technical field of semantic analysis, in particular to a text accuracy calculation method, a text accuracy calculation device and computer equipment based on semantic analysis. When the initial point of a template text starts to be transcribed, an edit distance matrix is established, the value of each element in the edit distance matrix is calculated, a track matrix is generated according to the calculated track of the value of each element in the edit distance matrix, the similarity of each track in the track matrix is calculated, one track with the highest similarity is screened to obtain a first track, the corresponding end point of a part of transcribed text on the template text is obtained according to the first track, thus a new template text is obtained, the part of transcribed text is compared with the new template text, the accuracy of the part of transcribed text is calculated, and the problem that the accuracy of transcription of the text cannot be accurately calculated when the part of text is transcribed is solved by the existing text transcription accuracy algorithm.

Description

Text accuracy rate calculation method and device based on semantic analysis and computer equipment
Technical Field
The application relates to the technical field of semantic analysis, in particular to a text accuracy calculation method, a text accuracy calculation device and computer equipment based on semantic analysis.
Background
In the case of statistical ASR (speech recognition) engine transcription accuracy, a common algorithm is the edit distance algorithm. The algorithm calculates the similarity (transcription accuracy) of the transcribed text to the template text by counting the number of times the least editing operation (editing operation includes replacing one character with another, inserting a character, deleting a character) required to transcribe the text to the template text. But in a scenario where the accuracy of real-time transcription of an ASR engine is of concern, the calculation result of this algorithm is not satisfactory. Since the algorithm always compares the text that has been transcribed with the entire text of the template text, the algorithm cannot accurately calculate the transcription accuracy of the transcribed text when only a portion of the text is transcribed. Thus, edit distance is not applicable in scenarios where ASR engine real-time transcription accuracy is a concern.
Content of the application
Aiming at the defects of the prior art, the application provides a text accuracy calculating method, a text accuracy calculating device and a computer device based on semantic analysis, which aim to solve the problem that the text transcription accuracy can not be accurately calculated when part of text is transcribed by comparing the transcribed text with all the text of a template text in the existing text transcription accuracy algorithm.
The technical scheme provided by the application is as follows:
a text accuracy computing method based on semantic parsing, the method comprising:
acquiring a part of transcribed text transcribed from the initial point of the template text;
establishing an edit distance matrix by taking the length of the template text character increased by two characters as a column number and the length of the partial transfer text character increased by two characters as a line number;
calculating the value of each element in the editing distance matrix according to the partial transfer text and the template text;
recording the calculated track of the values of each element in the edit distance matrix, and generating a track matrix corresponding to the edit distance matrix;
calculating the similarity of all tracks in the track matrix, screening one track with the highest similarity between the partial transfer text and the template text, and obtaining a first track;
determining a corresponding end point of the partial transfer text on the template text according to the first track to obtain a first end point;
acquiring a new template text from the template text according to the initial point and the first end point of the template text;
and comparing the partial transcribed text with the new template text, and calculating the accuracy of the partial transcribed text through an edit distance algorithm.
Further, after the step of creating an edit distance matrix by using the length of the template text character increased by two characters as the column number and the length of the partial transcribed text character increased by two characters as the row number, before the step of calculating the value of each element in the edit distance matrix according to the partial transcribed text and the template text, the method comprises:
inputting characters of the template text starting from a third element of the first row of the edit distance matrix;
inputting characters of the partially transcribed text starting from a third element of the first column of the edit distance matrix;
defining a value of 0 for a second element in a second row of the edit distance matrix;
sequentially increasing the value 1 by taking the value of a second element in the second row of the editing distance matrix as 0, and initializing the value of each element in the second row of the editing distance matrix;
sequentially increasing the value 1 by taking the value of the second element in the second column of the edit distance matrix as 0, and initializing the value of each element in the second column of the edit distance matrix.
Further, the value of each element in the edit distance matrix that is not initialized is determined by the value of one element in the left, upper left and upper directions, and the step of calculating the value of each element in the edit distance matrix according to the partially transcribed text and the template text includes:
Identifying the column number and the row number of a third element in a third column of the edit distance matrix;
identifying the column number and the line number of a third element in a third column of the edit distance matrix to respectively correspond to the characters of the template text and the characters of the partial transfer text;
judging whether the number of columns of the third element in the third column of the edit distance matrix corresponds to the characters of the template text and the number of rows of the third element in the third column of the edit distance matrix corresponds to the characters of the partial transcription text;
if the number of columns of the third element in the third column of the edit distance matrix corresponds to the character of the template text and the number of rows of the third element in the third column of the edit distance matrix corresponds to the character of the partial transcription text, the value of the third element in the third column of the edit distance matrix is the value of the element at the upper left corner of the third element;
if the number of columns of the third element in the third column of the edit distance matrix is not equal to the number of rows of the third element in the third column of the edit distance matrix, the value of the third element in the third column of the edit distance matrix is obtained by adding 1 to the minimum value of the elements at the left, upper left and upper sides of the third element;
And sequentially calculating the value of the fourth element in the third column of the edit distance matrix until the value of each element in the edit distance matrix is calculated.
Further, the step of recording the calculated track of the value of each element in the edit distance matrix and generating the track matrix corresponding to the edit distance matrix includes:
recording the calculation track of the value of each element in the edit distance matrix;
marking the value generation origin of each element in the edit distance matrix according to the calculation track of the value of each element in the edit distance matrix;
and after marking is completed, generating a track matrix corresponding to the editing distance matrix.
Further, the step of calculating the similarity of each track in the track matrix includes:
identifying the number of characters of the partial transcription text in each track in the track matrix, which is equal to the number of characters of the corresponding template text, so as to obtain the number of equal characters;
comparing the length of the characters of the partial transcription text in each track in the track matrix with the length of the corresponding characters of the template text, and selecting the characters with long length as the total number of the characters;
and calculating the ratio of the number of the equal characters of each track in the track matrix to the total number of the corresponding characters to obtain the similarity of each track in the track matrix.
Further, in the step of determining, according to the first track, a corresponding endpoint of the partial transcribed text on the template text, and obtaining a first endpoint, the method includes:
marking the last element in the first track;
and marking the corresponding characters of the template text according to the last element in the first track to obtain a first end point.
Further, in the step of obtaining a new template text from the template text according to the start point and the first end point of the template text, the method includes:
marking a first character of the template text in the template text as a starting point;
intercepting characters between the starting point of the template text and the first end point, wherein the characters between the starting point of the template text and the first end point comprise characters corresponding to the starting point of the template text and characters corresponding to the first end point;
and generating a text according to the intercepted characters, and obtaining the new template text.
The application also provides a text accuracy computing device based on semantic analysis, which comprises:
a first obtaining module, configured to obtain a partially transcribed text transcribed from a starting point of a template text;
The building module is used for building an editing distance matrix by taking the length of the template text character increased by two characters as the column number and the length of the part of the transfer text character increased by two characters as the row number;
the first calculation module is used for calculating the value of each element in the editing distance matrix according to the partial transfer text and the template text;
the generation module is used for recording the calculated track of the values of all elements in the edit distance matrix and generating a track matrix corresponding to the edit distance matrix;
the screening module is used for calculating the similarity of all tracks in the track matrix, screening one track with the highest similarity between the partial transfer text and the template text, and obtaining a first track;
the obtaining module is used for determining a corresponding end point of the partial transfer text on the template text according to the first track to obtain a first end point;
the second acquisition module is used for acquiring a new template text from the template text according to the initial point and the first end point of the template text;
and the second calculation module is used for comparing the partial transcribed text with the new template text and calculating the accuracy of the partial transcribed text through an edit distance algorithm.
The application also provides a computer device comprising a memory storing a computer program and a processor implementing the steps of any of the methods described above when the processor executes the computer program.
The application also provides a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of the method of any of the preceding claims.
According to the technical scheme, the application has the beneficial effects that: when the initial point of a template text starts to be transcribed, an edit distance matrix is established, the value of each element in the edit distance matrix is calculated, a track matrix is generated according to the calculated track of the value of each element in the edit distance matrix, the similarity of each track in the track matrix is calculated, one track with the highest similarity is screened to obtain a first track, the corresponding end point of a part of transcribed text on the template text is obtained according to the first track, thus a new template text is obtained, the part of transcribed text is compared with the new template text, the accuracy of the part of transcribed text is calculated, and the problem that the accuracy of transcription of the text cannot be accurately calculated when the part of text is transcribed is solved by the existing text transcription accuracy algorithm.
Drawings
FIG. 1 is a flowchart of a text accuracy calculation method based on semantic parsing provided by an embodiment of the present application;
FIG. 2 is a functional block diagram of a text accuracy computing device based on semantic parsing provided by an embodiment of the present application;
fig. 3 is a schematic block diagram of a computer device to which an embodiment of the present application is applied.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
As shown in fig. 1, an embodiment of the present application provides a text accuracy calculating method based on semantic parsing, where the method includes the following steps:
step S101, obtaining a partially transcribed text transcribed from the starting point of the template text.
The template text is transcribed from the start point of the template text and not all of the template text is transcribed, i.e. from the first character of the template text, but the end point of transcription is not at the last character of the template text but at any character in the template text except the last character of the template text. Since not all characters of the template text are transcribed, the resulting text that is transcribed from the beginning of the template text is referred to as partially transcribed text for this purpose.
The template text is a correct text for comparison with the partially transcribed text.
The above-mentioned transcription means transcription of speech into text by an ASR (speech recognition) engine.
And S102, establishing an edit distance matrix by taking the length of the template text character increased by two characters as a column number and the length of the partial transfer text character increased by two characters as a line number.
In this embodiment, the template text is a text that eliminates punctuation. The partially transcribed text is a text that eliminates punctuation.
And obtaining the length of the template text characters, and increasing the lengths of two characters according to the length of the template text characters to serve as the column number. The length of the partial transfer text characters is obtained, the length of two characters is increased according to the length of the partial transfer text characters to serve as the number of lines, the length of the template text characters increased by the length of the two characters is taken as the number of columns, and the length of the partial transfer text characters increased by the length of the two characters is taken as the number of lines, so that an editing distance matrix is established. The template text character length is increased by two characters to be used as the column number, the length of the partial transfer text character is increased by two characters to be used as the row number, and the purpose of inputting the template text and the partial transfer text on the first row and the first column respectively and inputting the initialized value on the second row and the second column is achieved.
Specifically, after step S102, and before step S103, it includes:
inputting characters of the template text starting from a third element of the first row of the edit distance matrix;
inputting characters of the partially transcribed text starting from a third element of the first column of the edit distance matrix;
defining a value of 0 for a second element in a second row of the edit distance matrix;
sequentially increasing the value 1 by taking the value of a second element in the second row of the editing distance matrix as 0, and initializing the value of each element in the second row of the editing distance matrix;
sequentially increasing the value 1 by taking the value of the second element in the second column of the edit distance matrix as 0, and initializing the value of each element in the second column of the edit distance matrix.
Characters of the template text are entered in the first row of the edit distance matrix, specifically, characters of the template text are entered starting with the third element of the first row of the edit distance matrix. Correspondingly, characters of the partially transcribed text are entered in the first column of the edit distance matrix, in particular, from the third element of the first column of the edit distance matrix. The third element of the first row and the first column of the edit distance matrix starts to input characters of the template text and characters of the partial transcription text respectively, so that corresponding relations exist between each character of the template text and each character of the partial transcription text in the edit distance matrix, and the corresponding positional relations are provided for initialized numerical values of the second row and the second column. First, the value of the second element in the second row of the edit distance matrix is defined as 0, then the values of the elements in the second row of the edit distance matrix are initialized by sequentially increasing the value 1 by 0, for example, the values of the second, third, fourth and fifth elements in the second row of the edit distance matrix are respectively 0, 1, 2 and 3. The value of the second element in the second row of the edit distance matrix is defined as 0, and in essence, the value of the second element in the second column of the edit distance matrix is also defined as 0, because the second element in the second row of the edit distance matrix and the second element in the second column of the edit distance matrix are in the same position, even if the same element, the values of the elements in the second column of the edit distance matrix are initialized to be sequentially incremented by the value of 0 by the value of 1, for example, the values of the second, third, fourth, and fifth elements in the second column of the edit distance matrix are respectively 0, 1, 2, and 3. After initializing the values of the second column, second row of the edit distance matrix, it is possible to calculate the values of the elements in the edit distance matrix.
And step 103, calculating the value of each element in the editing distance matrix according to the partial transfer text and the template text.
And determining a calculation mode of the values of all elements in the edit distance matrix according to the partial transcription text and the template text, namely, whether the characters of the partial transcription text are equal to the characters of the template text in the edit distance matrix, and further calculating the values of all elements in the edit distance matrix.
In the present embodiment, the value of each element that is not initialized in the edit distance matrix is determined by the value of one element in the left, upper side thereof. In step S103, it includes:
identifying the column number and the row number of a third element in a third column of the edit distance matrix;
identifying the column number and the line number of a third element in a third column of the edit distance matrix to respectively correspond to the characters of the template text and the characters of the partial transfer text;
judging whether the number of columns of the third element in the third column of the edit distance matrix corresponds to the characters of the template text and the number of rows of the third element in the third column of the edit distance matrix corresponds to the characters of the partial transcription text;
If the number of columns of the third element in the third column of the edit distance matrix corresponds to the character of the template text and the number of rows of the third element in the third column of the edit distance matrix corresponds to the character of the partial transcription text, the value of the third element in the third column of the edit distance matrix is the value of the element at the upper left corner of the third element;
if the number of columns of the third element in the third column of the edit distance matrix is not equal to the number of rows of the third element in the third column of the edit distance matrix, the value of the third element in the third column of the edit distance matrix is obtained by adding 1 to the minimum value of the elements at the left, upper left and upper sides of the third element;
and sequentially calculating the value of the fourth element in the third column of the edit distance matrix until the value of each element in the edit distance matrix is calculated.
Since the value of each element in the edit distance matrix that is not initialized is determined by the value of any element in the left, upper left and upper side, when the calculation is started, the element that accords with the left, upper left and upper side has only the third element in the third column of the edit distance matrix or the third element in the third column of the edit distance matrix, in this embodiment, the third element in the third column of the edit distance matrix is calculated, the column number and the line number of the third element in the third column of the edit distance matrix are identified, after the column number and the line number of the third element in the third column of the edit distance matrix are obtained, the character of the template text is corresponding to the column number of the third element in the third column of the edit distance matrix, and the character of the text is transcribed in the corresponding part of the line number of the third element in the third column of the edit distance matrix. After the corresponding characters are obtained, judging whether the characters of the template text corresponding to the column number of the third element in the third column of the edit distance matrix are equal to the characters of the transcribed text corresponding to the line number of the third element in the third column of the edit distance matrix, and determining the value of the third element in the third column of the edit distance matrix according to whether the characters of the template text corresponding to the line number of the third element in the third column of the edit distance matrix are equal to the characters of the transcribed text corresponding to the line number of the third element in the third column of the edit distance matrix, if the characters of the third element in the column number of the third column of the edit distance matrix are equal to the characters of the third element corresponding to the line number of the third element in the third column of the edit distance matrix, the value of the third element in the third column of the edit distance matrix is the value of the element at the upper left corner. If the character of the template text corresponding to the column number of the third element in the third column of the edit distance matrix is not equal to the character of the transcribed text corresponding to the line number of the third element in the third column of the edit distance matrix, the value of the third element in the third column of the edit distance matrix is obtained by adding 1 to the minimum value of the elements at the left, upper left and upper sides of the third element. After calculating the value of the third element in the third column of the edit distance matrix, sequentially calculating the value of the fourth element in the third column of the edit distance matrix until the value of each element in the edit distance matrix is calculated, that is, the value of the fourth element in the third column of the edit distance matrix is calculated, and after calculating the value of each element in the third column of the edit distance matrix, calculating the value of each element in the fourth column of the edit distance matrix until the value of each element in the last column of the edit distance matrix is calculated, and then completing the calculation of the value of each element in the edit distance matrix.
Step S104, recording calculation tracks of values of elements in the editing distance matrix, and generating a track matrix corresponding to the editing distance matrix.
In calculating the values of the elements in the edit distance matrix, a calculation locus of the values of the elements in the edit distance matrix, that is, which element the values of the elements in the edit distance matrix are determined by, is recorded. After the calculation of the values of the elements in the edit distance matrix is completed, the calculation track recording the values of the elements in the edit distance matrix is also completed, thereby generating a track matrix corresponding to the edit distance matrix.
In the present embodiment, in step S104, it includes:
recording the calculation track of the value of each element in the edit distance matrix;
marking the value generation origin of each element in the edit distance matrix according to the calculation track of the value of each element in the edit distance matrix;
and after marking is completed, generating a track matrix corresponding to the editing distance matrix.
The calculation track of the values of the elements in the edit distance matrix is recorded, the generation of the value of each element in the edit distance matrix is marked according to the calculation track of the value of each element in the edit distance matrix, in this embodiment, the calculation of the element by the upper left element is represented by l, the calculation of the element by the upper left element is represented by t, for example, if the third element in the third column of the edit distance matrix is determined by the second element in the second column of the edit distance matrix, the third element in the third column of the edit distance matrix is input by the third element in the third column of the edit distance matrix, if the third element in the third column of the edit distance matrix is determined by the third element in the second column of the edit distance matrix, the third element in the third column of the edit distance matrix is input by the third element in the third column of the edit distance matrix, and the third distance of the third element in the edit distance matrix is generated by the third t. After the marking is completed, a track matrix corresponding to the edit distance matrix is generated.
In this embodiment, the step of marking the origin of the value generation of each element in the edit distance matrix according to the calculated trajectory of the value of each element in the edit distance matrix includes:
marking the origin of the value generation of an element in the edit distance matrix when each record of the calculated track of the value of the element in the edit distance matrix;
until the value of each element in the editing distance matrix is marked.
The value generation source of the element in the edit distance matrix is marked immediately after the calculation track of the value of the element in the edit distance matrix is recorded, that is, the value generation source of each element in the edit distance matrix is marked while the calculation track of the value of each element in the edit distance matrix is recorded.
In some embodiments, in the step of marking the origin of the value generation of each element in the edit distance matrix according to the calculated trajectory of the value of each element in the edit distance matrix, the method includes:
after the calculation track of the values of the elements in the editing distance matrix is recorded, marking the generation origin of the values of the elements in the editing distance matrix according to the calculation track of the values of the elements in the editing distance matrix.
After the calculation track of the values of the elements in the editing distance matrix is completed, the start of the generation of the values of the elements in the marking editing distance matrix is triggered until the generation of the values of the elements in the marking editing distance matrix is completed. That is, the calculation trace of the value of each element in the uncompleted edit distance matrix does not perform the generation of the value of each element in the mark edit distance matrix.
Step 105, calculating the similarity of all tracks in the track matrix, screening one track with the highest similarity between the partial transfer text and the template text, and obtaining a first track.
After the track matrix is generated, calculating the similarity of each track in the track matrix, and after the similarity of each track is calculated, screening one track with the highest similarity between the partial transfer text and the template text to obtain a first track, wherein the first track is considered as the corresponding track of the partial transfer text on the template text.
In this embodiment, the step of calculating the similarity of each track in the track matrix includes:
identifying the number of characters of the partial transcription text in each track in the track matrix, which is equal to the number of characters of the corresponding template text, so as to obtain the number of equal characters;
Comparing the length of the characters of the partial transcription text in each track in the track matrix with the length of the corresponding characters of the template text, and selecting the characters with long length as the total number of the characters;
and calculating the ratio of the number of the equal characters of each track in the track matrix to the total number of the corresponding characters to obtain the similarity of each track in the track matrix.
After generating a track matrix, identifying the number of characters of the partial transcribed text in each track in the track matrix equal to the number of characters of the corresponding template text, obtaining the number of the equal characters, comparing the length of the characters of the partial transcribed text in each track in the track matrix with the length of the characters of the corresponding template text after obtaining the number of the equal characters in each track in the track matrix, selecting the length as the total number of the characters, and if the length of the characters of the partial transcribed text in one track in the track matrix is larger than the length of the characters of the corresponding template text, selecting the length of the characters of the partial transcribed text in one track in the track matrix as the total number of the characters. If the length of the characters of the partial transcribed text in one track in the track matrix is smaller than the length of the characters of the corresponding template text, selecting the length of the characters of the template text in one track in the track matrix as the total number of the characters. After the length is selected as the total number of characters, calculating the ratio of the number of the equal characters of each track in the track matrix to the corresponding total number of characters, and after the ratio calculation is completed, obtaining the similarity of each track in the track matrix.
And S106, determining a corresponding end point of the partial transfer text on the template text according to the first track, and obtaining a first end point.
After the first track is obtained, according to the first track, since the first track has an end point in the track matrix, determining the corresponding end point of the partial transfer text on the template text, thereby obtaining a first end point.
In the present embodiment, in step S106, it includes:
marking the last element in the first track;
and marking the corresponding characters of the template text according to the last element in the first track to obtain a first end point.
After the first track is obtained, marking the last element in the first track, obtaining the character of the template text on the corresponding column of the last element in the first track according to the last element in the first track, and marking the character of the corresponding template text, so that a first end point is obtained.
And step S107, acquiring a new template text from the template text according to the initial point and the first end point of the template text.
After the first end point is obtained, the text between the two points is obtained according to the initial point and the first end point of the template text, wherein the text comprises characters corresponding to the initial point and the first end point of the template text respectively, so that a new template text is obtained from the template text.
In the present embodiment, in step S107, it includes:
marking a first character of the template text in the template text as a starting point;
intercepting characters between the starting point of the template text and the first end point, wherein the characters between the starting point of the template text and the first end point comprise characters corresponding to the starting point of the template text and characters corresponding to the first end point;
and generating a text according to the intercepted characters, and acquiring the new template text.
After the first endpoint is obtained, marking a first character of the template text as a starting point in the template text, and intercepting characters between the starting point of the template text and the first endpoint, wherein the characters between the starting point of the template text and the first endpoint comprise characters corresponding to the starting point of the template text and characters corresponding to the first endpoint. After the intercepted characters, generating a text with the same format as the template text according to the intercepted characters, and obtaining a new template text.
And S108, comparing the partial transcribed text with the new template text, and calculating the accuracy of the partial transcribed text through an edit distance algorithm.
After a new template text is obtained, comparing the partial transcribed text with the new template text, and calculating the accuracy of the partial transcribed text through an edit distance algorithm instead of comparing the partial transcribed text with the new template text, so that the problem that the accuracy of transcription of the text cannot be accurately calculated when the partial text is transcribed by comparing the transcribed text with all the texts of the template text through the existing text transcription accuracy algorithm is solved.
In summary, when the initial point of the template text starts to be transcribed, an edit distance matrix is established, the values of each element in the edit distance matrix are calculated, a track matrix is generated according to the calculated track of each element in the edit distance matrix, the similarity of each track in the track matrix is calculated, a track with the highest similarity is screened to obtain a first track, the corresponding end point of a part of transcribed text on the template text is obtained according to the first track, thus obtaining a new template text, then the part of transcribed text is compared with the new template text, and the accuracy of the part of transcribed text is calculated.
As shown in fig. 2, an embodiment of the present application proposes a text accuracy calculating device 1 based on semantic parsing, where the device 1 includes a first obtaining module 11, a building module 12, a first calculating module 13, a generating module 14, a screening module 15, an obtaining module 16, a second obtaining module 17, and a second calculating module 18.
A first obtaining module 11 is configured to obtain a partially transcribed text transcribed from a starting point of the template text.
The template text is transcribed from the start point of the template text and not all of the template text is transcribed, i.e. from the first character of the template text, but the end point of transcription is not at the last character of the template text but at any character in the template text except the last character of the template text. Since not all characters of the template text are transcribed, the resulting text that is transcribed from the beginning of the template text is referred to as partially transcribed text for this purpose.
The template text is a correct text for comparison with the partially transcribed text.
The above-mentioned transcription means transcription of speech into text by an ASR (speech recognition) engine.
The establishing module 12 is configured to establish an edit distance matrix by using the length of the template text character increased by two characters as a column number and the length of the partially transcribed text character increased by two characters as a line number.
In this embodiment, the template text is a text that eliminates punctuation. The partially transcribed text is a text that eliminates punctuation.
And obtaining the length of the template text characters, and increasing the lengths of two characters according to the length of the template text characters to serve as the column number. The length of the partial transfer text characters is obtained, the length of two characters is increased according to the length of the partial transfer text characters to serve as the number of lines, the length of the template text characters increased by the length of the two characters is taken as the number of columns, and the length of the partial transfer text characters increased by the length of the two characters is taken as the number of lines, so that an editing distance matrix is established. The template text character length is increased by two characters to be used as the column number, the length of the partial transfer text character is increased by two characters to be used as the row number, and the purpose of inputting the template text and the partial transfer text on the first row and the first column respectively and inputting the initialized value on the second row and the second column is achieved.
Specifically, the apparatus 1 comprises:
a first input module for inputting characters of the template text starting from a third element of a first row of the edit distance matrix;
a second input module for inputting characters of the partially transcribed text starting from a third element of the first column of the edit distance matrix;
a definition module, configured to define a value of a second element in a second row of the edit distance matrix to be 0;
a first initializing module, configured to sequentially increment a value 1 by using a value of a second element in a second row of the edit distance matrix as 0, and initialize values of elements in the second row of the edit distance matrix;
and the second initializing module is used for sequentially increasing the value 1 by using the value of the second element in the second column of the edit distance matrix as 0 and initializing the values of the elements in the second column of the edit distance matrix.
Characters of the template text are entered in the first row of the edit distance matrix, specifically, characters of the template text are entered starting with the third element of the first row of the edit distance matrix. Correspondingly, characters of the partially transcribed text are entered in the first column of the edit distance matrix, in particular, from the third element of the first column of the edit distance matrix. The third element of the first row and the first column of the edit distance matrix starts to input characters of the template text and characters of the partial transcription text respectively, so that corresponding relations exist between each character of the template text and each character of the partial transcription text in the edit distance matrix, and the corresponding positional relations are provided for initialized numerical values of the second row and the second column. First, the value of the second element in the second row of the edit distance matrix is defined as 0, then the values of the elements in the second row of the edit distance matrix are initialized by sequentially increasing the value 1 by 0, for example, the values of the second, third, fourth and fifth elements in the second row of the edit distance matrix are respectively 0, 1, 2 and 3. The value of the second element in the second row of the edit distance matrix is defined as 0, and in essence, the value of the second element in the second column of the edit distance matrix is also defined as 0, because the second element in the second row of the edit distance matrix and the second element in the second column of the edit distance matrix are in the same position, even if the same element, the values of the elements in the second column of the edit distance matrix are initialized to be sequentially incremented by the value of 0 by the value of 1, for example, the values of the second, third, fourth, and fifth elements in the second column of the edit distance matrix are respectively 0, 1, 2, and 3. After initializing the values of the second column, second row of the edit distance matrix, it is possible to calculate the values of the elements in the edit distance matrix.
A first calculating module 13, configured to calculate values of elements in the edit distance matrix according to the partially transcribed text and the template text.
And determining a calculation mode of the values of all elements in the edit distance matrix according to the partial transcription text and the template text, namely, whether the characters of the partial transcription text are equal to the characters of the template text in the edit distance matrix, and further calculating the values of all elements in the edit distance matrix.
In the present embodiment, the value of each element that is not initialized in the edit distance matrix is determined by the value of one element in the left, upper side thereof. The first calculation module 13 includes:
the first identification module is used for identifying the column number and the row number of the third element in the third column of the edit distance matrix;
the second recognition module is used for recognizing that the column number and the line number of the third element in the third column of the edit distance matrix respectively correspond to the characters of the template text and the characters of the partial transfer text;
the first judging module is used for judging whether the column number of the third element in the third column of the editing distance matrix corresponds to the character of the template text and the row number of the third element in the third column of the editing distance matrix corresponds to the character of the partial transcription text or not; if the number of columns of the third element in the third column of the edit distance matrix corresponds to the character of the template text and the number of rows of the third element in the third column of the edit distance matrix corresponds to the character of the partial transcription text, the value of the third element in the third column of the edit distance matrix is the value of the element at the upper left corner of the third element; if the number of columns of the third element in the third column of the edit distance matrix is not equal to the number of rows of the third element in the third column of the edit distance matrix, the value of the third element in the third column of the edit distance matrix is obtained by adding 1 to the minimum value of the elements at the left, upper left and upper sides of the third element;
And the first sub-calculation module is used for sequentially calculating the value of the fourth element in the third column of the edit distance matrix until the calculation of the value of each element in the edit distance matrix is completed.
Since the value of each element in the edit distance matrix that is not initialized is determined by the value of any element in the left, upper left and upper side, when the calculation is started, the element that accords with the left, upper left and upper side has only the third element in the third column of the edit distance matrix or the third element in the third column of the edit distance matrix, in this embodiment, the third element in the third column of the edit distance matrix is calculated, the column number and the line number of the third element in the third column of the edit distance matrix are identified, after the column number and the line number of the third element in the third column of the edit distance matrix are obtained, the character of the template text is corresponding to the column number of the third element in the third column of the edit distance matrix, and the character of the text is transcribed in the corresponding part of the line number of the third element in the third column of the edit distance matrix. After the corresponding characters are obtained, judging whether the characters of the template text corresponding to the column number of the third element in the third column of the edit distance matrix are equal to the characters of the transcribed text corresponding to the line number of the third element in the third column of the edit distance matrix, and determining the value of the third element in the third column of the edit distance matrix according to whether the characters of the template text corresponding to the line number of the third element in the third column of the edit distance matrix are equal to the characters of the transcribed text corresponding to the line number of the third element in the third column of the edit distance matrix, if the characters of the third element in the column number of the third column of the edit distance matrix are equal to the characters of the third element corresponding to the line number of the third element in the third column of the edit distance matrix, the value of the third element in the third column of the edit distance matrix is the value of the element at the upper left corner. If the character of the template text corresponding to the column number of the third element in the third column of the edit distance matrix is not equal to the character of the transcribed text corresponding to the line number of the third element in the third column of the edit distance matrix, the value of the third element in the third column of the edit distance matrix is obtained by adding 1 to the minimum value of the elements at the left, upper left and upper sides of the third element. After calculating the value of the third element in the third column of the edit distance matrix, sequentially calculating the value of the fourth element in the third column of the edit distance matrix until the value of each element in the edit distance matrix is calculated, that is, the value of the fourth element in the third column of the edit distance matrix is calculated, and after calculating the value of each element in the third column of the edit distance matrix, calculating the value of each element in the fourth column of the edit distance matrix until the value of each element in the last column of the edit distance matrix is calculated, and then completing the calculation of the value of each element in the edit distance matrix.
The generating module 14 is configured to record a calculated track of values of each element in the edit distance matrix, and generate a track matrix corresponding to the edit distance matrix.
In calculating the values of the elements in the edit distance matrix, a calculation locus of the values of the elements in the edit distance matrix, that is, which element the values of the elements in the edit distance matrix are determined by, is recorded. After the calculation of the values of the elements in the edit distance matrix is completed, the calculation track recording the values of the elements in the edit distance matrix is also completed, thereby generating a track matrix corresponding to the edit distance matrix.
In the present embodiment, the generating module 14 includes:
the first recording module is used for recording the calculation track of the values of the elements in the edit distance matrix;
the first marking module is used for marking the value generation origin of each element in the edit distance matrix according to the calculation track of the value of each element in the edit distance matrix;
and the first generation module is used for generating a track matrix corresponding to the editing distance matrix after marking is completed.
The calculation track of the values of the elements in the edit distance matrix is recorded, the generation of the value of each element in the edit distance matrix is marked according to the calculation track of the value of each element in the edit distance matrix, in this embodiment, the calculation of the element by the upper left element is represented by l, the calculation of the element by the upper left element is represented by t, for example, if the third element in the third column of the edit distance matrix is determined by the second element in the second column of the edit distance matrix, the third element in the third column of the edit distance matrix is input by the third element in the third column of the edit distance matrix, if the third element in the third column of the edit distance matrix is determined by the third element in the second column of the edit distance matrix, the third element in the third column of the edit distance matrix is input by the third element in the third column of the edit distance matrix, and the third distance of the third element in the edit distance matrix is generated by the third t. After the marking is completed, a track matrix corresponding to the edit distance matrix is generated.
In this embodiment, the first marking module includes:
the first sub-marking module is used for marking the value generation origin of one element in the edit distance matrix when each calculation track of the value of the element in the edit distance matrix is recorded;
and the first sub-marking completion module is used for marking the value generation origin of each element in the editing distance matrix.
The value generation source of the element in the edit distance matrix is marked immediately after the calculation track of the value of the element in the edit distance matrix is recorded, that is, the value generation source of each element in the edit distance matrix is marked while the calculation track of the value of each element in the edit distance matrix is recorded.
In some embodiments, the first marking module comprises:
and the second sub-marking module is used for marking the value generation origin of each element in the edit distance matrix according to the calculated track of the value of each element in the edit distance matrix after finishing recording the calculated track of the value of each element in the edit distance matrix.
After the calculation track of the values of the elements in the editing distance matrix is completed, the start of the generation of the values of the elements in the marking editing distance matrix is triggered until the generation of the values of the elements in the marking editing distance matrix is completed. That is, the calculation trace of the value of each element in the uncompleted edit distance matrix does not perform the generation of the value of each element in the mark edit distance matrix.
And the screening module 15 is used for calculating the similarity of all tracks in the track matrix, screening one track with the highest similarity between the partial transfer text and the template text, and obtaining a first track.
After the track matrix is generated, calculating the similarity of each track in the track matrix, and after the similarity of each track is calculated, screening one track with the highest similarity between the partial transfer text and the template text to obtain a first track, wherein the first track is considered as the corresponding track of the partial transfer text on the template text.
In this embodiment, the screening module 15 includes:
the third recognition module is used for recognizing the number of characters of the partial transfer text in each track in the track matrix, which is equal to the number of characters of the corresponding template text, and obtaining the number of equal characters;
the first comparison module is used for comparing the length of the characters of the partial transcription text in each track in the track matrix with the length of the corresponding characters of the template text, and selecting the length as the total number of the characters;
and a third calculation module, configured to calculate a ratio of the number of equal characters in each track in the track matrix to the total number of corresponding characters, and obtain a similarity of each track in the track matrix.
After generating a track matrix, identifying the number of characters of the partial transcribed text in each track in the track matrix equal to the number of characters of the corresponding template text, obtaining the number of the equal characters, comparing the length of the characters of the partial transcribed text in each track in the track matrix with the length of the characters of the corresponding template text after obtaining the number of the equal characters in each track in the track matrix, selecting the length as the total number of the characters, and if the length of the characters of the partial transcribed text in one track in the track matrix is larger than the length of the characters of the corresponding template text, selecting the length of the characters of the partial transcribed text in one track in the track matrix as the total number of the characters. If the length of the characters of the partial transcribed text in one track in the track matrix is smaller than the length of the characters of the corresponding template text, selecting the length of the characters of the template text in one track in the track matrix as the total number of the characters. After the length is selected as the total number of characters, calculating the ratio of the number of the equal characters of each track in the track matrix to the corresponding total number of characters, and after the ratio calculation is completed, obtaining the similarity of each track in the track matrix.
And the obtaining module 16 is configured to determine, according to the first track, an endpoint corresponding to the part of the transcribed text on the template text, and obtain a first endpoint.
After the first track is obtained, according to the first track, since the first track has an end point in the track matrix, determining the corresponding end point of the partial transfer text on the template text, thereby obtaining a first end point.
In the present embodiment, the obtaining module 16 includes:
the second marking module is used for marking the last element in the first track;
the first obtaining module is used for marking the corresponding characters of the template text according to the last element in the first track to obtain a first end point.
After the first track is obtained, marking the last element in the first track, obtaining the character of the template text on the corresponding column of the last element in the first track according to the last element in the first track, and marking the character of the corresponding template text, so that a first end point is obtained.
A second obtaining module 17, configured to obtain a new template text from the template text according to the start point and the first end point of the template text.
After the first end point is obtained, the text between the two points is obtained according to the initial point and the first end point of the template text, wherein the text comprises characters corresponding to the initial point and the first end point of the template text respectively, so that a new template text is obtained from the template text.
In the present embodiment, the second acquisition module 17 includes:
a third marking module, configured to mark a first character of the template text as a starting point in the template text;
the intercepting module is used for intercepting characters between the starting point of the template text and the first end point, wherein the characters between the starting point of the template text and the first end point comprise characters corresponding to the starting point of the template text and characters corresponding to the first end point;
and the second sub-acquisition module is used for generating a text according to the intercepted characters and acquiring the new template text.
After the first endpoint is obtained, marking a first character of the template text as a starting point in the template text, and intercepting characters between the starting point of the template text and the first endpoint, wherein the characters between the starting point of the template text and the first endpoint comprise characters corresponding to the starting point of the template text and characters corresponding to the first endpoint. After the intercepted characters, generating a text with the same format as the template text according to the intercepted characters, and obtaining a new template text.
A second calculation module 18, configured to compare the partially transcribed text with the new template text, and calculate the accuracy of the partially transcribed text through an edit distance algorithm.
After a new template text is obtained, comparing the partial transcribed text with the new template text, and calculating the accuracy of the partial transcribed text through an edit distance algorithm instead of comparing the partial transcribed text with the new template text, so that the problem that the accuracy of transcription of the text cannot be accurately calculated when the partial text is transcribed by comparing the transcribed text with all the texts of the template text through the existing text transcription accuracy algorithm is solved.
In summary, when the initial point of the template text starts to be transcribed, an edit distance matrix is established, the values of each element in the edit distance matrix are calculated, a track matrix is generated according to the calculated track of each element in the edit distance matrix, the similarity of each track in the track matrix is calculated, a track with the highest similarity is screened to obtain a first track, the corresponding end point of a part of transcribed text on the template text is obtained according to the first track, thus obtaining a new template text, then the part of transcribed text is compared with the new template text, and the accuracy of the part of transcribed text is calculated.
As shown in fig. 3, in an embodiment of the present application, a computer device is further provided, where the computer device may be a server, and the internal structure of the computer device may be as shown in fig. 3. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the computer is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer equipment is used for storing data such as a model of a text accuracy computing method based on semantic analysis. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program, when executed by a processor, implements a text accuracy calculation method based on semantic parsing.
The processor executes the steps of the text accuracy rate calculation method based on semantic analysis: acquiring a part of transcribed text transcribed from the initial point of the template text; establishing an edit distance matrix by taking the length of the template text character increased by two characters as a column number and the length of the partial transfer text character increased by two characters as a line number; calculating the value of each element in the editing distance matrix according to the partial transfer text and the template text; recording the calculated track of the values of each element in the edit distance matrix, and generating a track matrix corresponding to the edit distance matrix; calculating the similarity of all tracks in the track matrix, screening one track with the highest similarity between the partial transfer text and the template text, and obtaining a first track; determining a corresponding end point of the partial transfer text on the template text according to the first track to obtain a first end point; acquiring a new template text from the template text according to the initial point and the first end point of the template text; and comparing the partial transcribed text with the new template text, and calculating the accuracy of the partial transcribed text through an edit distance algorithm.
In one embodiment, after the step of creating the edit distance matrix by using the length of the template text character increased by two characters as the column number and the length of the partially transcribed text character increased by two characters as the row number, the step of calculating the value of each element in the edit distance matrix according to the partially transcribed text and the template text includes:
inputting characters of the template text starting from a third element of the first row of the edit distance matrix;
inputting characters of the partially transcribed text starting from a third element of the first column of the edit distance matrix;
defining a value of 0 for a second element in a second row of the edit distance matrix;
sequentially increasing the value 1 by taking the value of a second element in the second row of the editing distance matrix as 0, and initializing the value of each element in the second row of the editing distance matrix;
sequentially increasing the value 1 by taking the value of the second element in the second column of the edit distance matrix as 0, and initializing the value of each element in the second column of the edit distance matrix.
In one embodiment, the value of each element in the edit distance matrix that is not initialized is determined by the value of one element in the left, upper left and upper directions, and the step of calculating the value of each element in the edit distance matrix according to the partially transcribed text and the template text includes:
Identifying the column number and the row number of a third element in a third column of the edit distance matrix;
identifying the column number and the line number of a third element in a third column of the edit distance matrix to respectively correspond to the characters of the template text and the characters of the partial transfer text;
judging whether the number of columns of the third element in the third column of the edit distance matrix corresponds to the characters of the template text and the number of rows of the third element in the third column of the edit distance matrix corresponds to the characters of the partial transcription text;
if the number of columns of the third element in the third column of the edit distance matrix corresponds to the character of the template text and the number of rows of the third element in the third column of the edit distance matrix corresponds to the character of the partial transcription text, the value of the third element in the third column of the edit distance matrix is the value of the element at the upper left corner of the third element;
if the number of columns of the third element in the third column of the edit distance matrix is not equal to the number of rows of the third element in the third column of the edit distance matrix, the value of the third element in the third column of the edit distance matrix is obtained by adding 1 to the minimum value of the elements at the left, upper left and upper sides of the third element;
And sequentially calculating the value of the fourth element in the third column of the edit distance matrix until the value of each element in the edit distance matrix is calculated.
In one embodiment, the step of recording the calculated track of the value of each element in the edit distance matrix and generating the track matrix corresponding to the edit distance matrix includes:
recording the calculation track of the value of each element in the edit distance matrix;
marking the value generation origin of each element in the edit distance matrix according to the calculation track of the value of each element in the edit distance matrix;
and after marking is completed, generating a track matrix corresponding to the editing distance matrix.
In one embodiment, the step of calculating the similarity of each track in the track matrix includes:
identifying the number of characters of the partial transcription text in each track in the track matrix, which is equal to the number of characters of the corresponding template text, so as to obtain the number of equal characters;
comparing the length of the characters of the partial transcription text in each track in the track matrix with the length of the corresponding characters of the template text, and selecting the characters with long length as the total number of the characters;
And calculating the ratio of the number of the equal characters of each track in the track matrix to the total number of the corresponding characters to obtain the similarity of each track in the track matrix.
In one embodiment, the step of determining, according to the first track, a corresponding endpoint of the partial transcribed text on the template text, and obtaining a first endpoint includes:
marking the last element in the first track;
and marking the corresponding characters of the template text according to the last element in the first track to obtain a first end point.
In one embodiment, the step of obtaining the new template text from the template text according to the starting point and the first end point of the template text includes:
marking a first character of the template text in the template text as a starting point;
intercepting characters between the starting point of the template text and the first end point, wherein the characters between the starting point of the template text and the first end point comprise characters corresponding to the starting point of the template text and characters corresponding to the first end point;
and generating a text according to the intercepted characters, and obtaining the new template text.
It will be appreciated by those skilled in the art that the architecture shown in fig. 3 is merely a block diagram of a portion of the architecture in connection with the present inventive arrangements and is not intended to limit the computer devices to which the present inventive arrangements are applicable.
The computer equipment of the embodiment of the application establishes an edit distance matrix when the initial point of a template text starts to be transcribed, calculates the value of each element in the edit distance matrix, generates a track matrix according to the calculation track of the value of each element in the edit distance matrix, calculates the similarity of each track in the track matrix, screens one track with the highest similarity to obtain a first track, obtains the corresponding end point of a part of transcribed text on the template text according to the first track, thereby obtaining a new template text, compares the part of transcribed text with the new template text, calculates the accuracy of the part of transcribed text, and aims to solve the problems that the transcribed text can not be accurately calculated when the part of text is transcribed by the existing text transcription accuracy algorithm and compares the transcribed text with all texts of the template text.
An embodiment of the present application further provides a computer readable storage medium, on which a computer program is stored, where the computer program when executed by a processor implements a text accuracy calculating method based on semantic parsing, specifically: acquiring a part of transcribed text transcribed from the initial point of the template text; establishing an edit distance matrix by taking the length of the template text character increased by two characters as a column number and the length of the partial transfer text character increased by two characters as a line number; calculating the value of each element in the editing distance matrix according to the partial transfer text and the template text; recording the calculated track of the values of each element in the edit distance matrix, and generating a track matrix corresponding to the edit distance matrix; calculating the similarity of all tracks in the track matrix, screening one track with the highest similarity between the partial transfer text and the template text, and obtaining a first track; determining a corresponding end point of the partial transfer text on the template text according to the first track to obtain a first end point; acquiring a new template text from the template text according to the initial point and the first end point of the template text; and comparing the partial transcribed text with the new template text, and calculating the accuracy of the partial transcribed text through an edit distance algorithm.
In one embodiment, after the step of creating the edit distance matrix by using the length of the template text character increased by two characters as the column number and the length of the partially transcribed text character increased by two characters as the row number, the step of calculating the value of each element in the edit distance matrix according to the partially transcribed text and the template text includes:
inputting characters of the template text starting from a third element of the first row of the edit distance matrix;
inputting characters of the partially transcribed text starting from a third element of the first column of the edit distance matrix;
defining a value of 0 for a second element in a second row of the edit distance matrix;
sequentially increasing the value 1 by taking the value of a second element in the second row of the editing distance matrix as 0, and initializing the value of each element in the second row of the editing distance matrix;
sequentially increasing the value 1 by taking the value of the second element in the second column of the edit distance matrix as 0, and initializing the value of each element in the second column of the edit distance matrix.
In one embodiment, the value of each element in the edit distance matrix that is not initialized is determined by the value of one element in the left, upper left and upper directions, and the step of calculating the value of each element in the edit distance matrix according to the partially transcribed text and the template text includes:
Identifying the column number and the row number of a third element in a third column of the edit distance matrix;
identifying the column number and the line number of a third element in a third column of the edit distance matrix to respectively correspond to the characters of the template text and the characters of the partial transfer text;
judging whether the number of columns of the third element in the third column of the edit distance matrix corresponds to the characters of the template text and the number of rows of the third element in the third column of the edit distance matrix corresponds to the characters of the partial transcription text;
if the number of columns of the third element in the third column of the edit distance matrix corresponds to the character of the template text and the number of rows of the third element in the third column of the edit distance matrix corresponds to the character of the partial transcription text, the value of the third element in the third column of the edit distance matrix is the value of the element at the upper left corner of the third element;
if the number of columns of the third element in the third column of the edit distance matrix is not equal to the number of rows of the third element in the third column of the edit distance matrix, the value of the third element in the third column of the edit distance matrix is obtained by adding 1 to the minimum value of the elements at the left, upper left and upper sides of the third element;
And sequentially calculating the value of the fourth element in the third column of the edit distance matrix until the value of each element in the edit distance matrix is calculated.
In one embodiment, the step of recording the calculated track of the value of each element in the edit distance matrix and generating the track matrix corresponding to the edit distance matrix includes:
recording the calculation track of the value of each element in the edit distance matrix;
marking the value generation origin of each element in the edit distance matrix according to the calculation track of the value of each element in the edit distance matrix;
and after marking is completed, generating a track matrix corresponding to the editing distance matrix.
In one embodiment, the step of calculating the similarity of each track in the track matrix includes:
identifying the number of characters of the partial transcription text in each track in the track matrix, which is equal to the number of characters of the corresponding template text, so as to obtain the number of equal characters;
comparing the length of the characters of the partial transcription text in each track in the track matrix with the length of the corresponding characters of the template text, and selecting the characters with long length as the total number of the characters;
And calculating the ratio of the number of the equal characters of each track in the track matrix to the total number of the corresponding characters to obtain the similarity of each track in the track matrix.
In one embodiment, the step of determining, according to the first track, a corresponding endpoint of the partial transcribed text on the template text, and obtaining a first endpoint includes:
marking the last element in the first track;
and marking the corresponding characters of the template text according to the last element in the first track to obtain a first end point.
In one embodiment, the step of obtaining the new template text from the template text according to the starting point and the first end point of the template text includes:
marking a first character of the template text in the template text as a starting point;
intercepting characters between the starting point of the template text and the first end point, wherein the characters between the starting point of the template text and the first end point comprise characters corresponding to the starting point of the template text and characters corresponding to the first end point;
and generating a text according to the intercepted characters, and obtaining the new template text.
The storage medium of the embodiment of the application establishes an edit distance matrix when the initial point of a template text starts to be transcribed, calculates the value of each element in the edit distance matrix, generates a track matrix according to the calculation track of the value of each element in the edit distance matrix, calculates the similarity of each track in the track matrix, screens one track with the highest similarity to obtain a first track, obtains the corresponding end point of a part of transcribed text on the template text according to the first track, thereby obtaining a new template text, compares the part of transcribed text with the new template text, calculates the accuracy of the part of transcribed text, and aims to solve the problems that the existing text transcription accuracy algorithm compares the transcribed text with all texts of the template text and can not accurately calculate the transcription accuracy of the text when the part of text is transcribed.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium provided by the present application and used in embodiments may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual speed data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
The foregoing description of the preferred embodiment of the application is not intended to be limiting, but rather is intended to cover all modifications, equivalents, and alternatives falling within the spirit and principles of the application.

Claims (10)

1. The text accuracy computing method based on semantic analysis is characterized by comprising the following steps:
acquiring a part of transcribed text transcribed from the initial point of the template text;
establishing an edit distance matrix by taking the length of the template text character increased by two characters as a column number and the length of the partial transfer text character increased by two characters as a line number;
calculating the value of each element in the editing distance matrix according to the partial transfer text and the template text;
recording a calculation track of the value of each element in the editing distance matrix, and generating a track matrix corresponding to the editing distance matrix, wherein the calculation track refers to the fact that the value of each element in the editing distance matrix is determined by the value of which element;
calculating the similarity of all tracks in the track matrix, screening one track with the highest similarity between the partial transfer text and the template text, and obtaining a first track;
Determining a corresponding end point of the partial transfer text on the template text according to the first track to obtain a first end point;
acquiring a new template text from the template text according to the initial point and the first end point of the template text;
and comparing the partial transcribed text with the new template text, and calculating the accuracy of the partial transcribed text through an edit distance algorithm.
2. The text accuracy calculation method based on semantic parsing according to claim 1, wherein after the step of creating an edit distance matrix with the length of the template text character increased by two characters as a column number and the length of the partially transcribed text character increased by two characters as a row number, before the step of calculating values of elements in the edit distance matrix from the partially transcribed text and the template text, comprising:
inputting characters of the template text starting from a third element of the first row of the edit distance matrix;
inputting characters of the partially transcribed text starting from a third element of the first column of the edit distance matrix;
defining a value of 0 for a second element in a second row of the edit distance matrix;
Sequentially increasing the value 1 by taking the value of a second element in the second row of the editing distance matrix as 0, and initializing the value of each element in the second row of the editing distance matrix;
sequentially increasing the value 1 by taking the value of the second element in the second column of the edit distance matrix as 0, and initializing the value of each element in the second column of the edit distance matrix.
3. The text accuracy calculation method based on semantic parsing according to claim 2, wherein the value of each element that is not initialized in the edit distance matrix is determined by the value of one element of the left, upper left, and upper side of the edit distance matrix, and the step of calculating the value of each element in the edit distance matrix from the partially transcribed text and the template text includes:
identifying the column number and the row number of a third element in a third column of the edit distance matrix;
identifying the column number and the line number of a third element in a third column of the edit distance matrix to respectively correspond to the characters of the template text and the characters of the partial transfer text;
judging whether the number of columns of the third element in the third column of the edit distance matrix corresponds to the characters of the template text and the number of rows of the third element in the third column of the edit distance matrix corresponds to the characters of the partial transcription text;
If the number of columns of the third element in the third column of the edit distance matrix corresponds to the character of the template text and the number of rows of the third element in the third column of the edit distance matrix corresponds to the character of the partial transcription text, the value of the third element in the third column of the edit distance matrix is the value of the element at the upper left corner of the third element;
if the number of columns of the third element in the third column of the edit distance matrix is not equal to the number of rows of the third element in the third column of the edit distance matrix, the value of the third element in the third column of the edit distance matrix is obtained by adding 1 to the minimum value of the elements at the left, upper left and upper sides of the third element;
and sequentially calculating the value of the fourth element in the third column of the edit distance matrix until the value of each element in the edit distance matrix is calculated.
4. The text accuracy calculation method based on semantic analysis according to claim 1, wherein the step of recording the calculation trajectory of the values of the elements in the edit distance matrix and generating the trajectory matrix corresponding to the edit distance matrix includes:
Recording the calculation track of the value of each element in the edit distance matrix;
marking the value generation origin of each element in the edit distance matrix according to the calculation track of the value of each element in the edit distance matrix;
and after marking is completed, generating a track matrix corresponding to the editing distance matrix.
5. The text accuracy calculation method based on semantic parsing according to claim 1, wherein the step of calculating the similarity of each trace in the trace matrix includes:
identifying the number of characters of the partial transcription text in each track in the track matrix, which is equal to the number of characters of the corresponding template text, so as to obtain the number of equal characters;
comparing the length of the characters of the partial transcription text in each track in the track matrix with the length of the corresponding characters of the template text, and selecting the characters with long length as the total number of the characters;
and calculating the ratio of the number of the equal characters of each track in the track matrix to the total number of the corresponding characters to obtain the similarity of each track in the track matrix.
6. The method for calculating text accuracy based on semantic parsing according to claim 1, wherein the step of determining, according to the first trajectory, a corresponding endpoint of the partially transcribed text on the template text, and obtaining a first endpoint includes:
Marking the last element in the first track;
and marking the corresponding characters of the template text according to the last element in the first track to obtain a first end point.
7. The semantic parsing-based text accuracy calculation method according to claim 6, wherein the step of acquiring a new template text from the template text according to a start point and the first end point of the template text comprises:
marking a first character of the template text in the template text as a starting point;
intercepting characters between the starting point of the template text and the first end point, wherein the characters between the starting point of the template text and the first end point comprise characters corresponding to the starting point of the template text and characters corresponding to the first end point;
and generating a text according to the intercepted characters, and obtaining the new template text.
8. A text accuracy computing device based on semantic parsing, the device comprising:
a first obtaining module, configured to obtain a partially transcribed text transcribed from a starting point of a template text;
the building module is used for building an editing distance matrix by taking the length of the template text character increased by two characters as the column number and the length of the part of the transfer text character increased by two characters as the row number;
The first calculation module is used for calculating the value of each element in the editing distance matrix according to the partial transfer text and the template text;
the generation module is used for recording calculation tracks of the values of the elements in the editing distance matrix and generating a track matrix corresponding to the editing distance matrix, wherein the calculation tracks refer to the values of the elements in the editing distance matrix which are determined by the values of the elements;
the screening module is used for calculating the similarity of all tracks in the track matrix, screening one track with the highest similarity between the partial transfer text and the template text, and obtaining a first track;
the obtaining module is used for determining a corresponding end point of the partial transfer text on the template text according to the first track to obtain a first end point;
the second acquisition module is used for acquiring a new template text from the template text according to the initial point and the first end point of the template text;
and the second calculation module is used for comparing the partial transcribed text with the new template text and calculating the accuracy of the partial transcribed text through an edit distance algorithm.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 7 when the computer program is executed.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 7.
CN201811348583.1A 2018-11-13 2018-11-13 Text accuracy rate calculation method and device based on semantic analysis and computer equipment Active CN109710904B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201811348583.1A CN109710904B (en) 2018-11-13 2018-11-13 Text accuracy rate calculation method and device based on semantic analysis and computer equipment
PCT/CN2018/124398 WO2020098098A1 (en) 2018-11-13 2018-12-27 Semantic analysis-based text accuracy calculation method, device and computer device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811348583.1A CN109710904B (en) 2018-11-13 2018-11-13 Text accuracy rate calculation method and device based on semantic analysis and computer equipment

Publications (2)

Publication Number Publication Date
CN109710904A CN109710904A (en) 2019-05-03
CN109710904B true CN109710904B (en) 2023-11-14

Family

ID=66254868

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811348583.1A Active CN109710904B (en) 2018-11-13 2018-11-13 Text accuracy rate calculation method and device based on semantic analysis and computer equipment

Country Status (2)

Country Link
CN (1) CN109710904B (en)
WO (1) WO2020098098A1 (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2999768B1 (en) * 1999-03-04 2000-01-17 株式会社エイ・ティ・アール音声翻訳通信研究所 Speech recognition error correction device
CN104464736A (en) * 2014-12-15 2015-03-25 北京百度网讯科技有限公司 Error correction method and device for voice recognition text
CN106847288A (en) * 2017-02-17 2017-06-13 上海创米科技有限公司 The error correction method and device of speech recognition text

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8001136B1 (en) * 2007-07-10 2011-08-16 Google Inc. Longest-common-subsequence detection for common synonyms
CN103699591A (en) * 2013-12-11 2014-04-02 湖南大学 Page body extraction method based on sample page
CN105653517A (en) * 2015-11-05 2016-06-08 乐视致新电子科技(天津)有限公司 Recognition rate determining method and apparatus
CN108399163B (en) * 2018-03-21 2021-01-12 北京理工大学 Text similarity measurement method combining word aggregation and word combination semantic features

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2999768B1 (en) * 1999-03-04 2000-01-17 株式会社エイ・ティ・アール音声翻訳通信研究所 Speech recognition error correction device
CN104464736A (en) * 2014-12-15 2015-03-25 北京百度网讯科技有限公司 Error correction method and device for voice recognition text
CN106847288A (en) * 2017-02-17 2017-06-13 上海创米科技有限公司 The error correction method and device of speech recognition text

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
一种基于短文本相似度计算的主观题自动阅卷方法;张均胜;石崇德;徐红姣;高影繁;何彦青;;图书情报工作(第19期);第31-37页 *

Also Published As

Publication number Publication date
CN109710904A (en) 2019-05-03
WO2020098098A1 (en) 2020-05-22

Similar Documents

Publication Publication Date Title
CN110765763B (en) Error correction method and device for voice recognition text, computer equipment and storage medium
CN110704633B (en) Named entity recognition method, named entity recognition device, named entity recognition computer equipment and named entity recognition storage medium
TWI621077B (en) Character recognition method and server for claim documents
CN113220782B (en) Method, device, equipment and medium for generating multi-element test data source
CN112651238A (en) Training corpus expansion method and device and intention recognition model training method and device
CN109473093B (en) Speech recognition method, device, computer equipment and storage medium
CN109766072B (en) Information verification input method and device, computer equipment and storage medium
CN109783785B (en) Method and device for generating experiment detection report and computer equipment
WO2022116436A1 (en) Text semantic matching method and apparatus for long and short sentences, computer device and storage medium
CN109933754B (en) Method, apparatus, computer device and storage medium for searching contract modification part
CN115497484B (en) Voice decoding result processing method, device, equipment and storage medium
CN112633423B (en) Training method of text recognition model, text recognition method, device and equipment
CN113449489A (en) Punctuation mark marking method, punctuation mark marking device, computer equipment and storage medium
WO2019153587A1 (en) User identity authentication method and apparatus, computer device and storage medium
CN109657210B (en) Text accuracy rate calculation method and device based on semantic analysis and computer equipment
CN111325031A (en) Resume parsing method and device
CN110705211A (en) Text key content marking method and device, computer equipment and storage medium
CN112749639B (en) Model training method and device, computer equipment and storage medium
CN109710904B (en) Text accuracy rate calculation method and device based on semantic analysis and computer equipment
CN110929514B (en) Text collation method, text collation apparatus, computer-readable storage medium, and electronic device
CN112395857A (en) Voice text processing method, device, equipment and medium based on dialog system
CN110852098A (en) Data correction method, electronic device and storage medium
CN113645357B (en) Call quality inspection method, device, computer equipment and computer readable storage medium
CN113434652B (en) Intelligent question-answering method, intelligent question-answering device, equipment and storage medium
CN115422936A (en) Entity identification method, entity identification device, 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
GR01 Patent grant
GR01 Patent grant