Entity linking method and apparatus, storage medium, and electronic device
By constructing link text in entity links and utilizing a combination of similarity and classification task models, the problem of poor link performance in existing technologies is solved, and efficient entity linking in short text scenarios is achieved.
Patent Information
- Application Number
- CN202111448462.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-30
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2041-11-30
AI Technical Summary
Existing entity linking technologies cannot achieve a complete linking effect and are difficult to implement, especially in short text scenarios, where they cannot effectively utilize text classification information.
By obtaining the standard names, categories, and descriptions of entities in the target text, link text is constructed. Then, the link result sets of text feature vectors are obtained by using similarity task models and classification task models respectively. Finally, the results of the two models are combined to determine the final link result of the entity.
It improves the effectiveness of entity links, enabling the effective combination of semantic and classification information in short text scenarios, thereby enhancing the accuracy and efficiency of links.
Smart Images

Figure CN114117266B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, in particular to an entity linking method and device, a storage medium and an electronic device. BACKGROUND
[0002] In the rapidly developing information age, the network has become the most important channel for human beings to obtain information. At the same time, with the acceleration of the pace of life, the demand of users for efficient reading of information resources is increasing, and the information resources contain a large amount of text entities with clear semantic information. How to efficiently obtain and utilize the entities in the text is a meaningful thing. Generally, the information can be screened by using the entity linking method, but the current entity linking technology cannot achieve complete linking effect and has great linking difficulty. SUMMARY
[0003] In order to solve the above problems, the embodiment of the present application provides an entity linking method, device, storage medium and electronic device, which reduces the complexity of entity linking and improves the effect of entity linking.
[0004] In a first aspect, the embodiment of the present application provides an entity linking method, which comprises:
[0005] Obtaining a target text containing an entity, and recalling at least one entity standard name and its corresponding category and description information according to the entity; based on the target text, the entity name of the entity, each entity standard name and its corresponding category and description information, constructing at least one linking text of the entity;
[0006] Respectively obtaining the text feature vector corresponding to each linking text;
[0007] Obtaining a first linking result set corresponding to each text feature vector, and obtaining a second linking result set corresponding to each text feature vector, each first linking result set being an entity linking result obtained based on a similarity task model, and each second linking result set being an entity linking result obtained based on a classification task model;
[0008] Based on each first linking result set and the second linking result set, obtaining the final entity linking result of the entity.
[0009] In a second aspect, the embodiment of the present application provides an entity linking device, which comprises:
[0010] a link text construction module, configured to obtain a target text containing an entity, and to retrieve at least one entity standard name and corresponding category and description information of the entity according to the entity, and to construct at least one link text of the entity based on the target text, an entity name of the entity, each entity standard name and corresponding category and description information thereof;
[0011] a text vector obtaining module, configured to obtain a text feature vector corresponding to each link text respectively;
[0012] a first set determining module, configured to obtain a first link result set corresponding to each text feature vector, and to obtain a second link result set corresponding to each text feature vector, wherein each first link result set is an entity link result obtained based on a similarity task model, and each second link result set is an entity link result obtained based on a classification task model;
[0013] a link result determining module, configured to obtain a final entity link result of the entity based on each first link result set and each second link result set.
[0014] In a third aspect, an embodiment of the present application provides a computer storage medium, which stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and performing the method steps of the first aspect.
[0015] In a fourth aspect, an embodiment of the present application provides an electronic device, which can include a processor and a memory, wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and performing the method steps of the first aspect.
[0016] The technical scheme provided by some embodiments of the present application has at least the following beneficial effects:
[0017] In the embodiments of the present application, by obtaining a target text containing an entity, and recalling at least one entity standard name and corresponding category and description information of the entity according to the entity, at least one link text of the entity is constructed based on the target text, the entity name of the entity, each entity standard name and the corresponding category and description information thereof, a text feature vector corresponding to each link text is obtained respectively, a first link result set obtained by each text feature vector based on a similarity task model is obtained, and a second link result set obtained by each text feature vector based on a classification task model is obtained, and a final entity link result of the entity is determined based on each first link result set and each second link result set. The user only needs to input the target text containing the entity, at least one entity standard name and the corresponding category and description information of the entity are recalled in the knowledge graph, at least one link text of the entity is constructed, and a text feature vector corresponding to each link text is obtained respectively, each first link result set is obtained by the text feature vector corresponding to each link text through the similarity task model and each second link result set is obtained through the classification task model, each first link result set and each second link result set obtained from the two different models are combined, and the final entity link result of the entity is determined, which can pay attention to the semantic information of the link text corresponding to the entity and the classification information of the link text corresponding to the entity, and the effect of entity linking is improved. BRIEF DESCRIPTION OF DRAWINGS
[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required to be used in the embodiments will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0019] Figure 1 A system architecture diagram of an entity linking system provided by the embodiments of the present application;
[0020] Figure 2 A flowchart of an entity linking method provided by the embodiments of the present application;
[0021] Figure 3 An example diagram of obtaining a statistical feature vector provided by the embodiments of the present application;
[0022] Figure 4 A flowchart of an entity linking method provided by the embodiments of the present application;
[0023] Figure 5 A flowchart of an entity linking method provided by the embodiments of the present application;
[0024] Figure 6An example schematic diagram for obtaining a statistical feature vector is provided for the embodiments of the present application.
[0025] Figure 7 An example schematic diagram for obtaining a final feature vector is provided for the embodiments of the present application.
[0026] Figure 8 An example schematic diagram for obtaining a first link result vector is provided for the embodiments of the present application.
[0027] Figure 9 An example schematic diagram for obtaining a second link result vector is provided for the embodiments of the present application.
[0028] Figure 10 A structural schematic diagram of an entity linking apparatus is provided for the embodiments of the present application.
[0029] Figure 11 A structural schematic diagram of an entity linking apparatus is provided for the embodiments of the present application.
[0030] Figure 12 A structural schematic diagram of an entity linking apparatus is provided for the embodiments of the present application.
[0031] Figure 13 A structural schematic diagram of an entity linking apparatus is provided for the embodiments of the present application.
[0032] Figure 14 A structural schematic diagram of an electronic device is provided for the embodiments of the present application. DETAILED DESCRIPTION
[0033] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application.
[0034] In the following description, the terms "first", "second", etc. are only for the purpose of description and cannot be understood as indicating or implying relative importance. The following description provides multiple embodiments of the present application, and different embodiments can be replaced or combined, so the present application can also be considered to include all possible combinations of the same and / or different embodiments described. Therefore, if one embodiment includes features A, B, and C, and another embodiment includes features B and D, the present application should also be considered to include one or more embodiments of all other possible combinations of A, B, C, and D, even if the embodiment is not explicitly described in the following content.
[0035] The following description provides examples, and is not limiting of the scope, applicability, or examples set forth in the claims. Changes can be made in the function and arrangement of elements discussed without departing from the scope of the application. Various examples can omit, substitute, or add various procedures or components as appropriate. For instance, the methods described can be performed in an order different than described, and various steps can be added, omitted, or combined. Also, features described with respect to some examples can be combined in other examples.
[0036] In the rapidly developing information age, the network has become the most important channel for human beings to obtain information. At the same time, with the acceleration of the pace of life, the demand of users for efficient reading of information resources is increasing, and the information resources contain a large amount of text entities with explicit semantic information. How to efficiently obtain and utilize the entities in the text is a meaningful thing. Generally, the entity linking method can be used for information screening, which can help people search information more quickly and read information resources more efficiently. Currently, the entity linking technology can be divided into two categories: similarity task model-based entity linking technology and classification task model-based entity linking technology. The similarity task model-based entity linking technology focuses on the semantic information of the entity to be linked, but does not explicitly use the statistical information of the text classification information, and the attention to the category information is not as good as the classification task-based entity linking technology. But the classification task model-based entity linking technology needs to construct multiple dimensions of classification features, and the data preparation process is complex. In the same classification dimension, it cannot achieve complete linking effect. In the short text scene, the context classification information is less, and the linking difficulty is greater.
[0037] Based on this, the embodiment of the present application provides an entity linking method, and at least one entity standard name and its corresponding category and description information are recalled according to the entity, at least one linking text of the entity is constructed by obtaining a target text containing the entity, based on the target text, the entity name of the entity, each entity standard name and its corresponding category and description information, a text feature vector corresponding to each linking text is respectively obtained, a first linking result set of the entity linking result obtained by a similarity task model corresponding to each text feature vector is obtained, a second linking result set of the entity linking result obtained by a classification task model corresponding to each text feature vector is obtained, and a final entity linking result of the entity is determined based on the first linking result set and the second linking result set. The user only needs to input the target text containing the entity, at least one entity standard name and its corresponding category and description information are recalled in the knowledge graph, at least one linking text of the entity is constructed, and a text feature vector corresponding to each linking text is respectively obtained, so that the first linking result set of the entity is obtained by the similarity task model through each text feature vector, the second linking result set of the entity is obtained by the classification task model through each text feature vector, the final entity linking result of the entity is determined from each first linking result set and each second linking result set, the linking results of the similarity task model and the classification task model are combined, and the final entity linking result of the entity is determined, thereby improving the effect of entity linking.
[0038] See Figure 1 The architecture schematic diagram of an entity linking system provided by the embodiment of the present application is shown.
[0039] The system comprises a user terminal, which can include but is not limited to a smartphone, a smart interactive tablet, a personal computer, a desktop computer, a tablet computer, a palm computer, a laptop computer, an all-in-one computer, a vehicle-mounted multimedia device, etc. By obtaining a target text containing an entity, and recalling at least one entity standard name and its corresponding category and description information according to the entity, the entity name of the entity, each entity standard name and its corresponding category and description information are spliced according to a preset format to obtain each entity text of the entity. The target text and the entity text are spliced to obtain at least one link text of the entity. Each link text is input into a pre-trained language model, and each link text is encoded by the pre-trained language model to output each text feature vector corresponding to each link text. The length of the entity name, the length of each description information, and the length of each entity text in each link text are obtained respectively. The first vector corresponding to the entity name in each link text is obtained according to the entity name length and the vector mapping table. The second vector corresponding to the description information in each link text is obtained according to the description information length and the vector mapping table. The third vector corresponding to the entity text in each link text is obtained according to the entity text length and the vector mapping table. The first vector and / or the second vector and / or the third vector are randomly spliced to obtain each statistical feature vector corresponding to each link text. The text feature vector and the statistical feature vector of each link text are spliced to obtain each final feature vector corresponding to each link text. Each first link result set of the entity link result is obtained by passing each final feature vector through a similarity task model. Each second link result set of the entity link result is obtained by passing each final feature vector through a classification task model. The link result with the highest score is determined as the first link result from each first link result set. The link result with the highest score is determined as the second link result from each second link result set. When the first link result and the second link result are the same, the first link result or the second link result is determined as the final entity link result of the entity. When the first link result and the second link result are different, the first link result is determined as the final entity link result of the entity.
[0040] According to the similarity task model and the classification task model, at least one first link result set and at least one second link result set are obtained by linking the entity in the preset knowledge graph. The highest scoring entity link result is determined from each first link result set and each second link result set, respectively, to determine the final entity link result of the entity. The similarity task model and the classification task model are effectively combined to link the entity, and the effect of entity linking is improved.
[0041] It should be noted that in the training phase of the model in the present scheme, the sample text containing the target entity input by the user is obtained, the sample text is linked in the preset knowledge graph to obtain at least one sample linked text, each sample linked text is input into the pre-training model to obtain a sample text feature vector corresponding to each sample linked text; optionally, by obtaining vectors corresponding to the length of the target entity name of the target entity, the length of the sample description information and the length of the sample entity text in each sample linked text, a sample statistical feature vector corresponding to each sample linked text is obtained; the sample text feature vector and the sample statistical feature vector corresponding to each sample linked text are spliced to obtain a sample final feature vector corresponding to each sample linked text; the at least one first sample linking result linked in the knowledge graph through the full connection layer, the dropout layer and the full connection layer of the similarity task model is finally obtained through the hyperbolic function tanh(), and the similarity task score of each first sample linking result corresponding to each sample linked text in the preset knowledge graph and the corresponding sample linked text is obtained; the first sample linking result with the highest similarity task score (the highest similarity in all first sample linking results of the model at present) corresponding to all sample linked texts is compared with the known result of the sample text, to determine whether the similarity of the first sample linking result with the highest similarity task score and the known result is within a preset range, if the similarity is within the preset range, it is determined that the similarity model training is completed, if the similarity is not within the preset range, the parameters of the similarity task model are adjusted and then trained in the above manner; at the same time, the sample final feature vector is linked in the knowledge graph through the full connection layer, the dropout layer and the full connection layer of the classification task model to obtain at least one second sample linking result corresponding to each sample linked text, and finally all second sample linking results corresponding to each sample linked text are obtained through the normalization function softmax(), and the classification task score of each sample linking result corresponding to each sample linked text in the preset knowledge graph and the corresponding sample linked text is obtained; the second sample linking result with the highest classification task score corresponding to all sample linked texts is compared with the known result of the sample text, to determine whether the classification of the second sample linking result with the highest classification task score and the known result is consistent, if the classification of the second sample linking result and the classification of the known result are consistent, it is determined that the current classification task model training is completed, if the classification of the second sample linking result and the classification of the known result are inconsistent, the parameters of the classification task model are adjusted and then trained in the above manner.
[0042] Please refer to Figure 2 A flowchart of an entity linking method is provided for the embodiments of the present application. As shown in Figure 2As shown, the entity linking method can include the following steps:
[0043] S101, obtaining a target text containing an entity, and recalling at least one entity standard name and its corresponding category and description information of the entity according to the entity, and constructing at least one linking text of the entity based on the target text, the entity name of the entity, each entity standard name and its corresponding category and description information;
[0044] Specifically, when it is necessary to link the entity, a user inputs a target text containing an entity, at least one entity standard name corresponding to the entity is recalled from a knowledge graph according to the entity, and correspondingly, each entity standard name has corresponding category and description information, and the entity name of the entity is determined in the target text input by the user, and the entity name of the entity is marked using an identifier, and then at least one entity text of the entity is constructed according to the entity name, each standard name of the entity and its corresponding category and description information, and the target text of the entity and each entity text are spliced to form at least one linking text of the entity.
[0045] The manner of splicing the target text and each entity text to form the corresponding linking text can include but is not limited to placing the target text before the entity text, placing the target text after the entity text, placing the target text between the entity texts, placing the entity text between the target texts, etc.
[0046] The entity name in the target text input by the user is marked using the identifier, so that when each linking text constructed is input to a pre-trained language model, the pre-trained language model can accurately locate the position of the entity name of the entity appearing in each linking text.
[0047] The identifier can include but is not limited to #, *, $, etc., and the manner of marking the identifier on the entity can include but is not limited to marking immediately before and after the entity, marking immediately before the entity, marking immediately after the entity, etc.
[0048] The entity can include but is not limited to an entity name, semantics associated with the entity name and text describing the entity name.
[0049] The entity name is a word describing the entity.
[0050] The entity standard name can include but is not limited to the full name of the entity, an alias, etc. The entity standard name is used to enhance the attention of the pre-trained language model to whether the entity name is consistent with the entity standard name.
[0051] The category corresponding to each entity standard name can include but is not limited to a person, an animal, a film and television work, a song, an electronic product, etc.
[0052] The description information is text that describes the entity, and may include, but is not limited to, text that explains or supplements the entity.
[0053] S102, respectively obtain the text feature vector corresponding to each of the linked texts;
[0054] Specifically, such as Figure 3 As shown, each of the constructed link texts is input into the pre-trained language model. The pre-trained language model encodes each link text by inserting a [CLS] symbol before each input link text and using the output vector corresponding to this symbol as the text feature vector of each link text.
[0055] The pre-trained language model may include, but is not limited to, the RoBERTa model.
[0056] RoBERTa is used to pre-train large amounts of unlabeled text data to learn language representations that can be used to fine-tune specific machine learning tasks. In this scheme, it is used to train on each constructed linked text so that the terminal can perform language representations in the format of each linked text.
[0057] Encoding link text can be done, but is not limited to, using the Transformer model.
[0058] The Transformer model is a method to accelerate the training of attention models, consisting of an encoder and a decoder. In this scheme, it is used to encode and decode the linked text input to the pre-trained language model.
[0059] S103, obtain the first link result set corresponding to each of the text feature vectors, and obtain the second link result set corresponding to each of the text feature vectors. Each first link result set is an entity link result obtained based on the similarity task model, and each second link result set is an entity link result obtained based on the classification task model.
[0060] Specifically, the text feature vectors obtained through the pre-trained language model are processed through a similarity task model to obtain the first set of link results for the entity link results corresponding to each linked text, and the text feature vectors obtained through the pre-trained language model are processed through a classification task model to obtain the second set of link results for the entity link results corresponding to each linked text.
[0061] The first link result in each first link result set corresponding to each link text can be 0, 1 or more. Each link text of the entity is linked in the preset knowledge graph through the similarity task model, and the first link result similar in semantics to each link text is searched. The preset knowledge graph includes a large amount of data information. If there is no first link result in one of the first link result sets, it means that the link text is searched in the knowledge graph through similarity, and no result similar in semantics to the link text is found. If there is only one first link result in one of the first link result sets, it means that the link text is searched in the knowledge graph through similarity, and only one first link result similar in semantics to the link text is found, or the similarity between the first link result and the link text is very high, and only the first link result can represent all the first link results of the link text. If there are multiple first link results in one of the first link result sets, it means that the link text is searched in the preset knowledge graph, and multiple first link results similar in similarity to the link text are found. Therefore, all the first link results are taken as the link result of the link text.
[0062] The similarity task model includes a full connection layer, a dropout layer and a full connection layer. The text feature vector of each link text passes through the full connection layer, the dropout layer and the full connection layer, and finally passes through the hyperbolic function tanh(), to obtain the similarity score between all the first link results corresponding to each link text in the preset knowledge graph and the corresponding link text.
[0063] The similarity score is a value in the range [-1, 1] of the hyperbolic function tanh().
[0064] The dropout layer refers to temporarily discarding a part of network neural units from the network according to a certain probability in the training process of the deep learning network, which is equivalent to finding a thinner network from the original network.
[0065] The second link result in each second link result set corresponding to each link text can be 0, 1 or more. Each link text of the entity is linked in the preset knowledge graph through the classification task model, and the classification of each link text in the preset knowledge graph is searched, which means that the entity standard name in each link text is classified and linked in the preset knowledge graph. The classification of the entity standard name of the entity in the preset knowledge graph can be 0, 1 or more.
[0066] The classification task model comprises a full connection layer, a dropout layer and a full connection layer. The text feature vectors corresponding to each link text of the entity are finally subjected to a normalization function softmax() to obtain classification scores corresponding to each classification of the entity standard name of the entity in the preset knowledge graph. Each classification is a plurality of classifications set in the preset knowledge graph, such as a film and television classification, a mobile game, a book and the like.
[0067] For example, the entity standard name in the link text is "Gods and Heroes", and "Gods and Heroes" is linked in the preset knowledge graph through the classification task model. The film and television classification, mobile game, book, novel and the like are obtained. According to the current popularity or the number of citations, the normalization function is used to calculate the scores of each classification.
[0068] The classification scores of each classification corresponding to each link text are values between 0 and 1, and the sum of all classification scores is 1.
[0069] S104, based on each first link result set and each second link result set, obtaining the final entity link result of the entity.
[0070] Specifically, the text feature vectors corresponding to each link text are subjected to the similarity task model to obtain a first link result set corresponding to each text feature vector. In all first link results of all first link result sets, the first link result with the highest similarity task score is determined as the first link result. The text feature vectors corresponding to each link text are subjected to the classification task model to obtain a second link result set corresponding to each text feature vector. In all second link results of all second link result sets, the second link result with the highest classification task score is determined as the second link result. According to the first link result and the second link result, the final entity link result of the entity is determined.
[0071] Each text feature vector corresponding to each link text can correspond to a first link result set and a second link result set connected in the preset knowledge graph. Each first link result set and second link result set of each link text can be 0, 1 or a plurality of link results.
[0072] Each first link result set and each second link result set is obtained according to different linking methods of each link text in the preset knowledge graph. Therefore, the first link result with the highest score in the first link result set corresponding to the same link text can be different from the final link result pointed to by the second link result with the highest score in the second link result set.
[0073] It should be noted that when the first link result with the highest score in the first link result set corresponding to the same link text is the same as the final link result pointed to by the second link result with the highest score in the second link result set, the first link result or the second link result is determined as the final entity link result of the entity, and when the first link result and the second link result are different, the first link result is determined as the final entity link result of the entity.
[0074] In the embodiment of the present application, by constructing a target text containing an entity for the entity to be linked, recalling at least one entity standard name and its corresponding category and description information according to the entity, constructing at least one entity text of the entity based on the entity name of the entity, each entity standard name and its corresponding category and description information, splicing the target text with each entity text respectively to form at least one link text of the entity, inputting each link text into the pre-trained language model, obtaining the text feature vector corresponding to each link text by encoding each link text through the pre-trained language model, obtaining the first link result set corresponding to each text feature vector through the similarity task model, obtaining the second link result set corresponding to each text feature vector through the classification task model, determining the corresponding highest-score link result from all first link result sets and all second link result sets as the first link result and the second link result respectively, and then determining the final entity link result of the entity based on each first link result set and each second link result set. Using two different linking methods, the text feature vectors of each link text constructed for the entity are obtained through the pre-trained language model, the text feature vectors corresponding to each link text are linked in the pre-set knowledge graph through the similarity task model and the classification task model, each first link result set and each second link result set corresponding to each link text are obtained, and then the final entity link result of the entity is determined from all first link result sets and all second link result sets, which improves the linking effect of entity linking.
[0075] Please refer to Figure 4 A flowchart of an entity linking method is provided for the embodiment of the present application. As shown in Figure 4 The entity linking method can include the following steps:
[0076] S201, a target text containing an entity is obtained, and at least one entity standard name and its corresponding category and description information are recalled according to the entity, and each entity text of the entity is constructed based on the entity name of the entity, each entity standard name and the category and description information corresponding to the entity standard name;
[0077] Specifically, when the entity needs to be linked, the user inputs target text containing the entity, at least one entity standard name corresponding to the entity is recalled from the knowledge graph according to the entity, each entity standard name has its corresponding category and description information, the entity name of the entity is determined in the input target text, and the entity name is marked using an identifier. In addition, each entity standard name and the category and description information corresponding to each entity standard name of the entity are also needed, and then based on the entity name of the entity, each entity standard name and the category and description information corresponding to each entity standard name, each entity standard name is constructed into entity text according to a preset format.
[0078] In the input target text, the entity name is marked using an identifier, so that when each constructed link text is input into the pre-trained language model, the pre-trained language model can accurately locate the position of the entity name of the entity in each link text.
[0079] The identifier can include but is not limited to #, *, $, etc., and the entity can include but is not limited to the entity name, the semantics of the associated entity name, and the text describing the entity name.
[0080] The entity name is a word describing the entity, and the entity standard name can include but is not limited to the full name of the entity, the alias, etc. The entity standard name is used to enhance the attention of the pre-trained language model to whether the entity name is consistent with the entity standard name.
[0081] The category corresponding to each entity standard name can include but is not limited to person, animal, film and television work, song, electronic product, etc.
[0082] The description information is a text describing the entity, which can include but is not limited to a text explaining the entity, a text supplementing the entity, etc.
[0083] The way of marking the identifier on the entity can include but is not limited to marking on both sides of the entity, marking on the front of the entity, marking on the back of the entity, etc. For example, when the entity is The Return of the Condor Heroes, the input target text can be "How many episodes does #The Return of the Condor Heroes# starring Nicholas Tse have?"
[0084] The preset construction format of the entity text of the entity can include but is not limited to: entity name-entity standard name; category: entity type; description information, entity name(entity standard name); category(entity type); description information, etc.
[0085] For example, The Condor Heroes - The Condor Heroes 95, Type: TV series works; The Condor Heroes is a Hong Kong television broadcast Limited according to Jin Yong's wuxia novel The Condor Heroes adapted to film, a total of 32 sets. By Lee Tin-sing, Wong Kwok-wai, Tang Kam-ping, Zhao Jingrong, Chen Baoyan script, Louis Koo, Li Jiaotong, Fu Mingxian, Bai Biao, Wei Qiuhua, etc.
[0086] S202, the target text and each of the entity text splicing, constructing at least one link text of the entity;
[0087] Specifically, the target text and each of the entity text splicing, constructing at least one link text of the entity.
[0088] The preset format of the target text and each of the entity text splicing to form each link text can include but not limited to the target text before the entity text, the target text after the entity text, the target text between the entity text, the entity text between the target text, etc.
[0089] The target text constructed in the above step S201 is "Louis Koo in # The Condor Heroes # how many sets?", and the entity text is "The Condor Heroes - The Condor Heroes 95, Type: TV series works; The Condor Heroes is a Hong Kong television broadcast Limited according to Jin Yong's wuxia novel The Condor Heroes adapted to film, a total of 32 sets. By Lee Tin-sing, Wong Kwok-wai, Tang Kam-ping, Zhao Jingrong, Chen Baoyan script, Louis Koo, Li Jiaotong, Fu Mingxian, Bai Biao, Wei Qiuhua, etc.
[0090] The corresponding link text can be "Louis Koo in # The Condor Heroes # how many sets? The Condor Heroes - The Condor Heroes 95, Type: TV series works; The Condor Heroes is a Hong Kong television broadcast Limited according to Jin Yong's wuxia novel The Condor Heroes adapted to film, a total of 32 sets. By Lee Tin-sing, Wong Kwok-wai, Tang Kam-ping, Zhao Jingrong, Chen Baoyan script, Louis Koo, Li Jiaotong, Fu Mingxian, Bai Biao, Wei Qiuhua, etc.
[0091] S203, respectively, each of the link text corresponding to the text feature vector;
[0092] The specific embodiment of this step can refer to step S102, which is not described here.
[0093] S204, obtain a first link result set corresponding to each of the text feature vectors and obtain a second link result set corresponding to each of the text feature vectors, each of the first link result sets being an entity link result obtained based on a similarity task model, and each of the second link result sets being an entity link result obtained based on a classification task model;
[0094] The specific implementation of this step can refer to step S103, and details are not repeated here.
[0095] S205, determine a first link result with the highest score in all the first link result sets and determine a second link result with the highest score in all the second link result sets;
[0096] Specifically, each text feature vector obtains a first link set corresponding to the text feature vector through the similarity task model, the score corresponding to each link result in all the first link result sets is in the value range interval [-1, 1] of the hyperbolic function tanh(), all the first link results in all the first link result sets are sorted according to the scores, and the first link result with the highest score in all the first link result sets is taken as the first link result. Each text feature vector obtains a second link result set corresponding to the text feature vector through the classification task model, the score corresponding to each link result in all the second link result sets is mapped in (0, 1) by the normalization function softmax(), and the sum of the scores of all the second link results in each second link result set is 1. All the second link results in all the second link result sets are sorted according to the scores, and the second link result with the highest score in all the second link result sets is taken as the second link result.
[0097] S206, if the first link result and the second link result are the same, determining the first link result or the second link result as the final entity link result of the entity;
[0098] Specifically, the first link result with the highest score is determined from all the first link results in all the first link result sets, and the second link result with the highest score is determined from all the second link results in all the second link result sets. When the final link results pointed to by the first link result and the second link result are the same, the first link result or the second link result is taken as the final entity link result of the entity.
[0099] When the final link results pointed to by the first link result and the second link result are the same, it is indicated that the results of linking the entity through the classification task model and the similarity task model are the same when linking the entity in the preset knowledge graph, and it is indicated that the fitting degree of the current link result to the final entity link result of the entity is very high.
[0100] S207, if the first linking result is different from the second linking result, determining the first linking result as the final entity linking result of the entity;
[0101] Specifically, the highest scoring linking result is determined from all first linking results of all first linking result sets as the first linking result, and the highest scoring linking result is determined from all second linking results of all second linking result sets as the second linking result, and when the final linking results pointed to by the first linking result and the second linking result are different, the first linking result is taken as the final entity linking result of the entity.
[0102] The first linking result is to link the linking texts of the entity in the preset knowledge graph according to semantic similarity, and the linking result with the highest semantic similarity found in the preset knowledge graph is taken as the first linking result. The second linking result is to link the entity standard name in the linking texts of the entity in the preset knowledge graph, find the categories in which the entity standard name exists in the preset knowledge graph, and calculate the scores of the categories according to the current popularity or the number of citations using a normalization function, and select the highest scoring linking result as the second linking result. Relative to the second linking result, the first linking result is more consistent with the linking result of the linking text, because the first linking result is obtained based on semantic similarity, and is more consistent with the target linking result of the entity.
[0103] In the embodiment of the present application, by acquiring a target text containing an entity, and according to the entity recalling at least one entity standard name and its corresponding category and description information in a preset knowledge graph, using an identifier to mark the entity name in the target text, and based on the entity name of the entity, each entity standard name and the category and description information corresponding to each entity standard name, constructing each entity text of the entity according to a preset format, splicing the target text and each entity text to obtain at least one link text, inputting each link text into a pre-trained language model, encoding each link text by the pre-trained language model to obtain a text feature vector corresponding to each link text, obtaining a first link result set corresponding to each text feature vector by passing each text feature vector through a similarity task model, at the same time, obtaining a second link result set corresponding to each text feature vector by passing each text feature vector through a classification task model, determining the link result with the highest score in all first link results of all first link result sets and all second link results of all second link result sets as the first link result and the second link result respectively, when the final link result pointed to by the first link result and the second link result is the same, determining the first link result or the second link result as the final entity link result of the entity, when the final link result pointed to by the first link result and the second link result is different, determining the first link result as the final entity link result of the entity. According to the text feature vector corresponding to each link text obtained by passing each link text through the pre-trained language model, passing each text feature vector through the similarity task model and the classification task model respectively to obtain the first link result set and the second link result set corresponding to each text feature vector, determining the link result with the highest score in all first link results of all first link result sets as the first link result, and determining the link result with the highest score in all second link result sets as the second link result, according to the comparison of the first link result and the second link result, determining the final entity link result of the entity, effectively combining the similarity task model and the classification task model to perform entity linking on the entity, and improving the effect of entity linking.
[0104] Please refer to Figure 5 , a flowchart of an entity linking method provided in the embodiment of the present application. As Figure 5 shown, the entity linking method can include the following steps:
[0105] S301, acquiring a target text containing an entity, and according to the entity recalling at least one entity standard name and its corresponding category and description information, based on the target text, the entity name of the entity, each entity standard name and its corresponding category and description information, constructing at least one link text of the entity;
[0106] The specific implementation of this step can refer to step S101, which will not be repeated here.
[0107] S302, input each of the link texts into a pre-trained language model to obtain at least one text feature vector, the pre-trained language model being used for encoding each link text;
[0108] Specifically, the target text containing the entity and each entity text composed of the entity name based on the entity, each entity standard name, and the category and description information corresponding to each entity standard name are spliced to form at least one link text of the entity, as shown in the following table: Figure 3 The pre-trained language model is used to encode each link text, the pre-trained language model inserts a [CLS] symbol in front of each input link text, and the output vector corresponding to the symbol is used as the text feature vector corresponding to each link text.
[0109] The pre-trained language model can include but is not limited to a RoBERTa model.
[0110] The RoBERTa is used to pre-train a large amount of unlabeled text data to learn a language representation that can be used for fine-tuning specific machine learning tasks, and in this scheme, each link text is trained to enable the terminal to represent the language in the format of each link text.
[0111] The encoding method of the link text can be but is not limited to a Transformer model.
[0112] The Transformer model is a method for accelerating the training of attention models, including an encoder and a decoder, which are used in this scheme to encode and decode each link text input into the pre-trained language model.
[0113] S303, obtaining the length of the entity name of the entity, the length of each description information, and the length of each entity text;
[0114] Specifically, the entity name in each link text is determined, and the length of the entity name is calculated, the description information in each link text is determined, and the length of each description information is calculated, and the entity text in each link text is determined, and the length of each entity text is calculated.
[0115] The length of the entity name, the length of each description information, and the length of each entity text can include but is not limited to the number of characters occupied by the number of words of these information in each link text, the proportion of these information in each link text, etc.
[0116] As described above in step S202, the link text is "How many episodes of #The Legend of Condor Hero# starring Louis Koo? The Legend of Condor Hero - 95 The Legend of Condor Hero, Type: TV series works; The Legend of Condor Hero is a TV series produced by Hong Kong Television Broadcast Limited based on the martial arts novel The Legend of Condor Hero by Jin Yong, with a total of 32 episodes. Produced by Lee Tin-shing, written by Huang Guohui, Tang Jianping, Zhao Jingrong, Chen Baoyan, starring Louis Koo, Li Ruotong, Fu Mingxian, Bai Biao, Wei Qiuhua, etc."
[0117] Among them, the length of the entity name "The Legend of Condor Hero" is 8 characters, the length of the description information "The Legend of Condor Hero is a TV series produced by Hong Kong Television Broadcast Limited based on the martial arts novel The Legend of Condor Hero by Jin Yong, with a total of 32 episodes. Produced by Lee Tin-shing, written by Huang Guohui, Tang Jianping, Zhao Jingrong, Chen Baoyan, starring Louis Koo, Li Ruotong, Fu Mingxian, Bai Biao, Wei Qiuhua, etc." is 190 characters, and the length of the entity text "The Legend of Condor Hero - 95 The Legend of Condor Hero, Type: TV series works; The Legend of Condor Hero is a TV series produced by Hong Kong Television Broadcast Limited based on the martial arts novel The Legend of Condor Hero by Jin Yong, with a total of 32 episodes. Produced by Lee Tin-shing, written by Huang Guohui, Tang Jianping, Zhao Jingrong, Chen Baoyan, starring Louis Koo, Li Ruotong, Fu Mingxian, Bai Biao, Wei Qiuhua, etc." is 232 characters.
[0118] S304, based on the length of the entity name, a first vector is obtained, based on the length of each description information, at least one second vector is obtained, and based on the length of each entity text, at least one third vector is obtained;
[0119] Specifically, the lengths of different entity names, the lengths of the description information, and the lengths of the entities correspond to different vectors respectively, the length of the obtained entity name is obtained according to the preset entity name length and vector mapping table to obtain the first vector corresponding to the entity name in each link text, the length of each description information is obtained according to the preset description information length and vector mapping table to obtain the second vector corresponding to the description information in each link text, and the length of each entity text is obtained according to the preset entity length and vector mapping table to obtain the third vector corresponding to the entity text in each link text.
[0120] As described above in step S303, the length of the obtained entity name is 8 characters, the length of the description information is 190 characters, and the length of the entity text is 232 characters, as shown in Table 1, the first vector corresponding to the entity name in the link text is vector a, the second vector corresponding to the description information in the link text is vector D, and the third vector corresponding to the entity text in the link text is vector Z.
[0121] Table 1
[0122] Entity name length Vector Description information length Vector Entity length Vector 0-10 characters a 0-50 characters A 0-60 characters S 11-20 characters b 51-100 characters B 61-120 characters X 21-30 characters c 101-150 characters C 121-180 characters Y 31-40 characters d 151-200 characters D 181-240 characters Z … … … … … …
[0123] S305, splicing the first vector and / or each of the second vector and / or each of the third vector to obtain the statistical feature vector corresponding to each of the link texts;
[0124] Specifically, the statistical feature vector corresponding to each link text can be composed of the first vector, the second vector, and the third vector respectively, can be composed of any two of the first vector, the second vector, and the third vector, and can be composed of the first vector, the second vector, and the third vector.
[0125] The arbitrary splicing is the splicing of the front and back positions of any vector.
[0126] The form of the arbitrary splicing of the first vector, the second vector, and the third vector can include but is not limited to the arbitrary splicing of the first vector and the second vector, the arbitrary splicing of the first vector and the third vector, and the arbitrary splicing of the second vector and the third vector.
[0127] The way of the arbitrary splicing of the first vector, the second vector, and the third vector can include but is not limited to the sequential splicing of the first vector, the second vector, and the third vector, the placement of the first vector between the second vector and the third vector, the placement of the third vector between the first vector and the second vector, etc.
[0128] As shown in FIG. 4, the statistical feature vector corresponding to the link text is obtained by randomly splicing the first vector, the second vector, and the third vector. Figure 6 The first vector corresponding to the entity name obtained in the above step 304 is vector a, the second vector corresponding to the description information is vector D, and the third vector corresponding to the entity text is vector Z. Therefore, the statistical feature vector can be vector aDZ, vector aZD, vector DZa, etc.
[0129] S306, splicing the text feature vector of each of the link texts with the statistical feature vector to obtain the final feature vector corresponding to each of the link texts;
[0130] Specifically, the text feature vector corresponding to each link text is obtained by the pre-training language model, the statistical feature vector corresponding to each link text is obtained according to the length of the entity name, the length of the description information, and the length of the entity in each link text, and the final feature vector corresponding to each link text is obtained by splicing the text feature vector and the statistical feature vector.
[0131] The way of splicing the text feature vector and the statistical feature vector to form the final feature vector can include, but is not limited to, placing the text feature vector before the statistical feature vector, placing the text feature vector before the statistical feature, placing the text feature vector between the statistical features, placing the statistical feature vector between the text feature vectors, etc.
[0132] The text feature vector obtained in the step S102 is spliced with the first vector, the second vector and the third vector in sequence to obtain the statistical feature vector, as shown in the following formula: Figure 7 It is shown that the text feature vector is spliced before the statistical feature vector to form the final feature vector.
[0133] S307, based on the final feature vector corresponding to each link text, obtaining a first link result set of each link text, and based on the final feature vector of each link text, obtaining a second link result set of each link text, each first link result set is an entity link result obtained based on a similarity task model, and each second link result set is an entity link result obtained based on a classification task model;
[0134] Specifically, as shown in the following formula: Figure 8 The text feature vector corresponding to each link text is spliced with the statistical feature vector to obtain the final feature vector corresponding to each link text, and each final feature vector is subjected to a similarity task model to obtain a first link result set corresponding to each final feature vector, as shown in the following formula: Figure 9 The text feature vector corresponding to each link text is spliced with the statistical feature vector to obtain the final feature vector corresponding to each link text, and each final feature vector is subjected to a classification task model to obtain a second link result set corresponding to each final feature vector.
[0135] Each final feature vector corresponding to each link text can be connected to a corresponding first link result set and a second link result set in a preset knowledge graph, and each first link result set and second link result set of each link text can be 0, 1 or multiple link results.
[0136] The similarity task model includes a full connection layer, a dropout layer and a full connection layer, and the text feature vector of each link text is subjected to the full connection layer, the dropout layer and the full connection layer, and finally subjected to a hyperbolic function tanh() to obtain the similarity score of each link text corresponding to all first link results in the preset knowledge graph.
[0137] The similarity score is a numerical value in the value range [-1, 1] of the hyperbolic function tanh().
[0138] Dropout layer refers to temporarily discarding a part of network neural units from the network according to a certain probability in the training process of the deep learning network, which is equivalent to finding a thinner network from the original network.
[0139] The second link result in each second link result set corresponding to each link text of the entity can be 0, 1 or multiple, and each link text of the entity is linked in the preset knowledge graph through the classification task model to find the classification of each link text in the preset knowledge graph, which means that the entity standard name in each link text is classified and linked in the preset knowledge graph, and the classification of the entity standard name of the entity in the preset knowledge graph can be 0, 1 or multiple.
[0140] The classification task model includes a full connection layer, a dropout layer and a full connection layer, and the final feature vector corresponding to each link text of the entity finally passes through a normalization function softmax() to obtain the classification score corresponding to each classification of the entity standard name of the entity in the preset knowledge graph.
[0141] For example, the entity standard name in the link text is "Jiudu Shengiao Xiaolü", and "Jiudu Shengiao Xiaolü" is linked in the preset knowledge graph through the classification task model, which will appear film and television, mobile game, book and novel links, etc. According to the current popularity or the number of citations, the normalization function is used to calculate the corresponding scores of each classification.
[0142] The classification score of each classification corresponding to each link text is a value between (0, 1), and the sum of all classification scores is 1.
[0143] S308, based on each first link result set and each second link result set, the final entity link result of the entity is obtained.
[0144] The specific implementation of this step can refer to step S104, which will not be repeated here.
[0145] In the embodiment of the present application, by obtaining the target text containing the entity, and recalling at least one entity standard name and its corresponding classification and description information of the entity in the preset knowledge graph, based on the entity name of the entity, each entity standard name and the category and description information corresponding to each entity standard name, each entity text of the entity is obtained, the target text and each entity text are spliced to obtain at least one link text of the entity, each link text is input into the pre-trained language model, and each link text is encoded by the pre-trained prediction model to obtain the text feature vector corresponding to each link text. At the same time, the length of the entity name, the length of the description information and the length of the entity text in each link text are obtained, the first vector corresponding to the entity name in each link text is obtained according to the entity name length and the vector mapping table, the second vector corresponding to the description information in each link text is obtained according to the description information length and the vector mapping table, and the third vector corresponding to the entity text in each link text is obtained according to the entity length and the vector mapping table. The first vector and / or the second vector and / or the third vector are randomly spliced to obtain a plurality of different statistical feature vectors corresponding to each link text, the text feature vector and the statistical feature vector corresponding to each link text are spliced to obtain the final feature vector corresponding to each link text, each final feature vector is input into the similarity task model to obtain the first link result set corresponding to each final feature vector, each final feature vector is input into the classification task model to obtain the second link result set corresponding to each final feature vector, the first link result with the highest score is determined as the first link result from all first link results in all first link result sets, the second link result with the highest score is determined as the second link result from all second link results in all second link result sets, and the final entity link result of the entity is obtained according to the first link result and the second link result. According to the similarity task model and the classification task model, the link of each link text of the entity in the preset knowledge graph is performed, the first link result set and the second link result set of each link text are obtained, and the final entity link result of the entity is determined from each first link result set and each second link result set. The link results of each link text of the entity are combined by the similarity task model and the classification task model, so as to determine the final entity link result of the entity, and the effect of entity linking is improved.
[0146] The following will be combined Figure 10 The entity linking device provided in the embodiment of the present application will be described in detail. It should be noted that. Figure 10 The entity linking device in the embodiment of the present application is used to execute the method of the embodiment of the present application Figures 2-9 The method embodiment shown in the embodiment of the present application is only shown with the part related to the embodiment of the present application for the convenience of description, and the specific technical details are disclosed. Please refer to the method embodiment shown in the embodiment of the present application. Figures 2-9 The method embodiment shown in the embodiment of the present application is only shown with the part related to the embodiment of the present application for the convenience of description, and the specific technical details are disclosed. Please refer to the method embodiment shown in the embodiment of the present application.
[0147] Please refer to Figure 10A structural schematic diagram of an entity linking apparatus is provided for the present application. As shown in Figure 10 The entity linking apparatus 1 of the embodiment of the present application comprises a linking text construction module 11, a text vector acquisition module 12, a first set determination module 13, and a linking result determination module 14.
[0148] The linking text construction module 11 is configured to acquire a target text containing an entity, recall at least one entity standard name and corresponding category and description information of the entity according to the entity, and construct at least one linking text of the entity based on the target text, the entity name of the entity, each entity standard name, and the corresponding category and description information of each entity standard name.
[0149] The text vector acquisition module 12 is configured to acquire a text feature vector corresponding to each linking text.
[0150] The first set determination module 13 is configured to acquire a first linking result set corresponding to each text feature vector, and acquire a second linking result set corresponding to each text feature vector. Each first linking result set is an entity linking result obtained based on a similarity task model, and each second linking result set is an entity linking result obtained based on a classification task model.
[0151] The linking result determination module 14 is configured to obtain a final entity linking result of the entity based on each first linking result set and each second linking result set.
[0152] Optionally, as shown in Figure 11 The linking text construction module 11 comprises:
[0153] The entity text construction unit 111 is configured to construct each entity text of the entity based on the entity name of the entity, each entity standard name, and the corresponding category and description information of each entity standard name.
[0154] The linking text construction unit 112 is configured to splice the target text and each entity text to construct at least one linking text of the entity.
[0155] Optionally, as shown in Figure 12 The entity linking apparatus 1 further comprises:
[0156] The statistical vector acquisition module 15 is configured to acquire a statistical feature vector corresponding to each linking text.
[0157] The second set determination module 16 is configured to obtain a first link result set corresponding to each link text according to the text feature vector and the statistical feature vector of the link text, and obtain a second link result set corresponding to each link text according to the text feature vector and the statistical feature vector of the link text.
[0158] Optionally, as shown in the statistical vector obtaining module 15 includes: Figure 10
[0159] The length obtaining unit 151 is configured to obtain the length of the entity name of the entity, the length of each description information, and the length of each entity text.
[0160] The vector generating unit 152 is configured to obtain a first vector based on the length of the entity name, obtain at least one second vector based on the length of each description information, and obtain at least one third vector based on the length of each entity text.
[0161] The statistical vector generating unit 153 is configured to splice the first vector and / or each second vector and / or each third vector to obtain the statistical feature vector corresponding to each link text.
[0162] Optionally, as shown in the second set determination module 16 includes: Figure 13
[0163] The vector splicing unit 161 is configured to splice the text feature vector and the statistical feature vector of each link text to obtain a final feature vector corresponding to each link text.
[0164] The set determination unit 162 is configured to obtain a first link result set of each link text based on the final feature vector corresponding to the link text, and obtain a second link result set of each link text based on the final feature vector of the link text.
[0165] Optionally, the link result determination module 14 includes:
[0166] The result determination unit 141 is configured to determine a first link result with the highest score in all first link result sets, and determine a second link result with the highest score in all second link result sets.
[0167] The result determination unit 141 is further configured to determine the first link result or the second link result as the final entity link result of the entity if the first link result is the same as the second link result.
[0168] The result determination unit 141 is further configured to determine the first link result as the final entity link result of the entity if the first link result is different from the second link result.
[0169] Optionally, the text vector obtaining module 12 is specifically configured to:
[0170] input each link text into a pre-trained language model to obtain at least one text feature vector, the pre-trained language model being configured to encode the link text.
[0171] In the embodiment of the present application, the target text containing the entity is obtained, at least one entity standard name and its corresponding category and description information are recalled according to the entity, each entity text of the entity is obtained based on the entity name of the entity, each entity standard name and the category and description information corresponding to each entity standard name, at least one link text of the entity is obtained by splicing the target text and each entity text, each link text is input into the pre-trained language model, and each link text is encoded by the pre-trained prediction model to obtain the text feature vector corresponding to each link text, the length of the entity name, the length of the description information and the length of the entity text in each link text are obtained, the first vector corresponding to the entity name in each link text is obtained according to the entity name length and the vector mapping table, the second vector corresponding to the description information in each link text is obtained according to the description information length and the vector mapping table, the third vector corresponding to the entity text in each link text is obtained according to the entity length and the vector mapping table, the first vector and / or the second vector and / or the third vector of each link text are randomly spliced to obtain a plurality of different statistical feature vectors corresponding to each link text, the text feature vector and the statistical feature vector corresponding to each link text are spliced to obtain the final feature vector of each link text, the first link result set corresponding to each final feature vector is obtained by the similarity task model, the second link result set corresponding to each final feature vector is obtained by the classification task model, the link result with the highest score is determined as the first link result from all the first link results of all the first link result sets, the link result with the highest score is determined as the second link result from all the second link results of all the second link result sets, and the final entity link result of the entity is obtained according to the first link result and the second link result. The similarity task model and the classification task model are combined to link each link text of the entity in the preset knowledge graph to obtain the first link result set and the second link result set of each link text, the first link result with the highest score is determined from all the first link results of all the first link result sets, the second link result with the highest score is determined from all the second link results of all the second link result sets, and the final entity link result of the entity is determined according to the first link result and the second link result, thereby improving the effect of entity linking.
[0172] The embodiment of the present application also provides a computer storage medium which can store a plurality of instructions suitable for being loaded and executed by a processor to implement the entity linking method of the embodiment shown in the above Figures 2-7 The specific implementation process can be referred to the specific description of the embodiment shown in the above Figures 2-7 The specific implementation process can be referred to the specific description of the embodiment shown in the above
[0173] Please refer to Figure 14A structural schematic diagram of an electronic device is provided for an embodiment of the present application. As shown in Figure 14 The terminal device 1000 can include at least one processor 1001, at least one network interface 1002, at least one input / output interface 1003, at least one display unit 1004, at least one memory 1005, and at least one communication bus 1006. The processor 1001 can include one or more processing cores. The processor 1001 connects various parts in the entire electronic device 1000 by various interfaces and lines, executes various functions of the terminal 1000 and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory 1005, and calling data stored in the memory 1005. The memory 1005 can be a high-speed RAM memory or a non-volatile memory such as at least one disk memory. The memory 1005 can also be at least one storage device located away from the aforementioned processor 1001. The network interface 1002 can optionally include a standard wired interface, a wireless interface (such as a WI-FI interface, a Bluetooth interface). The communication bus 1006 is used to realize the connection communication between the components. The display unit 1004 can be a touch panel. As shown in Figure 14 The memory 1005 as a storage medium can include an operating system, a network communication module, an input / output interface module, and an entity linking program.
[0174] In the electronic device 1000 shown in Figure 14 The input / output interface 1003 is mainly used to provide an interface for users and access devices, and obtain data input by users and access devices.
[0175] In one embodiment, the processor 1001 can be used to call the entity linking program stored in the memory 1005, and specifically perform the following operations:
[0176] Obtain a target text containing an entity, and recall at least one entity standard name and corresponding category and description information of the entity according to the entity. Based on the target text, the entity name of the entity, each entity standard name and the corresponding category and description information thereof, at least one linking text of the entity is constructed;
[0177] Respectively obtain a text feature vector corresponding to each of the linking texts;
[0178] Obtain a first linking result set corresponding to each of the text feature vectors, and obtain a second linking result set corresponding to each of the text feature vectors. Each of the first linking result sets is an entity linking result obtained based on a similarity task model, and each of the second linking result sets is an entity linking result obtained based on a classification task model.
[0179] Based on each of the first link result set and each of the second link result set, a final entity link result of the entity is obtained.
[0180] In one embodiment, the processor 1001, when constructing at least one link text of the entity based on the target text, the entity name of the entity, each entity standard name and the corresponding category and description information of the entity standard name, specifically performs the following operations:
[0181] Based on the entity name of the entity, each entity standard name and the corresponding category and description information of the entity standard name, each entity text of the entity is constructed.
[0182] The target text and each entity text are spliced respectively to construct at least one link text of the entity.
[0183] In one embodiment, the processor 1001 further performs the following operations:
[0184] Obtain the statistical feature vector corresponding to each link text;
[0185] According to the text feature vector and the statistical feature vector of each link text, a first link result set corresponding to each link text is obtained, and according to the text feature vector and the statistical feature vector of each link text, a second link result set corresponding to each link text is obtained.
[0186] In one embodiment, the processor 1001, when obtaining the statistical feature vector corresponding to each link text, specifically performs the following operations:
[0187] Obtain the length of the entity name of the entity, the length of each description information and the length of each entity text;
[0188] Based on the length of the entity name, a first vector is obtained, based on the length of each description information, at least one second vector is obtained, and based on the length of each entity text, at least one third vector is obtained;
[0189] The first vector and / or each second vector and / or each third vector are spliced to obtain the statistical feature vector corresponding to each link text.
[0190] In one embodiment, the processor 1001, when obtaining the statistical feature vector corresponding to each link text, specifically performs the following operations:
[0191] concatenate the text feature vectors of the link texts with the statistical feature vectors to obtain a final feature vector corresponding to each of the link texts;
[0192] obtain a first link result set of each of the link texts based on the final feature vector corresponding to the link text, and obtain a second link result set of each of the link texts based on the final feature vector of the link text.
[0193] In one embodiment, when the processor 1001 performs the final entity link result of the entity based on each of the first link result set and each of the second link result set, the processor 1001 specifically performs the following operations:
[0194] determines the first link result with the highest score in all first link result sets, and determines the second link result with the highest score in all second link result sets;
[0195] If the first link result and the second link result are the same, the first link result or the second link result is determined as the final entity link result of the entity;
[0196] If the first link result and the second link result are different, the first link result is determined as the final entity link result of the entity.
[0197] In one embodiment, when the processor 1001 performs the final entity link result of the entity based on each of the first link result set and each of the second link result set, the processor 1001 specifically performs the following operations:
[0198] input each of the link texts into a pre-trained language model to obtain at least one text feature vector, the pre-trained language model being used for encoding each link text.
[0199] In the embodiment of the present application, by obtaining the target text containing the entity, and recalling at least one entity standard name and its corresponding category and description information according to the entity, obtaining each entity text of the entity based on the entity name of the entity, each entity standard name and the category and description information corresponding to each entity standard name, splicing the target text and each entity text to obtain at least one link text of the entity, inputting each link text into the pre-trained language model, encoding each link text by the pre-trained language model to obtain the text feature vector corresponding to each link text, obtaining the length of the entity name, the length of the description information and the length of the entity text in each link text, obtaining the first vector corresponding to the entity name in each link text according to the entity name length and the vector mapping table, obtaining the second vector corresponding to the description information in each link text according to the description information length and the vector mapping table, obtaining the third vector corresponding to the entity text in each link text according to the entity length and the vector mapping table, randomly splicing the first vector and / or the second vector and / or the third vector of each link text to obtain a plurality of different statistical feature vectors corresponding to each link text, splicing the text feature vector and the statistical feature vector corresponding to each link text to obtain the final feature vector of each link text, obtaining the first link result set corresponding to each final feature vector by the similarity task model, obtaining the second link result set corresponding to each final feature vector by the classification task model, determining the link result with the highest score from all first link results of all first link result sets as the first link result, determining the link result with the highest score from all second link results of all second link result sets as the second link result, and then obtaining the final entity link result of the entity according to the first link result and the second link result. The similarity task model and the classification task model are combined to link each link text of the entity in the preset knowledge graph, and the first link result set and the second link result set of each link text are obtained, respectively, the first link result with the highest score is determined from all first link results of all first link result sets, the second link result with the highest score is determined from all second link results of all second link result sets, and then the final entity link result of the entity is determined according to the first link result and the second link result, thereby improving the effect of entity linking.
[0200] Those skilled in the art can clearly understand that the technical solutions of the present application can be implemented by means of software and / or hardware. The "unit" and "module" in the specification refer to software and / or hardware that can independently complete or cooperate with other components to complete a specific function, and the hardware may, for example, be a field programmable gate array (FPGA), an integrated circuit (IC), etc.
[0201] It should be noted that, for the foregoing method embodiments, the sequences of the described actions are not necessarily required to achieve the objects of the application, and certain steps can be performed in other sequences or even concurrently. Also, the aforementioned embodiments merely represent a small sub-set of the many possible embodiments of the present application. One of ordinary skill in the art will readily recognize that the present application can be implemented in combination with other steps and / or components not expressly described above. Accordingly, the present application is not limited to the embodiments described above, but instead has wide applicability and scope.
[0202] In the above embodiments, the description of each embodiment is focused on different aspects, and the parts not described in detail in a certain embodiment can be referred to the relevant description of other embodiments.
[0203] In several embodiments provided by the present application, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely schematic, and the division of the units is merely a logical function division. In actual implementation, another division manner can be adopted, for example, a plurality of units or components can be combined or integrated into another system, or some features can be omitted or not executed. In addition, the coupling or direct coupling or communication connection between the units or components shown or discussed can be indirect coupling or communication connection through some service interfaces, apparatuses or units, and can be electrical or other forms.
[0204] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on a plurality of network units. According to actual needs, part or all of the units can be selected to achieve the purpose of the embodiment.
[0205] In addition, each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can exist physically, or two or more units can be integrated into one unit. The integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
[0206] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable memory. Based on such understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a memory and includes a plurality of instructions for causing an electronic device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned memory includes: a U disk, a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store program codes.
[0207] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be performed by a program instructing relevant hardware, and the program can be stored in a computer readable memory, which can include a flash disk, a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a magnetic disk or an optical disk, etc.
[0208] The above is only exemplary embodiments of the present disclosure, which cannot limit the scope of the present disclosure. That is, any equivalent changes and modifications made according to the teachings of the present disclosure are still within the scope of the present disclosure. Other embodiments of the present disclosure will be readily apparent to those skilled in the art upon considering the specification and practicing the present disclosure. The present application is intended to cover any variations, uses or adaptive changes of the present disclosure that follow the general principles of the present disclosure and include common knowledge or conventional technical means in the technical field not recorded in the present disclosure. The specification and examples are only considered as exemplary, and the scope and spirit of the present disclosure are defined by the claims.
Claims
1. An entity linking method, characterized by, The method comprises: acquiring a target text containing an entity, recalling at least one entity standard name and corresponding category and description information of the entity according to the entity, and constructing at least one link text of the entity based on the target text, an entity name of the entity, each entity standard name and the corresponding category and description information of the entity standard name; respectively acquiring a text feature vector corresponding to each link text; acquiring a first link result set corresponding to each text feature vector and acquiring a second link result set corresponding to each text feature vector, each first link result set being an entity link result obtained based on a similarity task model, and each second link result set being an entity link result obtained based on a classification task model; determining a first link result with the highest score in each first link result set and determining a second link result with the highest score in each second link result set; if the first link result and the second link result are the same, determining the first link result or the second link result as a final entity link result of the entity; if the first link result and the second link result are different, determining the first link result as the final entity link result of the entity.
2. The method of claim 1, wherein, The method further comprises: acquiring a statistical feature vector corresponding to each link text; the acquiring of the first link result set corresponding to each text feature vector and the acquiring of the second link result set corresponding to each text feature vector comprises:
3. The method of claim 1, wherein, acquiring the first link result set corresponding to each link text according to the text feature vector and the statistical feature vector of the link text, and acquiring the second link result set corresponding to each link text according to the text feature vector and the statistical feature vector of the link text. The acquiring of the statistical feature vector corresponding to each link text comprises: acquiring the length of the entity name of the entity, the length of each description information and the length of each entity text; obtaining a first vector based on the length of the entity name, obtaining at least one second vector based on the length of each description information, and obtaining at least one third vector based on the length of each entity text; 4. The method of claim 3, wherein, splicing the first vector and / or each second vector and / or each third vector to obtain the statistical feature vector corresponding to each link text. The acquiring of the statistical feature vector corresponding to each link text comprises: 5. The method of claim 3, wherein, The text feature vectors of each of the link texts are spliced with the statistical feature vector to obtain a final feature vector corresponding to each of the link texts; A first link result set of each of the link texts is obtained based on the final feature vector corresponding to each of the link texts, and a second link result set of each of the link texts is obtained based on the final feature vector of each of the link texts.
6. The method according to any one of claims 1 to 5, characterized in that, The obtaining of the text feature vector corresponding to each of the link texts comprises: Each of the link texts is input into a pre-trained language model to obtain at least one text feature vector, and the pre-trained language model is used to encode each link text.
7. An entity linking apparatus characterized by comprising: The device comprises: A link text construction module configured to obtain a target text containing an entity, recall at least one entity standard name and corresponding category and description information of the entity according to the entity, and construct at least one link text of the entity based on the target text, the entity name of the entity, each entity standard name and the corresponding category and description information thereof; A text vector obtaining module configured to obtain a text feature vector corresponding to each of the link texts respectively; A first set determining module configured to obtain a first link result set corresponding to each of the text feature vectors and a second link result set corresponding to each of the text feature vectors, each of the first link result sets being an entity link result obtained based on a similarity task model, and each of the second link result sets being an entity link result obtained based on a classification task model; A link result determining module configured to determine a first link result with the highest score in each of the first link result sets and a second link result with the highest score in each of the second link result sets, determine the first link result or the second link result as a final entity link result of the entity if the first link result is the same as the second link result, and determine the first link result as the final entity link result of the entity if the first link result is different from the second link result.
8. A computer storage medium, characterized in that The computer storage medium stores a plurality of instructions adapted to be loaded and executed by a processor to perform the method steps of any one of claims 1-6.
9. An electronic device, comprising: Comprise: A processor and a memory; wherein the memory stores a computer program adapted to be loaded and executed by the processor to perform the method steps of any one of claims 1-6.
Citation Information
Patent Citations
Multi-language knowledge matching method and device for nodes and links in knowledge graph
CN111858961A
Method, electronic device, and storage medium for entity linking
US20210216716A1