Text matching method, text matching device, electronic device and storage medium
By combining Bert and FastText models in the text matching method, the similarity between candidate sentence text and text to be matched is solved, and the problem of slow sentence similarity calculation speed in traditional methods is achieved, which achieves more efficient and accurate text matching recognition, reducing the number of text matching and recognition. The labor cost of voice call.
Patent Information
- Application Number
- CN202210438940.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-25
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2042-04-25
AI Technical Summary
Although the traditional sentence similarity calculation method improves accuracy, the Bert model's slow prediction speed limits its application in industrial scenarios and reduces user experience satisfaction.
A text matching method is proposed. By receiving text search requests, the preset text matching model is used to calculate the similarity between candidate sentence text and text to be matched, and filtered in combination with the FastText model to improve the accuracy and efficiency of matching recognition.
It improves the accuracy and efficiency of text sentence matching recognition, reduces the labor cost of voice outgoing calls, and improves user experience satisfaction.
Smart Images

Figure CN115017886B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a text matching method, a text matching device, an electronic device and a storage medium. Background Art
[0002] At present, when enterprises are promoting existing products, they will inevitably encounter business functions such as after-sales service and customer service communication. As the number of users increases and the product range becomes larger, they will need to deal with a large number of users' questions about products and after-sales problems, but relying solely on manual voice outbound operations will reduce the work efficiency of enterprises.
[0003] Intelligent voice outbound calls using question similarity matching methods are an important research in the field of artificial intelligence. For example, in the field of insurance applications, many methods or algorithms involving sentence similarity matching are needed, such as accurately matching similar sentences to questions raised by users. However, traditional methods for calculating sentence similarity include: using the TextCNN model to calculate the vector of the sentence, and then using the twin tower model to calculate the interactive information between sentences, and then calculating the similarity between sentences; or using Bert as the basic model to calculate the vector of the sentence, and then using the twin tower model to calculate the interactive information between sentences, and then calculating the similarity between sentences. Although the use of the Bert model improves the accuracy of sentence similarity calculation, its slow prediction speed limits its application in industrial scenarios and reduces user experience satisfaction. Summary of the invention
[0004] The main purpose of the embodiments of the present application is to propose a text matching method, a text matching device, an electronic device and a storage medium, which can improve the accuracy and efficiency of text sentence matching and recognition, and reduce the labor cost of voice outbound calls.
[0005] To achieve the above object, a first aspect of an embodiment of the present application proposes a text matching method, the method comprising:
[0006] Receiving a text search request; wherein the text search request includes text to be matched;
[0007] Performing text pattern matching on the text to be matched to obtain at least one candidate sentence text;
[0008] Using a preset text matching model, respectively calculating the similarity between each of the candidate sentence texts and the text to be matched, and obtaining a first candidate matching score corresponding to each of the candidate sentence texts;
[0009] According to the first candidate matching scores corresponding to the respective candidate sentence texts, performing a first text screening on the at least one candidate sentence text to obtain a target sentence text and a target scene corresponding to the target sentence text;
[0010] When the target sentence text is not matched according to the first text screening, the FastText model is used to calculate the similarity between each of the candidate sentence texts and the text to be matched, and a second candidate matching score corresponding to each of the candidate sentence texts is obtained;
[0011] Performing a second text screening on the candidate sentence text according to the second candidate matching score to obtain the target sentence text and the target scene corresponding to the target sentence text;
[0012] The target sentence text is matched with a corresponding speech text in the speech text library preset in the target scenario, and a conversation is conducted with the user according to the voice corresponding to the speech text.
[0013] In some embodiments, performing text pattern matching on the text to be matched to obtain at least one candidate sentence text includes:
[0014] Performing rule matching on the text to be matched according to a preset rule template to obtain a target sentence text and a target scene corresponding to the target sentence text;
[0015] When the target sentence text is not matched according to the rule template, full pattern matching is performed on the text to be matched to obtain at least one candidate sentence text, wherein the candidate sentence texts are arranged in descending order.
[0016] In some embodiments, the text matching model is trained by the following steps:
[0017] Acquire first training sample data;
[0018] Using the first training sample data to perform model training on the Bert teacher model to obtain a sample training model;
[0019] Constructing second training sample data according to the training results of the sample training model;
[0020] The student model is trained using the second training sample data to obtain the text matching model, wherein the student model includes an Esim model or a TextCNN model.
[0021] In some embodiments, the using the first training sample data to perform model training on the Bert teacher model to obtain a sample training model includes:
[0022] Using the first training sample data to perform model training on the Bert teacher model to obtain a model output vector;
[0023] Performing a whitening operation on the model output vector to obtain a whitening matrix vector;
[0024] Performing a normalization operation on the model output vector to obtain a normalized vector;
[0025] Sample similarity calculation is performed based on the whitening matrix vector and the normalized vector, and when the result of the sample similarity calculation meets a preset accuracy condition, a sample training model is determined.
[0026] In some embodiments, the first text screening of the at least one candidate sentence text according to the first candidate matching score corresponding to each of the candidate sentence texts to obtain a target sentence text and a target scene corresponding to the target sentence text includes:
[0027] Comparing the first candidate matching score with a preset first threshold;
[0028] When the first candidate matching score corresponding to the candidate sentence text is greater than the first threshold, the corresponding candidate sentence text is used as the target sentence text, and the target scene corresponding to the target sentence text is obtained.
[0029] In some embodiments, when the first candidate matching score corresponding to the candidate sentence text is greater than the first threshold, taking the corresponding candidate sentence text as the target sentence text, and obtaining the target scene corresponding to the target sentence text, includes:
[0030] When multiple first candidate matching scores are greater than the first threshold, the multiple first candidate matching scores are arranged in descending numerical order, the candidate sentence text corresponding to the first first candidate matching score in the descending numerical order is used as the target sentence text, and the target scene corresponding to the target sentence text is obtained.
[0031] In some embodiments, performing a second text screening on the candidate sentence text according to the second candidate matching score to obtain the target sentence text and the target scene corresponding to the target sentence text includes:
[0032] Comparing the second candidate matching score with a preset second threshold; wherein the second threshold is less than the first threshold;
[0033] When the second candidate matching score corresponding to the candidate sentence text is greater than the second threshold, the corresponding candidate sentence text is used as the target sentence text, and the target scene corresponding to the target sentence text is obtained;
[0034] When the second candidate matching score corresponding to each of the candidate sentence texts is less than or equal to the second threshold, updating the second threshold, wherein the updated second threshold is less than the second threshold before updating;
[0035] When the second candidate matching score corresponding to the candidate sentence text is greater than the updated second threshold, the corresponding candidate sentence text is used as the target sentence text, and the target scene corresponding to the target sentence text is obtained.
[0036] To achieve the above-mentioned purpose, a second aspect of an embodiment of the present application provides a text matching device, the device comprising:
[0037] A search request acquisition module, used to receive a text search request; wherein the text search request includes a text to be matched;
[0038] A matching search module, used for performing text pattern matching on the text to be matched to obtain at least one candidate sentence text;
[0039] A first similarity matching module, used to calculate the similarity between each candidate sentence text and the text to be matched by using a preset text matching model, and obtain a first candidate matching score corresponding to each candidate sentence text;
[0040] A first text screening module, configured to perform a first text screening on the at least one candidate sentence text according to the first candidate matching score corresponding to each of the candidate sentence texts, to obtain a target sentence text and a target scene corresponding to the target sentence text;
[0041] A second similarity matching module is used to calculate the similarity between each of the candidate sentence texts and the text to be matched by using the FastText model when the target sentence text is not matched according to the first text screening, so as to obtain a second candidate matching score corresponding to each of the candidate sentence texts;
[0042] A second text screening module, configured to perform a second text screening on the candidate sentence text according to the second candidate matching score to obtain the target sentence text and the target scene corresponding to the target sentence text;
[0043] The voice dialogue module is used to match the target sentence text with the corresponding speech text in the speech text library preset in the target scenario, and to communicate with the user according to the voice corresponding to the speech text.
[0044] To achieve the above-mentioned purpose, a third aspect of the embodiments of the present application provides an electronic device, including:
[0045] at least one memory;
[0046] at least one processor;
[0047] at least one computer program;
[0048] The at least one computer program is stored in the at least one memory, and the at least one processor executes the at least one computer program to implement the text matching method described in the first aspect above.
[0049] To achieve the above-mentioned purpose, the fourth aspect of an embodiment of the present application proposes a storage medium, which is a computer-readable storage medium. The computer-readable storage medium stores a computer program, and the computer program is used to enable a computer to execute the text matching method described in the first aspect above.
[0050] The text matching method, text matching device, electronic device and storage medium proposed in the present application receive a text search request, wherein the text search request includes the text to be matched. In order to improve the accuracy and efficiency of the model in matching and identifying text sentences, the text pattern matching is performed on the text to be matched to obtain at least one candidate sentence text, and the similarity between each candidate sentence text and the text to be matched is calculated using a preset text matching model to obtain the first candidate matching score corresponding to each candidate sentence text. In order to output the text sentence that best matches the text to be matched, at least one candidate sentence text is screened for the first text according to the first candidate matching score corresponding to each candidate sentence text, and the target sentence text and the target scene corresponding to the target sentence text are obtained. In order to ensure that a text sentence similar to the text to be matched can be matched, when the target sentence text is not matched according to the first text screening, the FastText model is used to calculate the similarity between each candidate sentence text and the text to be matched, and the second candidate matching score corresponding to each candidate sentence text is obtained, and the candidate sentence text is screened for the second text according to the second candidate matching score to obtain the target sentence text and the target scene corresponding to the target sentence text. The target sentence text is matched with the corresponding speech text in the speech text library preset in the target scene, and a conversation is conducted with the user according to the voice corresponding to the speech text. This application can improve the accuracy and efficiency of text sentence matching recognition and reduce the labor cost of voice outbound calls by returning the target sentence text corresponding to the text to be matched and its corresponding target scene. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 is a flowchart of a text matching method provided in an embodiment of the present application;
[0052] Figure 2 yes Figure 1 Flow chart of step S120 in FIG.
[0053] Figure 3 is a flowchart of a training text matching model provided in an embodiment of the present application;
[0054] Figure 4 yes Figure 3 Flow chart of step S320 in FIG.
[0055] Figure 5 yes Figure 1 Flow chart of step S140 in FIG.
[0056] Figure 6 yes Figure 1 Flow chart of step S160 in FIG.
[0057] Figure 7 is a structural diagram of a text matching device provided in an embodiment of the present application;
[0058] Figure 8 It is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0059] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0060] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0061] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0062] First, some nouns involved in this application are analyzed:
[0063] Artificial Intelligence (AI): It is a new technical science that studies and develops theories, methods, technologies and application systems for simulating, extending and expanding human intelligence. AI is a branch of computer science. AI attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Research in this field includes robots, language recognition, image recognition, natural language processing and expert systems. AI can simulate the information process of human consciousness and thinking. AI is also a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0064] Natural language processing (NLP): NLP uses computers to process, understand and apply human languages (such as Chinese, English, etc.). NLP is a branch of artificial intelligence and an interdisciplinary subject between computer science and linguistics. It is often referred to as computational linguistics. Natural language processing includes grammatical analysis, semantic analysis, and text understanding. Natural language processing is often used in technical fields such as machine translation, handwritten and printed character recognition, speech recognition and text-to-speech conversion, information intent recognition, information extraction and filtering, text classification and clustering, public opinion analysis and opinion mining. It involves data mining related to language processing, machine learning, knowledge acquisition, knowledge engineering, artificial intelligence research, and linguistic research related to language computing.
[0065] TextCNN (Text Classification Neural Network): The TextCNN model is a model proposed by Yoon Kim in the paper Convolutional Naural Networks for Sentence Classification that uses convolutional neural networks to handle NLP problems. Compared with traditional RNN / LSTM models in NLP, TextCNN can extract important features more efficiently.
[0066] Bert (Bidirectional Encoder Representation from Transformers) model: The Bert model further increases the generalization ability of the word vector model, fully describes the characteristics of character level, word level, sentence level and even inter-sentence relationship, and is built based on Transformer. There are three types of Embedding in Bert, namely Token Embedding, Segment Embedding, and Position Embedding; Token Embeddings are word vectors, and the first word is the CLS mark, which can be used for subsequent classification tasks; Segment Embeddings are used to distinguish between two sentences, because pre-training not only does LM but also does classification tasks with two sentences as input; Position Embedding, the position word vector here is not the trigonometric function in Transfor, but is learned by Bert through training. However, Bert directly trains a Position Embedding to retain the position information, randomly initializes a vector for each position, adds model training, and finally obtains an Embedding containing position information. Finally, in the combination of this Position Embedding and Word Embedding, Bert chooses direct splicing.
[0067] Automatic Speech Recognition (ASR): Automatic speech recognition is a technology that converts human speech into text. The input of speech recognition is generally a speech signal in the time domain, mathematically represented by a series of vectors to represent the signal length (length T) and dimension (dimension d). The output of this automatic semantic recognition technology is text, represented by a series of tokens to represent the field length (length N) and different tokens.
[0068] ES (Elastic Search, ES) is a distributed, highly scalable, and highly real-time search and data analysis engine. It can easily enable the search, analysis, and exploration of large amounts of data. Taking full advantage of the horizontal scalability of ES can make data more valuable in the production environment. The implementation principle of the ES search engine is mainly divided into the following steps. First, the user submits the data to the ES database, and then the corresponding sentence is segmented through the word segmentation controller, and its weight and word segmentation results are stored in the data. When the user searches for data, the results are ranked and scored according to the weight, and then the returned results are presented to the user.
[0069] At present, when enterprises are promoting existing products, they will inevitably encounter business functions such as after-sales service and customer service communication. As the number of users increases and the product range becomes larger, they will need to deal with a large number of users' questions about products and after-sales problems, but relying solely on manual voice outbound operations will reduce the work efficiency of enterprises.
[0070] Intelligent voice outbound calls using question similarity matching methods are an important research in the field of artificial intelligence. For example, in the field of insurance applications, many methods or algorithms involving sentence similarity matching are needed, such as accurately matching similar sentences to questions raised by users. However, traditional methods for calculating sentence similarity include: using the TextCNN model to calculate the vector of the sentence, and then using the twin tower model to calculate the interactive information between sentences, and then calculating the similarity between sentences; or using Bert as the basic model to calculate the vector of the sentence, and then using the twin tower model to calculate the interactive information between sentences, and then calculating the similarity between sentences. Although the use of the Bert model improves the accuracy of sentence similarity calculation, its slow prediction speed limits its application in industrial scenarios and reduces user experience satisfaction.
[0071] Based on this, the embodiments of the present application provide a text matching method, a text matching device, an electronic device and a storage medium, which can improve the accuracy and efficiency of text sentence matching and recognition, and reduce the labor cost of voice outbound calls.
[0072] The text matching method, text matching device, electronic device and storage medium provided in the embodiments of the present application are specifically illustrated through the following embodiments. First, the text matching method in the embodiments of the present application is described.
[0073] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0074] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0075] The text matching method provided in the embodiment of the present application relates to the field of artificial intelligence technology. The text matching method provided in the embodiment of the present application can be applied to a terminal, can be applied to a server side, or can be software running in a terminal or a server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.; the server side can be configured as an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application that implements the text matching method, etc., but is not limited to the above forms.
[0076] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0077] See also Figure 1 , Figure 1 is an optional flowchart of the text matching method provided in the embodiment of the present application. Figure 1 The method may include but is not limited to steps S110 to S170.
[0078] Step S110, receiving a text search request; wherein the text search request includes text to be matched;
[0079] Step S120, performing text pattern matching on the text to be matched to obtain at least one candidate sentence text;
[0080] Step S130, using a preset text matching model to respectively calculate the similarity between each candidate sentence text and the text to be matched, and obtain a first candidate matching score corresponding to each candidate sentence text;
[0081] Step S140, performing a first text screening on at least one candidate sentence text according to the first candidate matching score corresponding to each candidate sentence text, to obtain a target sentence text and a target scene corresponding to the target sentence text;
[0082] Step S150, when the target sentence text is not matched according to the first text screening, the FastText model is used to calculate the similarity between each candidate sentence text and the text to be matched, and a second candidate matching score corresponding to each candidate sentence text is obtained;
[0083] Step S160, performing a second text screening on the candidate sentence texts according to the second candidate matching scores to obtain a target sentence text and a target scene corresponding to the target sentence text;
[0084] Step S170, matching the target sentence text with the corresponding speech text in the speech text library preset for the target scenario, and conducting a conversation with the user based on the voice corresponding to the speech text.
[0085] Steps S110 to S170 of the embodiment of the present application receive the text to be matched in the text search request to identify the user's intention based on the text to be matched. In order to improve the accuracy and efficiency of the model in matching and identifying the text to be matched, the text to be matched is subjected to text pattern matching to obtain at least one candidate sentence text, and the similarity between each candidate sentence text and the text to be matched is calculated using a preset text matching model to obtain the first candidate matching score corresponding to each candidate sentence text, that is, the correlation between different candidate sentence texts and the text to be matched can be clearly determined by the obtained first candidate matching score, and then the target sentence text can be matched from the candidate sentence text. In order to output the text sentence that best matches the text to be matched, at least one candidate sentence text is subjected to a first text screening according to the first candidate matching score corresponding to each candidate sentence text to obtain the target sentence text and the target scene corresponding to the target sentence text. In order to ensure that the embodiment of the present application can determine that a text sentence similar to the text to be matched can be matched, when the target sentence text is not matched according to the first text screening, the FastText model is used as a fallback operation to calculate the similarity between each candidate sentence text and the text to be matched, and obtain the second candidate matching score corresponding to each candidate sentence text, and perform a second text screening on the candidate sentence text according to the second candidate matching score to obtain the target sentence text and the target scene corresponding to the target sentence text. In order to effectively implement the application of the embodiment of the present application in actual scenarios, the target sentence text is matched with the corresponding speech text in the speech text library preset in the target scenario, and a conversation is conducted with the user according to the voice corresponding to the speech text. The present application realizes the intention recognition of the text to be matched related to the user by returning the target sentence text corresponding to the text to be matched and its corresponding target scene, which can improve the accuracy and efficiency of text sentence matching recognition and reduce the manpower cost of voice outbound calls.
[0086] In step S110 of some embodiments, when the text matching service is started, a text search request is received, the text search request includes the text to be matched, wherein receiving the text search request means that when the user answers or asks questions by voice, the text matching device that implements the text matching method can use ASR or NLP technology to parse and process the received voice information.
[0087] It should be noted that the text to be matched also includes the corresponding question text information entered by the user according to the voice prompt. For example, when making an actual intelligent automatic outbound call, the user can enter the corresponding question text information after receiving the corresponding voice prompt. The corresponding question can be entered by editing text or by voice, without restriction.
[0088] In step S120 of some embodiments, in order to improve the accuracy of text sentence matching and recognition, text pattern matching is performed on the text to be matched to obtain at least one candidate sentence text, and then the target text sentence is obtained through similarity matching among the obtained multiple candidate sentence texts. It should be noted that in order to avoid affecting the efficiency of text sentence matching and recognition due to the excessive number of obtained candidate sentence texts, the at least one obtained candidate sentence text can be arranged in descending order according to the corresponding matching value after text pattern matching. At the same time, a quantity threshold can be set. For example, if the selected quantity threshold is 50, 50 candidate sentence texts with higher matching values are selected for similar text matching to improve the efficiency of text sentence matching and recognition. Among them, the quantity threshold is an integer value greater than or equal to 1, and is not specifically limited here.
[0089] In step S130 of some embodiments, after matching at least one candidate sentence text, in order to effectively compare the correlation between the text to be matched and the candidate sentence text, a preset text matching model is used to calculate the similarity between each candidate sentence text and the text to be matched, and a first candidate matching score corresponding to each candidate sentence text is obtained. Then, the correlation between different candidate sentence texts and the text to be matched is determined through the obtained first candidate matching score, and the target sentence text is matched from the candidate sentence texts.
[0090] In step S140 of some embodiments, after obtaining the first candidate matching score corresponding to each candidate sentence text, in order to output the text sentence that best matches the text to be matched, all candidate sentence texts are subjected to first text screening according to the first candidate matching score to obtain the target sentence text and the target scene corresponding to the target sentence text, wherein the target text sentence indicates a sentence text with a high degree of matching with the text to be matched. The first text screening is equivalent to the first text screening of at least one candidate sentence text obtained according to the preset first threshold, which can improve the accuracy of text sentence matching recognition.
[0091] In step S150 of some embodiments, when the target sentence text is not matched according to the first text screening, it is equivalent to that the first candidate matching score corresponding to at least one candidate sentence text is less than the preset first threshold. In order to ensure that the text matching of the text to be matched is output with results, the FastText model is used to calculate the similarity between each candidate sentence text and the text to be matched, and the second candidate matching score corresponding to each candidate sentence text is obtained, that is, the FastText model is used to calculate the similarity between the text to be matched and the candidate sentence text again, and the correlation between different candidate sentence texts and the text to be matched is determined by the obtained second candidate matching score, and then the target sentence text is matched from the candidate sentence text.
[0092] In step S160 of some embodiments, after obtaining the second candidate matching scores corresponding to each candidate sentence text, in order to output the text sentence that best matches the text to be matched, the candidate sentence text is subjected to a second text screening according to the second candidate matching scores to obtain the target sentence text and the target scene corresponding to the target sentence text. It should be noted that since the second text screening is performed when the first text screening does not match the target sentence text, the selection range of the second text screening is more limited than the selection range of the first text screening, that is, the second threshold corresponding to the second text screening is less than the first threshold of the first text screening.
[0093] In step S170 of some embodiments, in order to effectively realize intelligent automatic dialogue with the matched target sentence text, the target sentence text is matched with the corresponding speech text in the speech text library preset in the target scenario, and a dialogue is conducted with the user according to the voice corresponding to the speech text. Among them, the preset speech text library is a collection of speech texts pre-arranged according to the business scenario of actual application, and the speech text library includes the target scenario of application and multiple target sentence texts corresponding to the target scenario. After matching the target sentence text, the speech text corresponding to the target sentence text is matched in the speech text library preset in the target scenario, and a dialogue is conducted with the user according to the voice corresponding to the speech text.
[0094] It should be noted that the text matching method of the embodiment of the present application can be applied to different business scenarios, including but not limited to insurance marketing scenarios, insurance information collection scenarios, financial collection scenarios, financial marketing scenarios, alarm scenarios of various systems, CRM member marketing scenarios, and other business scenarios that require intelligent automatic outbound calls.
[0095] Please refer to Figure 2 , Figure 2 is a flowchart of a specific method of step S120 in some embodiments of the present application. In some embodiments of the present application, step S120 includes but is not limited to step S210 and step S220. Figure 2 These two steps are introduced in detail.
[0096] Step S210, performing rule matching on the text to be matched according to a preset rule template to obtain a target sentence text and a target scene corresponding to the target sentence text;
[0097] Step S220: When the target sentence text is not matched according to the rule template, a full pattern match is performed on the text to be matched to obtain at least one candidate sentence text, wherein the candidate sentence texts are arranged in descending order.
[0098] In some embodiments, in order to improve the efficiency and accuracy of text sentence matching recognition, first, the matching text is matched according to the preset rule template, which is equivalent to performing preliminary text matching on the matching text. Specifically, the matching text can be searched and matched by ES, that is, the matching text is recalled based on matching algorithms such as BM25, and further coarse and fine sorting is performed to obtain the search matching score at this time. For example, the preset rule template can use ES to match the matching text for full mode matching, wherein the full mode matching refers to matching word by word according to the specific text in the text to be matched, specifically, assuming that the text to be matched is "We go to ABC today" (ABC is a place), when the full mode matching is performed by ES, when the matching text is completely matched with the text to be matched, the corresponding target sentence text and its corresponding target scene are directly obtained; and when the matching text is not completely matched with the text to be matched, that is, the matching text contains the words and sentences in the text to be matched, such as "We go to ABC", "Go to ABC" and other sentences, then the matching text is the candidate sentence text. According to the ES search match, the search match score corresponding to each candidate sentence text can be returned, and at the same time, the obtained at least one candidate sentence text is sorted in descending order according to the corresponding search match score.
[0099] It should be noted that the text to be matched can be matched according to a preset rule template, or it can be set to extract keywords from the text to be matched, determine the semantic information of the text to be matched, and then match the corresponding candidate sentence text according to the set semantic rules.
[0100] Please refer to Figure 3 , Figure 3 is another optional flow chart of the text matching method provided in some embodiments of the present application. In some embodiments of the present application, the text matching method further includes building a preset text matching model, wherein the training process of the text matching model specifically includes but is not limited to steps S310 to S340. Figure 3 These four steps are introduced in detail.
[0101] Step S310, obtaining first training sample data;
[0102] Step S320, using the first training sample data to perform model training on the Bert teacher model to obtain a sample training model;
[0103] Step S330, constructing second training sample data according to the training result of the sample training model;
[0104] Step S340, using the second training sample data to perform model training on the student model to obtain a text matching model, wherein the student model includes an Esim model or a TextCNN model.
[0105] In some embodiments, in order to improve the accuracy and efficiency of text sentence matching recognition and reduce the running time of the model, a text matching model is constructed by using a teacher model and a student model. First, a first training sample data is obtained, and the first training sample data can be historical speech text matching data, wherein the historical speech text matching data includes historical text to be matched, historical target sentence text, historical target scene, etc. The Bert teacher model is trained using the first training sample data, and the parameters of the Bert teacher model are continuously adjusted to obtain a sample training model with better effect according to the first training sample data. Afterwards, the training results of the Bert teacher model are used to construct a second training sample data, and the second training sample data is used to train the Esim student model or the TextCNN student model. By continuously adjusting the parameters of the Esim model or the TextCNN model student model, a text matching model with higher recognition accuracy is obtained, and the text matching model is used to implement the text matching method of the embodiment of the present application.
[0106] Please refer to Figure 4 , Figure 4 is a flowchart of a specific method of step S320 in some embodiments of the present application. In some embodiments of the present application, step S320 includes but is not limited to steps S410 to S440. Figure 4 These four steps are introduced in detail.
[0107] Step S410, using the first training sample data to perform model training on the Bert teacher model to obtain a model output vector;
[0108] Step S420, performing a whitening operation on the model output vector to obtain a whitening matrix vector;
[0109] Step S430, normalizing the model output vector to obtain a normalized vector;
[0110] Step S440, performing sample similarity calculation based on the whitening matrix vector and the normalized vector, and determining the sample training model when the result of the sample similarity calculation meets the preset accuracy condition.
[0111] In some embodiments, in order to better improve the accuracy of text sentence matching recognition, the quality and accuracy of the obtained text matching model can be improved by improving the Bert teacher model. The Bert teacher model is trained using the first training sample data. After obtaining the model output vector, the model output vector is whitened to obtain a whitened matrix vector, wherein the whitening operation causes the output whitened matrix vector to become a Gaussian distribution, and the variance in each dimension is the same. The model output vector is normalized to obtain a normalized vector, and sample similarity is calculated based on the whitened matrix vector and the normalized vector to obtain a corresponding similarity value. Specifically, the weighting coefficients corresponding to the whitened matrix vector and the normalized vector are set respectively to obtain the final vector corresponding to the input text data, and the sample similarity is calculated by calculating the final vectors of different text data, wherein a collaborative filtering algorithm such as a cosine similarity algorithm can be used to perform similarity calculation on the final vectors output by the text to be matched and the candidate sentence text. When the similarity value calculated by similarity meets the preset accuracy condition, the accuracy condition is used to indicate the minimum threshold that the result of the Bert teacher model output meets, and the threshold is a preset value between 0 and 1, thereby determining the sample training model. Based on the Bert teacher model, the present application optimizes the output vector of the Bert teacher model through whitening and normalization operations, so as to improve the recognition accuracy of the sample training model while not reducing the overall performance of the sample training model.
[0112] Please refer to Figure 5 , Figure 5 is a flowchart of a specific method of step S140 in some embodiments of the present application. In some embodiments of the present application, step S140 includes but is not limited to step S510 and step S520. Figure 5 These two steps are introduced in detail.
[0113] Step S510, comparing the first candidate matching score with a preset first threshold;
[0114] Step S520: When the first candidate matching score corresponding to the candidate sentence text is greater than the first threshold, the corresponding candidate sentence text is used as the target sentence text, and the target scene corresponding to the target sentence text is obtained.
[0115] In some embodiments, in order to output the text sentence that best matches the text to be matched, by comparing the size relationship between the first candidate matching score and the preset first threshold, when the first candidate matching score corresponding to the candidate sentence text is greater than the first threshold, the corresponding candidate sentence text is used as the target sentence text, and the target scene corresponding to the target sentence text is obtained. Among them, the preset first threshold can be set according to actual conditions, and the first threshold is any value between 0 and 100, without limitation.
[0116] In some embodiments of the present application, step S520 includes: when multiple first candidate matching scores are greater than a first threshold, arranging the multiple first candidate matching scores in descending numerical order, taking the candidate sentence text corresponding to the first candidate matching score in the first numerical descending order as the target sentence text, and obtaining the target scene corresponding to the target sentence text.
[0117] In some embodiments, in order to avoid too many candidate sentence texts being matched and affecting the efficiency of text matching and recognition, in some specific scenarios, when multiple first candidate matching scores are greater than a first threshold, the multiple first candidate matching scores are arranged in descending order, and the candidate sentence texts corresponding to the first five larger first candidate matching scores after the numerical descending order are selected, and then the five candidate sentence texts are subjected to overall matching analysis and comparison, and the candidate sentence text corresponding to the first candidate matching score in the numerical descending order is taken as the target sentence text, and the target scene corresponding to the target sentence text is obtained. This application realizes the intention recognition of the text to be matched related to the user by returning the target sentence text corresponding to the text to be matched and its corresponding target scene, which can improve the accuracy and efficiency of text sentence matching and recognition and reduce the manpower cost of voice outbound calls.
[0118] Please refer to Figure 6 , Figure 6 is a flowchart of a specific method of step S160 in some embodiments of the present application. In some embodiments of the present application, step S160 includes but is not limited to steps S610 to S640. Figure 6 These four steps are introduced in detail.
[0119] Step S610, comparing the second candidate matching score with a preset second threshold; wherein the second threshold is smaller than the first threshold;
[0120] Step S620, when the second candidate matching score corresponding to the candidate sentence text is greater than the second threshold, the corresponding candidate sentence text is used as the target sentence text, and the target scene corresponding to the target sentence text is obtained;
[0121] Step S630, when the second candidate matching score corresponding to each candidate sentence text is less than or equal to the second threshold, updating the second threshold, wherein the updated second threshold is less than the second threshold before the update;
[0122] Step S640: When the second candidate matching score corresponding to the candidate sentence text is greater than the updated second threshold, the corresponding candidate sentence text is used as the target sentence text, and the target scene corresponding to the target sentence text is obtained.
[0123] In some embodiments, when the target sentence text is not matched according to the first text screening, it is equivalent to that the first candidate matching scores corresponding to the candidate sentence texts are all less than the preset first threshold. In order to ensure that the text matching of the text to be matched is output with results, the FastText model is used to calculate the similarity between each candidate sentence text and the text to be matched, and the second candidate matching scores corresponding to each candidate sentence text are obtained. The second candidate matching scores and the preset second threshold are compared, wherein the second threshold is less than the first threshold, and the preset second threshold can be set according to the actual situation. The second threshold is any value between 0 and 100, without specific restrictions. When the second candidate matching score corresponding to the candidate sentence text is greater than the second threshold, the corresponding candidate sentence text is used as the target sentence text, and the target scene corresponding to the target sentence text is obtained. When the second candidate matching score corresponding to each candidate sentence text is less than or equal to the second threshold, the second threshold is updated, wherein the updated second threshold is less than the second threshold before the update, and when the second candidate matching score corresponding to the candidate sentence text is greater than the updated second threshold, the corresponding candidate sentence text is used as the target sentence text, and the target scene corresponding to the target sentence text is obtained. It should be noted that in order to ensure that the text matching of the text to be matched is output with results, the embodiment of the present application will continuously adjust the second threshold to obtain the target sentence text corresponding to the text to be matched and its corresponding target scene.
[0124] The text matching method, text matching device, electronic device and storage medium of the embodiment of the present application receive the text to be matched in the text search request to identify the user's intention based on the text to be matched. In order to improve the accuracy and efficiency of the model in matching and identifying the text to be matched, the text to be matched is subjected to text pattern matching to obtain at least one candidate sentence text, and the similarity between each candidate sentence text and the text to be matched is calculated using a preset text matching model to obtain the first candidate matching score corresponding to each candidate sentence text, that is, the correlation between different candidate sentence texts and the text to be matched can be clearly determined by the obtained first candidate matching score, and then the target sentence text can be matched from the candidate sentence text. In order to output the text sentence that best matches the text to be matched, at least one candidate sentence text is subjected to a first text screening according to the first candidate matching score corresponding to each candidate sentence text to obtain the target sentence text and the target scene corresponding to the target sentence text. In order to ensure that the embodiment of the present application can match the text sentence similar to the text to be matched, when the target sentence text is not matched according to the first text screening, the FastText model is used as a bottom-up operation to calculate the similarity between each candidate sentence text and the text to be matched, and obtain the second candidate matching score corresponding to each candidate sentence text, and the candidate sentence text is screened for the second text according to the second candidate matching score to obtain the target sentence text and the target scene corresponding to the target sentence text. In order to effectively implement the application of the embodiment of the present application in the actual scene, the target sentence text is matched with the corresponding speech text in the speech text library preset in the target scene, and the user is communicated according to the voice corresponding to the speech text. On the basis of the Bert teacher model, the present application optimizes the output vector of the Bert teacher model through whitening and normalization operations, so that the overall performance of the sample training model is not reduced, while improving the recognition accuracy of the sample training model, and then returning the target sentence text corresponding to the text to be matched and its corresponding target scene, realizing the intention recognition of the text to be matched related to the user, which can improve the accuracy and efficiency of text sentence matching recognition, and reduce the manpower cost of voice outbound calls.
[0125] Please refer to Figure 7 The embodiment of the present application also provides a text matching device, which can implement the above-mentioned text matching method. The device includes a search request acquisition module 710, a matching search module 720, a first similarity matching module 730, a first text screening module 740, a second similarity matching module 750, a second text screening module 760 and a voice dialogue module 770.
[0126] The search request acquisition module 710 is used to receive a text search request; wherein the text search request includes a text to be matched;
[0127] A matching search module 720, configured to perform text pattern matching on the text to be matched, and obtain at least one candidate sentence text;
[0128] The first similarity matching module 730 is used to calculate the similarity between each candidate sentence text and the text to be matched by using a preset text matching model, and obtain a first candidate matching score corresponding to each candidate sentence text;
[0129] A first text screening module 740 is used to perform a first text screening on at least one candidate sentence text according to the first candidate matching score corresponding to each candidate sentence text, to obtain a target sentence text and a target scene corresponding to the target sentence text;
[0130] The second similarity matching module 750 is used to calculate the similarity between each candidate sentence text and the to-be-matched text by using the FastText model when the target sentence text is not matched according to the first text screening, and obtain the second candidate matching score corresponding to each candidate sentence text;
[0131] A second text screening module 760 is used to perform a second text screening on the candidate sentence text according to the second candidate matching score to obtain a target sentence text and a target scene corresponding to the target sentence text;
[0132] The voice dialogue module 770 is used to match the target sentence text with the corresponding speech text in the speech text library preset in the target scenario, and to communicate with the user based on the voice corresponding to the speech text.
[0133] It should be noted that the text matching device of the embodiment of the present application is used to implement the above-mentioned text matching method. The text matching device of the embodiment of the present application corresponds to the above-mentioned text matching method. Please refer to the above-mentioned text matching method for the specific processing process, which will not be repeated here.
[0134] The embodiment of the present application also provides an electronic device, which includes: at least one memory, at least one processor, and at least one computer program, wherein the at least one computer program is stored in the at least one memory, and the at least one processor executes the at least one computer program to implement any of the text matching methods in the above embodiments. The electronic device can be any intelligent terminal including a tablet computer, a car computer, etc.
[0135] Please refer to Figure 8 , Figure 8 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:
[0136] The processor 810 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;
[0137] The memory 820 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 820 can store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 820, and the processor 810 calls and executes the text matching method of the embodiment of this application;
[0138] Input / output interface 830, used to implement information input and output;
[0139] The communication interface 840 is used to realize the communication interaction between the device and other devices. The communication can be realized through a wired manner (such as USB, network cable, etc.) or a wireless manner (such as mobile network, WIFI, Bluetooth, etc.);
[0140] bus 850 , which transmits information between the various components of the device (e.g., processor 810 , memory 820 , input / output interface 830 , and communication interface 840 );
[0141] The processor 810 , the memory 820 , the input / output interface 830 and the communication interface 840 are connected to each other in communication within the device via a bus 850 .
[0142] An embodiment of the present application further provides a storage medium, which is a computer-readable storage medium. The computer-readable storage medium stores a computer program, and the computer program is used to enable a computer to execute any one of the text matching methods in the above embodiments.
[0143] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0144] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0145] It can be understood by those skilled in the art that Figures 1 to 6 The technical solutions shown in the figure do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than those shown in the figure, or a combination of certain steps, or different steps.
[0146] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0147] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0148] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0149] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0150] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0151] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0152] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0153] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.
[0154] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.
Claims
1. A text matching method, characterized in that: The method comprises: Receiving a text search request; wherein the text search request includes text to be matched; Performing text pattern matching on the text to be matched to obtain at least one candidate sentence text; The preset text matching model is used to respectively calculate the similarity between each candidate sentence text and the text to be matched, and obtain the first candidate matching score corresponding to each candidate sentence text; wherein the text matching model is trained by the following steps: obtaining the first training sample data; using the first training sample data to perform model training on the Bert teacher model to obtain the sample training model; constructing the second training sample data according to the training result of the sample training model; using the second training sample data to perform model training on the student model to obtain the text matching model, wherein the student model includes the Esim model or the TextCNN model; the using The first training sample data performs model training on the Bert teacher model to obtain a sample training model, including: using the first training sample data to perform model training on the Bert teacher model to obtain a model output vector; performing a whitening operation on the model output vector to obtain a whitened matrix vector, wherein the whitening operation causes the output whitened matrix vector to become a Gaussian distribution, and the variance in each dimension is the same; performing a normalization operation on the model output vector to obtain a normalized vector; performing sample similarity calculation based on the whitened matrix vector and the normalized vector, and when the result of the sample similarity calculation meets a preset accuracy condition, determining the sample training model; According to the first candidate matching scores corresponding to the respective candidate sentence texts, performing a first text screening on the at least one candidate sentence text to obtain a target sentence text and a target scene corresponding to the target sentence text; When the target sentence text is not matched according to the first text screening, the FastText model is used to calculate the similarity between each of the candidate sentence texts and the text to be matched, and a second candidate matching score corresponding to each of the candidate sentence texts is obtained; Performing a second text screening on the candidate sentence text according to the second candidate matching score to obtain the target sentence text and the target scene corresponding to the target sentence text; The target sentence text is matched with a corresponding speech text in the speech text library preset in the target scenario, and a conversation is conducted with the user according to the voice corresponding to the speech text.
2. The text matching method according to claim 1, characterized in that: The performing text pattern matching on the text to be matched to obtain at least one candidate sentence text includes: Performing rule matching on the text to be matched according to a preset rule template to obtain a target sentence text and a target scene corresponding to the target sentence text; When the target sentence text is not matched according to the rule template, full pattern matching is performed on the text to be matched to obtain at least one candidate sentence text, wherein the candidate sentence texts are arranged in descending order.
3. The text matching method according to any one of claims 1 to 2, characterized in that: The first text screening of the at least one candidate sentence text according to the first candidate matching score corresponding to each of the candidate sentence texts to obtain a target sentence text and a target scene corresponding to the target sentence text includes: Comparing the first candidate matching score with a preset first threshold; When the first candidate matching score corresponding to the candidate sentence text is greater than the first threshold, the corresponding candidate sentence text is used as the target sentence text, and the target scene corresponding to the target sentence text is obtained.
4. The text matching method according to claim 3, characterized in that: When the first candidate matching score corresponding to the candidate sentence text is greater than the first threshold, the corresponding candidate sentence text is used as the target sentence text, and a target scene corresponding to the target sentence text is obtained, including: When multiple first candidate matching scores are greater than the first threshold, the multiple first candidate matching scores are arranged in descending numerical order, the candidate sentence text corresponding to the first first candidate matching score in the descending numerical order is used as the target sentence text, and the target scene corresponding to the target sentence text is obtained.
5. The text matching method according to claim 3, characterized in that: The performing a second text screening on the candidate sentence text according to the second candidate matching score to obtain the target sentence text and the target scene corresponding to the target sentence text includes: Comparing the second candidate matching score with a preset second threshold; wherein the second threshold is less than the first threshold; When the second candidate matching score corresponding to the candidate sentence text is greater than the second threshold, the corresponding candidate sentence text is used as the target sentence text, and the target scene corresponding to the target sentence text is obtained; When the second candidate matching score corresponding to each of the candidate sentence texts is less than or equal to the second threshold, updating the second threshold, wherein the updated second threshold is less than the second threshold before updating; When the second candidate matching score corresponding to the candidate sentence text is greater than the updated second threshold, the corresponding candidate sentence text is used as the target sentence text, and the target scene corresponding to the target sentence text is obtained.
6. A text matching device, characterized in that: The device comprises: A search request acquisition module, used to receive a text search request; wherein the text search request includes a text to be matched; A matching search module, used for performing text pattern matching on the text to be matched to obtain at least one candidate sentence text; The first similarity matching module is used to use a preset text matching model to respectively calculate the similarity between each candidate sentence text and the text to be matched, and obtain a first candidate matching score corresponding to each candidate sentence text; wherein the text matching model is trained by the following steps: obtaining first training sample data; using the first training sample data to perform model training on the Bert teacher model to obtain a sample training model; constructing second training sample data according to the training result of the sample training model; using the second training sample data to perform model training on the student model to obtain the text matching model, wherein the student model includes an Esim model or a TextCNN model Model; the Bert teacher model is trained using the first training sample data to obtain a sample training model, including: the Bert teacher model is trained using the first training sample data to obtain a model output vector; the model output vector is whitened to obtain a whitened matrix vector, the whitening operation makes the output whitened matrix vector become a Gaussian distribution, and the variance in each dimension is the same; the model output vector is normalized to obtain a normalized vector; sample similarity calculation is performed based on the whitened matrix vector and the normalized vector, and when the result of the sample similarity calculation meets the preset accuracy condition, the sample training model is determined; A first text screening module, configured to perform a first text screening on the at least one candidate sentence text according to the first candidate matching score corresponding to each of the candidate sentence texts, to obtain a target sentence text and a target scene corresponding to the target sentence text; A second similarity matching module is used to calculate the similarity between each of the candidate sentence texts and the text to be matched by using the FastText model when the target sentence text is not matched according to the first text screening, so as to obtain a second candidate matching score corresponding to each of the candidate sentence texts; A second text screening module, configured to perform a second text screening on the candidate sentence text according to the second candidate matching score to obtain the target sentence text and the target scene corresponding to the target sentence text; The voice dialogue module is used to match the target sentence text with the corresponding speech text in the speech text library preset in the target scenario, and to communicate with the user based on the voice corresponding to the speech text.
7. An electronic device, characterized in that include: at least one memory; at least one processor; at least one computer program; The at least one computer program is stored in the at least one memory, and the at least one processor executes the at least one computer program to implement: A text matching method as claimed in any one of claims 1 to 5.
8. Storage medium, the storage medium being a computer-readable storage medium, characterized in that: The computer readable storage medium stores a computer program, and the computer program is used to cause a computer to execute: The text matching method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Intention identification method and device, computer equipment, and computer-readable storage medium
CN113672696A