A data query method, device, storage medium and computer program product

By using pre-trained language models to extract and update entity information in the knowledge graph, the problem of inaccurate knowledge graph construction in traditional methods is solved, and the accuracy and efficiency of data query are improved.

CN118503454BActive Publication Date: 2024-09-20SHANDONG HAILIANG INFORMATION TECH RES INST
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410962599.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-18
Publication Date
2024-09-20
Estimated Expiration
2044-07-18

AI Technical Summary

Technical Problem

The traditional method of constructing knowledge graphs has the problem of inaccurate expression of knowledge structures, which results in the inability to obtain accurate query results for data query tasks based on knowledge graphs.

Method used

By obtaining the text data to be processed, the entity naming sample data set and the entity relationship recognition sample data set in the target field, the pre-trained language model is used to extract the mapping data of knowledge and contextual information, and the entity naming sample data set and entities are updated during the extraction process. Relation identification sample data sets, constructing knowledge graphs, and performing entity disambiguation and entity linking processing to optimize the quality of the knowledge graphs.

Benefits of technology

The accuracy and efficiency of the knowledge graph are improved, ensuring that more accurate results can be obtained when applying the knowledge graph for data query.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118503454B
    Figure CN118503454B
Patent Text Reader

Abstract

The present invention relates to the field of computer technology, and specifically discloses a data query method, device, storage medium and computer program product. In the process of constructing a knowledge graph of a target domain using a pre-trained language model, mapping data of knowledge and context information is extracted from text data to be processed based on an entity naming sample data set and an entity relationship recognition sample data set, and the mapping data is used to update the entity naming sample data set and the entity relationship recognition sample data set during the extraction process, so as to improve the efficiency and accuracy of the pre-trained language model in extracting entity names and relationships between entities; after constructing a knowledge graph of the target domain according to the entity names and the relationships between entities, entity disambiguation task prompt words and entity linking task prompt words are respectively constructed to update the knowledge graph, and the knowledge graph is continuously optimized, so that when the knowledge graph is used to perform data query tasks in the target domain, more accurate data query results can be obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a data query method, device, storage medium and computer program product. Background Art

[0002] As a technology that organizes data into a graphical structure, knowledge graphs express complex information through entities and their relationships, and have been widely used in information retrieval, recommendation systems, natural language processing and other fields. Building a knowledge graph in a specific domain helps to solve data query and search problems in a specific domain in a targeted manner.

[0003] However, the traditional method of constructing knowledge graphs has the problem of inaccurate expression of knowledge structure, which makes it impossible to obtain accurate query results when solving data query tasks in proprietary fields based on knowledge graphs.

[0004] Improving the quality of knowledge graphs to improve the accuracy of data queries using knowledge graphs is a technical problem that technical personnel in this field need to solve. Summary of the invention

[0005] The purpose of the present invention is to provide a data query method, device, storage medium and computer program product for improving the accuracy of data query using knowledge graphs.

[0006] In order to solve the above technical problems, the present invention provides a data query method, comprising:

[0007] Obtaining the text data to be processed, entity naming sample dataset, and entity relationship recognition sample dataset in the target domain;

[0008] Extracting mapping data of knowledge and context information from the input text data to be processed in sequence based on the entity naming sample data set and the entity relationship recognition sample data set using a pre-trained language model, and updating the entity naming sample data set and the entity relationship recognition sample data set using the mapping data during the extraction process; the knowledge includes entity names and relationships between entities;

[0009] Constructing a knowledge graph of the target domain according to the entity names and the relationships between the entities;

[0010] Constructing entity disambiguation task prompt words and inputting them into the pre-trained language model to perform entity disambiguation processing on the entity name to obtain an entity disambiguation result;

[0011] Constructing an entity linking task prompt word and inputting it into the pre-trained language model to perform entity linking processing on the entity name to obtain an entity linking result;

[0012] Updating the knowledge graph using the entity disambiguation result and the entity linking result;

[0013] Based on the knowledge graph, a data query task in the target field is performed to obtain a data query result.

[0014] On the one hand, obtaining the text data to be processed includes:

[0015] Collecting original text data of the target field;

[0016] The original text data is processed into blocks according to the semantic preservation block configuration parameter and the priority block configuration parameter to obtain the text block data to be processed;

[0017] The to-be-processed text block data is taken as the to-be-processed text data.

[0018] On the other hand, the block processing of the original text data according to the semantic preservation block configuration parameter and the priority block configuration parameter to obtain the text block data to be processed includes:

[0019] Identify segmentation keywords from the original text data;

[0020] If the block keywords do not exist in the original text data, dividing the original text data into meaning units using natural language processing technology;

[0021] If the block keyword exists in the original text data, the original text data is divided into the meaning units by using the block keyword as a block priority parameter and adopting natural language processing technology;

[0022] Context information is added to the meaning unit according to the record of the original text data to obtain the text block data to be processed.

[0023] On the other hand, the block processing of the original text data according to the semantic preservation block configuration parameter and the priority block configuration parameter to obtain the text block data to be processed includes:

[0024] Identifying a target entity name from the original text data;

[0025] The original text data is processed in blocks according to the occurrence frequency of the target entity name to obtain the text block data to be processed.

[0026] On the other hand, using the pre-trained language model to extract mapping data of knowledge and context information from the input text data to be processed based on the entity naming sample data set and the entity relationship recognition sample data set in sequence, and using the mapping data to update the entity naming sample data set and the entity relationship recognition sample data set during the extraction process, including:

[0027] The text data to be processed is constructed as prompt words for an entity naming task and input into the pre-trained language model, so that the pre-trained language model extracts the entity name and corresponding context information from the text data to be processed according to the entity naming sample data set;

[0028] The text data to be processed and the entity name are constructed as prompt words for an entity relationship recognition task and input into the pre-trained language model, so that the pre-trained language model extracts entity relationship triple data and corresponding context information from the text data to be processed according to the entity relationship recognition sample data set.

[0029] On the other hand, constructing the text data to be processed as prompt words for an entity naming task and inputting them into the pre-trained language model, so that the pre-trained language model extracts the entity name and corresponding context information from the text data to be processed according to the entity naming sample data set, including:

[0030] Retrieving relevant entity naming samples from the entity naming sample data set based on the text data to be processed using a text similarity algorithm;

[0031] Constructing the entity naming task prompt words using the text data to be processed and the relevant entity naming samples;

[0032] The entity naming task prompt word is input into the pre-trained language model, so that the pre-trained language model extracts the entity name and the corresponding context information from the text data to be processed according to the relevant entity naming sample.

[0033] On the other hand, the text data to be processed and the entity name are constructed as prompt words for entity relationship recognition task and input into the pre-trained language model, so that the pre-trained language model extracts entity relationship triple data and corresponding context information from the text data to be processed according to the entity relationship recognition sample data set, including:

[0034] Retrieving relevant entity relationship recognition samples from the entity relationship recognition sample data set based on the text data to be processed and the entity name using a text similarity algorithm;

[0035] Constructing the entity relationship recognition task prompt words using the text data to be processed and the relevant entity relationship recognition samples;

[0036] The entity relationship recognition task prompt words are input into the pre-trained language model so that the pre-trained language model extracts the entity relationship triple data and corresponding context information from the text data to be processed according to the relevant entity relationship recognition samples.

[0037] On the other hand, constructing entity disambiguation task prompt words and inputting them into the pre-trained language model to perform entity disambiguation processing on the entity name to obtain an entity disambiguation result, including:

[0038] Calculating a similarity score for each of the entity names, listing a plurality of the entity names having a similarity score greater than a first similarity threshold as a group of entity names to be disambiguated, to obtain a group of entity names to be disambiguated;

[0039] Obtaining context information corresponding to each of the entity names to be disambiguated;

[0040] The entity disambiguation task prompt words are constructed using the group of entity names to be disambiguated and the corresponding context information, the entity disambiguation task prompt words are input into the pre-trained language model to perform entity disambiguation on the entity names to be disambiguated, and the disambiguated entity names are output as the entity disambiguation results of the group of entity names to be disambiguated.

[0041] On the other hand, the entity disambiguation task prompt word is constructed with the to-be-disambiguated entity name group and the corresponding context information, the entity disambiguation task prompt word is input into the pre-trained language model to perform entity disambiguation processing on the to-be-disambiguated entity name, and the entity disambiguation result in which the disambiguated entity name is the to-be-disambiguated entity name group is outputted, including:

[0042] The entity disambiguation task prompt words are constructed with the disambiguation reasoning process task, the group of entity names to be disambiguated and the corresponding context information, and the entity disambiguation task prompt words are input into the pre-trained language model so that the pre-trained language model outputs the disambiguation reasoning basis corresponding to the entity disambiguation result while outputting the entity disambiguation result.

[0043] On the other hand, constructing an entity linking task prompt word and inputting it into the pre-trained language model to perform entity linking processing on the entity name to obtain an entity linking result, including:

[0044] Calculating a similarity score between the identified entity name to be linked and the entity name in the knowledge graph, and listing the entity name having a similarity score greater than a second similarity threshold as a candidate entity name;

[0045] Extracting a knowledge subgraph of the candidate entity name from the knowledge graph, and obtaining context information corresponding to the knowledge subgraph of the candidate entity name;

[0046] Constructing the entity linking task prompt word according to the to-be-linked entity name, the candidate entity name, the knowledge subgraph of the candidate entity name and the corresponding context information;

[0047] The entity linking task prompt word is input into the pre-trained language model to perform entity linking processing on the entity name to be linked and the candidate entity name, and a matching result between the entity name to be linked and the candidate entity name is output as the entity linking result.

[0048] On the other hand, constructing the entity linking task prompt word according to the to-be-linked entity name, the candidate entity name, the knowledge subgraph of the candidate entity name and the corresponding context information includes:

[0049] Constructing the entity linking task prompt word by linking the reasoning process task, the to-be-linked entity name, the candidate entity name, the knowledge subgraph of the candidate entity name and the corresponding context information;

[0050] Inputting the entity linking task prompt word into the pre-trained language model to perform entity linking processing on the to-be-linked entity name and the candidate entity name, and outputting a matching result between the to-be-linked entity name and the candidate entity name as the entity linking result, including:

[0051] The entity linking task prompt word is input into the pre-trained language model, so that the pre-trained language model outputs the linking reasoning basis corresponding to the entity linking result while outputting the entity linking result.

[0052] On the other hand, the entity naming sample dataset is constructed based on the initialization of the input entity naming seed annotation samples;

[0053] The entity relationship recognition sample data set is constructed based on the initialization of the input entity relationship recognition seed annotation samples.

[0054] In order to solve the above technical problems, the present invention further provides a data query device, comprising:

[0055] Memory for storing computer programs;

[0056] A processor is used to execute the computer program, and when the computer program is executed by the processor, the steps of any one of the data query methods described above are implemented.

[0057] In order to solve the above technical problems, the present invention also provides a non-volatile storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the data query method as described in any one of the above items are implemented.

[0058] In order to solve the above technical problems, the present invention also provides a computer program product, including a computer program / instruction, which implements the steps of any of the above data query methods when executed by a processor.

[0059] The data query method provided by the present invention has the beneficial effect that in the process of constructing the knowledge graph of the target domain using the pre-trained language model, mapping data of knowledge and context information is extracted from the text data to be processed based on the entity naming sample data set and the entity relationship recognition sample data set, and the mapping data is used to update the entity naming sample data set and the entity relationship recognition sample data set during the extraction process, thereby improving the efficiency and accuracy of the pre-trained language model in extracting entity names and relationships between entities; after constructing the knowledge graph of the target domain based on the entity names and the relationships between entities, entity disambiguation task prompt words and entity linking task prompt words are respectively constructed to update the knowledge graph, and the context understanding ability of the pre-trained language model is used to continuously optimize the knowledge graph, improve the quality of the knowledge graph, and thereby obtain more accurate data query results when using the knowledge graph to perform data query tasks in the target domain.

[0060] The present invention also provides a data query device, a non-volatile storage medium and a computer program product, which have the above-mentioned beneficial effects and are not described in detail here. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] In order to more clearly illustrate the embodiments of the present invention or the technical solutions of the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0062] Figure 1 An architectural diagram of a data query system provided by an embodiment of the present invention;

[0063] Figure 2 A flowchart of a data query method provided by an embodiment of the present invention;

[0064] Figure 3 A structural schematic diagram of a data query device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0065] The core of the present invention is to provide a data query method, device, storage medium and computer program product for improving the accuracy of data query using knowledge graphs.

[0066] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0067] Figure 1 An architectural diagram of a data query system provided in an embodiment of the present invention.

[0068] For ease of understanding, the system architecture to which the present invention is applicable is first introduced. Figure 1 As shown, in order to implement the data query method provided by an embodiment of the present invention, an embodiment of the present invention provides a data query system, which may include: a text receiving unit, a text preprocessing unit, an entity naming unit, an entity relationship recognition unit, an entity disambiguation and entity linking unit, a graph database and a document database.

[0069] Among them, the text receiving unit is used to receive the original text data of the target field. The text preprocessing unit is used to preprocess the original text data, such as data cleaning and data segmentation. The entity naming unit, entity relationship recognition unit, entity disambiguation and entity linking unit are used to call the pre-trained language model to perform corresponding reasoning and calculation tasks to complete the construction of the knowledge graph. The graph database is used to store the constructed knowledge graph. The document database is used to store the original text data or the pre-processed text data. A mapping relationship between knowledge-context information is established between the document database and the graph database to facilitate knowledge tracing. In the process of constructing the knowledge graph using the pre-trained language model, knowledge retrieval is performed in the two databases, and the two databases are continuously updated using the extracted knowledge-context information to achieve the construction and improvement of the knowledge graph.

[0070] The data query system provided by the embodiment of the present invention can be deployed on one server or in a cluster consisting of multiple devices.

[0071] Figure 1 This is an example where the target field is the academic field. The original text data can be academic literature materials (such as papers, patents, scholars' diaries, scientific research project materials, meeting minutes, etc.). The goal of constructing a knowledge graph is to effectively represent the various relationships between entities such as scholars, organizations, academic fields, and academic achievements. The constructed academic knowledge graph can be used to support scientific and technological intelligence analysis and other tasks.

[0072] Based on the above architecture, the data query method provided by the embodiment of the present invention is described below with reference to the accompanying drawings.

[0073] Figure 2A flow chart of a data query method provided by an embodiment of the present invention.

[0074] like Figure 2 As shown, the data query method provided by the embodiment of the present invention includes: S201: obtaining text data to be processed, entity naming sample data set and entity relationship recognition sample data set in the target field.

[0075] S202: Using a pre-trained language model to extract mapping data of knowledge and context information from the input text data to be processed based on an entity naming sample dataset and an entity relationship recognition sample dataset, and using the mapping data to update the entity naming sample dataset and the entity relationship recognition sample dataset during the extraction process; the knowledge includes entity names and relationships between entities.

[0076] S203: Construct a knowledge graph of the target domain based on entity names and relationships between entities.

[0077] S204: Construct a pre-trained language model for inputting prompt words into the entity disambiguation task to perform entity disambiguation processing on the entity name to obtain an entity disambiguation result.

[0078] S205: Construct a pre-trained language model for inputting prompt words into the entity linking task to perform entity linking processing on the entity name to obtain an entity linking result.

[0079] S206: Update the knowledge graph using the entity disambiguation results and entity linking results.

[0080] S207: Execute the data query task in the target field based on the knowledge graph to obtain the data query result.

[0081] In a specific implementation, the pretrained language model (PLM) may be a large language model (LLM). To improve the accuracy of generating a knowledge graph in a target domain, the pretrained language model may be obtained by training with original text data in the target domain.

[0082] In an embodiment of the present invention, the natural language processing capability and context understanding capability of the pre-trained language model are used to construct a knowledge graph of the target domain to improve the accuracy of the knowledge graph construction. The construction process mainly includes entity naming tasks, entity relationship recognition tasks, entity disambiguation tasks, and entity linking tasks. In order to further improve the accuracy of the knowledge graph, the corresponding pre-trained language models can be trained for entity naming tasks, entity relationship recognition tasks, entity disambiguation tasks, and entity linking tasks, respectively, and prompts and in-context learning can be fully utilized to improve the pre-trained language model's understanding of the text data to be processed in the target domain, and accurately construct the knowledge graph.

[0083] In an embodiment of the present invention, a knowledge-text tracing mechanism is established by updating an entity naming sample dataset and an entity relationship recognition sample dataset using the mapping data of the identified knowledge and context information. Based on this, sample retrieval is designed in the process of constructing a knowledge graph of the target field using a pre-trained language model to ensure the accuracy of constructing the knowledge graph.

[0084] For S201, considering the limited number of input tokens of the pre-trained language model, it is necessary to ensure that the size of each processing unit meets the capacity limit of the pre-trained language model and ensure the semantic integrity of the text to support subsequent knowledge extraction.

[0085] Acquiring the text data to be processed in S201 may include: collecting original text data in the target field; performing data cleaning and block processing on the original text data to obtain the text data to be processed.

[0086] The purpose of data cleaning the original text data is to remove noise and unstructured elements. Data cleaning the original text data may include: deleting the set type data in the original text data, and performing standardized text format processing on the remaining text data. The set type data may include format tags (such as Hyper Text Markup Language (HTML) tags), non-text elements (such as tables, pictures, etc.), document format symbols (such as headers, footers, reference lists, etc.). Standardized text format processing of the remaining text data may include: standardizing text formats, unifying date and number representations, removing redundant blank characters and line breaks; identifying and correcting spelling errors, and using natural language processing tools to standardize synonyms and variant words.

[0087] The original text data is processed in blocks. Specifically, the original text data after data cleaning can be processed in blocks to divide the long text into smaller segments that can be processed by the pre-trained language model.

[0088] In order to improve the accuracy of the pre-trained language model's understanding of the knowledge graph construction task in the target field, the embodiment of the present invention uses an entity naming sample dataset and an entity relationship recognition sample dataset as the basis for the pre-trained language model to extract entity names and relationships between entities.

[0089] In order to further improve the accuracy of the pre-trained language model's understanding of the knowledge graph construction task in the target field, in some optional implementations of the embodiments of the present invention, the entity naming sample data set can be initialized and constructed based on the input entity naming seed annotation samples; the entity relationship recognition sample data set can be initialized and constructed based on the input entity relationship recognition seed annotation samples.

[0090] Among them, the entity naming seed annotation samples are entity naming samples that are manually annotated according to the target entity type of the target field. The target entity type is the entity category of the target field that the user inputs. During the learning process of the pre-trained language model, the entity type can be expanded to obtain more levels of classification. For example, in the field of academic research, the target entity type can be a person's name, organization, occupation, time, research field, etc. In order to reduce the annotation cost, only a small number of entity naming seed annotation samples are required. For example, only 10 entity naming seed annotation samples can be annotated, and the pre-trained language model is relied upon to expand the samples during the learning process.

[0091] Entity relationship recognition seed annotation samples are entity relationship recognition samples that are manually annotated according to the target entity relationship type of the target field. The target entity relationship type is the major category of entity relationship that the target field is concerned about, which is input by the user. During the learning process of the pre-trained language model, the entity relationship type can be expanded to obtain more levels of classification. For example, in the field of academic research, the target entity relationship categories can include cooperation, competition, subordination, etc. In order to reduce the annotation cost, only a small number of entity relationship recognition seed annotation samples are required. For example, only 10 entity relationship recognition seed annotation samples can be annotated, and the pre-trained language model is relied upon to expand the samples during the learning process.

[0092] For S202, the entity naming task and the entity relationship recognition task can be constructed as a prompt word input pre-trained language model, output entities and the relationship between entities, and save the mapping data of knowledge and context information. For example, the entity name and entity relationship triple data can be stored in the graph database respectively, and the corresponding context information can be stored in the document database, and a mapping relationship between the entity name and the corresponding context information, and the entity relationship triple data and the corresponding context information can be established.

[0093] For S203, the entity name and entity relationship triple data are stored in a graph database, and a knowledge graph structure is constructed with entity names as nodes and relationships between entities as edges.

[0094] For S204, since the same entity may have different entity names in the same text and in different texts, it is necessary to perform entity disambiguation on the initially constructed knowledge graph. In an embodiment of the present invention, a pre-trained language model is constructed by inputting a prompt word for an entity disambiguation task to perform entity disambiguation on the entity name to obtain an entity disambiguation result, and the accuracy of entity disambiguation is improved by using the natural language processing capability of the pre-trained language model.

[0095] For S205, for the newly identified entity name, it is necessary to link it to the knowledge graph. In the embodiment of the present invention, by constructing the entity linking task prompt word input pre-trained language model to perform entity linking processing on the entity name, the entity linking result is obtained, and the natural language processing capability of the pre-trained language model is used to improve the accuracy of entity linking.

[0096] The data query method provided by the embodiment of the present invention, in the process of constructing the knowledge graph of the target domain using the pre-trained language model, extracts mapping data of knowledge and context information from the text data to be processed based on the entity naming sample data set and the entity relationship recognition sample data set, and uses the mapping data to update the entity naming sample data set and the entity relationship recognition sample data set during the extraction process, thereby improving the efficiency and accuracy of the pre-trained language model in extracting entity names and relationships between entities; after constructing the knowledge graph of the target domain based on the entity names and the relationships between entities, entity disambiguation task prompt words and entity linking task prompt words are respectively constructed to update the knowledge graph, and the context understanding ability of the pre-trained language model is used to continuously optimize the knowledge graph, improve the quality of the knowledge graph, and thereby obtain more accurate data query results when using the knowledge graph to perform data query tasks in the target domain.

[0097] Based on the above embodiment, the embodiment of the present invention further illustrates the text segmentation process.

[0098] In order to meet the processing requirements of the pre-trained language model, it is necessary to convert the long text data in the target domain into smaller segments and ensure the relative integrity of the text content after segmentation.

[0099] In an embodiment of the present invention, obtaining the text data to be processed in S201 may include: collecting original text data of the target field; performing block processing on the original text data according to the semantic preservation block configuration parameters and the priority block configuration parameters to obtain text block data to be processed; and using the text block data to be processed as the text data to be processed.

[0100] In a specific implementation of the embodiment of the present invention, two block strategies are adopted: semantics-preserving block and priority block.

[0101] The original text data is processed into blocks according to the semantic preservation block configuration parameters and the priority block configuration parameters to obtain the text block data to be processed, which may include: identifying block keywords from the original text data; if the original text data does not have the block keywords, using natural language processing technology to divide the original text data into meaning units; if the original text data has the block keywords, using the block keywords as the block priority parameters, and using natural language processing technology to divide the original text data into meaning units; adding context information to the meaning units according to the records of the original text data to obtain the text block data to be processed.

[0102] Among them, semantic preservation chunking aims to use natural language processing technology (such as paragraph detection, sentence boundary detection, etc.) to determine the logical segmentation points of text without obvious structure, ensuring that each chunk represents a complete thought unit or concept. Using natural language processing technology to divide the original text data into meaning units can include: using natural language processing tools to divide the original text data into complete meaning chunks, for example, a to-be-processed text chunk data can be designed as a complete paragraph.

[0103] To improve the integrity of the text content, a certain number of overlapping sentences are added at the end of the block, and these sentences will appear at the beginning of the next block to retain a certain context. In some optional implementations of the embodiments of the present invention, the last three sentences of the previous block can be set to overlap in each block.

[0104] Priority segmentation is designed to refer to the fixed format carried in the original text data. For example, the text parts of the paper that are easy to extract key information (such as abstracts and conclusions) can be used as segmentation keywords to give higher priority and be independently segmented to ensure that this information will not be missed during the preprocessing process.

[0105] Using the chunking keywords as chunking priority parameters, natural language processing technology is used to divide the original text data into meaning units, which may include structure-oriented chunking and important information independent processing chunking. Among them, structure-oriented chunking may include: using natural language processing tools to identify the text structure of the original text data, extracting titles, subtitles, lists, and sublists as chunking keywords as chunking guidelines, and chunking according to the logical structure of the text to ensure that each structural unit is regarded as a whole. Important information independent processing chunking may include: setting the area where the chunking keywords appear as a high-priority text area, ensuring that the high-priority text area is separately chunked, so that the pre-trained language model can focus on the analysis and processing of these parts. When chunking, additional contextual information is also provided for these areas to ensure the accuracy of the analysis.

[0106] In some other optional implementations of the embodiments of the present invention, the original text data is processed into blocks according to the semantic preservation block configuration parameters and the priority block configuration parameters to obtain the text block data to be processed, which may also include: identifying the target entity name from the original text data; processing the original text data into blocks according to the frequency of occurrence of the target entity name to obtain the text block data to be processed. That is, the block keyword can also be set as the target entity name, and smaller blocks are processed for the positions with higher frequency of occurrence of the target entity name, and larger blocks are processed for the positions with lower frequency of occurrence of the target entity name, so as to balance the frequency of occurrence of the target entity name.

[0107] In some other optional implementations of the embodiments of the present invention, the two segmentation strategies of semantic preservation segmentation and priority segmentation can be combined to set structure-oriented segmentation keywords and target entity name segmentation keywords to guide segmentation processing of original text data.

[0108] After the block processing is completed, the block data of the text to be processed is stored in the document database as the text data to be processed, and the data source of each text data to be processed (such as from a certain document) is recorded. The data source can be set with a unique identifier (a cryptographic hash function such as MD5 code can be used). For multiple text data to be processed from the same data source, they can be indexed and encoded with natural numbers in sequence to prepare for knowledge extraction from each text data to be processed later.

[0109] Based on the above embodiments, the embodiments of the present invention further illustrate the process of using a pre-trained language model to perform entity naming tasks and entity relationship recognition tasks.

[0110] In an embodiment of the present invention, S202 uses a pre-trained language model to extract mapping data of knowledge and context information from the input text data to be processed in sequence based on an entity naming sample data set and an entity relationship recognition sample data set, and uses the mapping data to update the entity naming sample data set and the entity relationship recognition sample data set during the extraction process. It can include: constructing the text data to be processed as entity naming task prompt words and inputting them into the pre-trained language model, so that the pre-trained language model extracts entity names and corresponding context information from the text data to be processed according to the entity naming sample data set; constructing the text data to be processed and the entity name as entity relationship recognition task prompt words and inputting them into the pre-trained language model, so that the pre-trained language model extracts entity relationship triple data and corresponding context information from the text data to be processed according to the entity relationship recognition sample data set.

[0111] When executing an entity naming task, the text data to be processed is constructed as prompt words for the entity naming task and input into a pre-trained language model, so that the pre-trained language model extracts entity names and corresponding context information from the text data to be processed according to an entity naming sample data set. This may include: using a text similarity algorithm to retrieve relevant entity naming samples from an entity naming sample data set according to the text data to be processed; constructing entity naming task prompt words using the text data to be processed and the relevant entity naming samples; and inputting the entity naming task prompt words into the pre-trained language model, so that the pre-trained language model extracts entity names and corresponding context information from the text data to be processed according to the relevant entity naming samples.

[0112] In an embodiment of the present invention, an entity naming sample data set can be set for each target entity type. These entity naming sample data sets are initially derived from manually annotated entity naming seed annotated samples, and are subsequently updated according to the learning process of the pre-trained language model. The entity naming sample data set is saved in a document database for subsequent retrieval and use.

[0113] When performing an entity naming task, the pre-trained language model is searched for a context similar to the current text data to be processed, specifically by retrieving the entity naming samples most similar to the text data to be processed from the document database. The entity naming samples may include entity naming seed annotation samples and / or entity naming samples output by the pre-trained language model.

[0114] In an embodiment of the present invention, a text similarity algorithm is used to retrieve relevant entity naming samples from an entity naming sample data set according to the text data to be processed. Specifically, a BM25 algorithm can be used to calculate similarity for retrieval. The number of retrieved relevant entity naming samples can be set to three.

[0115] In an embodiment of the present invention, an entity naming task prompt word is constructed according to the text data to be processed and the related entity naming samples. The name of the naming task prompt word can be "EntityRec", i.e., entity naming, which is used to ensure that the pre-trained language model can understand and learn how to recognize entities. By utilizing the context understanding ability of the pre-trained language model, "entity type", "text data to be processed", and "related entity naming samples" can be used as variables to fill in the entity naming task prompt word, and the content output by the pre-trained language model is required to include "entity name" and "original context sentence", which is output in JSON form. The naming task prompt word is input into the pre-trained language model to start the entity recognition process.

[0116] The format of the naming task prompt word can be as follows:

[0117] Enter the text data to be processed: "{Input_Text}";

[0118] Enter the relevant entity naming sample:

[0119] 1. Entity naming sample 1 {Sample_1_Entity}-context information {Sample_1_Context};

[0120] 2. Entity naming sample 2 {Sample_2_Entity}-context information {Sample_2_Context};

[0121] 3. Entity naming sample 3 {Sample_3_Entity}-context information {Sample_3_Context};

[0122] Please identify all entity names related to the target entity type {Entity_Type} based on the relevant entity naming samples and the text data to be processed, extract the original context sentences corresponding to each entity name, and return the results in the following JSON format:

[0123] {

[0124] "identified_entities":[

[0125] {

[0126] "entity":"Insert the recognized entity name here",

[0127] "context_sentence": "Insert the original context sentence containing the entity name here"

[0128] },

[0129] {

[0130] "entity":"Insert the next recognized entity name here",

[0131] "context_sentence": "Insert the original context sentence containing the next entity name here"

[0132] }

[0133] / / ...More results... ]

[0135] }

[0136] When applying the template of this naming task prompt, you need to replace the placeholders such as {Entity_Type}, {Input_Text}, {Sample_1_Entity}, {Sample_1_Context}, {Sample_2_Entity}, {Sample_2_Context}, {Sample_3_Entity}, and {Sample_3_Context} with specific entity types, text data to be processed, and related entity naming samples. The pre-trained language model will operate according to this naming task prompt, identify entities of the target entity type in the input text data to be processed, and return the results in JSON format. This structured output format is conducive to subsequent data processing and storage.

[0137] The entity names and corresponding context information identified by the pre-trained language model are stored in association to achieve knowledge traceability. This is achieved by storing the entity names in the graph database, storing the context information in the document database, and establishing a mapping relationship between them. The mapping data of the entity name and the corresponding context information is also saved as a new entity naming sample to update the entity naming sample dataset to support the continuous learning of the pre-trained language model. If multiple entities appear in the same context information, the context information is only saved once in the document database, and multiple entity names are pointed to the context information. This limitation does not apply to the entity naming sample dataset. The continuously updated entity naming sample dataset will be used for future entity recognition tasks to help the pre-trained language model adapt to text changes and continuously optimize entity naming performance.

[0138] The entity names extracted from the text data to be processed by the pre-trained language model are used as knowledge nodes and stored in the graph database as entity objects of the knowledge graph of the target field.

[0139] After completing entity recognition of the text data to be processed, entity relationship analysis is required in order to extract the semantic relationship between entities. An embodiment of the present invention provides an entity relationship analysis method based on a pre-trained language model. When performing an entity relationship recognition task, the text data to be processed and the entity name are constructed as prompt words for the entity relationship recognition task and input into the pre-trained language model, so that the pre-trained language model extracts entity relationship triple data and corresponding context information from the text data to be processed according to the entity relationship recognition sample data set, which may include: using a text similarity algorithm to retrieve relevant entity relationship recognition samples from the entity relationship recognition sample data set according to the text data to be processed and the entity name; constructing entity relationship recognition task prompt words using the text data to be processed and the relevant entity relationship recognition samples; inputting the entity relationship recognition task prompt words into the pre-trained language model, so that the pre-trained language model extracts entity relationship triple data and corresponding context information from the text data to be processed according to the relevant entity relationship recognition samples.

[0140] In an embodiment of the present invention, an entity relationship recognition sample data set may be set for each target entity relationship type. These entity relationship recognition sample data sets are initially derived from manually annotated entity relationship recognition seed annotated samples, and are subsequently updated according to the learning process of the pre-trained language model. The entity relationship recognition sample data set is stored in a document database for subsequent retrieval and use.

[0141] When performing the entity relationship recognition task, the pre-trained language model is searched for a context environment similar to the current text data to be processed, which is specifically achieved by retrieving the entity relationship recognition sample that is most similar to the entity name extracted from the text to be processed from the document database. The entity relationship recognition sample may include an entity relationship recognition seed annotation sample and / or an entity relationship recognition sample output by the pre-trained language model.

[0142] In an embodiment of the present invention, the BM25 algorithm may be used to calculate similarity for retrieval. The number of relevant entity relationship recognition samples retrieved may be set to three. For example, three of the ten entity relationship recognition samples that are most similar to the entity name in the target entity relationship type may be retrieved from the document database.

[0143] The context understanding ability of the pre-trained language model is used to extract entity relations. The name of the entity relation recognition task prompt word can be set to "RelationAna", that is, entity relation analysis, to guide the pre-trained language model to understand the task objectives and context. The "target entity relation type", "text data to be processed", "entity name", and "related entity relation recognition samples" can be embedded as variables into the entity relation recognition task prompt word. At the same time, the pre-trained language model is required to output the content including "entity relation triples" and "original context sentences" in JSON format. Input the entity relation recognition task prompt word into the pre-trained language model to start the entity relation recognition process.

[0144] The format of prompt words for entity relationship recognition tasks can be as follows:

[0145] Enter the text to be processed: "{Input_Text}";

[0146] Involved Entity Name: {Involved_Entities};

[0147] Input related entity relationship recognition sample:

[0148] 1. Entity relationship sample 1 {Sample_1_Relation}-context information {Sample_1_Context};

[0149] 2. Entity relationship sample 2 {Sample_2_Relation}-context information {Sample_2_Context};

[0150] 3. Entity relationship sample 3 {Sample_3_Relation}-context information {Sample_3_Context};

[0151] Please identify the samples and the names of the entities involved according to the relevant entity relationships, identify all relevant entity relationships, extract the original context sentences of each entity relationship, and return the results in the following JSON format:

[0152] {

[0153] "extracted_relations":[

[0154] {

[0155] "entity_1":"Insert the name of the first entity involved in the entity relationship here",

[0156] "relation":"Insert the identified relationship type here",

[0157] "entity_2":"Insert the name of the second entity involved in the entity relationship here",

[0158] "context_sentence": "Insert the original context sentence containing these entity relationships here"

[0159] },

[0160] / / ...More results... ]

[0162] }

[0163] When using this template, you need to replace the placeholders such as {Relation_Type}, {Input_Text}, {Involved_Entities}, {Sample_1_Relation}, {Sample_1_Context}, {Sample_2_Relation}, {Sample_2_Context}, {Sample_3_Relation}, and {Sample_3_Context} with specific relation types, the text data to be processed, the entity names involved in the text data to be processed, and the related entity relation recognition samples. This will guide the pre-trained language model to identify and extract the specific relations between the entity names contained in the text data to be processed based on the provided information and sample context, and return the results in JSON format for subsequent data processing and knowledge graph construction.

[0164] The entity relationships and corresponding context information identified by the pre-trained language model are stored in association to achieve knowledge traceability. This is achieved by storing the entity relationships in a graph database, storing the context information in a document database, and establishing a mapping relationship between them.

[0165] In the graph database, based on the entity relationship triple data, the entity name is used as the node and the entity relationship is used as the edge to form a knowledge graph. These entity relationships connect the entity nodes in the graph database as semantic relationships in the knowledge graph.

[0166] For each identified entity relationship, a mapping relationship with the corresponding context information in the document database is established to ensure the traceability of the relationship.

[0167] The entity relationship recognition results are used as new entity relationship recognition samples to update the entity relationship recognition sample dataset to support the continuous learning and optimization of the pre-trained language model.

[0168] Based on the above embodiments, the embodiments of the present invention further illustrate the process of entity disambiguation processing and entity linking processing.

[0169] The entities identified from the text data to be processed often have many ways of expression, that is, they correspond to multiple entity names, such as "School A" and "University A". Therefore, the entities need to be disambiguated and linked to the entities in the knowledge graph.

[0170] To simplify the calculation, the entity disambiguation task can be performed on a data source basis, such as first disambiguating entities in the same article.

[0171] In an embodiment of the present invention, in S204, entity disambiguation task prompt words are constructed and input into a pre-trained language model to perform entity disambiguation processing on entity names to obtain entity disambiguation results, which may include: calculating a similarity score for each entity name, listing multiple entity names with a similarity score greater than a first similarity threshold as a group of entity names to be disambiguated, and obtaining a group of entity names to be disambiguated; obtaining context information corresponding to each entity name to be disambiguated; constructing an entity disambiguation task prompt word with the group of entity names to be disambiguated and the corresponding context information, inputting the entity disambiguation task prompt word into the pre-trained language model to perform entity disambiguation processing on the entity names to be disambiguated, and outputting the disambiguated entity names as the entity disambiguation result of the group of entity names to be disambiguated.

[0172] In a specific implementation, similar entity screening is first performed to identify and screen out different expressions that may point to the same entity in the same data source. Specifically, the BM25 algorithm can be used to calculate the similarity score between each identified entity name and other entity names for multiple text data to be processed from the same data source. A first similarity threshold is set, which can be 0.5. For example, when the similarity threshold between entity names is greater than 0.5, they are considered to be likely to point to the same entity. For each group of entity names to be disambiguated, the context information corresponding to the entity names to be disambiguated is collected.

[0173] In order to make the pre-trained language model understand whether multiple entity names belong to the same entity, the embodiment of the present invention constructs entity disambiguation task prompt words according to the text data to be processed, the entity names to be disambiguated, and the context information corresponding to the entity names to be disambiguated, that is, these parameters are filled into the entity disambiguation task prompt words as variables. After the recognized entity names are disambiguated using the pre-trained language model, they are merged in the knowledge graph, and the disambiguated entity names are recorded in the document database as aliases of the disambiguated entity names.

[0174] In order to improve the interpretability and reliability of the entity disambiguation process, in an embodiment of the present invention, an entity disambiguation task prompt word "EntityDis" is constructed with a group of entity names to be disambiguated and corresponding context information, and the entity disambiguation task prompt word is input into a pre-trained language model to perform entity disambiguation on the entity names to be disambiguated, and the entity disambiguation result of the group of entity names to be disambiguated after the disambiguation is outputted, which may include: constructing an entity disambiguation task prompt word with a disambiguation reasoning process task, a group of entity names to be disambiguated and corresponding context information, and inputting the entity disambiguation task prompt word into a pre-trained language model, so that the pre-trained language model outputs a disambiguation reasoning basis corresponding to the entity disambiguation result while outputting the entity disambiguation result.

[0175] Therefore, the pre-trained language model is required to output "whether the entities are the same" and "reasons" and return them in JSON format.

[0176] The format of the prompt word for the entity disambiguation task can be as follows:

[0177] The format of the prompt word for the entity disambiguation task can be as follows:

[0178] Disambiguate entities in the following text:

[0179] Text: "{Article_Text}"

[0180] The entity name to be disambiguated and its context information:

[0181] 1. Entity name to be disambiguated "{Entity_1}" - context information "{Context_1}";

[0182] 2. Entity name to be disambiguated "{Entity_2}" - context information "{Context_2}";

[0183] 3. Entity name to be disambiguated "{Entity_3}" - context information "{Context_3}";

[0184] Consider the context information of the above entity names to be disambiguated, determine whether the entity names to be disambiguated refer to the same entity, briefly explain your judgment basis, and return the result in the following JSON format:

[0185] {

[0186] "disambiguation_results":[

[0187] {

[0188] "entity_group":[

[0189] "{Entity_1_Alias}",

[0190] "{Entity_2_Alias}"

[0191] ],

[0192] "is_same_entity": true,

[0193] "reasoning":"Insert the basis for the model to determine the same entity here"

[0194] },

[0195] / / ...More results... ]

[0197] }

[0198] When applying the entity disambiguation task prompt words in practice, you need to replace the placeholders such as {Article_Text}, {Entity_1}, {Context_1}, {Entity_2}, {Context_2}, {Entity_3} and {Context_3} with specific text data to be processed and entity names to be disambiguated. The pre-trained language model will operate according to the entity disambiguation task prompt words, determine whether the provided entity names to be disambiguated refer to the same entity, and give the basis for the judgment, and finally return the entity disambiguation result in JSON format. This entity disambiguation result will be used to update the knowledge graph and record the alias of the document knowledge base.

[0199] After entity disambiguation is completed, the entities in the knowledge graph need to be linked to merge entities with possible identical semantics. For newly identified entity names, possible corresponding entities need to be found in the knowledge graph.

[0200] In an embodiment of the present invention, constructing an entity linking task prompt word in S205 and inputting it into a pre-trained language model to perform entity linking processing on the entity name to obtain an entity linking result may include: calculating a similarity score between the identified entity name to be linked and the entity name in the knowledge graph, and listing the entity names with a similarity score greater than a second similarity threshold as candidate entity names; extracting a knowledge subgraph of the candidate entity name from the knowledge graph, and obtaining context information corresponding to the knowledge subgraph of the candidate entity name; constructing an entity linking task prompt word according to the entity name to be linked, the candidate entity name, the knowledge subgraph of the candidate entity name and the corresponding context information; inputting the entity linking task prompt word into the pre-trained language model to perform entity linking processing on the entity name to be linked and the candidate entity name, and outputting a matching result between the entity name to be linked and the candidate entity name as the entity linking result.

[0201] In the specific implementation, firstly, for the newly added entity name to be linked, possible corresponding entities are found in the knowledge graph. Specifically, the BM25 algorithm can be used to search for entities in the knowledge graph, and the second similarity threshold can be set, which can be 0.7. For example, when the similarity score between the entity name of the entity in the knowledge graph and the entity name to be linked is greater than 0.7, the entity name is listed as a candidate entity name. A list of candidate entity names is generated for further verification and linking.

[0202] The purpose of extracting knowledge subgraphs is to extract relevant knowledge subgraphs for the entity names to be linked and the candidate entity names. Specifically, this can be done by extracting the one-hop relationship knowledge subgraphs of the entity names to be linked and each candidate entity name from the knowledge graph and formally expressing these subgraphs.

[0203] The expression of knowledge subgraph can be as follows (taking University A as an example):

[0204] {

[0205] "entity":"University A",

[0206] "triples":[

[0207] {

[0208] "head":"University A",

[0209] "relation":"located in",

[0210] "tail":"Country Y"

[0211] },

[0212] {

[0213] "head":"University A",

[0214] "relation":"Creation Year",

[0215] "tail":"1096"

[0216] },

[0217] / / ...more triplets... ]

[0219] }

[0220] From the document database, descriptive texts for assisting entity linking are collected for the entity names to be linked and the candidate entity names. Specifically, two relevant descriptive texts can be randomly sampled for both the entity names to be linked and the candidate entity names as reference information for entity linking.

[0221] In an embodiment of the present invention, the entity linking task prompt word "EntityLink" is input into the pre-trained language model so that the pre-trained language model determines whether the entity name to be linked and the candidate entity name are the same semantic entity.

[0222] In order to improve the interpretability and reliability of the entity disambiguation process, in an embodiment of the present invention, constructing entity linking task prompt words based on the entity name to be linked, the candidate entity name, the knowledge subgraph of the candidate entity name and the corresponding context information can include: constructing the entity linking task prompt words based on the linking reasoning process task, the entity name to be linked, the candidate entity name, the knowledge subgraph of the candidate entity name and the corresponding context information; inputting the entity linking task prompt words into a pre-trained language model to perform entity linking processing on the entity name to be linked and the candidate entity name, and outputting the matching result of the entity name to be linked and the candidate entity name as the entity linking result, including: inputting the entity linking task prompt words into the pre-trained language model so that the pre-trained language model outputs the linking reasoning basis corresponding to the entity linking result while outputting the entity linking result.

[0223] Therefore, the prompt words of the entity linking task require the pre-trained language model to guide the pre-trained language model to output entity linking results and linking reasoning basis based on the knowledge subgraph and related description text.

[0224] Specifically, "name of entity to be linked", "name of candidate entity", "entity-related knowledge subgraph", and "entity-related description text" can be used as variables to fill in the entity linking task prompt words. At the same time, the returned content is required to include "whether the entities are the same" and "reasons", and be returned in JSON format.

[0225] The format of the entity linking task prompt word can be as follows:

[0226] Name of the entity to be linked: "{New_Entity_Name}";

[0227] The knowledge subgraph related to the entity to be linked: {New_Entity_Subgraph_JSON};

[0228] Description text of the entity to be linked:

[0229] 1. "{New_Entity_Description_1}";

[0230] 2. "{New_Entity_Description_2}";

[0231] Candidate entity names and their knowledge subgraphs and related description texts:

[0232] 1. Candidate entity: "{Candidate_Entity_1}"

[0233] Subgraph information: {Candidate_Entity_1_Subgraph_JSON}

[0234] Description text:

[0235] "{Candidate_Entity_1_Description_1}"

[0236] "{Candidate_Entity_1_Description_2}"

[0237] 2. Candidate entity: "{Candidate_Entity_2}"

[0238] Subgraph information: {Candidate_Entity_2_Subgraph_JSON}

[0239] Description text:

[0240] "{Candidate_Entity_2_Description_1}"

[0241] "{Candidate_Entity_2_Description_2}"

[0242] Based on the above information, please determine whether the entity name to be linked refers to the same entity with the same semantic expression as any candidate entity name, provide a basis for each judgment, and return the result in the following JSON format:

[0243] {

[0244] "entity_linking_results":[

[0245] {

[0246] "new_entity":"{New_Entity_Name}",

[0247] "candidate_entity":"{Candidate_Entity_1}",

[0248] "is_same_entity":true / false,

[0249] "reasoning":"Insert the basis for the model's conclusion based on the knowledge subgraph and description text here"

[0250] } ]

[0251] }

[0252] In practical applications, placeholders such as {New_Entity_Subgraph_JSON}, {Candidate_Entity_1_Subgraph_JSON}, and {Candidate_Entity_2_Subgraph_JSON} need to be replaced with specific knowledge subgraph JSON structures. This formal expression allows the model to understand the contextual relationship of each entity more clearly, thereby improving the accuracy of entity linking.

[0253] According to the entity linking results output by the pre-trained language model, the newly added entity names to be linked are merged with the entity names belonging to the same entity in the knowledge graph, and the document database and graph database are updated to achieve entity consistency and knowledge integrity.

[0254] On the basis of the above embodiment, the data query method provided by the embodiment of the present invention may further include: updating text data in the document database using the entity disambiguation result and the entity linking result.

[0255] That is to say, while performing knowledge disambiguation and linking on the knowledge graph, context samples in the database can also be disambiguated and linked, so as to shorten the subsequent disambiguation link analysis time.

[0256] The embodiment of the present invention realizes the construction of the knowledge graph of the target domain. The process utilizes the capability of the pre-trained language model and has good scalability. If you want to add entity types and semantic relationships, you can add them at any time in the process.

[0257] When dealing with the task of building a knowledge graph in the field of academic research, a pre-trained language model is used to perform named entity recognition, entity relationship analysis, entity linking and entity disambiguation on scholar-related entities in academic literature materials, ensuring the accuracy and depth of information extracted from the literature. The pre-trained language model provided by the embodiment of the present invention is used to implement the complete process of named entity recognition, entity relationship analysis, and entity disambiguation and linking, which is a key technology for building a high-quality academic knowledge graph. By setting corresponding prompt words and context information for each construction link of the knowledge graph, the pre-trained language model has good expansion capabilities at each key stage of knowledge graph construction and can adapt to new knowledge acquisition needs. And improve the model generalization ability of the pre-trained language model and its adaptability to knowledge in different fields.

[0258] The knowledge-context information tracing mechanism designed in the embodiment of the present invention improves the accuracy of the pre-trained language model, making it convenient to retrieve from the knowledge graph to the original text, thereby providing a means of accuracy verification for the pre-trained language model and ensuring the quality of information extraction and linking. Not only does it make the source of knowledge queryable, it also provides a basis for accuracy verification for the pre-trained language model in key stages such as named entity recognition, entity relationship analysis, entity linking and disambiguation, which is an important technology to ensure the accuracy and credibility of the constructed academic knowledge graph.

[0259] Therefore, the data query method provided by the embodiment of the present invention not only improves the efficiency and quality of building academic knowledge graphs, but also provides strong technical support for subsequent knowledge graph updates and expansions. The same technical effect can also be achieved when dealing with knowledge graph construction tasks in other fields.

[0260] The above describes in detail various embodiments corresponding to the data query method. On this basis, the present invention also discloses a data query device, a data query equipment, a non-volatile storage medium and a computer program product corresponding to the above method.

[0261] An embodiment of the present invention provides a data query device, which may include: an acquisition unit, used to acquire to-be-processed text data, an entity naming sample data set, and an entity relationship recognition sample data set in a target field.

[0262] The first inference calculation unit is used to use a pre-trained language model to extract mapping data of knowledge and context information from the input text data to be processed based on the entity naming sample data set and the entity relationship recognition sample data set in sequence, and use the mapping data to update the entity naming sample data set and the entity relationship recognition sample data set during the extraction process; the knowledge includes entity names and relationships between entities.

[0263] A construction unit is used to construct a knowledge graph of the target domain according to the entity names and the relationships between the entities.

[0264] The second reasoning calculation unit is used to construct an entity disambiguation task prompt word input into the pre-trained language model to perform entity disambiguation processing on the entity name to obtain an entity disambiguation result.

[0265] The third reasoning calculation unit is used to construct an entity linking task prompt word input into the pre-trained language model to perform entity linking processing on the entity name to obtain an entity linking result.

[0266] An updating unit is used to update the knowledge graph using the entity disambiguation result and the entity linking result.

[0267] A query unit is used to perform a data query task in the target field based on the knowledge graph to obtain a data query result.

[0268] It should be noted that in each implementation of the data query device provided by the embodiment of the present invention, the division of units is only a logical functional division, and other division methods can be adopted. The connection method between different units can be electrical, mechanical or other connection methods. The separated units can be located in the same physical location or distributed on multiple network nodes. Each unit can be implemented in the form of hardware or in the form of a software functional unit. That is, part or all of the units provided in the embodiment of the present invention can be selected according to actual needs and the corresponding connection method or integration method can be adopted to achieve the purpose of the embodiment of the present invention.

[0269] Since the embodiments of the apparatus part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the apparatus part, which will not be repeated here.

[0270] Figure 3 A structural schematic diagram of a data query device provided by an embodiment of the present invention.

[0271] like Figure 3 As shown, the data query device provided by the embodiment of the present invention includes: a memory 310, used to store a computer program 311; a processor 320, used to execute the computer program 311, and when the computer program 311 is executed by the processor 320, the steps of the data query method provided in any of the above embodiments are implemented.

[0272] Among them, the processor 320 may include one or more processing cores, such as a 3-core processor, an 8-core processor, etc. The processor 320 may be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor 320 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 320 may be integrated with a graphics processing unit (GPU), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 320 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.

[0273] The memory 310 may include one or more non-volatile storage media, which may be non-transitory. The memory 310 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 310 is at least used to store the following computer program 311, wherein the computer program 311, after being loaded and executed by the processor 320, can implement the relevant steps in the data query method disclosed in any of the aforementioned embodiments. In addition, the resources stored in the memory 310 may also include an operating system 312 and data 313, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 312 may be Windows or other types of operating systems. Data 313 may include, but is not limited to, the data involved in the above method.

[0274] In some embodiments, the data query device may further include a display screen 330 , a power supply 340 , a communication interface 350 , an input / output interface 360 ​​, a sensor 370 , and a communication bus 380 .

[0275] Those skilled in the art will understand that Figure 3 The structure shown in the figure does not constitute a limitation on the data query device, and may include more or fewer components than those shown in the figure.

[0276] The data query device provided in the embodiment of the present invention includes a memory and a processor. When the processor executes the program stored in the memory, it can implement the steps of the data query method provided in the above embodiment, and the effect is the same as above.

[0277] An embodiment of the present invention provides a non-volatile storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the data query method provided in any one of the above embodiments can be implemented.

[0278] The non-volatile storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.

[0279] For the introduction of the non-volatile storage medium provided in the embodiment of the present invention, please refer to the above method embodiment, and the effect thereof is the same as the data query method provided in the embodiment of the present invention, and the present invention will not elaborate on it here.

[0280] An embodiment of the present invention provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the data query method provided in any one of the above embodiments.

[0281] For an introduction to the computer program product provided by the embodiment of the present invention, please refer to the above method embodiment, and the effect thereof is the same as the data query method provided by the embodiment of the present invention, and the present invention will not elaborate on it here.

[0282] The above is a detailed introduction to a data query method, device, storage medium and computer program product provided by the present invention. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the embodiments can be referred to each other. For the devices, equipment, non-volatile storage media and computer program products disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present invention, the present invention can also be improved and modified in a number of ways, and these improvements and modifications also fall within the scope of protection of the present invention.

[0283] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

Claims

1. A data query method, characterized in that: include: Obtaining the text data to be processed, entity naming sample dataset, and entity relationship recognition sample dataset in the target domain; Extracting mapping data of knowledge and context information from the input text data to be processed in sequence based on the entity naming sample data set and the entity relationship recognition sample data set using a pre-trained language model, and updating the entity naming sample data set and the entity relationship recognition sample data set using the mapping data during the extraction process; the knowledge includes entity names and relationships between entities; Constructing a knowledge graph of the target domain according to the entity names and the relationships between the entities; Constructing entity disambiguation task prompt words and inputting them into the pre-trained language model to perform entity disambiguation processing on the entity name to obtain an entity disambiguation result; Constructing an entity linking task prompt word and inputting it into the pre-trained language model to perform entity linking processing on the entity name to obtain an entity linking result; Updating the knowledge graph using the entity disambiguation result and the entity linking result; Based on the knowledge graph, a data query task in the target field is performed to obtain a data query result.

2. The data query method according to claim 1, characterized in that: Acquiring the text data to be processed includes: Collecting original text data of the target field; The original text data is processed into blocks according to the semantic preservation block configuration parameter and the priority block configuration parameter to obtain the text block data to be processed; The to-be-processed text block data is taken as the to-be-processed text data.

3. The data query method according to claim 2, characterized in that: The block processing of the original text data according to the semantic preservation block configuration parameter and the priority block configuration parameter to obtain the to-be-processed text block data includes: Identify segmentation keywords from the original text data; If the block keywords do not exist in the original text data, dividing the original text data into meaning units using natural language processing technology; If the block keyword exists in the original text data, the original text data is divided into the meaning units by using the block keyword as a block priority parameter and adopting natural language processing technology; Context information is added to the meaning unit according to the record of the original text data to obtain the text block data to be processed.

4. The data query method according to claim 2, characterized in that: The block processing of the original text data according to the semantic preservation block configuration parameter and the priority block configuration parameter to obtain the to-be-processed text block data includes: Identifying a target entity name from the original text data; The original text data is processed in blocks according to the occurrence frequency of the target entity name to obtain the text block data to be processed.

5. The data query method according to claim 1, characterized in that: Extracting mapping data of knowledge and context information from the input text data to be processed based on the entity naming sample data set and the entity relationship recognition sample data set in turn using a pre-trained language model, and updating the entity naming sample data set and the entity relationship recognition sample data set using the mapping data during the extraction process, including: The text data to be processed is constructed as prompt words for an entity naming task and input into the pre-trained language model, so that the pre-trained language model extracts the entity name and corresponding context information from the text data to be processed according to the entity naming sample data set; The text data to be processed and the entity name are constructed as prompt words for entity relationship recognition task and input into the pre-trained language model, so that the pre-trained language model extracts entity relationship triple data and corresponding context information from the text data to be processed according to the entity relationship recognition sample data set.

6. The data query method according to claim 5, characterized in that: The text data to be processed is constructed as prompt words for an entity naming task and input into the pre-trained language model, so that the pre-trained language model extracts the entity name and corresponding context information from the text data to be processed according to the entity naming sample data set, including: Retrieving relevant entity naming samples from the entity naming sample data set based on the text data to be processed using a text similarity algorithm; Constructing the entity naming task prompt words using the text data to be processed and the relevant entity naming samples; The entity naming task prompt word is input into the pre-trained language model, so that the pre-trained language model extracts the entity name and the corresponding context information from the text data to be processed according to the relevant entity naming sample.

7. The data query method according to claim 5, characterized in that: The text data to be processed and the entity name are constructed as prompt words for entity relationship recognition task and input into the pre-trained language model, so that the pre-trained language model extracts entity relationship triple data and corresponding context information from the text data to be processed according to the entity relationship recognition sample data set, including: Retrieving relevant entity relationship recognition samples from the entity relationship recognition sample data set based on the text data to be processed and the entity name using a text similarity algorithm; Constructing the entity relationship recognition task prompt words using the text data to be processed and the relevant entity relationship recognition samples; The entity relationship recognition task prompt words are input into the pre-trained language model so that the pre-trained language model extracts the entity relationship triple data and corresponding context information from the text data to be processed according to the relevant entity relationship recognition samples.

8. The data query method according to claim 1, characterized in that: Constructing entity disambiguation task prompt words and inputting them into the pre-trained language model to perform entity disambiguation processing on the entity name to obtain entity disambiguation results, including: Calculating a similarity score for each of the entity names, listing a plurality of the entity names having a similarity score greater than a first similarity threshold as a group of entity names to be disambiguated, to obtain a group of entity names to be disambiguated; Obtaining context information corresponding to each of the entity names to be disambiguated; The entity disambiguation task prompt words are constructed using the group of entity names to be disambiguated and the corresponding context information, the entity disambiguation task prompt words are input into the pre-trained language model to perform entity disambiguation on the entity names to be disambiguated, and the disambiguated entity names are output as the entity disambiguation results of the group of entity names to be disambiguated.

9. The data query method according to claim 8, characterized in that: The entity disambiguation task prompt word is constructed with the to-be-disambiguated entity name group and the corresponding context information, the entity disambiguation task prompt word is input into the pre-trained language model to perform entity disambiguation processing on the to-be-disambiguated entity name, and the entity disambiguation result in which the disambiguated entity name is the to-be-disambiguated entity name group is outputted, including: The entity disambiguation task prompt words are constructed with the disambiguation reasoning process task, the group of entity names to be disambiguated and the corresponding context information, and the entity disambiguation task prompt words are input into the pre-trained language model so that the pre-trained language model outputs the disambiguation reasoning basis corresponding to the entity disambiguation result while outputting the entity disambiguation result.

10. The data query method according to claim 1, characterized in that: Constructing an entity linking task prompt word and inputting the pre-trained language model to perform entity linking processing on the entity name to obtain an entity linking result, including: Calculating a similarity score between the identified entity name to be linked and the entity name in the knowledge graph, and listing the entity name having a similarity score greater than a second similarity threshold as a candidate entity name; Extracting a knowledge subgraph of the candidate entity name from the knowledge graph, and obtaining context information corresponding to the knowledge subgraph of the candidate entity name; Constructing the entity linking task prompt word according to the to-be-linked entity name, the candidate entity name, the knowledge subgraph of the candidate entity name and the corresponding context information; The entity linking task prompt word is input into the pre-trained language model to perform entity linking processing on the entity name to be linked and the candidate entity name, and a matching result between the entity name to be linked and the candidate entity name is output as the entity linking result.

11. The data query method according to claim 10, characterized in that: Constructing the entity linking task prompt word according to the to-be-linked entity name, the candidate entity name, the knowledge subgraph of the candidate entity name and the corresponding context information, including: Constructing the entity linking task prompt word by linking the reasoning process task, the to-be-linked entity name, the candidate entity name, the knowledge subgraph of the candidate entity name and the corresponding context information; Inputting the entity linking task prompt word into the pre-trained language model to perform entity linking processing on the to-be-linked entity name and the candidate entity name, and outputting a matching result between the to-be-linked entity name and the candidate entity name as the entity linking result, including: The entity linking task prompt word is input into the pre-trained language model, so that the pre-trained language model outputs the linking reasoning basis corresponding to the entity linking result while outputting the entity linking result.

12. The data query method according to claim 1, characterized in that: The entity naming sample data set is constructed based on the input entity naming seed annotation sample initialization; The entity relationship recognition sample data set is constructed based on the initialization of the input entity relationship recognition seed annotation samples.

13. A data query device, characterized in that: include: Memory for storing computer programs; A processor is used to execute the computer program, and when the computer program is executed by the processor, the steps of the data query method according to any one of claims 1 to 12 are implemented.

14. A non-volatile storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the data query method according to any one of claims 1 to 12 are implemented.

15. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the data query method according to any one of claims 1 to 12 are implemented.