Sample generation method and device of entity recall model, equipment and storage medium

By automatically generating positive and negative training samples for the entity recall model, the problem of slow training sample labeling speed in existing technologies is solved, thereby improving the training efficiency and accuracy of the model.

CN114416929BActive Publication Date: 2026-04-07TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-27
Publication Date
2026-04-07

Smart Images

  • Figure CN114416929B_ABST
    Figure CN114416929B_ABST
Patent Text Reader

Abstract

The application discloses a sample generation method and device of an entity recall model, equipment and a storage medium, and belongs to the technical field of artificial intelligence. The method comprises the following steps: acquiring a plurality of query text corpora belonging to the same target field and a plurality of corresponding response text corpora; extracting at least one entity satisfying a first condition from the response text corpora corresponding to the query text corpora to obtain an entity set corresponding to the query text corpora; for a first query text corpus in the plurality of query text corpora, generating a training sample positive example of a first entity recall model based on the first query text corpus and the first entity set; and generating a training sample negative example of the first entity recall model based on the first query text corpus and a second entity set. The application realizes automatic generation of the training sample positive example and the training sample negative example, and improves the training efficiency of the entity recall model.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of artificial intelligence, and particularly relates to a sample generation method and device of an entity recall model, equipment and a storage medium. BACKGROUND

[0002] At present, a user can search through a search engine to obtain relevant answer texts.

[0003] In the related art, after obtaining a query text input by a user account, a classification model is used to process the query text to obtain an entity corresponding to the query text, and one or more answer texts corresponding to the query text are determined by taking the entity as an index. The above-mentioned classification model is trained based on supervised training samples manually labeled.

[0004] Before the classification model is trained, different categories of training samples need to be manually and accurately labeled, and one entity corresponds to one category. The labeling speed is slow, which leads to low training efficiency of the model. SUMMARY

[0005] The embodiments of the present application provide a sample generation method, device and equipment of an entity recall model and a storage medium, which can improve the training sample generation efficiency of the entity recall model and improve the training efficiency of the entity recall model. The technical solution is as follows.

[0006] According to an aspect of the embodiments of the present application, a sample generation method of an entity recall model is provided, which includes the following steps:

[0007] Obtaining a plurality of query text corpora belonging to the same target field and a plurality of answer text corpora corresponding to the plurality of query text corpora, respectively;

[0008] Extracting at least one entity satisfying a first condition from the answer text corpora corresponding to the query text corpora to obtain an entity set corresponding to the query text corpora;

[0009] For a first query text corpus in the plurality of query text corpora, generating a training sample positive example of the first entity recall model based on the first query text corpus and a first entity set, wherein the first entity set refers to an entity set corresponding to the first query text corpus;

[0010] Generating a training sample negative example of the first entity recall model based on the first query text corpus and a second entity set, wherein the second entity set refers to an entity set corresponding to a second query text corpus, and the second query text corpus is a query text corpus in the plurality of query text corpora except the first query text corpus;

[0011] The training sample positive example and the training sample negative example are used to train the first entity recall model, and the trained first entity recall model is used to determine the semantic matching degree between a target query text belonging to the target domain and a target entity.

[0012] According to an aspect of an embodiment of the present application, a search method is provided, the method comprising the following steps:

[0013] Obtaining a target query text belonging to a target domain;

[0014] Using a first entity recall model to obtain the semantic matching degree between the target query text and each query entity in an entity library respectively; wherein the entity library comprises a plurality of query entities belonging to the target domain;

[0015] Generating at least one candidate entity corresponding to the target query text according to a query entity whose semantic matching degree meets a target condition;

[0016] Using a second entity recall model to process at least one corresponding group to obtain a relationship discrimination result of each corresponding group; wherein one corresponding group comprises the target query text and one candidate entity;

[0017] Determining a recall entity corresponding to the target query text from the at least one candidate entity based on the relationship discrimination result;

[0018] Searching at least one answer text corresponding to the target query text from a text database according to the recall entity corresponding to the target query text.

[0019] According to an aspect of an embodiment of the present application, a sample generation device of an entity recall model is provided, the device comprising the following modules:

[0020] A corpus acquisition module is configured to acquire a plurality of query text corpora belonging to a same target domain and a plurality of answer text corpora corresponding to the query text corpora respectively;

[0021] An entity acquisition module is configured to extract at least one entity meeting a first condition from an answer text corpus corresponding to a query text corpus to obtain an entity set corresponding to the query text corpus;

[0022] A positive example generation module is configured to, for a first query text corpus in the plurality of query text corpora, generate a training sample positive example of the first entity recall model based on the first query text corpus and a first entity set; wherein the first entity set refers to an entity set corresponding to the first query text corpus;

[0023] The negative example generation module is configured to generate training sample negative examples of the first entity recall model based on the first query text corpus and a second entity set. The second entity set refers to an entity set corresponding to a second query text corpus. The second query text corpus is a query text corpus other than the first query text corpus in the plurality of query text corpora.

[0024] The training sample positive examples and the training sample negative examples are used to train the first entity recall model. The trained first entity recall model is used to determine semantic matching degrees between target query texts belonging to the target domain and target entities.

[0025] According to an aspect of an embodiment of the present application, a search device is provided. The device includes the following modules:

[0026] The text acquisition module is configured to acquire a target query text belonging to a target domain.

[0027] The matching acquisition module is configured to acquire semantic matching degrees between the target query text and each query entity in an entity library using a first entity recall model. The entity library includes a plurality of query entities belonging to the target domain.

[0028] The entity generation module is configured to generate at least one candidate entity corresponding to the target query text based on a query entity whose semantic matching degree satisfies a target condition.

[0029] The result acquisition module is configured to process at least one corresponding group using a second entity recall model to obtain a relationship discrimination result of each corresponding group. One corresponding group includes the target query text and one candidate entity.

[0030] The entity determination module is configured to determine a recall entity corresponding to the target query text from the at least one candidate entity based on the relationship discrimination result.

[0031] The text retrieval module is configured to search at least one response text corresponding to the target query text from a text database according to the recall entity corresponding to the target query text.

[0032] According to an aspect of an embodiment of the present application, a computer device is provided. The computer device includes a processor and a memory. The memory stores at least one instruction, at least one program, a code set, or an instruction set. The at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the above-described sample generation method of an entity recall model or the above-described search method.

[0033] According to an aspect of the embodiments of the present application, the embodiments of the present application provide a computer readable storage medium, the readable storage medium stores at least one instruction, at least one program, a code set or an instruction set, the at least one instruction, the at least one program, the code set or the instruction set are loaded and executed by a processor to implement the sample generation method of the entity recall model or implement the search method.

[0034] According to an aspect of the embodiments of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions, so that the computer device executes the sample generation method of the entity recall model or implements the search method.

[0035] The technical solutions provided by the embodiments of the present application can bring the following beneficial effects:

[0036] The training sample positive examples of the first entity recall model are generated through the first query text corpus and the first entity set, the training sample negative examples of the first entity recall model are generated through the first query text corpus and the second entity set, and the entity set is extracted from the existing answer text corpus, so that the automatic generation of the training sample positive examples and the training sample negative examples is realized, manual labeling of the entities corresponding to the first query text corpus is not needed, the training sample generation efficiency of the first entity recall model is improved, the training efficiency of the subsequent first entity recall model is improved, and moreover, the answer text corpus and the query text corpus have a corresponding relationship, the entity set corresponding to the query text corpus is extracted from the answer text corpus corresponding to the query text corpus, the accuracy of the entity set acquisition is improved, and the accuracy of the first entity recall model is further improved. BRIEF DESCRIPTION OF DRAWINGS

[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0038] Figure 1 is a schematic diagram of the sample generation system of the entity recall model provided by an embodiment of the present application;

[0039] Figure 2 Exemplarily shows a schematic diagram of a sample generation system of an entity recall model;

[0040] Figure 3is a schematic diagram of an entity recall system provided by an embodiment of the present application;

[0041] Figure 4 is a schematic diagram of an entity recall system;

[0042] Figure 5 is a flowchart of a sample generation method of an entity recall model provided by an embodiment of the present application;

[0043] Figure 6 is a schematic diagram of an entity set acquisition method;

[0044] Figure 7 is a flowchart of a sample generation method of an entity recall model provided by another embodiment of the present application;

[0045] Figure 8 is a schematic diagram of a data processing method of a first entity recall model in a training process;

[0046] Figure 9 is a schematic diagram of a training method of a second entity recall model;

[0047] Figure 10 is a schematic diagram of a data processing method of a second entity recall model in a training process;

[0048] Figure 11 is a schematic diagram of a training method of an entity recall model in a medical field;

[0049] Figure 12 is a flowchart of a search method provided by an embodiment of the present application;

[0050] Figure 13 is a schematic diagram of a first entity recall model;

[0051] Figure 14 is a block diagram of a sample generation apparatus of an entity recall model provided by an embodiment of the present application;

[0052] Figure 15 is a block diagram of a sample generation apparatus of an entity recall model provided by another embodiment of the present application;

[0053] Figure 16 is a block diagram of a search apparatus provided by an embodiment of the present application;

[0054] Figure 17 is a block diagram of a search apparatus provided by another embodiment of the present application;

[0055] Figure 18 is a structural block diagram of a computer device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0056] In order to make the purpose, technical solutions and advantages of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the drawings.

[0057] The sample generation method and search method of the entity recall model in the present application involve the following technologies:

[0058] Artificial intelligence (AI) is the use of digital computers or digital computer-controlled machines to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology of computer science, which tries to understand the essence of intelligence and produce a new intelligent machine that can react in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines, so that machines have the functions of perception, reasoning and decision-making.

[0059] Artificial intelligence technology is a comprehensive discipline, involving a wide range of fields, both hardware and software technologies. Artificial intelligence basic technologies generally include technologies such as sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction system, mechatronics, etc. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning, etc. several major directions.

[0060] Machine learning (ML) is a multi-disciplinary subject, involving probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory, etc. It is a subject that studies how computers simulate or implement human learning behavior to acquire new knowledge or skills, and reorganize existing knowledge structure to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental approach to making computers intelligent, and its applications are widespread in various fields of artificial intelligence. Machine learning and deep learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and teaching learning technologies.

[0061] With the research and progress of artificial intelligence technology, artificial intelligence technology has been researched and applied in many fields, such as common smart home, smart wearable devices, virtual assistants, smart speakers, smart marketing, unmanned vehicles, autonomous vehicles, drones, robots, smart medical care, smart customer service, etc. It is believed that with the development of technology, artificial intelligence technology will be applied in more and more fields and play an increasingly important role.

[0062] The technical scheme provided in the embodiments of the present application relates to machine learning and other technologies of artificial intelligence. In the following, the technical scheme of the present application will be introduced and described in combination with several embodiments.

[0063] Please refer to Figure 1 which shows a schematic diagram of a sample generation system of an entity recall model provided in an embodiment of the present application. The sample generation system of the entity recall model can include a first device 10 and a second device 20.

[0064] The first device 10 is configured to provide data required for model training. Optionally, the first device 10 can be any device with data collection and data uploading functions, such as a mobile phone, a tablet computer, a game console, an e-book reader, a multimedia playback device, a wearable device, a PC (Personal Computer), a smart voice interaction device, a smart home appliance, a vehicle-mounted terminal, a client background server, and other electronic devices, and the embodiments of the present application do not limit the first device 10.

[0065] The second device 20 is configured to train the model. Optionally, the second device 20 can be a server, a computer device, a PC, and other electronic devices, and the embodiments of the present application do not limit the second device 20. The server can be a single server, a server cluster composed of multiple servers, or a cloud computing service center.

[0066] The first device 10 and the second device 20 perform data transmission through a network.

[0067] Optionally, in the embodiments of the present application, the model refers to an entity recall model, and the entity recall model includes a first entity recall model and a second entity recall model. The first entity recall model is configured to determine the semantic matching degree between a target query text and each query entity in an entity library; and the second entity recall model is configured to determine whether the corresponding relationship between the target query text and each candidate entity is accurate, wherein the candidate entity is determined according to the semantic matching degree.

[0068] Exemplarily, as Figure 2As shown, the first device 10 collects a plurality of query text corpora and respective response text corpora corresponding to the plurality of query text corpora, and sends the plurality of query text corpora and the plurality of response text corpora to the second device 20. Further, for each query text corpus in the plurality of query text corpora, the second device 20 obtains an entity set corresponding to the query text corpus from the response text corpus, generates a training sample positive example of the first entity recall model based on the entity set corresponding to the query text corpus, generates a training sample negative example of the first entity recall model based on entity sets corresponding to other query text corpora, and then trains the first entity recall model based on the training sample positive example and the training sample negative example. Moreover, after obtaining the entity set corresponding to the query text corpus, the second device 20 obtains a first label and a second label corresponding to the query text corpus, performs first task training on the second entity recall model with the query text corpus, the entity set corresponding to the query text corpus, and the first label, and performs second task training on the second entity recall model with the query text corpus and the second label. The first label is used to indicate whether the corresponding relationship between the query text corpus and an entity is accurate, the entity being any entity in the entity set corresponding to the query text corpus, and one entity corresponding to one first label. The second label is used to indicate whether the query text corpus includes feature text of a target domain.

[0069] Optionally, the first device 10 and the second device 20 can be the same device or different devices, and embodiments of the present application do not limit this.

[0070] It should be noted that the above Figure 2 is only exemplary and explanatory, and in exemplary embodiments, the functions of the first device 10 and the second device 20 can be flexibly set and adjusted, and embodiments of the present application do not limit this. Exemplarily, the first device 10 generates the training sample positive example and the training sample negative example after obtaining the query text corpus and the response text corpus, and then the second device 20 performs model training.

[0071] Please refer to Figure 3 , which shows a schematic diagram of an entity recall system provided by an embodiment of the present application. The entity recall system can include a terminal 30 and a server 40.

[0072] Terminal 30 includes, but is not limited to, electronic devices such as mobile phones, tablets, game consoles, e-book readers, multimedia playback devices, wearable devices, PCs (Personal Computers), intelligent voice interaction devices, smart home appliances, and in-vehicle terminals. Terminal 30 may include a client application. Optionally, the application can be any application with query functionality, such as a search engine, a question-and-answer application, or a social application; this embodiment does not limit this. The aforementioned application can be an application that requires downloading and installation, or it can be an application that can be used instantly; this embodiment does not limit this either.

[0073] Server 40 provides background services to terminal 30. Server 40 can be a single server, a server cluster consisting of multiple servers, or a cloud computing service center. Optionally, server 40 can be a background server for the client of the aforementioned application. In an exemplary embodiment, server 40 provides background services to multiple terminals 30.

[0074] The aforementioned terminal 30 and the aforementioned server 40 communicate with each other via a network.

[0075] Optionally, in this embodiment, server 40 provides search functionality to terminal 30. For example, as shown... Figure 4 As shown, when terminal 30 detects a user's query operation, it takes the user's query as the target query text and sends it to server 40. Further, after obtaining the target query text, server 40 processes it based on a first entity recall model, determining the semantic matching degree between the target query text and each query entity in the entity database. Based on this semantic matching degree, it selects at least one candidate entity that matches the target query text. Then, based on a second entity recall model, it processes the target query text and candidate entities to determine whether there is an accurate correspondence between them. If there is an accurate correspondence, the candidate entity is determined to be the recall entity corresponding to the target query text, and at least one response text corresponding to the target query text is retrieved from the text database based on this recall entity. Afterwards, server 40 sends the at least one response text to terminal 30, and correspondingly, terminal 30 displays the at least one response text to the user in the user interface. The text database can be located in server 40 or in other devices; this embodiment does not limit this.

[0076] Optionally, the aforementioned server 40 and Figure 1 The second device 20 in the embodiments can be the same device, and this application does not limit this embodiment.

[0077] One point that needs to be clarified is that the above Figure 4 The descriptions provided are merely exemplary and explanatory. In exemplary embodiments, the functions of terminal 30 and server 40 can be flexibly configured and adjusted, and this application does not limit them. For example, after obtaining the target query text, terminal 30 determines the recall entity corresponding to the target query text based on the first entity recall model and the second entity recall model, and then obtains the response text from the text database through server 40.

[0078] Please refer to Figure 5 This document illustrates a flowchart of a sample generation method for an entity recall model provided in one embodiment of this application. This method can be applied to... Figure 1 The second device 20 of the sample generation system for the entity recall model shown may be the executing entity for each step (hereinafter referred to as "computer device"). The method may include at least one of the following steps (501-504):

[0079] Step 501: Obtain multiple query text corpora belonging to the same target domain, and the response text corpora corresponding to each of the multiple query text corpora.

[0080] The target domain is used to indicate the use case of the entity recall model. For example, the target domain is the medical field, and the use case of the entity recall model is a symptom description retrieval scenario. Optionally, the above-mentioned target domain can be a broad domain, such as the medical field, the education field, the transportation field, etc.; or, the above-mentioned target domain can also be a narrow domain, such as the ophthalmology field, the otolaryngology field, the neurology field, etc.; the embodiments of this application do not limit this.

[0081] The query text corpus is a text corpus generated based on questions raised by users. This query text corpus can also be called the question text corpus. Optionally, when generating the query text corpus, the question can be directly used as the query text corpus, or the question can be processed before generating the query text corpus. For example, if a user raises a question based on text, the question text can be directly used as the aforementioned query text corpus; if a user raises a question based on an image, the question image is processed to convert it from text to image to generate the aforementioned query text corpus. It should be noted that the term "user" is a general term. Optionally, the user can be an individual, a group of multiple people, or an artificial intelligence that automatically raises questions, etc., and this application embodiment does not limit this.

[0082] Response text corpus refers to the text corpus of answers to query text corpus. In this embodiment, the computer device acquires multiple query text corpora belonging to the same target domain, and the response text corpora corresponding to each query text corpus. Optionally, the query text corpora and response text corpora of each domain are pre-stored in the database corresponding to that domain. When the computer device acquires the query text corpus and the response text corpus corresponding to the query text corpus in the target domain, it can directly retrieve them from the stored data in the database corresponding to the target domain. Of course, in an exemplary embodiment, the computer device can also acquire the query text corpus and the response text corpus corresponding to the query text corpus in real time from the data uploading device when determining the samples for generating the entity recall model. Optionally, the data uploading device is... Figure 1 The first device 10 in the embodiment.

[0083] Optionally, in embodiments of this application, the aforementioned response text corpus includes one or more answer texts to the query text corpus.

[0084] In one possible implementation, the response text corpus includes an answer text for the query text corpus. Optionally, if the query text corpus corresponds to a unique answer text, the response text corpus is generated based on that unique answer text; if the query text corpus corresponds to multiple answer texts, one answer text is selected from the multiple answer texts to generate the response text corpus. Optionally, when selecting from multiple answer texts, the reliability of each answer text is obtained, and the response text corpus is generated based on the answer text with the highest reliability. Of course, in exemplary embodiments, when selecting from multiple answer texts, one answer text can also be randomly selected from the multiple answer texts; this application embodiment does not limit this.

[0085] In another possible implementation, the response text corpus includes multiple answer texts corresponding to the query text corpus. Optionally, when the query text corpus corresponds to multiple answer texts, the multiple answer texts are concatenated to generate the response text corpus; or, when the query text corpus corresponds to multiple answer texts, reliable answer texts are selected from the multiple answer texts based on their reliability and concatenated to generate the response text corpus.

[0086] Optionally, the factors influencing the reliability of the above-mentioned procedures include, but are not limited to, at least one of the following: the amount of data in the answer text, the author of the answer text, and the number of likes on the answer text. For example, the reliability of the answer text is determined by the amount of data in the answer text; the more data in the answer text, the more reliable it is. The reliability of the answer text is determined by the author of the answer text; if the author of the answer text is an expert in the aforementioned target field, then the answer text is reliable. The reliability of the answer text is determined by the number of likes on the answer text; the more likes the answer text, the more reliable it is. Users can express their approval of the answer text by liking and / or writing positive comments.

[0087] Optionally, in this embodiment of the application, in order to improve the accuracy of entity recall model training, when the computer device obtains query text corpus, it selects candidate query text corpus with reliable answer text from multiple candidate query text corpus as the aforementioned query text corpus.

[0088] Step 502: Extract at least one entity that satisfies the first condition from the response text corpus corresponding to the query text corpus to obtain the entity set corresponding to the query text corpus.

[0089] In this embodiment of the application, after acquiring the query text corpus and response text corpus, the computer device extracts at least one entity that satisfies a first condition from the response text corpus corresponding to the query text corpus, thereby obtaining an entity set corresponding to the query text corpus. The entity set corresponding to the query text corpus includes at least one entity, which can be referred to as a positive example entity corresponding to the query text corpus.

[0090] Optionally, the first condition is set based on the degree of relevance between the entity and the query text corpus. After obtaining the query text corpus and the corresponding response text corpus, the computer device extracts at least one entity associated with the query text corpus from the response text corpus, based on the first condition, and generates a set of entities corresponding to the query text corpus.

[0091] The method for obtaining the entity set corresponding to the query text corpus will be described in detail below, and will not be repeated here.

[0092] Step 503: For the first query text corpus among multiple query text corpora, generate positive training samples for the first entity recall model based on the first query text corpus and the first entity set.

[0093] In this embodiment, after obtaining the entity set corresponding to the query text corpus, the computer device generates positive training samples for the first entity recall model based on the query text corpus and the entity set corresponding to it. The trained first entity recall model is used to determine the semantic matching degree between the target query text and the target entity belonging to the target domain. This semantic matching degree indicates the similarity between the target query text and the target entity. Optionally, a higher semantic matching degree indicates a greater similarity between the target query text and the target entity; conversely, a lower semantic matching degree indicates a smaller similarity between the target query text and the target entity.

[0094] Taking the first query text corpus from multiple query text corpora as an example, in this embodiment of the application, for the first query text corpus, the computer device generates positive training samples for the first entity recall model based on the first query text corpus and the first entity set. The first entity set refers to the entity set corresponding to the first query text corpus.

[0095] Optionally, the positive training samples include the first query text corpus and at least one entity from the first entity set.

[0096] In one possible implementation, the training sample positive examples include a first query text corpus and multiple entities in a first entity set. Optionally, after obtaining the first entity set, the computer device generates training sample positive examples for the first entity recall model based on a set value, using the first query text corpus and the first entity set as a benchmark.

[0097] Optionally, the above-mentioned setting values ​​can be setting values ​​for entities or setting values ​​for positive examples of training samples.

[0098] In one possible implementation, the set value is a set value for entities. After obtaining the first entity set, the computer device uses the set value as a basis to group the entities in the first entity set to obtain at least one entity combination. Based on the at least one entity combination and the first query text corpus, a training sample positive example is generated. At this time, a training sample positive example includes the first query text corpus and an entity combination. The number of entities contained in an entity combination is the set value.

[0099] In another possible implementation, the set value is a set value for positive training samples. After obtaining the first entity set, the computer device uses the set value as a basis and combines it with the number of entities contained in the first entity set to group the entities in the first entity set to obtain at least one entity combination. Based on the at least one entity combination and the first query text corpus, positive training samples are generated. At this time, a positive training sample includes the first query text corpus and an entity combination, and the number of positive training samples is the set value.

[0100] Optionally, the above-mentioned set value can be a specific value or a numerical condition. For example, the numerical condition is: all entities in the entity set; or, half of the entities in the entity set; or, one-third of the entities in the entity set. This application embodiment does not limit this.

[0101] In another possible implementation, the training sample positive examples include a first query text corpus and an entity from a first entity set. Optionally, after obtaining the first entity set, the computer device generates training sample positive examples for the first entity recall model based on the first query text corpus and all or some of the entities in the first entity set.

[0102] In one possible implementation, to control the number of positive training samples to improve the training speed of the first entity recall model, the computer device generates positive training samples for the first entity recall model based on the first query text corpus and a subset of entities in the first entity set. Optionally, if the first entity set contains *a* entities, then when obtaining the aforementioned positive training samples, *c* positive training samples for the first entity recall model are generated based on the first query text corpus and *c* entities. One of the *c* positive training samples includes one entity from the first query text corpus and the *c* entities, where *a* and *c* are both positive integers, and *a* is greater than *c*.

[0103] In another possible implementation, to improve the accuracy of the first entity recall model, the computer device generates positive training samples for the first entity recall model based on the first query text corpus and all entities in the first entity set. Optionally, if the first entity set contains *a* entities, then when obtaining the aforementioned positive training samples, *a* positive training samples for the first entity recall model are generated based on the first query text corpus and the *a* entities. Here, one of the *a* positive training samples includes the first query text corpus and one entity from the *a* entities, where *a* is a positive integer.

[0104] It should be noted that, in the embodiments of this application, the semantic matching degree between the entities of the first query text corpus and the positive examples of the training samples is high.

[0105] Step 504: Based on the first query text corpus and the second entity set, generate negative training samples for the first entity recall model.

[0106] In this embodiment of the application, after obtaining the entity set corresponding to the query text corpus, the computer device generates training sample negative examples for the first entity recall model based on the query text corpus and the entity sets corresponding to other query text corpora besides the query text corpus.

[0107] Taking the first query text corpus from multiple query text corpora as an example, in this embodiment of the application, for the first query text corpus, the computer device generates training negative samples for the first entity recall model using the first query text corpus and the second entity set. The second entity set refers to the entity set corresponding to the second query text corpus; the second query text corpus is the query text corpus other than the first query text corpus among the aforementioned multiple query text corpora. Optionally, the second entity set includes at least one entity, which can be referred to as the negative example entity corresponding to the first query text corpus, or as the positive example entity corresponding to the second query text corpus.

[0108] In one possible implementation, to control the number of positive training samples to improve the training speed of the first entity recall model, the computer device generates negative training samples for the first entity recall model based on a first query text corpus and a subset of entities in a second entity set. Optionally, if the second entity set contains b entities, then when obtaining the aforementioned negative training samples, d negative training samples for the first entity recall model are generated based on the first query text corpus and d entities. One of the d negative training samples includes one entity from the first query text corpus and the d entities, where b and d are both positive integers, and b is greater than d.

[0109] In another possible implementation, to improve the accuracy of the first entity recall model, the computer device generates training sample negative examples for the first entity recall model based on the first query text corpus and all entities in the second entity set. Optionally, if the second entity set contains b entities, then when obtaining the aforementioned training sample negative examples, b training sample negative examples for the first entity recall model are generated based on the first query text corpus and the b entities. Here, one of the b training sample negative examples includes one entity from the first query text corpus and the b entities, where b is a positive integer.

[0110] It should be noted that, in this embodiment of the application, the semantic matching degree between the entities of the first query text corpus and the negative examples of the training samples is low.

[0111] Optionally, the second query text corpus is any query text other than the first query text corpus among the plurality of query text corpora; or, the second query text corpus is a query text corpus selected from the plurality of query text corpora based on the entity vectors corresponding to each query text corpus.

[0112] In one possible implementation, the second query text corpus is any query text excluding the first query text corpus from the plurality of query text corpora. Optionally, after obtaining the first query text corpus, the computer device obtains at least one remaining query text corpus excluding the first query text corpus from the plurality of query text corpora, and randomly selects the second query text corpus from the at least one remaining query text corpus.

[0113] In another possible implementation, the second query text corpus is selected from multiple query text corpora based on the entity vectors corresponding to each query text corpus. Optionally, after obtaining the first entity set, the computer device iterates through the entity sets corresponding to each other query text corpus based on the first entity set to obtain entity duplication results corresponding to each other query text corpus; further, based on the entity duplication results, at least one second query text corpus is determined from each other query text corpus. The entity duplication results indicate that the number of identical entities between the first entity set and the entity sets corresponding to other query text corpora is less than a certain value, which can be any value, and this application embodiment does not limit this. Optionally, to improve the accuracy of the first entity recall model, the value is zero; that is, the entity duplication results indicate that there are no identical entities between the first entity set and the entity sets corresponding to other query text corpora; and there are no identical entities between the second entity set and the first entity set. The other query text corpora refer to the query text corpora other than the first query text corpus among the multiple query text corpora.

[0114] Optionally, in the embodiments of this application, steps 503 and 504 described above can be executed simultaneously.

[0115] In summary, the technical solution provided in this application generates positive training samples for the first entity recall model using the first query text corpus and the first entity set, and generates negative training samples for the first entity recall model using the first query text corpus and the second entity set. The entity set is extracted from existing response text corpus, thus achieving automatic generation of positive and negative training samples without requiring manual annotation of entities corresponding to the first query text corpus. This improves the efficiency of generating training samples for the first entity recall model and consequently, the training efficiency of the model. Furthermore, the response text corpus and the query text corpus have a corresponding relationship; the entity set corresponding to the query text corpus is extracted from the response text corpus corresponding to the query text corpus, improving the accuracy of entity set acquisition and thus enhancing the accuracy of the first entity recall model.

[0116] In addition, there are no identical entities between the second entity set and the first entity set. During the training process of the first entity recall model, there is no situation where an entity exists in both positive and negative training samples, which improves the accuracy of the generated training samples and thus improves the accuracy of the first entity recall model.

[0117] The following section introduces how to obtain the entity set corresponding to the query text corpus.

[0118] In an exemplary embodiment, step 502 above includes at least one of the following steps:

[0119] 1. Perform word segmentation on the response text corpus corresponding to the query text corpus to obtain at least one word segment;

[0120] 2. Based on the entity database of the target domain, determine at least one entity that satisfies the first condition from at least one word segmentation to obtain the entity set corresponding to the query text corpus.

[0121] In this embodiment, after acquiring query text corpora and response text corpora, the computer device performs word segmentation on the response text corpora corresponding to the query text corpora to obtain at least one word segmentation; further, it acquires query entities from an entity library in the target domain, and based on the query entities, determines at least one entity that satisfies a first condition from the aforementioned at least one word segmentation. The entity library includes at least one query entity.

[0122] In one possible implementation, the first condition is that the word segment is a query entity. Optionally, after obtaining at least one word segment, the computer device iterates through each word based on the query entities in the entity database to determine whether the word segment exists in the entity database. If the word segment exists in the entity database, it is determined that the word segment is a query entity, and thus the word segment satisfies the first condition; if the word segment does not exist in the entity database, it is determined that the word segment is not a query entity, and thus the word segment does not satisfy the first condition.

[0123] Optionally, when the computer device traverses each word segment, it compares the word segment with each existing query entity in the entity database. If the word segment is a query entity or a synonym of the query entity, it is determined that the word segment exists in the entity database.

[0124] In another possible implementation, the first condition is that the segmented words are important query entities in the response text corpus. Optionally, after obtaining the at least one segmented word, the computer device determines the segmented words contained in the entity database from the at least one segmented word to obtain at least one candidate entity; further, the computer device obtains the importance of each candidate entity in the response text corpus, and obtains the entity set corresponding to the query text corpus based on the candidate entities whose importance satisfies the second condition. The second condition can be that the importance is greater than a first threshold; or, the second condition can also be that the importance is sorted from high to low and the entities are ranked first.

[0125] In one possible implementation, when determining the importance of a candidate entity, the computer device acquires the number of times the candidate entity appears in at least one of the aforementioned word segments, and determines the importance of the candidate entity in the response text corpus based on the number of occurrences. The number of occurrences is positively correlated with the importance; the more occurrences, the higher the importance, and vice versa.

[0126] In another possible implementation, when determining the importance of a candidate entity, the computer device acquires the number of times the candidate entity appears in the at least one word segment and the total number of the at least one word segment; further, based on the number of occurrences and the total number, it determines the frequency of occurrence of the candidate entity in the response text corpus, and determines the importance of the candidate entity in the response text corpus based on the frequency of occurrence. Optionally, the frequency of occurrence is obtained by dividing the number of occurrences by the total number; correspondingly, the frequency of occurrence is positively correlated with the importance, the higher the frequency of occurrence, the higher the importance, and the lower the frequency of occurrence, the lower the importance.

[0127] In another possible implementation, when determining the importance of a candidate entity, the computer device acquires the number of times the candidate entity appears in the at least one word segment, and the total number of times each candidate entity appears in the at least one word segment. Further, based on the number of occurrences and the total number of occurrences, the device determines the proportion of occurrence of the candidate entity among the multiple candidate entities, and determines the importance of the candidate entity in the response text corpus based on this proportion. Optionally, the proportion is obtained by dividing the number of occurrences by the total number of occurrences; correspondingly, the proportion is positively correlated with the importance, with a higher frequency of occurrence indicating higher importance and a lower frequency of occurrence indicating lower importance.

[0128] It should be noted that the above description of the methods for obtaining importance is only exemplary and explanatory. In the exemplary embodiment, the importance of a candidate entity in the response text corpus can be determined by one or more of the following: number of occurrences, frequency of occurrence, and proportion of occurrence.

[0129] For example, in conjunction with reference Figure 6 The method for obtaining the entity set is described in detail below. For the query text 61: "26-day-old newborn has diarrhea after breastfeeding", the response text 62 corresponding to the query text 61 is obtained. The response text 62 is then segmented to obtain at least one segment 63. Further, the query entities in the entity database 64 are compared with the at least one segment 63, and at least one candidate segment 65 is obtained from the at least one segment 63. Then, the frequency of each candidate segment 65 in the at least one segment 63 is determined. The candidate segment 65 with a frequency greater than a certain value is determined as the entity set 66 corresponding to the query text 61.

[0130] Optionally, the entity library is a database used to store query entities, and different domains correspond to different entity libraries. In this embodiment, the entity library includes multiple query entities belonging to the target domain. When generating the entity library, at least one candidate query entity belonging to the target domain is obtained, and then the query count of each candidate query entity in historical query data is obtained. Based on the candidate query entities whose query counts satisfy a third condition, query entities in the entity library are generated, thereby generating the entity library. The third condition can be that the query count is greater than a second threshold; or, the third condition can also be that the query counts are sorted from high to low and the entities are ranked first. Optionally, after obtaining the candidate query entities whose query counts satisfy the third condition, the candidate query entity and its synonyms are determined as query entities in the entity library.

[0131] Please refer to Figure 7 This illustrates a flowchart of a sample generation method for an entity recall model provided in another embodiment of this application. This method can be applied to... Figure 1The second device 20 of the sample generation system of the entity recall model shown may be the execution subject of each step (hereinafter referred to as "computer device").

[0132] The method may include at least one of the following steps (701-707):

[0133] Step 701: Obtain multiple query text corpora belonging to the same target domain, and the response text corpora corresponding to each of the multiple query text corpora.

[0134] Step 702: Extract at least one entity that satisfies the first condition from the response text corpus corresponding to the query text corpus to obtain the entity set corresponding to the query text corpus.

[0135] Step 703: For the first query text corpus among multiple query text corpora, generate positive training samples for the first entity recall model based on the first query text corpus and the first entity set.

[0136] Step 704: Based on the first query text corpus and the second entity set, generate negative training samples for the first entity recall model.

[0137] Steps 701-704 above and Figure 5 Steps 501-504 in the embodiment are the same; see details below. Figure 5 Examples are not described in detail here.

[0138] Step 705: Input the positive and negative training samples into the first entity recall model to obtain the output of the first entity recall model for the first query text corpus.

[0139] In this embodiment of the application, after obtaining the above-mentioned positive training samples and negative training samples, the computer device inputs the positive training samples and negative training samples into the first entity recall model respectively to obtain the output result of the first entity recall model for the first query text corpus.

[0140] Optionally, the output of the first query text corpus includes a first semantic distance corresponding to each positive instance entity and a second semantic distance corresponding to each negative instance entity. In an exemplary embodiment, step 705 includes at least one of the following steps:

[0141] 1. Obtain the text semantic vector of the first query text corpus; and obtain the positive example semantic vector of each positive example entity in the first entity set; and obtain the negative example semantic vector of each negative example entity in the second entity set.

[0142] 2. Determine the first semantic distance based on the text semantic vector and the positive example semantic vector;

[0143] 3. Determine the second semantic distance based on the text semantic vector and the negative example semantic vector.

[0144] Optionally, in this embodiment of the application, after obtaining positive examples and negative examples of training samples, the first entity recall model obtains the text semantic vector of the first query text corpus based on the first query text corpus; based on the first entity set, it obtains the positive example semantic vector of each positive example entity in the first entity set; and based on the second entity set, it obtains the negative example semantic vector of each negative example entity in the second entity set.

[0145] Optionally, in this embodiment, both the positive and negative training samples include the first query text corpus. In this case, the first entity recall model can obtain the text semantic vector by processing the first query text corpus only once. For example, after obtaining the text semantic vector based on the first query text corpus in the positive training samples, when a negative training sample is input into the first entity recall model, the semantic distance is directly calculated based on the previously obtained text semantic vector.

[0146] Optionally, in this embodiment of the application, after obtaining the text semantic vector, the positive example semantic vector and the negative example semantic vector, the computer device determines a first semantic distance based on the text semantic vector and the positive example semantic vector; and determines a second semantic distance based on the text semantic vector and the negative example semantic vector.

[0147] It should be noted that in this embodiment, semantic distance and semantic matching degree are negatively correlated; that is, the smaller the semantic distance, the greater the semantic matching degree; conversely, the greater the semantic distance, the smaller the semantic matching degree. In this embodiment, the purpose of training the first entity recall model is to minimize the first semantic distance and maximize the second semantic distance.

[0148] Taking the first query text corpus, one positive entity, and one negative entity as an example, combined with references... Figure 8This section introduces the data processing methods used by the first entity recall model during training. After acquiring the first query text corpus, the first entity recall model processes the corpus to obtain the character vector, text vector, and position vector of each character. The character vector is the encoded vector of a character in the first query text corpus; the text vector is the vector of a character obtained based on the context of the first query text corpus; and the position vector indicates the positional features of a character within the first query text corpus. Further, based on the aforementioned character vector, text vector, and position vector, a text semantic vector for the first query text corpus is generated. Similarly, after acquiring positive entities, the first entity recall model processes them to obtain the character vector, text vector, and position vector of each character, thereby obtaining the positive semantic vector of the positive entity; similarly, after acquiring negative entities, the first entity recall model processes them to obtain the character vector, text vector, and position vector of each character, thereby obtaining the negative semantic vector of the negative entity. Subsequently, the first entity recall model obtains the first semantic distance based on the text semantic vector and the positive example semantic vector, and obtains the second semantic distance based on the text semantic vector and the negative example semantic vector.

[0149] One point that needs to be clarified is that the above Figure 8 This is merely exemplary and illustrative. In the exemplary embodiment, the input methods for the first query text corpus, positive example entities, and negative example entities can be flexibly set and adjusted according to actual circumstances. For example, the input method for the first query text corpus, positive example entities, and negative example entities is “[cls]first query text corpus[sep]positive example entity[sep]negative example entity[sep]”; or, the input method for the first query text corpus, positive example entities, and negative example entities is “[cls]first query text corpus[sep]positive example entity[sep], [cls]first query text corpus[sep]negative example entity[sep]”; or, the input method for the first query text corpus, positive example entities, and negative example entities is “[cls]first query text corpus[sep], [cls]positive example entity[sep], [cls]negative example entity[sep]”; and so on.

[0150] Step 706: Determine the loss of the first entity recall model based on the output results of multiple query text corpora.

[0151] In this embodiment, after acquiring the output results of multiple query text corpora, the computer device determines the loss of the first entity recall model based on the output results of the multiple query text corpora. This loss is used to measure the accuracy of the output results of the first entity recall model.

[0152] In an exemplary embodiment, step 706 above includes at least one of the following steps:

[0153] 1. For any positive instance entity in the first entity set, combine it with any negative instance entity in the second entity set to obtain at least one entity group; wherein an entity group includes one positive instance entity and one negative instance entity;

[0154] 2. For a target entity group in at least one entity group, determine the loss of the first entity recall model for the target entity group based on the first semantic distance corresponding to the target positive instance entity in the target entity group and the second semantic distance corresponding to the target negative instance entity in the target entity group;

[0155] 3. Based on the loss of the first entity recall model for each entity group, determine the loss of the first entity recall model for the first query text corpus;

[0156] 4. Determine the loss of the first entity recall model based on the loss of the first entity recall model for each query text corpus.

[0157] Optionally, in this embodiment, after acquiring the output results of multiple query text corpora, the computer device performs pairwise matching of each positive example entity and each negative example entity to obtain at least one entity group. Further, taking each entity group as a unit, based on the first semantic distance corresponding to the positive example entities in the entity group and the second semantic distance corresponding to the negative example entities in the entity group, the loss of the first entity recall model for each entity group is determined. Then, based on the loss of each entity group, the loss of the first entity recall model for the query text corpora is determined, and based on the loss of the first entity recall model for each query text corpus, the loss of the first entity recall model is determined.

[0158] For example, assuming the first query text corpus is q, for at least one target entity group in the entity group, the target positive instance entity in the target entity group is r1, and the target negative instance entity in the target entity group is r2, then the loss L of the first entity recall model for the target entity group is... 11 for:

[0159] L 11 =max(0, m+d(q, r2)-d(q, r1));

[0160] Where d(q, r1) represents the first semantic distance; d(q, r2) represents the second semantic distance; and m represents the maximum distance between the first semantic distance and the second semantic distance after the first entity recall model has been trained.

[0161] The loss L1 of the first entity recall model for the first query text corpus is:

[0162] L1 = L 11 10L 12 10·.....+L1n ;

[0163] Among them, L 12 ...L 1n This represents the loss for each entity group other than the target entity group among the multiple entity groups corresponding to the first query text corpus.

[0164] The loss L of the first entity recall model is:

[0165] L = (L1 + L2 + ... + L) x ) / x;

[0166] Among them, L2……L x This represents the loss for each query text corpus other than the first query text corpus.

[0167] Step 707: Adjust the parameters of the first entity recall model based on the loss of the first entity recall model.

[0168] In this embodiment of the application, after obtaining the loss of the first entity recall model, the computer device adjusts the parameters of the first entity recall model according to the loss. Furthermore, it continues to train the first entity recall model with adjusted parameters to obtain a new loss and continues to adjust the parameters until the obtained loss converges.

[0169] In summary, the technical solution provided in this application uses automatically generated positive and negative training samples to train the first entity recall model, thereby improving the training efficiency of the first entity recall model.

[0170] Furthermore, a positive training sample includes a first query text corpus and an entity from a first entity set; a negative training sample includes a first query text corpus and an entity from a second entity set. During the training of the first entity recall model, all content of both the positive and negative training samples is input into the first entity recall model. The first entity recall model can learn from both the query text corpus and entities during training, thus improving its accuracy. However, in classification models of related technologies, only all or part of the query text corpus is input into the classification model, and entities are used as sample labels to judge the output of the classification model. During training, the classification model learns solely from all or part of the query text corpus, resulting in lower accuracy than the first entity recall model in this application.

[0171] Optionally, in this embodiment of the application, the entity recall model includes a first entity recall model and a second entity recall model. Please refer to... Figure 9The training method for the second entity recall model includes at least one of the following steps:

[0172] Step 901: Obtain the first training sample set for the second entity recall model.

[0173] Optionally, the second entity recall model has a relationship discrimination function, which is used to determine whether the correspondence between the target query text and the target entity is accurate.

[0174] In this embodiment of the application, before training the second entity recall model, the computer device acquires a first training sample set for the second entity recall model. A first training sample in this first training sample set includes a training text corpus, a sample entity corresponding to the training text corpus, and a first label corresponding to the sample entity. The first label is used to indicate whether the correspondence between the training text corpus and the sample entity is accurate.

[0175] For example, the contents of the first training sample set are shown in Table 1 below:

[0176] Table 1 First Training Sample Set

[0177] Training text corpus Sample entity First label First training sample 1 Cramps like aching in the waist Waist pain 1 First training sample 2 Also blurred when looking at things Blurred vision 1 First training sample 3 Menstrual period will be extended Menstrual delay 0 First training sample 4 Swelling in the upper abdomen Lower abdominal distension 0

[0178] In Table 1 above, the first label "1" indicates that the correspondence between the training text corpus and the sample entities is accurate, and the first label "0" indicates that the correspondence between the training text corpus and the sample entities is inaccurate.

[0179] In one possible implementation, the training text corpus is the query text corpus, and the sample entity is any entity in the entity set corresponding to the query text corpus. Optionally, after obtaining positive training samples, the computer device determines the query text corpus of the positive training samples as the training text corpus, determines the entity of the positive training samples as the sample entity, and then generates the first training sample set.

[0180] In another possible implementation, the training text corpus is the query text corpus; the sample entity is an entity determined based on the processing result of the first entity recall model after training on the query text corpus. Optionally, after the computer device completes the training of the first entity recall model, it uses the first entity recall model to process the query text corpus, and then determines at least one entity corresponding to the query text corpus based on the output result of the first entity recall model, selects one entity from the at least one entity as the sample entity, and then generates the first training sample set.

[0181] Optionally, the first training sample set may include duplicate training text corpora, but the first training sample set does not include duplicate sample entities; that is, in the first training sample set, the same training text corpus may correspond to different sample entities.

[0182] Step 902: Based on each first training sample in the first training sample set, train the second entity recall model on the first task to obtain the first loss of the second entity recall model.

[0183] In this embodiment, after acquiring the first training sample set, the computer device trains the second entity recall model on a first task based on each first training sample in the first training sample set, thereby obtaining a first loss for the second entity recall model. This first loss is used to measure the accuracy of the relationship discrimination function of the second entity recall model.

[0184] Optionally, when obtaining the first loss, the computer device obtains the text semantic vector of the training text corpus and the entity semantic vector of the sample entities corresponding to the training text corpus; further, based on the text semantic vector and the entity semantic vector, it generates a first discrimination result of the second entity recall model for each first training sample. Here, the first discrimination result refers to the probability that the correspondence between the training text corpus and the corresponding sample entities is accurate. Then, based on the first discrimination result of each first training sample corpus and the first label of each first training sample, the computer device determines the first loss.

[0185] Step 903: Adjust the parameters of the second entity recall model based on the first loss.

[0186] In this embodiment of the application, after obtaining the first loss, the computer device adjusts the parameters of the second entity recall model based on the first loss. Furthermore, it continues to train the second entity recall model with adjusted parameters to obtain a new first loss and continues to adjust the parameters until the obtained first loss converges.

[0187] In summary, the technical solution provided in this application embodiment trains the second entity recall model using a first training sample set, and the second entity recall model can determine whether the correspondence between the target query text and the target entity is accurate. That is, the second entity recall model can identify the entities obtained by the first entity recall model to determine whether the correspondence between the entities obtained by the first entity recall model and the target query text is accurate, thereby improving the accuracy of entity recall.

[0188] Furthermore, in the classification models of related technologies, it is necessary to label the entity categories corresponding to each training sample, with one entity corresponding to one entity category, resulting in a large number of categories to be labeled. However, in the technical solution provided in this application embodiment, the first label is used to indicate whether the correspondence between the training text corpus and the sample entities is accurate. Labeling the correspondence between the training text corpus and the sample entities only requires labeling two categories: accurate and inaccurate. This helps to improve the labeling speed, increase the generation efficiency of the first training samples of the second entity recall model, and thus improve the training efficiency of the second entity recall model. Moreover, during the training process of the second entity recall model, both the training text corpus and the sample entities are input into the second entity recall model, allowing the second entity recall model to learn from both the training text corpus and the sample entities, thereby improving the accuracy of the second entity recall model.

[0189] Optionally, in this embodiment, the second entity recall model further includes a feature discrimination function, which is used to determine whether the target query text includes feature text from the target domain. In an exemplary embodiment, the training method of the second entity recall model further includes at least one of the following steps:

[0190] 1. Obtain the second training sample set for the second entity recall model.

[0191] In this embodiment, before training the second entity recall model, the computer device acquires a second training sample set for the second entity recall model. Each second training sample in this second training sample set includes a training text corpus and a corresponding second label, which indicates whether the training text corpus contains feature text from the target domain.

[0192] Optionally, the training text corpus of the first training sample set is the same as the training text corpus of the second training sample set.

[0193] Optionally, in this embodiment of the application, after obtaining the second training sample set, the computer device uses the second training sample set to train the second entity recall model for the second task.

[0194] 2. Obtain the text semantic vectors of the training text corpus.

[0195] In this embodiment of the application, after obtaining the second training sample set, the computer device obtains the text semantic vector of each training text corpus in the second training sample set.

[0196] 3. Based on the text semantic vector, generate the second entity recall model for the second discrimination result of the training text corpus.

[0197] In this embodiment, after acquiring the aforementioned text semantic vectors, the computer device generates a second discrimination result for each training text corpus based on the text semantic vectors of each training text corpus. This second discrimination result refers to the probability that the training text corpus contains feature text from the target domain.

[0198] 4. Based on the second discrimination results of each training text corpus in the training sample set, and the second label of each training text corpus, determine the second loss.

[0199] In this embodiment, after acquiring the second discrimination result of the training text corpus, the computer device determines the second loss of the second entity recall model based on the second discrimination result corresponding to each training text corpus in the training sample set and the second label of each training text corpus. This second loss is used to measure the accuracy of the feature discrimination function of the second entity recall model.

[0200] Optionally, after obtaining the first loss and the second loss, the computer device adjusts the parameters of the second entity recall model based on the first loss and the second loss.

[0201] Optionally, in an exemplary embodiment, the first task and the second task are trained alternately when training the second entity recall model. Taking a training text corpus and a sample entity corresponding to that training text corpus as an example, in conjunction with reference to... Figure 10 This section introduces the data processing method of the second entity recall model during training. After acquiring the training text corpus and sample entities, the second entity recall model processes the training text corpus and sample entities separately to obtain the text semantic vector of the training text corpus and the entity semantic vector of the sample entity. Then, based on the text semantic vector and the entity semantic vector, the second entity recall model outputs the first discrimination result mentioned above, and based on the text semantic vector, outputs the second discrimination result mentioned above.

[0202] Optionally, in the embodiments of this application, the first entity recall model described above may also be referred to as the entity coarse recall model, and the second entity recall model described above may also be referred to as the entity fine ranking model.

[0203] In addition, such as Figure 11 As shown, taking the medical field as an example, this paper provides a complete introduction to the training method of entity recall models. Specifically, it includes at least one of the following steps:

[0204] Step 1101: Obtain multiple query text corpora belonging to the medical field.

[0205] For example, the plurality of query text corpora include query text corpus q1, query text corpus q2, and query text corpus q3.

[0206] Step 1102: Extract at least one entity that satisfies the first condition from the response text corpus corresponding to the query text corpus to obtain the entity set corresponding to the query text corpus.

[0207] For example, the entity set corresponding to query text corpus q1 includes entities r11, r12, and r13, the entity set corresponding to query text corpus q2 includes entity r21, and the entity set corresponding to query text corpus q3 includes entities r31 and r32.

[0208] Step 1103: Based on the entity set corresponding to each query text corpus, generate positive and negative training samples for the first entity recall model.

[0209] For example, the training sample positive examples include: "query text corpus q1, entity r11", "query text corpus q1, entity r12", "query text corpus q1, entity r13", "query text corpus q2, entity r21", "query text corpus q3, entity r31", "query text corpus q3, entity r32"; the training sample negative examples include: "query text corpus q1, entity r21", "query text corpus q1, entity r31", "query text corpus q1, entity r32", "query text corpus q2, entity r11", "query text corpus q2, entity r12", "query text corpus q2, entity r13", "query text corpus q2, entity r31", "query text corpus q2, entity r32", "query text corpus q3, entity r11", "query text corpus q3, entity r12", "query text corpus q3, entity r13", "query text corpus q3, entity r21".

[0210] Step 1104: Train the first entity recall model based on positive and negative examples of the training samples.

[0211] Step 1105: Based on the entity set corresponding to each query text corpus, generate the first training sample set and the second training sample set for the second entity recall model.

[0212] For example, the first training sample set includes: "query text corpus q1, entity r11, first label 1", "query text corpus q1, entity r12, first label 1", "query text corpus q1, entity r13, first label 0", "query text corpus q2, entity r21, first label 1", "query text corpus q3, entity r31, first label 1", "query text corpus q3, entity r32, first label 0"; the second training sample set includes: "query text corpus q1, second label 1", "query text corpus q2, second label 0", "query text corpus q3, first label 1".

[0213] Step 1106: Train the second entity recall model using the first training sample set for the first task; and train the second entity recall model using the second training sample set for the second task. The first and second tasks are trained alternately.

[0214] Please refer to Figure 12 The diagram illustrates a flowchart of a search method provided in one embodiment of this application. This method can be applied to... Figure 2 The server 20 of the entity recall system shown may be the executing entity for each step (hereinafter referred to as "computer device"). The method may include at least one of the following steps (1201-1205):

[0215] Step 1201: Obtain the target query text belonging to the target domain.

[0216] In this embodiment, a computer device acquires target query text belonging to a target domain. The target query text is text generated based on a question raised by a user. This target query text can also be called question text. Optionally, when generating the target query text, the question can be directly used as the target query text, or the question can be processed before generating the target query text.

[0217] Optionally, in this embodiment of the application, the above-mentioned question can be a question entered by the user account or a question selected by the user account from the candidate questions. This embodiment of the application does not limit this.

[0218] Step 1202: Using the first entity recall model, the semantic matching degree between the target query text and each query entity in the entity database is obtained.

[0219] In this embodiment, after obtaining the target query text, the computer device employs a first entity recall model to obtain the semantic matching degree between the target query text and each query entity in the entity database. The semantic matching degree indicates the similarity between the target query text and the query entities, and the entity database includes multiple query entities belonging to the target domain. Optionally, a higher semantic matching degree indicates a greater similarity between the target query text and the query entities; conversely, a lower semantic matching degree indicates a smaller similarity between the target query text and the query entities.

[0220] In an exemplary embodiment, step 1202 above includes at least one of the following steps:

[0221] 1. Obtain the text semantic vector of the target query text, as well as the entity semantic vectors of each pre-stored query entity;

[0222] 2. Obtain the semantic distance between the text semantic vector and the entity semantic vector of each query entity. The semantic distance is negatively correlated with the semantic matching degree.

[0223] For example, such as Figure 13 As shown, the first entity recall model 1300 includes an online processing module 1310 and an offline processing module 1320. After obtaining the query entities in the entity database, the first entity recall model 1300 preprocesses each query entity based on the offline processing module 1320 to obtain the entity semantic vector of each query entity. Then, after obtaining the target query text, the first entity recall model 1300 processes the target query text based on the online processing module 1310 to obtain the text semantic vector of the target query text; further, it obtains the pre-obtained entity semantic vectors of each query entity from the offline processing module 1320, and determines the semantic matching degree between the target query text and each query entity based on the text semantic vector and the entity semantic vectors of each query entity.

[0224] Step 1203: Generate at least one candidate entity corresponding to the target query text based on the query entities whose semantic matching degree meets the target conditions.

[0225] In this embodiment of the application, after obtaining the above semantic matching degree, the computer device generates at least one candidate entity corresponding to the target query text based on the query entities whose semantic matching degree satisfies the target conditions.

[0226] The target condition can be that the semantic matching degree is greater than the third threshold; or, the target condition can also be that the semantic matching degree is sorted from high to low and placed first.

[0227] Step 1204: Using the second entity recall model, at least one corresponding group is processed to obtain the relationship discrimination results of each corresponding group.

[0228] In this embodiment of the application, after obtaining at least one candidate entity, the computer device uses a second entity recall model to process at least one corresponding group to obtain the relationship discrimination result of each corresponding group. A corresponding group includes the target query text and a candidate entity.

[0229] Step 1205: Based on the relationship discrimination result, determine the recall entity corresponding to the target query text from at least one candidate entity.

[0230] In this embodiment of the application, after obtaining the aforementioned relationship discrimination result, the computer device determines the recall entity corresponding to the target query text from at least one candidate entity based on the relationship discrimination result. Optionally, the computer device obtains the relationship discrimination result of each corresponding group, determines the accurate corresponding group of the correspondence between the target query text and the candidate entity based on the relationship discrimination result of each corresponding group, and then determines the candidate entity of the determined corresponding group as the recall entity corresponding to the target query text.

[0231] Step 1206: Based on the recall entity corresponding to the target query text, search the text database to obtain at least one response text corresponding to the target query text.

[0232] In this embodiment, after obtaining the aforementioned recall entity, the computer device searches a text database for at least one response text corresponding to the target query text based on the recall entity corresponding to the target query text. In one possible implementation, the computer device uses the recall entity as an index to retrieve the response text from the text database; in another possible implementation, the computer device uses the recall entity and its synonyms as indexes to retrieve the response text from the text database.

[0233] It should be noted that for some details regarding the first entity recall model and the second entity recall model, please refer to the above. Figure 5 to Figure 11 The content introduced.

[0234] In summary, the technical solution provided in this application embodiment obtains at least one candidate entity corresponding to the target query text from the query entities in the entity database through a trained first entity recall model, thereby improving the accuracy of candidate entity acquisition; and furthermore, obtains the recall entity corresponding to the target query text from at least one candidate entity through a trained second entity recall model, thereby improving the accuracy of recall entity acquisition.

[0235] In addition, the first entity recall model includes an online processing module and an offline processing module. Based on the offline processing module, the entity semantic vectors of each query entity are obtained in advance. After obtaining the text semantic vectors through the online processing module, the semantic distance between the text semantic vectors and the entity semantic vectors can be quickly determined, thereby improving the data processing efficiency of the first entity recall model.

[0236] It should be noted that the above description of this application through embodiments is merely exemplary and illustrative. New embodiments formed by arbitrarily combining the steps in the above embodiments are also within the protection scope of this application.

[0237] It should also be noted that the above description of this application through embodiments is merely exemplary and explanatory. New embodiments formed by arbitrarily combining the steps in the above embodiments are also within the protection scope of this application. It is understood that in the specific implementation of this application, user information and other related data are involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions. For example, the query text corpus and response text corpus involved in this application are all carried out with the user's permission and in compliance with relevant laws, regulations and standards. The user can be the user who uploads the query text corpus and / or response text corpus.

[0238] The following are embodiments of the apparatus described in this application, which can be used to execute the embodiments of the method described in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method described in this application.

[0239] Please refer to Figure 14 This diagram illustrates a block diagram of a sample generation apparatus for an entity recall model according to an embodiment of this application. The apparatus has the function of implementing the sample generation method for the aforementioned entity recall model. This function can be implemented in hardware or by hardware executing corresponding software. The apparatus 1400 can be a computer device or can be installed within a computer device. The apparatus 1400 may include: a corpus acquisition module 1410, an entity acquisition module 1420, a positive example generation module 1430, and a negative example generation module 1440.

[0240] The corpus acquisition module 1410 is used to acquire multiple query text corpora belonging to the same target domain, as well as response text corpora corresponding to the multiple query text corpora respectively.

[0241] The entity acquisition module 1420 is used to extract at least one entity that satisfies a first condition from the response text corpus corresponding to the query text corpus, and obtain the entity set corresponding to the query text corpus.

[0242] The positive example generation module 1430 is used to generate positive training samples for the first entity recall model based on the first query text corpus and the first entity set among the multiple query text corpora; wherein, the first entity set refers to the entity set corresponding to the first query text corpus.

[0243] The negative example generation module 1440 is used to generate training sample negative examples for the first entity recall model based on the first query text corpus and the second entity set; wherein, the second entity set refers to the entity set corresponding to the second query text corpus, and the second query text corpus is the query text corpus other than the first query text corpus among multiple query text corpora; wherein, the training sample positive examples and the training sample negative examples are used to train the first entity recall model, and the trained first entity recall model is used to determine the semantic matching degree between the target query text and the target entity belonging to the target domain.

[0244] In an exemplary embodiment, such as Figure 15 As shown, the entity acquisition module 1420 includes: a word segmentation acquisition unit 1421 and an entity acquisition unit 1422.

[0245] The word segmentation acquisition unit 1421 is used to perform word segmentation processing on the response text corpus corresponding to the query text corpus to obtain at least one word segment.

[0246] The entity acquisition unit 1422 is used to determine at least one entity that satisfies the first condition from the at least one word segmentation based on the query entity library of the target domain, and obtain the entity set corresponding to the query text corpus.

[0247] In an exemplary embodiment, the entity acquisition unit 1422 includes: a word segmentation processing subunit, an importance acquisition subunit, and an entity acquisition subunit.

[0248] The word segmentation processing subunit determines the words contained in the entity library from the at least one word segment to obtain at least one candidate entity.

[0249] The degree acquisition subunit is used to acquire the importance degree of each candidate entity in the response text corpus.

[0250] The entity acquisition subunit is used to obtain the entity set corresponding to the query text corpus based on the candidate entities that meet the second condition according to the importance level.

[0251] In an exemplary embodiment, the degree acquisition subunit is configured to acquire the number of times the candidate entity appears in the at least one word segment, wherein the number of appearances is positively correlated with the importance; or, acquire the number of times the candidate entity appears in the at least one word segment, and the total number of the at least one word segment; determine the frequency of appearance of the candidate entity in the response text corpus based on the number of appearances and the total number; wherein the frequency of appearance is positively correlated with the importance; or, acquire the number of times the candidate entity appears in the at least one word segment, and the total number of appearances of each candidate entity in the at least one word segment; determine the proportion of appearance of the candidate entity among multiple candidate entities based on the number of appearances and the total number of appearances; wherein the proportion of appearance is positively correlated with the importance.

[0252] In an exemplary embodiment, such as Figure 15 As shown, the device 1400 further includes an entity library acquisition unit 1450.

[0253] The entity database acquisition unit 1450 is used to acquire at least one candidate query entity belonging to the target domain; acquire the number of queries for each candidate query entity in historical query data; and generate query entities in the entity database based on the candidate query entities whose query counts satisfy a third condition; wherein the entity database includes multiple query entities belonging to the target domain.

[0254] In an exemplary embodiment, the first entity set contains a entities, where a is a positive integer; the second entity set contains b entities, where b is a positive integer.

[0255] In an exemplary embodiment, the positive example generation module 1430 is configured to generate a training sample positive examples for the first entity recall model based on the first query text corpus and the a entities; wherein, one of the training sample positive examples includes the first query text corpus and one of the a entities.

[0256] In an exemplary embodiment, the negative example generation module 1440 is configured to generate b training sample negative examples for the first entity recall model based on the first query text corpus and the b entities; wherein, one of the b training sample negative examples includes the first query text corpus and one of the b entities.

[0257] In an exemplary embodiment, the corpus acquisition module 1410 is further configured to traverse the entity sets corresponding to each of the other query text corpora based on the first entity set, and obtain entity duplication results corresponding to each of the query text corpora; wherein the entity duplication results are used to indicate whether there are identical entities between the first entity set and the entity sets corresponding to the other query text corpora; and to determine at least one second query text corpus from each of the other query text corpora based on the entity duplication results; wherein there are no identical entities between the second entity set and the first entity set.

[0258] In an exemplary embodiment, such as Figure 15 As shown, the device 1400 includes: a result output module 1460, a loss acquisition module 1470, and a model training module 1480.

[0259] The result output module 1460 is used to input the positive examples and negative examples of the training samples into the first entity recall model respectively, and obtain the output result of the first entity recall model for the first query text corpus.

[0260] The loss acquisition module 1470 is used to determine the loss of the first entity recall model based on the output results of multiple query text corpora.

[0261] The model training module 1480 is used to adjust the parameters of the first entity recall model based on the loss of the first entity recall model.

[0262] In an exemplary embodiment, the result output module 1460 is configured to: acquire the text semantic vector of the first query text corpus; acquire the positive semantic vector of each positive entity in the first entity set; acquire the negative semantic vector of each negative entity in the second entity set; determine a first semantic distance based on the text semantic vector and the positive semantic vector; and determine a second semantic distance based on the text semantic vector and the negative semantic vector; wherein the output result of the first query text corpus includes the first semantic distance corresponding to each of the positive entities and the second semantic distance corresponding to each of the negative entities.

[0263] In an exemplary embodiment, the loss acquisition module 1470 is configured to combine any positive entity in the first entity set with any negative entity in the second entity set to obtain at least one entity group; wherein, an entity group includes one positive entity and one negative entity; for a target entity group in the at least one entity group, the loss of the first entity recall model for the target entity group is determined based on the first semantic distance corresponding to the target positive entity in the target entity group and the second semantic distance corresponding to the target negative entity in the target entity group; the loss of the first entity recall model for the first query text corpus is determined based on the loss of the first entity recall model for each entity group; and the loss of the first entity recall model for each query text corpus is determined based on the loss of the first entity recall model for each query text corpus.

[0264] In an exemplary embodiment, such as Figure 15 As shown, the device 1400 further includes a sample generation module 1490.

[0265] The sample generation module 1490 is used to obtain a first training sample set for the second entity recall model; wherein, a first training sample in the first training sample set includes a training text corpus, a sample entity corresponding to the training text corpus, and a first label corresponding to the sample entity, and the first label is used to indicate whether the correspondence between the training text corpus and the sample entity is accurate.

[0266] The loss acquisition module 1470 is further configured to perform a first task training on the second entity recall model based on each first training sample in the first training sample set, and obtain a first loss of the second entity recall model; wherein, the first loss is used to measure the accuracy of the relationship discrimination function of the second entity recall model.

[0267] The model training module 1480 is also used to adjust the parameters of the second entity recall model based on the first loss.

[0268] In an exemplary embodiment, the sample generation module 1490 is further configured to obtain a second training sample set for the second entity recall model; wherein, a second training sample in the second training sample set includes the training text corpus and a second label corresponding to the training text corpus, the second label being used to indicate whether the training text corpus contains feature text of the target domain.

[0269] The loss acquisition module 1470 is further configured to acquire the text semantic vector of the training text corpus; generate a second discrimination result of the second entity recall model for the training text corpus based on the text semantic vector; wherein, the second discrimination result refers to the probability that the training text corpus contains feature text of the target domain; and determine the second loss of the second entity recall model based on the second discrimination result of each training text corpus in the training sample set and the second label of each training text corpus.

[0270] The model training module 1480 is further configured to adjust the parameters of the second entity recall model based on the first loss and the second loss.

[0271] In summary, the technical solution provided in this application generates positive training samples for the first entity recall model using the first query text corpus and the first entity set, and generates negative training samples for the first entity recall model using the first query text corpus and the second entity set. The entity set is extracted from existing response text corpus, thus achieving automatic generation of positive and negative training samples without requiring manual annotation of entities corresponding to the first query text corpus. This improves the efficiency of generating training samples for the first entity recall model and consequently, the training efficiency of the model. Furthermore, the response text corpus and the query text corpus have a corresponding relationship; the entity set corresponding to the query text corpus is extracted from the response text corpus corresponding to the query text corpus, improving the accuracy of entity set acquisition and thus enhancing the accuracy of the first entity recall model.

[0272] Please refer to Figure 16 This diagram illustrates a block diagram of a search apparatus according to an embodiment of this application. The apparatus has the function of implementing the search method described above; this function can be implemented in hardware or by hardware executing corresponding software. The apparatus can be a computer device or can be installed within a computer device. The apparatus 1600 may include: a text acquisition module 1610, a matching acquisition module 1620, an entity generation module 1630, a result acquisition module 1640, an entity determination module 1650, and a text retrieval module 1660.

[0273] The text acquisition module 1610 is used to acquire target query text belonging to the target domain.

[0274] The matching acquisition module 1620 is used to acquire the semantic matching degree between the target query text and each query entity in the entity database using the first entity recall model; wherein, the entity database includes multiple query entities belonging to the target domain.

[0275] The entity generation module 1630 is used to generate at least one candidate entity corresponding to the target query text based on the query entities whose semantic matching degree meets the target conditions.

[0276] The result acquisition module 1640 is used to process at least one corresponding group using a second entity recall model to obtain the relationship discrimination result of each corresponding group; wherein, one corresponding group includes the target query text and a candidate entity.

[0277] The entity determination module 1650 is used to determine the recall entity corresponding to the target query text from the at least one candidate entity based on the relationship discrimination result.

[0278] The text retrieval module 1660 is used to search the text database for at least one response text corresponding to the target query text based on the recall entity corresponding to the target query text.

[0279] In an exemplary embodiment, such as Figure 17 As shown, the matching acquisition module 1620 includes: a vector acquisition unit 1621 and a distance acquisition unit 1622.

[0280] The vector acquisition unit 1621 is used to acquire the text semantic vector of the target query text and the entity semantic vector of each query entity that is stored in advance.

[0281] The distance acquisition unit 1622 is used to acquire the semantic distance between the text semantic vector and the entity semantic vector of each query entity, wherein the semantic distance is negatively correlated with the semantic matching degree.

[0282] In summary, the technical solution provided in this application embodiment obtains at least one candidate entity corresponding to the target query text from the query entities in the entity database through a trained first entity recall model, thereby improving the accuracy of candidate entity acquisition; and furthermore, obtains the recall entity corresponding to the target query text from at least one candidate entity through a trained second entity recall model, thereby improving the accuracy of recall entity acquisition.

[0283] It should be noted that the apparatus provided in the above embodiments is only illustrated by the division of the above functional modules when implementing its functions. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus and method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.

[0284] Please refer to Figure 18This diagram illustrates the structural block diagram of a computer device provided in one embodiment of this application. This computer device can be used to implement the sample generation method or search method of the aforementioned entity recall model. Specifically:

[0285] Computer device 1800 includes a central processing unit (CPU) 1801, a system memory 1804 including random access memory (RAM) 1802 and read-only memory (ROM) 1803, and a system bus 1805 connecting the system memory 1804 and the CPU 1801. Computer device 1800 also includes a basic input / output system (I / O system) 1806 that facilitates information transfer between various components within the computer, and a mass storage device 1807 for storing the operating system 1813, application programs 1814, and other program modules 1815.

[0286] The basic input / output system 1806 includes a display 1808 for displaying information and an input device 1809 for user input, such as a mouse or keyboard. Both the display 1808 and the input device 1809 are connected to the central processing unit 1801 via an input / output controller 1810 connected to the system bus 1805. The basic input / output system 1806 may also include the input / output controller 1810 for receiving and processing input from multiple other devices such as a keyboard, mouse, or electronic stylus. Similarly, the input / output controller 1810 also provides output to a display screen, printer, or other types of output devices.

[0287] Mass storage device 1807 is connected to central processing unit 1801 via a mass storage controller (not shown) connected to system bus 1805. Mass storage device 1807 and its associated computer-readable media provide non-volatile storage for computer device 1800. That is, mass storage device 1807 may include computer-readable media (not shown) such as hard disk or CD-ROM (Compact Disc Read-Only Memory) drive.

[0288] Without loss of generality, computer-readable media can include computer storage media and communication media. Computer storage media includes volatile and non-volatile, removable and non-removable media implemented using any method or technology for storing information such as computer-readable instructions, data structures, program modules, or other data. Computer storage media includes RAM, ROM, EPROM (Erasable Programmable Read Only Memory), EEPROM (Electrically Erasable Programmable Read Only Memory), flash memory or other solid-state storage devices, CD-ROM, DVD (Digital Video Disc) or other optical storage, magnetic tape cassettes, magnetic tape, disk storage, or other magnetic storage devices. Of course, those skilled in the art will recognize that computer storage media are not limited to the above-mentioned types. The system memory 1804 and mass storage device 1807 described above can be collectively referred to as memory.

[0289] According to various embodiments of this application, the computer device 1800 can also be connected to a remote computer on a network, such as the Internet. That is, the computer device 1800 can be connected to a network 1812 via a network interface unit 1811 connected to the system bus 1805, or the network interface unit 1811 can be used to connect to other types of networks or remote computer systems (not shown).

[0290] The memory also includes a computer program stored in the memory and configured to be executed by one or more processors to implement the sample generation method of the entity recall model or the search method described above.

[0291] In an exemplary embodiment, a computer-readable storage medium is also provided, the storage medium storing at least one instruction, at least one program, code set, or instruction set, wherein the at least one instruction, the at least one program, the code set, or the instruction set, when executed by a processor, implements the sample generation method of the entity recall model described above, or implements the search method described above.

[0292] Optionally, the computer-readable storage medium may include: ROM (Read Only Memory), RAM (Random Access Memory), SSD (Solid State Drives), or optical disc, etc. The random access memory may include ReRAM (Resistance Random Access Memory) and DRAM (Dynamic Random Access Memory).

[0293] In an exemplary embodiment, a computer program product or computer program is also provided, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the sample generation method of the entity recall model described above, or to perform the search method described above.

[0294] It should be understood that "multiple" as used herein refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. Furthermore, the step numbers described herein are merely illustrative of one possible execution order. In some other embodiments, the steps may not be executed in numerical order, such as two steps with different numbers being executed simultaneously, or two steps with different numbers being executed in the reverse order of the illustration. This application does not limit this.

[0295] The above description is merely an exemplary embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A sample generation method for an entity recall model, characterized in that, The method includes: Obtain multiple query text corpora belonging to the same target domain, and response text corpora corresponding to each of the multiple query text corpora; The response text corpus corresponding to the query text corpus is segmented to obtain at least one segmented word; Based on the entity library of the target domain, at least one entity that satisfies the first condition is determined from the at least one word segmentation to obtain the entity set corresponding to the query text corpus. The first condition includes one of the following: the word segmentation is the query entity, the word segmentation is a synonym of the query entity, or the word segmentation is an important query entity in the response text corpus. For the first query text corpus among the multiple query text corpora, positive training samples for the first entity recall model are generated based on the first query text corpus and the first entity set; wherein, the first entity set refers to the entity set corresponding to the first query text corpus; Based on the first query text corpus and the second entity set, training sample negative examples are generated for the first entity recall model; wherein, the second entity set refers to the entity set corresponding to the second query text corpus, and the second query text corpus is the query text corpus other than the first query text corpus among the multiple query text corpora; The positive and negative training samples are used to train the first entity recall model. The trained first entity recall model is used to determine the semantic matching degree between the target query text and the target entity belonging to the target domain.

2. The method according to claim 1, characterized in that, The query entity based on the entity library of the target domain determines at least one entity that satisfies the first condition from the at least one word segmentation, thereby obtaining the entity set corresponding to the query text corpus, including: From the at least one word segment, determine the word segment contained in the entity library to obtain at least one candidate entity; The importance of each candidate entity in the response text corpus is obtained respectively; Based on the candidate entities that satisfy the second condition in terms of importance, the entity set corresponding to the query text corpus is obtained.

3. The method according to claim 2, characterized in that, The step of obtaining the importance of each candidate entity in the response text corpus includes: The number of times the candidate entity appears in the at least one word segment is obtained, and the number of occurrences is positively correlated with the importance. or, The number of times the candidate entity appears in the at least one word segment and the total number of the at least one word segment are obtained; the frequency of the candidate entity in the response text corpus is determined based on the number of occurrences and the total number; wherein the frequency of occurrence is positively correlated with the importance. or, The number of times the candidate entity appears in the at least one word segment is obtained, as well as the total number of times each candidate entity appears in the at least one word segment; based on the number of occurrences and the total number of occurrences, the proportion of occurrence of the candidate entity among the multiple candidate entities is determined; wherein, the proportion of occurrence is positively correlated with the importance.

4. The method according to claim 1, characterized in that, The method further includes: Obtain at least one candidate query entity belonging to the target domain; Obtain the number of queries for each candidate query entity in the historical query data; Based on the candidate query entities whose query counts satisfy the third condition, the query entities in the entity database are generated. The entity database includes multiple query entities belonging to the target domain.

5. The method according to claim 1, characterized in that, The first entity set contains 'a' entities, where 'a' is a positive integer; the second entity set contains 'b' entities, where 'b' is a positive integer. The step of generating positive training samples for the first entity recall model based on the first query text corpus and the first entity set includes: Based on the first query text corpus and the a entities, generate a positive training sample for the first entity recall model. Among them, one of the a training sample positive examples includes the first query text corpus and one of the a entities; The step of generating negative training samples for the first entity recall model based on the first query text corpus and the second entity set includes: Based on the first query text corpus and the b entities, generate b training sample negative examples for the first entity recall model; Among them, one of the negative training samples in the b training sample negative examples includes the first query text corpus and one of the b entities.

6. The method according to any one of claims 1 to 5, characterized in that, The method further includes: Based on the first entity set, the entity sets corresponding to each other query text corpus are traversed to obtain the entity duplication results corresponding to each of the other query text corpus; wherein, the entity duplication results are used to indicate whether there are any identical entities between the first entity set and the entity sets corresponding to the other query text corpus. Based on the entity duplication results, at least one second query text corpus is determined from each of the other query text corpora; wherein, there are no identical entities between the second entity set and the first entity set.

7. The method according to any one of claims 1 to 5, characterized in that, The method further includes: The positive and negative examples of the training samples are respectively input into the first entity recall model to obtain the output results of the first entity recall model for the first query text corpus. Based on the output results of multiple query text corpora, the loss of the first entity recall model is determined; The parameters of the first entity recall model are adjusted based on the loss of the first entity recall model.

8. The method according to claim 7, characterized in that, The step of inputting the positive and negative examples of the training samples into the first entity recall model to obtain the output of the first entity recall model for the first query text corpus includes: Obtain the text semantic vector of the first query text corpus; and obtain the positive semantic vector of each positive entity in the first entity set; and obtain the negative semantic vector of each negative entity in the second entity set. Based on the text semantic vector and the positive example semantic vector, a first semantic distance is determined; The second semantic distance is determined based on the text semantic vector and the negative example semantic vector; The output of the first query text corpus includes the first semantic distance corresponding to each of the positive example entities and the second semantic distance corresponding to each of the negative example entities.

9. The method according to claim 8, characterized in that, The step of determining the loss of the first entity recall model based on the output results of multiple query text corpora includes: For any positive instance entity in the first entity set, combine it with any negative instance entity in the second entity set to obtain at least one entity group; wherein, an entity group includes one positive instance entity and one negative instance entity; For a target entity group in the at least one entity group, the loss of the first entity recall model for the target entity group is determined based on the first semantic distance corresponding to the target positive instance entity in the target entity group and the second semantic distance corresponding to the target negative instance entity in the target entity group. Based on the loss of the first entity recall model for each entity group, determine the loss of the first entity recall model for the first query text corpus; The loss of the first entity recall model is determined based on the loss of the first entity recall model for each of the query text corpora.

10. The method according to any one of claims 1 to 5, characterized in that, The method further includes: Obtain a first training sample set for the second entity recall model; wherein, a first training sample in the first training sample set includes a training text corpus, a sample entity corresponding to the training text corpus, and a first label corresponding to the sample entity, wherein the first label is used to indicate whether the correspondence between the training text corpus and the sample entity is accurate; Based on each first training sample in the first training sample set, the second entity recall model is trained on a first task to obtain the first loss of the second entity recall model; wherein, the first loss is used to measure the accuracy of the relationship discrimination function of the second entity recall model. The parameters of the second entity recall model are adjusted based on the first loss.

11. The method according to claim 10, characterized in that, The method further includes: Obtain a second training sample set for the second entity recall model; wherein, a second training sample in the second training sample set includes the training text corpus and a second label corresponding to the training text corpus, the second label being used to indicate whether the training text corpus contains feature text of the target domain; Obtain the text semantic vector of the training text corpus; Based on the text semantic vector, a second discrimination result of the second entity recall model is generated for the training text corpus; wherein, the second discrimination result refers to the probability that the training text corpus contains feature text of the target domain; Based on the second discrimination result of each training text corpus in the training sample set, and the second label of each training text corpus, the second loss of the second entity recall model is determined; wherein, the second loss is used to measure the accuracy of the feature discrimination function of the second entity recall model; The step of adjusting the parameters of the second entity recall model based on the first loss includes: Based on the first loss and the second loss, the parameters of the second entity recall model are adjusted.

12. A search method, characterized in that, The method further includes: Retrieve the target query text belonging to the target domain; The first entity recall model is used to obtain the semantic matching degree between the target query text and each query entity in the entity database; wherein, the entity database includes multiple query entities belonging to the target domain; Based on the query entities whose semantic matching degree satisfies the target conditions, at least one candidate entity corresponding to the target query text is generated. A second entity recall model is used to process at least one corresponding group to obtain the relationship discrimination result of each corresponding group; wherein, each corresponding group includes the target query text and a candidate entity, and the second entity recall model is used to determine whether the correspondence between the target query text and each candidate entity is accurate; Based on the relationship discrimination result, the recall entity corresponding to the target query text is determined from the at least one candidate entity; Based on the recall entity corresponding to the target query text, at least one response text corresponding to the target query text is retrieved from the text database.

13. The method according to claim 12, characterized in that, The first entity recall model is used to obtain the semantic matching degree between the target query text and each query entity in the entity database, including: Obtain the text semantic vector of the target query text, and the entity semantic vector of each of the query entities stored in advance; The semantic distance between the text semantic vector and the entity semantic vector of each query entity is obtained respectively, and the semantic distance is negatively correlated with the semantic matching degree.

14. A sample generation device for an entity recall model, characterized in that, The device includes: The corpus acquisition module is used to acquire multiple query text corpora belonging to the same target domain, as well as response text corpora corresponding to the multiple query text corpora respectively; The entity acquisition module is used to perform word segmentation on the response text corpus corresponding to the query text corpus to obtain at least one word segment; based on the query entity of the entity library of the target domain, it determines at least one entity that satisfies a first condition from the at least one word segment to obtain the entity set corresponding to the query text corpus, wherein the first condition includes one of the following: the word segment is the query entity, the word segment is a synonym of the query entity, or the word segment is an important query entity in the response text corpus; The positive example generation module is used to generate positive training samples for the first entity recall model based on the first query text corpus and the first entity set among the multiple query text corpora; wherein, the first entity set refers to the entity set corresponding to the first query text corpus; The negative example generation module is used to generate training sample negative examples for the first entity recall model based on the first query text corpus and the second entity set; wherein, the second entity set refers to the entity set corresponding to the second query text corpus, and the second query text corpus is the query text corpus other than the first query text corpus among the multiple query text corpora; The positive and negative training samples are used to train the first entity recall model. The trained first entity recall model is used to determine the semantic matching degree between the target query text and the target entity belonging to the target domain.

15. A search device, characterized in that, The device includes: The text acquisition module is used to acquire target query text belonging to the target domain. The matching acquisition module is used to acquire the semantic matching degree between the target query text and each query entity in the entity database using the first entity recall model; wherein, the entity database includes multiple query entities belonging to the target domain; The entity generation module is used to generate at least one candidate entity corresponding to the target query text based on the query entities whose semantic matching degree meets the target conditions. The result acquisition module is used to process at least one corresponding group using a second entity recall model to obtain the relationship discrimination result of each corresponding group; wherein, a corresponding group includes the target query text and a candidate entity, and the second entity recall model is used to determine whether the correspondence between the target query text and each candidate entity is accurate; An entity determination module is used to determine the recall entity corresponding to the target query text from the at least one candidate entity based on the relationship discrimination result. The text retrieval module is used to search the text database for at least one response text corresponding to the target query text based on the recall entity corresponding to the target query text.

16. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing at least one instruction, the at least one instruction being loaded and executed by the processor to implement the sample generation method of the entity recall model as described in any one of claims 1 to 11, or to implement the search method as described in claim 12 or 13.

17. A computer-readable storage medium, characterized in that, The storage medium stores at least one instruction, which is loaded and executed by a processor to implement the sample generation method of the entity recall model as described in any one of claims 1 to 11, or to implement the search method as described in claim 12 or 13.

18. A computer program product, characterized in that, The computer program product includes computer instructions stored in a computer-readable storage medium, and a processor reads and executes the computer instructions from the computer-readable storage medium to implement the sample generation method of the entity recall model as described in any one of claims 1 to 11, or to implement the search method as described in claim 12 or 13.

Citation Information

Patent Citations

  • Recommendation reason screening method and device and electronic equipment

    CN111831902A

  • Entity recognition method and device

    CN113065353A