An entity linking method, system, device and medium

By combining entity recognition, semantic vector encoding, language model enhancement, and matching model, the problem of insufficient semantic distinguishability caused by sparse and non-standard text in multi-source heterogeneous business databases is solved, and high-precision entity linking is achieved, meeting the real-time and reliability requirements in power business operation and management.

CN122153075APending Publication Date: 2026-06-05GUANGDONG POWER GRID CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
GUANGDONG POWER GRID CO LTD
Filing Date
2026-03-03
Publication Date
2026-06-05

Smart Images

  • Figure CN122153075A_ABST
    Figure CN122153075A_ABST
Patent Text Reader

Abstract

The application discloses an entity linking method, system, device and medium, and belongs to the technical field of computer information processing. The method comprises the following steps: obtaining a to-be-processed text of a first database, performing entity recognition on the to-be-processed text to obtain an entity mention and a corresponding original context; encoding the entity mention into a first semantic vector, performing vector retrieval in a second database according to the first semantic vector, and obtaining a plurality of candidate entities; inputting the original context and the candidate entities into a preset language model to obtain target semantic information according to a preset prompt template, fusing the original context and the target semantic information to obtain target context of each candidate entity; and inputting the target context and attribute information of the candidate entities into a preset matching model to obtain a matching score of each candidate entity, and taking the candidate entity with the highest matching score as an entity linking result. Therefore, the application can realize high-precision entity linking.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer information processing, and in particular to a method, system, device, and medium for linking entities. Background Technology

[0002] In the field of power business operation and management, there are inconsistencies or non-standard formats in entity descriptions in databases from different business systems (such as customer work orders and equipment logs). In order to achieve the fusion analysis and unified management of multi-source heterogeneous business data, it is necessary to accurately link non-standard entity references in the first database to standard entities in the standard database (such as standard product database and customer file database), thereby realizing intelligent decision-making in power business operations.

[0003] Currently, index-based or vector-based retrieval methods, through vector encoding and efficient retrieval structures, enable text entities to be quickly matched to knowledge base entities. Typically, this method encodes entity mentions in the text and knowledge base entities into low-dimensional vectors, constructs an entity vector index using a similarity search library, and employs methods such as approximate nearest neighbor to quickly filter Top-K candidate entities before using a dedicated EL model to determine the entity linking results.

[0004] However, when the original business record information is sparse (such as short text or highly ambiguous), or when multiple candidate entities in the second database are highly similar in name and attributes, the semantic representation of the model is not distinctive enough, resulting in a significant decrease in link accuracy and making it difficult to meet the actual business requirements for link reliability. Summary of the Invention

[0005] This invention provides an entity linking method, system, device, and medium that can solve the problem of insufficient semantic representation distinguishability caused by the sparse and non-standard expression of the original business text information in a multi-source heterogeneous business database environment, which leads to a significant reduction in linking accuracy, thereby achieving high-precision linking of entities between the second database and the first database.

[0006] This invention provides an entity linking method, comprising: For each first database to be linked, obtain the text to be processed, perform entity recognition on the text to be processed to obtain at least one entity mention, and determine the original context corresponding to each entity mention; For each entity mention, the entity mention is encoded into a first semantic vector, and vector retrieval is performed in a preset second database based on the first semantic vector to obtain multiple candidate entities; For each candidate entity mentioned by each entity, the original context and the candidate entity are input into a preset language model to be processed according to a preset prompt template to obtain target semantic information. The original context and the target semantic information are then fused to obtain the target context corresponding to each candidate entity. For each entity mention, the target context and the attribute information of the candidate entity are input into a preset matching model to obtain the matching score corresponding to each candidate entity. The candidate entity with the highest matching score is used as the entity linking result of the entity mention, so as to realize the entity linking between the first database and the second database.

[0007] This invention transforms unstructured or semi-structured text into structured entity references and their original context through Entity Recognition (NER), providing clear operational objects and semantic background for subsequent link processing. It converts text semantics into computable vectors and utilizes efficient approximate retrieval techniques (such as ANN) to quickly recall a set of potentially related candidate entities from a massive knowledge base (second database), reducing matching computation costs and meeting real-time business requirements. Semantic similarity-based retrieval can capture entities that appear inconsistent on the surface but are semantically related, such as name variations and synonyms, improving the recall rate of the candidate set and laying the foundation for subsequent fine-grained ranking. Finally, it leverages the deep semantic understanding and generation capabilities of Large Language Models (LLM). Under the constraints of specific candidate entities and their attributes, the original context is semantically supplemented in a targeted and differentiated manner (generating target semantic information) to achieve semantic enhancement and disambiguation. By fusing the generated supplementary information with the original context, a richer and more discriminative target context is formed for each candidate entity. Even if multiple candidate entities share the same ambiguous original description, their corresponding enhanced contexts can still show differences, thereby greatly improving the disambiguation capability of the subsequent fine-ranking model. After obtaining the target context rich in discriminative information, a specialized matching model is used for deep semantic interaction and fine-grained scoring. This model can comprehensively consider multi-dimensional information such as semantic alignment, business logic matching, and attribute consistency. Based on the matching score, sorting and selection are performed, and the final, unique link result is output, realizing a complete and automated linking process from the original text to the standard entity.

[0008] Furthermore, the process of fusing the original context and the target semantic information to obtain the target context corresponding to each candidate entity specifically involves: A context-based concatenation strategy is employed, appending or inserting the target semantic information as supplementary semantic information to the original context to obtain the target context. The step of inputting the original context and the candidate entities into a preset language model for processing according to a preset prompt template to obtain the target semantic information specifically involves: According to the prompt template, the original context, the candidate entity, and the attribute information are combined into a conditional input instruction, wherein the attribute information is the information of the candidate entity in the preset second database; The input instruction is input into the language model, and the original context is semantically supplemented by using the candidate entity and the corresponding attribute information as semantic constraints to obtain the target semantic information.

[0009] This clarifies the role of the prompt template: to structure and task-orientedize scattered information, forming explicit instructions for the LLM. By making attribute information a mandatory condition, it ensures that the generated content is closely related to the candidate entities, avoids the free divergence of the LLM, and enhances the controllability and relevance of the generated content. The LLM can supplement the incomplete original description within the framework of given entity attributes. Since different candidate entities have different attributes, the supplementary content generated under the same original context will also be different, increasing the distinguishing features of the target context.

[0010] Further, the step of performing vector retrieval in a preset second database based on the first semantic vector to obtain multiple candidate entities specifically involves: For each preset entity in the preset second database, each preset entity is encoded to obtain a corresponding second semantic vector; The similarity between the first semantic vector and each of the second semantic vectors is calculated, and the preset entities are sorted based on the similarity scores. A preset number of entities are selected as candidate entities.

[0011] This clarifies that the specific operation of fusion is splicing, and the primary and secondary relationships are distinct (the original context is the main body, and the generated information is supplementary), avoiding information confusion or semantic distortion during the fusion process.

[0012] Further, the step of performing vector retrieval in a preset second database based on the first semantic vector to obtain multiple candidate entities specifically involves: For each preset entity in the preset second database, each preset entity is encoded to obtain a corresponding second semantic vector; The similarity between the first semantic vector and each of the second semantic vectors is calculated, and the preset entities are sorted based on the similarity scores. A preset number of entities are selected as candidate entities.

[0013] This approach breaks down vector retrieval into four distinct steps: encoding, calculation, sorting, and selection. The selection of a preset number ensures that while maintaining recall, the number of candidates entering the subsequent high-cost fine-tuning stage is strictly controlled, thus balancing efficiency and effectiveness.

[0014] Further, the calculation of the similarity between the first semantic vector and each of the second semantic vectors is specifically as follows: The cosine similarity between the first semantic vector and each of the second semantic vectors is calculated using approximate nearest neighbor retrieval or inverted indexing.

[0015] This specifies the specific technical path (ANN / inverted index) and similarity metric (cosine similarity) for achieving fast retrieval, thus enabling efficient retrieval.

[0016] Furthermore, before encoding the entity mention into a first semantic vector for each entity mention, the method further includes: Text cleaning is performed on all the entity mentions to obtain the corresponding entity strings; Encoding the entity mention into a first semantic vector specifically involves encoding the entity string into the first semantic vector within the semantic space corresponding to the second semantic vector.

[0017] Such cleaning operations (such as removing symbols, unifying capitalization, and expanding abbreviations) can significantly reduce noise caused by inconsistencies in surface form, making vector encoding more accurate and improving data quality and consistency; it emphasizes encoding in the semantic space corresponding to the second semantic vector to ensure semantic space alignment and guarantee the comparability of the first and second semantic vectors.

[0018] Further, the step of inputting the target context and the attribute information of the candidate entities into a preset matching model to obtain the matching score corresponding to each candidate entity specifically involves: Determine the matching pair corresponding to the target context and the attribute information; The matching pair is input into the matching model, and the matching score is obtained by evaluating semantic alignment, business scenario matching, and entity differentiation.

[0019] This approach not only assesses surface semantic similarity (alignment), but also evaluates deep business logic consistency (scenario matching), as well as the characteristics highlighted by the enhanced context of this solution (entity differentiation), thus protecting the multi-dimensional comprehensive evaluation mechanism of the fine-ranking model and achieving high-precision links.

[0020] Another embodiment of the present invention provides an entity linking system, including: an entity recognition module, an initial matching module, a semantic enhancement module, and an entity linking module; The entity recognition module is used to obtain the text to be processed for each first database to be linked, perform entity recognition on the text to be processed to obtain at least one entity mention, and determine the original context corresponding to each entity mention. The initial matching module is used to encode each entity mention into a first semantic vector, and perform vector retrieval in a preset second database based on the first semantic vector to obtain multiple candidate entities; The semantic enhancement module is used to input the original context and the candidate entity into a preset language model for each entity mention corresponding to each candidate entity, to process according to a preset prompt template, to obtain target semantic information, and to fuse the original context and the target semantic information to obtain the target context corresponding to each candidate entity. The entity linking module is used to input the target context and the attribute information of the candidate entity into a preset matching model for each entity mention, obtain a matching score for each candidate entity, and select the candidate entity with the highest matching score as the entity mention. Another embodiment of the present invention provides a terminal device, including: a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, it implements the steps of the entity linking method of the present invention.

[0021] Another embodiment of the present invention provides a computer-readable storage medium item, including: a stored computer program, which, when the computer program is running, controls the device where the computer-readable storage medium is located to perform steps as described in the entity linking method of the present invention. Attached Figure Description

[0022] To more clearly illustrate the technical solution of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0023] Figure 1 This is one of the flowcharts illustrating an entity linking method provided in an embodiment of the present invention; Figure 2 This is a second flowchart illustrating an entity linking method provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of an entity linking system provided in an embodiment of the present invention. Detailed Implementation

[0024] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0025] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the application; the terms “comprising” and “having”, and any variations thereof, in the specification, claims, and foregoing description of the drawings are intended to cover non-exclusive inclusion.

[0026] In the description of the embodiments of this application, technical terms such as "first" and "second" are used only to distinguish different objects and should not be construed as indicating or implying relative importance or implicitly specifying the number, specific order, or primary and secondary relationship of the indicated technical features. In the description of the embodiments of this application, "multiple" means two or more, unless otherwise explicitly defined.

[0027] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0028] In the description of the embodiments in this application, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following related objects have an "or" relationship.

[0029] In the description of the embodiments of this application, the term "multiple" refers to two or more (including two), similarly, "multiple sets" refers to two or more (including two sets), and "multiple pieces" refers to two or more (including two pieces).

[0030] In the description of the embodiments of this application, unless otherwise expressly specified and limited, technical terms such as "installation," "connection," "joining," and "fixing" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components. For those skilled in the art, the specific meaning of the above terms in the embodiments of this application can be understood according to the specific circumstances.

[0031] See Figure 1 To address the problem in existing technologies where insufficient semantic representation due to sparse and non-standardized original business text information leads to significantly reduced link accuracy in multi-source heterogeneous business database environments, and to achieve high-precision linking of entities between a second database and a first database, an embodiment of the present invention provides an entity linking method, comprising: Step 101: For each first database to be linked, obtain the text to be processed, perform entity recognition on the text to be processed to obtain at least one entity mention, and determine the original context corresponding to each entity mention.

[0032] Entity references refer to words or phrases that actually appear in the text being processed and point to a specific entity. An entity is an independently existing object in the objective world, and an entity reference is the specific text in the text used to refer to that entity. The same entity may be referred to in multiple different ways in the text. For example, suppose we have a text: "Apple released a new phone. I ate an apple." In this text: the first "apple" is an entity reference, referring to the entity "Apple Inc." (a technology company); the second "apple" is also an entity reference, but it refers to the entity "apple (fruit)" (a type of fruit in the Rosaceae family).

[0033] It should be noted that when this application is applied in an entity-linked environment of multiple business databases and a second database, each business database is treated as a first database to execute the steps of this invention. In the above steps, within the multi-source heterogeneous business database environment of the power system, unstructured or semi-structured business text (e.g., customer names, product abbreviations, transaction descriptions, and behavior log texts) containing entity information is extracted from at least one of the customer database, product database, transaction database, or behavior database (i.e., the first database) as the text to be processed. This invention is used to link entity references in these records with standard entities in a pre-built business knowledge base (i.e., the second database) to achieve unified cross-database identification. Using natural language processing technology, noun phrases or specific fields representing real-world objects in the text to be processed are automatically identified as entity references, and the text segment containing the entity reference in the text to be processed is recorded as its original context. Specifically, the original business records can be uniformly converted into a preset standard format, and then named entity recognition can be used. The model performs word segmentation and entity recognition on the processed business records to obtain entity mentions. and type tags The original context refers to the textual context in which an entity appears in the original business records of the four business databases. For example, the customer description field in the customer database record, the transaction description in the transaction database record, or the behavior fragments in the behavior database log. These contexts are usually short and sparse, but they contain the contextual clues necessary for the large language model to perform semantic completion and disambiguation.

[0034] As an example of an embodiment of the present invention, before encoding the entity mention into a first semantic vector for each entity mention, the method further includes: performing text cleaning on all entity mentions to obtain corresponding entity strings; the encoding of the entity mention into a first semantic vector specifically involves: encoding the entity string into the first semantic vector in the semantic space corresponding to the second semantic vector.

[0035] Specifically, the original business records are structured according to unified field specifications (e.g., unified encoding, timestamp format, and name standardization). This is achieved through named entity recognition. The model identifies latent entity mentions in the text and assigns a type label (such as person, company, product, etc.) to each mention to narrow down the subsequent candidate entity recall. The identified entity mentions... Text cleaning is performed, including case unification, abbreviation expansion, symbol removal, and stop word filtering, to obtain standardized entity strings, represented as: ; Using a pre-trained vector encoder, the normalized entities are mentioned respectively. and business knowledge base entities Encode them into vector representations within the same semantic space. Generate one vector representation for each entity mention. A vector representation is also generated for each entity in the knowledge base. The dimensions of the vector can include semantic information such as word embedding features, industry category features, geographic encoding features, and product type features, used to measure the semantic similarity between entity mentions and knowledge base entities. .

[0036] Step 102: For each entity mention, encode the entity mention into a first semantic vector, and perform vector retrieval in a preset second database based on the first semantic vector to obtain multiple candidate entities.

[0037] In the above steps, a semantic encoding model is used to transform the entity mention into a low-dimensional dense vector representation, namely the first semantic vector. A pre-constructed second database (i.e., a standard knowledge base) stores a large number of standard entities and their corresponding semantic vector representations. By calculating the similarity between the first semantic vector and the semantic vectors of each entity in the second database, and filtering based on the similarity from high to low, a set of candidate entities semantically related to the entity mention is quickly obtained.

[0038] As an example of an embodiment of the present invention, the step of performing vector retrieval in a preset second database based on the first semantic vector to obtain multiple candidate entities specifically involves: encoding each preset entity in the preset second database to obtain a corresponding second semantic vector; calculating the similarity between the first semantic vector and each second semantic vector, and sorting each preset entity based on the similarity; and selecting a preset number of preset entities as candidate entities.

[0039] Specifically, an efficient vector index structure is constructed to support fast retrieval. For example, tree-based indexing, hash-based indexing, or graph-based approximate nearest neighbor indexing techniques are used to index the second semantic vector set. When a first semantic vector mentioning a certain entity is received, the similarity between the first semantic vector and a large number of second semantic vectors in the second database is quickly calculated or estimated by querying the index structure. The similarity calculation can use various vector space metrics such as inner product, cosine similarity, or Euclidean distance. Based on the calculated similarity values, all relevant preset entities are sorted in descending order. Finally, according to a preset truncation strategy, the top K preset entities are selected from the sorted list to form the candidate entity set, where the value of K can be configured according to the business scenario's requirements for balancing recall and precision.

[0040] As an example of an embodiment of the present invention, the calculation of the similarity between the first semantic vector and each of the second semantic vectors specifically involves: calculating the cosine similarity between the first semantic vector and each of the second semantic vectors through approximate nearest neighbor retrieval or inverted index.

[0041] In this embodiment, by approximate nearest neighbor Retrieve or inverted index, calculate the cosine similarity between entity mentions and entities in the knowledge base. , and select The entities with the highest similarity are selected as candidates. The formula for calculating cosine similarity is as follows: .

[0042] Step 103: For each candidate entity corresponding to each entity mention, input the original context and the candidate entity into a preset language model to process according to a preset prompt template to obtain target semantic information. Then, fuse the original context and the target semantic information to obtain the target context corresponding to each candidate entity.

[0043] In the above steps, for each candidate entity corresponding to the entity mention, a conditional input containing the original context and the candidate entity information is constructed using a preset prompt template tailored to a specific business domain. This conditional input guides a large-scale language model to generate text content—the target semantic information—that supplements, clarifies, or expands the information about the candidate entity in the original context. Subsequently, the target semantic information is integrated with the original context to form a more complete and semantically richer enhanced text description for each candidate entity—the target context.

[0044] Specifically, to enhance the expressive power of the original context, the original context and candidate entities are input into a Prompt template customized based on the business scenario. For each candidate entity, controlled semantic completion is performed on the same original context, combining the candidate entity's standard name and its basic attribute information in the business knowledge base. This results in multiple sets of enhanced semantic representations corresponding one-to-one with different candidate entities. In this way, even if multiple candidate entities share the same original context, their enhancement results can still reflect differences at the semantic level. The generated enhanced information is then concatenated and merged with the original context to form the enhanced entity input for the fine-tuning stage.

[0045] Step 104: For each entity mention, input the target context and the attribute information of the candidate entity into a preset matching model to obtain the matching score corresponding to each candidate entity. Take the candidate entity with the highest matching score as the entity link result of the entity mention, so as to realize the entity link between the first database and the second database.

[0046] In the above steps, for each entity mention, the target context corresponding to each candidate entity is paired with the normalized attribute information (such as type, description, and relationship) of the candidate entity in the second database, forming multiple matching pairs. A trained deep semantic matching model is used to perform joint semantic understanding and relevance calculation on each matching pair, outputting a quantified matching score. Finally, the matching scores obtained by all candidate entities are compared, and the candidate entity with the highest score is determined as the real standard entity pointed to by the entity mention in the second database, thus completing the entity link from non-normalized business data to the normalized knowledge base.

[0047] As an example of an embodiment of the present invention, the step of inputting the original context and the candidate entity into a preset language model for processing according to a preset prompt template to obtain target semantic information specifically involves: combining the original context, the candidate entity, and the attribute information into a conditional input instruction according to the prompt template, wherein the attribute information is the information of the candidate entity in a preset second database; inputting the input instruction into the language model, and using the candidate entity and the corresponding attribute information as semantic constraints to semantically supplement the original context to obtain the target semantic information.

[0048] In this embodiment, a large language model is used to generate structured and supplementary semantic extensions, thereby solving problems such as information sparsity, vague descriptions, or difficulty in distinguishing information in the original context. The original context... and Candidate entities are input into preset business domains Template, generation Input command; the template, in its design, comprehensively considers entity type, business scenario, and semantic differentiation requirements. By constraining entity categories (such as customers, products, enterprises, etc.) and data sources (customer database, transaction database, behavior database, etc.), it guides the large language model to focus on key information that characterizes entity differences. Simultaneously, the template limits the expression form of the generated content to ensure the structural stability and controllability of the output content. A domain-optimized large language model (such as the Big Watt model) is invoked to perform pairwise semantic enhancement processing on each pair of "original context—candidate entity," generating contextual enhancement information (i.e., target semantic information) for entity disambiguation, represented as: .

[0049] In this invention, the large language model introduces candidate entities as explicit semantic constraints to perform controlled semantic completion and targeted enhancement of the original context. For each candidate entity, its standard name and existing description information, along with the original business context, are input into the aforementioned customized template. During the generation process, the large language model imposes conditional constraints on the candidate entities, generating only supplementary information highly relevant to them, thus forming multiple enhanced results surrounding different candidate entities but sharing the same original context. The generated enhanced information includes at least one of the following: background information describing the business attributes or application scenarios of the candidate entity; supplementary explanations of business relationships or semantic clues implicit but not explicitly expressed in the original context; and descriptions of differentiated attributes that can distinguish similar entities.

[0050] As an example of an embodiment of the present invention, the step of fusing the original context and the target semantic information to obtain the target context corresponding to each candidate entity specifically involves: using a context splicing strategy to append or insert the target semantic information as supplementary semantic information of the original context to obtain the target context.

[0051] In this embodiment, a context splicing strategy is used to concatenate the original context. Enhanced information generated by LLM The components are merged to form the enhanced context in this invention. (i.e., the target context). During the fusion process, the original context serves as the semantic backbone, maintaining the semantic meaning of entity mentions within the original text. Enhanced information is added or inserted as supplementary semantic content. When the original context clearly contains a location where an entity is mentioned, the system appends enhanced information to the original context according to preset rules, while keeping that location unchanged. This information is used to supplement the entity's business background, usage scenarios, or distinguishing attributes. When the original text structure is relatively scattered or contains multiple related segments, the enhanced information is organized into independent supplementary paragraphs and combined with the original context in a fixed order to form a clearly structured and semantically complete enhanced input (i.e., the target context), represented as: .

[0052] For example, given the original context "The customer applied for low-voltage connection service with China Southern Power Grid," the enhanced information can be added to "The customer applied for low-voltage connection service with China Southern Power Grid. Additional explanation: China Southern Power Grid is a regional power operator, mainly responsible for power supply access and low-voltage electricity services within a specific region." This allows the enhanced context to provide semantic supplementation that helps disambiguate entities without introducing ambiguity.

[0053] As an example of an embodiment of the present invention, the step of inputting the target context and the attribute information of the candidate entities into a preset matching model to obtain the matching score corresponding to each candidate entity specifically involves: determining the matching pair corresponding to the target context and the attribute information; inputting the matching pair into the matching model, and obtaining the matching score by evaluating semantic alignment, business scenario matching degree, and entity distinguishability.

[0054] In this embodiment, the model input includes a set of candidate entities and a target context. Based on these inputs, deep semantic modeling is used to finely differentiate each candidate entity, thereby selecting the unique standard entity that best matches the meaning of the entity mentioned in the original business record. This embodiment, while ensuring recall coverage, generates highly discriminative matching scores through a fine-ranking model, compensating for the shortcomings of coarse-grained retrieval in the recall stage. The final output is entity link results that can be directly used for unified identification across four databases. By jointly semantically encoding the enhanced context and candidate entity descriptions, fine-grained differences between candidate entities can be effectively identified, making it applicable to complex business scenarios such as short text, noisy text, and long-tail entities.

[0055] Specifically, the context will be enhanced. With candidate entities The description is constructed as a matching input pair The enhanced context and the description text of each candidate entity (and its standard attribute fields in the knowledge base) are constructed as matching input pairs, for example, input into the fine-ranking model in the sequence form of "[CLS]Enhanced Context[SEP]Candidate Entity Description[SEP]". The fine-ranking model will comprehensively model from several dimensions and finally output a real-valued matching score. The alignment of entity type and attributes (used to determine whether the entity type, industry category, regional characteristics, etc., reflected in the enhanced context are consistent with the structured attribute fields of the candidate entity), the matching degree of business scenario and behavior pattern (used to match the transaction scenario and behavior pattern description in the enhanced context with the typical business patterns presented by the candidate entity in the knowledge base), and the distinguishability of disambiguation description and candidate entity (used to compare fine-grained differences between multiple / identical entities using the "disambiguation description section," enhancing the ability to distinguish between long-tail and fine-grained entities), are expressed as follows: ; It should be noted that during the training phase of the matching model, positive and negative sample pairs are constructed, and the model parameters are optimized using the cross-entropy loss function: ; in, For the sample size, for Select value, For the true candidate index mentioned by the i-th entity, The matching score for the i-th entity mentioning the k-th candidate.

[0056] During the inference phase, a matching score is calculated for each candidate entity, and the entity with the highest score is selected as the final prediction. .

[0057] like Figure 2 As shown, a second flowchart of an entity linking method is provided. In this embodiment, it includes: Step 201, Data Access and Preprocessing: Access raw records from the customer database, product database, transaction database, and behavior database, and convert them into a unified internal standard format; perform word segmentation and entity recognition. Extract entity mentions and type tags And perform data cleaning and standardization to obtain ; Step 202, Rapid Recall of Candidate Entities: Mentioning Entities With business knowledge base entities Encode into vectors respectively and In the inverted index and Calculate cosine similarity in the retrieval space Select Candidate entities are identified to ensure that the recall speed meets the real-time requirements of the business. Step 203, LLM Semantic Context Enhancement: Targeting Candidate entities, calls through business domains Optimized large language model, based on the original context Generate richer and more distinctive contexts This includes information such as brand background, regional characteristics, transaction type, and historical behavior, to enhance the entity's ability to disseminate dissent. Step 204, Data Fusion and Context Concatenation: Employing a model-specific context concatenation strategy, the original context is... Enhanced information generated by large models Fusion Ensure that the location and semantic structure of entity references are clear; and according to different Different customized splicing methods are used to develop the models; Step 205, Fine-tuning and Scoring: Using efficient... The fine-grained ranking model uses a cross-encoder to simultaneously encode entity mentions and candidate entities within a fused context, and then performs matching and scoring to obtain... ; Step 206, Matching Loss Calculation: Based on the obtained Cross-entropy loss is used to calculate the difference between the predicted assignment and the actual assignment; Step 207, Iterative Training Optimization: Before application, train an efficient system based on supervised training data. The fine-ranking model repeats steps two through five until the training iteration limit is reached or the model converges, at which point the optimal fine-ranking model parameters are obtained. Step 208, System Deployment and Application: This system can be seamlessly integrated into the business data processing platform to assist in the realization of practical tasks such as customer profile building and precise advertising.

[0058] like Figure 3 As shown, based on the above method embodiments, an embodiment of the present invention provides an entity linking system 300, including: an entity recognition module 301, an initial matching module 302, a semantic enhancement module 303, and an entity linking module 304; The entity recognition module 301 is used to obtain the text to be processed for each first database to be linked, perform entity recognition on the text to be processed to obtain at least one entity mention, and determine the original context corresponding to each entity mention. The initial matching module 302 is used to encode each entity mention into a first semantic vector, and perform vector retrieval in a preset second database based on the first semantic vector to obtain multiple candidate entities; The semantic enhancement module 303 is used to input the original context and the candidate entity into a preset language model for each entity mention corresponding to each candidate entity, to process according to a preset prompt template, to obtain target semantic information, and to fuse the original context and the target semantic information to obtain the target context corresponding to each candidate entity. The entity linking module 304 is used to input the target context and the attribute information of the candidate entity into a preset matching model for each entity mention, obtain the matching score corresponding to each candidate entity, and take the candidate entity with the highest matching score as the entity linking result of the entity mention, so as to realize the entity linking between the first database and the second database.

[0059] Furthermore, the process of fusing the original context and the target semantic information to obtain the target context corresponding to each candidate entity specifically involves: A context-based concatenation strategy is employed, appending or inserting the target semantic information as supplementary semantic information to the original context to obtain the target context. The step of inputting the original context and the candidate entities into a preset language model for processing according to a preset prompt template to obtain the target semantic information specifically involves: According to the prompt template, the original context, the candidate entity, and the attribute information are combined into a conditional input instruction, wherein the attribute information is the information of the candidate entity in the preset second database; The input instruction is input into the language model, and the original context is semantically supplemented by using the candidate entity and the corresponding attribute information as semantic constraints to obtain the target semantic information.

[0060] This clarifies the role of the prompt template: to structure and task-orientedize scattered information, forming explicit instructions for the LLM. By making attribute information a mandatory condition, it ensures that the generated content is closely related to the candidate entities, avoids the free divergence of the LLM, and enhances the controllability and relevance of the generated content. The LLM can supplement the incomplete original description within the framework of given entity attributes. Since different candidate entities have different attributes, the supplementary content generated under the same original context will also be different, increasing the distinguishing features of the target context.

[0061] Further, the step of performing vector retrieval in a preset second database based on the first semantic vector to obtain multiple candidate entities specifically involves: For each preset entity in the preset second database, each preset entity is encoded to obtain a corresponding second semantic vector; The similarity between the first semantic vector and each of the second semantic vectors is calculated, and the preset entities are sorted based on the similarity scores. A preset number of entities are selected as candidate entities.

[0062] This clarifies that the specific operation of fusion is splicing, and the primary and secondary relationships are distinct (the original context is the main body, and the generated information is supplementary), avoiding information confusion or semantic distortion during the fusion process.

[0063] Further, the step of performing vector retrieval in a preset second database based on the first semantic vector to obtain multiple candidate entities specifically involves: For each preset entity in the preset second database, each preset entity is encoded to obtain a corresponding second semantic vector; The similarity between the first semantic vector and each of the second semantic vectors is calculated, and the preset entities are sorted based on the similarity scores. A preset number of entities are selected as candidate entities.

[0064] This approach breaks down vector retrieval into four distinct steps: encoding, calculation, sorting, and selection. The selection of a preset number ensures that while maintaining recall, the number of candidates entering the subsequent high-cost fine-tuning stage is strictly controlled, thus balancing efficiency and effectiveness.

[0065] Further, the calculation of the similarity between the first semantic vector and each of the second semantic vectors is specifically as follows: The cosine similarity between the first semantic vector and each of the second semantic vectors is calculated using approximate nearest neighbor retrieval or inverted indexing.

[0066] This specifies the specific technical path (ANN / inverted index) and similarity metric (cosine similarity) for achieving fast retrieval, thus enabling efficient retrieval.

[0067] Furthermore, before encoding the entity mention into a first semantic vector for each entity mention, the method further includes: Text cleaning is performed on all the entity mentions to obtain the corresponding entity strings; Encoding the entity mention into a first semantic vector specifically involves encoding the entity string into the first semantic vector within the semantic space corresponding to the second semantic vector.

[0068] Such cleaning operations (such as removing symbols, unifying capitalization, and expanding abbreviations) can significantly reduce noise caused by inconsistencies in surface form, making vector encoding more accurate and improving data quality and consistency; it emphasizes encoding in the semantic space corresponding to the second semantic vector to ensure semantic space alignment and guarantee the comparability of the first and second semantic vectors.

[0069] Further, the step of inputting the target context and the attribute information of the candidate entities into a preset matching model to obtain the matching score corresponding to each candidate entity specifically involves: Determine the matching pair corresponding to the target context and the attribute information; The matching pair is input into the matching model, and the matching score is obtained by evaluating semantic alignment, business scenario matching, and entity differentiation.

[0070] This approach not only assesses surface semantic similarity (alignment), but also evaluates deep business logic consistency (scenario matching), as well as the characteristics highlighted by the enhanced context of this solution (entity differentiation), thus protecting the multi-dimensional comprehensive evaluation mechanism of the fine-ranking model and achieving high-precision links.

[0071] This invention transforms unstructured or semi-structured text into structured entity references and their original context through Entity Recognition (NER), providing clear operational objects and semantic background for subsequent link processing. It converts text semantics into computable vectors and utilizes efficient approximate retrieval techniques (such as ANN) to quickly recall a set of potentially related candidate entities from a massive knowledge base (second database), reducing matching computation costs and meeting real-time business requirements. Semantic similarity-based retrieval can capture entities that appear inconsistent on the surface but are semantically related, such as name variations and synonyms, improving the recall rate of the candidate set and laying the foundation for subsequent fine-grained ranking. Finally, it leverages the deep semantic understanding and generation capabilities of Large Language Models (LLM). Under the constraints of specific candidate entities and their attributes, the original context is semantically supplemented in a targeted and differentiated manner (generating target semantic information) to achieve semantic enhancement and disambiguation. By fusing the generated supplementary information with the original context, a richer and more discriminative target context is formed for each candidate entity. Even if multiple candidate entities share the same ambiguous original description, their corresponding enhanced contexts can still show differences, thereby greatly improving the disambiguation capability of the subsequent fine-ranking model. After obtaining the target context rich in discriminative information, a specialized matching model is used for deep semantic interaction and fine-grained scoring. This model can comprehensively consider multi-dimensional information such as semantic alignment, business logic matching, and attribute consistency. Based on the matching score, sorting and selection are performed, and the final, unique link result is output, realizing a complete and automated linking process from the original text to the standard entity.

[0072] It is understood that the above system item embodiments correspond to the method item embodiments of the present invention, and can implement the entity linking method provided by any of the above method item embodiments of the present invention.

[0073] It should be noted that the system embodiments described above are merely illustrative, and some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, in the accompanying drawings of the system embodiments provided by this invention, the connection relationships between modules indicate that they have communication connections, which can be specifically implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement this without any creative effort.

[0074] For ease of description and brevity, the system embodiments of the present invention include all the implementation methods described in the above entity linking method embodiments, and will not be repeated here.

[0075] Based on the above embodiments of the entity linking method, another embodiment of the present invention provides a terminal device, which includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor. When the processor executes the computer program, it implements the entity linking method of any embodiment of the present invention.

[0076] Furthermore, the process of fusing the original context and the target semantic information to obtain the target context corresponding to each candidate entity specifically involves: A context-based concatenation strategy is employed, appending or inserting the target semantic information as supplementary semantic information to the original context to obtain the target context. The step of inputting the original context and the candidate entities into a preset language model for processing according to a preset prompt template to obtain the target semantic information specifically involves: According to the prompt template, the original context, the candidate entity, and the attribute information are combined into a conditional input instruction, wherein the attribute information is the information of the candidate entity in the preset second database; The input instruction is input into the language model, and the original context is semantically supplemented by using the candidate entity and the corresponding attribute information as semantic constraints to obtain the target semantic information.

[0077] This clarifies the role of the prompt template: to structure and task-orientedize scattered information, forming explicit instructions for the LLM. By making attribute information a mandatory condition, it ensures that the generated content is closely related to the candidate entities, avoids the free divergence of the LLM, and enhances the controllability and relevance of the generated content. The LLM can supplement the incomplete original description within the framework of given entity attributes. Since different candidate entities have different attributes, the supplementary content generated under the same original context will also be different, increasing the distinguishing features of the target context.

[0078] Further, the step of performing vector retrieval in a preset second database based on the first semantic vector to obtain multiple candidate entities specifically involves: For each preset entity in the preset second database, each preset entity is encoded to obtain a corresponding second semantic vector; The similarity between the first semantic vector and each of the second semantic vectors is calculated, and the preset entities are sorted based on the similarity scores. A preset number of entities are selected as candidate entities.

[0079] This clarifies that the specific operation of fusion is splicing, and the primary and secondary relationships are distinct (the original context is the main body, and the generated information is supplementary), avoiding information confusion or semantic distortion during the fusion process.

[0080] Further, the step of performing vector retrieval in a preset second database based on the first semantic vector to obtain multiple candidate entities specifically involves: For each preset entity in the preset second database, each preset entity is encoded to obtain a corresponding second semantic vector; The similarity between the first semantic vector and each of the second semantic vectors is calculated, and the preset entities are sorted based on the similarity scores. A preset number of entities are selected as candidate entities.

[0081] This approach breaks down vector retrieval into four distinct steps: encoding, calculation, sorting, and selection. The selection of a preset number ensures that while maintaining recall, the number of candidates entering the subsequent high-cost fine-tuning stage is strictly controlled, thus balancing efficiency and effectiveness.

[0082] Further, the calculation of the similarity between the first semantic vector and each of the second semantic vectors is specifically as follows: The cosine similarity between the first semantic vector and each of the second semantic vectors is calculated using approximate nearest neighbor retrieval or inverted indexing.

[0083] This specifies the specific technical path (ANN / inverted index) and similarity metric (cosine similarity) for achieving fast retrieval, thus enabling efficient retrieval.

[0084] Furthermore, before encoding the entity mention into a first semantic vector for each entity mention, the method further includes: Text cleaning is performed on all the entity mentions to obtain the corresponding entity strings; Encoding the entity mention into a first semantic vector specifically involves encoding the entity string into the first semantic vector within the semantic space corresponding to the second semantic vector.

[0085] Such cleaning operations (such as removing symbols, unifying capitalization, and expanding abbreviations) can significantly reduce noise caused by inconsistencies in surface form, making vector encoding more accurate and improving data quality and consistency; it emphasizes encoding in the semantic space corresponding to the second semantic vector to ensure semantic space alignment and guarantee the comparability of the first and second semantic vectors.

[0086] Further, the step of inputting the target context and the attribute information of the candidate entities into a preset matching model to obtain the matching score corresponding to each candidate entity specifically involves: Determine the matching pair corresponding to the target context and the attribute information; The matching pair is input into the matching model, and the matching score is obtained by evaluating semantic alignment, business scenario matching, and entity differentiation.

[0087] This approach not only assesses surface semantic similarity (alignment), but also evaluates deep business logic consistency (scenario matching), as well as the characteristics highlighted by the enhanced context of this solution (entity differentiation), thus protecting the multi-dimensional comprehensive evaluation mechanism of the fine-ranking model and achieving high-precision links.

[0088] This invention transforms unstructured or semi-structured text into structured entity references and their original context through Entity Recognition (NER), providing clear operational objects and semantic background for subsequent link processing. It converts text semantics into computable vectors and utilizes efficient approximate retrieval techniques (such as ANN) to quickly recall a set of potentially related candidate entities from a massive knowledge base (second database), reducing matching computation costs and meeting real-time business requirements. Semantic similarity-based retrieval can capture entities that appear inconsistent on the surface but are semantically related, such as name variations and synonyms, improving the recall rate of the candidate set and laying the foundation for subsequent fine-grained ranking. Finally, it leverages the deep semantic understanding and generation capabilities of Large Language Models (LLM). Under the constraints of specific candidate entities and their attributes, the original context is semantically supplemented in a targeted and differentiated manner (generating target semantic information) to achieve semantic enhancement and disambiguation. By fusing the generated supplementary information with the original context, a richer and more discriminative target context is formed for each candidate entity. Even if multiple candidate entities share the same ambiguous original description, their corresponding enhanced contexts can still show differences, thereby greatly improving the disambiguation capability of the subsequent fine-ranking model. After obtaining the target context rich in discriminative information, a specialized matching model is used for deep semantic interaction and fine-grained scoring. This model can comprehensively consider multi-dimensional information such as semantic alignment, business logic matching, and attribute consistency. Based on the matching score, sorting and selection are performed, and the final, unique link result is output, realizing a complete and automated linking process from the original text to the standard entity.

[0089] For example, in this embodiment, the computer program can be divided into one or more modules, which are stored in the memory and executed by the processor to complete the present invention. The one or more modules may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the terminal device.

[0090] The terminal device may be a desktop computer, laptop, handheld computer, or cloud server, etc. The terminal device may include, but is not limited to, a processor and a memory.

[0091] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the terminal device, connecting all parts of the terminal device via various interfaces and lines.

[0092] Based on the above-described method embodiments, another embodiment of the present invention provides a computer-readable storage medium including a stored computer program, wherein, when the computer program is executed, it controls the device where the computer-readable storage medium is located to execute the entity linking method described in any of the above-described method embodiments of the present invention.

[0093] Based on the above-described method embodiments, this invention also provides a computer program / program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of any of the above-described method embodiments, and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0094] The modules / units integrated in the device / terminal equipment, if implemented as software functional units and sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the above embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc.

[0095] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications are also considered to be within the scope of protection of the present invention.

Claims

1. A method for linking entities, characterized in that, include: For each first database to be linked, obtain the text to be processed, perform entity recognition on the text to be processed to obtain at least one entity mention, and determine the original context corresponding to each entity mention; For each entity mention, the entity mention is encoded into a first semantic vector, and vector retrieval is performed in a preset second database based on the first semantic vector to obtain multiple candidate entities; For each candidate entity mentioned by each entity, the original context and the candidate entity are input into a preset language model to be processed according to a preset prompt template to obtain target semantic information. The original context and the target semantic information are then fused to obtain the target context corresponding to each candidate entity. For each entity mention, the target context and the attribute information of the candidate entity are input into a preset matching model to obtain the matching score corresponding to each candidate entity. The candidate entity with the highest matching score is used as the entity linking result of the entity mention, so as to realize the entity linking between the first database and the second database.

2. The entity linking method as described in claim 1, characterized in that, The step of inputting the original context and the candidate entities into a preset language model for processing according to a preset prompt template to obtain target semantic information specifically involves: According to the prompt template, the original context, the candidate entity, and the attribute information are combined into a conditional input instruction, wherein the attribute information is the information of the candidate entity in the preset second database; The input instruction is input into the language model, and the original context is semantically supplemented by using the candidate entity and the corresponding attribute information as semantic constraints to obtain the target semantic information.

3. The entity linking method as described in claim 1, characterized in that, The process of fusing the original context and the target semantic information to obtain the target context corresponding to each candidate entity specifically involves: A context splicing strategy is adopted to append or insert the target semantic information as supplementary semantic information to the original context to obtain the target context.

4. The entity linking method as described in claim 1, characterized in that, The step of performing vector retrieval in a preset second database based on the first semantic vector to obtain multiple candidate entities specifically involves: For each preset entity in the preset second database, each preset entity is encoded to obtain a corresponding second semantic vector; The similarity between the first semantic vector and each of the second semantic vectors is calculated, and the preset entities are sorted based on the similarity scores. A preset number of entities are selected as candidate entities.

5. The entity linking method as described in claim 4, characterized in that, The calculation of the similarity between the first semantic vector and each of the second semantic vectors is specifically as follows: The cosine similarity between the first semantic vector and each of the second semantic vectors is calculated using approximate nearest neighbor retrieval or inverted indexing.

6. The entity linking method as described in claim 4, characterized in that, Before encoding the entity mention into a first semantic vector for each entity mention, the method further includes: Text cleaning is performed on all the entity mentions to obtain the corresponding entity strings; Encoding the entity mention into a first semantic vector specifically involves encoding the entity string into the first semantic vector within the semantic space corresponding to the second semantic vector.

7. The entity linking method as described in claim 1, characterized in that, The step of inputting the target context and the attribute information of the candidate entities into a preset matching model to obtain the matching score corresponding to each candidate entity is as follows: Determine the matching pair corresponding to the target context and the attribute information; The matching pair is input into the matching model, and the matching score is obtained by evaluating semantic alignment, business scenario matching, and entity differentiation.

8. A physical linking system, characterized in that, include: Entity recognition module, initial matching module, semantic enhancement module, and entity linking module; The entity recognition module is used to obtain the text to be processed for each first database to be linked, perform entity recognition on the text to be processed to obtain at least one entity mention, and determine the original context corresponding to each entity mention. The initial matching module is used to encode each entity mention into a first semantic vector, and perform vector retrieval in a preset second database based on the first semantic vector to obtain multiple candidate entities; The semantic enhancement module is used to input the original context and the candidate entity into a preset language model for each entity mention corresponding to each candidate entity, to process according to a preset prompt template, to obtain target semantic information, and to fuse the original context and the target semantic information to obtain the target context corresponding to each candidate entity. The entity linking module is used to input the target context and the attribute information of the candidate entity into a preset matching model for each entity mention, obtain the matching score corresponding to each candidate entity, and take the candidate entity with the highest matching score as the entity linking result of the entity mention, so as to realize the entity linking between the first database and the second database.

9. A terminal device, characterized in that, It includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, it implements the entity linking method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, include: A stored computer program, wherein, when the computer program is executed, it controls the device containing the computer-readable storage medium to perform the entity linking method as described in any one of claims 1-7.