A method and device for error-tolerant alignment of multi-stage speech and text

Through a multi-stage speech and text fault-tolerant alignment method, automatic speech recognition and longest increasing subsequence technology are used to solve the problems of long audio alignment and low accuracy in traditional methods, achieve efficient speech and text alignment, and improve alignment. Accuracy and speed.

CN115062599BActive Publication Date: 2024-09-06QINGDAO UNIV OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210625881.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-02
Publication Date
2024-09-06
Estimated Expiration
2042-06-02

AI Technical Summary

Technical Problem

Traditional speech and text alignment methods take a long time to process long audio and noise, and the alignment accuracy is low. Especially when the accuracy of ASR is limited, it is difficult to achieve efficient sentence-level alignment.

Method used

A multi-stage speech and text error-tolerant alignment method is used to generate recognition text through automatic speech recognition, find the longest increasing subsequence anchor point, divide preliminary alignment segments and unaligned segments, and use similarity calculation functions for alignment to gradually improve alignment accuracy.

Benefits of technology

It effectively solves the problem of sentence-level alignment of long speech and text, improves alignment accuracy, shortens processing time, and reduces dependence on ASR accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115062599B
    Figure CN115062599B
Patent Text Reader

Abstract

The present invention discloses a method and device for fault-tolerant alignment of multi-stage speech and text, including: a first stage of converting speech into text to form a recognized text; a second stage of searching for anchor points in the original text and the recognized text by finding the longest increasing subsequence; a third stage of dividing the recognized text into preliminary aligned segments and unaligned segments according to the positional relationship of the anchor points in the sentence; a fourth stage of repeatedly executing the second and third stages for the unaligned segments until the unaligned segments no longer change or no new anchor points appear; a fifth stage of performing preliminary alignment of the unaligned segments by using a similarity calculation function to find the most similar words in the recognized text as sentence boundaries in the recognized text for the unaligned segments; and a sixth stage of judging whether the preliminarily aligned sentences are accurately aligned or incorrectly aligned. The text-speech alignment method of the present invention can effectively solve the sentence-level alignment problem of continuous, non-completely matched long speech and text.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of speech processing, and in particular, relates to a method and a device for aligning speech with text. Background Art

[0002] Speech-text alignment, or text-to-speech alignment for short, is one of the key technologies in the fields of speech recognition data annotation, news subtitle generation, and audiobook production. Speech and text usually show the characteristics of being consistent in overall content, but not completely matching. Therefore, how to divide speech into corresponding granularities according to the granularity of text content, and align and reorganize these divided units, is the key to text-to-speech alignment technology.

[0003] Traditional text-speech alignment methods are mainly implemented through forced alignment technology based on the Viterbi algorithm. However, if the audio file contains noise or there are long audios that do not match the text content, the traditional text-speech alignment method cannot achieve effective alignment. The decoding process of the long audio Viterbi will take a lot of time, and for incompletely matched corpora, the Viterbi algorithm will end the entire alignment process due to local alignment failures due to its iterative method.

[0004] At present, there are still many text-speech alignment methods based on Automatic Speech Recognition (ASR) technology, that is, through ASR, the "text-speech alignment" problem is converted into the problem of "matching text and text strings", and then the edit distance algorithm is used to find the recognized text (text recognized by ASR technology) segment that is most similar to the original text. The alignment accuracy of this text-speech alignment method is limited by the accuracy of ASR, and it is necessary to reduce the impact of ASR accuracy on text-speech alignment accuracy by designing reasonable alignment rules. Summary of the invention

[0005] The purpose of the present invention is to provide a method and device for multi-stage speech and text error-tolerant alignment, which can effectively solve the sentence-level alignment problem of continuous, non-completely matched long speech and text, and make up for the shortcomings of traditional text-to-speech alignment methods in the process of aligning continuous, non-completely matched long speech and text, which are time-consuming and have low alignment accuracy.

[0006] In order to solve the above technical problems, the present invention adopts the following technical solutions to achieve the above problems:

[0007] In one aspect, the present invention provides a method for multi-stage error-tolerant alignment of speech and text, comprising:

[0008] The first stage: converting speech into text to form recognition text;

[0009] The second stage: searching for anchor points in the original text and the recognized text by finding the longest increasing subsequence;

[0010] The third stage: dividing the recognized text into preliminary aligned segments and unaligned segments according to the positional relationship of the anchor points in the sentence;

[0011] Stage 4: Repeating the second stage and the third stage for the misaligned segment until the misaligned segment no longer changes or no new anchor point appears;

[0012] The fifth stage: for the unaligned segments, a similarity calculation function is used to find the most similar words in the recognized text and the original text as sentence boundaries, and the unaligned segments are preliminarily aligned;

[0013] Stage 6: Determine whether the preliminarily aligned sentences are accurately aligned or incorrectly aligned.

[0014] In some embodiments of the present application, the second stage preferably includes the following process:

[0015] In the original text, punctuation marks are replaced with set sentence separators to concatenate into a long string;

[0016] Converting the characters in the original text and the recognized text into pinyin;

[0017] Perform similarity matching on the pinyin in the original text and the recognized text to find out the words that are exactly the same in the recognized text and the original text;

[0018] According to the positions of the words that match exactly in the original text, a method of finding the longest increasing subsequence is adopted to obtain the anchor point set.

[0019] In some embodiments of the present application, in the third stage, the preliminary aligned segments and the unaligned segments may be divided according to the positional relationship of the anchor points in the sentence using the following alignment rules:

[0020] Alignment rule 1: The part between anchor points in a sentence is divided into preliminary alignment segments;

[0021] Alignment Rule 2: The parts between anchor points across sentences are divided into unaligned segments.

[0022] In some embodiments of the present application, the fifth stage may specifically include the following process:

[0023] Assume that the unaligned segment in the original text is S′, and its corresponding subsequence in the recognized text is A′ n ;

[0024] Using the similarity calculation function sim(S′,A′n ) in A′ n Traverse the unaligned segments and find a word that maximizes the similarity in the unaligned segments as the sentence boundary;

[0025] The start time and / or end time of the word is used as the timestamp of the boundary to perform preliminary alignment on the misaligned segments.

[0026] In some embodiments of the present application, the sixth stage may specifically include the following process:

[0027] The pinyin of the sentences preliminarily aligned in the original file and the recognition file are represented by vectors u and v respectively, and the cosine similarity of vectors u and v is calculated:

[0028]

[0029] Set the similarity threshold α;

[0030] If sim(u,v)≥α, the sentence is judged to be in an aligned state; otherwise, the sentence is judged to be in a misaligned state and an error prompt is given.

[0031] In another aspect, the present invention also proposes a device for multi-stage speech and text error-tolerant alignment, comprising an automatic speech recognition module, a module for finding the longest increasing subsequence, a module for dividing aligned segments into unaligned segments, a loop control module, a similarity calculation module and a precise alignment recognition module; wherein the automatic speech recognition module is used to convert speech into text to form a recognized text; the module for finding the longest increasing subsequence is used to search for anchor points in the original text and the recognized text; the module for dividing aligned segments into unaligned segments is used to divide the recognized text into preliminary aligned segments and unaligned segments according to the positional relationship of the anchor points in the sentence. ; The loop control module is used to control the longest increasing subsequence finding module and the alignment segment and misalignment segment division module to repeatedly process the misaligned segment until the misaligned segment no longer changes or no new anchor point appears; the similarity calculation module is used to use the similarity calculation function to find the most similar words in the recognized text with the original text for the misaligned segment; the alignment segment and misalignment segment division module uses the most similar words as sentence boundaries to perform preliminary alignment on the misaligned segments; the precise alignment recognition module is used to determine the precise alignment and incorrect alignment of the preliminarily aligned sentences.

[0032] In some embodiments of the present application, a Chinese character to pinyin conversion module is further provided in the device, which is used to replace punctuation marks in the original text with set sentence separators to splice them into a long string, and then convert the characters in the original text and the recognized text into pinyin, and then transmit them to the similarity calculation module; the similarity calculation module performs similarity matching on the pinyin in the original text and the recognized text, finds out the words that match exactly the same in the recognized text and the original text, and transmits them to the longest increasing subsequence search module; the longest increasing subsequence search module searches for anchor points in the original text and the recognized text according to the positions of the words that match exactly the same in the original text, using the method of finding the longest increasing subsequence; the aligned segment and unaligned segment division module divides the preliminary aligned segments and unaligned segments according to the positional relationship of the anchor points in the sentence using the following alignment rules:

[0033] Alignment rule 1: The part between anchor points in a sentence is divided into preliminary alignment segments;

[0034] Alignment Rule 2: The parts between anchor points across sentences are divided into unaligned segments.

[0035] In some embodiments of the present application, the precise alignment recognition module represents the pinyin of the sentences in the original file and the recognition file with vectors u and v respectively, and sends them to the similarity calculation module to calculate the cosine similarity of the vectors u and v. The precise alignment recognition module sets a similarity threshold α; if sim(u,v)≥α, the sentence is determined to be in an aligned state; otherwise, the sentence is determined to be in a misaligned state, and the error prompt module is controlled to output an error prompt to display the text-time alignment information where an error occurs.

[0036] Compared with the prior art, the advantages and positive effects of the present invention are as follows: the present invention designs a text-speech alignment method and device for multi-stage long speech, adopts similarity calculation method and longest increasing subsequence search technology to find the anchor points that match the words in the original text and the recognized text, and divides the preliminary aligned segments and the unaligned segments according to the positional relationship of the anchor points in the sentence, and performs similarity matching on the unaligned segments to achieve preliminary alignment of all sentences. The text-speech alignment method of the present invention is less affected by the accuracy of ASR, can effectively solve the sentence-level alignment problem of continuous, non-completely matched long speech and text, and has high alignment accuracy and short time consumption, which can effectively make up for the shortcomings of the traditional text-speech alignment method in the process of aligning continuous, non-completely matched long speech and text, which is time-consuming and has low alignment accuracy.

[0037] Other features and advantages of the present invention will become more apparent after reading the detailed description of the embodiments of the present invention in conjunction with the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 An overall flow chart of an embodiment of the multi-stage speech and text error-tolerant alignment method proposed by the present invention;

[0039] Figure 2 This is a general architecture diagram of an embodiment of the multi-stage speech and text error-tolerant alignment device proposed by the present invention;

[0040] Figure 3 Schematic diagram of the anchor point selection stage;

[0041] Figure 4 Schematic diagram of the initial alignment stage. DETAILED DESCRIPTION

[0042] The specific implementation modes of the present invention are described in detail below with reference to the accompanying drawings.

[0043] like Figure 1 As shown, the multi-stage speech and text error-tolerant alignment method of this embodiment mainly involves several stages: generating and recognizing text according to speech, selecting anchor points, preliminary alignment, and accurate alignment judgment. In view of the above stages, this embodiment configures the main components such as automatic speech recognition module, Chinese character conversion pinyin module, similarity calculation module, longest increasing subsequence search module, aligned segment and unaligned segment division module, loop control module, accurate alignment recognition module and error prompt module in the multi-stage speech and text error-tolerant alignment device accordingly, as shown in FIG. Figure 2 As shown, multi-stage continuous long speech can be automatically aligned with the text content even when it does not completely match the overall content of the text.

[0044] Combine the following Figure 1 and Figure 2 , the text-language error-tolerant alignment technology of this embodiment is specifically explained.

[0045] This embodiment divides the multi-stage speech and text error-tolerant alignment method into the following six stages:

[0046] <Phase 1> The stage of generating recognized text based on speech

[0047] This embodiment converts the problem of aligning speech and text into the problem of aligning text and text. At this stage, this embodiment preferably uses automatic speech recognition ASR technology to convert the speech that needs to be aligned into text to form a recognized text. This process can be Figure 2 This is done in the automatic speech recognition module.

[0048] <Phase 2> Anchor point selection stage

[0049] In this stage, the main task is to search for anchor points in the original text and the recognized text by finding the longest increasing subsequence.

[0050] An anchor is a word or phrase that matches the recognized text and the original text, and is used to locate matching fields in the recognized text and the original text.

[0051] In order to facilitate the search for anchor points, this embodiment designs the following anchor point search process:

[0052] In the first step, in the original text, punctuation marks and sentence break symbols such as carriage return or line feed are replaced with the set sentence separators to splice into a long string; the content between two adjacent sentence separators constitutes a sentence;

[0053] The second step is to convert the characters in the recognized text and the original text into pinyin. This process can be Figure 2 This is done in the Chinese character to pinyin module;

[0054] The third step is to perform similarity matching on the converted pinyin to find the words that match the recognized text exactly with the original text. This process can be Figure 2 It is completed in the similarity calculation module;

[0055] The fourth step is to use the method of finding the longest increasing subsequence to select anchor points from all the words found in the third step that match exactly the same words. This process can be done in Figure 2 This is done in the module of finding the longest increasing subsequence.

[0056] In this embodiment, the original text is represented by a sequence S, and the ASR result in the recognized text is represented by a sequence A. n = (h0,k0) ,a (h1,k1) ,…,a (hn,kn) > indicates that hn and kn represent the start and end time of the audio corresponding to the ASR result, where n is a natural number and h0 <k0<…<hn<kn。

[0057] In anchor point selection, the following two conditions need to be met:

[0058] The anchor point is the sequence S and A n Match the exact word or phrase in the

[0059] The position and time of the anchor points in the sequence S must be in order, that is, the anchor point sequence is A n subsequence, you can use anchors′ n = (hi,ki) ,a (hi+1,ki+1) ,…,a (hj,kj) > indicates.

[0060] Since the text corresponding to an ASR result (i.e., sequence A n ​​) may appear multiple times in the original text. For example, in the following passage, "Erin said that she was ridiculed by Zander a few days ago and she was still angry. She wanted to take the opportunity to retaliate against Zander and vent her hatred. Zander smiled after hearing this." In this passage, "Zander" appears three times in the segment. For incompletely matched corpus, due to the influence of the recording environment and equipment, the ASR result may only recognize the last two "Zander", and the first "Zander" audio segment may be wrong and thus recognized as "Zeande". Therefore, the two "Zander" in the ASR result will be mistakenly matched to the positions of the first two "Zander" in the original text, which will cause the position of the ASR result in the original text to not increase in order.

[0061] Considering the above problems, this embodiment uses the method of finding the longest increasing subsequence to obtain the anchor point set anchors′ according to the position of the ASR result in the original text. n ,like Figure 3 shown.

[0062] The longest increasing subsequence problem is to find a subsequence in a given numerical sequence, so that the values ​​of the elements of this subsequence increase in sequence, and the length of this subsequence is as large as possible. The elements in the longest increasing subsequence are not necessarily continuous in the original sequence.

[0063] Figure 3 In the figure, serial number I indicates deletion errors compared with the original text (commonly seen in missed readings); serial number II indicates insertion errors compared with the original text (commonly seen in multiple readings); serial number III indicates replacement errors compared with the original text (commonly seen in misreading characters or incorrect pronunciations); serial number IV indicates anchor points (matching identical words) that will be discarded when searching for the longest increasing subsequence in a global scope due to the above three errors.

[0064] <Phase 3> Preliminary alignment

[0065] According to the position relationship of the anchor points found in the second stage in the sentences of the original text, the recognized text can be divided into preliminary aligned segments and unaligned segments. This process can be done in Figure 2 The division of aligned segments and unaligned segments is completed in the module.

[0066] In this embodiment, according to the position relationship of the anchor points in the sentence, the following alignment rules are preferably used to divide the preliminary aligned segments and the unaligned segments:

[0067] Alignment rule 1: The part between anchor points in a sentence is divided into preliminary alignment segments;

[0068] Alignment Rule 2: The part between anchor points that span sentences is divided into unaligned segments. That is, if the part between two temporally adjacent anchor points spans different sentences, the part between the two anchor points is divided into unaligned segments.

[0069] The above alignment rules can be stored in Figure 2 In the rule base, it is called by the aligned segment and unaligned segment division module.

[0070] like Figure 4 As shown, S i represents the i-th sentence in the original text, s ij represents the jth word in the i-th sentence. For the beginning of the sentence, if s 1j is the anchor point, even if s 21 If there is no anchor point, then we can also assume that there is an anchor point at the beginning of S2, and the same is true for the end of the sentence. Based on the above alignment rules, we can know that:

[0071] Because the sentence begins with s 11 and ending s 1j There are anchor points in both sentences, so sentence S1 is considered to be preliminarily aligned, forming a preliminarily aligned segment;

[0072] Since the beginning of sentence S2 is s 21 There is an anchor point, s 2(j - 1) There is an anchor point, ending s 2j There is no anchor point, and the beginning of sentence S3 is s 31 There is no anchor point, s 32 There is no anchor point, s 33 There is an anchor point, s 3j There are anchor points, so sentences S2 and S3 can be divided into two aligned segments and one unaligned segment. 21 …s 2(j-1) For the initial alignment segment, s 2j …s 32 For unaligned segments, s 33 …s 3j For the initial alignment segment.

[0073] <Stage 4> Finding the anchor point to abandon

[0074] This embodiment searches for the ASR result subsequence corresponding to the unaligned segment, takes the unaligned segment and the found ASR result subsequence as new input, and repeatedly executes the second and third stages until the unaligned segment no longer changes or no new anchor point appears. In this way, by continuously narrowing the range to be aligned, the anchor point discarded due to searching for the longest increasing subsequence can be found again.

[0075] For example, in Figure 3 In the speech recognition results, if the ASR result marked with sequence number IV is selected as the new anchor point in the second round of anchor point selection and preliminary alignment of the unaligned segments, then according to alignment rule 1, both sentences S1 and S2 will be aligned.

[0076] This stage can be Figure 2 The loop control module in controls the longest increasing subsequence finding module and the aligned segment and unaligned segment division module to complete.

[0077] <Phase 5> Similarity matching of unaligned segments

[0078] After executing the fourth stage, if there are still unaligned segments, a similarity calculation function can be used to find the most similar words in the original text as sentence boundaries in the recognized text to perform preliminary alignment on the unaligned segments.

[0079] This process can be done by Figure 2 The similarity calculation module and the alignment and misalignment segmentation module in the recognition text are used to complete the task. That is, the similarity calculation module uses the similarity calculation function sim() to find the most similar words in the original text for the misaligned segments; the alignment and misalignment segmentation module uses the most similar words as sentence boundaries to perform preliminary alignment on the misaligned segments.

[0080] Specifically, suppose that after the fourth stage is executed, there is still an unaligned segment s′ and the corresponding ASR result subsequence A′ n = (hi,ki) ,…,a (hj,kj) >, through the similarity calculation function sim(s′,A′ n ) in A′ n Traverse and concatenate the ASR results into a string, and perform similarity matching with s′ to find an ASR result (the most similar word) N that maximizes the sentence boundary similarity in the unaligned segment. * , as the timestamp of the boundary, the unaligned segments are preliminarily aligned to complete this round of similarity matching.

[0081] The calculation formula is: * = argmax n sim(s′,A′ n ).

[0082] The boundary timestamp here may be the start time and / or end time corresponding to the word with the greatest similarity.

[0083] <Stage 6> Precise alignment judgment stage

[0084] This stage mainly focuses on the above-mentioned preliminarily aligned sentences to determine whether they are accurately aligned or incorrectly aligned.​

[0085] This process can Figure 2 The precise alignment is completed in the recognition module.

[0086] Specifically, the following processes may be involved:

[0087] First, the pinyin of the sentences in the original file and the recognition file that are preliminarily aligned are represented by vectors u and v, respectively, and the cosine similarity of vectors u and v is calculated:

[0088]

[0089] Secondly, a similarity threshold α is set, and if sim(u,v)≥α, the sentence is determined to be in an aligned state; otherwise, the sentence is determined to be in a misaligned state and an error prompt is given. The error prompt can be output by an error prompt module to display the text-time alignment information of the error.

[0090] The similarity calculation functions used in different stages of this embodiment can all adopt the cosine similarity calculation function.

[0091] The specific process of the multi-stage speech and text error-tolerant alignment method of this embodiment is described in detail below through a specific example.

[0092] Assume the original text is:

[0093] Episode 1

[0094] Irene spoke up and said that she was ridiculed by Zander a few days ago and she was still angry. She wanted to seize the opportunity to take revenge on Zander and vent her hatred. Zander smiled slightly after hearing this.

[0095] Step 1: Use the automatic speech recognition module to convert speech into text to form recognition text.

[0096] Step 2: Replace the punctuation marks and carriage returns in the original text with a special sentence separator ┆, concatenate them into a long string, and then use the Chinese character to pinyin module to convert the long string into pinyin as follows:

[0097] ┆di yi ji┆ai lin kai kou shuo dao┆ta ji tian qian bei zan de chao xiao┆zhi jin yu nu wei xiao┆yao zhu ji hui bao fu zan de┆chu chu xin touzhi hen┆zan de wei yi xiao┆

[0098] Step 3: Use the Chinese character to pinyin module to convert the characters in the recognized text into pinyin, as shown in Table 1.

[0099] Table 1

[0100] text Pinyin Start time End Time Irene ai lin 600 1230 Said Shuo Dao 1620 2220 she ta 2500 2680 Zeand ze an de 3900 4380 laugh at chao xiao 4380 4890 to date zhi jin 5010 5610 The anger is still there yu nu wei xiao 5620 6560 Seize the opportunity Zhu zhu ji hui 6810 7740 revenge Bao Fu 7750 8170 Zander zan de 8220 8380 To solve yi jie 8395 8710 Heart Xin Tou 8720 9100 Hate zhi hen 9100 9550 Zander zan de 9820 10160 Smile wei wei yi xiao 10170 10800

[0101] Step 4: Use the similarity calculation module and the longest increasing subsequence search module to search for the anchor point set.

[0102] First, the similarity calculation module is used to find the ASR results that appear in the original text and record their index positions in the original text string. Then, the longest increasing subsequence search module is used to search for the anchor point set based on the index position in the ASR result, as shown in Table 2.

[0103] Table 2

[0104] text Pinyin Start time End Time Index location Is it an anchor point? Irene ai lin 600 1230 12 yes Said Shuo Dao 1620 2220 27 yes she ta 2500 2680 37 yes laugh at chao xiao 4380 4890 64 yes to date zhi jin 5010 5610 74 yes The anger is still there yu nu wei xiao 5620 6560 83 yes Seize the opportunity Zhu zhu ji hui 6810 7740 103 yes revenge Bao Fu 7750 8170 119 yes Zander zan de 8220 8380 57 no Heart Xin Tou 8720 9100 142 yes Hate zhi hen 9100 9550 150 yes Zander zan de 9820 10160 126 no Smile wei wei yi xiao 10170 10800 166 yes

[0105] The original pinyin segment can be marked according to the final searched anchor point set. For example, the distribution of anchor points can be marked with underlines as follows:

[0106] ┆di yi ji┆ ai lin kai kou Shuo Dao ┆ ta Ji Tianqian is also a Chao xiao ┆ I'm not sure what to do ┆yao Zhu ji hui bao fu zan de┆chu chu Xin Tou zhi hen ┆zan de wei wei yi xiao ┆

[0107] Step 5: Perform preliminary alignment based on the designed alignment rules 1 and 2, combined with the index positions of the anchor points and the beginning and end of the sentence.

[0108] According to alignment rules 1 and 2, the unaligned segment in the original pinyin segment is "zan de┆chu chu", and the rest are preliminary aligned segments.

[0109] Step 6: According to the unaligned segment "zan de┆chu chu", find the end time of the anchor point "revenge" closest to the beginning of the unaligned segment and the start time of the anchor point "heart" closest to the end of the unaligned segment, and find the ASR results within the time range 8170-8720.

[0110] That is, the ASR results corresponding to the unaligned segments obtained from Table 1 are {“text”: “Zande”, “start time”: 8220, “end time”: 8380} and {“text”: “Yijie”, “start time”: 8395, “end time”: 8710}.

[0111] Step 7: According to the unaligned segment “zan de┆chu chu” and its corresponding ASR result “zan de┆yi jie”, a second round of anchor point selection and preliminary alignment is performed to complete the preliminary alignment of all sentences.

[0112] In the second round of anchor point selection, the new anchor point is “zan de”, and according to alignment rule 1, a preliminary alignment of the unaligned segments can be achieved.

[0113] Step 8: Precise Alignment and Error Tips

[0114] Through the above steps, we can get seven preliminarily aligned sentences s1, s2, …, s7. The sentences corresponding to the original pinyin and the ASR pinyin are represented by vectors u and v respectively, and the cosine similarity sim(u, v) of vectors u and v is calculated.

[0115] When the similarity threshold α is set to 0.9, the final cosine similarity calculation results and sentence alignment results are shown in Table 3.

[0116] Table 3

[0117]

[0118] Of course, the above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A method for error-tolerant alignment of multi-stage speech and text, characterized in that: include: The first stage: converting speech into text to form recognition text; The second stage: searching for anchor points in the original text and the recognized text by finding the longest increasing subsequence; It includes: Converting the characters in the original text and the recognized text into pinyin; Perform similarity matching on the pinyin in the original text and the recognized text to find out the words that are exactly the same between the recognized text and the original text; According to the positions of the words that match exactly in the original text, a set of anchor points is obtained by finding the longest increasing subsequence; The third stage: According to the positional relationship of the anchor points in the sentence, the following alignment rules are used in the recognized text to divide the preliminary aligned segments and the unaligned segments: Alignment rule 1: The part between anchor points in a sentence is divided into preliminary alignment segments; Alignment rule 2: The parts between anchor points across sentences are divided into unaligned segments; Stage 4: Repeating the second stage and the third stage for the misaligned segment until the misaligned segment no longer changes or no new anchor point appears; The fifth stage: for the unaligned segments, a similarity calculation function is used to find the most similar words in the recognized text and the original text as sentence boundaries, and the unaligned segments are preliminarily aligned; Stage 6: Determine whether the preliminarily aligned sentences are accurately aligned or incorrectly aligned.

2. The method for multi-stage speech and text error-tolerant alignment according to claim 1, characterized in that: The second phase also includes: In the original text, punctuation marks are replaced with set sentence separators to be spliced ​​into a long string, and then a process of converting the characters in the original text and the recognized text into pinyin is performed.

3. The method for multi-stage speech and text error-tolerant alignment according to claim 1, characterized in that: The fifth stage includes: Assume that the unaligned segment in the original text is S′, and its corresponding subsequence in the recognized text is A′ n ; Using the similarity calculation function sim(S′,A′ n ) in A′ n Traverse the unaligned segments and find a word that maximizes the similarity in the unaligned segments as the sentence boundary; The start time and / or end time of the word is used as the timestamp of the boundary to perform preliminary alignment on the misaligned segments.

4. The method for multi-stage speech and text error-tolerant alignment according to claim 1, characterized in that: The sixth stage includes: The pinyin of the sentences preliminarily aligned in the original file and the recognition file are represented by vectors u and v respectively, and the cosine similarity of vectors u and v is calculated: Set the similarity threshold α; If sim(u,v)≥α, the sentence is judged to be in an aligned state; otherwise, the sentence is judged to be in a misaligned state and an error prompt is given.

5. A device for error-tolerant alignment of multi-stage speech and text, characterized in that: include: Automatic speech recognition module, which is used to convert speech into text to form recognition text; The module for finding the longest increasing subsequence is used to search for anchor points in the original text and the recognized text; The module for dividing aligned segments and unaligned segments is used to divide the recognized text into preliminary aligned segments and unaligned segments according to the positional relationship of the anchor points in the sentence using the following alignment rules: Alignment rule 1: The part between anchor points in a sentence is divided into preliminary alignment segments; Alignment rule 2: The parts between anchor points across sentences are divided into unaligned segments; A loop control module, used for controlling the longest increasing subsequence finding module and the aligned segment and misaligned segment division module to repeatedly process the misaligned segment until the misaligned segment no longer changes or no new anchor point appears; A similarity calculation module, which is used to use a similarity calculation function to find the most similar word in the recognized text to the original text for the unaligned segment; The aligned segment and unaligned segment division module uses the most similar words as sentence boundaries to perform preliminary alignment on the unaligned segments; A precise alignment recognition module, which is used to determine whether the preliminarily aligned sentences are precisely aligned or incorrectly aligned; A Chinese character to pinyin conversion module, which is used to replace punctuation marks in the original text with set sentence separators to splice them into a long string, and then convert the characters in the original text and the recognized text into pinyin and transmit them to the similarity calculation module; The similarity calculation module performs similarity matching on the pinyin in the original text and the recognized text, finds out the words that are completely matched between the recognized text and the original text, and transmits them to the longest increasing subsequence finding module; The module for finding the longest increasing subsequence searches for anchor points in the original text and the recognized text using a method for finding the longest increasing subsequence according to the positions of the words that match exactly in the original text.

6. The device for error-tolerant alignment of multi-stage speech and text according to claim 5, characterized in that: The precise alignment recognition module represents the pinyin of the sentences in the original file and the recognition file with vectors u and v respectively, and sends them to the similarity calculation module to calculate the cosine similarity of the vectors u and v. The precise alignment recognition module sets a similarity threshold α; If sim(u,v)≥α, the sentence is determined to be in an aligned state; otherwise, the sentence is determined to be in a misaligned state, and the error prompt module is controlled to output an error prompt.