A Hint-based Learning-Based Entity and / or Relation Linking Approach

By introducing entity and relationship linking methods based on prompt learning in the knowledge graph question and answer system, the ambiguity problem of entities and relationships in SPARQL queries is solved, and higher accuracy and generalization capabilities are achieved.

CN115129893BActive Publication Date: 2025-04-15CHINA UNIV OF PETROLEUM (EAST CHINA)
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210787603.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-06
Publication Date
2025-04-15
Estimated Expiration
2042-07-06

AI Technical Summary

Technical Problem

In the knowledge graph question and answer system, the existing technology is difficult to effectively solve the ambiguity of entities and relationships in SPARQL queries, resulting in poor generalization and fluctuations in the query.

Method used

An entity and/or relational linking method based on prompt learning is designed to pre-process SPARQL, entity recall, relational linking and final SPARQL revision by introducing a BM25 character-level short text matching algorithm and a prompt learning-based disambiguation model.

Benefits of technology

This method obtains good task effects with few samples, simplifying the disambiguation task into a binary classification task, so that the entity disambiguation model can be used for both entity links and relationship links, effectively improving the accuracy of the question-and-answer system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115129893B_ABST
    Figure CN115129893B_ABST
Patent Text Reader

Abstract

The present invention provides an entity and / or relationship linking method based on prompt learning, which introduces prompt learning on the basis of an entity disambiguation method, and includes the following steps: preprocessing the SPARQL generated by a question-answering system, performing clause division, judging the SPARQL clause type, and selectively performing subsequent steps; realizing entity recall through a BM25 character-level short text matching algorithm, designing an entity and / or relationship linking method based on prompt learning, linking the entity mentioned in the SPARQL with the recalled entity; according to obtaining the correct entity, querying the entity-related relationship in the knowledge base as the recall relationship, using the entity and / or relationship linking method in the above process, linking the relationship mentioned in the SPARQL with the recall relationship; revising the SPARQL according to the linking result. The present invention introduces prompt learning on the basis of a traditional entity disambiguation method, so that the entity disambiguation model can be used for entity and relationship links at the same time, revising the generated SPARQL query, and improving the accuracy of the question-answering system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of natural language processing, and in particular relates to an entity and / or relationship linking method based on prompt learning. Background Art

[0002] In the knowledge graph question answering system, for one entity or relationship in the question, there may be multiple corresponding entities or relationships in the knowledge base. Due to the ambiguity of entities, the ambiguity of SPARQL queries generated by the question answering system is becoming more and more obvious. Currently, there is a lack of an effective method to revise the SPARQL output by the question answering model.

[0003] Among them, the entity linking method based on word vector relevance: The entity linking method based on word vector relevance uses the continuous bag of words (CBOW) model to train the word vectors of the words in the corpus, and then uses the words close to the query word as the expansion word. The word vector mines the semantic relevance between words from the corpus, which is a supplement to the rule-based query expansion method to recall candidate entities. When calculating document similarity, the related words based on the word vector are used as the vector dimension, thereby obtaining the semantic similarity characteristics of the document. Finally, the query word is linked to the corresponding candidate entity using a ranking learning model based on a single document method. However, this method has poor generalization, and different styles of training data may cause large fluctuations in accuracy. In addition, the offline trained word vector is used to represent the entity, and the model cannot be used for relationship disambiguation.

[0004] Among them, the rule-based entity linking method: for each entity that needs entity linking, generate a candidate entity set corresponding to each entity in a given knowledge base; calculate the relevance of each entity with each candidate entity in the candidate entity set corresponding to the entity according to the precise attributes, fuzzy attributes and related entities of each candidate entity in the candidate entity set; obtain the link entity of the current entity according to the relevance between the current entity and its candidate entities and the number of candidate entities corresponding to the entity. However, this method relies on the design of rules for specific data, so it also has the problem of poor generalization. Summary of the invention

[0005] In view of the above problems, the present invention revises SPARQL by designing a universal disambiguation model and combining rules. The first aspect of the present invention provides an entity and / or relationship linking method based on prompt learning, which introduces prompt learning on the basis of the existing entity disambiguation method and includes the following steps:

[0006] S1, preprocess the SPARQL generated by the question-answering system, divide the clauses, and determine the SPARQL clause type; if <subject> ?x <object>Type, then you need to perform steps S2 and S4. If <subject>predicate? x, then steps S2, S3 and S4 need to be performed;

[0007] S2, implement entity recall through BM25 character-level short text matching algorithm, design entity and / or relationship linking method based on prompt learning, and link SPARQL mentioned entities with recalled entities;

[0008] S3, based on the correct entity obtained in S2, query the entity-related relationship in the knowledge base as the recall relationship, and use the entity and / or relationship linking method in S2 to link the relationship mentioned in SPARQL with the recall relationship;

[0009] S4, revise SPARQL based on the entity and / or relationship linking results.

[0010] In a possible design, in step S1, the long SPARQL is divided into short SPARQL clauses by using a regular expression, and the clause type is determined, specifically:

[0011] S11, performing regular expression segmentation on the generated SPARQL according to the character ".," to obtain multiple sub-SPARQL statements;

[0012] S12, use the regular expression to determine the position of "?x" in the clause. If "?x" is at the end of the clause, it is judged as <subject>predicate? x type, otherwise <subject> ?x <object>type.

[0013] In a possible design, in step S2, the entity disambiguation task is regarded as a binary classification task, and an entity and / or relationship linking method based on prompt learning is designed, specifically:

[0014] S21, extract entity e1 in the sub-SPARQL, calculate the similarity between entity e1 and each node in the knowledge base through the BM25 character-level short text matching algorithm, and sort according to the similarity, and select the n entities with the highest similarity as the candidate entity set, denoted as F = {f1,f2,…,f n }, to achieve entity recall;

[0015] S22, using the entity disambiguation model based on prompt learning, select the most suitable knowledge base entity to achieve entity disambiguation; the candidate entity f obtained in step S21 i , concatenate the input question Q and the entity e1 obtained in step S21, use [SEP] as a separator, and embed the prompt parameters [P1]-[P n ] and [MASK] tags as model input, denoted as T, the formula is as follows:

[0016] T=[Q][SEP][f i ][SEP][e1][SEP][P1]…[P n ][MASK]

[0017] The entity disambiguation task is regarded as a binary classification task, that is, e1 and f i For the same entity or different entities, the Answer label learned can be expressed as "yes" and "no". Each category contains different answer subspaces. For example, the category "yes" contains multiple related word representations, and the category "no" contains multiple unrelated word representations. Take T as input, and RoBERTa as the base model of entity disambiguation for task modeling. It is responsible for extracting semantic information, generating characters corresponding to the [MASK] position through the MLM task, and finally mapping the generated characters to the answer to obtain the binary classification result.

[0018] S23, according to the binary classification result obtained in step S22, the probability value is calculated using the Softmax function; all entities with the label "yes" are sorted according to probability, and the entity link result with the largest probability is selected as the entity link result, and the entity link result with the largest probability is replaced. <subject>Error entity.

[0019] In a possible design, in step S3, all relations of the correct entity in S23 are obtained as the recall relation candidate set G = {g1, g2, ..., g n }, use the entity disambiguation model of step S22 to perform relationship disambiguation, obtain the correct relationship attributes, and replace the predicate wrong relationship.

[0020] The second aspect of the present invention also provides a SPARQL revision device for use in a knowledge graph question-answering system, the device comprising at least one processor and at least one memory, the processor and the memory being coupled; a computer program is stored in the memory; when the processor executes the computer program stored in the memory, the device executes the method described in the first aspect.

[0021] The third aspect of the present invention further provides a computer-readable storage medium, in which a program or instruction is stored. When the program or instruction is executed by a processor, the computer executes the method described in the first aspect.

[0022] Beneficial effects: The present invention provides an entity and / or relationship linking method based on prompt learning. On the basis of the traditional entity disambiguation method, prompt learning is introduced, so that the model can obtain good task effects with few samples, and the disambiguation task is simplified to a binary classification task, so that the entity disambiguation model can be used for entity linking and relationship linking at the same time, and the generated SPARQL query is revised, which effectively solves the SPARQL query ambiguity problem. The accuracy of the question-answering system is effectively improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Figure 1 Flow chart of the entity and / or relationship linking method based on prompt learning of the present invention.

[0024] Figure 2 It is a schematic diagram of an embodiment of the entity and / or relationship linking method based on prompt learning of the present invention.

[0025] Figure 3 Schematic diagram of the entity disambiguation model architecture based on prompt learning of the present invention.

[0026] Figure 4 The present invention is a simplified structural block diagram of a SPARQL revision device applied in a knowledge graph question-answering system. DETAILED DESCRIPTION

[0027] The knowledge graph question-answering system can generate corresponding SPARQL query statements based on the natural language questions input by users and query them in the knowledge base to get answers. For an entity or relationship in the question, there may be multiple corresponding entities or relationships in the knowledge base. Take the question "When are apples available?" as an example. The question involves the entity "apple", but there are multiple interpretations of apple in the knowledge base. Apple may refer to Apple Inc. or apple (Rosaceae Malus genus). Due to the ambiguity of entities, the ambiguity of SPARQL queries generated by the question-answering system is becoming more and more significant. Therefore, it is necessary to link the entities and knowledge base entities, and the relationships and knowledge base relationships involved in SPARQL one by one. Entity linking is divided into three steps: candidate entity recall, entity disambiguation, and entity ranking. Based on the short text matching algorithm BM25, an entity recall model is designed to obtain candidate entities with high matching degrees in the knowledge base. Based on Prompt Learning, an entity disambiguation model is designed to obtain the relevance score of candidate entities. By sorting entities, we select the entity with the highest confidence for knowledge base entity linking, and query all the relationship attributes of the entity. We use the entity disambiguation model again to select the relationship with the highest confidence for knowledge base relationship linking. Based on the results of entity and relationship linking, we revise the SPARQL query, which effectively improves the accuracy of the question-answering system.

[0028] The invention will be further described below in conjunction with specific embodiments.

[0029] Embodiment 1:

[0030] This embodiment takes the question "Who is the CEO of Apple?" as an example, and combines Figures 1 to 3 , the specific process of the entity and / or relationship linking method based on prompt learning of the present invention is described:

[0031] S1, pre-process the "Select?x where{<Apple_(Apple Inc.)><CEO>?x.}" generated by the question-answering system, divide the clauses, and determine the SPARQL clause type. <subject> ?x <object>type, only S2 and S4 are required. <subject>predicate? x form, then S2, S3, and S4 are required;

[0032] S2, implements entity recall through the BM25 character-level short text matching algorithm, designs an entity and relationship linking method based on prompt learning, and links the SPARQL mentioned entities with the recalled entities;

[0033] S3, based on the correct entity obtained in S2, query the entity-related relationship in the knowledge base as the recall relationship, and use the entity and relationship linking method in S2 to link the relationship mentioned in SPARQL with the recall relationship;

[0034] S4, revise SPARQL based on the entity and relationship linking results.

[0035] like Figure 2 and Figure 3 As shown, the disambiguation model based on prompt learning in the present invention can be applied to entity linking and relationship linking at the same time, so as to revise SPARQL. SPARQL is an RDF query language; RDF is a resource description framework, which uses XML syntax to express the data model and is used to describe the characteristics of Web resources and the relationship between resources.

[0036] In step S1, the long SPARQL is split into short SPARQL clauses by regular expressions, and the clause types are determined, which mainly include:

[0037] S11, performing regular expression segmentation on the generated SPARQL according to the character ".", to obtain multiple sub-SPARQL statements. In this embodiment, the generated SPARQL has only one clause, so segmentation is not required;

[0038] S12, use the regular expression to determine the position of "?x" in the clause. "?x" is at the end of the clause and is determined as <subject>predicate? x type;

[0039] In step S2, the entity disambiguation task is regarded as a binary classification task, and an entity and relationship linking method based on prompt learning is designed, which mainly includes:

[0040] S21, extract the entity "Apple_(Apple Company)" in the sub-SPARQL and record it as e1, calculate the similarity between entity e1 and each node in the knowledge base through the BM25 character-level short text matching algorithm, and sort according to the similarity, and select the 5 entities with the highest similarity as the candidate entity set {"Apple tree_(Rosaceae plant)", "Apple_(Rosaceae Malus genus fruit)", "Apple_(Apple product company)", "Apple_(Stephy Tang song)", "Apple_(An and the Cavalry song)"}, recorded as F = {f1,f2,…,f n }, to achieve entity recall;

[0041] S22, using the entity disambiguation model based on prompt learning, selects the most suitable knowledge base entity to achieve entity disambiguation. i , the input question Q, the entity e1 obtained in S21 are concatenated, [SEP] is used as a separator, and the prompt parameters [P1]-[P n ] and [MASK] tags as model input, denoted as T, the formula is as follows:

[0042] T=[Q][SEP][f i ][SEP][e1][SEP][P1]…[P n ][MASK]

[0043] The entity disambiguation task is regarded as a binary classification task, that is, e1 and f i For the same entity or different entities, the Answer label learned can be expressed as "yes" and "no". Each category contains different answer subspaces. For example, the category "yes" contains multiple related word representations, such as "same" and "consistent", and the category "no" contains multiple irrelevant word representations, such as "irrelevant" and "different". Take T as input, RoBERTa (A Robustly Optimized BERT, a stable optimized BERT model) as the base model of entity disambiguation for task modeling, responsible for semantic information extraction, and generate the characters corresponding to the [MASK] position through the masked language model MLM (Masked Language Model) task. Finally, the generated characters are mapped to the answer to obtain the binary classification result;

[0044] S23, according to the binary classification result obtained in step S22, the probability value is calculated using the Softmax function. All entities with the label "yes" are sorted according to probability, and the entity with the highest probability is selected as the entity linking result. In this embodiment, the entity with the highest probability is "Apple_(Apple Product Company)", which is used as the correct entity to replace the wrong entity "Apple_(Apple Company)" in the original SPARQL;

[0045] In step S3, all relations of the correct entities in S23 are obtained as the recall relation candidate set {"Chief Executive Officer", "Chief Financial Officer", "Chief Information Officer", "Chief Technology Officer"}, which is recorded as G = {g1, g2, ..., g n }, use the entity disambiguation model of step S22 to perform relationship disambiguation, obtain the correct relationship attributes, and replace the predicate wrong relationship;

[0046] Based on the traditional entity disambiguation method, this paper introduces prompt learning, so that the entity disambiguation model can be used for both entity linking and relationship linking, and the generated SPARQL query is revised, which effectively solves the SPARQL query ambiguity problem. The algorithm aims to use the prompt learning method to maximize the potential of the pre-trained model, while improving the versatility of the model, simplifying the SPARQL revision process, and improving the accuracy of question answering.

[0047] Embodiment 2:

[0048] like Figure 4 As shown, the present invention also provides a SPARQL revision device applied in a knowledge graph question-answering system, the device includes at least one processor and at least one memory, and also includes a communication interface and an internal bus; a computer execution program is stored in the memory; when the processor executes the execution program stored in the memory, the device executes the method described in Example 1. The internal bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus. The memory may include a high-speed RAM memory, and may also include a non-volatile storage NVM, such as at least one disk memory, and may also be a U disk, a mobile hard disk, a read-only memory, a disk or an optical disk, etc.

[0049] The device may be provided as a terminal, a server or other forms of devices.

[0050] Figure 4 is a block diagram of a device shown as an example. The device may include one or more of the following components: a processing component, a memory, a power component, a multimedia component, an audio component, an input / output (I / O) interface, a sensor component, and a communication component. The processing component generally controls the overall operation of the electronic device, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component may include one or more processors to execute instructions to complete all or part of the steps of the above method. In addition, the processing component may include one or more modules to facilitate interaction between the processing component and other components. For example, the processing component may include a multimedia module to facilitate interaction between the multimedia component and the processing component.

[0051] The memory is configured to store various types of data to support operations on the electronic device. Examples of such data include instructions for any application or method operating on the electronic device, contact data, phone book data, messages, pictures, videos, etc. The memory can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0052] The power supply assembly provides power to various components of the electronic device. The power supply assembly may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device. The multimedia assembly includes a screen that provides an output interface between the electronic device and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia assembly includes a front camera and / or a rear camera. When the electronic device is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0053] The audio component is configured to output and / or input audio signals. For example, the audio component includes a microphone (MIC), and when the electronic device is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in a memory or sent via a communication component. In some embodiments, the audio component also includes a speaker for outputting an audio signal. The I / O interface provides an interface between the processing component and the peripheral interface module, and the above-mentioned peripheral interface module can be a keyboard, a click wheel, a button, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.

[0054] The sensor assembly includes one or more sensors for providing various aspects of status assessment for the electronic device. For example, the sensor assembly can detect the on / off state of the electronic device, the relative positioning of components, such as the display and keypad of the electronic device, and the sensor assembly can also detect the position change of the electronic device or a component of the electronic device, the presence or absence of user contact with the electronic device, the orientation or acceleration / deceleration of the electronic device and the temperature change of the electronic device. The sensor assembly may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor or a temperature sensor.

[0055] The communication component is configured to facilitate wired or wireless communication between the electronic device and other devices. The electronic device can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0056] In an exemplary embodiment, the electronic device may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the above methods.

[0057] Embodiment 3:

[0058] The present invention also provides a non-volatile computer-readable storage medium, in which a program or instruction is stored. When the program or instruction is executed by a processor, the computer executes the method described in Example 1.

[0059] Specifically, a system, device or equipment equipped with a readable storage medium may be provided, on which a software program code for implementing the functions of any of the above-mentioned embodiments is stored, and a computer or processor of the system, device or equipment reads and executes the instructions stored in the readable storage medium. In this case, the program code read from the readable medium itself can implement the functions of any of the above-mentioned embodiments, so the machine-readable code and the readable storage medium storing the machine-readable code constitute a part of the present invention.

[0060] The above storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk (such as CD-ROM, CD-R, CD-RW, DVD-20ROM, DVD-RAM, DVD-RW, DVD-RW), magnetic tape, etc. The storage medium can be any available medium that can be accessed by a general or special-purpose computer.

[0061] It should be understood that the processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented by a hardware processor or implemented by a combination of hardware and software modules in the processor.

[0062] It should be understood that the storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the storage medium can also exist as discrete components in a terminal or server.

[0063] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.

[0064] The computer program instructions for performing the disclosed operation may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions may be executed completely on a user's computer, partially on a user's computer, executed as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be personalized by utilizing the state information of a computer-readable program instruction, and the electronic circuit may execute a computer-readable program instruction, thereby realizing various aspects of the present disclosure.

[0065] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

[0066] Although the above describes the specific implementation methods of the present invention, it is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art on the basis of the technical solution of the present invention without creative work are still within the scope of protection of the present invention.< / subject> < / subject> < / object> < / subject> < / subject> < / object> < / subject> < / subject> < / subject> < / object> < / subject>

Claims

1. A method for linking entities and / or relations based on prompt learning, characterized in that: Hint learning is introduced based on the existing entity disambiguation method, and includes the following steps: S1, preprocess the SPARQL generated by the question-answering system, divide the clauses, and determine the SPARQL clause type; if <subject> ?x <object>If it is of the form < subject >predicate ?x, then steps S2, S3 and S4 need to be performed; Use regular expressions to split long SPARQL into short SPARQL clauses and determine the clause type, specifically: S11, performing regular expression segmentation on the generated SPARQL according to the character ".," to obtain multiple sub-SPARQL statements; S12, use regular expression to determine the position of "?x" in the clause. If "?x" is at the end of the clause, it is judged as < subject >predicate ?x type, otherwise <subject> ?x <object>type; S2, implement entity recall through BM25 character-level short text matching algorithm, design entity and / or relationship linking method based on prompt learning, and link SPARQL mentioned entities with recalled entities; The entity disambiguation task is regarded as a binary classification task, and an entity and / or relationship linking method based on prompt learning is designed. Specifically: S21, extract entities in sub-SPARQL , the entity The similarity is calculated with each node in the knowledge base through the BM25 character-level short text matching algorithm, and the n entities with the highest similarity are selected as the candidate entity set, which is recorded as , realize entity recall; S22, using the entity disambiguation model based on prompt learning, select the most suitable knowledge base entity to achieve entity disambiguation; the candidate entity obtained in step S21 , the input question Q and the entity obtained in step S21 Concatenate, use [SEP] as the separator, and embed the prompt parameter at the end as well as The mark is used as the model input, denoted as T, and the formula is as follows: The entity disambiguation task is regarded as a binary classification task, that is, and The answer labels are expressed as "yes" and "no" for the same entity or not. T is used as input, and RoBERTa is used as the base model of entity disambiguation for task modeling. It is responsible for extracting semantic information, generating characters corresponding to the [MASK] position through the MLM task, and finally mapping the generated characters to the answer to obtain the binary classification result. S23, according to the binary classification result obtained in step S22, the probability value is calculated using the Softmax function; all entities with the label "yes" are sorted according to probability, and the entity with the largest probability is selected as the entity linking result to replace the <subject> error entity; S3, based on the correct entity obtained in S2, query the entity-related relationship in the knowledge base as the recall relationship, and use the entity and / or relationship linking method in S2 to link the relationship mentioned in SPARQL with the recall relationship; S4, revise SPARQL based on the entity and / or relationship linking results.

2. The entity and / or relationship linking method based on prompt learning as claimed in claim 1, characterized in that: In step S3, all relations of the correct entity in S23 are obtained as a candidate set of recalled relations. , use the entity disambiguation model of step S22 to perform relationship disambiguation, obtain the correct relationship attributes, and replace the predicate wrong relationship.

3. A SPARQL revision device applied in a knowledge graph question answering system, characterized in that: The device includes at least one processor and at least one memory, the processor and the memory are coupled; a computer program is stored in the memory; when the processor executes the computer program stored in the memory, the device executes the method according to claim 1 or 2.

4. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program or instruction, and when the program or instruction is executed by a processor, the computer executes the method according to claim 1 or 2. < / object> < / subject> < / object> < / subject>

Citation Information

Patent Citations

  • An entity linking method based on graph model

    CN108959461A

  • System and method for automatically generating question and query pairs

    US20220107946A1