Text matching score calculation method and system, and text matching method

CN117669535BActive Publication Date: 2026-11-03CTRIP COMP TECH SHANGHAI
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202311787054.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-12-22
Publication Date
2026-11-03
Estimated Expiration
2043-12-22

AI Technical Summary

Technical Problem

Existing text matching score calculation methods cannot effectively escape the influence of word length and word order, resulting in unstable calculation results, especially in the calculation of similarity between phrases.

Method used

The algorithm combines the longest common substring algorithm and the Sorenson-dice coefficient algorithm to perform matching based on the number of words in the input text and the matching text, calculates the basic text score, and obtains the text matching score through post-processing correction, including inclusion correction and prefix correction, to ensure the stability and accuracy of the calculation process.

Benefits of technology

It improves the stability and accuracy of text matching score calculation, making it suitable for various text matching scenarios such as machine translation and information retrieval, shortening user waiting time, and improving the system's adaptability and versatility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117669535B_ABST
    Figure CN117669535B_ABST
Patent Text Reader

Abstract

The application discloses a kind of text matching division calculation method, system, text matching method, the calculation method is used to calculate the text matching between input text and the text matching of the input text corresponding, the calculation method includes the following steps: obtaining input text and the text matching corresponding to the input text;According to the input text and the text matching, calculate text matching rate;According to the word quantity of the input text and the word quantity of the text matching, the corresponding calculation mode is matched to calculate basic text score;The text matching rate and the basic text score are post-processed, and text matching score is obtained.The word quantity of input text and text matching is matched, so that the calculation process is more stable, avoids the unstable factor caused by different word quantity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of text processing, and specifically to a method, system, and text matching method for calculating text matching scores. Background Technology

[0002] Edit distance is an existing text relevance algorithm that measures the similarity between two strings. It represents the minimum number of editing operations required to transform one string into another, where each editing operation can be inserting, deleting, or replacing a character.

[0003] This algorithm has certain advantages in calculating the text similarity between words, but the calculation results are greatly affected by the word length, resulting in a large deviation. For example, Me and Mac (edit distance 2) are compared with Me and Melbourne (edit distance 7). However, in the context of association, Melbourne is obviously more likely to be the search target than Mac.

[0004] Secondly, it is not well applied to calculating text similarity between phrases, and the results are significantly affected by the number of words. For example, compared with Shanghai Hongqiao and Hongqiao District (edit distance 8) to Shanghai Hongqiao and Shanghai Hongqiao International Airport (edit distance 21), Shanghai Hongqiao International Airport is at a disadvantage. However, from the perspective of the associative context, the result of Shanghai Hongqiao International Airport is more consistent with the input intent.

[0005] At the same time, different word orders can also have a significant impact on the results when calculating between phrases. For example, AustraliaMelbourne and Melbourne Australia (edit distance 12) have an advantage compared to AustraliaMelbourne and USA Melbourne (edit distance 5), but in reality, AustraliaMelbourne should have a higher match. Summary of the Invention

[0006] The technical problem to be solved by the present invention is to overcome the shortcomings of the prior art in which the text matching score calculation cannot get rid of the influence of word length, and to provide a text matching score calculation method, system and text matching method.

[0007] The present invention solves the above-mentioned technical problems through the following technical solution:

[0008] This invention provides a method for calculating a text matching score. The method is used to calculate the text matching score between an input text and a matching text corresponding to the input text. The calculation method includes the following steps:

[0009] Obtain the input text and the matching text corresponding to the input text;

[0010] Calculate the text matching rate based on the input text and the matching text.

[0011] The basic text score is calculated by matching the number of words in the input text and the number of words in the matched text to the corresponding calculation pattern.

[0012] The text matching rate and the basic text score are post-processed to obtain the text matching score.

[0013] In this scheme, the number of words in the input text and the matching text are matched, making the calculation process more stable and avoiding instability caused by differences in the number of words. This method can be applied to various text matching scenarios, such as machine translation, text summarization, and information retrieval, and has high versatility.

[0014] Preferably, the step of calculating the basic text score based on the word count of the input text and the word count of the matched text to match the corresponding calculation pattern includes:

[0015] When both the input text and the matching text are a single word, the basic text score is calculated using the longest common substring algorithm combined with the Sorenson-dice coefficient algorithm.

[0016] In this scheme, when both the input and matching texts consist of a single word, the basic text score is calculated by combining the longest common substring algorithm and the Sorenson-dice coefficient algorithm, resulting in a shorter time. This helps improve information processing speed and shorten user waiting time. By determining the corresponding pattern, the deviation in basic text score calculation caused by different numbers of words can be reduced. This gives the system better stability when processing texts of different lengths, improving its adaptability.

[0017] Preferably, the step of calculating the basic text score based on the word count of the input text and the word count of the matched text to match the corresponding calculation pattern includes:

[0018] When the input text consists of multiple words and the matching text consists of a single word, the longest common substring algorithm combined with the Sorenson-dice coefficient algorithm is used to calculate several initial text scores for each word in the input text and the matching text.

[0019] The basic text score is obtained by using the maximum value in the initial text score as the numerator and the number of words in the input text as the denominator.

[0020] In this scheme, by calculating an initial text score for each word and taking the maximum value as the base text score, the overall similarity assessment result can be avoided due to the low similarity of individual words. This method ensures the fairness of the base text score, making the assessment result more reflective of the similarity between the input text and the matched text. By calculating the initial text score for each word and using the maximum value as the base text score, the bias in the base text score calculation caused by different numbers of words can be reduced. This makes the system more stable when processing texts of different lengths, improving the system's adaptability. Combining the longest common substring algorithm and the Sorenson-dice coefficient algorithm, the initial text score of each word can be calculated in a shorter time. This helps to improve information processing speed and shorten user waiting time.

[0021] Preferably, the step of calculating the basic text score based on the word count of the input text and the word count of the matched text to match the corresponding calculation pattern includes:

[0022] When the input text is a single word and the matching text consists of multiple words, the longest common substring algorithm combined with the Sorenson-dice coefficient algorithm is used to calculate several initial text scores for each word in the input text and each word in the matching text.

[0023] The basic text score is obtained by using the maximum value in the initial text score as the numerator and the number of words in the matched text as the denominator.

[0024] In this scheme, when the input text consists of a single word and the matching text consists of multiple words, the initial text score for each word is calculated using the longest common substring algorithm and the Sorenson-dice coefficient algorithm, achieving a refined evaluation of the text. This helps to better capture the correlation between the input text and the matching text.

[0025] Preferably, the step of calculating the basic text score based on the word count of the input text and the word count of the matched text to match the corresponding calculation pattern includes:

[0026] When both the input text and the matching text consist of multiple words, the initial text score of each word in the input text and each word in the matching text is calculated based on the longest common substring algorithm combined with the Sorenson-dice coefficient algorithm.

[0027] The highest score among the initial text scores is obtained using the maximum non-repeating sampling algorithm and used as the base text score.

[0028] In this scheme, when both the input and matching texts consist of multiple words, the initial text score for each word is calculated using the longest common substring algorithm and the Sorenson-dice coefficient algorithm, achieving a comprehensive evaluation of the text. This helps to better capture the correlation between the input and matching texts. Combining the longest common substring algorithm and the Sorenson-dice coefficient algorithm allows for the calculation of the initial text score for each word in a relatively short time. Simultaneously, the maximum unique sampling algorithm helps to quickly find the highest score among the initial text scores, improving information processing speed and reducing user waiting time.

[0029] Preferably, the step of post-processing the text matching rate and the basic text score to obtain the text matching score includes:

[0030] The text inclusion score is obtained by performing inclusion correction on the text matching rate and the basic text score;

[0031] The text inclusion score is prefixed to obtain the text matching score.

[0032] In this scheme, by applying inclusion correction to the text matching rate and basic text score, the degree of text matching can be better reflected, thus improving the accuracy of matching. Prefix correction is used to avoid errors in matching short texts. This correction can improve the accuracy of matching long texts, thereby making the calculation of the text matching score more reasonable.

[0033] Preferably, the step of performing inclusion correction on the text matching rate and the basic text score to obtain the text inclusion score includes:

[0034] The inclusion correction is performed based on the text matching rate, the basic text score, and the preset inclusion weight to obtain the text inclusion score.

[0035] Preferably, the step of prefix correction of the text inclusion score to obtain the text matching score includes:

[0036] The prefix correction is performed based on the text inclusion score and the preset prefix matching weight to obtain the text matching score.

[0037] Another aspect of the present invention provides a text matching score calculation system, the calculation system being used to calculate a text matching score between an input text and a matching text corresponding to the input text, the calculation system comprising:

[0038] The text acquisition module is used to acquire input text and matching text corresponding to the input text.

[0039] A matching rate calculation module is used to calculate the text matching rate based on the input text and the matching text.

[0040] The basic text score calculation module is used to calculate the basic text score by matching the corresponding calculation pattern based on the number of words in the input text and the number of words in the matched text.

[0041] The text matching score calculation module is used to post-process the text matching rate and the basic text score to obtain the text matching score.

[0042] Another aspect of the present invention provides a text matching method, which employs the calculation method described above, and the text matching method includes:

[0043] Obtain the input text and the matching text corresponding to the input text.

[0044] Calculate the text matching score between the matched text and the input text according to the calculation method described above;

[0045] The words in the matched text are sorted according to the text matching score to complete the text matching.

[0046] The significant advantages of this invention are: it matches the number of words in the input and matching texts, making the calculation process more stable and avoiding instability caused by differences in the number of words. This method can be applied to various text matching scenarios, such as machine translation, text summarization, and information retrieval, demonstrating high versatility. Attached Figure Description

[0047] Figure 1 This is a flowchart of the steps in the text matching score calculation method of Embodiment 1 of the present invention.

[0048] Figure 2 This is a simplified flowchart of one possible embodiment of the present invention.

[0049] Figure 3 This is a flowchart of the text matching method according to Embodiment 1 of the present invention.

[0050] Figure 4 This is a structural block diagram of the text matching score calculation system of Embodiment 2 of the present invention. Detailed Implementation

[0051] The present invention will be further illustrated by way of embodiments below, but the present invention is not limited to the scope of the embodiments described herein.

[0052] Example 1

[0053] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application. It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein.

[0054] The text matching score is a quantitative metric used to assess the similarity between two texts. It measures the degree of match between input text and reference text, question text, answer text, or other relevant text.

[0055] This embodiment provides a method for calculating text matching scores, which is applicable to the calculation of text matching scores between words in an associative context and is applicable to multiple languages.

[0056] Based on the requirements of the associative scenario, the text matching results should meet the following basic principles:

[0057]

[0058] To ensure the input content matches as expected, the final text matching score consists of two parts and four steps: a basic text matching score and an inclusion score. For detailed steps, please refer to [link to details]. Figure 1 This includes the following steps:

[0059] S10. Obtain the input text and the matching text corresponding to the input text;

[0060] In this embodiment, the number of words in the input text is unlimited, and the language type can be adjusted according to the specific matching text database. After obtaining the input text, this embodiment retrieves the matching text from the matching text database, and its language type can be Chinese, English, etc. In other possible implementations, different language types can be added according to different needs, such as Korean, Japanese, etc.

[0061] S20. Calculate the text matching rate based on the input text and the matched text;

[0062] Text matching rate mainly refers to the proportion of identical words in the input text and the matching text compared to the total number of words in the input text. The determination of identical words can be adjusted according to different languages. Additionally, the text matching rate acceptance threshold can be controlled by parameters. When the value is less than the threshold, the matching is not accepted, and the text matching rate is set to 0. The threshold can be adjusted as needed.

[0063] S30. Calculate the basic text score by matching the corresponding calculation pattern based on the number of words in the input text and the number of words in the matching text;

[0064] Based on the different word counts in the input text and the matching text, this embodiment summarizes four cases: one-to-one, where both the input text and the matching text are a single word; one-to-many, where the input text is a single word and the matching text is multiple words; many-to-one, where the input text is multiple words and the matching text is a single word; and many-to-many, where both the input text and the matching text are multiple words.

[0065] S40. Post-process the text matching rate and basic text score to obtain the text matching score.

[0066] In this embodiment, the number of words in the input text and the matching text are matched, making the calculation process more stable and avoiding instability caused by differences in the number of words. This method can be applied to various text matching scenarios, such as machine translation, text summarization, and information retrieval, and has high versatility.

[0067] Specifically, step S30 includes:

[0068] S31. Determine the corresponding pattern based on the number of words in the input text and the number of words in the matching text.

[0069] As shown above, this embodiment divides the correspondence pattern between input text and matching text into four cases based on the number of words: one-to-one, one-to-many, many-to-one, and many-to-many. The following explains how to calculate the basic text score for each of these four correspondence patterns.

[0070] S311. When both the input text and the matching text are a single word, calculate the basic text score based on the longest common substring algorithm and the Sorenson-dice coefficient algorithm.

[0071] This step corresponds to the one-to-one scenario. Specifically, when both the input text and the matching text are a single word, the Longest Common Substring (LCS) algorithm is used in conjunction with the Sorenson-Dice algorithm. The Sorenson-Dice coefficient algorithm is used for calculation. Its key feature is its emphasis on the importance of character order, representing the proportion of consistent text in the overall sequence. The longest common substring algorithm is used to find the longest common subsequence between two sequences. It can be used to calculate the similarity between two texts. The Sorenson-Dice coefficient is an indicator used to measure the similarity between two sequences, taking into account both matching length and matching ratio.

[0072] The longest common substring is the length of the longest consecutive common substring between two strings. This problem can be solved using dynamic programming. Given two strings x and y, define a two-dimensional array where dp[i][j] represents the longest common substring between the first i strings of x and the first j strings of y.

[0073]

[0074] If two characters are equal, then dp[i][j] = dp[i-1][j-1] + 1, where 1 represents that the i-th character of x is equal to the j-th character of y. According to the definition of dp[i][j], it is naturally equal to the longest common substring of the first i-1 strings of x and the first j-1 strings of y + 1. Finding the largest value among them is the length of the longest common substring.

[0075] If the i-th character of x is not equal to the j-th character of y, then obviously dp[i][j] = 0, because dp[i][j] is defined as the longest common substring. So as long as there is even one character that is not equal, it means that the definition of the longest common substring is not satisfied, so dp[i][j] is 0.

[0076] Based on the above formula and approach, we can achieve and obtain the maximum d[i][j], which is the length of the longest common substring.

[0077] Sorenson - Dice A coefficient is an algorithm used to measure the similarity between two sets, typically comparing the similarity between two text strings or sequences. The coefficient is calculated as follows:

[0078]

[0079] Here, X and Y represent two strings. In this calculation, |X|∩Y| represents the length of the longest common substring of the two strings, while |X| and |Y| represent the lengths of the two strings, respectively. The Sorenson-Dice coefficient ranges from 0 to 1, with values ​​closer to 1 indicating higher similarity.

[0080] Taking "apple" and "please" as an example, the longest common substring is 3 ("ple"), the length of "apple" is 5, and the length of "please" is 6. Therefore, the Sorenson-dice coefficient is:

[0081]

[0082] This allows us to obtain the basic text score.

[0083] S312. When the input text consists of multiple words and the matching text consists of a single word, calculate the initial text scores for each word in the input text and the matching text based on the longest common substring algorithm and the Sorenson-dice coefficient algorithm.

[0084] The basic text score is obtained by using the maximum value in the initial text score as the numerator and the number of words in the input text as the denominator.

[0085] This step corresponds to the many-to-one scenario. When the input consists of multiple words and the matching content is a single word, the initial text score for each input word and the matching word is calculated separately. The calculation method for the initial text score is the same as for the one-to-one scenario; the maximum value is selected as the numerator, and the number of input words is used as the denominator, thus obtaining the basic text score for the many-to-one scenario. In this step, the method for calculating the initial text scores for each word in the input text and several words in the matching text is the same as in S311, that is, based on the longest common substring length and the Sorenson-dice coefficient algorithm mentioned in S311, the scores for multiple input words and the matching text are calculated separately, resulting in a score array. Assuming there are three input words, A, B, and C, and the matching word is a, then...

[0086] S={S Aa ,S Ba ,S Ca}

[0087] Where S is the score array, S Aa ,S Ba ,S Ca This represents the result of each calculation. At this point, the basic text is divided into...

[0088]

[0089] Where s is the basic text score result in the current many-to-one scenario, and since there are 3 input words, the denominator is 3.

[0090] S313. When the input text is a single word and the matching text consists of multiple words, calculate the basic initial text score of each word in the input text and each word in the matching text based on the longest common substring algorithm and the Sorenson-dice coefficient algorithm.

[0091] In this step, similar to step S312, the scores for the multiple input words and the matching text are calculated based on the longest common substring length and the Sorenson-dice coefficient algorithm mentioned in S311, resulting in a score array. Assuming there are three input words, A, and matching words a, b, and c, then...

[0092] S={S Aa ,S Ab ,S Ac}

[0093] Where S is the score array, S Aa ,S Ba ,S Ca This represents the result of each calculation. At this point, the basic text is divided into...

[0094]

[0095] Where S is the score result in the current one-to-many case, and since there are 3 input words, the denominator is 3.

[0096] This step addresses the one-to-many scenario. When the input consists of a single word and the matching content comprises multiple words, it calculates the initial text score for each part of the input and matching texts separately, using the same calculation method as the one-to-one approach. The maximum value is selected as the numerator, and the number of matching words is used as the denominator, thus obtaining the basic text score for the one-to-many scenario. Its key feature is that it ignores the influence of word order on the text score, ensuring the most reasonable result. Simultaneously, while considering the impact of word count, it avoids excessive score reduction due to word length.

[0097] S314. When both the input text and the matching text contain multiple words, calculate the basic initial text score of each word in the input text and each word in the matching text based on the longest common substring algorithm and the Sorenson-dice coefficient algorithm.

[0098] The highest score among the initial text scores is obtained using the maximum non-repeating sampling algorithm as the base text score.

[0099] This step addresses the many-to-many scenario. When both the input and matching texts consist of multiple words, the initial text score between each word in the input text and each word in the matching text is calculated and stored in a two-dimensional array, using the same calculation method as in a one-to-one scenario. After obtaining the initial text scores between all words, a dynamic programming approach is employed to ensure that each input word and matching word is calculated only once, and that every input word participates in the calculation. This achieves the maximum unique sampling sum algorithm, yielding the maximum base text score for the many-to-many scenario.

[0100] Suppose we have an input phrase with two words, represented by A and B; and a matching phrase with three words, represented by a, b, and c.

[0101] input = {A, B}

[0102] match = {a, b, c}

[0103] First, calculate the scores between all input words and matching words (using the calculation method mentioned in S311), resulting in the following two-dimensional matrix.

[0104] a b c A <![CDATA[S Aa ]]> <![CDATA[S Ab ]]> <![CDATA[S Ac ]]> B <![CDATA[S Ba ]]> <![CDATA[S Bb ]]> <![CDATA[S Bc ]]>

[0105] Since the number of input words and the number of matched words are not the same, it is only necessary to ensure that all words in the fewest word groups are used and that no words in the most frequent word groups are used repeatedly. Since the input contains the fewest word groups, it is only necessary to recursively traverse and execute A and B in the input. Additionally, two parameters are required during the calculation:

[0106] usedWords - Records words that have been used.

[0107] currentScore - Records the current score

[0108] Current input word Current match words usedWords currentScore A a none <![CDATA[S Aa ]]> B b a <![CDATA[S Aa +S Bb ]]> B c a,b <![CDATA[S Aa +S Bc ]]> A b none <![CDATA[S Ab ]]> B a b <![CDATA[S Ab +S Ba ]]> B c b,a <![CDATA[S Ab +S Bc ]]> A c none <![CDATA[S Ac ]]> B a c <![CDATA[S Ac +S Ba ]]> B b c,a <![CDATA[S Ac +S Bb ]]>

[0109] The maximum value in currentScore is the desired result.

[0110] In this embodiment, steps S311-S314 can be used to calculate the basic text score for different situations, effectively avoiding the influence of word count and word order on the text matching score calculation.

[0111] like Figure 2 The diagram shown is a simplified flowchart of one possible implementation of the present invention, namely: calculating the text matching rate → calculating the basic text score S1 → performing inclusion correction to obtain the text inclusion score S2 → prefix correction → obtaining the text matching score S3.

[0112] Based on this, step S40 specifically includes:

[0113] S41. The text inclusion score is obtained by performing inclusion correction on the text matching rate and the basic text score; specifically, the text inclusion score is obtained by performing inclusion correction based on the text matching rate, the basic text score and the preset inclusion weight.

[0114] In this step, the preset inclusion weights include: inclusion weight, which is the proportion of text inclusion score in the total score; and inclusion weight offset, which is the adjustment coefficient for inclusion weight when there is a complete inclusion.

[0115] The specific calculation method for text inclusion score is as follows: Figure 2 As shown, it can be expressed by the following formula:

[0116] S2 = MR*α + (1-α)*S1;

[0117] Where S1 is the base text score, MR is the text matching rate, α is the preset inclusion weight, and S2 is the text inclusion score. When there is a complete inclusion, α = CW + CWO; when there is no complete inclusion, α = CW. CW: Contain Weight; CWO: Contain Weight Offset.

[0118] S42. Perform prefix correction on the text inclusion score to obtain the text matching score. Specifically, perform prefix correction based on the text inclusion score and the preset prefix matching weight to obtain the text matching score.

[0119] In this step, when the prefix of the input text is equal to all the starting parts of the matching text, the degree of fit of the input text can be considered to be higher, and vice versa. Therefore, this method will reduce the score of input text that fails to meet this condition, and the weight of the reduction is controlled by the preset prefix matching weight.

[0120] Please see Figure 2 Prefix correction can be expressed as:

[0121] S3 = S2 * β;

[0122] Here, β is the preset prefix matching weight. β = 1 when all prefixes of the input text begin with the same value as the matching text; β = PW when none of the prefixes of the input text begin with the same value as the matching text. PW: Prefix Match Weight, which can be customized as needed. S3 is the final text matching score.

[0123] The following is a specific example of the calculation method in this embodiment.

[0124] Input content: Shanghai Hongqiao;

[0125] Matching content: Shanghai Hongqiao International Airport (SHA);

[0126] Preset inclusion weight (CW): 0.2;

[0127] Preset includes weight offset (CWO): 0.05;

[0128] Preset prefix matching weight: 0.1;

[0129]

[0130] Therefore, in this embodiment, the number of words in the input text and the matching text are matched, making the calculation process more stable and avoiding instability caused by differences in the number of words. This method can be applied to various text matching scenarios, such as machine translation, text summarization, and information retrieval, and has high versatility.

[0131] This embodiment also provides a text matching method, which employs the calculation method described above, wherein, as... Figure 3 As shown, text matching methods include:

[0132] S50. Obtain the input text and the matching text corresponding to the input text;

[0133] S60. Calculate the text matching score between the matched text and the input text according to the text matching score calculation method;

[0134] S70. Sort the words in the matched text according to the text matching score to complete the text matching.

[0135] In this embodiment, the text matching score of the matched text is calculated according to the aforementioned text matching score calculation method, and the text matching scores are sorted to increase the accuracy of text matching. Preferably, the text matching scores are sorted from largest to smallest.

[0136] Example 2

[0137] This embodiment provides a text matching score calculation system. The system calculates the text matching score between input text and its corresponding matching text. Figure 4 As shown, the computing system includes:

[0138] Text acquisition module 1 is used to acquire the input text and the matching text corresponding to the input text;

[0139] Matching rate calculation module 2 is used to calculate the text matching rate based on the input text and the matched text;

[0140] The basic text score calculation module 3 is used to calculate the basic text score by matching the corresponding calculation pattern based on the number of words in the input text and the number of words in the matching text.

[0141] The text matching score calculation module 4 is used to post-process the text matching rate and the basic text score to obtain the text matching score.

[0142] In this embodiment, the number of words in the input text and the matching text are matched, making the calculation process more stable and avoiding instability caused by differences in the number of words. This system can be applied to various text matching scenarios, such as machine translation, text summarization, and information retrieval, and has high versatility.

[0143] While specific embodiments of the present invention have been described above, those skilled in the art should understand that these are merely illustrative examples, and the scope of protection of the present invention is defined by the appended claims. Those skilled in the art can make various changes or modifications to these embodiments without departing from the principles and essence of the present invention, but all such changes and modifications fall within the scope of protection of the present invention.

Claims

1. A method for calculating text matching scores, characterized in that, The calculation method is used to calculate the text matching score between the input text and the matching text corresponding to the input text. The calculation method includes the following steps: Obtain the input text and the matching text corresponding to the input text; Calculate the text matching rate based on the input text and the matched text; The basic text score is calculated by matching the number of words in the input text and the number of words in the matched text to the corresponding calculation pattern. Post-processing is performed on the text matching rate and the basic text score to obtain the text matching score; The step of calculating the basic text score by matching the corresponding calculation pattern based on the number of words in the input text and the number of words in the matched text includes: When both the input text and the matching text are a single word, the basic text score is calculated using the longest common substring algorithm and the Sorenson-dice coefficient algorithm. When both the input text and the matching text consist of multiple words, several initial text scores are calculated for each word in the input text and each word in the matching text based on the longest common substring algorithm and the Sorenson-dice coefficient algorithm. The highest score among the initial text scores is obtained according to the maximum non-repeating sampling algorithm as the base text score; the maximum non-repeating sampling algorithm adopts a dynamic programming method to ensure that each input word and matching word is calculated only once, and to ensure that each input word participates in the calculation. The steps for post-processing the text matching rate and the basic text score to obtain the text matching score include: The text inclusion score is obtained by performing inclusion correction on the text matching rate and the basic text score; the text inclusion score is calculated as follows: S2 = MR*α+(1-α)*S1; where S1 is the basic text score, MR is the text matching rate, α is the preset inclusion weight, and S2 is the text inclusion score; when there is complete inclusion, α = CW+CWO; when there is no complete inclusion, α = CW; CW is the inclusion weight; CWO is the inclusion weight offset; The text inclusion score is prefixed to obtain the text matching score; The step of prefix correction of the text inclusion score to obtain the text matching score includes: The prefix correction is performed based on the text inclusion score and the preset prefix matching weight to obtain the text matching score; the calculation formula for the prefix correction is as follows: S3 = S2*β; where β is the preset prefix matching weight, β=1 when all the prefixes of the input text start to be the same as the matching text; β=PW when all the prefixes of the input text start to be different from the matching text; PW is the prefix matching weight; S3 is the text matching score.

2. The calculation method as described in claim 1, characterized in that, The step of calculating the basic text score by matching the corresponding calculation pattern based on the number of words in the input text and the number of words in the matched text includes: When the input text consists of multiple words and the matching text consists of a single word, the longest common substring algorithm and the Sorenson-dice coefficient algorithm are used to calculate several initial text scores for each word in the input text and the matching text. The basic text score is obtained by using the maximum value in the initial text score as the numerator and the number of words in the input text as the denominator.

3. The calculation method as described in claim 1, characterized in that, The step of calculating the basic text score by matching the corresponding calculation pattern based on the number of words in the input text and the number of words in the matched text includes: When the input text is a single word and the matching text consists of multiple words, several initial text scores are calculated for each word in the input text and each word in the matching text based on the longest common substring algorithm and the Sorenson-dice coefficient algorithm. The basic text score is obtained by using the maximum value in the initial text score as the numerator and the number of words in the matched text as the denominator.

4. A text matching score calculation system, characterized in that, The computing system is used to calculate a text matching score between input text and matching text corresponding to the input text. The computing system includes: The text acquisition module is used to acquire input text and matching text corresponding to the input text. A matching rate calculation module is used to calculate the text matching rate based on the input text and the matching text. The basic text score calculation module is used to calculate the basic text score based on the corresponding pattern of the input text and the matched text; The text matching score calculation module is used to post-process the text matching rate and the basic text score to obtain the text matching score. The text matching score calculation module is also used to calculate the basic text score based on the longest common substring algorithm and the Sorenson-dice coefficient algorithm when both the input text and the matching text are a single word. The text matching score calculation module is further configured to calculate several initial text scores for each word in the input text and each word in the matching text based on the longest common substring algorithm and the Sorenson-dice coefficient algorithm when both the input text and the matching text are multiple words. The text matching score calculation module is also used to obtain the highest score among the initial text scores as the basic text score according to the maximum non-repeating sampling algorithm; the maximum non-repeating sampling algorithm is a dynamic programming method that ensures that each input word and matching word is calculated only once, and that each input word participates in the calculation. The text matching score calculation module is further used to perform inclusion correction on the text matching rate and the basic text score to obtain a text inclusion score; the calculation formula for the text inclusion score is as follows: S2 = MR*α+(1-α)*S1; where S1 is the basic text score, MR is the text matching rate, α is the preset inclusion weight, and S2 is the text inclusion score; when there is complete inclusion, α = CW+CWO; when there is no complete inclusion, α = CW; CW is the inclusion weight; CWO is the inclusion weight offset; The text matching score calculation module is also used to perform prefix correction on the text inclusion score to obtain the text matching score; The text matching score calculation module is further used to perform prefix correction based on the text inclusion score and the preset prefix matching weight to obtain the text matching score; the calculation formula for the prefix correction is as follows: S3 = S2*β; where β is the preset prefix matching weight, β=1 when all the prefixes of the input text start to be equal to the matching text; β=PW when all the prefixes of the input text start to be equal to the matching text; PW is the prefix matching weight; S3 is the text matching score.

5. A text matching method, characterized in that, The text matching method employs the calculation method described in any one of claims 1-3, and the text matching method includes: Obtain the input text and the matching text corresponding to the input text. Calculate the text matching score between the matched text and the input text according to the calculation method described above; The words in the matched text are sorted according to the text matching score to complete the text matching.

Citation Information

Patent Citations

  • Text matching method, device, equipment and storage medium

    CN114090735A

  • Systems and methods for deviation detection, information extraction and obligation deviation detection

    US20210294974A1

  • Semantic co-occurrence filtering for speech recognition and signal transcription applications

    US5500920A