Entity linking method and apparatus, device and medium
By annotating text fragments in entity links and combining them with a semantic matching neural network, the semantic similarity between text and entities is utilized, solving the problem of the failure to effectively utilize semantic information in existing technologies and achieving more efficient and accurate entity links.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-04
- Publication Date
- 2026-03-03
AI Technical Summary
Existing entity linking technologies fail to effectively utilize the semantic information of text and entities when matching text and entities, and fail to accurately handle entity mapping in cases of typos and text abbreviations.
By labeling entity fragments and non-entity fragments in the text, and combining the text fragments with the text matching degree of the entities, a semantic matching neural network is used to obtain the semantic similarity between candidate entities and target text, thereby determining the target entity.
It improves the accuracy and efficiency of entity linking, simplifies the processing flow, and enables more accurate identification of target entities.
Smart Images

Figure CN114611526B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of artificial intelligence technology, and more particularly to the fields of knowledge graphs and natural language processing technology, specifically to an entity linking method, apparatus, electronic device, computer-readable storage medium, and computer program product. Background Technology
[0002] Artificial intelligence (AI) is the study of enabling computers to simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, and planning). It encompasses both hardware and software technologies. AI hardware technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, and big data processing. AI software technologies primarily include computer vision, speech recognition, natural language processing, machine learning / deep learning, big data processing, and knowledge graph technologies.
[0003] Entity linking technology refers to mapping language fragments in text to entities in a knowledge base, especially when the names or aliases of the language fragments and entities do not perfectly match (e.g., due to typos, abbreviations, etc.), to achieve accurate mapping. Entity linking is one of the research hotspots in the field of natural language processing and plays an important role in practical industry applications. Its key lies in how to recall candidate entities based on text and select the final linked entity from among them.
[0004] The methods described in this section are not necessarily methods that had been previously conceived or adopted. Unless otherwise specified, no method described in this section should be assumed to be prior art simply because it is included in this section. Similarly, unless otherwise specified, the issues mentioned in this section should not be considered to be accepted in any prior art. Summary of the Invention
[0005] This disclosure provides a method, apparatus, electronic device, computer-readable storage medium, and computer program product for linking entities.
[0006] According to one aspect of this disclosure, an entity linking method is provided, comprising: determining a plurality of fragments of target text, the plurality of fragments including entity fragments and non-entity fragments; obtaining a plurality of candidate entities; for each candidate entity among the plurality of candidate entities, obtaining a matching degree between the candidate entity and the plurality of fragments, the matching degree being used to indicate the degree of overlap between the text included in each candidate entity and the text included in the plurality of fragments; determining a semantic similarity between the candidate entity and the target text based on the matching degree between each candidate entity and the plurality of fragments; and determining a target entity for linking with the target text from the plurality of candidate entities, at least based on the semantic similarity between each candidate entity and the target text.
[0007] According to another aspect of this disclosure, an entity linking apparatus is provided, comprising: a first determining unit configured to determine a plurality of segments of target text, the plurality of segments including entity segments and non-entity segments; a first acquiring unit configured to acquire a plurality of candidate entities; a second acquiring unit configured to acquire, for each of the plurality of candidate entities, a matching degree between the candidate entity and the plurality of segments, the matching degree indicating the degree of overlap between the text of each candidate entity and the text included in the plurality of segments; a second determining unit configured to determine, based on the matching degree between the candidate entity and the plurality of segments, a semantic similarity between the candidate entity and the target text; and a third determining unit configured to determine, at least based on the semantic similarity between each candidate entity and the target text, a target entity from the plurality of candidate entities for linking with the target text.
[0008] According to another aspect of this disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the entity linking method described above.
[0009] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are used to cause the computer to perform the above-described entity linking method.
[0010] According to another aspect of this disclosure, a computer program product is provided, including a computer program, wherein the computer program, when executed by a processor, is capable of implementing the above-described entity linking method.
[0011] According to one or more embodiments of this disclosure, the efficiency and accuracy of entity linking can be improved.
[0012] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0013] The accompanying drawings exemplify embodiments and form part of the specification, serving together with the textual description to explain exemplary implementations of the embodiments. The illustrated embodiments are for illustrative purposes only and do not limit the scope of the claims. Throughout the drawings, the same reference numerals refer to similar but not necessarily identical elements.
[0014] Figure 1A schematic diagram of an exemplary system in which various methods described herein may be implemented, according to exemplary embodiments of the present disclosure;
[0015] Figure 2 A flowchart of an entity linking method according to an exemplary embodiment of the present disclosure is shown;
[0016] Figure 3 A flowchart of an entity linking method according to an exemplary embodiment of the present disclosure is shown;
[0017] Figure 4 A schematic diagram of the structure of a semantic matching neural network according to an exemplary embodiment of the present disclosure is shown;
[0018] Figure 5 A structural block diagram of a physical linking device according to an exemplary embodiment of the present disclosure is shown;
[0019] Figure 6 A structural block diagram of an exemplary electronic device that can be used to implement embodiments of the present disclosure is shown. Detailed Implementation
[0020] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0021] In this disclosure, unless otherwise stated, the use of terms such as "first," "second," etc., to describe various elements is not intended to limit the positional, temporal, or importance relationships of these elements; such terms are merely used to distinguish one element from another. In some examples, the first element and the second element may refer to the same instance of that element, while in other cases, based on the context, they may refer to different instances.
[0022] The terminology used in the description of the various examples described in this disclosure is for the purpose of describing particular examples only and is not intended to be limiting. Unless the context explicitly indicates otherwise, an element may be one or more unless the number of elements is specifically limited. Furthermore, the term "and / or" as used in this disclosure covers any one of the listed items and all possible combinations thereof.
[0023] Entity linking technology refers to mapping language fragments in text to entities in a knowledge base. One approach involves selecting linked entities by calculating the similarity between the text and the text contained in the entity, but this doesn't utilize the semantic information inherent in the text and entity. Another approach uses a trained neural network to derive semantic similarity based on the semantic information contained in the text and entity, but this doesn't consider the matching relationship between the text and the text contained in the entity during the semantic information extraction process.
[0024] Based on this, this disclosure provides an entity linking method, which obtains the semantic similarity between text and entities by annotating entity fragments and non-entity fragments in text, and then considering the text matching degree between multiple fragments in text and entities, thereby enabling more accurate and efficient identification of entities linked to text.
[0025] The embodiments of this disclosure will now be described in detail with reference to the accompanying drawings.
[0026] Figure 1 A schematic diagram of an exemplary system 100 in which the various methods and apparatus described herein can be implemented according to embodiments of this disclosure is shown. Reference Figure 1 The system 100 includes one or more client devices 101, 102, 103, 104, 105 and 106, a server 120, and one or more communication networks 110 coupling the one or more client devices to the server 120. The client devices 101, 102, 103, 104, 105 and 106 can be configured to execute one or more applications.
[0027] In embodiments of this disclosure, server 120 may run one or more services or software applications that enable the execution of entity linking methods.
[0028] In some embodiments, server 120 may also provide other services or software applications that may include non-virtual and virtual environments. In some embodiments, these services may be provided as web-based services or cloud services, such as to users of client devices 101, 102, 103, 104, 105 and / or 106 under a Software as a Service (SaaS) model.
[0029] exist Figure 1In the configuration shown, server 120 may include one or more components that implement the functions performed by server 120. These components may include software components, hardware components, or combinations thereof that can be executed by one or more processors. Users operating client devices 101, 102, 103, 104, 105, and / or 106 can sequentially interact with server 120 using one or more client applications to utilize the services provided by these components. It should be understood that various different system configurations are possible and may differ from system 100. Therefore, Figure 1 This is an example of a system used to implement the various methods described herein, and is not intended to be limiting.
[0030] Users can use client devices 101, 102, 103, 104, 105, and / or 106 to send target text. The client devices can provide an interface that allows users to interact with the client devices. The client devices can also output information to the user through this interface. Although... Figure 1 Only six client devices are described, but those skilled in the art will understand that this disclosure can support any number of client devices.
[0031] Client devices 101, 102, 103, 104, 105, and / or 106 may include various types of computer devices, such as portable handheld devices, general-purpose computers (such as personal computers and laptops), workstation computers, wearable devices, smart screen devices, self-service terminal devices, service robots, gaming systems, thin clients, various messaging devices, sensors, or other sensing devices. These computer devices can run various types and versions of software applications and operating systems, such as Microsoft Windows, Apple iOS, UNIX-like operating systems, Linux or Linux-like operating systems (such as Google Chrome OS); or include various mobile operating systems, such as Microsoft Windows Mobile OS, iOS, Windows Phone, and Android. Portable handheld devices may include cellular phones, smartphones, tablets, personal digital assistants (PDAs), etc. Wearable devices may include head-mounted displays (such as smart glasses) and other devices. Gaming systems may include various handheld gaming devices, internet-enabled gaming devices, etc. Client devices are capable of executing various applications, such as various internet-related applications, communication applications (such as email applications), short message service (SMS) applications, and can use various communication protocols.
[0032] Network 110 can be any type of network well known to those skilled in the art, and can use any of a variety of available protocols (including but not limited to TCP / IP, SNA, IPX, etc.) to support data communication. By way of example only, one or more networks 110 can be a local area network (LAN), an Ethernet-based network, a token ring network, a wide area network (WAN), the Internet, a virtual network, a virtual private network (VPN), an intranet, an extranet, a public switched telephone network (PSTN), an infrared network, a wireless network (e.g., Bluetooth, WIFI), and / or any combination of these and / or other networks.
[0033] Server 120 may include one or more general-purpose computers, special-purpose server computers (e.g., PC (personal computer) servers, UNIX servers, mid-range servers), blade servers, mainframe computers, server clusters, or any other suitable arrangement and / or combination. Server 120 may include one or more virtual machines running a virtual operating system, or other computing architectures involving virtualization (e.g., one or more flexible pools of logical storage devices that can be virtualized to maintain virtual storage devices for servers). In various embodiments, server 120 may run one or more services or software applications that provide the functionality described below.
[0034] The computing unit in server 120 can run one or more operating systems, including any of the aforementioned operating systems and any commercially available server operating system. Server 120 can also run any of a variety of additional server applications and / or middleware applications, including HTTP servers, FTP servers, CGI servers, JAVA servers, database servers, etc.
[0035] In some implementations, server 120 may include one or more applications to analyze and merge data feeds and / or event updates received from users of client devices 101, 102, 103, 104, 105, and 106. Server 120 may also include one or more applications to display data feeds and / or real-time events via one or more display devices of client devices 101, 102, 103, 104, 105, and 106.
[0036] In some implementations, server 120 can be a server for a distributed system or a server integrated with blockchain. Server 120 can also be a cloud server, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology. A cloud server is a host product in the cloud computing service system, designed to address the shortcomings of traditional physical hosts and Virtual Private Server (VPS) services, such as high management difficulty and weak business scalability.
[0037] System 100 may also include one or more databases 130. In some embodiments, these databases may be used to store data and other information. For example, one or more of the databases 130 may be used to store information such as audio files and video files. Databases 130 may reside in various locations. For example, a database used by server 120 may be local to server 120, or it may be located away from server 120 and may communicate with server 120 via a network-based or dedicated connection. Databases 130 may be of different types. In some embodiments, the database used by server 120 may be, for example, a relational database. One or more of these databases may store, update, and retrieve data from and from the databases in response to commands.
[0038] In some embodiments, one or more of the databases 130 may also be used by an application to store application data. The databases used by the application may be of different types, such as key-value stores, object stores, or regular stores supported by a file system.
[0039] Figure 1 The system 100 can be configured and operated in various ways to enable the application of the various methods and apparatus described in this disclosure.
[0040] Figure 2 A flowchart of an entity linking method according to an exemplary embodiment of this disclosure is shown. Figure 2 As shown, the method includes: step S201, determining multiple segments of the target text, the multiple segments including entity segments and non-entity segments; step S202, obtaining multiple candidate entities; step S203, for each candidate entity among the multiple candidate entities, obtaining the matching degree between the candidate entity and the multiple segments, the matching degree being used to indicate the degree of overlap between the text included in each candidate entity and the text included in the multiple segments; step S204, determining the semantic similarity between the candidate entity and the target text based on the matching degree between each candidate entity and the multiple segments; and step S205, determining the target entity for linking with the target text from the multiple candidate entities, at least based on the semantic similarity between each candidate entity and the target text. Therefore, by annotating entity segments and non-entity segments in the text, and considering the text matching relationship between multiple segments and entities in the text, the semantic similarity between candidate entities and the target text can be obtained, thus enabling a simpler and more accurate acquisition of the semantic similarity between the target text to be linked and the candidate entities, thereby determining the target entity for linking with the target text and achieving more accurate and efficient entity linking.
[0041] For example, determining multiple segments of the target text in step S201 can be achieved through text sequence annotation. By annotating the text corresponding to entities included in the target text as entity segments and the remaining segments as non-entity segments, the entity segments in the target text can be used to more accurately indicate the semantic information of the target text, thereby improving the accuracy of entity links.
[0042] According to some embodiments, in step S202, obtaining multiple candidate entities includes: obtaining multiple initial entities; and determining multiple candidate entities from the multiple initial entities based on entity fragments of the target text. Therefore, by initially screening the initial entities, multiple candidate entities can be recalled, effectively reducing the number of candidate entities, thereby reducing the computational load required to determine the target entity, and thus improving the accuracy and efficiency of entity linking.
[0043] For example, the plurality of initial entities may be obtained from a database, and then multiple candidate entities may be determined from the plurality of initial entities based on the similarity between each initial entity and an entity fragment of the target text. In one example, multiple candidate entities may be recalled using an ElasticSearch database to reduce the computational load required to determine the target entity and improve the accuracy and efficiency of entity linking.
[0044] According to some embodiments, in step S203, obtaining the matching degree between each candidate entity and the plurality of segments for each candidate entity among the plurality of candidate entities includes: obtaining a common subsequence between the candidate entity and the plurality of segments; and determining the matching degree between the candidate entity and the plurality of segments based on the common subsequence. Therefore, the matching degree between the candidate entity and the plurality of segments can be obtained more simply and accurately.
[0045] For example, the matching degree between a candidate entity and the multiple segments can be determined by the proportion of the length of the common subsequence to the length of the text sequence of the candidate entity and / or the multiple segments. For instance, when the proportion of the length of the common subsequence to the length of the text sequence of one entity segment in both the candidate entity and the multiple segments is 100%, it can be determined that the candidate entity and the entity segment completely overlap, thus determining that the candidate entity and the entity segment have a high matching degree.
[0046] In one example, the matching degree between the candidate entity and the multiple segments can be characterized by defining multiple matching types, such as "complete overlap," "partial overlap," and "no overlap." For instance, when the text sequence of the candidate entity completely overlaps with the text sequence of one of the multiple segments, the matching degree between the candidate entity and that segment can be determined as "complete overlap." When the text sequence of the candidate entity partially overlaps with the text sequence of one of the multiple segments, the matching degree between the candidate entity and that segment can be determined as "partial overlap." This allows for a simple and accurate characterization of the matching degree between the candidate entity and the multiple segments, thereby improving the efficiency of entity linking.
[0047] According to some embodiments, in step S204, determining the semantic similarity between the candidate entity and the target text based on the matching degree between each candidate entity and the plurality of segments includes: inputting the candidate entity, the target text, and the matching degree between the candidate entity and the plurality of segments into a semantic matching neural network to obtain the semantic similarity between the candidate entity and the target text output by the semantic matching neural network. Therefore, the semantic similarity between the candidate entity and the target text can be obtained using a semantic matching neural network, simplifying the processing flow and making it more convenient and accurate.
[0048] For example, the semantic matching neural network can be trained through the following steps: obtaining sample candidate entities and sample target text, wherein the sample target text includes multiple segments, including entity segments and non-entity segments; obtaining the matching degree between the sample candidate entities and the multiple segments; calculating and labeling the true semantic similarity between the sample candidate entities and the sample target text based on the sample candidate entities, the sample target text, and the matching degree between the sample candidate entities and the multiple segments, specifically, for example, the true semantic similarity of the sample target text can be calculated using a formula; inputting the sample candidate entities, the sample target text, and the matching degree between the sample candidate entities and the multiple segments into the semantic matching neural network, and obtaining the predicted semantic similarity output by the semantic matching neural network; calculating a loss value based on the true semantic similarity and the predicted semantic similarity; and adjusting the parameters of the semantic matching neural network based on the loss value.
[0049] Further, according to some embodiments, the semantic matching neural network includes a first sub-neural network and a second sub-neural network, wherein obtaining the semantic similarity between the candidate entity and the target text output by the semantic matching neural network includes: inputting the candidate entity, the target text, and the matching degree between the candidate entity and the plurality of segments into the first sub-neural network to obtain the entity vector corresponding to the candidate entity and the text vector corresponding to the target text output by the first sub-neural network; and inputting the entity vector corresponding to the candidate entity and the text vector corresponding to the target text into the second sub-neural network to obtain the semantic similarity between the candidate entity and the target text output by the second sub-neural network. Thus, by converting the candidate entity and the target text into corresponding vectors, the semantic similarity between the candidate entity and the target text can be obtained more accurately.
[0050] For example, the first sub-neural network can be an attention-based vector encoder, which can encode the candidate entity and the target text into corresponding entity vectors and text vectors based on the matching degree between the candidate entity and the multiple segments. By applying the attention mechanism, the first sub-neural network can make the obtained entity vectors and text vectors more accurately represent the semantic information of the candidate entity and the target text, thereby improving the accuracy of entity linking. For example, in the application of the first sub-neural network, by perceiving the matching degree between the candidate entity and the multiple segments, more semantic information contained in the segments of the target text with a high matching degree with the candidate entity can be applied, thereby obtaining more accurate text vectors.
[0051] Furthermore, in one example, the candidate entity and multiple fragments of the target text can be first input into a pre-trained model, such as the Ernie model, to obtain the initial entity vector corresponding to the candidate entity and the multiple initial text fragment vectors corresponding to each of the multiple fragments of the target text. Then, the initial entity vector, the multiple initial text fragment vectors, and the matching degree between the candidate entity and the multiple fragments are input into a first sub-neural network, so that the first sub-neural network can output entity vectors and text vectors that represent the semantic information of the candidate entity and the target text more accurately and efficiently.
[0052] According to some embodiments, step S205, determining the target entity for linking with the target text from the plurality of candidate entities based on the semantic similarity between each candidate entity and the target text, includes: sorting the plurality of candidate entities at least based on the semantic similarity between each candidate entity and the target text to obtain a candidate entity sorting result; and determining the target entity for linking with the target text based on the candidate entity sorting result. Therefore, by sorting the candidate entities, the target entity for linking with the target text can be quickly and accurately determined.
[0053] For example, the candidate entities can be sorted based on the semantic similarity between each candidate entity and the target text from largest to smallest, and then the candidate entity with the largest sorting value can be determined as the target entity, which is simpler and more accurate.
[0054] According to some embodiments, the method further includes: calculating the edit distance between each candidate entity in the plurality of candidate entities and an entity segment of the target text, the edit distance indicating the degree of difference between each candidate entity and the entity segment of the target text; and in step S205, at least based on the edit distance between each candidate entity and the entity segment of the target text and the semantic similarity between each candidate entity and the target text, determining the target entity for linking with the target text from the plurality of candidate entities. Thus, by fusing the edit distances between each candidate entity and the entity segment of the target text, the target entity for linking with the target text can be determined more accurately, improving the accuracy of entity linking.
[0055] For example, the edit distance is a quantified numerical value that indicates the minimum number of processing steps required to transform one text sequence into another. Further, in one example, the edit distance coefficient between two text sequences can be obtained based on the following formula:
[0056]
[0057] In the above formula, edit_distance represents the edit distance between text sequence s1 and text sequence s2, and len(s1) and len(s2) represent the lengths of the text sequences.
[0058] In one example, the text sequence s1 corresponding to the candidate entity is “ABBCC”, and the text sequence s2 corresponding to the entity fragment of the target text is “ABBDD”. It can be seen that converting text sequence s1 into text sequence s2 requires at least two character substitution processes, i.e., the edit distance is 2. Combining the length of the text sequence, the edit distance coefficient between text sequence s1 and text sequence s2 is 0.6.
[0059] According to some embodiments, determining the target entity for linking with the target text from a plurality of candidate entities, based at least on the edit distance between each candidate entity and an entity segment of the target text, and the semantic similarity between each candidate entity and the target text, includes: performing a weighted calculation on the edit distance between each candidate entity and an entity segment of the target text, and the semantic similarity between each candidate entity and the target text, based on a preset weight; and determining the target entity for linking with the target text from the plurality of candidate entities based on the result of the weighted calculation. This allows for a simpler and more accurate determination of the target entity for linking with the target text.
[0060] For example, the matching degree between each candidate entity and multiple segments of the target text may include the sub-matching degree between each candidate entity and the entity segments of the target text. Furthermore, the target entity for linking with the target text may be determined from the multiple candidate entities based on the sub-matching degree between each candidate entity and the entity segments of the target text, the edit distance coefficient between each candidate entity and the entity segments of the target text, and the semantic similarity between each candidate entity and the target text. The sub-matching degree between the candidate entity and the entity segments of the target text may be a binary value of 1 or 0. For example, if the entity segment of the target text is a subsequence of the candidate entity, then the sub-matching degree between the candidate entity and the entity segment of the target text is determined to be 1; otherwise, it is 0.
[0061] For example, based on preset weights, the sub-matching degree between each candidate entity and the entity segment of the target text, the edit distance coefficient between each candidate entity and the entity segment of the target text, and the semantic similarity between each candidate entity and the target text can be weighted and calculated. Then, based on the weighted calculation results, the target entity for linking with the target text can be determined from the multiple candidate entities to improve the accuracy of entity linking.
[0062] Furthermore, according to some embodiments, the step of weighting the edit distance between each candidate entity and the entity segment of the target text and the semantic similarity between each candidate entity and the target text based on preset weights includes: adjusting the preset weights according to preset rules; and weighting the edit distance between each candidate entity and the entity segment of the target text and the semantic similarity between each candidate entity and the target text based on the adjusted preset weights.
[0063] For example, adjusting the preset weights according to preset rules can either modify the weights according to the preset rules or not modify the weights according to the preset rules. For instance, when the semantic similarity between each candidate entity and the target text is obtained using a semantic matching neural network, the weights of each indicator during the weighted calculation process can be dynamically adjusted based on changes in the performance of the semantic matching neural network. Alternatively, the preset weights of each indicator during the weighted calculation process can be left unchanged if the performance of the semantic matching neural network remains unchanged. For example, the weights corresponding to the semantic similarity between each candidate entity and the target text can be reduced during the cold start phase, and then increased again after the performance of the semantic matching neural network reaches a predetermined standard, to solve the cold start problem of the semantic matching neural network and make the entity linking method more applicable to various scenarios.
[0064] According to some embodiments, the method further includes: obtaining attribute information corresponding to each of the plurality of candidate entities, the attribute information including information related to the candidate entity, and wherein the matching degree includes the matching degree between the candidate entity and / or the corresponding attribute information of the candidate entity and the plurality of segments, and in step S204, determining the semantic similarity between the candidate entity and the target text based on the matching degree between each candidate entity and the plurality of segments includes: determining the semantic similarity between the candidate entity and the target text based on the matching degree between the candidate entity and / or the corresponding attribute information of the candidate entity and the plurality of segments. Therefore, the semantics of the candidate entity can be more accurately indicated using the corresponding attribute information of the candidate entity, thereby improving the accuracy of entity linking.
[0065] Furthermore, according to some embodiments, the candidate entities are obtained from a knowledge graph, and obtaining the corresponding attribute information of each candidate entity among the plurality of candidate entities includes: for each candidate entity among the plurality of candidate entities, obtaining the nodes and edges associated with that candidate entity from the knowledge graph; and obtaining the attribute information of each node and edge associated with that candidate entity, so as to obtain the corresponding attribute information of that candidate entity. Thus, the association information contained in each node and edge in the knowledge graph can be utilized to more accurately obtain the corresponding attribute information of each candidate entity, thereby more accurately representing the semantics of each candidate entity and improving the accuracy of entity linking.
[0066] According to some embodiments, the method further includes: rewriting each segment of a plurality of segments of the target text based on preset rules to obtain a plurality of segments that meet preset conditions. Thus, by rewriting the target text, standardized text segments can be obtained, facilitating subsequent processing and thereby improving the accuracy and efficiency of entity linking.
[0067] For example, rewriting each segment of the target text based on preset rules may include: using a preset error correction dictionary to find and correct typos in the segment of the target text, thereby reducing the impact of typos on the entity linking effect.
[0068] For example, rewriting each segment of the target text based on preset rules may include: rewriting the numbers, dates, and times in the target text segment into date and time information in a predetermined format. For example, rewriting Arabic numerals in the target text segment into Chinese characters. This reduces the impact of different expressions of the same information on the effectiveness of entity links.
[0069] The exemplary embodiments of this disclosure will be further described below with reference to examples.
[0070] Figure 3 A flowchart of an entity linking method according to an exemplary embodiment of the present disclosure is shown. Figure 4 A schematic diagram of the structure of a semantic matching neural network according to an exemplary embodiment of the present disclosure is shown.
[0071] like Figure 3 As shown, the entity linking method includes the following segmented steps:
[0072] Step S31: Annotate the target text segments; Step S32: Rewrite the target text segments; Step S33: Initially screen and recall candidate entities; Step S34: Sort the candidate entities.
[0073] Step S31 may specifically include:
[0074] Step S311: Determine multiple segments of the target text through text sequence annotation, wherein the multiple segments include entity segments and non-entity segments.
[0075] Step S32 may specifically include:
[0076] Step S321: Based on preset rules, rewrite each segment of the target text to obtain multiple segments that meet preset conditions.
[0077] Step S33 may specifically include:
[0078] Step S331: Obtain multiple initial entities from the knowledge graph;
[0079] Step S332: Based on the entity fragments of the target text, determine multiple candidate entities from the multiple initial entities.
[0080] Step S34 may specifically include:
[0081] Step S341: For each candidate entity among the plurality of candidate entities, obtain the nodes and edges associated with that candidate entity from the knowledge graph;
[0082] Step S342: Obtain the attribute information of the nodes and edges associated with the candidate entity to obtain the corresponding attribute information of the candidate entity;
[0083] Step S343: Determine the matching degree between the candidate entity and / or the corresponding attribute information of the candidate entity and the multiple fragments. The matching degree between different elements can be characterized by defining multiple matching degree types as shown in Table 1.
[0084] Table 1:
[0085]
[0086]
[0087] Step S344: Input the candidate entity and its corresponding attribute information and multiple fragments of the target text into the pre-trained model to obtain the initial entity vector and initial attribute vector of the candidate entity and the multiple initial text fragment vectors of each fragment of the target text.
[0088] Step S345: Input the initial entity vector and initial attribute vector, the plurality of initial text fragment vectors, and the matching degree between the candidate entity and / or the corresponding attribute information of the candidate entity and the plurality of fragments into the first sub-neural network to obtain the entity vector and text vector output by the first sub-neural network;
[0089] Step S346: Input the entity vector corresponding to the candidate entity and the text vector corresponding to the target text into the second sub-neural network to obtain the semantic similarity between the candidate entity and the target text output by the second sub-neural network;
[0090] Step S347: Based at least on the semantic similarity between each candidate entity and the target text, determine the target entity from the plurality of candidate entities for linking with the target text.
[0091] Therefore, it is possible to more accurately obtain the semantic similarity between the target text to be linked and the candidate entities, and then determine the target entities to be linked with the target text, thus achieving more accurate and efficient entity linking.
[0092] According to another aspect of this disclosure, a physical linking device is also provided. Figure 5 A structural block diagram of a physical linking device 500 according to an exemplary embodiment of the present disclosure is shown. Figure 5 As shown, the device 500 includes: a first determining unit 501 configured to determine multiple segments of target text, the multiple segments including entity segments and non-entity segments; a first acquiring unit 502 configured to acquire multiple candidate entities; a second acquiring unit 503 configured to acquire, for each candidate entity among the multiple candidate entities, the matching degree between the candidate entity and the multiple segments, the matching degree indicating the degree of overlap between the text of each candidate entity and the text included in the multiple segments; a second determining unit 504 configured to determine the similarity between the candidate entity and the target text based on the matching degree between the candidate entity and the multiple segments; and a third determining unit 505 configured to determine, at least based on the similarity between each candidate entity and the target text, a target entity from the multiple candidate entities for linking with the target text. The operation of units 501-505 of the entity linking device 500 is similar to the operation of steps S201-S205 described above, and will not be repeated here.
[0093] According to another aspect of this disclosure, an electronic device is also provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the entity linking method described above.
[0094] According to another aspect of this disclosure, a non-transitory computer-readable storage medium storing computer instructions is also provided, wherein the computer instructions are used to cause the computer to perform the entity linking method described above.
[0095] According to another aspect of this disclosure, a computer program product is also provided, comprising a computer program, wherein the computer program, when executed by a processor, implements the entity linking method described above.
[0096] refer to Figure 6 The present invention describes a structural block diagram of an electronic device 600 that can serve as a server or client of the present disclosure, which is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0097] like Figure 6 As shown, device 600 includes a computing unit 601, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 602 or a computer program loaded from storage unit 608 into random access memory (RAM) 603. RAM 603 may also store various programs and data required for the operation of device 600. The computing unit 601, ROM 602, and RAM 603 are interconnected via bus 604. Input / output (I / O) interface 605 is also connected to bus 604.
[0098] Multiple components in device 600 are connected to I / O interface 605, including: input unit 606, output unit 607, storage unit 608, and communication unit 609. Input unit 606 can be any type of device capable of inputting information to device 600. Input unit 606 can receive input numerical or character information and generate key signal inputs related to user settings and / or function control of the electronic device, and can include, but is not limited to, a mouse, keyboard, touchscreen, trackpad, trackball, joystick, microphone, and / or remote control. Output unit 607 can be any type of device capable of presenting information, and can include, but is not limited to, a monitor, speaker, video / audio output terminal, vibrator, and / or printer. Storage unit 608 can include, but is not limited to, a hard disk and an optical disk. Communication unit 609 allows device 600 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks, and can include, but is not limited to, modems, network cards, infrared communication devices, wireless communication transceivers, and / or chipsets, such as Bluetooth™ devices, 802.11 devices, WiFi devices, WiMax devices, cellular communication devices, and / or the like.
[0099] The computing unit 601 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 601 performs the various methods and processes described above, such as the entity linking method. For example, in some embodiments, the entity linking method can be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 608. In some embodiments, part or all of the computer program can be loaded and / or installed on device 600 via ROM 602 and / or communication unit 609. When the computer program is loaded into RAM 603 and executed by the computing unit 601, one or more steps of the entity linking method described above can be performed. Alternatively, in other embodiments, the computing unit 601 can be configured to perform the entity linking method by any other suitable means (e.g., by means of firmware).
[0100] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0101] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0102] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0103] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0104] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0105] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.
[0106] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0107] While embodiments or examples of this disclosure have been described with reference to the accompanying drawings, it should be understood that the methods, systems, and devices described above are merely exemplary embodiments or examples, and the scope of the invention is not limited by these embodiments or examples, but only by the granted claims and their equivalents. Various elements in the embodiments or examples may be omitted or replaced by their equivalents. Furthermore, the steps may be performed in a different order than that described in this disclosure. Further, various elements in the embodiments or examples may be combined in various ways. Importantly, as the technology evolves, many elements described herein can be replaced by equivalents that appear after this disclosure.
Claims
1. A method for linking entities, comprising: Identify multiple fragments of the target text, including entity fragments and non-entity fragments; Retrieve multiple candidate entities; Obtain the attribute information corresponding to each candidate entity among the plurality of candidate entities, wherein the attribute information includes semantic information related to the candidate entity; For each of the plurality of candidate entities, Obtain the matching degree type between the candidate entity and the plurality of segments, wherein the matching degree type between the candidate entity and each segment indicates the segment type and the degree of text overlap between the candidate entity and the segment; Obtain the matching degree type between the attribute information of the candidate entity and the multiple fragments. The matching degree type between the attribute information of the candidate entity and each fragment indicates the fragment type of the fragment and the degree of text overlap between the attribute information of the candidate entity and the fragment. The fragment type includes entity fragments or non-entity fragments. Based on the matching degree type of each candidate entity with the multiple fragments and the matching degree type of the corresponding attribute information of each candidate entity with the multiple fragments, the semantic similarity between the candidate entity and the target text is determined. as well as Based at least on the semantic similarity between each candidate entity and the target text, a target entity for linking with the target text is determined from the plurality of candidate entities.
2. The method according to claim 1, wherein, The step of determining the semantic similarity between the candidate entity and the target text based on the matching degree type between each candidate entity and the plurality of segments, and the matching degree type between the corresponding attribute information of each candidate entity and the plurality of segments, includes: The candidate entity, the target text, the matching degree type of the candidate entity and the plurality of segments, and the corresponding attribute information of each candidate entity and the matching degree type of the plurality of segments are input into a semantic matching neural network to obtain the semantic similarity between the candidate entity and the target text output by the semantic matching neural network.
3. The method according to claim 2, wherein the semantic matching neural network comprises a first sub-neural network and a second sub-neural network, and wherein, The step of obtaining the semantic similarity between the candidate entity output by the semantic matching neural network and the target text includes: The candidate entity, the target text, the matching degree type between the candidate entity and the plurality of segments, and the matching degree type between the attribute information of each candidate entity and the plurality of segments are input into a first sub-neural network to obtain the entity vector corresponding to the candidate entity and the text vector corresponding to the target text output by the first sub-neural network; and The entity vector corresponding to the candidate entity and the text vector corresponding to the target text are input into the second sub-neural network to obtain the similarity between the candidate entity and the target text output by the second sub-neural network.
4. The method according to claim 1, wherein, The process of obtaining multiple candidate entities includes: Obtain multiple initial entities; and Based on the entity fragments of the target text, multiple candidate entities are determined from the multiple initial entities.
5. The method according to claim 1, wherein, The step of obtaining the matching degree between each candidate entity and the plurality of fragments for each candidate entity among the plurality of candidate entities includes: Obtain the common subsequence of the candidate entity and the plurality of fragments; and Based on the common subsequence, the matching degree between the candidate entity and the multiple fragments is determined.
6. The method according to claim 1, further comprising: Calculate the edit distance between each candidate entity and an entity segment of the target text, whereby the edit distance indicates the degree of difference between each candidate entity and the entity segment of the target text. The target entity for linking with the target text is determined from the plurality of candidate entities based at least on the edit distance between each candidate entity and the entity fragment of the target text and the semantic similarity between each candidate entity and the target text.
7. The method according to claim 6, wherein, The step of determining the target entity for linking with the target text from the plurality of candidate entities, based at least on the edit distance between each candidate entity and an entity fragment of the target text and the semantic similarity between each candidate entity and the target text, includes: Based on preset weights, the edit distance between each candidate entity and the entity segment of the target text, as well as the semantic similarity between each candidate entity and the target text, are weighted and calculated; and Based on the weighted calculation results, a target entity for linking with the target text is determined from the plurality of candidate entities.
8. The method according to claim 7, wherein, The step of weighting the edit distance between each candidate entity and the entity fragment of the target text, as well as the semantic similarity between each candidate entity and the target text, based on preset weights, includes: Adjust the preset weights according to preset rules; and Based on the adjusted preset weights, the edit distance between each candidate entity and the entity fragment of the target text, as well as the semantic similarity between each candidate entity and the target text, are calculated using weighted averages.
9. The method of claim 1, wherein the candidate entity is obtained from a knowledge graph, and wherein, Obtaining the attribute information of each candidate entity from the plurality of candidate entities includes: For each of the plurality of candidate entities, obtain the nodes and edges associated with that candidate entity from the knowledge graph; and Obtain the attribute information of the nodes and edges associated with the candidate entity to obtain the corresponding attribute information of the candidate entity.
10. The method according to claim 1, further comprising: Based on preset rules, each segment of the target text is rewritten to obtain multiple segments that meet preset conditions.
11. The method according to any one of claims 1-10, wherein, The step of determining the target entity for linking with the target text from the plurality of candidate entities, based at least on the semantic similarity between each candidate entity and the target text, includes: Based at least on the semantic similarity between each candidate entity and the target text, the candidate entities are ranked to obtain a candidate entity ranking result; and Based on the candidate entity ranking results, the target entity used to link with the target text is determined.
12. A physical linking device, comprising: The first determining unit is configured to determine multiple segments of the target text, the multiple segments including entity segments and non-entity segments; The first acquisition unit is configured to acquire multiple candidate entities; Obtain the attribute information corresponding to each candidate entity among the plurality of candidate entities, wherein the attribute information includes semantic information related to the candidate entity; The second acquisition unit is configured to, for each of the plurality of candidate entities, acquire the matching degree between the candidate entity and the plurality of segments, wherein the matching degree type indicates the segment type of the segment and the degree of text overlap between the candidate entity and the segment; and acquire the matching degree type between the corresponding attribute information of the candidate entity and the plurality of segments, wherein the matching degree type indicates the segment type of the segment and the degree of text overlap between the corresponding attribute information of the candidate entity and the segment, wherein the segment type includes entity segments or non-entity segments; The second determining unit is configured to determine the semantic similarity between the candidate entity and the target text based on the matching degree type between the candidate entity and the plurality of segments and the matching degree type between the corresponding attribute information of each candidate entity and the plurality of segments. as well as The third determining unit is configured to determine, from the plurality of candidate entities, a target entity for linking with the target text, based at least on the semantic similarity between each candidate entity and the target text.
13. An electronic device, comprising: At least one processor; as well as A memory that is communicatively connected to the at least one processor; in The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-11.
14. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-11.
15. A computer program product comprising a computer program, wherein, The computer program, when executed by a processor, implements the method according to any one of claims 1-11.
Citation Information
Patent Citations
Method, device, equipment and medium for entity association
CN109933785A
Method and device for processing query text, equipment, medium and program
CN112507198A
Resource information acquisition method and device, readable storage medium and electronic equipment
CN113204685A