Text data processing method, device, equipment and medium

By obtaining the similarity between positive and negative samples in the entity recall model, correcting the network parameters, and forming the target entity recall model, the problem of low recall caused by incomplete vocabulary list is solved, and the entity recall and text understanding ability are improved.

CN113761105BActive Publication Date: 2025-08-29TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110567596.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-24
Publication Date
2025-08-29
Estimated Expiration
2041-05-24

AI Technical Summary

Technical Problem

In existing entity link services, the candidate entity recall rate is too low due to incompleteness of the vocabulary, and the text content cannot be accurately understood.

Method used

By obtaining the labeled entity of the sample query entity as a positive sample, the initial entity recall model is used to generate the first entity representation feature and the second entity representation feature of the entity knowledge base, calculate the similarity and obtain the first negative sample, and correct the network parameters of the initial entity recall model in combination with the positive sample and the negative sample to form the target entity recall model.

Benefits of technology

It improves the recall rate of the entity recall model, can better distinguish similar entities, and enhances the ability to understand text content.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113761105B_ABST
    Figure CN113761105B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a text data processing method, apparatus, device, and medium, the method comprising: obtaining sample text data containing a sample query entity, determining the labeled entity corresponding to the sample query entity in the entity knowledge base as a positive sample; obtaining the first entity representation feature of the sample query entity and the second entity representation features of all sample entities in the entity knowledge base according to the initial entity recall model; obtaining the first negative sample corresponding to the sample query entity in the entity sample according to the entity similarity between the first entity representation feature and all the second entity representation features; obtaining the second negative sample of the sample query entity in the entity knowledge base, and correcting the network parameters of the initial entity recall model according to the positive sample, the first negative sample, and the second negative sample, and determining the initial entity recall model after the parameter correction as the target entity recall model. By adopting the embodiment of the present application, the recall rate of the entity recall model can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a text data processing method, apparatus, device, and medium. Background Art

[0002] Entity linking service refers to matching entities appearing in text with entities existing in the knowledge graph. This entity linking service can be applied in scenarios such as information search, question and answer, and recommendation.

[0003] Currently, in various application scenarios of entity linking services, after obtaining text content, the entities contained in the text content can be identified, and based on a pre-sorted vocabulary, the entities in the knowledge base corresponding to the entities in the text content can be found, thereby recalling a list of candidate entities in the knowledge base, filtering and sorting the entities contained in the candidate entity list, and ultimately obtaining knowledge base entities that match the above text content. The resulting knowledge base entities are conducive to accurately understanding the above text content. However, when recalling a candidate entity list based on a vocabulary, the incompleteness of the vocabulary may cause the recalled candidate entities to differ greatly from the text content itself, resulting in a low recall rate for the text content. Summary of the Invention

[0004] Embodiments of the present application provide a text data processing method, apparatus, device, and medium, which can improve the recall rate of an entity recall model.

[0005] An embodiment of the present application provides a text data processing method, including:

[0006] Obtain sample text data containing a sample query entity, and determine the labeled entity corresponding to the sample query entity in the entity knowledge base as a positive sample;

[0007] Obtaining a first entity representation feature corresponding to a sample query entity according to an initial entity recall model, and obtaining a second entity representation feature corresponding to a sample entity in an entity knowledge base according to the initial entity recall model; the sample entity in the entity knowledge base includes a positive sample;

[0008] Obtaining a first negative sample corresponding to the sample query entity from the sample entity based on the entity similarity between the first entity representation feature and the second entity representation feature corresponding to the sample entity; the entity similarity between the second entity representation feature corresponding to the first negative sample and the first entity representation feature is greater than the entity similarity between the first entity representation feature and the second entity representation feature corresponding to the positive sample;

[0009] A second negative sample corresponding to the sample query entity is obtained in the entity knowledge base, and the network parameters of the initial entity recall model are corrected according to the positive sample, the first negative sample and the second negative sample, and the initial entity recall model after the parameter correction is determined as the target entity recall model; the second negative sample belongs to the sample entity other than the positive sample and the first negative sample in the entity knowledge base, and the target entity recall model is used to recall the candidate entity corresponding to the query text data from the entity knowledge base.

[0010] An embodiment of the present application provides a text data processing device, including:

[0011] A sample data acquisition module is used to obtain sample text data containing a sample query entity and determine the labeled entity corresponding to the sample query entity in the entity knowledge base as a positive sample;

[0012] An entity representation module is configured to obtain a first entity representation feature corresponding to a sample query entity based on an initial entity recall model, and obtain a second entity representation feature corresponding to a sample entity in an entity knowledge base based on the initial entity recall model; the sample entity in the entity knowledge base includes a positive sample;

[0013] a negative sample determination module, configured to obtain, from the sample entity, a first negative sample corresponding to the sample query entity based on an entity similarity between the first entity representation feature and a second entity representation feature corresponding to the sample entity; wherein the entity similarity between the second entity representation feature corresponding to the first negative sample and the first entity representation feature is greater than the entity similarity between the first entity representation feature and the second entity representation feature corresponding to the positive sample;

[0014] A parameter correction module is used to obtain a second negative sample corresponding to the sample query entity in the entity knowledge base, correct the network parameters of the initial entity recall model based on the positive sample, the first negative sample and the second negative sample, and determine the initial entity recall model after parameter correction as the target entity recall model; the second negative sample belongs to the sample entity in the entity knowledge base other than the positive sample and the first negative sample, and the target entity recall model is used to recall the candidate entity corresponding to the query text data from the entity knowledge base.

[0015] Among them, the number of sample query entities is M, where M is a positive integer;

[0016] The sample data acquisition module includes:

[0017] A query entity acquisition unit is used to acquire sample text data and acquire M sample query entities from the sample text data according to location identification information carried by the sample text data;

[0018] The labeled entity acquisition unit is used to obtain labeled entities that match the M sample query entities in the entity knowledge base according to the entity identification information carried by the sample text data, and determine the labeled entities as positive samples corresponding to the M sample query entities.

[0019] Among them, the entity knowledge base includes N sample entities, where N is a positive integer;

[0020] The entity representation module includes:

[0021] A first encoding unit, configured to input the sample text data into a first text encoding component in the initial entity recall model, and generate a first entity representation feature corresponding to the sample query entity through the first text encoding component;

[0022] The second encoding unit is used to input N sample entities in the entity knowledge base into the second text encoding component in the initial entity recall model in sequence, and generate second entity representation features corresponding to the N sample entities respectively through the second text encoding component.

[0023] The first encoding unit includes:

[0024] The word vector acquisition subunit is used to divide the sample text data into D unit characters and obtain the first unit word vectors corresponding to the D unit characters respectively; D is a positive integer;

[0025] A text vector acquisition subunit, configured to acquire first text vectors corresponding to the D unit characters according to semantic information of the D unit characters in the sample text data;

[0026] A position vector acquisition subunit, configured to acquire first position vectors corresponding to the D unit characters respectively according to the text positions of the D unit characters in the sample text data;

[0027] A first vector superposition subunit, configured to superimpose the first unit word vector, the first text vector, and the first position vector to obtain a first input representation feature;

[0028] The first representation feature generation subunit is used to input the first input representation feature into the first text encoding component in the initial entity recall model, perform text encoding on the first input representation feature according to the first text encoding component, and generate the first entity representation feature corresponding to the sample query entity.

[0029] The second encoding unit includes:

[0030] A second vector superposition subunit is used to obtain the second unit word vector, the second text vector and the second position vector corresponding to N sample entities in the entity knowledge base, and superimpose the second unit word vector, the second text vector and the second position vector to obtain a second input representation feature;

[0031] A second representation feature generating subunit is configured to input the second input representation feature into the second text encoding component in the initial entity recall model, perform text encoding on the second input representation feature according to the second text encoding component, and generate second entity representation features corresponding to N sample entities respectively;

[0032] The index establishment subunit is configured to establish index information for the N second entity representation features, and add the index information corresponding to the N second entity representation features to the index database.

[0033] Among them, the negative sample determination module includes:

[0034] an entity similarity acquisition unit, configured to acquire entity similarities between the first entity representation feature and the N second entity representation features respectively according to dot product results between the first entity representation feature and the second entity representation features corresponding to the N sample entities;

[0035] A similar entity acquisition unit is configured to search the index database for similar index information that matches the first entity representation feature based on the entity similarity, and to acquire similar entity representation features associated with the similar index information from the N second entity representation features;

[0036] The first negative sample determination unit is used to determine the entity similarity between the first entity representation feature and the second entity representation feature corresponding to the labeled entity as a threshold similarity, and determine the sample entity corresponding to the similar entity representation feature whose entity similarity is greater than the threshold similarity as the first negative sample corresponding to the sample query entity.

[0037] Among them, the entity knowledge base includes N sample entities, where N is a positive integer;

[0038] The parameter correction module includes:

[0039] a sample quantity determination unit, configured to count a first sample quantity corresponding to the first negative sample, and determine a second sample quantity based on the negative sample ratio value and the first sample quantity;

[0040] The second negative sample acquisition unit is configured to acquire second negative samples that meet a second sample quantity from the N sample entities included in the entity knowledge base.

[0041] Among them, the parameter correction module includes:

[0042] A first discrimination result obtaining unit, configured to combine the positive sample and the first negative sample into first training data, and obtain a first discrimination result corresponding to the first training data;

[0043] A second discrimination result obtaining unit, configured to combine the positive sample and the second negative sample into second training data, and obtain a second discrimination result corresponding to the second training data;

[0044] The network parameter correction unit is used to correct the network parameters of the initial entity recall model according to the first discrimination result and the second discrimination result, and determine the initial entity recall model after the parameter correction as the target entity recall model.

[0045] The network parameter correction unit is specifically used to:

[0046] Determine a model loss function corresponding to the initial entity recall model based on the first discrimination result and the second discrimination result;

[0047] The network parameters of the initial entity recall model are modified according to the model loss function. When the number of training times corresponding to the initial entity recall model meets the training termination condition, the initial entity recall model that meets the training termination condition is determined as the target entity recall model.

[0048] The device further comprises:

[0049] The query entity recognition module is used to obtain the query text data in the information query platform and obtain the query entity contained in the query text data;

[0050] The feature representation module is used to output the query entity representation features corresponding to the query entity and the sample entity representation features corresponding to the sample entities in the entity knowledge base through the target entity recall model;

[0051] The candidate entity recall module is used to obtain K candidate entities associated with the query entity in the entity knowledge base based on the feature similarity between the query entity representation feature and the sample entity representation feature; K is a positive integer;

[0052] The link entity determination module is used to obtain push evaluation values ​​corresponding to K candidate entities, and determine the candidate entity corresponding to the largest push evaluation value among the K candidate entities as the link entity corresponding to the entity to be queried.

[0053] The device further comprises:

[0054] The entity details information display module is used to obtain the entity details information corresponding to the linked entity, push the entity details information as the query result of the query text data to the information query platform, and display the query result in the information query platform.

[0055] In one aspect, an embodiment of the present application provides a computer device, including a memory and a processor, wherein the memory is connected to the processor, the memory is used to store a computer program, and the processor is used to call the computer program so that the computer device executes the method provided in the above aspect of the embodiment of the present application.

[0056] On one hand, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. The computer program is suitable for being loaded and executed by a processor, so that a computer device with a processor executes the method provided in the above aspect of the embodiment of the present application.

[0057] According to one aspect of the present application, a computer program product or computer program is provided, the computer program product or computer program including 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 method provided in the above aspect.

[0058] In an embodiment of the present application, sample text data containing a sample query entity can be obtained, and the labeled entity corresponding to the sample query entity in the entity knowledge base can be determined as a positive sample. According to the initial entity recall model, a first entity representation feature corresponding to the sample query entity and a second entity representation feature corresponding to the sample entity in the entity knowledge base can be obtained. According to the entity similarity between the first entity representation feature and the second entity representation feature corresponding to the sample entity, a first negative sample corresponding to the sample query entity is obtained in the sample entity, wherein the entity similarity between the second entity representation feature corresponding to the first negative sample and the first entity representation feature is greater than the entity similarity between the first entity representation feature and the second entity representation feature corresponding to the positive sample; a second negative sample corresponding to the sample query entity is obtained in the entity knowledge base, and the network parameters of the initial entity recall model are corrected according to the positive sample, the first negative sample and the second negative sample to obtain a trained target entity recall model, wherein the first negative sample belongs to a sample entity other than the positive sample and the first negative sample in the entity database. It can be seen that the first negative sample corresponding to the sample query entity can be determined through the initial entity recall model, where the positive sample is the labeled entity of the sample query entity, that is, the positive sample is known, the first negative sample is the sample entity in the entity knowledge base whose entity similarity is greater than the positive sample, that is, the first negative sample is similar to the positive sample, and the second negative sample is the sample entity selected from the entity knowledge base. The initial entity recall model is trained by the positive sample, the first negative sample, and the second negative sample, so that the trained target entity recall model can better distinguish similar entities, thereby improving the recall rate of the target entity recall model. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0060] Figure 1 This is a schematic diagram of a network architecture provided by an embodiment of the present application;

[0061] Figure 2 This is a training scene diagram of an entity recall model provided in an embodiment of the present application;

[0062] Figure 3 This is a flowchart of a text data processing method provided by an embodiment of the present application;

[0063] Figure 4 This is a schematic diagram of the data format of a sample text data provided in an embodiment of the present application;

[0064] Figure 5 This is a schematic diagram of obtaining entity representation features provided by an embodiment of the present application;

[0065] Figure 6 is a schematic diagram of calculating entity similarity provided by an embodiment of the present application;

[0066] Figure 7 Schematic diagram of an entity recall model based on adversarial learning training provided in an embodiment of the present application;

[0067] Figure 8 This is a flow chart of a training entity recall model provided in an embodiment of the present application;

[0068] Figure 9 This is a schematic diagram of an application scenario of an entity linking service provided in an embodiment of the present application;

[0069] Figure 10 This is a structural diagram of a text data processing device provided in an embodiment of the present application;

[0070] Figure 11 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0071] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0072] This application relates to artificial intelligence (AI) technology. AI is the theory, methods, techniques, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce new intelligent machines that can respond in a manner similar to human intelligence. AI also studies the design principles and implementation methods of various intelligent machines, enabling them to perceive, reason, and make decisions. AI is an interdisciplinary discipline encompassing a wide range of fields, encompassing both hardware and software technologies. Basic AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, speech processing, natural language processing, and machine learning / deep learning. This application specifically relates to natural language processing (NLP), a subcategory of AI technology.

[0073] Among them, natural language processing is an important direction in the fields of computer science and artificial intelligence. It studies various theories and methods that can achieve effective communication between humans and computers using natural language. Natural language processing is a science that integrates linguistics, computer science, and mathematics. Therefore, research in this field will involve natural language, that is, the language people use in daily life, so it is closely related to the study of linguistics. Natural language processing technology generally includes text processing, semantic understanding, machine translation, robot question answering, knowledge graph and other technologies. The present application specifically relates to entity recognition of a text to be processed. After identifying an entity from the text to be processed, the entity is converted into a first entity representation feature (representation vector). By calculating the entity similarity between the above entity representation feature and the second entity representation feature corresponding to all entities in the entity knowledge base, the candidate entities in the corresponding entity knowledge base are recalled, and then the candidate entities are filtered and sorted to obtain the final correct target entity. A corresponding relationship is established between the entity in the text to be processed and the target entity in the entity knowledge base to better understand the text to be processed.

[0074] This application also involves the following concepts:

[0075] Knowledge graph: A knowledge graph is a network consisting of nodes and edges connecting nodes, where the nodes in the knowledge graph can be nodes and the edges are the relationships between entities. For example, the knowledge graph includes the node "Xiao A" and the node "China", and these two nodes are connected by an edge from the node "Xiao A" to the entity "China". This edge is "nationality", which means that the nationality of "Xiao A" is "China". In this application, the entities contained in the above knowledge graph all belong to the entity knowledge base, where the entity knowledge base can include the entity name and entity detail information (also called entity profile) corresponding to each entity in the knowledge graph, and the entities in the entity knowledge base can be called sample entities.

[0076] Entity linking: Entity linking matches entities that appear in text with entities in the knowledge graph. For example, if the text is "Xiao A is the top scorer in the national college entrance examination," there is an entity "Xiao A" in the text, but there are several entities with the same name in the knowledge graph. Entity linking requires identifying "Xiao A" in the text and matching it with the college entrance examination student "Xiao A" in the knowledge graph.

[0077] Adversarial learning: Adversarial learning is a newly proposed machine learning method that is implemented by having two networks compete against each other. These two networks can be a generator network and a discriminator network. The generator network can continuously capture the probability distribution of real samples in the training library and convert the input random noise into new samples (which can be called fake data). The discriminator network can observe real data and fake data simultaneously to determine whether the input data is real. Through repeated confrontation, the capabilities of the generator and discriminator will continue to increase until a balance is reached. Ultimately, the trained generator can generate high-quality data that is indistinguishable from real data.

[0078] See Figure 1 , Figure 1 This is a schematic diagram of a network architecture provided by an embodiment of the present application. Figure 1 As shown, the network architecture may include a server 10d and a user terminal cluster, and the user terminal cluster may include one or more user terminals, and the number of user terminals is not limited here. Figure 1As shown, the user terminal cluster may specifically include user terminal 10a, user terminal 10b and user terminal 10c, etc. Among them, server 10d may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. User terminals 10a, user terminals 10b and user terminals 10c, etc. may include: smart phones, tablet computers, laptop computers, PDAs, mobile internet devices (MID), wearable devices (such as smart watches, smart bracelets, etc.) and smart TVs, etc., which have video / image playback functions. As Figure 1 As shown, the user terminal 10a, the user terminal 10b and the user terminal 10c can respectively establish a network connection with the server 10d, so that each user terminal can exchange data with the server 10d through the network connection.

[0079] like Figure 1As shown, taking the user terminal 10a in the user terminal cluster as an example, the user terminal 10a can obtain sample text data, which includes a sample query entity, and obtain a labeled entity that matches the sample query entity in the entity knowledge base, and the labeled entity corresponding to the sample query entity is known; an initial entity recall model can be obtained, and a first entity representation feature corresponding to the sample query entity and a second entity representation feature corresponding to the sample entity in the entity knowledge base are generated by the initial entity recall model. The sample entity in the entity knowledge base includes the above-mentioned labeled entity, and the second entity representation feature corresponding to the labeled entity can be determined as a positive sample of the sample query entity. By calculating the entity similarity between the first entity representation feature and the second entity representation feature corresponding to the sample entity, a first negative sample corresponding to the sample query entity can be obtained from the sample entity, and the entity similarity between the second entity representation feature corresponding to the first negative sample and the first entity representation feature is greater than the entity similarity between the positive sample and the first entity representation feature; and then, based on the positive sample, the first negative sample and the second negative sample corresponding to the sample query entity (sample entities other than the positive sample and the first negative sample can be randomly selected from the second entity representation feature corresponding to the sample entity), the network parameters of the initial entity recall model can be modified to obtain a trained target entity recall model. In other words, during the training of the initial entity recall model, the network parameters of the previous round of training can be used to determine the first negative sample of the sample query entity, that is, the first negative sample is generated by the network parameters of the previous round of training, the positive sample is known, and the second negative sample is a sample entity other than the positive sample randomly selected from the entity knowledge base. Then, the network parameters trained in the previous round can be corrected again based on the positive sample, the first negative sample and the second negative sample to obtain the network parameters of this round of training; repeat the above training process until the training termination condition is reached (for example, the training termination condition can be reaching a preset maximum number of training times, or reaching a training convergence condition), and the target entity recall model is obtained. The trained entity recall model can be used to recall candidate entities corresponding to the query text data from the entity knowledge base. The query text data can refer to the search text in the search scenario, or the question in the question-and-answer scenario, or the text content to be recommended in the recommendation scenario, etc.; the candidate entities recalled by the target entity recall model have a strong correlation with the query text data, that is, through the above training method, the recall rate of the entity recall model can be improved.

[0080] Please also see Figure 2 , Figure 2 This is a training scene diagram of an entity recall model provided in an embodiment of the present application. Figure 1 Taking the user terminal 10a shown in the figure as an example, the entity recall model is trained using adversarial learning. Figure 2As shown, the user terminal 10a can obtain an initialized entity recall model (which can be called an initial entity recall model). All data used to train the initial entity recall model can be labeled with the sample query entities contained therein, as well as the labeled entities of each sample query entity in the entity knowledge base. During the training process of the initial entity recall model, the network parameters of the initial entity recall model need to be continuously trained. The initial entity recall model generated by the previous round of training can be used as a generator, and the initial entity recall model of the current round of training can be used as a discriminator. The generator can be used to generate a first negative sample, which can be determined by the entity similarity between the entity representation features generated by the generator. The discriminator can be used to distinguish the samples generated by the generator. It should be noted that when the initial entity recall model is used as a generator, it can be understood as performing forward calculations in the initial entity recall model. When the initial entity recall model is used as a discriminator, it can be understood as a process of correcting the network parameters of the initial entity recall model, that is, the network parameter training process of the initial entity recall model is completed when the initial entity recall model is used as a discriminator.

[0081] like Figure 2 As shown, the user terminal 10a can obtain sample text data 20a for training the initial entity recall model. The sample text data 20a can be specifically represented as "Gaokao champion Xiao A". The sample text data 20a can pre-label the sample query entity 20b ("Xiao A"), and obtain the labeled entity corresponding to the sample query entity 20b in the entity knowledge base 20c. At this time, the labeled entity can be "Xiao A (Gaokao champion)". Among them, the number of entities contained in the entity knowledge base 20c can be N, N is a positive integer, such as N can be 1, 2, 3, ..., and the N entities contained in the entity knowledge base 20c can all be used as sample entities. The N sample entities here include the above-mentioned labeled entities; Figure 2 As shown, the entity knowledge base 20c can also include sample entities such as "Xiao A (surgeon)" and "Xiao B (film and television actor)", among which the entity name of the sample entity "Xiao A (surgeon)" is "Xiao A", and the entity details information is "Xiao A, the top scorer in the science college entrance examination in xx Province in 20xx, graduated from xx school..."; the entity name of the sample entity "Xiao B (film and television actor)" is "Xiao B", and the entity details information is "Xiao B, the heroine of the film and television drama "Rural xxx"..." and so on.

[0082] Further, the user terminal 10a can obtain an initial entity recall model, which can refer to an initialized entity recall model or an entity recall model that has not been trained completely. The initial entity recall model in the embodiments of the present application can be a language representation model, and this initial entity recall model can be used to convert a text described in natural language into an entity representation vector (which can be called entity representation features). The user terminal 10a can divide all the sample text data 20a ("the top scorer in the college entrance examination, Little A") into unit characters: "high", "exam", "top", "scorer", "little", "A". Through the initial entity recall model, the representation vectors corresponding to each unit character in the sample text data 20a can be generated (for example, the representation vector corresponding to the unit character "high", the representation vector corresponding to the unit character "exam", etc.). Furthermore, based on the representation vectors corresponding to each unit character respectively, the entity representation features 20d corresponding to the sample query entity 20b can be obtained. Similarly, for the N sample entities (including the sample entity names and the entity detail information corresponding to the sample entities) included in the entity knowledge base 20c, the above-mentioned same method can be adopted to generate the entity representation features corresponding to the N sample entities respectively; furthermore, the entity representation features corresponding to the N sample entities can be used to form an entity representation feature set 20e, and this entity representation feature set 20e can include the entity representation feature 1 corresponding to the labeled entity "Little A (the top scorer in the college entrance examination)", the entity representation feature 2 corresponding to the sample entity "Little A (surgeon)", the entity representation feature 3 corresponding to the sample entity "Little B (film and television actor)",....

[0083] Further, the user terminal 10a can calculate the entity similarity between the entity representation features 20d and the N entity representation features in the entity representation feature set 20e. For example, it can calculate the entity similarity 1 between the entity representation features 20d and the entity representation feature 1 in the entity representation feature set 20e, calculate the entity similarity 2 between the entity representation features 20d and the entity representation feature 2, calculate the entity similarity 3 between the entity representation features 20d and the entity representation feature 3,....; among which, the entity similarity between the entity representation features 20d corresponding to the sample query entity 20b and the entity representation feature 1 corresponding to the labeled entity is: entity similarity 1. The user terminal 10a can, in the entity representation feature set 20e, use the sample entities corresponding to the entity representation features with entity similarity greater than the above entity similarity 1 as the first negative samples corresponding to the sample query entity 20b. In other words, sample entities similar to the entity query entity 20b can be mined from the entity knowledge base, and the entity representation features corresponding to the similar sample entities here can be used as the first negative samples.

[0084] Optionally, the labeled entity "Xiao A (College Entrance Examination Champion)" can be used as a positive sample of the sample query entity 20b; of course, the user terminal 10a can randomly select a second negative sample of the sample query entity 20b from the sample entities other than the labeled entity and the first negative sample in the entity knowledge base 20c, and then combine the first negative sample and the second negative sample into a negative sample of the sample query entity 20b. According to the negative sample and the positive sample, the network parameters of the initial entity recall model are trained. Through continuous training, a trained target entity recall model can be finally obtained. In the embodiment of the present application, the first negative sample used in the training of the above-mentioned initial entity recall model is determined by the entity representation feature generated by the initial entity recall model generated by the previous round of training, and can be used to train the network parameters of the initial entity recall model according to the positive sample and the negative sample; because the negative sample includes a first negative sample similar to the entity representation feature 20d of the sample query entity 20b, the target entity recall model trained based on the negative sample and the positive sample can better distinguish entity data that is difficult to identify, thereby improving the recall rate of the target entity recall model.

[0085] See Figure 3 , Figure 3 This is a flowchart of a text data processing method provided by an embodiment of the present application. It is understandable that the text data processing method can be executed by a computer device, which can be a user terminal, or a server, or a system consisting of a user terminal and a server, or a computer program application (including program code), which is not specifically limited here. Figure 3 As shown, the text data processing method may include the following steps:

[0086] Step S101: obtain sample text data containing a sample query entity, and determine the labeled entity corresponding to the sample query entity in the entity knowledge base as a positive sample.

[0087] Specifically, the entity linking service may include steps such as entity recognition (mention recognition), candidate entity recall, and entity disambiguation; wherein, entity recognition may refer to identifying all entities from text data (query) described in natural language; candidate entity recall may refer to recalling candidate entities related to the entities contained in the text data query from the entity knowledge base through an entity recall model (the entity recall model here may refer to a trained model, or may be called a target entity recall model) (the number of candidate entities may be a value greater than 1); entity disambiguation may refer to filtering and sorting the recalled candidate entities to obtain the correct entities corresponding to the entities in the text data query, and then linking the entities in the text data query to the correct entities in the entity knowledge base. Before using the entity recall model to recall candidate entities from the entity knowledge base, the entity recall model needs to be trained; during the training process of the entity recall model, the computer device can obtain a training set for training the entity recall model. The training data contained in the training set can also be called sample text data. Each sample text data can be labeled with the sample query entity it contains, and the labeled entity in the entity knowledge base corresponding to the sample query entity is known; when the computer device obtains the sample text data from the training set, it can obtain the labeled sample query entity from the sample text data, and at the same time, it can also obtain the labeled entity that matches the sample query entity from the entity knowledge base, that is, the labeled entity in the entity knowledge base can be used to assist in understanding the above sample text data. For example, when the sample text data is a query text in a search platform, the labeled entities can be used to assist in understanding the semantic information of the query text in the entity knowledge base to obtain query results associated with the sample text data; when the sample text data is a question in a question-answering system, the labeled entities can be used to represent the accurate answer of the sample text data in the entity knowledge base; when the sample text data is the article content in a recommendation platform, the labeled entities can be used to represent the pushed content of the sample text data in the entity knowledge base.

[0088] Optionally, the sample text data in the training set may include one or more sample query entities. When the sample text data includes one sample query entity, it is necessary to obtain a labeled entity corresponding to the sample query entity from the entity knowledge base; when the sample text data includes multiple sample query entities, it is necessary to obtain the labeled entities corresponding to all the sample query entities contained in the sample text data from the entity knowledge base. Assuming that the number of sample query entities contained in the sample text data is M, M is a positive integer, such as M can be 1, 2, ..., after obtaining the sample text data, the computer device can obtain M sample query entities in the sample text data based on the position identification information (offset) carried by the sample text data, and can also obtain labeled entities that match the M sample query entities in the entity knowledge base based on the entity identification information (entity id) carried by the sample text data, and determine the labeled entities as positive samples corresponding to the M sample query entities.

[0089] Please also see Figure 4 , Figure 4 This is a data format diagram of a sample text data provided in an embodiment of the present application. Figure 4 As shown, for the sample text data 30a in the training set ("Is Xiao A the top scorer in the national college entrance examination?"), the sample text data 30a can mark the entity set (i.e., the entity id in the entity knowledge base) corresponding to each sample query entity in the current sample text data 30a. Figure 4 As shown, the sample query entity annotated by the sample text data 30a is: "Little A"; the position identification information carried by the sample text data 30a is 0, that is, the position of the sample query entity in the sample text data 30a is: 0 (the representation of the position identification information at this time is offset: 0, indicating that the sample query entity "Little A" is located at the starting position in the sample text data 30a); the entity identification information 30b carried by the sample text data 30a can be: the entity id is specifically da77793c-fe70-xxxx-ff98, and the entity id can be used to represent the annotated entity corresponding to the sample query entity "Little A"; optionally, when the context of the sample text data 30a is insufficient, a sample query entity can correspond to multiple annotated entities in the entity knowledge base. It should be noted that the positive sample, the first negative sample, and the second negative sample in the embodiment of the present application can be the entity id corresponding to the sample entity in the entity knowledge base.

[0090] Step S102: obtaining a first entity representation feature corresponding to a sample query entity according to an initial entity recall model, and obtaining a second entity representation feature corresponding to a sample entity in an entity knowledge base according to the initial entity recall model; the sample entity in the entity knowledge base includes a positive sample.

[0091] Specifically, the computer device can obtain an initialized entity recall model (also referred to as an initial entity recall model), and through the initial entity recall model, it can output the first entity representation feature corresponding to the sample query entity and the second entity representation feature corresponding to all sample entities in the entity knowledge base; the first entity representation feature in this application can also be a representation vector corresponding to the sample number text data.

[0092] Optionally, the initial entity recall model can be a dual-tower model, which can include a first text encoding component and a second text encoding component. The entity knowledge base can include N sample entities, where N can be a positive integer, such as N can be 1, 2, ...; the computer device can input the sample text data into the first text encoding component in the initial entity recall model, and generate a first entity representation feature corresponding to the sample query entity through the first text encoding component; the N sample entities in the entity knowledge base are sequentially input into the second text encoding component in the initial entity recall model, and the second text encoding component generates a second entity representation feature corresponding to each of the N sample entities. Wherein, the above-mentioned first text encoding component and the second text encoding component can both be language representation models, for example, the first text encoding component and the second text encoding component can both be BERT (Bidirectional Encoder Representations from Transformers) model, Word2Vec (a word vector representation model), Latent Semantic Analysis (LSA), Latent Dirichlet Allocation (LDA), random indexing, etc. It should be noted that the model structures of the first text encoding component and the second text encoding component can be the same, but the model parameters obtained after training are different. It should be noted that the initial entity recall model involved in the embodiments of the present application can refer to the model generated by the previous round of training.

[0093] Optionally, the process of obtaining the first entity representation feature through the first text encoding component may include: the computer device may divide the sample text data into D unit characters, and obtain the first unit word vectors corresponding to the D unit characters respectively, where D is a positive integer, such as D can take the value of 1, 2,...; and then, based on the semantic information of the D unit characters in the sample text data, the first text vectors corresponding to the D unit characters respectively can be obtained; based on the text position of the D unit characters in the sample text data, the first position vectors corresponding to the D unit characters respectively can be obtained; the first unit word vector, the first text vector and the first position vector are superimposed to obtain the first input representation feature; the first input representation feature is input into the first text encoding component in the initial entity recall model, and the first input representation feature is text-encoded according to the first text encoding component to generate the first entity representation feature corresponding to the sample query entity.

[0094] In which, the computer device can convert each unit character in the sample text data into a word vector (i.e., a first unit word vector) by querying a word vector table, wherein the word vector table can contain word vectors corresponding to all commonly used characters, and the word vector table can be understood as a "dictionary" containing all commonly used character vectors, and the unit character can refer to each word in the sample text data; the value of the first text vector can be automatically learned during the training process of the initial entity recall model, and the first text vector can be used to characterize the global semantic information of the sample text data and can be fused with the first unit word vector; since the semantic information carried by the unit characters appearing at different positions in the sample text data is different (for example, the semantic information carried by "I wait for you" and "you wait for me" is different), a different position vector can be attached to each of the D unit characters in the sample text data for distinction. The sum of the first unit word vector, the first text vector, and the first position vector can be used as input data of the first text editing component (i.e., the first input representation feature). After the first input representation feature is input into the first text encoding component, the first text editing component can perform text encoding on the first input representation feature to obtain the first entity representation feature corresponding to the sample query entity.

[0095] Optionally, the process of obtaining the second entity representation features corresponding to N sample entities through the second text encoding component may include: the computer device may obtain the second unit word vector, the second text vector and the second position vector corresponding to the N sample entities in the entity knowledge base, superimpose the second unit word vector, the second text vector and the second position vector to obtain the second input representation feature; input the second input representation feature into the second text encoding component in the initial entity recall model, perform text encoding on the second input representation feature according to the second text encoding component, and generate the second entity representation features corresponding to the N sample entities; and then establish index information for the N second entity representation features, and add the index information corresponding to the N second entity representation features to the index database.

[0096] Among them, the processing process of the sample entities in the entity knowledge base by the second text encoding component is the same as the processing process of the sample text data by the aforementioned first text encoding component, and will not be repeated here. After the second entity representation features corresponding to all sample entities in the entity knowledge base are output by the second text editing component, index information can be established for the second entity representation features corresponding to each sample entity, and the index information corresponding to each second entity representation feature is added to the index database (faiss index), wherein the index database can be used to search for second entity representation features similar to the first entity representation features.

[0097] Optional, please also see Figure 5 , Figure 5 This is a schematic diagram of obtaining entity representation features provided by an embodiment of the present application. The initial entity recall model may include a first text encoding component and a second text encoding component, wherein the first text encoding component may refer to a language representation model on the sample query text side, and the second text encoding component may refer to a language representation model on the sample entity side in the entity knowledge base. This embodiment of the present application takes the example that both the first text encoding component and the second text encoding component are BERT models to describe the processing of sample text data and sample entities in the entity knowledge base. Figure 5As shown, after the computer device obtains the sample text data 40a ("Top Scorer in the National College Entrance Examination, Little A"), special characters can be inserted into "Top Scorer in the National College Entrance Examination, Little A" to identify the sample query entity. Among them, the special characters inserted into "Top Scorer in the National College Entrance Examination, Little A" can include: [CLS] symbol, [SEP] symbol, [L] symbol, [R] symbol. The output vector corresponding to the [CLS] symbol can be used for the classification model. For non-classification models, this [CLS] symbol can be omitted or retained. The [SEP] symbol can be a sentence segmentation symbol used to split two sentences in the input first text encoding component. The [L] symbol and [R] symbol are used to identify the sample query entity "Little A" included in "Top Scorer in the National College Entrance Examination, Little A". The unit characters included in the sample text data 40a with special characters inserted can include: "[CLS]", "high", "school", "exam", "top", "scorer", "[L]", "Little", "A", "[R]", "[SEP]". Through the first text encoding component, the output vector E1 corresponding to the [CLS] symbol, the output vector E2 corresponding to the unit character "high", the output vector E3 corresponding to the unit character "school", the output vector E4 corresponding to the unit character "exam", the output vector E5 corresponding to the unit character "top", the output vector E6 corresponding to the [L] symbol, the output vector E7 corresponding to the unit character "Little", the output vector E8 corresponding to the unit character "A", the output vector E9 corresponding to the [R] symbol, and the output vector E10 corresponding to the [SEP] symbol can be output. According to the above output vectors E1 to E10, the first entity representation feature 40c corresponding to the sample text data 40a ("Top Scorer in the National College Entrance Examination, Little A") can be generated.

[0098] Similarly, for the sample entity 40b "Little A (Top Scorer in the Hunan Provincial College Entrance Examination)" in the entity knowledge base, the computer device can insert special characters into the entity name and entity details information of the sample entity 40b "Little A (Top Scorer in the Hunan Provincial College Entrance Examination)", such as inserting the [S] character after the sample entity "Little A" to disconnect the sample entity "Little A" from the entity details information "Top Scorer in the Hunan Provincial College Entrance Examination", adding the [CLS] symbol before the text of the sample entity 40b, and adding the [SEP] symbol to the entity details information "Top Scorer in the Hunan Provincial College Entrance Examination". This [SEP] symbol is used to split "Top Scorer in the Hunan Provincial College Entrance Examination" from the subsequent text statements. Further, through the second text encoding component, the output vectors corresponding to each unit character in the sample entity 40b can be output respectively (for example, the output vector corresponding to the [CLS] symbol in the sample entity 40b is Q1, and the output vector corresponding to the unit character "lake" is Q5, etc.). Of course, for the special characters inserted into the sample entity 40b, the corresponding output vectors can also be obtained after passing through the second text encoding component. The computer device can be based on the output vectors corresponding to each unit character included in the sample entity 40b (for example, as Figure 5The output vector Q1-output vector Q12 shown in the figure generates the second entity representation feature 40d corresponding to the sample entity 40b "Xiao A (Hunan Province College Entrance Examination Champion)". For each sample text included in the entity knowledge base, the second entity representation feature corresponding to each sample entity can be obtained through the above processing.

[0099] Furthermore, the computer device can calculate sigmoid (which can be called an S-type function, an S-type growth curve, or an activation function) on the dot product result of the first entity representation feature 40c and the second entity representation feature 40d to obtain the entity similarity between the first entity representation feature 40c and the second entity representation feature 40d. The entity similarity at this time can also be understood as the similarity between the sample text data 40a and the sample entity 40b.

[0100] Step S103, based on the entity similarity between the first entity representation feature and the second entity representation feature corresponding to the sample entity, obtain a first negative sample corresponding to the sample query entity in the sample entity; the entity similarity between the second entity representation feature corresponding to the first negative sample and the first entity representation feature is greater than the entity similarity between the first entity representation feature and the second entity representation feature corresponding to the positive sample.

[0101] Specifically, after the initial entity recall model outputs the first entity representation feature corresponding to the sample query entity and the second entity representation feature corresponding to each sample text in the entity knowledge base, the computer device can obtain the entity similarity between the first entity representation feature and the second entity representation feature corresponding to each sample entity. During the training process of the initial entity recall model, a sample entity having an entity similarity greater than that of a positive sample can be determined as a first negative sample corresponding to the sample query entity, wherein the entity similarity between the second entity representation feature corresponding to the first negative sample and the first entity representation feature is greater than the entity similarity between the first entity representation feature and the second entity representation feature corresponding to the positive sample.

[0102] Optionally, when determining the first negative sample from N entity samples, a nearest neighbor search method (Nearest Neighbor Search) may be used in the index database to obtain the first negative sample corresponding to the sample query entity. Among them, the process of determining the first negative sample may include: the computer device can calculate the sigmoid of the dot product results between the first entity representation feature and the second entity representation features corresponding to the N sample entities based on the dot product results to obtain the entity similarity between the first entity representation feature and the N second entity representation features; according to the entity similarity, search the index database for similar index information that matches the first entity representation feature (for example, the first entity representation feature can be used as a new data point in the index database, and the similar index information closest to the first entity representation feature can be searched from the index database through the nearest neighbor search method), and obtain the similar entity representation feature associated with the similar index information from the N second entity representation features, that is, the second entity representation feature corresponding to the similar index information is used as the similar entity representation feature; and then the entity similarity between the first entity representation feature and the second entity representation feature corresponding to the labeled entity (positive sample) can be determined as the threshold similarity, and the sample entity corresponding to the similar entity representation feature whose entity similarity is greater than the threshold similarity is determined as the first negative sample corresponding to the sample query entity.

[0103] Among them, the nearest neighbor search method can refer to the optimization problem of searching for the nearest point in a scale space. The nearest neighbor search method used in this application can also refer to the K-nearest neighbor search method, that is, K data points closest to the query point can be searched in a scale space. The nearest neighbor search method can include but is not limited to: linear search (involving the calculation of entity similarity between the first entity representation feature and the second entity representation feature corresponding to N sample entities), KD tree (K-dimensional tree, a binary tree structure), Ball tree (a tree data structure), LSH (Localitysensitive hashing), vector quantization method, compression / clustering-based search, and greedy search in small graphs.

[0104] It should be noted that the purpose of training the initial entity recall model is to make the entity similarity between the first entity representation feature of the sample text data and the second entity representation feature corresponding to the positive sample higher than the entity similarity between the first entity representation feature and the second entity representation feature corresponding to the negative sample (the first negative sample and the second negative sample). Figure 6 , Figure 6 This is a schematic diagram of calculating entity similarity provided by an embodiment of the present application. Figure 6The sample text data 50a shown is: College Entrance Examination Champion Xiao A, the sample entity 50b contained in the entity knowledge base is: "Xiao A (College Entrance Examination Champion)", and the sample entity 50c contained in the entity knowledge base is: "Xiao A (Surgeon)". Of course, the entity knowledge base can also include sample entities such as "Xiao B", "Xiao C" and "Sun". Through the first text encoding component in the initial entity recall model, the entity representation feature 1 (i.e., the first entity representation feature) corresponding to the sample query entity in the sample text data 50a can be generated. Through the second text encoding component in the initial entity recall model, the second entity representation features corresponding to the N sample entities contained in the entity knowledge base can be generated. For example, the second entity representation feature corresponding to the sample entity 50b can be: entity representation feature 2, and the second entity representation feature corresponding to the sample entity 50c can be: entity representation feature 3, etc.

[0105] The computer device can construct a vector space 50d with the second entity representation features corresponding to all sample entities in the entity knowledge base and the entity representation feature 1 corresponding to the sample query entity. The entity representation feature 1 of the sample query entity in the sample text data corresponds to the representation vector 50e in the vector space 50d, the entity representation feature 2 corresponding to the sample entity 50b corresponds to the representation vector 50f in the vector space 50d, and the entity representation feature 3 corresponding to the sample entity 50c corresponds to the representation vector 50g in the vector space 50d. In the embodiment of the present application, assuming that the labeled entity of the sample query entity contained in the sample text data 50a in the entity knowledge base is the sample entity 50b, after training the initial entity recall model, the entity similarity between the sample text data 50a and the sample entity 50b can be greater than the entity similarity between the sample text data 50a and the sample entity 50c, and even greater than the entity similarity between the sample text data 50a and the sample text "Xiao B", the sample entity "Xiao C" and other entities.

[0106] Step S104: obtain a second negative sample corresponding to the sample query entity in the entity knowledge base, correct the network parameters of the initial entity recall model based on the positive sample, the first negative sample and the second negative sample, and determine the initial entity recall model after the parameter correction as the target entity recall model; the second negative sample belongs to the sample entity other than the positive sample and the first negative sample in the entity knowledge base, and the target entity recall model is used to recall the candidate entity corresponding to the query text data from the entity knowledge base.

[0107] Specifically, after determining the first negative sample corresponding to the sample query entity contained in the sample text data, the computer device can combine the first negative sample with the original second negative sample, wherein the second negative sample can refer to a sample entity randomly selected from N sample entities other than the first negative sample and the positive sample (labeled entity). The above-mentioned first negative sample, second negative sample, and positive sample can be used as batch data (batch) for training the initial entity recall model. In order to prevent the initial entity recall model from overfitting the first negative sample task, the ratio between the number of second negative samples and the number of first negative samples in the batch used for each training can be kept unchanged. In other words, the computer device can count the number of first samples corresponding to the first negative samples, and determine the number of second samples based on the negative sample ratio value (which can be understood as the ratio between the number of second negative samples and the number of first negative samples in a preset batch, which can be manually set according to actual needs) and the number of first samples, that is, determine the number of second negative samples in the current batch; obtain the second negative samples that meet the second sample number among the N sample entities; based on the positive samples, the first negative samples and the second negative samples, correct the network parameters of the initial entity recall model, and determine the trained initial entity recall model as the target entity recall model.

[0108] After determining the first negative sample, the second negative sample, and the positive sample, the initial entity recall model can be trained using multi-task learning, where the multi-task may refer to the first negative sample task and the second negative sample task. The computer device may combine the positive sample and the first negative sample into first training data, obtain a first discrimination result corresponding to the first training data, and the first training data may be used for learning the first negative sample task. The first discrimination result may refer to the first discrimination result for the first negative sample obtained by using the initial entity recall model of this round of training as a discriminator; the positive sample and the second negative sample may be combined into second training data, obtain a second discrimination result corresponding to the second training data, and the second training data may be used for learning the second negative sample task. The second discrimination result may refer to the second discrimination result for the second negative sample obtained by using the initial entity recall model of this round of training as a discriminator. Furthermore, a model loss function corresponding to the initial entity recall model can be determined based on the first discrimination result and the second discrimination result, and the network parameters of the initial entity recall model can then be modified based on the model loss function. When the number of training times corresponding to the initial entity recall model satisfies a training termination condition, the initial entity recall model that satisfies the training termination condition is determined as the target entity recall model. The training termination condition may include a pre-set maximum number of training iterations or a training convergence condition. The trained initial entity recall model is then referred to as the target entity recall model.

[0109] Optionally, the initial entity recall model can be trained repeatedly to obtain a trained target entity recall model. In the embodiment of the present application, the initial entity recall model generated by the previous round of training can be used as a generator, and the initial entity recall model generated by the current round of training can be used as a discriminator, wherein the generator can be used to generate the above-mentioned first negative sample, and the discriminator can be used to distinguish the first negative sample generated by the generator, as well as the positive sample and the second negative sample. Please refer to Figure 7 , Figure 7 Schematic diagram of an entity recall model based on adversarial learning training provided in an embodiment of the present application. Figure 7 The generator shown is the initial entity recall model generated by the previous round of training, and the discriminator is the initial entity recall model generated by the current round of training; the generator can generate the first entity representation feature corresponding to the sample query entity contained in the sample text data, and the second entity representation feature corresponding to all sample entities contained in the entity knowledge base, and determine the first negative sample 60c from all sample entities based on the entity similarity between the first entity representation feature and the second entity representation feature corresponding to the sample entity; wherein, the determination process of the first negative sample 60c can refer to the description of the above step S103, which will not be repeated here.

[0110] like Figure 7 The data set 60a shown may include all sample entities in the entity knowledge base, and a second negative sample 60b is randomly selected from the data set 60a, where the second negative sample 60b may be a sample entity in the data set 60a except the positive sample (labeled entity) and the first negative sample; the first negative sample 60c and the second negative sample 60b are input into the discriminator, and the discriminator is used to distinguish the authenticity of the positive sample generated by the generator, the first negative sample 60c and the second negative sample 60b.

[0111] Please also see Figure 8 , Figure 8 This is a flow chart of a training entity recall model provided in an embodiment of the present application. Figure 8As shown, the process of training the initial entity recall model may include: in the first round of training of the initial entity recall model, the labeled entity corresponding to the sample query entity contained in the sample text data may be used as a positive sample, and the sample entity other than the labeled entity is randomly selected in the entity knowledge base as the second negative sample, that is, there is no first negative sample in the first round of training. In each round of training after the initial entity recall model, the model (initial entity recall model) generated by the T-1th round of training (T can be a positive integer greater than 1) can be used as a generator to generate second entity representation features for all sample entities in the entity knowledge base, and index information is established for the second entity representation features corresponding to all sample entities, and the index information is put into the index database (faiss index); at the same time, special characters can be inserted into the sample text data (query) and the sample query entity (mention) can be identified. The model generated by the T-1 round of training can then be used to generate the first entity representation feature corresponding to the sample text data (query); the TOP-K second entity representation features of similarity can be retrieved from the faissindex database through the first entity representation feature, that is, the second entity representation features corresponding to the top K highest entity similarities; then the second entity representation features corresponding to the positive samples can be filtered out from the K second entity representation features, and the sample entities corresponding to the second entity representation features with entity similarity higher than that of the positive samples can be screened out as the first negative samples (also called hard negative samples); the mined first negative samples and the randomly selected second negative samples are combined into negative samples, and the model is trained for the Tth round using multi-task learning. In order to prevent the model from overfitting the first negative sample task (also called hard negative sample task), it is necessary to keep the ratio between the number of second negative samples and the number of first negative samples in the batch unchanged.

[0112] Optionally, the trained target entity recall model can be used to recall candidate entities corresponding to the query text data in the entity knowledge base, and the recall rate of the target entity recall model can be evaluated by the correlation between the candidate entities recalled from the entity knowledge base by the target entity recall model and the query text data. In order to verify the candidate entity recall performance of the trained target entity recall model, the embodiment of the present application can be based on the search click log, manually annotated to construct a data set containing 7,000 training data sets and 3,000 test data sets, and complete the training process of the initial entity recall model on the data set, as well as the testing process of the trained target entity recall model. In order to intuitively reflect the candidate entity recall performance of the target entity recall model trained by the embodiment of the present application, the target entity recall model obtained by training using adversarial learning can be compared with the candidate entity recall method based on the dictionary and the model obtained by training using randomly selected negative samples. The test experimental results are shown in Table 1 below:

[0113] Table 1

[0114]

[0115] As shown in Table 1, top1 (K=1) recall can be expressed as: for each test entity, one candidate entity can be recalled; top10 (K=10) recall can be expressed as: for each test entity, 10 candidate entities can be recalled. Compared with the dictionary-based candidate entity recall method, the target entity recall model trained using adversarial learning improves top10 recall performance by 8 points. At the same time, because the target entity recall model trained using adversarial learning can limit the number of candidate entities recalled, it improves the throughput of the entire entity linking service (throughput increased by 5 times) and reduces the 95th percentile latency (reduced to 1 / 20 of the baseline solution).

[0116] Optionally, in the process of training the initial entity recall model, in addition to introducing adversarial learning, pre-training can also be introduced to mine more training data for pre-training, further improving the recall rate of the target entity recall model and achieving the goal of optimizing the recall rate. It should be noted that the recall rate involved in this application refers to the ratio of the number of positive samples predicted by the target entity recall model to the number of actual positive samples in the test data set during the test process.

[0117] Optionally, after the computer device obtains the target entity recall model through adversarial learning training, the target entity recall model can be applied to the entity linking service, wherein the entity linking service may include entity recognition (mention recognition), candidate entity recall, and entity disambiguation. The above-mentioned target entity recall model can be specifically applied to the candidate entity recall step, which can improve the accuracy of the recalled candidate entities. When the target entity recall model is applied in an information query platform (for example, a search system), the computer device can obtain the query text data in the information query platform and obtain the entities to be queried contained in the query text data, that is, identify all entities to be queried contained in the query text data described in natural language, such as identifying the entity to be queried "the champion of the 2020 National College Entrance Examination" from the query text data "Who is the champion of the 2020 National College Entrance Examination".

[0118] Furthermore, through the target entity recall model, the query entity representation features corresponding to the entity to be queried and the sample entity representation features corresponding to the sample entities in the entity knowledge base can be output, and then, based on the feature similarity between the query entity representation features and the sample entity representation features, K candidate entities associated with the entity to be queried can be obtained in the entity knowledge base, where K is a positive integer, such as K can take values ​​of 1, 2,...; as in the above example, according to the entity to be queried "2020 National College Entrance Examination Champion", K candidate entities can be recalled from the entity knowledge base, and the K candidate entities can be: "National College Entrance Examination Champion (the highest score in the national college entrance examination)", "National College Entrance Examination Champion (the 2019 college entrance examination champion is the xx province college entrance examination champion)", "National College Entrance Examination Champion (Xiao A missed the national college entrance examination champion)", "National College Entrance Examination Champion (2010 college entrance examination champion Xiao B)", and the number of candidate entities K is 4 at this time.

[0119] Furthermore, the push evaluation values ​​corresponding to the K candidate entities can be obtained, and the candidate entity corresponding to the largest push evaluation value among the K candidate entities can be determined as the linked entity corresponding to the entity to be queried, and then the entity detail information corresponding to the linked entity can be obtained, and the entity detail information can be pushed to the information query platform as the query result of the query text data, and the query result can be displayed on the information query platform. As mentioned above, the recalled candidate entities such as "National College Entrance Examination Champion (the highest score in the national college entrance examination)", "National College Entrance Examination Champion (the 2019 college entrance examination champion is the xx province college entrance examination champion)", "National College Entrance Examination Champion (Xiao A missed the national college entrance examination champion)", "National College Entrance Examination Champion (Xiao B, the 2010 college entrance examination champion)" can be sorted by push evaluation value (which can also be understood as scoring sorting), and finally it is concluded that "National College Entrance Examination Champion (Xiao B, the 2010 college entrance examination champion)" has the highest push evaluation value, that is, "National College Entrance Examination Champion (Xiao B, the 2010 college entrance examination champion)" is the entity to be queried "2020 national college entrance examination champion". The linked entity corresponding to "National College Entrance Examination Champion"; the entity detail information corresponding to "National College Entrance Examination Champion (2010 College Entrance Examination Champion Xiao B)" can be pushed to the information query platform, and the above entity detail information can be displayed on the information query platform. In the embodiment of the present application, the target entity recall model is introduced, which will neither recall too many candidate entities, resulting in too long entity disambiguation time, and lowering the efficiency of the entire entity linking service, nor miss recalling related candidate entities, resulting in too low a recall of the entity linking service. In other words, the introduction of the target entity recall model can improve the efficiency of the entity linking service and improve the recall rate of the entity linking service.

[0120] Optionally, the entity linking service that introduces the target entity recall model can be applied in search scenarios, knowledge question answering scenarios, information flow recommendation scenarios, etc. Please also refer to Figure 9 , Figure 9This is a schematic diagram of an application scenario of an entity linking service provided by an embodiment of the present application. Figure 9 As shown, the computer device can identify the query entity "2017 version of XX Heroes" from the query text data 70a ("Who is the leading actor of the 2017 version of XX Heroes"); through the target entity recall model, the candidate entity 70b, candidate entity 70c and candidate entity 70d corresponding to the query entity "2017 version of XX Heroes" can be recalled from the entity knowledge base (Topbase knowledge base). The candidate entity 70b is "XX Heroes (a martial arts novel created by Xiao C)", the candidate entity 70c is "XX Heroes (a TV series directed by Xiao D in 2017)", and the candidate entity 70d is "XX Heroes (a TV series starring Xiao A and Xiao B in 2003)".

[0121] Furthermore, by sorting the push evaluation values ​​of candidate entity 70b, candidate entity 70c and candidate entity 70d, it can be determined that the linked entity corresponding to the query entity "2017 version of XX Heroes" is candidate entity 70c, namely "XX Heroes (a TV series directed by Xiao D in 2017)"; candidate entity 70b and candidate entity 70d are not the linked entities corresponding to the query entity "2017 version of XX Heroes".

[0122] Optionally, when the entity linking service is applied in a search scenario, the type and other attributes (for example, actors, directors, original works, etc.) of the linked entity "XX Heroes (a TV series directed by Xiao D in 2017)" can be given to assist the search engine in completing the understanding of the query text data 70a ("Who is the leading actor of the 2017 version of XX Heroes").

[0123] Optionally, when the entity linking service is applied in a knowledge question-answering scenario, the main entity (such as "2017 version of XX Heroes") in the query text data 70a ("Who is the main actor of the 2017 version of XX Heroes") can be accurately located, that is, the query text data 70a can be used as a question in the knowledge question-answering scenario to more accurately query the entity knowledge base; Figure 9 As shown, the entity id (707xxx7f) and entity attribute (actor) corresponding to the linked entity can be given, and then actor Xiao E and actor Xiao F can be accurately queried from the entity knowledge base. That is, the answer to the question "Who is the leading actor of the 2017 version of XX Heroes" is: actor Xiao E and actor Xiao F.

[0124] Optionally, when the entity linking service is applied in the recommendation scenario of information flow, the entity linking service is specifically applied to understand the content of articles in the information flow, and can identify entities in the article title and push them according to content classification. Figure 9As shown, the type of the linked entity "XX Heroes (a TV series directed by Xiao D in 2017)" and the corresponding related articles can be given. For example, if the type is starring actor Xiao E, the title of the corresponding related article is "Wearing the same clothes as other actors, the same dress but different styles, but the temperament is comparable"; if the type is ancient costume martial arts drama, the title of the corresponding related article is "Ancient costumes are shabby? The style of more than 20 years ago is what martial arts dramas should look like"; if the type is Xiao C TV series, the title of the corresponding related article is "How many of the 15 martial arts TV series have you watched, and which ones are your favorites?"

[0125] In an embodiment of the present application, the first negative sample corresponding to the sample query entity can be determined through the initial entity recall model, wherein the positive sample is the labeled entity of the sample query entity, that is, the positive sample is known, the first negative sample is the sample entity in the entity knowledge base whose entity similarity is greater than the positive sample, that is, the first negative sample is similar to the positive sample, and the second negative sample is the sample entity selected from the entity knowledge base. The initial entity recall model is trained by the positive sample, the first negative sample, and the second negative sample, so that the trained target entity recall model can better distinguish similar entities, thereby improving the recall rate of the target entity recall model; using the target entity recall model, the number of candidate entities recalled can be limited while ensuring that candidate entities associated with the query text data are not missed, so as to reduce the entity disambiguation time, thereby improving the efficiency of the entity linking service.

[0126] See Figure 10 , Figure 10 : is a structural diagram of a text data processing device provided in an embodiment of the present application. It can be understood that the text data processing device can be a computer program (including program code) applied to a computer device, for example, the text data processing device can be a text application software, and the text data processing device can be used to execute the corresponding steps of the method provided in the embodiment of the present application. Figure 10 As shown, the text data processing device 1 may include: a sample data acquisition module 11, an entity representation module 12, a negative sample determination module 13, and a parameter correction module 14;

[0127] The sample data acquisition module 11 is used to obtain sample text data containing a sample query entity and determine the labeled entity corresponding to the sample query entity in the entity knowledge base as a positive sample;

[0128] An entity representation module 12 is configured to obtain a first entity representation feature corresponding to a sample query entity based on an initial entity recall model, and obtain a second entity representation feature corresponding to a sample entity in an entity knowledge base based on the initial entity recall model; the sample entity in the entity knowledge base includes a positive sample;

[0129] A negative sample determination module 13 is configured to obtain a first negative sample corresponding to the sample query entity from the sample entity based on the entity similarity between the first entity representation feature and the second entity representation feature corresponding to the sample entity; the entity similarity between the second entity representation feature corresponding to the first negative sample and the first entity representation feature is greater than the entity similarity between the first entity representation feature and the second entity representation feature corresponding to the positive sample;

[0130] The parameter correction module 14 is used to obtain a second negative sample corresponding to the sample query entity in the entity knowledge base, correct the network parameters of the initial entity recall model based on the positive sample, the first negative sample and the second negative sample, and determine the initial entity recall model after parameter correction as the target entity recall model; the second negative sample belongs to the sample entity other than the positive sample and the first negative sample in the entity knowledge base, and the target entity recall model is used to recall the candidate entity corresponding to the query text data from the entity knowledge base.

[0131] The specific functional implementation of the sample data acquisition module 11, the entity representation module 12, the negative sample determination module 13, and the parameter correction module 14 can be found in the above Figure 3 Steps S101 to S104 in the corresponding embodiment will not be described in detail here.

[0132] In some feasible implementations, the number of sample query entities is M, where M is a positive integer;

[0133] The sample data acquisition module 11 may include: a query entity acquisition unit 111, a label entity acquisition unit 112;

[0134] The query entity acquisition unit 111 is used to acquire sample text data and acquire M sample query entities from the sample text data according to the location identification information carried by the sample text data;

[0135] The labeled entity acquisition unit 112 is used to respectively acquire labeled entities matching the M sample query entities in the entity knowledge base according to the entity identification information carried by the sample text data, and determine the labeled entities as positive samples corresponding to the M sample query entities.

[0136] The specific functional implementation of the query entity acquisition unit 111 and the annotation entity acquisition unit 112 can be found in the above Figure 3 Step S101 in the corresponding embodiment will not be described in detail here.

[0137] In some feasible implementations, the entity knowledge base includes N sample entities, where N is a positive integer;

[0138] The entity representation module 12 may include: a first encoding unit 121, a second encoding unit 122;

[0139] A first encoding unit 121 is configured to input the sample text data into a first text encoding component in the initial entity recall model, and generate a first entity representation feature corresponding to the sample query entity through the first text encoding component;

[0140] The second encoding unit 122 is used to input N sample entities in the entity knowledge base into the second text encoding component in the initial entity recall model in sequence, and generate second entity representation features corresponding to the N sample entities respectively through the second text encoding component.

[0141] The specific functional implementation of the first encoding unit 121 and the second encoding unit 122 can be found in the above Figure 3 Step S102 in the corresponding embodiment will not be described in detail here.

[0142] In some feasible implementations, the first encoding unit 121 may include: a word vector acquisition subunit 1211, a text vector acquisition subunit 1212, a position vector acquisition subunit 1213, a first vector superposition subunit 1214, and a first representation feature generation subunit 1215;

[0143] The word vector acquisition subunit 1211 is used to divide the sample text data into D unit characters and obtain the first unit word vectors corresponding to the D unit characters respectively; D is a positive integer;

[0144] The text vector acquisition subunit 1212 is configured to acquire first text vectors corresponding to the D unit characters according to semantic information of the D unit characters in the sample text data;

[0145] The position vector obtaining subunit 1213 is configured to obtain first position vectors corresponding to the D unit characters according to the text positions of the D unit characters in the sample text data;

[0146] A first vector superposition subunit 1214 is configured to superimpose the first unit word vector, the first text vector, and the first position vector to obtain a first input representation feature;

[0147] The first representation feature generation subunit 1215 is used to input the first input representation feature into the first text encoding component in the initial entity recall model, perform text encoding on the first input representation feature according to the first text encoding component, and generate the first entity representation feature corresponding to the sample query entity.

[0148] The specific functional implementation of the word vector acquisition subunit 1211, the text vector acquisition subunit 1212, the position vector acquisition subunit 1213, the first vector superposition subunit 1214, and the first representation feature generation subunit 1215 can be found in the above Figure 3 Step S102 in the corresponding embodiment will not be described in detail here.

[0149] In some feasible implementations, the second encoding unit 122 may include: a second vector superposition subunit 1221, a second representation feature generation subunit 1222, and an index establishment subunit 1223;

[0150] The second vector superposition subunit 1221 is used to obtain the second unit word vector, the second text vector, and the second position vector corresponding to N sample entities in the entity knowledge base, and superimpose the second unit word vector, the second text vector, and the second position vector to obtain a second input representation feature;

[0151] The second representation feature generating subunit 1222 is configured to input the second input representation feature into the second text encoding component in the initial entity recall model, perform text encoding on the second input representation feature according to the second text encoding component, and generate second entity representation features corresponding to N sample entities respectively;

[0152] The index establishing subunit 1223 is configured to establish index information for the N second entity representation features, and add the index information corresponding to the N second entity representation features to the index database.

[0153] The specific functional implementation of the second vector superposition subunit 1221, the second representation feature generation subunit 1222, and the index establishment subunit 1223 can be found in the above Figure 3 Step S102 in the corresponding embodiment will not be described in detail here.

[0154] In some feasible implementations, the negative sample determination module 13 may include: an entity similarity acquisition unit 131 , a similar entity acquisition unit 132 , and a first negative sample determination unit 133 ;

[0155] An entity similarity acquisition unit 131 is configured to acquire entity similarities between the first entity representation feature and the N second entity representation features, based on dot product results between the first entity representation feature and the second entity representation features corresponding to the N sample entities;

[0156] A similar entity acquisition unit 132 is configured to search the index database for similar index information that matches the first entity representation feature based on the entity similarity, and to acquire similar entity representation features associated with the similar index information from the N second entity representation features;

[0157] The first negative sample determination unit 133 is used to determine the entity similarity between the first entity representation feature and the second entity representation feature corresponding to the labeled entity as a threshold similarity, and determine the sample entity corresponding to the similar entity representation feature whose entity similarity is greater than the threshold similarity as the first negative sample corresponding to the sample query entity.

[0158] The specific functional implementation of the entity similarity acquisition unit 131, the similar entity acquisition unit 132, and the first negative sample determination unit 133 can be found in the above Figure 3 Step S103 in the corresponding embodiment will not be described in detail here.

[0159] In some feasible implementations, the entity knowledge base includes N sample entities, where N is a positive integer;

[0160] The parameter correction module 14 may include: a sample quantity determination unit 141, a second negative sample acquisition unit 142, a first discrimination result acquisition unit 143, a second discrimination result acquisition unit 144, and a network parameter correction unit 145;

[0161] A sample number determination unit 141 is configured to count the first sample number corresponding to the first negative sample, and determine the second sample number based on the negative sample ratio and the first sample number;

[0162] The second negative sample acquisition unit 142 is configured to acquire second negative samples that meet a second sample quantity from the N sample entities included in the entity knowledge base.

[0163] A first discrimination result obtaining unit 143 is configured to combine the positive sample and the first negative sample into first training data and obtain a first discrimination result corresponding to the first training data;

[0164] A second discrimination result obtaining unit 144 is configured to combine the positive sample and the second negative sample into second training data, and obtain a second discrimination result corresponding to the second training data;

[0165] The network parameter correction unit 145 is configured to correct the network parameters of the initial entity recall model according to the first discrimination result and the second discrimination result, and determine the initial entity recall model after parameter correction as the target entity recall model.

[0166] Optionally, the network parameter modification unit 145 is specifically configured to:

[0167] Determine a model loss function corresponding to the initial entity recall model based on the first discrimination result and the second discrimination result;

[0168] The network parameters of the initial entity recall model are modified according to the model loss function. When the number of training times corresponding to the initial entity recall model meets the training termination condition, the initial entity recall model that meets the training termination condition is determined as the target entity recall model.

[0169] The specific functional implementation of the sample quantity determination unit 141, the second negative sample acquisition unit 142, the first discrimination result acquisition unit 143, the second discrimination result acquisition unit 144, and the network parameter correction unit 145 can be referred to above. Figure 3 Step S104 in the corresponding embodiment will not be described in detail here.

[0170] In some feasible implementations, the text data processing device 1 may further include: a query entity recognition module 15, a feature representation module 16, a candidate entity recall module 17, a link entity determination module 18, and an entity detail information display module 19;

[0171] The to-be-queried entity identification module 15 is used to obtain the query text data in the information query platform and obtain the to-be-queried entity contained in the query text data;

[0172] A feature representation module 16 is configured to output, through a target entity recall model, a query entity representation feature corresponding to the entity to be queried and sample entity representation features corresponding to sample entities in the entity knowledge base;

[0173] The candidate entity recall module 17 is used to obtain K candidate entities associated with the query entity in the entity knowledge base according to the feature similarity between the query entity representation feature and the sample entity representation feature; K is a positive integer;

[0174] The link entity determination module 18 is configured to obtain push evaluation values ​​corresponding to K candidate entities, and determine the candidate entity corresponding to the largest push evaluation value among the K candidate entities as the link entity corresponding to the entity to be queried.

[0175] The entity detail information display module 19 is used to obtain the entity detail information corresponding to the linked entity, push the entity detail information as the query result of the query text data to the information query platform, and display the query result on the information query platform.

[0176] The specific functional implementation of the query entity recognition module 15, the feature representation module 16, the candidate entity recall module 17, the linked entity determination module 18, and the entity detail information display module 19 can be found in the above Figure 3 Step S104 in the corresponding embodiment will not be described in detail here.

[0177] In an embodiment of the present application, the first negative sample corresponding to the sample query entity can be determined through the initial entity recall model, wherein the positive sample is the labeled entity of the sample query entity, that is, the positive sample is known, the first negative sample is the sample entity in the entity knowledge base whose entity similarity is greater than the positive sample, that is, the first negative sample is similar to the positive sample, and the second negative sample is the sample entity selected from the entity knowledge base. The initial entity recall model is trained by the positive sample, the first negative sample, and the second negative sample, so that the trained target entity recall model can better distinguish similar entities, thereby improving the recall rate of the target entity recall model; using the target entity recall model, the number of candidate entities recalled can be limited while ensuring that candidate entities associated with the query text data are not missed, so as to reduce the entity disambiguation time, thereby improving the efficiency of the entity linking service.

[0178] See Figure 11 , Figure 11 This is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. Figure 11 As shown, the computer device 1000 may include: a processor 1001, a network interface 1004 and a memory 1005. In addition, the above-mentioned computer device 1000 may also include: a user interface 1003, and at least one communication bus 1002. The communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. Optionally, the network interface 1004 may include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as at least one disk storage. Optionally, the memory 1005 may also be at least one storage device located away from the aforementioned processor 1001. As Figure 11 As shown, the memory 1005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a device control application.

[0179] In such Figure 11 In the computer device 1000 shown, the network interface 1004 can provide network communication functions; the user interface 1003 is mainly used to provide an interface for user input; and the processor 1001 can be used to call the device control application stored in the memory 1005 to achieve:

[0180] Obtain sample text data containing a sample query entity, and determine the labeled entity corresponding to the sample query entity in the entity knowledge base as a positive sample;

[0181] Obtaining a first entity representation feature corresponding to a sample query entity according to an initial entity recall model, and obtaining a second entity representation feature corresponding to a sample entity in an entity knowledge base according to the initial entity recall model; the sample entity in the entity knowledge base includes a positive sample;

[0182] Obtaining a first negative sample corresponding to the sample query entity from the sample entity based on the entity similarity between the first entity representation feature and the second entity representation feature corresponding to the sample entity; the entity similarity between the second entity identification feature corresponding to the first negative sample and the first entity representation feature is greater than the entity similarity between the first entity representation feature and the second entity representation feature corresponding to the positive sample;

[0183] A second negative sample corresponding to the sample query entity is obtained in the entity knowledge base, and the network parameters of the initial entity recall model are corrected according to the positive sample, the first negative sample and the second negative sample, and the initial entity recall model after the parameter correction is determined as the target entity recall model; the second negative sample belongs to the sample entity other than the positive sample and the first negative sample in the entity knowledge base, and the target entity recall model is used to recall the candidate entity corresponding to the query text data from the entity knowledge base.

[0184] It should be understood that the computer device 1000 described in the embodiment of the present application can execute the above Figure 3 The description of the text data processing method in the corresponding embodiment can also be performed Figure 10 The description of the text data processing device 1 in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of adopting the same method will not be repeated here either.

[0185] In addition, it should be noted that: the embodiment of the present application also provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program executed by the text data processing device 1 mentioned above, and the computer program includes program instructions. When the processor executes the program instructions, it can execute the above-mentioned text data processing device 1. Figure 3 The description of the text data processing method in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of adopting the same method will not be repeated. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application. As an example, program instructions can be deployed on a computing device for execution, or on multiple computing devices located at one location, or on multiple computing devices distributed at multiple locations and interconnected by a communication network. Multiple computing devices distributed at multiple locations and interconnected by a communication network can constitute a blockchain system.

[0186] In addition, it should be noted that: the embodiment of the present application also provides a computer program product or computer program, which may include computer instructions, which may be 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 may execute the computer instructions, so that the computer device performs the above Figure 3 The description of the text data processing method in the corresponding embodiment will therefore not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated here. For technical details not disclosed in the computer program product or computer program embodiments involved in this application, please refer to the description of the method embodiments of this application.

[0187] It should be noted that for the aforementioned various method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.

[0188] The steps in the method of the embodiment of the present application can be adjusted in order, combined and deleted according to actual needs.

[0189] The modules in the device of the embodiment of the present application can be merged, divided and deleted according to actual needs.

[0190] Those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing related hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When executed, the program can include the processes in the above-described method embodiments. The storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0191] The above disclosure is only a preferred embodiment of the present application, and certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.

Claims

1. A text data processing method, characterized in that: include: Obtain sample text data containing a sample query entity, and determine the labeled entity corresponding to the sample query entity in the entity knowledge base as a positive sample; The labeled entity is used to represent the accurate answer of the sample text data in the entity knowledge base; Obtaining a first entity representation feature corresponding to the sample query entity according to an initial entity recall model, and obtaining a second entity representation feature corresponding to a sample entity in the entity knowledge base according to the initial entity recall model; the sample entity in the entity knowledge base includes the positive sample; Obtaining a first negative sample corresponding to the sample query entity from the sample entity based on the entity similarity between the first entity representation feature and the second entity representation feature corresponding to the sample entity; the entity similarity between the second entity representation feature corresponding to the first negative sample and the first entity representation feature is greater than the entity similarity between the first entity representation feature and the second entity representation feature corresponding to the positive sample; A second negative sample corresponding to the sample query entity is obtained in the entity knowledge base, and the network parameters of the initial entity recall model are corrected by adversarial learning based on the positive sample, the first negative sample and the second negative sample, and the initial entity recall model after the parameter correction is determined as the target entity recall model; the second negative sample belongs to the sample entity in the entity knowledge base other than the positive sample and the first negative sample, and the target entity recall model is used to distinguish similar entities in the entity knowledge base and recall candidate entities corresponding to the query text data.

2. The method according to claim 1, characterized in that The number of the sample query entities is M, where M is a positive integer; The acquiring of sample text data containing a sample query entity and determining a labeled entity corresponding to the sample query entity in an entity knowledge base as a positive sample includes: Acquire the sample text data, and acquire M sample query entities from the sample text data according to the location identification information carried by the sample text data; According to the entity identification information carried by the sample text data, labeled entities matching the M sample query entities are respectively obtained in the entity knowledge base, and the labeled entities are determined as positive samples corresponding to the M sample query entities respectively.

3. The method according to claim 1, characterized in that The entity knowledge base includes N sample entities, where N is a positive integer; The step of obtaining a first entity representation feature corresponding to the sample query entity according to the initial entity recall model, and obtaining a second entity representation feature corresponding to the sample entity in the entity knowledge base according to the initial entity recall model, includes: Inputting the sample text data into a first text encoding component in the initial entity recall model, and generating a first entity representation feature corresponding to the sample query entity through the first text encoding component; The N sample entities in the entity knowledge base are sequentially input into the second text encoding component in the initial entity recall model, and the second entity representation features corresponding to the N sample entities are generated by the second text encoding component.

4. The method according to claim 3, characterized in that Inputting the sample text data into the first text encoding component of the initial entity recall model, and generating a first entity representation feature corresponding to the sample query entity through the first text encoding component, includes: Divide the sample text data into D unit characters, and obtain the first unit word vectors corresponding to the D unit characters respectively; D is a positive integer; Obtaining first text vectors corresponding to the D unit characters respectively according to semantic information of the D unit characters in the sample text data; According to the text positions of the D unit characters in the sample text data, obtaining first position vectors corresponding to the D unit characters respectively; Superimposing the first unit word vector, the first text vector, and the first position vector to obtain a first input representation feature; The first input representation feature is input into a first text encoding component in the initial entity recall model, and the first input representation feature is text-encoded according to the first text encoding component to generate a first entity representation feature corresponding to the sample query entity.

5. The method according to claim 3, characterized in that The step of sequentially inputting N sample entities in the entity knowledge base into the second text encoding component in the initial entity recall model, and generating second entity representation features corresponding to the N sample entities respectively through the second text encoding component, includes: Obtaining second unit word vectors, second text vectors, and second position vectors corresponding to N sample entities in the entity knowledge base, respectively, and superimposing the second unit word vectors, the second text vectors, and the second position vectors to obtain a second input representation feature; Inputting the second input representation feature into the second text encoding component in the initial entity recall model, performing text encoding on the second input representation feature according to the second text encoding component to generate second entity representation features corresponding to the N sample entities respectively; Index information is created for the N second entity representation features, and the index information corresponding to the N second entity representation features is added to the index database.

6. The method according to claim 5, characterized in that The obtaining, from the sample entity, a first negative sample corresponding to the sample query entity based on the entity similarity between the first entity representation feature and the second entity representation feature corresponding to the sample entity, includes: Obtaining entity similarities between the first entity representation feature and the N second entity representation features according to dot product results between the first entity representation feature and the second entity representation features corresponding to the N sample entities; According to the entity similarity, searching the index database for similar index information that matches the first entity representation feature, and obtaining similar entity representation features associated with the similar index information from the N second entity representation features; The entity similarity between the first entity representation feature and the second entity representation feature corresponding to the labeled entity is determined as a threshold similarity, and the sample entity corresponding to the similar entity representation feature with entity similarity greater than the threshold similarity is determined as a first negative sample corresponding to the sample query entity.

7. The method according to claim 1, characterized in that The entity knowledge base includes N sample entities, where N is a positive integer; The obtaining of a second negative sample corresponding to the sample query entity in the entity knowledge base includes: Counting the number of first samples corresponding to the first negative samples, and determining the number of second samples according to the negative sample ratio and the first sample number; From the N sample entities included in the entity knowledge base, second negative samples that meet the second sample quantity are obtained.

8. The method according to claim 1, characterized in that The method of modifying the network parameters of the initial entity recall model according to the positive sample, the first negative sample, and the second negative sample, and determining the initial entity recall model after the parameter modification as the target entity recall model, includes: Combining the positive sample and the first negative sample into first training data, and obtaining a first discrimination result corresponding to the first training data; Combining the positive sample and the second negative sample into second training data, and obtaining a second discrimination result corresponding to the second training data; According to the first discrimination result and the second discrimination result, the network parameters of the initial entity recall model are corrected, and the initial entity recall model after the parameter correction is determined as the target entity recall model.

9. The method according to claim 8, characterized in that The method of modifying the network parameters of the initial entity recall model according to the first discrimination result and the second discrimination result, and determining the initial entity recall model after the parameter modification as the target entity recall model, includes: Determining a model loss function corresponding to the initial entity recall model according to the first discrimination result and the second discrimination result; The network parameters of the initial entity recall model are modified according to the model loss function. When the number of training times corresponding to the initial entity recall model meets the training termination condition, the initial entity recall model that meets the training termination condition is determined as the target entity recall model.

10. The method according to claim 1, characterized in that Also includes: Obtaining query text data from the information query platform, and obtaining the entity to be queried contained in the query text data; Outputting, through the target entity recall model, query entity representation features corresponding to the entity to be queried and sample entity representation features corresponding to the sample entities in the entity knowledge base; According to the feature similarity between the query entity representation feature and the sample entity representation feature, K candidate entities associated with the entity to be queried are obtained from the entity knowledge base; K is a positive integer; The push evaluation values ​​corresponding to the K candidate entities are obtained, and the candidate entity corresponding to the largest push evaluation value among the K candidate entities is determined as the link entity corresponding to the entity to be queried.

11. The method according to claim 10, characterized in that Also includes: Entity detail information corresponding to the linked entity is obtained, the entity detail information is pushed to the information query platform as a query result of the query text data, and the query result is displayed on the information query platform.

12. A text data processing device, characterized in that: include: A sample data acquisition module is used to acquire sample text data containing a sample query entity, and to determine a labeled entity corresponding to the sample query entity in an entity knowledge base as a positive sample; the labeled entity is used to represent the accurate answer of the sample text data in the entity knowledge base; an entity representation module, configured to obtain a first entity representation feature corresponding to the sample query entity according to an initial entity recall model, and obtain a second entity representation feature corresponding to a sample entity in the entity knowledge base according to the initial entity recall model; the sample entity in the entity knowledge base includes the positive sample; a negative sample determination module, configured to obtain, from the sample entity, a first negative sample corresponding to the sample query entity based on an entity similarity between the first entity representation feature and a second entity representation feature corresponding to the sample entity; wherein the entity similarity between the second entity representation feature corresponding to the first negative sample and the first entity representation feature is greater than the entity similarity between the first entity representation feature and the second entity representation feature corresponding to the positive sample; A parameter correction module is used to obtain a second negative sample corresponding to the sample query entity in the entity knowledge base, and to correct the network parameters of the initial entity recall model using an adversarial learning method based on the positive sample, the first negative sample and the second negative sample, and to determine the initial entity recall model after parameter correction as the target entity recall model; the second negative sample belongs to a sample entity in the entity knowledge base other than the positive sample and the first negative sample, and the target entity recall model is used to distinguish similar entities in the entity knowledge base and recall candidate entities corresponding to the query text data.

13. A computer device, characterized in that: including memory and processor; The memory is connected to the processor, the memory is used to store a computer program, and the processor is used to call the computer program so that the computer device executes the method according to any one of claims 1 to 11.

14. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which is suitable for being loaded and executed by a processor, so that a computer device having the processor executes the method according to any one of claims 1 to 11.

15. A computer program product, characterized in that The computer program product comprises computer instructions, and when the computer instructions are executed by a processor, the method according to any one of claims 1 to 11 is implemented.

Citation Information

Patent Citations

  • Trademark image retrieval model training method and system, storage medium and computer device

    CN110674881A

  • Method and device for determining target text, server, and storage medium

    CN112115697A