Text matching method and device, electronic equipment and readable storage medium
By dividing the target text into header and footer text and using a sliding window to determine the matching position in the baseline text, the problem of low text matching accuracy in the prior art is solved, and higher matching accuracy is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- MASHANG CONSUMER FINANCE CO LTD
- Filing Date
- 2022-11-14
- Publication Date
- 2026-06-23
AI Technical Summary
In existing technologies, text matching methods based on word overlap suffer from low matching accuracy when the texts to be matched do not completely correspond.
The target text to be matched is divided into header text and footer text. The start and end positions of the matching are determined in the base text by a sliding window for length matching, and the corresponding matching text characters are extracted for comparison.
By accurately locating the start and end positions of the match and eliminating interfering text, the accuracy of text matching is improved, especially when the text to be matched is a part of the base text.
Smart Images

Figure CN116150333B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of natural language processing technology, and in particular to a text matching method, apparatus, electronic device, and readable storage medium. Background Technology
[0002] With the development of natural language processing technology, text matching has been widely used in many practical application scenarios. For example, it can be used to find corresponding articles based on user search terms, or to perform voice quality inspection based on the matching results between customer service speech-transcribed text and standard text.
[0003] In related technologies, text matching methods primarily rely on algorithms based on word overlap to determine whether two texts match. However, this method directly performs a holistic match on the two texts, which can lead to low accuracy if the two texts do not completely correspond. For example, if the text to be matched is only a portion of the base text, this approach will significantly reduce the accuracy of text matching. Summary of the Invention
[0004] This disclosure provides a text matching method, apparatus, electronic device, and readable storage medium for improving the accuracy of text matching.
[0005] Firstly, this disclosure provides a text matching method, comprising the following steps:
[0006] The target text to be matched is divided into header text and footer text;
[0007] The starting position of the matching text corresponding to the header text is determined by using a first sliding window that matches the length of the header text;
[0008] The matching termination position corresponding to the tail text is determined by using a second sliding window that matches the length of the tail text;
[0009] Based on the matching start position and the matching end position, extract the matching text characters corresponding to the target text to be matched from the reference text;
[0010] Based on the comparison result between the matched text characters and the target text to be matched, it is determined whether the target text to be matched matches the reference text.
[0011] Secondly, this disclosure provides a text matching apparatus, comprising:
[0012] The segmentation module is suitable for dividing the target text to be matched into header text and footer text;
[0013] a start position determining module, adapted to determine a matching start position corresponding to the head text in the reference text by a first sliding window matching a length of the head text;
[0014] a termination position determining module, adapted to determine a matching termination position corresponding to the tail text in the reference text by a second sliding window matching a length of the tail text;
[0015] an extracting module, adapted to extract a matching text character corresponding to the target text to be matched from the reference text according to the matching start position and the matching termination position;
[0016] a matching module, adapted to match a comparison result between the text character and the target text to be matched to determine whether the target text to be matched matches the reference text.
[0017] In a third aspect, the present disclosure provides an electronic device, comprising: at least one processor; and a memory connected with the at least one processor in communication; wherein the memory stores one or more computer programs executable by the at least one processor, and the one or more computer programs are executed by the at least one processor to enable the at least one processor to perform the above method.
[0018] In a fourth aspect, the present disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor / processing core, implements the above method.
[0019] The embodiments provided in this disclosure divide the target text to be matched into two parts: header text and footer text. Correspondingly, on the one hand, for the header text, a sliding window matching is performed in the reference text to determine the matching start position corresponding to the header text within the reference text based on the matching result; on the other hand, for the footer text, a sliding window matching is performed in the reference text to determine the matching end position corresponding to the footer text within the reference text based on the matching result. Then, matching text characters corresponding to the target text are extracted from the reference text based on the matching start and end positions, so that the matching text characters can be compared with the target text. Therefore, this method, by dividing the target text to be matched into header and footer text and performing matching on the header and footer text separately, accurately locates the matching start and end positions in the reference text, thereby achieving the purpose of eliminating interfering text and accurate matching, and thus improving the accuracy of text matching. This method, by matching the length of the sliding window used to determine the starting position of the match with the header text, can more accurately locate the region in the reference text corresponding to the content of the header text, and then determine the starting position of the match based on this region. Similarly, by matching the length of the sliding window used to determine the ending position of the match with the tail text, it can more accurately locate the region in the reference text corresponding to the content of the tail text, and then determine the ending position of the match based on this region. This method can accurately extract the local content in the reference text corresponding to the text to be matched, even when the text to be matched is only a part of the content in the reference text, thus significantly improving the accuracy of text matching.
[0020] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0021] The accompanying drawings are provided to further illustrate the present disclosure and form part of the specification. They are used together with the embodiments of the present disclosure to explain the disclosure and do not constitute a limitation thereof. The above and other features and advantages will become more apparent to those skilled in the art from the detailed description of exemplary embodiments with reference to the accompanying drawings, in which:
[0022] Figure 1 A flowchart illustrating a text matching method provided in one embodiment of this disclosure;
[0023] Figure 2 A flowchart illustrating a text matching method provided in another embodiment of this disclosure;
[0024] Figure 3A flowchart illustrating a text matching method provided as a specific example is shown;
[0025] Figure 4 A schematic diagram illustrating the contrast of jumping is shown;
[0026] Figure 5 A block diagram of a text matching device provided in an embodiment of this disclosure;
[0027] Figure 6 This is a block diagram of an electronic device provided in an embodiment of the present disclosure. Detailed Implementation
[0028] To enable those skilled in the art to better understand the technical solutions of this disclosure, exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments of this disclosure to aid understanding. These should be considered merely exemplary. Therefore, those skilled in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0029] Where there is no conflict, the various embodiments of this disclosure and the features thereof in the embodiments may be combined with each other.
[0030] As used herein, the term “and / or” includes any and all combinations of one or more related enumerated entries.
[0031] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit this disclosure. As used herein, the singular forms “a” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that when the terms “comprising” and / or “made of” are used in this specification, the presence of the stated feature, integral, step, operation, element, and / or component is specified, but the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or groups thereof is not excluded. Words such as “connected” or “linked” are not limited to physical or mechanical connections but can include electrical connections, whether direct or indirect.
[0032] Unless otherwise specified, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and this disclosure, and will not be interpreted as having an idealized or overly formal meaning, unless expressly so defined herein.
[0033] The text matching method according to embodiments of this disclosure can be executed by electronic devices such as terminal devices or servers. Terminal devices can be in-vehicle devices, user equipment (UE), mobile devices, user terminals, terminals, cellular phones, cordless phones, personal digital assistants (PDAs), handheld devices, computing devices, in-vehicle devices, wearable devices, etc. The server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. Specifically, the method can be implemented by a processor calling a computer program stored in memory.
[0034] In related technologies, text matching methods mainly rely on word overlap matching algorithms to determine whether two texts match. However, this method directly performs a holistic match on both texts, which can lead to low accuracy if the two texts do not correspond perfectly. To address this issue, this application proposes a text matching method that divides the target text into a header and footer section and performs matching on each section separately. This allows for precise location of the matching start and end points within the reference text, eliminating interfering text and achieving accurate matching, thereby improving the accuracy of text matching.
[0035] Figure 1 A flowchart illustrating a text matching method provided as an embodiment of this disclosure. (Refer to...) Figure 1 The method includes:
[0036] Step S110: Divide the target text to be matched into header text and footer text.
[0037] The target text to be matched can be various types of text, such as speech-to-text or recorded call text; this application does not limit the specific type of the target text. Specifically, the target text to be matched is divided into two parts: a header text and a footer text. The division of the header and footer text can be done in several ways:
[0038] In the first segmentation method, the first few characters are extracted from the target text as the header text, and the last few characters are extracted as the tail text. This segmentation method can be further divided into several different implementations: In one optional implementation, the tail character of the header text and the first character of the tail text are separated by several characters. For example, assuming the target text has 20 characters, the first 6 characters are extracted as the header text, and the last 6 characters are extracted as the tail text. Thus, the characteristic of this implementation is that the header text and the tail text do not overlap and are separated by a preset number of characters. This implementation can reduce the computational load in subsequent similarity calculations and improve computational efficiency. In another optional implementation, the header text and the tail text have a certain overlapping area. For example, assuming the target text has 20 characters, the first 15 characters are extracted as the header text, and the last 15 characters are extracted as the tail text. This method, by allowing a certain overlapping area between the header text and the tail text, can incorporate more semantic information into the similarity calculation process, thereby improving the accuracy of the similarity calculation.
[0039] In the second division method, the target text is directly divided into two non-overlapping parts: the first part is the header text, and the second part is the footer text. In summary, this application does not limit the specific division method of the header and footer text.
[0040] Furthermore, in addition to the two segmentation methods mentioned above, semantic information can be further incorporated to segment the header and footer texts. For example, multiple semantic keywords can be pre-defined, and then the target text can be matched against the pre-defined semantic keywords. Based on the matching results, the header and footer texts can be segmented according to the words that successfully match the semantic keywords, ensuring that both the segmented header and footer texts contain a pre-defined number of semantic keywords, thereby improving the accuracy of subsequent matching.
[0041] Step S120: Determine the starting position of the matching text corresponding to the header text in the reference text through a first sliding window that matches the length of the header text.
[0042] The length of the first sliding window matches the length of the header text; for example, the length of the first sliding window is equal to the length of the header text. Optionally, the first sliding window starts from a first initial position and slides multiple times according to a preset first sliding step size to obtain multiple first sliding positions, so as to extract a set of first text characters that match each first sliding position from the base text. Therefore, each slide of the first sliding window corresponds to a first sliding position, and a set of first text characters that match that first sliding position is extracted from the base text, resulting in multiple sets of first text characters corresponding to multiple first sliding positions. The number of characters in each set of first text characters matches the length of the first sliding window.
[0043] Calculate the similarity between each group of first text characters and the header text to obtain multiple similarity values corresponding to multiple groups of first text characters. A group of first text characters that satisfies the first similarity condition includes: the group of first text characters with the highest similarity to the header text, and / or, a group of first text characters with a similarity to the header text greater than the first similarity threshold. The above two methods can also be used in combination. For example, first obtain the group of first text characters with the highest similarity to the header text, then determine whether the value of this highest similarity is greater than the first similarity threshold. If yes, then the group of first text characters with the highest similarity to the header text satisfies the first similarity condition; if not, then the group of first text characters with the highest similarity to the header text does not satisfy the first similarity condition.
[0044] Of course, besides the methods described above, those skilled in the art can also flexibly perform sliding matching in other ways to determine the starting position of the matching corresponding to the header text contained in the base text. This invention does not limit the specific implementation details, as long as the accuracy of the matching can be improved through sliding matching.
[0045] Step S130: Using a second sliding window that matches the length of the tail text, extract multiple sets of second text character groups from the reference text that match multiple second sliding positions of the second sliding window, calculate the similarity between each set of second text character groups and the tail text; and determine the matching termination position corresponding to the tail text contained in the reference text based on the second sliding position corresponding to a set of second text character groups that satisfies the second similarity condition.
[0046] The length of the second sliding window matches the length of the trailing text; for example, the length of the second sliding window is equal to the length of the trailing text. Optionally, the second sliding window starts from a second initial position and slides multiple times according to a preset second sliding step size to obtain multiple second sliding positions, so as to extract a set of second text characters that match each second sliding position from the base text. Therefore, each slide of the second sliding window corresponds to a second sliding position, and a set of second text characters that match that second sliding position is extracted from the base text, resulting in multiple sets of second text characters corresponding to multiple second sliding positions. The number of characters in each set of second text characters matches the length of the second sliding window.
[0047] Calculate the similarity between each group of second text characters and the end text, obtaining multiple similarity values corresponding to multiple groups of second text characters. A group of second text characters that satisfies the second similarity condition includes: the group with the highest similarity to the end text, and / or, a group with a similarity to the end text greater than the second similarity threshold. The above two methods can also be combined. For example, first obtain the group of second text characters with the highest similarity to the end text, then determine whether the value of this highest similarity is greater than the second similarity threshold. If yes, then the group of second text characters with the highest similarity to the end text satisfies the second similarity condition; if not, then the group of second text characters with the highest similarity to the end text does not satisfy the second similarity condition.
[0048] Of course, in addition to the above methods, those skilled in the art can also flexibly perform sliding matching in other ways to determine the matching termination position corresponding to the tail text contained in the base text. This invention does not limit the specific implementation details, as long as the accuracy of matching can be improved through sliding matching. Step S140: Based on the matching start position and the matching termination position, extract the matching text characters corresponding to the target text to be matched from the base text.
[0049] The matched text characters refer to the text characters between the start and end positions of the match, including the characters corresponding to the start and end positions. By extracting the matched text characters, irrelevant characters in the base text can be removed, improving the accuracy of subsequent matches.
[0050] Step S150: Based on the comparison result between the matched text characters and the target text to be matched, determine whether the target text to be matched matches the baseline text.
[0051] The comparison of matching text characters with the target text to be matched can be achieved in various ways. For example, a similarity algorithm can be used to calculate the similarity between the matching text characters and the target text to be matched; if the similarity is greater than a similarity threshold, the two are considered to match. Alternatively, the matching text characters and the target text to be matched can be input into a preset evaluation model, and the model's output can be used to determine whether the two match. In short, the matching method and evaluation criteria can be flexibly set by those skilled in the art according to actual business scenarios, and this application does not limit them.
[0052] Therefore, in this embodiment, the target text to be matched is divided into two parts: header text and footer text. Correspondingly, on the one hand, for the header text, a sliding window matching is performed in the reference text to determine the matching start position corresponding to the header text within the reference text based on the matching result; on the other hand, for the footer text, a sliding window matching is performed in the reference text to determine the matching end position corresponding to the footer text within the reference text based on the matching result. Then, based on the matching start and end positions, matching text characters corresponding to the target text are extracted from the reference text for comparison with the target text. Thus, this method, by dividing the target text to be matched into header and footer text and performing matching on each part separately, accurately locates the matching start and end positions in the reference text, achieving the purpose of eliminating interfering text and accurate matching, thereby improving the accuracy of text matching. This method, by matching the length of the sliding window used to determine the starting position of the match with the header text, can more accurately locate the region in the reference text corresponding to the content of the header text, and then determine the starting position of the match based on this region. Similarly, by matching the length of the sliding window used to determine the ending position of the match with the tail text, it can more accurately locate the region in the reference text corresponding to the content of the tail text, and then determine the ending position of the match based on this region. This method can accurately extract the local content in the reference text corresponding to the text to be matched, even when the text to be matched is only a part of the content in the reference text, thus significantly improving the accuracy of text matching.
[0053] Figure 2 A flowchart illustrating a text matching method provided as another embodiment of this disclosure. (Refer to...) Figure 2 The method includes:
[0054] Step S201: Divide the target text to be matched into header text and footer text.
[0055] Specifically, obtain the total length of the target text to be matched; based on the total length, divide the target text to be matched into header text and footer text, so that the sum of the lengths of the header text and the footer text is greater than the total length of the text.
[0056] Furthermore, semantic information can be used to further segment the header and footer texts. For example, multiple semantic keywords can be pre-defined, and then the target text can be matched against these keywords. Based on the matching results, the header and footer texts can be segmented according to the words that successfully match the semantic keywords, ensuring that both the segmented header and footer texts contain a preset number of semantic keywords, thereby improving the accuracy of subsequent matching.
[0057] Step S202: Extract multiple sets of first text character groups from the reference text that match multiple first sliding positions of the first sliding window through a first sliding window that matches the length of the header text.
[0058] The first sliding window is used to extract a set of first text characters that match the window length and window position. The window length of the first sliding window is equal to the length of the header text; therefore, the character length of each set of first text characters is equal to the character length of the header text. Furthermore, the window position of the first sliding window is changed multiple times according to a preset first sliding step.
[0059] The multiple first sliding positions of the first sliding window are determined in the following way: based on the sliding start character contained in the reference text, the first sliding position corresponding to the first initial position of the first sliding window is determined; starting from the first initial position, the first sliding window slides multiple times along the arrangement path of the characters constituting the reference text with a preset first sliding step size to obtain the multiple first sliding positions of the first sliding window.
[0060] For example, suppose the base text is "Hello, according to the relevant regulations of the my country Banking and Insurance Regulatory Commission, in order to protect your personal rights, we will record key parts of the process by means of audio and video recording," and the target text to be matched is "According to the relevant regulations of the China Banking and Insurance Regulatory Commission, in order to protect your legitimate personal rights," and the segmented header text is "According to the relevant regulations of the my country Banking and Insurance Regulatory Commission," then a first sliding window with a length of 15 characters is set, and the first initial position of the first sliding window is determined according to the sliding start character contained in the base text.
[0061] For example, assume that the sliding start character included in the reference text is the first character "您" of the reference text. Then, the 15 characters that match the first initial position of the first sliding window are "您好,根据银保监会有关规定,为了", and the first group of the first text character groups that match the first initial position of the first sliding window is "您好,根据银保监会有关规定,为了".
[0062] Assume that the first sliding step is 1 character. Then, starting from the first initial position, the first sliding window is moved once along the arrangement path of the characters constituting the reference text with the preset first sliding step. The 15 characters that match the first sliding position of the first sliding window are "好,根据银保监会有关规定,为了保", and the second group of the first text character groups that match the first initial position of the first sliding window is "好,根据银保监会有关规定,为了保". Similarly, starting from the first initial position, the first sliding window is moved twice along the arrangement path of the characters constituting the reference text with the preset first sliding step. The 15 characters that match the first sliding position of the first sliding window are ",根据银保监会有关规定,为了保护", and the third group of the first text character groups that match the first sliding position of the first sliding window is ",根据银保监会有关规定,为了保护"... And so on until the first sliding window slides to the end of the reference characters.
[0063] Step S203: Calculate the similarity between each group of the first text character groups and the head text.
[0064] For the multiple groups of the first text character groups obtained above, calculate the similarity between each group of the first text character groups and the head text respectively.
[0065] To improve the accuracy of the calculation results, in this embodiment, two different similarity algorithms are used for calculation. Correspondingly, when calculating the similarity between text character group i and text j, according to the first similarity algorithm, calculate the first similarity value between text character group i and the text j; according to the second similarity algorithm, calculate the second similarity value between text character group i and the text j; determine the similarity between text character group i and text j based on the first similarity value and the second similarity value; where, if text character group i is the first text character group, then text j is the head text; if text character group i is the second text character group, then text j is the tail text.
[0066] Specifically, the first similarity algorithm is used to calculate the first similarity value between each group of first text characters and the header text; the second similarity algorithm is used to calculate the second similarity value between each group of first text characters and the header text; based on the first and second similarity values between each group of first text characters and the header text, the similarity between each group of first text characters and the header text is obtained. This complementary use of the two similarity algorithms accurately reflects the similarity situation.
[0067] Optionally, the first similarity algorithm is based on character order, and the second similarity algorithm is based on character semantics. For example, the first similarity algorithm is the edit distance algorithm, also called the shortest edit distance algorithm. This algorithm focuses more on the order of words and is highly sensitive to words and word order, but lacks overall semantic features. The second similarity algorithm is based on BERT word vectors. For example, the text is first converted into BERT word vectors through a BERT model, and then the similarity between BERT word vectors is used to determine the similarity between texts. This algorithm focuses on calculating overall semantic features, but is not sensitive to word order. Therefore, in this embodiment, in order to take into account both character order and character semantics, the two similarity algorithms are used in combination to improve accuracy. In addition, in order to make the final calculation result comprehensively reflect both character order features and character semantic features, in this embodiment, corresponding weights are set for the two similarity algorithms so that the final similarity result is obtained according to the weighted calculation method. Accordingly, the first weight corresponding to the first similarity algorithm and the second weight corresponding to the second similarity algorithm are obtained; based on the first weight and the second weight, the first similarity value between each group of first text characters and the header text and the second similarity value between each group of first text characters and the header text are weighted and calculated to obtain the similarity between each group of first text characters and the header text.
[0068] The ratio of the first weight to the second weight can be determined based on the sensitivity to character order and semantics in the actual application scenario. For example, if the sensitivity to character order and semantics is the same in the actual application scenario, then both the first weight and the second weight are set to 50%; if the actual application scenario is more sensitive to character order, then the first weight is set to be greater than the second weight; conversely, if the actual application scenario is more sensitive to character semantics, then the first weight is set to be less than the second weight.
[0069] Step S204: Determine the matching starting position corresponding to the header text in the base text based on the first sliding position corresponding to the first group of first text characters with the highest similarity to the header text.
[0070] Specifically, based on the first sliding position corresponding to the first group of first text characters with the highest similarity to the header text, the position of the first character corresponding to the first character contained in the first group of first text characters with the highest similarity is determined, and the position of the first character is determined as the matching starting position corresponding to the header text.
[0071] Specifically, from multiple similarity scores between the first text character groups and the header text, the first text character group with the highest similarity score is determined, and the position of the first character in the first text character group with the highest similarity score is used as the starting position for matching. For example, in the example above, assuming the first text character group with the highest similarity score is "According to the relevant regulations of the China Banking and Insurance Regulatory Commission, in order to protect", the starting position for matching corresponds to the position of the root character in "According to".
[0072] Step S205: Extract multiple sets of second text character groups from the base text that match multiple second sliding positions of the second sliding window through a second sliding window that matches the length of the tail text.
[0073] The second sliding window is used to extract a set of second text characters that match the window length and window position. The window length of the second sliding window is equal to the length of the trailing text; therefore, the character length of each set of second text characters is equal to the character length of the trailing text. Furthermore, the window position of the second sliding window is changed multiple times according to a preset second sliding step.
[0074] The multiple second sliding positions of the second sliding window are determined in the following way: based on the matching start position contained in the reference text, the second sliding position corresponding to the second initial position of the second sliding window is determined; starting from the second initial position, the second sliding window slides multiple times along the arrangement path of the characters constituting the reference text with a preset second sliding step size to obtain the multiple second sliding positions of the second sliding window.
[0075] For example, assuming the base text is "Hello, according to the relevant regulations of the China Banking and Insurance Regulatory Commission, in order to protect your personal rights and interests, we will record the key parts of the process by means of audio and video recording," and the target text to be matched is "According to the relevant regulations of the my country Banking and Insurance Regulatory Commission, in order to protect your legitimate personal rights and interests," and the segmented tail text is "in order to protect your legitimate personal rights and interests," then a second sliding window with a length of 12 characters is set, and the second initial position of the second sliding window is determined according to the matching start position contained in the base text.
[0076] For example, in the example above, the starting position of the match in the base text is the position of the character "root" in the base text. In the initial state, the 12 characters that match the second initial position of the second sliding window are "According to the relevant regulations of the China Banking and Insurance Regulatory Commission, in order to". The first group of second text characters that match the second initial position of the second sliding window are "According to the relevant regulations of the China Banking and Insurance Regulatory Commission, in order to".
[0077] Assuming the second sliding step is also one character, the second sliding window starts from the second initial position and moves once along the path of the characters constituting the base text with the preset second sliding step. The 12 characters matching the second sliding position of the second sliding window are "According to the relevant regulations of the China Banking and Insurance Regulatory Commission, in order to protect". The second group of second text characters matching the second sliding position of the second sliding window is then "According to the relevant regulations of the China Banking and Insurance Regulatory Commission, in order to protect". Similarly, starting from the second initial position, the second sliding window moves twice along the path of the characters constituting the base text with the preset second sliding step. The 12 characters matching the second sliding position of the second sliding window are "According to the relevant regulations of the China Banking and Insurance Regulatory Commission, in order to protect". The third group of second text characters matching the second sliding position of the second sliding window is then "According to the relevant regulations of the China Banking and Insurance Regulatory Commission, in order to protect", and so on, until the second sliding window slides to the end of the base characters.
[0078] Step S206: Calculate the similarity between the second text character group and the tail text in each group.
[0079] Specifically, according to the first similarity algorithm, the first similarity value between each group of second text characters and the end text is calculated; according to the second similarity algorithm, the second similarity value between each group of second text characters and the end text is calculated; based on the first similarity value between each group of second text characters and the end text and the second similarity value between each group of second text characters and the end text, the similarity between each group of second text characters and the end text is obtained.
[0080] Optionally, based on the first weight and the second weight, a weighted calculation is performed on the first similarity value between each group of second text characters and the end text, and the second similarity value between each group of second text characters and the end text, to obtain the similarity between each group of second text characters and the end text.
[0081] The specific selection of the similarity algorithm and the setting of the weights can be found in the descriptions in the corresponding sections above, and will not be repeated here.
[0082] Step S207: Based on the second sliding position corresponding to the second text character group with the highest similarity to the tail text, determine the matching termination position contained in the reference text that corresponds to the tail text.
[0083] Among them, according to the second sliding position corresponding to the group of second text character groups with the highest similarity to the tail text, determine the tail character position corresponding to the tail character included in the group of second text character groups with the highest similarity, and determine the tail character position as the matching termination position corresponding to the tail text.
[0084] Specifically, from the multiple similarities between multiple groups of second text character groups and the tail text, determine the group of second text character groups with the highest similarity, and use the position where the tail character in the group of second text character groups with the highest similarity is located as the matching termination position. For example, in the above example, assume that the group of second text character groups with the highest similarity is "It is stipulated that in order to protect your personal rights and interests", then the matching termination position corresponds to the position of '益' in '权益'.
[0085] Step S208: Extract the matching text characters corresponding to the target text to be matched from the reference text according to the matching start position and the matching termination position.
[0086] Among them, the matching text characters refer to: the text characters between the matching start position and the matching termination position, including the characters corresponding to the matching start position and the matching termination position. By extracting the matching text characters, the irrelevant characters included in the reference text can be removed, improving the accuracy of subsequent matching. For example, in the above example, the matching text characters are "According to the relevant regulations of the CBIRC, in order to protect your personal rights and interests". Thus, it can be seen that since the number of characters included in the reference text is large and there is a lot of irrelevant content mixed in, by extracting the matching text characters, the subsequent matching area can be accurately positioned to improve the accuracy of matching.
[0087] In other words, in the traditional method, only the entire reference text "Hello, according to the relevant regulations of the CBIRC, in order to protect your personal rights and interests, we will record the key links of the process by audio and video" can be matched with the target text "According to the regulations of the relevant regulations of the CBIRC of our country, in order to protect your legitimate personal rights and interests". Due to the large amount of interfering content included in the reference text, the matching result will be inaccurate. By the method in this embodiment, the matching text characters can be accurately positioned as "According to the relevant regulations of the CBIRC, in order to protect your personal rights and interests", thereby improving the accuracy of the matching result.
[0088] Step S209: Determine whether the target text to be matched matches the reference text according to the comparison result between the matching text characters and the target text to be matched.
[0089] The comparison of matching text characters with the target text to be matched can be achieved in various ways. For example, a similarity algorithm can be used to calculate the similarity between the matching text characters and the target text to be matched; if the similarity is greater than a similarity threshold, the two are considered to match. Alternatively, the matching text characters and the target text to be matched can be input into a preset evaluation model, and the model's output can be used to determine whether the two match. In short, the matching method and evaluation criteria can be flexibly set by those skilled in the art according to actual business scenarios, and this application does not limit them.
[0090] In one optional implementation, the target text to be matched consists of multiple translated texts obtained through automatic speech recognition; and the reference text consists of multiple scripted texts obtained based on standard speech patterns. Accordingly, after step S209, the following steps are also included:
[0091] Step S210: Determine the quality inspection score of the translated text based on the matching results between the translated text and the script text.
[0092] Specifically, if the translated text matches the script text closely, the translated text will receive a higher quality control score; conversely, if the match is poor, the translated text will receive a lower quality control score. In short, by matching the translated text with the script text, the translated text can be quality controlled.
[0093] In developing this invention, the inventors discovered that customer service personnel may pause or breathe during their speech, resulting in a large number of translated texts, each with a small character count. In other words, for a single text in a standard script, there may actually be multiple translated texts, each with a small character count. Therefore, the number of translated texts is not equal to the number of texts in the standard script, and typically, the number of translated texts is greater. In this situation, to improve the accuracy of quality control, it is necessary to merge multiple translated texts corresponding to the same script. Accordingly, when dividing the target text to be matched into header and footer text, the current translated text is extracted from multiple translated texts and divided into header and footer texts. Furthermore, when extracting multiple sets of first text character groups matching multiple first sliding positions of the first sliding window from the reference text, the current speech text is extracted from multiple speech texts, and multiple sets of first text character groups matching multiple first sliding positions of the first sliding window are extracted from the current speech text. Correspondingly, when determining the quality inspection score of the translated text based on the matching result between the translated text and the speech text, firstly, the mapping relationship between the current translated text and the current speech text is recorded; then, for the same speech text, multiple translated texts with a mapping relationship with that speech text are merged to obtain the translated mapping text corresponding to that speech text; based on the matching result between the speech text and the translated mapping text, the quality inspection score corresponding to the translated mapping text is determined.
[0094] In summary, this embodiment divides the target text to be matched into two parts: a header text and a footer text. Correspondingly, on the one hand, for the header text, a sliding window matching is performed in the reference text to determine the matching start position corresponding to the header text within the reference text based on the matching result; on the other hand, for the footer text, a sliding window matching is performed in the reference text to determine the matching end position corresponding to the footer text within the reference text based on the matching result. Then, based on the matching start and end positions, matching text characters corresponding to the target text are extracted from the reference text for comparison with the target text. Thus, this method, by dividing the target text to be matched into header and footer texts and performing matching on each part separately, accurately locates the matching start and end positions in the reference text, achieving the purpose of eliminating interfering text and accurate matching, thereby improving the accuracy of text matching. Furthermore, by setting two different similarity algorithms, both character order and semantic features can be considered, improving matching accuracy. Moreover, by performing merging processing on multiple translated texts, the reliability of speech quality inspection can be improved.
[0095] To facilitate understanding, the following specific example will be used to describe in detail the implementation details of this embodiment:
[0096] With the development of intelligent technology, artificial intelligence has begun to be applied to various fields and aspects. One application is in script quality inspection, used to determine whether customer service personnel's scripts meet standards. Another application is in evaluating customer service personnel based on the results of script quality inspection. The script inspection process involves matching standard scripts with ASR (Audio-Speech-to-Text) translated scripts for scoring, and giving a final score based on the semantic differences between the two.
[0097] In one related technology, string-based detection (ES retrieval, N-gram retrieval) is used. Specifically, the repetition of characters is detected by comparing the string sequence of the standard speech with the string sequence translated by ASR, and the evaluation is based on the repetition detection results. However, this method has at least the following drawbacks: (1) It does not contain semantic information. It detects the repetition of characters by simply comparing the repetition of characters. It is not sensitive to the order of the characters. If the characters are exactly the same, but the order of the phrases and words is disordered, the difference cannot be detected. (2) When the speech is translated into ASR, there may be sentence splitting. If there is a pause when the customer service representative is speaking, ASR will recognize one sentence as two sentences. Therefore, when the split speech is matched with the original standard long sentence, the number of characters will inevitably be too large.
[0098] Another related technology utilizes a semantic matching method based on semantic models. Specifically, the semantic model encodes sentences into semantic vectors and then compares the semantics of two sentences, evaluating the quality of the customer service script's presentation by detecting the semantic differences between them. However, this method has at least the following drawbacks: Matching solely based on semantics can miss some detailed descriptive information. If the customer service representative uses inappropriate words, omits words or phrases, but still describes the sentence semantically, these errors cannot be detected by the encoded sentence semantics alone. Furthermore, when ASR scripts are split, this method will also fail to match due to the semantic inconsistency between the standard long sentences and the split short sentences.
[0099] In summary, neither of the two technologies mentioned above can simultaneously address both word order and semantic features; and they also cannot accurately identify situations where sentences are split due to pauses in the customer service representative's speech.
[0100] To address the aforementioned issues, this example divides the target text into a header and a footer, and performs matching on each part separately. This allows for precise location of the start and end points of the matching within the base text, eliminating interfering text and achieving accurate matching, thereby improving the accuracy of text matching. Figure 3 As shown, the text matching method in this example specifically includes the following steps:
[0101] Step S301: Obtain the first translated text contained in the translated text set, and divide the first translated text into two parts: the header text and the footer text.
[0102] First, extract a length of cut_dis from the beginning of the ASR sentence (i.e., the first translated text) as the "ASR header identifier," and extract a length of cut_dis from the end of the sentence as the "ASR tail identifier." The "ASR header identifier" is the header text, and the "ASR tail identifier" is the tail text.
[0103] The length of `cut_dis` is determined by the actual length of the ASR (Automatic Sentence Recognition) sentence. If the actual length of the ASR sentence is greater than 20, then `cut_dis` is 15; if the actual length of the ASR sentence is less than 20 but greater than 10, then `cut_dis` is 10. Furthermore, when the length of the ASR sentence is less than 10, `cut_dis` is the length of the ASR sentence. Therefore, the criteria for determining the value of `cut_dis` are: the truncated content should be representative of the current sentence, avoiding repetition or high similarity with other sentences or paragraphs; and it should be as short as possible while maintaining representativeness, because longer truncated content will take longer to match later, affecting timeliness.
[0104] Step S302: Determine whether there exists a first text character group in the first spoken text that has a similarity to the first translated text that meets the preset similarity condition by using a sliding matching method.
[0105] Specifically, a sliding match is performed between the header text of the first translated text and the first text in the standard script set. During the sliding match, it is determined whether there is a first text character group in the first text that has a similarity to the first translated text that meets the preset similarity condition.
[0106] The first text character group is a set of characters captured through the first sliding window mentioned above; the specific sliding method will not be elaborated here. The sliding window method mentioned above is essentially a jump comparison method. Figure 4 A schematic diagram illustrating the contrast in bouncing is shown. (For example...) Figure 4 As shown, it is necessary to perform a jump comparison between the ASR script (i.e., the translated text) and the standard script (i.e., the script text). In the 0th jump comparison, firstly, align the first character of the ASR script with the first character of the standard script and compare them; in the 1st jump comparison, shift the first character of the ASR script one position to the right, aligning it with the second character of the standard script, and compare them; in the 2nd jump comparison, shift the first character of the ASR script two positions to the right, aligning it with the third character of the standard script, and compare them; in the Nth jump comparison, shift the first character of the ASR script N positions to the right, aligning it with the last character of the ASR script, and compare them.
[0107] In each comparison process, a portion of the characters compared with the ASR script is taken as the first text character group. The similarity between the first text character group and the ASR script is calculated in each jump comparison process to determine whether there exists a first text character group in the first script text whose similarity with the first translated text meets a preset similarity condition. The preset similarity condition can be: the similarity between the first text character group and the first translated text is greater than a threshold.
[0108] Step S303: If yes, determine the starting position of the match in the first speech text based on the first text character group whose similarity with the first translated text is greater than the preset similarity threshold.
[0109] Step S304: If not, perform a sliding match between the header text in the first translated text and the second script text in the standard script set. If the header text in the first translated text does not match any script text in the standard script set, return a matching failure message.
[0110] Step S305: Determine whether there exists a second text character group in the first speech text that has a similarity to the first translated text that meets the preset similarity condition by using a sliding matching method.
[0111] Specifically, the tail text in the first translated text is matched with the first text in the standard script set. During the matching process, it is determined whether there is a second text character group in the first text that has a similarity greater than a preset similarity threshold with the first translated text (the specific method for determining the second text character group can be found in the relevant section above).
[0112] Step S306: If yes, determine the matching termination position in the first speech text based on the second text character group whose similarity with the first translated text is greater than a preset similarity threshold.
[0113] Step S307: If not, perform a sliding match between the tail text in the first translated text and the second script text in the standard script set. If the tail text in the first translated text does not match any script text in the standard script set, return a matching failure message.
[0114] Step S308: Record the mapping relationship between the current translated text and the current spoken text.
[0115] Each translated text has a unique translated text ID, and each script text also has a unique script text ID. Accordingly, the mapping relationship between the current translated text and the current script text is recorded through the translated text ID and the script text ID.
[0116] Step S309: For the same script text, perform a merging process on multiple translated texts that have a mapping relationship with the script text to obtain the translated mapped text corresponding to the script text.
[0117] Step S310: Based on the matching results between the script text and the translated mapping text, determine the quality inspection score corresponding to the translated mapping text.
[0118] In this process, ASR scripts may be transmitted in multiple segments after the original sentence is divided into multiple segments. Therefore, multiple ASR scripts may match the same standard script. Thus, the data with detection values greater than the threshold obtained in the previous step and the segments of multiple ASR scripts that correspond to the same standard script need to be merged according to the field order. The evaluation score is the average of the sum of each segment.
[0119] For ease of understanding, the specific forms of the ASR script and the standard script in this example are given below:
[0120] ASR script is as follows:
[0121]
[0122]
[0123] The standard script is as follows:
[0124]
[0125]
[0126]
[0127] As can be seen from the above example, the short phrases in the ASR script corresponding to the same standard script are merged, resulting in a translated mapping text corresponding to each standard script. Thus, a corresponding quality inspection score 'score' is given for each translated mapping text, and based on the comparison between the quality inspection score and the preset score threshold, the recognition result 'result' corresponding to each translated mapping text is given, where True corresponds to the customer service representative's correct statement; False corresponds to the customer service representative's incorrect statement.
[0128] Additionally, in this example, further detection can be performed on customer responses contained in the translated text. Since customer responses are not within the scope of standard script detection and strongly correspond to customer attitudes and responses, but are mixed in with customer service scripts in the ASR (Automatic Responsive Speech) of the audio recording, separate detection of customer responses is necessary. Customer response detection is mainly performed using preset response words (such as response keywords), such as: 'okay', 'don't know', 'not clear', 'not sure', 'disagree', 'no', 'can', 'wrong', 'no', 'I know', 'yes', 'I understand', 'I disagree', 'I object', 'object', 'okay', 'okay', 'um', 'agree', 'yes', 'understand', 'know', 'clear', 'understand', 'okay', 'confirm', 'um, okay', 'correct', 'didn't hear clearly', 'um, okay', etc. For example, the system checks if the last five characters of the current sentence or the first five characters of the next sentence contain preset response keywords, which are then used as the customer's reaction to the current sentence. Correspondingly, the system incorporates the customer's response to assist in quality control scoring.
[0129] In summary, this example has at least the following advantages:
[0130] (1) By using the two similarity calculation methods mentioned above, namely the shortest edit distance and BERT word vector, we can pay attention to both the overall semantic information and the detailed information of the wording.
[0131] (2) First, the head and tail detection and positioning method is adopted because a sentence in the ASR script may be a subset of a sentence in the standard script. After positioning, the subset of the standard script is matched with the ASR script to prevent the ASR script subset from matching the whole standard script, which would cause the matching result to be inaccurate. The matching method in this example is more targeted when the ASR translation is inaccurate.
[0132] (3) Sentence merging is performed based on the matching results of ASR scripts, which eliminates the problem of splitting a single sentence of standard script into multiple sentences during ASR translation. This allows the results to evaluate multiple ASR statements originating from the same standard script as a whole, thus improving the accuracy of the final quality inspection results.
[0133] It is understood that the various method embodiments mentioned above in this disclosure can be combined with each other to form combined embodiments without violating the principle and logic. Due to space limitations, this disclosure will not elaborate further. Those skilled in the art will understand that in the above methods of specific implementation, the specific execution order of each step should be determined by its function and possible internal logic.
[0134] In addition, this disclosure also provides a text matching device, an electronic device, and a computer-readable storage medium, all of which can be used to implement any of the text matching methods provided in this disclosure. The corresponding technical solutions and descriptions are described in the relevant section on methods and will not be repeated here.
[0135] Figure 5 A block diagram of a text matching device provided in this disclosure.
[0136] Reference Figure 5 This disclosure provides a text matching device 50, which includes:
[0137] The segmentation module 51 is suitable for segmenting the target text to be matched into header text and footer text;
[0138] The starting position determination module 52 is adapted to determine the matching starting position corresponding to the header text contained in the reference text through a first sliding window that matches the length of the header text;
[0139] The termination position determination module 53 is adapted to determine the matching termination position corresponding to the tail text contained in the reference text through a second sliding window that matches the length of the tail text;
[0140] Extraction module 54 is adapted to extract matching text characters corresponding to the target text to be matched from the reference text according to the matching start position and the matching end position;
[0141] The matching module 55 is adapted to compare the text characters with the target text to be matched, and to determine whether the target text to be matched matches the reference text.
[0142] Optionally, the starting position determination module 52 is specifically adapted to:
[0143] Using a first sliding window that matches the length of the header text, multiple sets of first text character groups that match multiple first sliding positions of the first sliding window are extracted from the reference text. The similarity between each set of first text character groups and the header text is calculated. Based on the first sliding position corresponding to a set of first text character groups that satisfies the first similarity condition, the matching start position corresponding to the header text contained in the reference text is determined.
[0144] The termination position determination module 53 is specifically adapted to:
[0145] Using a second sliding window that matches the length of the tail text, multiple sets of second text character groups that match multiple second sliding positions of the second sliding window are extracted from the reference text. The similarity between each set of second text character groups and the tail text is calculated. Based on the second sliding position corresponding to a set of second text character groups that satisfies the second similarity condition, the matching termination position corresponding to the tail text contained in the reference text is determined.
[0146] Optionally, the multiple first sliding positions of the first sliding window are determined in the following way:
[0147] Based on the sliding start character contained in the reference text, determine the first sliding position corresponding to the first initial position of the first sliding window; starting from the first initial position, slide the first sliding window multiple times along the arrangement path of the characters constituting the reference text with a preset first sliding step size to obtain multiple first sliding positions of the first sliding window.
[0148] The multiple second sliding positions of the second sliding window are determined in the following manner:
[0149] Based on the matching start position contained in the reference text, determine the second sliding position corresponding to the second initial position of the second sliding window; starting from the second initial position, slide the second sliding window multiple times along the arrangement path of the characters constituting the reference text with a preset second sliding step size to obtain multiple second sliding positions of the second sliding window.
[0150] Optionally, the partitioning module is specifically adapted to:
[0151] Obtain the total length of the target text to be matched;
[0152] Based on the total length of the text, the target text to be matched is divided into header text and footer text, such that the sum of the lengths of the header text and the footer text is greater than the total length of the text.
[0153] Optionally, the first set of text characters that satisfies the first similarity condition includes: the first set of text characters with the highest similarity to the header text, and / or, the first set of text characters with a similarity to the header text greater than the first similarity threshold; and the matching starting position is determined based on the position of the first character corresponding to the first character contained in the first set of text characters that satisfies the first similarity condition.
[0154] The set of second text characters that satisfies the second similarity condition includes: the set of second text characters with the highest similarity to the tail text, and / or the set of second text characters with a similarity to the tail text greater than the second similarity threshold; and the matching termination position is determined based on the position of the tail character contained in the set of second text characters that satisfies the second similarity condition.
[0155] Optionally, the starting position determination module is specifically adapted to:
[0156] According to the first similarity algorithm, calculate the first similarity value between each group of first text characters and the header text;
[0157] According to the second similarity algorithm, the second similarity value between each group of first text characters and the header text is calculated;
[0158] The similarity between each group of first text characters and the header text is obtained based on a first similarity value and a second similarity value.
[0159] The termination position determination module is specifically adapted to:
[0160] According to the first similarity algorithm, calculate the first similarity value between each group of second text characters and the tail text;
[0161] According to the second similarity algorithm, the second similarity value between each group of second text characters and the tail text is calculated;
[0162] The similarity between each group of second text characters and the tail text is obtained based on the first similarity value between each group of second text characters and the tail text and the second similarity value between each group of second text characters and the tail text.
[0163] Optionally, the first similarity algorithm is a character order-based algorithm, and the second similarity algorithm is a character semantic-based algorithm;
[0164] Furthermore, the starting position determination module is specifically adapted to:
[0165] Obtain the first weight corresponding to the first similarity algorithm and the second weight corresponding to the second similarity algorithm;
[0166] Based on the first weight and the second weight, a weighted calculation is performed on the first similarity value between each group of first text characters and the header text, and the second similarity value between each group of first text characters and the header text, to obtain the similarity between each group of first text characters and the header text.
[0167] The termination position determination module is specifically adapted to:
[0168] Based on the first weight and the second weight, a weighted calculation is performed on the first similarity value between each group of second text characters and the tail text, and the second similarity value between each group of second text characters and the tail text, to obtain the similarity between each group of second text characters and the tail text.
[0169] Optionally, the target text to be matched is a plurality of translated texts obtained by automatic speech recognition; and the reference text is a plurality of scripted texts obtained based on standard speech scripts.
[0170] Furthermore, the matching module is also adapted to:
[0171] Based on the matching results between the translated text and the script text, the quality inspection score of the translated text is determined.
[0172] Optionally, the matching module is specifically adapted to:
[0173] Record the mapping relationship between the currently translated text and the currently spoken text;
[0174] For the same script text, multiple translated texts that have a mapping relationship with the script text are merged to obtain a translated mapped text corresponding to the script text;
[0175] Based on the matching result between the script text and the translated mapping text, the quality inspection score result corresponding to the translated mapping text is determined.
[0176] Figure 6 A block diagram of an electronic device is provided in this disclosure.
[0177] Reference Figure 6 This disclosure provides an electronic device comprising: at least one processor 501; at least one memory 502; and one or more I / O interfaces 503 connected between the processor 501 and the memory 502; wherein the memory 502 stores one or more computer programs executable by the at least one processor 501, and the one or more computer programs are executed by the at least one processor 501 using the text matching method described above.
[0178] This disclosure also provides a computer-readable storage medium storing a computer program thereon, wherein the computer program, when executed by a processor / processor core, implements the data migration method described above. The computer-readable storage medium may be volatile or non-volatile.
[0179] This disclosure also provides a computer program product, including computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code, wherein when the computer-readable code is run in a processor of an electronic device, the processor in the electronic device performs the above-described data migration method.
[0180] Those skilled in the art will understand that all or some of the steps, systems, and apparatuses disclosed above, and their functional modules / units, can be implemented as software, firmware, hardware, or suitable combinations thereof. In hardware implementations, the division between functional modules / units mentioned above does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed collaboratively by several physical components. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit (ASIC). Such software can be distributed on a computer-readable storage medium, which may include computer storage media (or non-transitory media) and communication media (or transient media).
[0181] As is known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable program instructions, data structures, program modules, or other data). Computer storage media includes, but is not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), static random access memory (SRAM), flash memory or other memory technologies, portable compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, it is known to those skilled in the art that communication media typically contain computer-readable program instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.
[0182] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.
[0183] Computer program instructions used to perform the operations of this disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, status setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as the "C" language or similar programming languages. The computer-readable program instructions may execute entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing the status information of the computer-readable program instructions to implement various aspects of this disclosure.
[0184] The computer program product described herein can be implemented specifically through hardware, software, or a combination thereof. In one alternative embodiment, the computer program product is specifically embodied in a computer storage medium; in another alternative embodiment, the computer program product is specifically embodied in a software product, such as a software development kit (SDK), etc.
[0185] Various aspects of this disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.
[0186] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.
[0187] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.
[0188] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0189] Example embodiments have been disclosed herein, and while specific terminology has been used, it is for illustrative purposes only and should be construed as such, and is not intended to be limiting. In some instances, it will be apparent to those skilled in the art that features, characteristics, and / or elements described in connection with particular embodiments may be used alone, or in combination with features, characteristics, and / or elements described in connection with other embodiments, unless otherwise expressly indicated. Therefore, those skilled in the art will understand that various changes in form and detail may be made without departing from the scope of this disclosure as set forth by the appended claims.
Claims
1. A text matching method, characterized in that, include: The target text to be matched is divided into header text and footer text; The starting position of the matching text corresponding to the header text is determined by using a first sliding window that matches the length of the header text; The matching termination position corresponding to the tail text is determined by using a second sliding window that matches the length of the tail text; Based on the matching start position and the matching end position, extract the matching text characters corresponding to the target text to be matched from the reference text; Based on the comparison result between the matched text characters and the target text to be matched, it is determined whether the target text to be matched matches the reference text.
2. The method according to claim 1, characterized in that, The step of determining the matching starting position corresponding to the header text within the reference text through a first sliding window that matches the length of the header text includes: Using a first sliding window that matches the length of the header text, multiple sets of first text character groups that match multiple first sliding positions of the first sliding window are extracted from the reference text. The similarity between each set of first text character groups and the header text is calculated. Based on the first sliding position corresponding to a set of first text character groups that satisfies the first similarity condition, the matching start position corresponding to the header text contained in the reference text is determined. The step of determining the matching termination position corresponding to the tail text contained in the reference text through a second sliding window that matches the length of the tail text includes: Using a second sliding window that matches the length of the tail text, multiple sets of second text character groups that match multiple second sliding positions of the second sliding window are extracted from the reference text. The similarity between each set of second text character groups and the tail text is calculated. Based on the second sliding position corresponding to a set of second text character groups that satisfies the second similarity condition, the matching termination position corresponding to the tail text contained in the reference text is determined.
3. The method according to claim 2, characterized in that, The multiple first sliding positions of the first sliding window are determined in the following way: Based on the sliding start character contained in the reference text, determine the first sliding position corresponding to the first initial position of the first sliding window; starting from the first initial position, slide the first sliding window multiple times along the arrangement path of the characters constituting the reference text with a preset first sliding step size to obtain multiple first sliding positions of the first sliding window. The multiple second sliding positions of the second sliding window are determined in the following manner: Based on the matching start position contained in the reference text, determine the second sliding position corresponding to the second initial position of the second sliding window; starting from the second initial position, slide the second sliding window multiple times along the arrangement path of the characters constituting the reference text with a preset second sliding step size to obtain multiple second sliding positions of the second sliding window.
4. The method according to claim 2, characterized in that, The similarity between text character group i and text j is calculated in the following way: According to the first similarity algorithm, calculate the first similarity value between text character group i and the text j; According to the second similarity algorithm, the second similarity value between text character group i and the text j is calculated; Based on the first similarity value and the second similarity value, the similarity between the text character group i and the text j is determined; Wherein, if the text character group i is the first text character group, then the text j is the header text; if the text character group i is the second text character group, then the text j is the footer text.
5. The method according to claim 4, characterized in that, The first similarity algorithm is based on character order, and the second similarity algorithm is based on character semantics. Furthermore, determining the similarity between the text character group i and the text j based on the first similarity value and the second similarity value includes: Obtain the first weight corresponding to the first similarity algorithm and the second weight corresponding to the second similarity algorithm; Based on the first weight and the second weight, the first similarity value and the second similarity value are weighted and calculated to obtain the similarity between the text character group i and the text j.
6. The method according to claim 1, characterized in that, The target text to be matched consists of multiple translated texts obtained through automatic speech recognition; and the reference text consists of multiple scripted texts obtained based on standard speech patterns. Furthermore, after determining whether the target text matches the baseline text based on the comparison result between the matching text characters and the target text to be matched, the method further includes: Based on the matching results between the translated text and the script text, the quality inspection score of the translated text is determined.
7. The method according to claim 6, characterized in that, The step of dividing the target text to be matched into header text and tail text includes: extracting the current translated text from multiple translated texts, and dividing the current translated text into header text and tail text; and extracting multiple sets of first text character groups that match multiple first sliding positions of the first sliding window from the reference text includes: extracting the current speech text from multiple speech texts, and extracting multiple sets of first text character groups that match multiple first sliding positions of the first sliding window from the current speech text. Furthermore, determining the quality inspection score of the translated text based on the matching result between the translated text and the script text includes: Record the mapping relationship between the currently translated text and the currently spoken text; For the same script text, multiple translated texts that have a mapping relationship with the script text are merged to obtain a translated mapped text corresponding to the script text; Based on the matching result between the script text and the translated mapping text, the quality inspection score result corresponding to the translated mapping text is determined.
8. A text matching device, characterized in that, include: The segmentation module is suitable for dividing the target text to be matched into header text and footer text; The starting position determination module is adapted to determine the matching starting position corresponding to the header text contained in the reference text through a first sliding window that matches the length of the header text; The termination position determination module is adapted to determine the matching termination position corresponding to the tail text contained in the reference text through a second sliding window that matches the length of the tail text; The extraction module is adapted to extract matching text characters corresponding to the target text to be matched from the reference text based on the matching start position and the matching end position; The matching module is adapted to match the comparison results between text characters and the target text to be matched, and to determine whether the target text to be matched matches the reference text.
9. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores one or more computer programs that can be executed by the at least one processor, the one or more computer programs being executed by the at least one processor to enable the at least one processor to perform the method as described in any one of claims 1-7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, The computer program, when executed by a processor, implements the method as described in any one of claims 1-7.