Text semantic matching method and device

Through the preset similarity combination algorithm and SBERT model, users' intentions in the intelligent dialogue platform are accurately judged, which solves the problem of inaccurate intention judgment when users dynamically modify intentions and improves response accuracy.

CN114861674BActive Publication Date: 2025-02-14SHANDONG NEW GENERATION INFORMATION IND TECH RES INST CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210544384.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-19
Publication Date
2025-02-14
Estimated Expiration
2042-05-19

AI Technical Summary

Technical Problem

In the intelligent dialogue platform, it is difficult to accurately judge the user's intentions because users need to dynamically add, delete and modify their intentions.

Method used

The preset similarity combination algorithm is used to calculate the first similarity degree of the text input by the user with the text in the preset corpus, filter out the reference corpus set, and compare the user input text and reference corpus sets through the preset SBERT model. , determine the text semantics.

Benefits of technology

When users dynamically modify their intentions, they can accurately judge user intentions through various algorithms and SBERT models to improve the response accuracy of the intelligent dialogue platform.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114861674B_ABST
    Figure CN114861674B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a text semantic matching method and device. Through a preset similarity combination algorithm, a first similarity calculation is performed on the text input by the user and the text in the preset corpus, so as to screen out a reference corpus set in the preset corpus; wherein the first similarity corresponding to the corpus in the reference corpus set is greater than the preset similarity threshold; the preset corpus includes multiple corpora and multiple corpora respectively correspond to text semantics; the text input by the user and the reference corpus set are input into a preset SBERT model, and a first sequence vector is extracted from the text input by the user through the preset SBERT model, and a second sequence vector is extracted from the corpus in the reference corpus set through the preset SBERT model; through the preset SBERT model, the second similarities corresponding to the first sequence vector and the multiple second sequence vectors are determined respectively, so as to determine the text semantics corresponding to the text input by the user according to the second similarity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a text semantic matching method and device. Background Art

[0002] In intelligent services, it is necessary to quickly and automatically answer common questions of users. In the prior art, it is usually to determine whether the text corresponding to the user's speech is similar to the text of the question in the question library, and then find the answer corresponding to the similar question as a reply.

[0003] In the prior art, the judgment of text similarity is usually achieved by training machine learning models. However, models based on deep learning are often applicable to fixed intents. For application scenarios such as intelligent dialogue platforms, because users need to dynamically add, delete, and modify intents, it is difficult to accurately judge user intent during the dialogue process. Summary of the invention

[0004] The embodiments of the present application provide a text semantic matching method and device for solving the following technical problems: For application scenarios such as intelligent dialogue platforms, because users need to dynamically add, delete, and modify intentions, it is difficult to accurately judge user intentions during the dialogue process.

[0005] The present application embodiment adopts the following technical solutions:

[0006] The embodiment of the present application provides a text semantic matching method. The method comprises: performing a first similarity calculation on the text input by the user and the text in the preset corpus through a preset similarity combination algorithm, so as to screen out a reference corpus set in the preset corpus; wherein the first similarity corresponding to the corpus in the reference corpus set is greater than the preset similarity threshold; the preset corpus includes multiple corpora and multiple corpora respectively correspond to text semantics; inputting the text input by the user and the reference corpus set into a preset SBERT model, extracting a first sequence vector from the text input by the user through the preset SBERT model, and extracting a second sequence vector from the corpus in the reference corpus set through the preset SBERT model; determining the second similarities corresponding to the first sequence vector and the multiple second sequence vectors respectively through the preset SBERT model, so as to determine the text semantics corresponding to the text input by the user according to the second similarity.

[0007] The embodiment of the present application can use a preset similarity algorithm set to perform a first similarity calculation on the text input by the user and the text in the preset corpus through multiple similarity algorithms, so as to determine a reference corpus set with a higher similarity to the text input by the user according to the first similarities corresponding to different algorithms. Thereby narrowing the scope of semantic selection. Secondly, in order to further accurately determine the text semantics corresponding to the text input by the user, the text input by the user and the reference corpus set are input into the preset SBERT model, and the content input by the user is compared with the reference corpus set, and the corresponding text semantics are determined by the obtained second similarity. Therefore, for application scenarios such as intelligent dialogue platforms, when users dynamically add, delete, and modify intentions, the user's intentions can be accurately judged through multiple algorithm sets and the preset SBERT model.

[0008] In one implementation of the present application, the preset similarity combination algorithm includes at least one or more of the BM25 algorithm, the minimum distance algorithm, the synonym replacement algorithm, and the typo correction algorithm.

[0009] In one implementation of the present application, a first similarity calculation is performed on the text input by the user and the text in the preset corpus through a preset similarity combination algorithm to screen out a reference corpus set in the preset corpus, specifically including: performing a first similarity calculation on the text input by the user and the text in the preset corpus through multiple algorithms in the similarity combination algorithm; determining multiple first similarities corresponding to each corpus in the preset corpus; comparing the multiple first similarities corresponding to each corpus with a preset similarity threshold, and when the multiple first similarities corresponding to the current corpus are all greater than the preset similarity threshold, using the current corpus as the corpus in the reference corpus set.

[0010] In one implementation of the present application, the text input by the user and the reference corpus set are input into a preset SBERT model, specifically including: inputting the text input by the user and the reference corpus set into a sub-network model in the preset SBERT model respectively; wherein the sub-network model is a plurality of BERT models with shared parameters.

[0011] In one implementation of the present application, a first sequence vector is extracted from the text input by the user through a preset SBERT model, specifically including: encoding the text input by the user through the Transformer layer of the SBERT model to convert the text input by the user into an encoding format corresponding to the SBERT model; based on the preset character length and the SBERT model, the text input by the user is divided into text to obtain a first sequence vector corresponding to the text input by the user.

[0012] In one implementation of the present application, a second sequence vector is extracted from the corpus in the reference corpus set through a preset SBERT model, specifically including: encoding the corpus in the reference corpus set through the Transformer layer of the SBERT model to convert the corpus in the reference corpus set into an encoding format corresponding to the SBERT model; based on the preset character length and the SBERT model, text division is performed on the corpus in the reference corpus set to obtain a second sequence vector corresponding to the corpus in the reference corpus set.

[0013] In one implementation of the present application, a second similarity corresponding to a first sequence vector and multiple second sequence vectors is determined by presetting an SBERT model, specifically including: determining the first data content in the first sequence vector and determining the second data content in the second sequence vector through the SBERT model; calculating the correlation between the first data content and the multiple second data contents, respectively, to obtain the second similarity between the first sequence vector and the multiple second sequence vectors, respectively.

[0014] In one implementation of the present application, the text semantics corresponding to the text input by the user is determined based on the second similarity, specifically including: determining the second similarities corresponding to the corpora in the reference corpus set respectively; based on the first similarity and a preset weight value template, determining the weight values ​​corresponding to the corpora in the reference corpus set respectively; multiplying the weight value by the second similarity, and taking the corpus meaning corresponding to the second similarity with the highest product as the text semantics matching the text input by the user.

[0015] The embodiment of the present application adjusts the weight of the second similarity according to the weight values ​​corresponding to the corpora in the reference corpus set, so as to combine the first similarity with the second similarity. The most similar corpus is determined based on the combined result, and then the text semantics that best matches the text input by the user is determined.

[0016] In one implementation of the present application, before performing a first similarity calculation on the text input by the user and the text in the preset corpus through a preset similarity combination algorithm, the method also includes: obtaining the text input by the user; performing data cleaning on the text input by the user to determine the problem data in the text input by the user; wherein the problem data includes at least one or more of duplicate data and damaged data; deleting the duplicate data; and repairing the damaged data based on a preset text template.

[0017] An embodiment of the present application provides a text semantic matching device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can: perform a first similarity calculation on a text input by a user and a text in a preset corpus through a preset similarity combination algorithm, so as to screen out a reference corpus set in the preset corpus; wherein the first similarity corresponding to the corpus in the reference corpus set is greater than a preset similarity threshold; the preset corpus includes a plurality of corpora and the plurality of corpora respectively correspond to text semantics; the text input by the user and the reference corpus set are input into a preset SBERT model, a first sequence vector is extracted from the text input by the user through the preset SBERT model, and a second sequence vector is extracted from the corpus in the reference corpus set through the preset SBERT model; and a second similarity corresponding to the first sequence vector and the plurality of second sequence vectors respectively is determined through the preset SBERT model, so as to determine the text semantics corresponding to the text input by the user according to the second similarity.

[0018] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects: the embodiments of the present application can use a preset similarity algorithm set to perform a first similarity calculation on the text input by the user and the text in the preset corpus through multiple similarity algorithms, thereby determining a reference corpus set with a higher similarity to the text input by the user according to the first similarities corresponding to different algorithms. Thereby narrowing the scope of semantic selection. Secondly, in order to further accurately determine the text semantics corresponding to the text input by the user, the text input by the user and the reference corpus set are input into the preset SBERT model, and the content input by the user is compared with the reference corpus set, and the corresponding text semantics are determined by the obtained second similarity. Therefore, for application scenarios such as intelligent dialogue platforms, when users dynamically add, delete, and modify intentions, the user's intentions can be accurately judged through multiple algorithm sets and the preset SBERT model. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative labor.

[0020] In the figure:

[0021] Figure 1 A flow chart of a text semantic matching method provided in an embodiment of the present application;

[0022] Figure 2 A structural diagram of a text semantic matching device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0023] The embodiments of the present application provide a text semantic matching method and device.

[0024] In order to enable those skilled in the art to better understand the technical solutions in this application, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this application.

[0025] In intelligent services, it is necessary to quickly and automatically answer common questions of users. In the prior art, it is usually determined whether the text corresponding to the user's speech is similar to the text of the question in the question library, and then find the answer corresponding to the similar question as a reply.

[0026] In the prior art, the judgment of text similarity is usually achieved by training machine learning models. However, models based on deep learning are often applicable to fixed intents. For application scenarios such as intelligent dialogue platforms, since users need to dynamically add, delete, and modify intents, it is difficult to accurately judge user intent during the dialogue process.

[0027] In order to solve the above problems, the embodiments of the present application provide a text semantic matching method and device. Through a preset similarity algorithm set, a first similarity calculation can be performed on the text input by the user and the text in the preset corpus through a plurality of similarity algorithms, so as to determine a reference corpus set with a higher similarity to the text input by the user according to the first similarities corresponding to different algorithms. Thereby narrowing the scope of semantic selection. Secondly, in order to further accurately determine the text semantics corresponding to the text input by the user, the text input by the user and the reference corpus set are input into the preset SBERT model, and the content input by the user is compared with the reference corpus set, and the corresponding text semantics are determined by the obtained second similarity. Therefore, for application scenarios such as intelligent dialogue platforms, when users dynamically add, delete, and modify intentions, the user intentions can be accurately judged through a plurality of algorithm sets and the preset SBERT model.

[0028] The technical solution proposed in the embodiments of the present application is described in detail below with reference to the accompanying drawings.

[0029] Figure 1 A flow chart of a text semantic matching method provided in an embodiment of the present application. Figure 1 As shown, the text semantic matching method includes the following steps:

[0030] S101, the text semantic matching device performs a first similarity calculation on the text input by the user and the text in the preset corpus through a preset similarity combination algorithm, so as to screen out a reference corpus set in the preset corpus. The first similarity corresponding to the corpus in the reference corpus set is greater than a preset similarity threshold, and the preset corpus includes a plurality of corpora and the plurality of corpora respectively correspond to text semantics.

[0031] In one embodiment of the present application, a text input by a user is obtained. The text input by the user is cleaned to determine problematic data in the text input by the user. The problematic data includes at least one or more of duplicate data and damaged data. The duplicate data is deleted, and the damaged data is repaired based on a preset text template.

[0032] Specifically, when users input text, there may be typos, repeated input, garbled input, etc. At this time, directly performing semantic matching on the text input by the user will reduce the accuracy of semantic matching. Therefore, before performing semantic matching, it is necessary to perform data cleaning on the text content input by the user. In order to determine the problem data inside. If the problem data is duplicate data, the duplicate part can be directly deleted. If the problem is damaged data, for example, some words have garbled characters, typos, etc., a preset text template can be established based on the big data of the user input text collected in advance, and the text input by the user can be revised according to the preset text template.

[0033] In one embodiment of the present application, a first similarity calculation is performed on the text input by the user and the text in the preset corpus respectively through multiple algorithms in the similarity combination algorithm. Multiple first similarities corresponding to each corpus in the preset corpus are determined. The multiple first similarities corresponding to each corpus are compared with the preset similarity threshold. When the multiple first similarities corresponding to the current corpus are all greater than the preset similarity threshold, the current corpus is used as the corpus in the reference corpus set.

[0034] In one embodiment of the present application, the preset similarity combination algorithm includes at least one or more of the BM25 algorithm, the minimum distance algorithm, the synonym replacement algorithm, and the typo correction algorithm.

[0035] Specifically, after receiving the text input by the user, the similarity of the text input by the user is calculated respectively by using a plurality of algorithms in the similarity algorithm. For example, the first similarity between the text input by the user and the text in the preset corpus is determined by the BM25 algorithm. And, the first similarity between the text input by the user and the text in the preset corpus is determined by the minimum distance algorithm. And the first similarity between the text input by the user and the text in the preset corpus is calculated by the synonym replacement algorithm, and the first similarity between the text input by the user and the text in the preset corpus is calculated by the typo correction algorithm.

[0036] Furthermore, each corpus in the preset corpus can obtain the first similarity corresponding to a plurality of similarity algorithms. The plurality of first similarities corresponding to each corpus are respectively compared with the preset similarity threshold to determine the number of first similarities of each corpus that is greater than the preset similarity threshold. If the plurality of first similarities corresponding to the current corpus are all greater than the preset similarity threshold, it means that the corpus is relatively similar to the content input by the user, and therefore, the corpus can be used as the corpus in the reference corpus set. Using the above series of similarity algorithms, the corpus pre-defined by the user is initially screened and recalled to determine a portion of the corpus in the corpus that is relatively similar to the text input by the user.

[0037] S102: Input the text input by the user and the reference corpus set into a preset SBERT model, perform a first sequence vector extraction on the text input by the user through the preset SBERT model, and perform a second sequence vector extraction on the corpus in the reference corpus set through the preset SBERT model.

[0038] In one embodiment of the present application, the text input by the user and the reference corpus set are respectively input into the sub-network model in the preset SBERT model, wherein the sub-network model is a plurality of BERT models with shared parameters.

[0039] Specifically, when the text input by the user is input into the preset SBERT model, the initial SBERT model needs to be trained according to the pre-collected text training set to obtain the preset SBERT model.

[0040] Furthermore, the SBERT model in the embodiment of the present application includes two sub-networks, both of which are BERT models, and the two BERT models share parameters. For example, when comparing the similarity of two sentences A and B, they are respectively input into the BERT network to obtain sequence vectors, and then the output through pooling is two sets of vectors representing sentences with dimensions less than 128, and finally the similarity between the two is calculated.

[0041] In one embodiment of the present application, the text input by the user is encoded by the Transformer layer of the SBERT model to convert the text input by the user into an encoding format corresponding to the SBERT model. Based on the preset character length and the SBERT model, the text input by the user is divided into texts to obtain a first sequence vector corresponding to the text input by the user.

[0042] Specifically, the content input into the SBERT model has different formats. In order to unify the formats so that the SBERT model can extract sequence vectors, the input content needs to be encoded and converted into the encoding format corresponding to the SBERT model. Secondly, the text input by the user is segmented to convert the longer text input by the user into multiple short sentences to obtain the first sequence vector corresponding to the text input by the user.

[0043] For example, a paragraph of text has 1,500 characters. If it is divided by periods, there are 80 sentences. Then for each sentence, the BERT model can be used to obtain a sentence vector. The maximum length of characters contained in a sentence can be defined as 128. At this time, the shape of the result obtained from such a sentence is (128, 768). Then each sentence obtains a vector with a shape of (768), which is the embedding of this sentence. Then a sample is set to have 80 sentences. If there are more than 80 sentences, the first 80 are taken. If there are less than 80 sentences, a 768-dimensional all-0 vector is filled. The final result is: (N, 80, 768). N represents the number of samples, 80 represents the maximum length of the sentence, and 768 represents the vector dimension.

[0044] In one embodiment of the present application, the corpus in the reference corpus set is encoded by the Transformer layer of the SBERT model to convert the corpus in the reference corpus set into an encoding format corresponding to the SBERT model. Based on the preset character length and the SBERT model, the corpus in the reference corpus set is text-divided to obtain a second sequence vector corresponding to the corpus in the reference corpus set.

[0045] Specifically, the corpus in the reference corpus set input into the SBERT model may have different formats. In order to unify the formats so that the SBERT model can extract sequence vectors from them, it is necessary to encode the input corpus content and convert it into the encoding format corresponding to the SBERT model. Secondly, the reference corpus set content is divided into texts to convert the longer texts in the reference corpus set into multiple short sentences to obtain the two-sequence vector corresponding to the reference corpus set.

[0046] S103 . Determine second similarities respectively corresponding to the first sequence vector and the plurality of second sequence vectors by using a preset SBERT model, so as to determine text semantics corresponding to the text input by the user according to the second similarities.

[0047] In one embodiment of the present application, the first data content in the first sequence vector is determined by the SBERT model, and the second data content in the second sequence vector is determined. The first data content is respectively associated with the plurality of second data contents to obtain the second similarity between the first sequence vector and the plurality of second sequence vectors.

[0048] Specifically, the SBERT model outputs a first sequence vector of less than 128 dimensions corresponding to the text input by the user, and the SBERT model determines a second sequence vector of less than 128 dimensions corresponding to each corpus in the reference corpus set. The SBERT model determines a second similarity between the first sequence vector and each second sequence vector.

[0049] In one embodiment of the present application, the second similarities corresponding to the corpora in the reference corpus set are determined. Based on the first similarity and a preset weight value template, the weight values ​​corresponding to the corpora in the reference corpus set are determined. The weight value is multiplied by the second similarity, and the meaning of the corpus corresponding to the second similarity with the highest product is used as the text semantics matching the text input by the user.

[0050] Specifically, after obtaining the second similarity corresponding to each corpus in the reference corpus set, in order to improve the accuracy of the final text semantics, the embodiment of the present application combines the first similarity with the second similarity. The process is to determine the first similarity corresponding to each corpus in the reference corpus set, and compare the first similarity with the preset weight value template to obtain the weight value corresponding to each first similarity.

[0051] It should be noted that the preset weight value template includes a plurality of different first similarity values ​​and a weight value corresponding to each first similarity value, wherein the higher the first similarity value is, the higher the corresponding weight value is.

[0052] Further, the second similarity corresponding to each corpus in the reference corpus set and the weight value corresponding to each corpus are obtained, and the weight value corresponding to each corpus is multiplied by the second similarity to adjust each corpus, so as to determine the corpus with the highest similarity in a manner of combining the first similarity with the second similarity. The text semantics corresponding to the corpus with the highest similarity is determined in the preset corpus, and the text semantics is used as the text semantics matched by the text input by the user.

[0053] The embodiment of the present application adjusts the weight of the second similarity according to the weight values ​​corresponding to the corpora in the reference corpus set, so as to combine the first similarity with the second similarity. The most similar corpus is determined based on the combined result, and then the text semantics that best matches the text input by the user is determined.

[0054] Figure 2 This is a schematic diagram of the structure of a text semantic matching device provided in an embodiment of the present application. Figure 2 As shown, the text semantic matching device includes:

[0055] at least one processor; and,

[0056] a memory communicatively connected to the at least one processor; wherein,

[0057] The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to:

[0058] By using a preset similarity combination algorithm, a first similarity calculation is performed on the text input by the user and the text in the preset corpus, so as to screen out a reference corpus set in the preset corpus; wherein the first similarity corresponding to the corpus in the reference corpus set is greater than a preset similarity threshold; the preset corpus includes a plurality of corpora and the plurality of corpora respectively correspond to text semantics;

[0059] Inputting the text input by the user and the reference corpus set into a preset SBERT model, performing a first sequence vector extraction on the text input by the user through the preset SBERT model, and performing a second sequence vector extraction on the corpus in the reference corpus set through the preset SBERT model;

[0060] The preset SBERT model is used to determine second similarities respectively corresponding to the first sequence vector and a plurality of second sequence vectors, so as to determine text semantics corresponding to the text input by the user according to the second similarities.

[0061] Each embodiment in this application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, equipment, and non-volatile computer storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0062] The above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0063] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the embodiments of the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the embodiments of the present application should be included in the scope of the claims of the present application.

Claims

1. A text semantic matching method, characterized in that: The method comprises: By using a preset similarity combination algorithm, a first similarity calculation is performed on the text input by the user and the text in the preset corpus, so as to screen out a reference corpus set in the preset corpus; wherein the first similarity corresponding to the corpus in the reference corpus set is greater than a preset similarity threshold; the preset corpus includes a plurality of corpora and the plurality of corpora respectively correspond to text semantics; Inputting the text input by the user and the reference corpus set into a preset SBERT model, performing a first sequence vector extraction on the text input by the user through the preset SBERT model, and performing a second sequence vector extraction on the corpus in the reference corpus set through the preset SBERT model; Determine, by using the preset SBERT model, second similarities respectively corresponding to the first sequence vector and a plurality of the second sequence vectors, so as to determine, according to the second similarities, text semantics corresponding to the text input by the user; The first similarity calculation is performed on the text input by the user and the text in the preset corpus by using a preset similarity combination algorithm to screen out a reference corpus set in the preset corpus, specifically including: By using a plurality of algorithms in the similarity combination algorithm, respectively performing a first similarity calculation on the text input by the user and the text in the preset corpus; Determine a plurality of first similarities corresponding to each corpus in the preset corpus; Compare the multiple first similarities corresponding to each corpus with the preset similarity threshold, and when the multiple first similarities corresponding to the current corpus are all greater than the preset similarity threshold, use the current corpus as the corpus in the reference corpus set; The extracting a first sequence vector from the text input by the user through the preset SBERT model specifically includes: Encoding the text input by the user through the Transformer layer of the SBERT model to convert the text input by the user into an encoding format corresponding to the SBERT model; Based on a preset character length and the SBERT model, performing text segmentation on the text input by the user to obtain a first sequence vector corresponding to the text input by the user; The extracting a second sequence vector from the corpus in the reference corpus set by using the preset SBERT model specifically includes: Encoding the corpus in the reference corpus set through the Transformer layer of the SBERT model to convert the corpus in the reference corpus set into an encoding format corresponding to the SBERT model; Based on a preset character length and the SBERT model, text segmentation is performed on the corpus in the reference corpus set to obtain a second sequence vector corresponding to the corpus in the reference corpus set; The determining, by the preset SBERT model, second similarities respectively corresponding to the first sequence vector and the plurality of second sequence vectors specifically includes: Determine the first data content in the first sequence vector by using the SBERT model, and determine the second data content in the second sequence vector; Calculating the association degree between the first data content and the plurality of second data contents respectively, so as to obtain the second similarities between the first sequence vector and the plurality of second sequence vectors respectively; Determining the text semantics corresponding to the text input by the user according to the second similarity specifically includes: Determining second similarities corresponding to the corpora in the reference corpus set respectively; Based on the first similarity and a preset weight value template, determining weight values ​​corresponding to the corpora in the reference corpus set respectively; The weight value is multiplied by the second similarity, and the corpus meaning corresponding to the second similarity with the highest product is used as the text semantics matching the text input by the user.

2. A text semantic matching method according to claim 1, characterized in that: The preset similarity combination algorithm includes at least one or more of a BM25 algorithm, a minimum distance algorithm, a synonym replacement algorithm, and a typo correction algorithm.

3. A text semantic matching method according to claim 1, characterized in that: The step of inputting the text input by the user and the reference corpus set into a preset SBERT model specifically includes: Input the text input by the user and the reference corpus set into the sub-network model in the preset SBERT model respectively; The sub-network models are multiple BERT models with shared parameters.

4. A text semantic matching method according to claim 1, characterized in that: Before performing a first similarity calculation on the text input by the user and the text in the preset corpus by using the preset similarity combination algorithm, the method further includes: Obtaining text input by the user; Performing data cleaning on the text input by the user to determine problematic data in the text input by the user; wherein the problematic data at least includes one or more of duplicate data and damaged data; Deleting the duplicate data; and Based on a preset text template, the damaged data is repaired.

5. A text semantic matching device, comprising: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to: By using a preset similarity combination algorithm, a first similarity calculation is performed on the text input by the user and the text in the preset corpus, so as to screen out a reference corpus set in the preset corpus; wherein the first similarity corresponding to the corpus in the reference corpus set is greater than a preset similarity threshold; the preset corpus includes a plurality of corpora and the plurality of corpora respectively correspond to text semantics; Inputting the text input by the user and the reference corpus set into a preset SBERT model, performing a first sequence vector extraction on the text input by the user through the preset SBERT model, and performing a second sequence vector extraction on the corpus in the reference corpus set through the preset SBERT model; Determine, by using the preset SBERT model, second similarities respectively corresponding to the first sequence vector and a plurality of the second sequence vectors, so as to determine, according to the second similarities, text semantics corresponding to the text input by the user; The first similarity calculation is performed on the text input by the user and the text in the preset corpus by using a preset similarity combination algorithm to screen out a reference corpus set in the preset corpus, specifically including: By using a plurality of algorithms in the similarity combination algorithm, respectively performing a first similarity calculation on the text input by the user and the text in the preset corpus; Determine a plurality of first similarities corresponding to each corpus in the preset corpus; Compare the multiple first similarities corresponding to each corpus with the preset similarity threshold, and when the multiple first similarities corresponding to the current corpus are all greater than the preset similarity threshold, use the current corpus as the corpus in the reference corpus set; The extracting a first sequence vector from the text input by the user through the preset SBERT model specifically includes: Encoding the text input by the user through the Transformer layer of the SBERT model to convert the text input by the user into an encoding format corresponding to the SBERT model; Based on a preset character length and the SBERT model, performing text segmentation on the text input by the user to obtain a first sequence vector corresponding to the text input by the user; The extracting a second sequence vector from the corpus in the reference corpus set by using the preset SBERT model specifically includes: Encoding the corpus in the reference corpus set through the Transformer layer of the SBERT model to convert the corpus in the reference corpus set into an encoding format corresponding to the SBERT model; Based on a preset character length and the SBERT model, text segmentation is performed on the corpus in the reference corpus set to obtain a second sequence vector corresponding to the corpus in the reference corpus set; The determining, by the preset SBERT model, second similarities respectively corresponding to the first sequence vector and the plurality of second sequence vectors specifically includes: Determine the first data content in the first sequence vector by using the SBERT model, and determine the second data content in the second sequence vector; Calculating the association degree between the first data content and the plurality of second data contents respectively, so as to obtain the second similarities between the first sequence vector and the plurality of second sequence vectors respectively; Determining the text semantics corresponding to the text input by the user according to the second similarity specifically includes: Determining second similarities corresponding to the corpora in the reference corpus set respectively; Based on the first similarity and a preset weight value template, determining weight values ​​corresponding to the corpora in the reference corpus set respectively; The weight value is multiplied by the second similarity, and the corpus meaning corresponding to the second similarity with the highest product is used as the text semantics matching the text input by the user.

Citation Information

Patent Citations

  • Semantic recognition method and device, computer equipment and storage medium

    CN112149410A

  • Question and answer pair matching method and device, electronic equipment and storage medium

    CN112417096A

  • Question and answer method and device, electronic equipment and storage medium

    CN113157867A