Entity linking method and device, equipment and medium
By obtaining the user query statement and using the pre-trained named entity recognition model to determine the entity to be linked, and determining the linked entity from the candidate entities based on string matching and similarity results, the problem of low efficiency of entity linking and high labor cost in the existing technology is solved. problem, achieving efficient entity linking.
Patent Information
- Application Number
- CN202311716720.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-13
- Publication Date
- 2024-10-22
AI Technical Summary
The entity linking efficiency in the existing technology is low and requires a lot of manual construction of feature engineering, resulting in high labor costs and poor linking efficiency.
By obtaining the user query statement, the pre-trained named entity recognition model is used to determine the entity to be linked, and the linked entity is determined from the candidate entities based on string matching and similarity results to improve the efficiency of entity linking.
It improves the efficiency of entity linking and reduces computational complexity and labor costs.
Smart Images

Figure CN118820482A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of natural language processing technology, and in particular, relates to an entity linking method, device, equipment and medium. Background Art
[0002] With the popularization and deepening of computer applications, the requirements for large-scale real text content calculation and understanding are becoming increasingly urgent. Entity linking has become an important task in the field of natural language information processing. Through entity linking, the entities in the text to be identified are associated and corresponded with the entities in the knowledge base to complete natural language tasks such as question answering.
[0003] However, in the related art, traditional statistical schemes are used and a large amount of feature engineering needs to be manually constructed to achieve entity linking, which requires a lot of manpower costs and has low linking efficiency. Summary of the invention
[0004] The embodiments of the present application provide a physical linking method, apparatus, device and medium, which can improve linking efficiency.
[0005] In a first aspect, an embodiment of the present application provides an entity linking method, comprising:
[0006] Get the user's query statement;
[0007] Inputting the query statement into a pre-trained named entity recognition model to determine the entity to be linked corresponding to the query statement;
[0008] Determine multiple candidate entities according to the matching results of the entities in the knowledge base and the character strings of the entities to be linked;
[0009] According to the entity to be linked and multiple candidate entities, respectively determine a similarity result between each candidate entity and the entity to be linked;
[0010] According to the similarity result, a link entity corresponding to the to-be-linked entity is determined from the multiple candidate entities.
[0011] In a second aspect, an embodiment of the present application provides a physical linking device, the device comprising:
[0012] The acquisition module is used to obtain the user's query statement;
[0013] An input module, used to input the query statement into a pre-trained named entity recognition model to determine the entity to be linked corresponding to the query statement;
[0014] A matching module, used to determine multiple candidate entities according to the matching results of the entities in the knowledge base and the character strings of the entities to be linked;
[0015] A first determination module, configured to determine, based on the to-be-linked entity and a plurality of candidate entities, a similarity result between each candidate entity and the to-be-linked entity;
[0016] The second determining module is used to determine the linking entity corresponding to the to-be-linked entity from the multiple candidate entities according to the similarity result.
[0017] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, the steps of the entity linking method described in any one of the embodiments of the first aspect are implemented.
[0018] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the steps of the entity linking method described in any one of the embodiments of the first aspect are implemented.
[0019] The entity linking method, apparatus, device and medium of the embodiments of the present application perform named entity recognition on the acquired user query statement to determine the entity to be linked, and determine multiple candidate entities based on string matching between the entity to be linked and the entities in the knowledge base, and then determine the link entity corresponding to the entity to be linked from the multiple candidate entities according to the similarity between each candidate entity and the entity to be linked, so as to realize entity linking, which can improve the linking efficiency and has low computational complexity and labor cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0021] Figure 1 It is a flowchart of an entity linking method provided in an embodiment of the present application;
[0022] Figure 2 is a structural schematic diagram of a physical linking device provided in an embodiment of the present application;
[0023] Figure 3 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0024] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.
[0025] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0026] It should be noted that the acquisition, storage, use and processing of data in the embodiments of the present application are in compliance with the relevant provisions of national laws and regulations.
[0027] Entity is used to represent the basic unit that carries important information in natural language text. The semantic information of a text can be represented by the interaction between entities and other entities.
[0028] Named entity recognition is used to identify entities of specified categories in text, such as people, organizations, places, etc.
[0029] With the popularization and deepening of computer applications, the requirements for large-scale real text content calculation and understanding are becoming increasingly urgent. Entity linking has become an important task in the field of natural language information processing. Through entity linking, the entities in the text to be identified are associated and corresponded with the entities in the knowledge base to complete natural language tasks such as question answering.
[0030] However, in the related art, traditional statistical schemes are used and a large amount of feature engineering needs to be manually constructed to achieve entity linking, which requires a lot of manpower costs and has low linking efficiency.
[0031] In order to solve the problems of related technologies, embodiments of the present application provide an entity linking method, apparatus, device and medium.
[0032] The entity linking method provided in the embodiment of the present application is described in detail below through specific embodiments and their application scenarios in conjunction with the accompanying drawings.
[0033] Figure 1 FIG. 1 is a flow chart of an entity linking method 100 according to an embodiment of the present application. Figure 1 As shown, the entity linking method 100 may specifically include the following steps:
[0034] S101, obtaining a user's query statement;
[0035] S102, inputting the query statement into a pre-trained named entity recognition model to determine an entity to be linked corresponding to the query statement;
[0036] S103, determining a plurality of candidate entities according to the matching results between the entities in the knowledge base and the character strings of the entities to be linked;
[0037] S104, determining the similarity result between each candidate entity and the entity to be linked according to the entity to be linked and multiple candidate entities;
[0038] S105: Determine, according to the similarity result, a link entity corresponding to the to-be-linked entity from the multiple candidate entities.
[0039] Therefore, named entity recognition is performed on the obtained user query statement to determine the entity to be linked, and multiple candidate entities are determined based on string matching between the entity to be linked and the entities in the knowledge base. Then, the link entity corresponding to the entity to be linked is determined from the multiple candidate entities according to the similarity between each candidate entity and the entity to be linked, so as to realize entity linking. This can improve the linking efficiency, and the computational complexity and labor cost are low.
[0040] The specific implementation methods of the above steps are introduced below.
[0041] It should be noted that the knowledge base in the embodiment of the present application may include a general Internet semantic knowledge base, or may include a customized specific knowledge base corresponding to the user's application scenario and application requirements. In other words, the entity linking method in the embodiment of the present application can be applied to the specific scenario of the user's requirements.
[0042] In some embodiments, in step S101, the query statement obtained can be regarded as a short text, and in order to make the text match and adapt to the named entity recognition model, the text needs to be preprocessed. Specifically, the preprocessing process includes: cleaning the query statement, for example, filtering the stop words and abnormal symbols in the query statement; converting the cleaned text into an input format that matches the named entity recognition model, and annotating the text, that is, identifying the named entities in the text.
[0043] For the annotation method, the BIO format can be used to annotate each word in the text into one of the following three categories: B (Begin), I (Inside), O (Outside). Among them, B (Begin) is used to mark the beginning word of an entity, indicating that this word is the starting part of an entity; I (Inside) is used to mark the middle word of an entity, indicating that this word is in the entity but not the starting word; O (Outside) is used to mark words that do not belong to any entity. In this way, the entity boundary information in the text can be determined through annotation, so that the named entity recognition model can more easily learn to recognize the beginning and end of the entity.
[0044] In some embodiments, in step S102, the named entity recognition model is an ERNIE-BiGRU-CRF model, that is, the named entity recognition is performed using the ERNIE (Enhanced Representation through Knowledge Integration) pre-trained model and in combination with the BiGRU (Bi-direction Gate Recurrent Unit) and CRF (Conditional Random Fields) layers.
[0045] Specifically, the named entity recognition model adopts a masking strategy at three levels: word, entity, and phrase. During pre-training, it does not focus only on a single masked string token, that is, it is not a character-level masking mechanism, but learns the representation of these tokens through other tokens in the context to understand the relationship between them. In other words, when an entity is masked, the contextual information around the entity can be observed at the same time, including other masked tokens and unmasked tokens. In this way, the internal structure of the entity and the relationship between the entity and its context can be learned, that is, in addition to learning local relationships, the relationship between entities can also be learned.
[0046] Therefore, ERNIE can realize the feature extraction and vectorized representation of the input corpus in the process of named entity recognition, and has better recognition effect on Chinese corpus, and can better learn the semantic relationship between words, entities and phrases of different granularities.
[0047] Furthermore, the BiGRU network is used to classify each token. Specifically, the results of the forward GRU and backward GRU are concatenated, and finally the label category is obtained through the fully connected layer and softmax.
[0048] Among them, the GRU network merges the forget gate and input gate of LSTM and replaces them with update gates, which simplifies the model structure, reduces model parameters and shortens model training time, but the effect is equivalent to that of LSTM. The GRU formula description is shown in formulas (1) to (4).
[0049]
[0050]
[0051]
[0052]
[0053] in, is the input at the current moment; is the hidden state at the previous moment; Indicates the candidate state at the current moment; To update the gate, control the next information inflow; is the reset gate that controls the retention and loss of information; σ is the activation function; W and bc are the weights and biases of the model parameters.
[0054] Furthermore, through the idea of global optimization, the global optimal label sequence is obtained based on the constraint relationship between labels. The trained CRF model is decoded using the Viterbi algorithm to calculate the label sequence with the highest probability, as shown in the following formula (5):
[0055]
[0056] In this way, the calculated tag sequence is decoded and converted to the entity to be linked. Taking the user demand scenario as the knowledge base question-answering scenario in intelligent operation and maintenance as an example, for example, if the user's query statement is "query the status of the virtual machine resource management system", the entity to be linked is "virtual machine resource management system".
[0057] In some embodiments, in step S103, based on the entity to be linked, a search is performed in the knowledge base to determine whether there is an entity that matches the string of the entity to be linked; if there is an entity that matches the string of the entity to be linked in the knowledge base, multiple entities that match the string of the entity to be linked are determined as multiple candidate entities.
[0058] In another embodiment, when there is no entity matching the string of the entity to be linked in the knowledge base, the entity to be linked is segmented to obtain multiple segmented words. For example, the multiple segmented words obtained after segmenting the entity to be linked "virtual machine resource management system" include: "virtual machine", "resource", "management", "system", "resource management system". Then, for each segmented word, according to the substring corresponding to the segmented word, the entity matching the substring is searched in the knowledge base; the entities matching each segmented word are determined as multiple candidate entities.
[0059] In some embodiments, in step S104, the entity to be linked and the candidate entity are respectively vectorized to obtain the word vector of the entity to be linked and the word vector of the candidate entity; thus, based on the word vector of the entity to be linked and the word vector of the candidate entity, the similarity result between the candidate entity and the entity to be linked is determined.
[0060] Specifically, vectorization is implemented through the CBOW model in word2vec. The structure of the CBOW model includes three layers: input layer, projection layer and output layer.
[0061] For the specific structure of the CBOW model, assuming that the context of the central word t is composed of 2t words, the input layer includes the word vectors w1, w2, ..., w i ∈R m , where m represents the word vector w i The length of R represents the set of all real numbers; the projection layer mainly accumulates and sums the 2t word vectors of the input layer, as shown in the following formula (6):
[0062]
[0063] For the output layer, it is a binary tree structure. Specifically, the words that appear in the corpus are used as leaf nodes, and the number of times each word appears in the corpus is used as the weight to construct a Huffman binary tree. Then, in the Huffman binary tree structure, there are (N = |D|) leaf nodes, corresponding to the words in D in the dictionary, and there are N-1 non-leaf nodes.
[0064] In some embodiments, when calculating entity vectors through the CBOW model, a training word vector is first selected, wherein the basic corpus selects the corpus of a general knowledge base, and adds query corpus of user demand scenarios, entity supplementary corpus in a specific knowledge base, etc.; then, the word vector is trained and saved after preprocessing and word segmentation; thus, the pre-trained word vector model can be directly loaded to calculate the candidate entity vector.
[0065] In some embodiments, the similarity result between each candidate entity and the entity to be linked can be determined according to the following formula (7):
[0066]
[0067] Among them, a i b represents the vector matrix element of the candidate entity; b i Vector matrix elements representing the entities to be linked.
[0068] Furthermore, in some embodiments, for each candidate entity, an evaluation index of the candidate entity is determined based on the similarity result. Specifically, if the candidate entity is determined by matching the character string of the entity to be linked, the similarity result corresponding to the candidate entity is directly determined as the evaluation index of the candidate entity; if the candidate entity is determined by matching the substring of the segmented word obtained after segmenting the entity to be linked, the evaluation index of the candidate entity is determined based on the similarity result of the candidate entity and its substring of the segmented word.
[0069] In specific implementation, the weight coefficient of the candidate entity is determined according to the number of characters in the substring of the word segmentation corresponding to the candidate entity and the number of characters in the string of the entity to be linked; thus, the product of the similarity result and the weight coefficient is determined as the evaluation index of the candidate entity.
[0070] The weight coefficient can be determined by the following formula (8):
[0071]
[0072] Among them, s a Indicates the total number of characters in the string, s t The word count of the substring representing the candidate entity.
[0073] Thus, the weight coefficient of each substring can be obtained by calculation, and then the weights of all candidate entities obtained by traversing all word segmentation results and performing matching searches in the knowledge base are determined as the weight of the corresponding substring.
[0074] Then, the evaluation index of the candidate entity is:
[0075] R s =W s ×S s (9)
[0076] Among them, W s Represents the weight coefficient corresponding to the candidate entity.
[0077] In some embodiments, in step S105, a preset number of candidate entities with the largest values of evaluation indicators among multiple candidate entities are determined as a first set, for example, the top 5 candidate entities with the highest evaluation indicators are determined as the first set; multiple candidate entities are classified through a classification model to determine a second set; thus, based on the first set and the second set, the link entity corresponding to the entity to be linked is determined.
[0078] In a specific implementation, multiple candidate entities are input into a classification model to obtain classification results, wherein the classification results include positive examples and negative examples. Positive examples are used to indicate real linked entities, while other entities are regarded as negative examples. Thus, the candidate entities corresponding to the positive examples are determined as the second set.
[0079] More specifically, the classification model uses the TextCNN model. The word vectors of multiple candidate entities are input into the TextCNN model, and after operations such as convolution and pooling, feature extraction and compression are completed. Finally, the fully connected network layer and softmax output categories are output, and the positive examples in the category are the second set.
[0080] In some embodiments, when the second set is an empty set, the candidate entity with the largest value of the evaluation index in the first set is determined as the link entity corresponding to the entity to be linked; when the second set is not an empty set, the intersection of the first set and the second set is determined as the third set; when the third set is an empty set, the candidate entity with the largest value of the evaluation index in the first set is determined as the link entity corresponding to the entity to be linked; when the third set is not an empty set, the candidate entity with the largest value of the evaluation index in the third set is determined as the link entity corresponding to the entity to be linked.
[0081] It should be noted that the above describes some embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the above embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0082] Based on the same technical concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a physical linking device 200.
[0083] like Figure 2 As shown, the entity linking device 200 may include:
[0084] The acquisition module 201 is used to acquire the user's query statement;
[0085] An input module 202, configured to input the query statement into a pre-trained named entity recognition model to determine an entity to be linked corresponding to the query statement;
[0086] A matching module 203, used to determine multiple candidate entities according to the matching results between the entities in the knowledge base and the character strings of the entities to be linked;
[0087] A first determination module 204 is used to determine the similarity result between each candidate entity and the entity to be linked according to the entity to be linked and multiple candidate entities;
[0088] The second determining module 205 is used to determine the linking entity corresponding to the to-be-linked entity from the multiple candidate entities according to the similarity result.
[0089] In some embodiments, the matching module 203 is specifically used to search in the knowledge base whether there is an entity matching the string of the entity to be linked based on the entity to be linked; when there is an entity matching the string of the entity to be linked in the knowledge base, multiple entities matching the string of the entity to be linked are determined as multiple candidate entities.
[0090] In some embodiments, the matching module 203 is also specifically used to perform word segmentation processing on the entity to be linked to obtain multiple word segments when there is no entity matching the string of the entity to be linked in the knowledge base; for each word segment, according to the substring corresponding to the word segment, search the knowledge base for an entity matching the substring; and determine the entities matching each word segment as multiple candidate entities.
[0091] In some embodiments, the first determination module 204 is specifically used to vectorize the entity to be linked and the candidate entity respectively to obtain the word vector of the entity to be linked and the word vector of the candidate entity; based on the word vector of the entity to be linked and the word vector of the candidate entity, determine the similarity result between the candidate entity and the entity to be linked.
[0092] In some embodiments, the second determination module 205 is specifically used to determine, for each of the candidate entities, an evaluation index of the candidate entity based on the similarity result; determine a preset number of candidate entities with the largest values of the evaluation index among multiple candidate entities as a first set; input multiple candidate entities into a classification model to obtain classification results, the classification results including positive examples and negative examples, the positive examples being used to indicate real linked entities; determine the candidate entities corresponding to the positive examples as a second set; and determine the linked entities corresponding to the entities to be linked based on the first set and the second set.
[0093] In some embodiments, the second determination module 205 is further specifically used to determine the weight coefficient of the candidate entity based on the number of characters in the substring of the word segment corresponding to the candidate entity and the number of characters in the string of the entity to be linked; and determine the product of the similarity result and the weight coefficient as the evaluation index of the candidate entity.
[0094] In some embodiments, the second determination module 205 is further specifically used to determine, when the second set is an empty set, the candidate entity with the largest numerical value of the evaluation index in the first set as the link entity corresponding to the entity to be linked; when the second set is not an empty set, determine the intersection of the first set and the second set as the third set; when the third set is an empty set, determine the candidate entity with the largest numerical value of the evaluation index in the first set as the link entity corresponding to the entity to be linked; when the third set is not an empty set, determine the candidate entity with the largest numerical value of the evaluation index in the third set as the link entity corresponding to the entity to be linked.
[0095] It should be noted that, for the convenience of description, the above device is described in various modules according to their functions. Of course, when implementing this application, the functions of each module can be implemented in the same or multiple software and / or hardware.
[0096] The device of the above embodiment is used to implement the corresponding entity linking method in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.
[0097] Based on the same technical concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides an electronic device.
[0098] Figure 3 A more specific schematic diagram of the hardware structure of an electronic device provided by this embodiment is shown.
[0099] The electronic device 300 may include a processor 301 and a memory 302 storing computer program instructions.
[0100] Specifically, the processor 301 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0101] The memory 302 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 302 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, the memory 302 may include a removable or non-removable (or fixed) medium. In appropriate cases, the memory 302 may be inside or outside the integrated gateway disaster recovery device. In a specific embodiment, the memory 302 is a non-volatile solid-state memory.
[0102] In certain embodiments, the memory may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Thus, typically, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to one aspect of the present application.
[0103] The processor 301 implements any one of the entity linking methods in the above embodiments by reading and executing computer program instructions stored in the memory 302 .
[0104] In some examples, the electronic device 300 may further include a communication interface 303 and a bus 310. Figure 3 As shown, the processor 301, the memory 302, and the communication interface 303 are connected via a bus 310 and communicate with each other.
[0105] The communication interface 303 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.
[0106] Bus 310 includes hardware, software or both, and the components of online data flow billing equipment are coupled to each other. For example, but not limitation, bus 310 may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front-end bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 310 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the present application considers any suitable bus or interconnection.
[0107] Exemplarily, the electronic device 300 may be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA).
[0108] Based on the same technical concept, corresponding to any of the above-mentioned embodiments, the present application also provides a non-transitory computer-readable storage medium. The computer-readable storage medium stores computer program instructions; when the computer program instructions are executed by the processor, any of the entity linking methods in the above-mentioned embodiments is implemented. Examples of computer-readable storage media include non-transitory computer-readable storage media, such as portable disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, etc.
[0109] Based on the same technical concept, corresponding to any of the above-mentioned embodiments, the present application also provides a computer program product, which includes computer program instructions. In some embodiments, the computer program instructions can be executed by one or more processors of a computer so that the computer and / or the processor execute the entity linking method. Corresponding to the execution subject corresponding to each step in each embodiment of the entity linking method, the processor that executes the corresponding step can belong to the corresponding execution subject.
[0110] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.
[0111] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0112] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.
[0113] The above reference is according to the method of the embodiment of the present application, the flow chart of the device (system) and the computer program product and / or the block diagram described various aspects of the present application.It should be understood that each square box in the flow chart and / or the block diagram and the combination of each square box in the flow chart and / or the block diagram can be realized by computer program instructions.These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the realization of the function / action specified in one or more square boxes of the flow chart and / or the block diagram.Such a processor can be but is not limited to a general-purpose processor, a special-purpose processor, a special application processor or a field programmable logic circuit.It can also be understood that each square box in the block diagram and / or the flow chart and the combination of the square boxes in the block diagram and / or the flow chart can also be realized by the dedicated hardware that performs the specified function or action, or can be realized by the combination of dedicated hardware and computer instructions.
[0114] The above is only a specific implementation of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.
Claims
1. An entity linking method, characterized in that: include: Get the user's query statement; Inputting the query statement into a pre-trained named entity recognition model to determine the entity to be linked corresponding to the query statement; Determine multiple candidate entities according to the matching results between the entity in the knowledge base and the character string of the entity to be linked; According to the entity to be linked and multiple candidate entities, respectively determine a similarity result between each candidate entity and the entity to be linked; According to the similarity result, a link entity corresponding to the to-be-linked entity is determined from the multiple candidate entities.
2. The method according to claim 1, characterized in that The determining of multiple candidate entities according to the matching results of the entity in the knowledge base and the character string of the entity to be linked includes: According to the entity to be linked, searching in the knowledge base whether there is an entity matching the character string of the entity to be linked; In the case that there is an entity matching the character string of the to-be-linked entity in the knowledge base, a plurality of entities matching the character string of the to-be-linked entity are determined as a plurality of candidate entities.
3. The method according to claim 2, characterized in that After searching in the knowledge base whether there is an entity matching the character string of the entity to be linked according to the entity to be linked, the method further includes: When there is no entity matching the character string of the to-be-linked entity in the knowledge base, segmenting the to-be-linked entity to obtain a plurality of segmented words; For each of the word segments, according to the substring corresponding to the word segment, searching the knowledge base for an entity matching the substring; Entities matching each word segment are determined as multiple candidate entities.
4. The method according to claim 1, characterized in that The step of determining, based on the entity to be linked and the plurality of candidate entities, a similarity result between each candidate entity and the entity to be linked comprises: Vectorizing the to-be-linked entity and the candidate entity respectively to obtain a word vector of the to-be-linked entity and a word vector of the candidate entity; According to the word vector of the entity to be linked and the word vector of the candidate entity, a similarity result between the candidate entity and the entity to be linked is determined.
5. The method according to claim 3, characterized in that: Determining, from the plurality of candidate entities, a link entity corresponding to the to-be-linked entity according to the similarity result, comprises: For each of the candidate entities, determining an evaluation index of the candidate entity according to the similarity result; Determine a preset number of candidate entities with the largest values of the evaluation index among the multiple candidate entities as a first set; Inputting multiple candidate entities into a classification model to obtain a classification result, wherein the classification result includes positive examples and negative examples, and the positive examples are used to indicate real link entities; Determine the candidate entities corresponding to the positive examples as a second set; According to the first set and the second set, a link entity corresponding to the to-be-linked entity is determined.
6. The method according to claim 5, characterized in that Determining the evaluation index of the candidate entity according to the similarity result includes: Determine the weight coefficient of the candidate entity according to the number of characters in the substring of the word segmentation corresponding to the candidate entity and the number of characters in the string of the entity to be linked; The product of the similarity result and the weight coefficient is determined as the evaluation index of the candidate entity.
7. The method according to claim 5, characterized in that The determining, according to the first set and the second set, a link entity corresponding to the to-be-linked entity comprises: In the case that the second set is an empty set, determining the candidate entity with the largest value of the evaluation index in the first set as the link entity corresponding to the to-be-linked entity; When the second set is not an empty set, the intersection of the first set and the second set is determined as the third set; when the third set is an empty set, the candidate entity with the largest value of the evaluation index in the first set is determined as the link entity corresponding to the entity to be linked; when the third set is not an empty set, the candidate entity with the largest value of the evaluation index in the third set is determined as the link entity corresponding to the entity to be linked.
8. A physical linking device, characterized in that: The device comprises: The acquisition module is used to obtain the user's query statement; An input module, used to input the query statement into a pre-trained named entity recognition model to determine the entity to be linked corresponding to the query statement; A matching module, used to determine multiple candidate entities according to the matching results of the entities in the knowledge base and the character strings of the entities to be linked; A first determination module, configured to determine, based on the to-be-linked entity and a plurality of candidate entities, a similarity result between each candidate entity and the to-be-linked entity; The second determining module is used to determine the linking entity corresponding to the to-be-linked entity from the multiple candidate entities according to the similarity result.
9. An electronic device, characterized in that: The device comprises: a processor and a memory storing computer program instructions; when the processor calls the computer program instructions, the entity linking method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are called by the processor, the entity linking method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Method and system for linking entities
CN106202382A
Knowledge-driven query-based entity linking method
CN110888946A
Knowledge graph question and answer question entity linking method and device, equipment and medium
CN114925681A
