Entity alignment method and device based on multi-round reading understanding

文档序号:1816621 发布日期:2021-11-09 浏览:9次 中文

阅读说明:本技术 一种基于多轮阅读理解的实体对齐方法及装置 (Entity alignment method and device based on multi-round reading understanding ) 是由 邓礼志 于皓 张�杰 吴信东 吴明辉 于 2021-08-18 设计创作,主要内容包括:本发明涉及一种基于多轮阅读理解的实体对齐方法及装置,该方法包括:对原始文本进行NER处理,得到至少一个实体及其类别标签;基于类别标签分别构造每个实体对应的问句,并从标准实体库中召回该实体的候选词作为各个问句的选项;分别将各个问句及对应的选项输入预先训练的文本分类模型,得到原始文本当中不同实体的各个候选词的关联度评分,根据评分结果确定一个实体的对齐结果,完成该实体的对齐工作;按照完成对齐的实体更新问句,并迭代执行上一步,直到完成原始文本所有实体的对齐工作,最后输出结果。本发明通过多轮阅读理解的方式,再进行后续实体对齐的时候引入已对齐实体的结果信息,能够提高实体对齐的效果。(The invention relates to an entity alignment method and device based on multi-round reading understanding, wherein the method comprises the following steps: performing NER processing on the original text to obtain at least one entity and a category label thereof; constructing question sentences corresponding to each entity respectively based on the category labels, and recalling candidate words of the entities from a standard entity library as options of each question sentence; inputting each question sentence and the corresponding option into a pre-trained text classification model respectively to obtain the relevance grade of each candidate word of different entities in the original text, determining the alignment result of one entity according to the grade result, and finishing the alignment work of the entity; and updating the question sentence according to the aligned entities, iteratively executing the previous step until the alignment work of all the entities of the original text is completed, and finally outputting the result. According to the invention, the result information of the aligned entity is introduced when the subsequent entity alignment is carried out in a multi-round reading and understanding mode, so that the entity alignment effect can be improved.)

1. An entity alignment method based on multi-round reading understanding is characterized by comprising the following steps:

performing NER processing on the original text to obtain at least one entity and a category label thereof;

constructing question sentences corresponding to each entity respectively based on the category labels, and recalling candidate words of the entities from a standard entity library as options of each question sentence;

inputting each question sentence and the corresponding option into a pre-trained text classification model respectively to obtain the relevance scores of each candidate word of different entities in the original text, determining the alignment result of one entity according to the score results, and finishing the alignment work of the entity;

and updating the question sentence according to the aligned entities, iteratively executing the previous step until the alignment work of all the entities of the original text is completed, and finally outputting the result.

2. The method according to claim 1, wherein the constructing a question sentence corresponding to each entity based on the category label includes:

and aiming at each entity, replacing the entity in the original sentence by the question word corresponding to the category label of the entity to construct a question sentence.

3. The method of claim 1, wherein determining an alignment result of an entity based on the scoring result comprises:

and selecting the candidate word with the highest score as the alignment result of the corresponding entity.

4. A method according to any of claims 1-3, characterized in that the text classification model uses the bert model.

5. An entity alignment apparatus based on multi-round reading understanding, comprising:

the entity identification module is used for carrying out NER processing on the original text to obtain at least one entity and a category label thereof;

the question construction and option recall module is used for respectively constructing a question corresponding to each entity based on the category label and recalling candidate words of the entity from a standard entity library as options of each question;

the entity alignment module is used for inputting each question and corresponding options into a pre-trained text classification model respectively to obtain the relevance scores of candidate words of different entities in the original text, determining the alignment result of one entity according to the score results and finishing the alignment work of the entity;

and the iteration module is used for updating the question according to the aligned entities, and iteratively calling the entity alignment module until the alignment work of all the entities of the original text is completed, and finally outputting the result.

6. The apparatus of claim 5, wherein the question construction and option recall module is specifically configured to:

and aiming at each entity, replacing the entity in the original sentence by the question word corresponding to the category label of the entity to construct a question sentence.

7. The apparatus of claim 5, wherein the entity alignment module is specifically configured to:

and selecting the candidate word with the highest score as the alignment result of the corresponding entity.

8. The apparatus according to any one of claims 5-7, wherein said text classification model employs a bert model.

9. A terminal device, comprising:

a processor; and

a memory having executable code stored thereon, which when executed by the processor, causes the processor to perform the method of any one of claims 1-4.

10. A non-transitory machine-readable storage medium having executable code stored thereon, wherein the executable code, when executed by a processor of an electronic device, causes the processor to perform the method of any of claims 1-4.

Technical Field

The invention relates to the field of entity alignment in text processing, in particular to an entity alignment method and device based on multi-round reading understanding.

Background

In this era of data explosion, knowledge extraction is particularly important. However, the same concept may have different expressions and the same expression may have different concepts. How to better solve the problems of word ambiguity and multi-word ambiguity becomes a problem to be solved urgently.

At present, a more traditional method for solving the problem is to perform entity alignment by using a rule dictionary, an edit distance, a TFIDF and other feature extraction methods. The scheme mainly depends on indexing on the basis that the same word exists before and after alignment, and completely cannot identify completely different entity segments.

The other technology is that a latest strong pre-training language model or a graph neural network model is used for carrying out feature representation learning on entity description contents in a reference and knowledge base, and then the similarity of the features of the reference and knowledge base is calculated to carry out judgment on the relevance closeness.

Disclosure of Invention

Aiming at the problems in the prior art, the invention provides an entity alignment method and device based on multi-round reading understanding, which further improve the recognition accuracy of the technology of entity alignment by fully utilizing the priori knowledge of aligned entities and category information and utilizing the technical means of reading understanding, are beneficial to the intellectualization of text understanding and serve a dialog system and a search engine.

According to a first aspect of the embodiments of the present invention, there is provided an entity alignment method based on multi-round reading understanding, including:

performing NER processing on the original text to obtain at least one entity and a category label thereof;

constructing question sentences corresponding to each entity respectively based on the category labels, and recalling candidate words of the entities from a standard entity library as options of each question sentence;

inputting each question sentence and the corresponding option into a pre-trained text classification model respectively to obtain the relevance scores of each candidate word of different entities in the original text, determining the alignment result of one entity according to the score results, and finishing the alignment work of the entity;

and updating the question sentence according to the aligned entities, iteratively executing the previous step until the alignment work of all the entities of the original text is completed, and finally outputting the result.

Further, the constructing a question corresponding to each entity based on the category label specifically includes:

and aiming at each entity, replacing the entity in the original sentence by the question word corresponding to the category label of the entity to construct a question sentence.

Further, the determining an alignment result of an entity according to the scoring result specifically includes:

and selecting the candidate word with the highest score as the alignment result of the corresponding entity.

Further, the text classification model adopts a bert model.

According to a second aspect of the embodiments of the present invention, there is provided an entity alignment apparatus based on multi-round reading understanding, including:

the entity identification module is used for carrying out NER processing on the original text to obtain at least one entity and a category label thereof;

the question construction and option recall module is used for respectively constructing a question corresponding to each entity based on the category label and recalling candidate words of the entity from a standard entity library as options of each question;

the entity alignment module is used for inputting each question and corresponding options into a pre-trained text classification model respectively to obtain the relevance scores of candidate words of different entities in the original text, determining the alignment result of one entity according to the score results and finishing the alignment work of the entity;

and the iteration module is used for updating the question sentence according to the aligned entities, iteratively executing the previous step until the alignment work of all the entities of the original text is completed, and finally outputting the result.

Further, the question construction and option recall module is specifically configured to:

and aiming at each entity, replacing the entity in the original sentence by the question word corresponding to the category label of the entity to construct a question sentence.

Further, the entity alignment module is specifically configured to:

and selecting the candidate word with the highest score as the alignment result of the corresponding entity.

Further, the text classification model adopts a bert model.

According to a third aspect of the embodiments of the present invention, there is provided a terminal device, including:

a processor; and

a memory having executable code stored thereon, which when executed by the processor, causes the processor to perform the method as described above.

According to a fourth aspect of embodiments of the present invention, there is provided a non-transitory machine-readable storage medium having stored thereon executable code, which when executed by a processor of an electronic device, causes the processor to perform the method as described above.

The technical scheme provided by the embodiment of the invention can have the following beneficial effects:

on one hand, based on the thought of reading understanding, the prior information of the category of the entity behind the NER is fully utilized, on the other hand, the result information of the aligned entity is introduced when the subsequent entity alignment is carried out through a multi-round reading understanding mode, the effect of entity alignment can be improved, and the knowledge extraction work in the big data era can be better completed.

It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention, as claimed.

Drawings

The above and other objects, features and advantages of the present invention will become more apparent by describing in more detail exemplary embodiments thereof with reference to the attached drawings, in which like reference numerals generally represent like parts throughout.

Fig. 1 is a flowchart of an entity alignment method based on multi-round reading understanding according to an embodiment of the present invention.

Detailed Description

Preferred embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While the preferred embodiments of the present invention are shown in the drawings, it should be understood that the present invention may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.

The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in this specification and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.

It is to be understood that, although the terms first, second, third, etc. may be used herein to describe various information, such information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present invention. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the present invention, "a plurality" means two or more unless specifically defined otherwise.

The technical solutions of the embodiments of the present invention are described in detail below with reference to the accompanying drawings.

Referring to fig. 1, an entity alignment method based on multi-round reading understanding provided by an embodiment of the present invention includes the following steps:

step 1: performing NER (Named Entity Recognition) processing on the original text to obtain at least one Entity and a category label thereof;

for example, the original text is that "in the french open game, sara boy finally wins over lina", and after processing, the "match: france, figure: sara bow, lina ". The NER method of this step is not limited and is not the subject of this patent.

Step 2: constructing question sentences corresponding to each entity respectively based on the category labels, and recalling candidate words of the entities from a standard entity library as options of each question sentence;

optionally, step 2 specifically includes: and aiming at each entity, replacing the entity in the original sentence by the question word corresponding to the category label of the entity to construct a question sentence.

The purpose of this step is to construct a question for reading and understanding the task, and recall the entity candidate words from the standard entity library, so as to calculate the relevance result of different entity candidate words and question through model selection in the following. The recall method in this step is not limited and is not the subject matter of this patent.

Taking "sara boy finally defeats lina in france open contest" as an example, 3 questions are constructed as follows:

"in which race sara eventually competed for lina", the option is the outcome of the recall: "A: french tennis public event B: french badminton tournament.

"who has finally won lina in france" option is the result of a recall: "A: lin da sara boy (writer) B: maria, Sarah doll (tennis player).

"in the middle of the French public race, who is the end of the conquer doll, the option is the result of a recall: "A: lina (tennis player) B: lina (actress.) -.

And step 3: inputting each question sentence and the corresponding option into a pre-trained text classification model respectively to obtain the relevance scores of each candidate word of different entities in the original text, determining the alignment result of one entity according to the score results, and finishing the alignment work of the entity;

optionally, in this step, the determining an alignment result of an entity according to the scoring result specifically includes:

and selecting the candidate word with the highest score as the alignment result of the corresponding entity.

For example, the relevance scores of the choices among the 3 questions in step 2 are (1) a 0.5B 0.5(2) a 0.2B 0.8(3) a 0.6B 0.4 respectively, wherein the score of the B choice in the 2 nd question is 0.8, which exceeds the highest scores of the choices of the other questions by 0.6 and 0.5, so that the second question selects the B choice as the answer to be harvested in the first round of reading understanding, thereby aligning the entity "saraBowa" in the original text to the standard entity "Maria-Sabowa (tennis player)".

Alternatively, in this embodiment, the text classification model may employ a bert model. When the bert model is used, training data needs to be constructed according to the input format of the bert, for example, as follows:

inputting: [ CLS ] in [ French public offer game ], Sarbowa has finally won who [ SEP ] French tennis open game [ SEP ]

And (3) outputting: 1

Inputting: [ CLS ] in [ French public race ], Sarbowa has finally won who [ SEP ] French badminton public race [ SEP ]

And (3) outputting: 0

Thus, the bert model can give a prediction score for each candidate word for the input question, for example:

inputting: [ CLS ] in the French tennis public race, Maria, Sara boy (tennis player) has finally won? [ SEP ] Lina (tennis athlete) [ SEP ]

And (3) prediction: fraction between 0 and 1

Candidate word association degree scores of different entities in the original text are obtained through a bert model, and the highest score is selected as an answer for the first round of reading understanding.

And 4, step 4: and updating the question sentence according to the aligned entities, iteratively executing the previous step until the alignment work of all the entities of the original text is completed, and finally outputting the result.

Specifically, based on the first answer obtained in step 3, if the alignment of all entities is not completed, the iteration of steps 2 and 3 is performed. The specific question is updated as follows:

(1) "in which match Maria-Sarafla (tennis player) finally competed with Lina", the option was the result of a recall: "A: french tennis public event B: french badminton tournament.

(2) "who the Maria, Saraflobowa (tennis player) finally competed for in the French public race", the option is the result of a recall: "A: lina (tennis player) B: lina (actress.) -.

And (3) for other details, referring to steps 2 and 3, continuously iterating until the alignment work of all entities of the original text is finished, and finally outputting the result.

In this step, the prior knowledge of aligned fragment in the text is fully utilized, so that the alignment work of the subsequent fragment can be assisted, and the accuracy of the model can be improved. For example, "sara boy finally defeats lina in a france tournament," sara boy is known to mean the tennis player "maliya sara boy" in the previous step, and then it will be easier to know "lina" and also mean the tennis player "lina" by using the prior knowledge.

Correspondingly to the above method embodiment, an embodiment of the present invention provides an entity alignment apparatus based on multi-round reading understanding, including:

the entity identification module is used for carrying out NER processing on the original text to obtain at least one entity and a category label thereof;

the question construction and option recall module is used for respectively constructing a question corresponding to each entity based on the category label and recalling candidate words of the entity from a standard entity library as options of each question;

the entity alignment module is used for inputting each question and corresponding options into a pre-trained text classification model respectively to obtain the relevance scores of candidate words of different entities in the original text, determining the alignment result of one entity according to the score results and finishing the alignment work of the entity;

and the iteration module is used for updating the question sentence according to the aligned entities, iteratively executing the previous step until the alignment work of all the entities of the original text is completed, and finally outputting the result.

Optionally, in this embodiment, the question constructing and option recalling module is specifically configured to:

and aiming at each entity, replacing the entity in the original sentence by the question word corresponding to the category label of the entity to construct a question sentence.

Optionally, in this embodiment, the entity alignment module is specifically configured to:

and selecting the candidate word with the highest score as the alignment result of the corresponding entity.

Optionally, in this embodiment, the text classification model adopts a bert model.

With regard to the system in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.

The method of the present invention may be implemented as a computing device comprising a memory and a processor.

The Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.

The memory may include various types of storage units such as system memory, Read Only Memory (ROM), and permanent storage. Wherein the ROM may store static data or instructions that are required by the processor or other modules of the computer. The persistent storage device may be a read-write storage device. The persistent storage may be a non-volatile storage device that does not lose stored instructions and data even after the computer is powered off. In some embodiments, the persistent storage device employs a mass storage device (e.g., magnetic or optical disk, flash memory) as the persistent storage device. In other embodiments, the permanent storage may be a removable storage device (e.g., floppy disk, optical drive). The system memory may be a read-write memory device or a volatile read-write memory device, such as a dynamic random access memory. The system memory may store instructions and data that some or all of the processors require at runtime. Further, the memory may comprise any combination of computer-readable storage media, including various types of semiconductor memory chips (DRAM, SRAM, SDRAM, flash memory, programmable read-only memory), magnetic and/or optical disks, may also be employed. In some embodiments, the memory may include a removable storage device that is readable and/or writable, such as a Compact Disc (CD), a read-only digital versatile disc (e.g., DVD-ROM, dual layer DVD-ROM), a read-only Blu-ray disc, an ultra-dense optical disc, a flash memory card (e.g., SD card, min SD card, Micro-SD card, etc.), a magnetic floppy disc, or the like. Computer-readable storage media do not contain carrier waves or transitory electronic signals transmitted by wireless or wired means.

The memory has stored thereon executable code which, when processed by the processor, causes the processor to perform some or all of the methods described above.

Furthermore, the method according to the invention may also be implemented as a computer program or computer program product comprising computer program code instructions for carrying out some or all of the steps of the above-described method of the invention.

Alternatively, the invention may also be embodied as a non-transitory machine-readable storage medium (or computer-readable storage medium, or machine-readable storage medium) having stored thereon executable code (or a computer program, or computer instruction code) which, when executed by a processor of an electronic device (or computing device, server, etc.), causes the processor to perform part or all of the various steps of the above-described method according to the invention.

The aspects of the invention have been described in detail hereinabove with reference to the drawings. In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments. Those skilled in the art should also appreciate that the acts and modules referred to in the specification are not necessarily required by the invention. In addition, it can be understood that the steps in the method according to the embodiment of the present invention may be sequentially adjusted, combined, and deleted according to actual needs, and the modules in the device according to the embodiment of the present invention may be combined, divided, and deleted according to actual needs.

Those of skill would further appreciate that the various illustrative logical blocks, modules, circuits, and algorithm steps described in connection with the disclosure herein may be implemented as electronic hardware, computer software, or combinations of both.

The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems and methods according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.

Having described embodiments of the present invention, the foregoing description is intended to be exemplary, not exhaustive, and not limited to the embodiments disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen in order to best explain the principles of the embodiments, the practical application, or improvements made to the technology in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.

10页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种知识库中知识的自动关联方法及装置

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!