Text query method, device, electronic device and storage medium
By introducing hierarchical identification and target similarity text recommendation models into the intelligent question-answering system, and combining it with positive and negative training sample pair training, the problem of insufficient understanding of query statements with different expressions by the intelligent question-answering system is solved, and more accurate text expansion and response are achieved.
Patent Information
- Application Number
- CN202110702405.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-24
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2041-06-24
AI Technical Summary
Existing intelligent question-answering systems are unable to accurately understand the text semantics when faced with semantically identical query statements in different forms of expression, resulting in reduced response accuracy. In addition, the extended text information output by the seq2seq model is highly similar to the original query text information and lacks rational expansion.
The target object’s level identification is introduced, and the target extended text information with the same semantics and similarity to the original query text information is obtained through the trained target similarity text recommendation model. The model is trained by combining positive and negative training sample pairs to improve the richness and accuracy of the extended text information.
The response accuracy and service quality of the intelligent question-answering system have been improved. It can accurately understand query texts with the same semantics but different expressions, improves its intelligence level, and avoids duplicate recommendations and empty results.
Smart Images

Figure CN115525741B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology and discloses a text query method, device, electronic device and storage medium. Background Art
[0002] With the development of deep learning, calling interfaces of intelligent question-answering systems have been set up in various applications and are widely used in human-computer interaction scenarios.
[0003] In real life, text with the same meaning can be expressed in many different ways. For example, "How's the weather today?" and "Let me introduce today's weather" both express the same weather. Consequently, in intelligent question-answering systems, if the textual representation of the question-answer corpus is relatively simple, when receiving queries with the same semantics but in other forms, the system will be unable to accurately understand the textual semantics of the query and, therefore, be unable to respond accurately. Therefore, expanding the textual representation of semantically identical question-answer corpora in intelligent question-answering systems is a key technology for human-computer interaction.
[0004] Currently, in intelligent question-answering systems, the expansion process of question-answering corpus is as follows: based on the original query text information input by the target object, a seq2seq model is used to output multiple semantically identical extended text information. The target object selects the target extended text information from the multiple extended text information and saves it.
[0005] However, since the extended text information output by the seq2seq model is mostly based on the generalization results obtained by the maximum likelihood method, there is still a high text similarity between the extended text information obtained by the seq2seq model and the original query text information.
[0006] For example, the original query text information input by the target object is "poems about lotus", and the extended text information output by the intelligent question-answering system for the target object is {"What are the poems about lotus", "Poems related to lotus", ...}.
[0007] Obviously, since the original query text information and the expanded text information are too similar, the above method fails to achieve a reasonable expansion of the question and answer corpus. As a result, there is still a problem that the intelligent question and answer system cannot accurately understand the text semantics of the query statement, which to a certain extent affects the response accuracy of the intelligent question and answer system and reduces the service quality of the intelligent question and answer system. Summary of the Invention
[0008] The embodiments of the present application provide a text query method, device, electronic device, and storage medium to improve the richness of the expression form of extended text information, thereby improving the response accuracy of the intelligent question-answering system.
[0009] In a first aspect, an embodiment of the present application provides a text query method, the method comprising:
[0010] In response to a query request sent by a target object, obtaining original query text information carried in the query request and a level identifier of the target object; the level identifier is used to indicate a level of similarity in expression between the original query text information and the target extended text information;
[0011] Based on the level identifier, a trained target similar text recommendation model is used to obtain target extended text information that meets the expression similarity level and has the same semantics as the original query text information; wherein the target similar text recommendation model is obtained by training based on multiple training sample pairs associated with each preset level identifier;
[0012] Based on the obtained target extended text information, corresponding query results are obtained, and the query results are sent to the target object for display.
[0013] In a second aspect, an embodiment of the present application provides a text query device, including:
[0014] a response module, configured to respond to a query request sent by a target object and obtain the original query text information carried in the query request and a level identifier of the target object; the level identifier is used to indicate the level of similarity in expression between the original query text information and the target extended text information;
[0015] An acquisition module is configured to use a trained target similarity text recommendation model based on the level identifier to obtain target extended text information that meets the expression similarity level and has the same semantics as the original query text information; wherein the target similarity text recommendation model is obtained by training based on multiple training sample pairs associated with each preset level identifier;
[0016] The query module is used to obtain corresponding query results based on the obtained target extended text information, and send the query results to the target object for display.
[0017] Optionally, the device further includes:
[0018] A sample acquisition module is used to obtain a preset set of training sample pairs, wherein each training sample pair includes a sample query text information and a real extended text information;
[0019] A sample identification module, configured to mark corresponding level identifications for each training sample pair included in the training sample pair set;
[0020] The model training module is configured to iteratively train the similar text recommendation model to be trained based on the training sample pair set until a preset convergence condition is met, and use the similar text recommendation model output in the last round as the target similar text recommendation model, wherein the following operations are performed during one round of iteration:
[0021] Inputting each training sample pair extracted from the training sample pair set and the corresponding level identifier into the similar text recommendation model to be trained, and obtaining predicted extended text information with the same semantics corresponding to each sample query text information based on each sample query text information and the corresponding level identifier in each training sample pair;
[0022] Determining the similarity loss value of each training sample pair based on the predicted extended text information and the actual extended text information corresponding to each sample query text information;
[0023] Based on the obtained similarity loss values, parameters of the similar text recommendation model to be trained are adjusted.
[0024] Optionally, the training sample pair set includes each positive training sample pair and each negative training sample pair, and the sample identification module is specifically configured to:
[0025] Based on the similarity of expression between the sample query text information and the real extended text information contained in each of the positive training sample pairs, marking the corresponding level identifier for each of the positive training sample pairs;
[0026] Marking each of the negative training sample pairs as a set level identifier;
[0027] The positive training sample pairs and the negative training sample pairs are set based on the recommendation results of the similar text recommendation model to be trained for each sample query text information.
[0028] Optionally, the sample identification module is specifically used to:
[0029] For each positive training sample pair, perform the following operations:
[0030] Determine the evaluation value corresponding to each preset evaluation indicator of a positive training sample pair;
[0031] Determining the expression form similarity corresponding to the one positive training sample pair based on each evaluation value obtained for the one positive training sample pair and each preset weight of the preset evaluation indicators;
[0032] Based on the similarity of the expression forms corresponding to the positive training sample pair, a corresponding level identifier is marked for the positive training sample pair.
[0033] Optionally, each preset evaluation indicator includes at least one of the following:
[0034] Character difference values between each pair of positive training samples and each corresponding real extended text information of the same sample query text information;
[0035] In each positive training sample pair, a character difference value between each sample query text information and the corresponding true extended text information;
[0036] In each positive training sample pair, the semantic similarity between each sample query text information and the corresponding real extended text information;
[0037] The semantic completeness of each true extended text information in each positive training sample pair.
[0038] Optionally, the sample acquisition module is further configured to:
[0039] Each positive training sample pair and each negative training sample pair in the training sample set are set respectively in the following manner:
[0040] Inputting a sample query text information into a similar text recommendation model, and obtaining each extended text information corresponding to the sample query text information based on the similar text recommendation model;
[0041] Presenting the respective extended text information to a reference subject, and in response to a selection operation of the reference subject, using the selected respective first extended text information as respective first true extended text information corresponding to the one sample query text information, and recording the one sample query information and the respective first true extended text information as corresponding positive training sample pairs;
[0042] And each unselected second extended text information is used as each second true extended text information corresponding to the one sample query text information, and the one sample query information and each second true extended text information are recorded as corresponding negative training sample pairs.
[0043] Optionally, the sample acquisition module is specifically configured to:
[0044] Based on the similar text recommendation model, using a preset first expansion method, performing a first expansion transformation process on the first N characters in the sample query text information to obtain first expansion transformation sequences corresponding to the first N characters, where N is a preset integer not less than 1;
[0045] Based on the similar text recommendation model, a preset second expansion method is adopted to perform second expansion transformation processing on the last M characters in the sample query text information and each first expansion transformation sequence until a preset end condition is met, thereby obtaining each extended text information corresponding to the sample query text information, wherein M is a preset integer not less than 1.
[0046] In a third aspect, an embodiment of the present application provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the method described in the first aspect when executing the program.
[0047] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions. When the computer instructions are executed on a computer, the computer executes the method described in the first aspect.
[0048] In an embodiment of the present application, a response is made to a query request sent by a target object, and based on the level identifier of the target object carried in the query request, a trained target similarity text recommendation model is used to obtain target extended text information that meets the expression similarity level with the original query text information carried in the query request and has the same semantics. Based on the obtained target extended text information, a corresponding query result is obtained and displayed to the target object. Among them, the level identifier is used to indicate the expression similarity level between the original query text information and the target extended text information. The higher the level identifier of the target object, the lower the expression similarity level between the target extended text information and the original query text information. In this way, the similarity of the expression of the target extended text information and the original query text information is correlated with the level identifier of the target object, thereby providing differentiated services for target objects of different levels. By expanding the original query text information with the target similarity text recommendation model, the intelligent question-answering system can accurately understand the extended text information that has the same semantics as the original query text information but a different expression form, and thus make a correct response. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 A schematic diagram of a method for expanding text information in related art;
[0050] Figure 2A A schematic diagram of an application scenario provided in an embodiment of the present application;
[0051] Figure 2B A schematic diagram of another application scenario provided by an embodiment of the present application;
[0052] Figure 3 A schematic diagram of a method for expanding text information provided in an embodiment of the present application;
[0053] Figure 4A A flowchart of generating a set of training sample pairs provided in an embodiment of the present application;
[0054] Figure 4B Schematic diagram of extended text information obtained based on the seq2seq model provided in an embodiment of the present application;
[0055] Figure 4C A flow chart of a method for obtaining extended text information provided in an embodiment of the present application;
[0056] Figure 4D Schematic diagram of the BS algorithm expansion transformation method provided in the embodiment of the present application;
[0057] Figure 4E Schematic diagram of the DBS algorithm expansion transformation method provided in the embodiment of the present application;
[0058] Figure 4F A schematic diagram of the extended transformation of the DBS algorithm and the BS algorithm provided in an embodiment of the present application;
[0059] Figure 5A Flowchart of the similar text recommendation model training method provided in the embodiment of the present application;
[0060] Figure 5B A flow chart of the sample identification method provided in an embodiment of the present application;
[0061] Figure 5C A flow chart of a method for identifying positive training sample pairs provided in an embodiment of the present application;
[0062] Figure 5D A flowchart of the iterative method for each round of the similar text recommendation model provided in an embodiment of the present application;
[0063] Figure 6 Schematic diagram of a method for determining the semantic similarity of training sample pairs using the Bert model provided in an embodiment of the present application;
[0064] Figure 7 A schematic diagram of the structure of the similar text recommendation model provided in an embodiment of the present application;
[0065] Figure 8 A schematic diagram of a method for generating extended text information provided in an embodiment of the present application;
[0066] Figure 9 An interface diagram for text expansion on a smart terminal provided in an embodiment of the present application;
[0067] Figure 10 This is an interface diagram of text expansion performed by the server provided in an embodiment of the present application;
[0068] Figure 11 A flowchart of a text query method provided in an embodiment of the present application;
[0069] Figure 12 This is an interface diagram of the method for responding to text queries provided by an intelligent terminal in an embodiment of the present application;
[0070] Figure 13 This is an interface diagram of the server response text query method provided in an embodiment of the present application;
[0071] Figure 14 A structural diagram of a text query device provided in an embodiment of the present application;
[0072] Figure 15 A structural diagram of an electronic device provided in an embodiment of the present application;
[0073] Figure 16 A structural diagram of a terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0074] In order to better understand the technical solutions provided by the embodiments of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0075] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention 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 numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes 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.
[0076] In order to help those skilled in the art better understand the technical solutions of the present application, the basic concepts involved in the present application are explained below.
[0077] 1) Question-Answering System
[0078] Question Answering System (QA): It is an advanced form of information retrieval system that can answer questions raised by users in natural language in an accurate and concise natural language. The main reason for the rise of QA system research is people's demand for fast and accurate information acquisition. Currently, QA system is a research direction in the field of artificial intelligence and natural language processing that has attracted much attention and has broad development prospects.
[0079] 2) Question Generation (QG): In natural language processing (NLP), it refers to generating a question based on a given text and a corresponding answer.
[0080] 3) Sequence to sequence (seq2seq) model
[0081] The seq2seq model is a type of encoder-decoder structure, in which one neural network acts as an encoder and the other neural network acts as a decoder. The encoder is responsible for compressing the input sequence into a vector of a specified length, which serves as the semantics of the input sequence. The decoder is responsible for converting the generated vector of a specified length into an output sequence. The embodiments of the present application do not impose any restrictive requirements on the structure of the neural network, including but not limited to Recurrent Neural Network (RNN), Convolutional Neural Networks (CNN), Long Short-Term Memory (LSTM), and Gated Recurrent Unit (GRU).
[0082] 4) Transformer Model
[0083] The Transformer model introduces the Attention mechanism, abandoning the inherent mode of the traditional encoder-decoder model that must be combined with CNN or RNN. Compared with the seq2seq model, it reduces the amount of computation, improves the efficiency of parallel operation, and also improves the accuracy of the operation results.
[0084] 5) Bidirectional Encoder Representations from Transformer (BERT) Model
[0085] The Bert model is an encoder network of a bidirectional Transformer. The goal of the Bert model is to use large-scale unlabeled corpus training to obtain a semantic representation of the text containing rich semantic information, and then fine-tune the semantic representation of the text in a specific NLP task, and finally apply it to the specific NLP task.
[0086] 6) Fine-tune
[0087] In downstream tasks, it is usually necessary to train the sample data corresponding to the specific downstream tasks to fine-tune the basic model parameters, and then apply the fine-tuned model to the specific downstream tasks.
[0088] 7) Natural Language Processing (NLP)
[0089] Natural language processing (NLP) is a key area of research in computer science and artificial intelligence. It studies the theories and methods that enable effective communication between humans and computers using natural language. Natural language processing (NLP) integrates linguistics, computer science, and mathematics. Therefore, research in this field involves natural language—the language we use in everyday life—and is closely linked to linguistics. NLP technologies typically include text processing, semantic understanding, machine translation, robotic question answering, and knowledge graphs.
[0090] The design concept of this application is described below.
[0091] In the development of question-answering (Q&A) systems, corpus is a crucial core asset. For each specific task domain, good corpus is essential for training a good model, ensuring that the model can recognize all the corpus belonging to that domain. For question-answering tasks, the more Q&A corpus available, the more intelligent the model will be, enabling it to answer a wide variety of questions.
[0092] There are two key aspects of question-and-answer corpora: the quantity of the corpus—the greater the quantity, the more intelligent the trained model. The quality of the corpus should encompass questions of various expressions. Of course, algorithms are also crucial for question-and-answer tasks. They enable similar questions to be recalled and, in turn, answer the subject's question. Therefore, the generalization performance of the algorithm plays a key role in the overall service quality of the intelligent question-and-answer system, and the algorithm requires the support of a large amount of high-quality corpus to train a good model. Therefore, the quantity and quality of the question-and-answer corpus play a decisive role in the end-to-end impact of the question-and-answer field and the subject's experience. High-quality corpus is particularly important for question-and-answer tasks.
[0093] In order to obtain more question-answering corpus (including questions and answers associated with the questions), the question-answering corpus can be expanded. Figure 1 shown; in Figure 1 In this paper, based on the existing parallel corpus pairs (q-q'), a seq2seq model is trained. Based on the trained seq2seq model, the text information (text to be generalized) input online by the target object is expanded and the expansion results are displayed. The expansion results selected by the target object are stored in the question-answering knowledge base, and the results not selected by the target object are put into the blacklist library, so that when the text information is expanded subsequently, the expansion results in the blacklist library are automatically filtered out.
[0094] use Figure 1 When the solution shown is expanded, there are at least the following problems:
[0095] 1) When training the seq2seq model, all parallel corpus pairs are used as positive training sample pairs, and no negative training sample pairs are combined. As a result, the trained seq2seq model itself does not have the ability to avoid negative training sample pairs and has poor intelligence.
[0096] 2) The seq2seq model expands the input text information based on the maximum likelihood method. It is very likely that the expression of the recommended expansion results is not much different from the input text information, and the seq2seq model itself does not distinguish the quality of the expansion results.
[0097] 3) It is unable to intelligently learn the unchecked extension results of the target object, and uses a blacklist library to store the unchecked extension results of the target object, so that the content in the library is not recommended. It is very likely that the extension result for a certain text information will be 0, and it does not have the closed-loop learning capability.
[0098] For example, for a target user's input text message A, the seq2seq model recommends the expansion result [A1, A2, A3, A4, A5]. However, the target user is dissatisfied with the results for A4 and A5 and selects only A1, A2, and A3. When A is expanded again, the recommended expansion result is still [A1, A2, A3, A4, A5], which appears unintelligent. To address this issue, related technologies blacklist A4 and A5, so that the next time a recommendation is made, the expansion result is [A1, A2, A3]. However, if the target user is dissatisfied with any of the expansion results for A and all A1-A5 are blacklisted, the next recommendation will likely result in no recommended results.
[0099] In view of this, embodiments of the present application provide a text query method, apparatus, device, and computer storage medium. Considering that the expression form of the extended text information recommended by the traditional seq2seq model is relatively simple, embodiments of the present application introduce a target object's level identifier. The higher the level identifier, the higher the level of similarity between the extended text information and the original query text information. Specifically, in response to a query request sent by a target object, the original query text information carried in the query request and the target object's level identifier are obtained. Based on the level identifier, a trained target similarity text recommendation model is used to obtain target extended text information that meets the expression form similarity level and has the same semantics as the original query text information. Based on the obtained target extended text information, corresponding query results are obtained and displayed. By associating the similarity between the expression form of the target extended text information and the original query text information with the target object's level identifier, the target object is encouraged to upgrade itself to improve the richness of the expression form of the target extended text information. When an intelligent question-answering system answers questions based on the rich expression form of the extended text information, it can accurately understand query texts that have the same semantics as the original query text information but different expression forms, thereby providing correct responses and improving the service quality of the intelligent question-answering system.
[0100] In addition, when the trained target similarity text recommendation model is used to expand the original query text information input by the target object, the unselected extended text information and the original query text information are combined into negative training sample pairs, so that the next time the recommendation is made, the negative training sample pairs can be accurately avoided, and new extended results of the original query text information can be intelligently recommended to the target object.
[0101] In order to more clearly understand the design ideas of this application, the following examples are given to introduce the application scenarios of the embodiments of this application; Figure 2A , provides a structural diagram of an intelligent question-answering system, the system includes a processing device 10 (such as an intelligent terminal 100) and a server 200, wherein the intelligent terminal 100 may include but is not limited to Figure 2A The desktop computer 100-1 or smart phone 100-2 in the smart terminal 100 may be installed with a question-answering application 110, which may include but is not limited to Figure 2A The application 110-1 or application 110-2, etc. in the server 200 is installed with the server-side application of the intelligent question-answering system; the smart terminal 100 and the question-answering server 200 communicate with each other.
[0102] The target object logs in to the question-and-answer application 110, and the smart terminal 100 obtains the level identification of the target object through the question-and-answer application 110, and receives the original query text information input by the target object. Based on the level identification of the target object, the obtained original query text information is expanded, and the expanded multiple extended text information is displayed to the target object through the user interface; it can also respond to the target object's selection operation on the displayed multiple extended text information, and send the selected target extended text information to the question-and-answer server 200, so that the question-and-answer server 200 obtains the query result corresponding to the target extended text information based on the question-and-answer knowledge base 300, and returns it to the smart terminal 100, and the smart terminal 100 displays the corresponding query result to the target object.
[0103] As an embodiment, the server 200 may also update the question-and-answer knowledge base 300 based on the target object's selection operation on the extended text information, and train a target similar text recommendation model for extending the original query text information based on the question-and-answer knowledge base 300.
[0104] The present application embodiment also provides a structural diagram of another intelligent question-answering system, see Figure 2B ; The system includes a smart terminal 100 and a processing device 10 (eg, a server 200).
[0105] The target object logs in to the question-and-answer application 110, and the smart terminal 100 obtains the level identification of the target object through the question-and-answer application 110, and receives the original query text information input by the target object, and sends a query request to the server 200 based on the obtained level identification of the target object and the original query text information. The server 200 responds to the query request, expands the obtained original query text information based on the level identification of the target object, and sends the expanded multiple extended text information to the smart terminal 100; the smart terminal 100 responds to the target object's selection operation on the multiple displayed extended text information, and sends the selected target extended text information to the server 200. The server 200 obtains the query result corresponding to the target extended text information based on the question-and-answer knowledge base 300, and returns it to the smart terminal 100, and the smart terminal 100 displays the corresponding query result to the target object.
[0106] The above-mentioned server 200 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers (such as but not limited to servers 200-1 to 200-3 shown in the figure), or multiple cloud servers in cloud service technology that provide 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, as well as big data and artificial intelligence platforms.
[0107] The smart terminal 100 in the embodiment of the present application can be a mobile terminal, a fixed terminal or a portable terminal, such as a mobile phone, a station, a unit, a device, a multimedia computer, a multimedia tablet, an Internet node, a communicator, a desktop computer, a laptop computer, a notebook computer, a netbook computer, a tablet computer, a personal communication system (PCS) device, a personal navigation device, a personal digital assistant (PDA), an audio / video player, a digital camera / camcorder, a positioning device, a television receiver, a radio broadcast receiver, an e-book device, a gaming device or any combination thereof, including accessories and peripherals of these devices or any combination thereof.
[0108] based on Figure 2A and Figure 2B In the following, the target similarity text recommendation model involved in the embodiment of the present application is described in detail.
[0109] In the embodiment of the present application, a training sample pair set is first generated, and then a similar text recommendation model is trained based on the training sample pair set. Figure 3 As shown; based on the existing parallel corpus pair (q-q'), the seq2seq model is trained, and based on the seq2seq model, the sample query text information (text to be generalized) input online by the reference object is expanded. During the expansion process, the fusion decoding method is adopted to obtain and display each extended text information, and the extended text information checked by the target object is used as a positive training sample pair and stored in the question-answering knowledge base, and the extended text information not checked by the reference object is used as a negative training sample pair. Since the negative training sample pair is the unchecked generalization result fed back online by the reference object, it indicates that the quality of the result is poor. The generalization result that the target object is not satisfied with is used as a negative training sample pair, so that the trained model can automatically learn the online selection result, automatically avoid the situation where the reference object does not check the generalization result, and improve the intelligence of the model. Further, based on the obtained positive and negative training sample pairs, the similar text recommendation model provided in the embodiment of the present application is trained. During training, the corresponding level identifier is marked for each positive and negative training sample pair, and a response is made based on the obtained target similar text recommendation model.
[0110] It should be noted that the embodiments of this application Figure 3 This is just an example, and the fusion decoding module can also be deployed independently.
[0111] In each positive training sample pair and each negative training sample pair set in the embodiment of the present application, each training sample pair includes a sample query text information and a real extended text information. A sample query text information can correspond to multiple real extended text information. Based on each positive and negative training sample pair, a training sample pair set for training a similar text recommendation model is generated. Figure 4A :
[0112] S400_1: The processing device inputs a sample query text information into a similar text recommendation model, and obtains each extended text information corresponding to the sample query text information based on the similar text recommendation model.
[0113] In S400_1, the similar text recommendation model can be Figure 3 The seq2seq model in
[15] takes a sample query text as an example. The sample query text information is input into the seq2seq model, which extracts the semantic vectors of each word in the sample query text information and predicts the corresponding extended text information based on the extracted semantic vectors. The similar text recommendation model is trained using existing parallel corpus pairs (for example, {"Who is Li Bai?", "Tell me about Li Bai"}).
[0114] For example, Figure 4B As shown in the figure, taking the sample query text information "How is the weather today" as an example, based on the seq2seq model, the various extended text information obtained are "How is the weather today", "Introduce today's weather", "Query today's weather", and "Check today's weather forecast".
[0115] In S400_1, the process of obtaining each extended text information is as follows Figure 4C :
[0116] S400_11: The processing device performs first expansion transformation processing on the first N characters in a sample query text information based on the similar text recommendation model and adopts a preset first expansion method to obtain first expansion transformation sequences corresponding to the first N characters.
[0117] In S400_11, N is a preset integer not less than 1. The first extension method includes but is not limited to a Diverse Beam Search (DBS) algorithm. The DBS algorithm is an improvement on the Beam Search (BS) algorithm.
[0118] The BS algorithm is a heuristic graph search algorithm, usually used when the solution space of the graph is relatively large. In order to reduce the space and time occupied by the search, some nodes with relatively poor quality are cut off at each step of depth expansion, and some nodes with higher quality are retained. This reduces space consumption and improves time efficiency. It is widely used in the field of natural language processing.
[0119] The extended transformation process of the BS algorithm is shown in Figure 4DAs shown in the figure, the BS algorithm performs expansion transformation according to the maximum likelihood of characters. Assuming that the input text is "I am a yellow person", the vocabulary size is 5, and the beam size is 2, when the transformation generates the first word, the two words with the highest probability are selected, namely "I" and "yellow"; when the transformation generates the second word, "I" and "yellow" are combined with each word in the vocabulary respectively, and the two phrases with the highest probability are selected, "I am" and "yellow"; when the transformation generates the third word, "I am" and "yellow" are combined with each word in the vocabulary respectively, and the two phrases with the highest probability are selected, "I am a person" and "I am yellow".
[0120] DBS groups beam widths into integers. Each group is similar to BS, continuously extending the sequence. A dissimilarity term is introduced to ensure differences between groups. The BDS algorithm automatically adds a repetition penalty to each expansion transformation. This results in different vocabulary from previous transformations, potentially filtering out some relatively fluent sentences.
[0121] Still taking the input text "I am a yellow person" as an example, see Figure 4E When DBS is used for expansion transformation, when the transformation generates the first word, the two words with the highest probability are selected, namely "I" and "yellow"; when the transformation generates the second word, "I" and "yellow" are combined with each word in the vocabulary respectively, and the two phrases with the highest probability are selected, "I am" and "yellow race"; when the transformation generates the third word, "I am" and "yellow race" are combined with each word in the vocabulary respectively, and the two phrases with the highest probability are selected, "I am a person" and "yellow race".
[0122] In S400_11, the DBS algorithm is used to perform a first expansion transformation process on N characters in a sample query text information, thereby ensuring that diversified expansion results are obtained.
[0123] S400_12: The processing device adopts a preset second expansion method based on the similar text recommendation model to perform second expansion transformation processing on the last M characters in a sample query text information and each first expansion transformation sequence until the preset end condition is met, thereby obtaining each expanded text information corresponding to a sample query text information.
[0124] In S400_12, the preset end condition is obtaining the end symbol "SEP" or reaching the maximum preset sequence length.
[0125] Because S400_11 uses the DBS mechanism to expand the first N characters, some of the expanded results may have incoherent word order. Therefore, the second expansion method is used to expand the last M characters to ensure the fluency of the expanded text. M is a preset integer not less than 1. The second expansion method includes, but is not limited to, the BS algorithm. A description of the BS algorithm is provided in S400_11 and will not be repeated here.
[0126] In the embodiment of this application, the DBS algorithm is first used to expand the first N characters, ensuring the diversity of the expanded text information. Then, the BS algorithm is used for expansion based on maximum likelihood, without emphasizing differences or repetition penalties for the next M characters, ensuring the coherence of the entire sentence. Therefore, by using the expansion transformation method that combines DBS and BS algorithm decoding, the diversity of each expanded text information is guaranteed, while ensuring the coherence and readability of each expanded text.
[0127] For example, when using BDS and BS algorithms to decode the sentence “I am a yellow person”, Figure 4F As shown in the figure, the results generated by the third transformation may be "I am a human" and "yellow people", with the first two characters being different but the third character being the same, thus satisfying both diversity of expression and fluency.
[0128] S400_2: The processing device presents each extended text information to the reference object, and in response to the selection operation of the reference object, uses each selected first extended text information as each first real extended text information corresponding to a sample query text information, and records a sample query information and each first real extended text information as corresponding positive training sample pairs.
[0129] In S400_2, assuming that the sample query text information is "How is the weather today?", the corresponding extended text information is "How is the weather today?", "How is the weather today?", "Introduce today's weather", "Query today's weather", and "Check today's weather forecast". The processing device presents each extended text information to object A through the user interface. Object A checks "How is the weather today?" and "Introduce today's weather" and notifies the processing device. The processing device uses "How is the weather today" checked by object A as a real extended text information corresponding to "How is the weather today", and obtains positive training sample pair 1 {"How is the weather today?", "How is the weather today"}, and uses "Introduce today's weather" checked by object A as another real extended text information corresponding to "How is the weather today", and obtains positive training sample pair 2 {"How is the weather today?", "Introduce today's weather"}.
[0130] S400_3: The processing device uses each unselected second extended text information as each second true extended text information corresponding to a sample query text information, and records a sample query information and each second true extended text information as a corresponding negative training sample pair.
[0131] In S400_3, still taking the sample query text information "How is the weather today" as an example, for each of the above-mentioned extended text information, object A does not check "How is the weather today?", then the processing device will take the unchecked "How is the weather today?" as a real extended text information corresponding to "How is the weather today?", and obtain a negative training sample pair 1 {"How is the weather today?", "How is the weather today?"}.
[0132] In the above-mentioned embodiment of the present application, the generated training sample set incorporates the negative training sample pairs fed back by the reference object, and the negative training sample pairs are also used for model training, so that when the model is subsequently trained using the training sample set for recommendation, the generalization results of the same negative training sample pairs can be avoided, thereby improving the quality of generalization and the online learning ability of the model, and enhancing the intelligence of the model.
[0133] After obtaining the training sample pair set, the model is trained to obtain the target similar text recommendation model. The training process is shown in Figure 5A :
[0134] S501: The processing device obtains a preset training sample pair set.
[0135] In S501, each training sample pair in the training sample pair set includes a sample query text information and a real extended text information. The sample query text information in different training sample pairs can be the same or different, and the real extended text information in different training sample pairs is different.
[0136] For example, "What's the weather like today?" and "Let me tell you about today's weather" are the first training sample pair, "What's the weather like today?" and "Query today's weather" are the second training sample pair, and "Who is Li Bai?" and "Tell me about who Li Bai is?" are the third training sample pair. The first and second training sample pairs have the same sample query text information but different true extended text information. The first and third training sample pairs have different sample query text information and true extended text information.
[0137] S502: The processing device marks corresponding level identifiers for each training sample pair included in the training sample pair set.
[0138] In S502, each training sample pair included in the training sample pair set can be divided into a positive training sample pair and a negative training sample pair. Each positive training sample pair and each negative training sample pair are set based on the recommendation results of each sample query text information based on the similar text recommendation model to be trained. The processing device marks each positive training sample pair and each negative training sample pair with a corresponding level identifier, wherein the level identifier is used to indicate the expression similarity level between the sample query text information and the extended text information, see Figure 5B :
[0139] S5021: The processing device marks a corresponding level identifier for each positive training sample pair based on the similarity of expression between the sample query text information and the true extended text information contained in each positive training sample pair.
[0140] In S5021, the lower the similarity in expression form, the greater the difference between the true extended text information and the sample query text information, the richer the content expressed by the true extended text information relative to the sample query text information, and the higher the level identifier corresponding to the positive training sample pair consisting of the sample query text information and the true extended text information. Each level identifier corresponds to multiple positive training sample pairs.
[0141] For example, the embodiment of the present application pre-sets 5 level identifiers, which are respectively recorded as 1, 2, 3, 4, and 5. Each level identifier corresponds to a preset similarity interval. When the sample query text information "How is the weather today" in the positive training sample pair 1 and the expression form similarity of the real extended text information "How is the weather today" are Y (the corresponding level is low), and belong to the value interval corresponding to the level identifier "1", then the level identifier corresponding to the positive training sample pair 1 is marked as "1".
[0142] For another example, when the expression similarity value of the sample query text information "How is the weather today" in the positive training sample pair 2 and the real extended text information "Introduce today's weather" is Y' (Y'>Y, the corresponding level is intermediate), and it belongs to the value range corresponding to the level identifier "2", then the level identifier corresponding to the positive training sample pair 2 is marked as "2".
[0143] For each positive training sample pair, the processing device may mark each positive training sample pair with a corresponding level identifier based on each preset evaluation indicator, wherein each preset evaluation indicator includes at least one of the following:
[0144] 1) Between each positive training sample pair, the character difference value between each real extended text information corresponding to the same sample query text information.
[0145] Still taking the positive training sample pair 1 and the positive training sample pair 2 as an example, the positive training sample pair 1 and the positive training sample pair 2 have the same sample query text information "How is the weather today?". The character difference value between the real extended text information 1 "How is the weather today" contained in the positive training sample pair 1 and the real extended text information 2 "Introducing today's weather" contained in the positive training sample pair 2 can be determined. The larger the character difference value, the richer the expression form between the real extended text information contained in the two positive training sample pairs, and the better the quality of the positive training sample pairs, thereby ensuring the diversity between the positive training sample pairs.
[0146] 2) In each positive training sample pair, the character difference value between each sample query text information and the corresponding true extended text information.
[0147] Taking the positive training sample pair 1 as an example, the sample query text information contained in the positive training sample pair 1 is "How is the weather today", and the true extended text information is "How is the weather today". The character difference value between "How is the weather today" and "How is the weather today" can be determined. The larger the character difference value, the greater the difference between the true extended text information and the sample query text information.
[0148] 3) In each positive training sample pair, the semantic similarity between each sample query text information and the corresponding true extended text information.
[0149] If the difference between the sample query and the corresponding true extension is significant, the semantics of the information being expressed may have changed. For example, if the sample query is "What's the weather like today?" and the corresponding true extension is "What's suitable to wear in today's weather," while both involve temperature, the semantics are different. Therefore, while ensuring the richness of the true extension's expression, it's also important to ensure semantic consistency with the sample query.
[0150] 4) The semantic completeness of each true extended text information in each positive training sample pair.
[0151] In order to improve the accuracy of semantic understanding of intelligent question-answering systems, it is necessary to ensure the semantic integrity of authentic extended text information.
[0152] In S5021, when implementing, for each positive training sample pair, execute Figure 5C The operations shown are:
[0153] S5021_1: The processing device determines the evaluation value corresponding to each preset evaluation indicator of a positive training sample pair.
[0154] In S5021_1, for each preset evaluation indicator, different models may be used to determine the evaluation value of the corresponding preset evaluation indicator, including but not limited to character difference value, semantic similarity, and semantic completeness.
[0155] The following takes the positive training sample pair 1 as an example to describe the process of determining the various evaluation values of the positive training sample pair 1.
[0156] When the evaluation value is the character difference value between the true extended text information of the positive training sample pair 1 and the true extended text information of other positive training sample pairs with the same sample query text information, the N-gram model can be used for determination.
[0157] N-Gram is a language model based on a statistical algorithm. The basic idea is to perform a sliding window operation of size N on the bytes of the sample query text information, forming multiple byte segment sequences of length N (i.e., multiple real extended text information). Each byte segment is called a gram. The frequency of occurrence of all grams is counted to determine the probability of each byte segment sequence. The greater the probability difference between the byte segment sequences, the greater the character difference between the real extended text information, the higher the expression richness score, and the greater the diversity of the positive training sample pairs corresponding to the sample query text information.
[0158] Taking the sample query text information included in the positive training sample pair 1 as an example, the various real extended text information corresponding to the sample query text information determined by N-Gram is shown in Table 1.
[0159] Table 1 Probability of each real extended text information corresponding to the same sample query text information
[0160] Positive training sample pairs Sample query text information Real extended text information Probability 1 What's the weather like today? What's the weather like today? P1 2 What's the weather like today? Let me introduce today's weather P2 3 What's the weather like today? Check today's weather P3
[0161] Among them, P1>P3>P2, indicating that "Introduce today's weather" has the largest difference with "What's the weather like today" and has the highest corresponding score; the character difference value of the true extended text information between positive training sample pair 1 and positive training sample pair 3 is smaller than the character difference value of the true extended text information between positive training sample pair 1 and another positive training sample pair 2.
[0162] When the evaluation value is the character difference between "what's the weather like today" and "how's the weather today" for the positive training sample pair 1, it can be determined by the minimum edit distance (MED) between the sample query text information and the true extended text information. A larger edit distance indicates a larger character difference value. The edit distance refers to the minimum number of single-character edit operations required to convert a character in the sample query text information into the corresponding character in the true extended text information.
[0163] When the evaluation value is the semantic similarity between the sample query text information and the true extended text information of the positive training sample pair 1, the Bert model can be used to determine it. The description of the Bert model can be found in the above glossary and will not be repeated here.
[0164] The network structure of the Bert model is as follows Figure 6 As shown in the figure, the sample query text information is "How is the weather today" and the real extended text information is "How is the weather today" are input to the input layer of the Bert model respectively, and the input layer performs word segmentation. Among them, the [CLS] label is used to indicate whether the semantics of the sample query text information and the real extended text information are consistent. The [SEP] label is a sentence symbol used to separate the sample query text information and the real extended text information; the embedding layer represents each word with a vector, and obtains the feature vector (E) corresponding to each word. CLS , E1,…,E6'); Figure 6 Each “○” in represents a transformer network structure, which is used to perform semantic parsing on the feature vector of each word and determine the probability P based on the parsed semantic vector to represent the semantic similarity between “what’s the weather like today” and “what’s the weather like today”.
[0165] When the evaluation value is the semantic completeness of the true extended text information of the positive training sample pair 1, the VAD algorithm can be used to determine it.
[0166] Taking the semantic completeness of "How is the weather today" as an example, the VAD algorithm is used to determine the probability value of "How is the weather today" predicted by "How is the weather today". The larger the probability value, the more complete the semantics, and the stronger the readability and fluency of the real extended text information.
[0167] S5021_2: The processing device determines the expression form similarity corresponding to a positive training sample pair based on each evaluation value obtained for the positive training sample pair and the preset weight of each preset evaluation indicator.
[0168] In S5021_2, still taking the positive training sample pair 1 as an example, assuming that the character difference value between the real extended text information of the positive training sample pair 1 determined in S5021_1 and the real extended text information of the positive training sample pairs 2 and 3 is Y1, and the corresponding weight is W1; the character difference value between the sample query text information of the positive training sample pair 1 and the corresponding real extended text information is Y2, and the corresponding weight is W2, the semantic similarity between the sample query text information of the positive training sample pair 1 and the corresponding real extended text information is Y3, and the corresponding weight is W3, the semantic completeness of the real extended text information of the positive training sample pair 1 is Y4, and the corresponding weight is W4, then the expression form similarity of the positive training sample 1 is Y=Y1*W1+Y2*W2+Y3*W3+Y4*W4.
[0169] S5021_3: The processing device marks a corresponding level identifier for a positive training sample pair based on the similarity of the expression forms corresponding to the positive training sample pair.
[0170] In S5021_3, still taking the positive training sample pair 1 as an example, the expression similarity Y of the positive training sample pair 1 has been obtained by S5021_2, and Y is compared with the preset similarity intervals corresponding to each preset level identifier. When Y belongs to the value interval corresponding to the level identifier "1", the level identifier corresponding to the positive training sample pair 1 is marked as "1".
[0171] S5022: The processing device marks each negative training sample pair as a set level identifier.
[0172] In S5022, each negative training sample pair is fed back online by each reference subject, indicating a training sample pair that the reference subject is not interested in. The processing device marks each negative training sample pair with a preset level identifier (such as "0").
[0173] When training traditional seq2seq models, there are no negative training sample pairs. The extended results that the user has not checked are directly stored in the blacklist, such as Figure 1 As shown, the embodiment of the present application generates negative training sample pairs based on the unchecked extension results of each reference object, and marks them with preset level identifiers. Compared with the method of storing them in a blacklist library, the negative training sample pairs with level identifiers are used for model training, so that the trained model can automatically filter and avoid recommending extension results with a label of "0", thereby improving the intelligence of the model.
[0174] S503: The processing device trains the similar text recommendation model to be trained in an iterative manner based on the training sample pair set until a preset convergence condition is met, and uses the similar text recommendation model output in the last round as the target similar text recommendation model.
[0175] In S503, the processing device performs multiple rounds of training on the similar text recommendation model to be trained based on each positive and negative training sample pair with a corresponding level identifier in the training sample set, stops training when the preset convergence condition of the model is met, and uses the similar text recommendation model output in the last round as the target similar text recommendation model. During each round of training, the similar text model to be trained will automatically learn the relationship between the expression similarity level and the level identifier corresponding to each training sample pair. The higher the level identifier, the higher the expression similarity level between the extended text information predicted by the model and the sample query text information, and the more obvious the difference between the predicted extended text information and the sample query text information. Since each positive and negative training sample pair is marked with a corresponding level identifier through each preset evaluation indicator, the target similar text model finally trained is a generalized model with a level gradient, which can provide differentiated generalization results for target objects of different levels. Moreover, due to the introduction of negative training sample pairs, when using the target similarity text recommendation model to expand the sample query text information, it avoids recommending the same generalized results, thereby improving the generalization quality and closed-loop learning ability of the model. Furthermore, when using the target similarity text recommendation model for question and answer, it can accurately understand the various text information input by the target object and respond correctly, thereby improving the model service quality.
[0176] The target similarity text recommendation model can be an architecture composed of multiple neural networks with text processing capabilities, see Figure 7 ; The embodiment of the present application provides an architecture of a target similar text recommendation model, which includes an encoding network and a decoding network. The encoding network is used for sample query text information, and learns to generate semantic vectors C of each word in the sample query text information. The semantic vector of a word is obtained by fusing the text vector of a word with the semantic information of the sample query text information; the decoding network is used to learn to generate predicted extended text information with the same semantics as the sample query text information using the semantic vectors C of each word in the sample query text information. Among them, the encoding network and the decoding network can be composed of Transformer units. In the embodiment of the present application, it is possible but not limited to first pre-training the encoding network, and then fine-tuning the encoding parameters of the pre-trained encoding network and the decoding parameters in the decoding network through the fine-tuning mechanism Fine-tune to obtain the target similar text recommendation model.
[0177] Optionally, the encoding network and the decoding network may also adopt the Bert model.
[0178] It should be noted that if GPU resources are limited, convolutional neural networks and recurrent neural networks can also be used for encoding and decoding networks. Although the depth of CNN and RNN is not as good as that of BERT and Transformer in deep feature extraction, and the effect is not as good as that of BERT and Transformer, their computing speed is fast and the performance requirements of the device are relatively low.
[0179] In specific implementation, each round of training of the target similarity text recommendation model includes the following steps. Figure 5D :
[0180] S5031: The processing device inputs each training sample pair extracted from the training sample pair set and the corresponding level identifier into the similar text recommendation model to be trained, and obtains the predicted extended text information with the same semantics corresponding to each sample query text information based on each sample query text information and the corresponding level identifier in each training sample pair.
[0181] In S5031, for each sample query text information in each training sample pair (including positive training sample pairs and negative training sample pairs), the semantic vectors of each word in the predicted expanded text information are related, that is, the output of the following depends on the output of the previous text, such as Figure 8 As shown; taking the Bert model as an example, x1-xn represents the input sample query text information and the real extended text information, which are separated by SEP tags. The semantic vector of each word in each training sample pair generated by the Bert model is integrated with the feature vector of the level identifier, and the extended text information is predicted based on the fused vector, where q1 represents the first word of the predicted extended text information, and the second word q2 of the extended text information is predicted based on x1-xn and q1, and so on, until the complete predicted extended text information is obtained.
[0182] S5032: The processing device determines the similarity loss value of each training sample pair based on the predicted extended text information and the actual extended text information corresponding to each sample query text information.
[0183] In S5032, taking the sample query text information j in each sample query text information (any one of the sample query text information in each sample query text information) as an example, based on the predicted extended text information j corresponding to the sample query text information j predicted in S3021, the similarity loss value between the predicted extended text information j and the true extended text information j is determined. The embodiment of the present application does not impose restrictive requirements on the loss function, including but not limited to the cross-entropy loss function.
[0184] S5033: The processing device adjusts parameters of the similar text recommendation model to be trained based on the obtained similarity loss values.
[0185] In S5033, the similarity loss values corresponding to each training sample are compared with the pre-set similarity loss threshold. When the similarity loss value is greater than the similarity loss threshold, it indicates that the preset convergence condition of the model is not met, and the parameters of the similar text recommendation model to be trained need to be adjusted until the convergence condition is met.
[0186] In other embodiments, Figure 4A After setting each positive and negative training sample pair, each positive and negative training sample pair contained in the obtained training sample pair set can be marked with the corresponding level identifier, and then executed Figure 5A The model training process is simplified, thereby improving the model training efficiency.
[0187] It should be noted that the target similarity text recommendation model obtained in the embodiment of the present application can be applied to the extended functions of the question-and-answer knowledge base (including questions and answers) in various applications. By calling the interface of the processing device, extended text information with hierarchical gradient differentiation is recommended to the target object.
[0188] like Figure 9 As shown, taking the processing device as an intelligent terminal as an example, corresponding to the scenario shown in 2A, Figure 9 In (a), the target object logs in through the question-and-answer application of the smart terminal (for example, a desktop computer). The smart terminal obtains the level identification of the target object and displays it in the information bar 901. The target object selects "Question and Answer Knowledge Base" in the drop-down menu 902 on the left to display the question-and-answer knowledge base expansion page 903. When expanding, the expansion can be targeted according to the type of the question-and-answer knowledge base, for example, the expansion is "film and television", "navigation", "food", etc. The target object can enter the sample query text information to be expanded through the "Add Question and Answer" option, or select the sample query text information already in the question-and-answer knowledge base for expansion. After the smart terminal obtains the sample query text information and the level identification, it sends an expansion request by clicking the "Edit" option. The expansion request carries the sample query text information and the level identification. The smart terminal responds to the expansion request and obtains each expansion text information that meets the expression similarity level indicated by the level identification and has the same semantics as the sample query text information based on the trained target similarity text model. At this time, the "similar questions" in the question-and-answer knowledge base expansion page displayed by the smart terminal are marked with a red dot "·". Figure 9The area 904 enclosed by a dotted circle in (b) indicates that the smart terminal has obtained the various extended text information recommended by the target similar text recommendation model; the target object clicks the "similar question" option to view the various extended text information, and at this time, the red "·" disappears, as shown in FIG. Figure 9 As shown in (c) in the figure; the target object adds extended text information through the smart terminal, that is, the extended text information is associated with the sample query text information to generate each positive training sample pair and store it in the question-answer knowledge base. It is also possible to not add the displayed extended text information and associate the unadded (unchecked) extended text information with the sample query text information to generate each negative training sample pair. The smart terminal adds corresponding level identifiers to each positive and negative training sample pair for training the next version of the target similarity text recommendation model, and sends each positive and negative training sample pair to the server. After iteratively updating the online target similarity text recommendation model, when the text is subsequently extended, the real extended text information in the negative training sample pair will not be recommended, which improves the quality and accuracy of the recommended extended text information.
[0189] like Figure 10 As shown, taking the processing device as a server as an example, corresponding to the scenario shown in 2B, Figure 10 In (a), the target object logs in through the question-and-answer application of the smart terminal. The smart terminal obtains the level identification of the target object and displays it in the information bar 901. The target object selects "Question and Answer Knowledge Base" in the left drop-down menu 902 to display the question and answer knowledge base expansion page 903. The target object enters the sample query text information to be expanded through the "Add Question and Answer" option, or selects the sample query text information already in the question and answer knowledge base for expansion. After the smart terminal obtains the sample query text information and the level identification, it clicks the "Edit" option to send an expansion request to the server. The expansion request carries the sample query text information and the level identification; after receiving the expansion request, the server obtains each expansion text information based on the trained target similarity text model and sends each expansion text information to the smart terminal. At this time, the "similar questions" in the question and answer knowledge base expansion page displayed by the smart terminal are marked with a red dot "·", as shown in FIG. Figure 10 The area 904 outlined by the dotted line in (b) indicates that the extended text information recommended by the server has been received; the target object can view the extended text information by clicking the "similar question" option, such as Figure 10As shown in (c) in the figure, the target object adds extended text information through the smart terminal, that is, associates the extended text information with the sample query text information to generate positive training sample pairs. Alternatively, the displayed extended text information can be left unchecked and the unadded (unchecked) extended text information can be associated with the sample query text information to generate negative training sample pairs. Each positive and negative training sample pair is then sent to the server, which adds a corresponding level identifier to each positive and negative training sample pair for use in training the next version of the target similarity text recommendation model.
[0190] In the embodiments of this application, after obtaining a trained target-similar text recommendation model, the model can be applied to the intelligent question-answering system for question-answering. Because the model can obtain extended text information with rich and diverse expressions and the same semantics based on the hierarchical identification of the target object, it can accurately identify query texts with different expressions and provide correct responses, thereby improving the model's service quality.
[0191] The following is an example of a method for applying a target similar text recommendation model to perform text query in an embodiment of the present application; Figure 11 , represents the text query method designed in the embodiment of the present application, which is applied to the intelligent question-answering system, as follows:
[0192] S1101: The processing device responds to a query request sent by a target object and obtains original query text information carried in the query request and a level identifier of the target object.
[0193] In S1101 , the target object enters a corresponding account to log in through the login page of the question-and-answer client of the processing device, and the question-and-answer client obtains the level identifier of the target object.
[0194] In some embodiments, the target object's level identification can be represented by Arabic numerals, with larger numbers indicating higher level identification. For example, a level identification of "1" indicates that the target object is a normal target object, a level identification of "2" indicates that the target object is a VIP target object, and a level identification of "3" indicates that the target object is a super VIP target object.
[0195] In S1101, after the target object logs in, the original query text information is input into the user interface of the processing device, and based on the original text information and the level identification of the target object, a query request is sent to the question-and-answer server. The question-and-answer server responds to the received query request and obtains the original query text information and the level identification of the target object.
[0196] Optionally, the processing device may directly respond to the query request sent by the target object and obtain the original query text information carried in the query request and the level identifier of the target object.
[0197] The level indicator indicates the degree of similarity between the original query text and the target expanded text. A higher level indicator indicates a lower level of similarity, indicating a greater degree of difference between the target expanded text and the original query text. This indicates that the target expanded text is more likely to surprise the target audience, making the product appear more intelligent. Furthermore, target audiences at all levels will experience the value of membership registration.
[0198] For example, taking the original query text information input by target objects with different levels of identification as "How is the weather today", for super VIP target objects, the target extended text information is "Query the weather in the next 2 hours", and the similarity level with the expression of "How is the weather today" is high, and the difference is relatively high; for VIP target objects, the target extended text information is "Introduce today's weather", and the similarity level with the expression of "How is the weather today" is medium; for free target objects, the target extended text information is "How is the weather today", and the similarity level with the expression of "How is the weather today" is low. The recommended target extended text information is relatively similar to the original query text information, and the difference is relatively low.
[0199] S1102: The processing device uses a trained target similar text recommendation model based on the level identifier to obtain target extended text information that meets the expression similarity level with the original query text information and has the same semantics.
[0200] In S1102, the processing device responds to the query request and inputs the obtained level identifier and the original query text information into the trained target similarity text recommendation model. Since the target similarity text recommendation model is obtained based on a plurality of training sample pairs associated with each preset level identifier, based on the model, a plurality of extended text information that meet the expression similarity level with the original query text information and have the same semantics is obtained. The processing device sends the plurality of extended text information to the question and answer client, which displays them to the target object. The target object selects the target extended text information that it is most interested in from the plurality of displayed extended text information and sends it to the processing device. The processing device responds to the query request based on the target extended text information selected by the target object.
[0201] Optionally, the processing device may directly display multiple extended text information to the target object, and respond to the query request based on the target extended text information selected by the target object.
[0202] Taking the example of the original query text information "How is the weather today" with the level identifier "2", the target similarity text recommendation model intelligently recommends 4 extended text information, namely {"Introduce today's weather", "Query today's weather", "What is the temperature today", and "Check today's weather forecast"}. The target object selects one target extended text information from the 4 extended text information.
[0203] S1103: The processing device obtains corresponding query results based on the obtained target extended text information and sends the query results to the target object for display.
[0204] In S1103, the processing device responds to the user query request based on the target extended text information selected by the target object, and sends the obtained query results to the question-and-answer client, which displays the corresponding query results to the target object through the user interface.
[0205] For example, taking the target extended text information selected by the target object as "Introduce today's weather" as an example, the question and answer server performs a query based on "Introduce today's weather" and obtains the query result "Today is cloudy, the lowest temperature is 22℃, the highest temperature is 29℃, and the southeast wind is level 3 to 4". The question and answer client displays the query result to the target object.
[0206] Optionally, while displaying the query results, the Q&A client can also voice broadcast the query results.
[0207] In the above-mentioned embodiment of the present application, the expression similarity level indicated by the level identifier of the target object makes the expression similarity level between the multiple extended text information recommended by the target similarity text recommendation model and the original query text information correspond to the level identifier of the target object, thereby providing differentiated extended text information for target objects of different levels; based on the target extended text information selected by the target object from the multiple extended text information, the query request is responded to. Since the target extended text information has the same semantics as the original query text information and has a richer expression form, it can improve the ability to understand texts of various expression forms and improve the accuracy of the response.
[0208] Taking the processing device as an intelligent terminal as an example, Figure 12 The complete text query process provided by the embodiment of the present application is shown; the target object logs in to the account through the question-answering application of the smart terminal, and the smart terminal obtains the level identification of the target object and displays it in the information bar, such as Figure 12As shown in (a) in the figure, the target object enters the original query text information "How is the weather today?" in the user interface and sends a query request. The smart terminal responds to the query request and obtains four extended text information that have the same expression similarity level as "How is the weather today?" and have the same semantics based on the target similarity text recommendation model, such as Figure 12 As shown in (b) in the figure, the target object selects the target extended text information "Introduce today's weather" that he is most interested in through the radio button. The smart terminal sends "Introduce today's weather" to the server. The server obtains the corresponding query results based on "Introduce today's weather" and sends them to the smart terminal, which displays them to the target object. Figure 12 As shown in (c) in .
[0209] Taking the processing device as a server as an example, Figure 13 The complete text query process provided by the embodiment of the present application is shown; the target object logs in to the account through the question-answering application of the smart terminal, and the smart terminal obtains the level identification of the target object and displays it in the information bar, such as Figure 13 As shown in (a) in the figure, the target object enters the original query text information "How is the weather today" in the user interface and sends a query request to the server. After receiving the query request, the server obtains four extended text information that meet the expression similarity level and have the same semantics as "How is the weather today" based on the target similar text recommendation model, and sends them to the smart terminal, which displays them to the target object, as shown in Figure 2. Figure 13 As shown in (b) in the figure, the target object selects the target extended text information "Introduce today's weather" that he is most interested in through the radio button. The smart terminal sends "Introduce today's weather" to the server. The server obtains the corresponding query results based on "Introduce today's weather" and sends them to the smart terminal, which displays them to the target object. Figure 13 As shown in (c) in .
[0210] Based on the same inventive concept, the present application embodiment provides a text query device, see Figure 14 ,include:
[0211] Response module 1401 is used to respond to the query request sent by the target object and obtain the original query text information carried in the query request and the level identifier of the target object; the level identifier is used to indicate the expression similarity level between the original query text information and the target expanded text information
[0212] Acquisition module 1402 is configured to use a trained target similar text recommendation model based on the level identifier to obtain target extended text information that meets the expression similarity level and has the same semantics as the original query text information; wherein the target similar text recommendation model is obtained by training based on multiple training sample pairs associated with each preset level identifier;
[0213] The query module 1403 is configured to obtain corresponding query results based on the obtained target extended text information, and send the query results to the target object for display.
[0214] Optionally, the device further includes:
[0215] The sample acquisition module 1404 is used to acquire a preset set of training sample pairs, wherein each training sample pair includes a sample query text information and a real extended text information;
[0216] The sample identification module 1405 is used to mark the corresponding level identification for each training sample pair included in the training sample pair set;
[0217] The model training module 1406 is configured to iteratively train the similar text recommendation model to be trained based on the training sample pair set until a preset convergence condition is met, and use the similar text recommendation model output in the last round as the target similar text recommendation model. The following operations are performed during one round of iteration:
[0218] Inputting each training sample pair extracted from the training sample pair set and the corresponding level identifier into the similar text recommendation model to be trained, and obtaining predicted extended text information with the same semantics corresponding to each sample query text information based on each sample query text information and the corresponding level identifier in each training sample pair;
[0219] Determining the similarity loss value of each training sample pair based on the predicted extended text information and the actual extended text information corresponding to each sample query text information;
[0220] Based on the obtained similarity loss values, parameters of the similar text recommendation model to be trained are adjusted.
[0221] Optionally, the training sample pair set includes each positive training sample pair and each negative training sample pair, and the sample identification module 1405 is specifically configured to:
[0222] Based on the similarity of expression between the sample query text information and the real extended text information contained in each of the positive training sample pairs, marking the corresponding level identifier for each of the positive training sample pairs;
[0223] Marking each of the negative training sample pairs as a set level identifier;
[0224] The positive training sample pairs and the negative training sample pairs are set based on the recommendation results of the similar text recommendation model to be trained for each sample query text information.
[0225] Optionally, the sample identification module 1405 is specifically configured to:
[0226] For each positive training sample pair, perform the following operations:
[0227] Determine the evaluation value corresponding to each preset evaluation indicator of a positive training sample pair;
[0228] Determining the expression form similarity corresponding to the one positive training sample pair based on each evaluation value obtained for the one positive training sample pair and each preset weight of the preset evaluation indicators;
[0229] Based on the similarity of the expression forms corresponding to the positive training sample pair, a corresponding level identifier is marked for the positive training sample pair.
[0230] Optionally, each preset evaluation indicator includes at least one of the following:
[0231] Character difference values between each pair of positive training samples and each corresponding real extended text information of the same sample query text information;
[0232] In each positive training sample pair, a character difference value between each sample query text information and the corresponding true extended text information;
[0233] In each positive training sample pair, the semantic similarity between each sample query text information and the corresponding real extended text information;
[0234] The semantic completeness of each true extended text information in each positive training sample pair.
[0235] Optionally, the sample acquisition module 1404 is further configured to:
[0236] Each positive training sample pair and each negative training sample pair in the training sample set are set respectively in the following manner:
[0237] Inputting a sample query text information into a similar text recommendation model, and obtaining each extended text information corresponding to the sample query text information based on the similar text recommendation model;
[0238] Presenting the respective extended text information to a reference subject, and in response to a selection operation of the reference subject, using the selected respective first extended text information as respective first true extended text information corresponding to the one sample query text information, and recording the one sample query information and the respective first true extended text information as corresponding positive training sample pairs;
[0239] And each unselected second extended text information is used as each second true extended text information corresponding to the one sample query text information, and the one sample query information and each second true extended text information are recorded as corresponding negative training sample pairs.
[0240] Optionally, the sample acquisition module 1404 is specifically configured to:
[0241] Based on the similar text recommendation model, using a preset first expansion method, performing a first expansion transformation process on the first N characters in the sample query text information to obtain first expansion transformation sequences corresponding to the first N characters, where N is a preset integer not less than 1;
[0242] Based on the similar text recommendation model, a preset second expansion method is adopted to perform second expansion transformation processing on the last M characters in the sample query text information and each first expansion transformation sequence until a preset end condition is met, thereby obtaining each extended text information corresponding to the sample query text information, wherein M is a preset integer not less than 1.
[0243] As an example, Figure 14 The device in can be used for any text expansion and text query method provided in the embodiments of the present application, and can achieve the same technical effect, which will not be repeated here.
[0244] The above device is an example of a hardware entity. Figure 15 The electronic device shown includes a processor 1501 , a storage medium 1502 and at least one external communication interface 1503 ; the processor 1501 , the storage medium 1502 and the external communication interface 1503 are all connected via a bus 1504 .
[0245] The storage medium 1502 stores a computer program;
[0246] When the processor 1501 executes the computer program, the text expansion method and the text query method discussed above are implemented.
[0247] Figure 15 In the figure, one processor 1501 is used as an example, but the number of processors 1501 is not limited in practice.
[0248] Storage medium 1502 may be a volatile memory, such as a random-access memory (RAM); a non-volatile memory, such as a read-only memory, a flash memory, a hard disk drive (HDD), or a solid-state drive (SSD); or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but not limited thereto. Storage medium 1502 may be a combination of the aforementioned storage media.
[0249] Based on the same inventive concept, an embodiment of the present application provides a terminal device, which is introduced below.
[0250] Please refer to Figure 16 The terminal device includes a display unit 1640, a processor 1680 and a memory 1620, wherein the display unit 1640 includes a display panel 1641, which is used to display information input by the user or information provided to the user and various operation interfaces and display pages of the question-and-answer client 110. In the embodiment of the present application, it is mainly used to display the interface, shortcut window, etc. of the client installed in the terminal device.
[0251] Optionally, the display panel 1641 may be configured in the form of a liquid crystal display (LCD) or an organic light-emitting diode (OLED).
[0252] The processor 1680 is configured to read a computer program and then execute the method defined by the computer program. For example, the processor 1680 reads an application of a question-and-answer client, thereby running the application on the terminal device and displaying the application interface on the display unit 1640. The processor 1680 may include one or more general-purpose processors and may also include one or more DSPs (Digital Signal Processors) to perform related operations to implement the technical solutions provided in the embodiments of the present application.
[0253] The memory 1620 generally includes internal memory and external memory, and the internal memory can be a random access memory (RAM), a read-only memory (ROM), and a cache (CACHE) etc. The external memory can be a hard disk, an optical disk, a USB disk, a floppy disk or a tape drive etc. The memory 1620 is used to store computer programs and other data. The computer program includes an application corresponding to the client etc. Other data may include data generated after the operating system or the application is run, and the data includes system data (such as configuration parameters of the operating system) and user data. In the embodiment of the present application, program instructions are stored in the memory 1620, and the processor 1680 executes the program instructions in the memory 1620 to implement any of the text expansion methods and text query methods discussed in the previous figure.
[0254] In addition, the terminal device may also include a display unit 1640 for receiving input digital information, word information, contact touch operations, or contactless gestures, as well as generating signal inputs related to user settings and function control of the terminal device. Specifically, in an embodiment of the present application, the display unit 1640 may include a display panel 1641. The display panel 1641, such as a touch screen, can collect user touch operations on or near it (such as operations performed by the user using a finger, stylus, or any other suitable object or accessory on or on the display panel 1641) and drive corresponding connected devices according to a pre-set program. Optionally, the display panel 1641 may include a touch detection device and a touch controller. The touch detection device detects the player's touch direction and detects signals generated by the touch operation, transmitting the signals to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into touch point coordinates, and then sends it to the processor 1680. It can also receive commands sent by the processor 1680 and execute them. In an embodiment of the present application, if the user clicks on the question-and-answer application 110, the touch detection device in the display panel 1641 detects a touch operation, and sends a signal corresponding to the detected touch operation to the touch controller. The touch controller converts the signal into touch coordinates and sends them to the processor 1680. The processor 1680 determines that the user needs to operate the question-and-answer application 110 based on the received touch coordinates.
[0255] The display panel 1641 can be implemented using various types, such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the display unit 1640, the terminal device can also include an input unit 1630. The input unit 1630 can include, but is not limited to, an image input device 1631 and other input devices 1632. The other input devices 1632 can include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, power keys, etc.), a trackball, a mouse, and a joystick.
[0256] In addition to the above, the terminal device may also include a power supply 1690 for powering other modules, an audio circuit 1660, a near-field communication module 1670, and an RF circuit 1610. The terminal device may also include one or more sensors 1650, such as an accelerometer, a light sensor, a pressure sensor, etc. The audio circuit 1660 specifically includes a speaker 1661 and a microphone 1662. For example, the terminal device can collect the user's voice through the microphone 1662 to perform corresponding operations.
[0257] As an embodiment, the number of processors 1680 may be one or more, and the processor 1680 and the memory 1620 may be coupled or relatively independently configured.
[0258] As an example, Figure 16 The processor 1680 in the embodiment can be used to implement the following Figure 15 The functions of each module in .
[0259] As an example, Figure 16 The processor 2180 in can be used to implement the functions of the processing device discussed above.
[0260] Those skilled in the art will understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions, and the aforementioned computer program can be stored in a computer-readable storage medium. When the computer program is executed, it executes the steps of the above-mentioned method embodiments; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROMs), random access memories (RAMs), magnetic disks or optical disks, and other media that can store program codes.
[0261] Alternatively, if the above-mentioned integrated unit of the invention is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the above-mentioned methods of each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.
[0262] Based on the same technical concept, an embodiment of the present application also provides a computer-readable storage medium, which stores computer instructions. When the above-mentioned computer instructions are executed on a computer, the computer executes the question expansion method discussed above.
[0263] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0264] Obviously, those skilled in the art may make various changes and modifications to this application without departing from the spirit and scope of this application. Thus, if these modifications and variations of this application fall within the scope of the claims of this application and their equivalents, this application is intended to include these modifications and variations.
Claims
1. A text query method, characterized in that: The method comprises: In response to a query request sent by a target object, obtaining original query text information carried in the query request and a level identifier of the target object; the level identifier is used to indicate a level of similarity in expression between the original query text information and the target extended text information; Based on the level identifier, a trained target similar text recommendation model is used to obtain target extended text information that meets the expression similarity level and has the same semantics as the original query text information; wherein the target similar text recommendation model is obtained by training based on multiple training sample pairs associated with each preset level identifier; Based on the obtained target extended text information, corresponding query results are obtained, and the query results are sent to the target object for display.
2. The method according to claim 1, wherein The target similar text recommendation model is trained in the following way: Obtain a preset set of training sample pairs, where each training sample pair includes a sample query text information and a real extended text information; For each training sample pair included in the training sample pair set, mark a corresponding level identifier; Based on the training sample pair set, the similar text recommendation model to be trained is trained in an iterative manner until a preset convergence condition is met, and the similar text recommendation model output in the last round is used as the target similar text recommendation model, wherein the following operations are performed during one round of iteration: Inputting each training sample pair extracted from the training sample pair set and the corresponding level identifier into the similar text recommendation model to be trained, and obtaining predicted extended text information with the same semantics corresponding to each sample query text information based on each sample query text information and the corresponding level identifier in each training sample pair; Determining the similarity loss value of each training sample pair based on the predicted extended text information and the actual extended text information corresponding to each sample query text information; Based on the obtained similarity loss values, parameters of the similar text recommendation model to be trained are adjusted.
3. The method according to claim 2, wherein The training sample pair set includes each positive training sample pair and each negative training sample pair: The step of marking corresponding level identifiers for each training sample pair included in the training sample pair set includes: Based on the similarity of expression between the sample query text information and the real extended text information contained in each of the positive training sample pairs, marking the corresponding level identifier for each of the positive training sample pairs; Marking each of the negative training sample pairs as a set level identifier; The positive training sample pairs and the negative training sample pairs are set based on the recommendation results of the similar text recommendation model to be trained for each sample query text information.
4. The method according to claim 3, wherein The step of marking each positive training sample pair with a corresponding level identifier based on the similarity in expression between the sample query text information and the real extended text information contained in each positive training sample pair includes: For each positive training sample pair, perform the following operations: Determine the evaluation value corresponding to each preset evaluation indicator of a positive training sample pair; Determining the expression form similarity corresponding to the one positive training sample pair based on each evaluation value obtained for the one positive training sample pair and each preset weight of the preset evaluation indicators; Based on the similarity of the expression forms corresponding to the positive training sample pair, a corresponding level identifier is marked for the positive training sample pair.
5. The method according to claim 4, wherein The preset evaluation indicators include at least one of the following: Character difference values between each pair of positive training samples and each corresponding real extended text information of the same sample query text information; In each positive training sample pair, a character difference value between each sample query text information and the corresponding true extended text information; In each positive training sample pair, the semantic similarity between each sample query text information and the corresponding real extended text information; The semantic completeness of each true extended text information in each positive training sample pair.
6. The method according to claim 2, wherein Before obtaining the preset training sample pair set, it also includes: Each positive training sample pair and each negative training sample pair in the training sample set are set respectively in the following manner: Inputting a sample query text information into a similar text recommendation model, and obtaining each extended text information corresponding to the sample query text information based on the similar text recommendation model; Presenting the respective extended text information to a reference subject, and in response to a selection operation of the reference subject, using the selected respective first extended text information as respective first true extended text information corresponding to the one sample query text information, and recording the one sample query information and the respective first true extended text information as corresponding positive training sample pairs; And each unselected second extended text information is used as each second true extended text information corresponding to the one sample query text information, and the one sample query information and each second true extended text information are recorded as corresponding negative training sample pairs.
7. The method according to claim 6, wherein The obtaining, based on the similar text recommendation model, each extended text information corresponding to the sample query text information includes: Based on the similar text recommendation model, using a preset first expansion method, performing a first expansion transformation process on the first N characters in the sample query text information to obtain first expansion transformation sequences corresponding to the first N characters, where N is a preset integer not less than 1; Based on the similar text recommendation model, a preset second expansion method is adopted to perform second expansion transformation processing on the last M characters in the sample query text information and each first expansion transformation sequence, respectively, until a preset end condition is met, to obtain each extended text information corresponding to the sample query text information, wherein M is a preset integer not less than 1.
8. A text query device, characterized in that: include: A response module is used to respond to the query request sent by the target object and obtain the original query text information carried in the query request and the level identifier of the target object; the level identifier is used to indicate the expression similarity level between the original query text information and the target expanded text information An acquisition module is configured to use a trained target similarity text recommendation model based on the level identifier to obtain target extended text information that meets the expression similarity level and has the same semantics as the original query text information; wherein the target similarity text recommendation model is obtained by training based on multiple training sample pairs associated with each preset level identifier; The query module is used to obtain corresponding query results based on the obtained target extended text information, and send the query results to the target object for display.
9. The device according to claim 8, characterized in that The device further comprises: A sample acquisition module is used to obtain a preset set of training sample pairs, wherein each training sample pair includes a sample query text information and a real extended text information; A sample identification module, configured to mark corresponding level identifications for each training sample pair included in the training sample pair set; The model training module is configured to iteratively train the similar text recommendation model to be trained based on the training sample pair set until a preset convergence condition is met, and use the similar text recommendation model output in the last round as the target similar text recommendation model, wherein the following operations are performed during one round of iteration: Inputting each training sample pair extracted from the training sample pair set and the corresponding level identifier into the similar text recommendation model to be trained, and obtaining predicted extended text information with the same semantics corresponding to each sample query text information based on each sample query text information and the corresponding level identifier in each training sample pair; Determining the similarity loss value of each training sample pair based on the predicted extended text information and the actual extended text information corresponding to each sample query text information; Based on the obtained similarity loss values, parameters of the similar text recommendation model to be trained are adjusted.
10. The device according to claim 9, wherein The training sample pair set includes each positive training sample pair and each negative training sample pair, and the sample identification module is specifically used to: Based on the similarity of expression between the sample query text information and the real extended text information contained in each of the positive training sample pairs, marking the corresponding level identifier for each of the positive training sample pairs; Marking each of the negative training sample pairs as a set level identifier; The positive training sample pairs and the negative training sample pairs are set based on the recommendation results of the similar text recommendation model to be trained for each sample query text information.
11. The device according to claim 10, wherein The sample identification module is specifically used to: For each positive training sample pair, perform the following operations: Determine the evaluation value corresponding to each preset evaluation indicator of a positive training sample pair; Determining the expression form similarity corresponding to the one positive training sample pair based on each evaluation value obtained for the one positive training sample pair and each preset weight of the preset evaluation indicators; Based on the similarity of the expression forms corresponding to the positive training sample pair, a corresponding level identifier is marked for the positive training sample pair.
12. The device according to claim 9, wherein The sample acquisition module is further used to: Each positive training sample pair and each negative training sample pair in the training sample set are set respectively in the following manner: Inputting a sample query text information into a similar text recommendation model, and obtaining each extended text information corresponding to the sample query text information based on the similar text recommendation model; Presenting the respective extended text information to a reference subject, and in response to a selection operation of the reference subject, using the selected respective first extended text information as respective first true extended text information corresponding to the one sample query text information, and recording the one sample query information and the respective first true extended text information as corresponding positive training sample pairs; And each unselected second extended text information is used as each second true extended text information corresponding to the one sample query text information, and the one sample query information and each second true extended text information are recorded as corresponding negative training sample pairs.
13. The device according to claim 12, wherein The sample acquisition module is specifically used to: Based on the similar text recommendation model, using a preset first expansion method, performing a first expansion transformation process on the first N characters in the sample query text information to obtain first expansion transformation sequences corresponding to the first N characters, where N is a preset integer not less than 1; Based on the similar text recommendation model, a preset second expansion method is adopted to perform second expansion transformation processing on the last M characters in the sample query text information and each first expansion transformation sequence, respectively, until a preset end condition is met, to obtain each extended text information corresponding to the sample query text information, wherein M is a preset integer not less than 1.
14. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the method according to any one of claims 1 to 7 are implemented.
15. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and when the computer instructions are executed on a computer, the computer is caused to perform the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Method and device for determining standard text corresponding to query text
CN110990533A
Recommendation reason screening method and device and electronic equipment
CN111831902A