A method and device for completing incomplete corpus
By parsing entity relationship expressions in voice interaction and using the seed relationship library for matching and completion, the problem of low accuracy in corpus completion is solved, high-accuracy corpus completion and expansion of the seed relationship library are achieved, and correct feedback is ensured and subsequent completion capabilities.
Patent Information
- Application Number
- CN201910365369.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-04-30
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2039-04-30
AI Technical Summary
In the existing technology, in voice interaction, the accuracy of corpus completion is not high, and it is easy to answer questions that are not asked.
By collecting user corpus, parsing and generating entity relationship expressions, determining whether there are incomplete character entities, and performing matching and completion in the pre-stored seed relationship library, including searching for target seeds, obtaining target seed relationship sets, and matching relationship expressions to complete Entity relationship expressions.
The accuracy of corpus completion is improved, user information can be correctly fed back, and the seed relationship library is expanded without being incomplete to enhance subsequent completion capabilities.
Smart Images

Figure CN111858867B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of natural language processing, and in particular to a method and device for completing incomplete corpus. Background Art
[0002] With the rapid development of network technology, smart terminals are gradually designing all aspects of people's lives. With the increasing maturity of artificial intelligence-related technologies, the intelligence of various terminals is also getting higher and higher. As one of the mainstream interaction methods in smart terminal applications, voice interaction has greatly facilitated the use of various users. For example, in the use of various tutoring machines and learning machines, children can ask various questions they don't understand to the tutoring machine and learning machine through voice, and then the learning machine will give the children corresponding responses.
[0003] In response to user questions, smart devices often need to first collect the question information and then complete the question corpus information in order to provide timely feedback to the user and answer the user's questions. The conventional completion method mainly determines the completeness of the part of speech in the sentence after word segmentation, which has a low accuracy rate and can easily result in irrelevant answers. Summary of the invention
[0004] In order to solve the above technical problems, the present invention provides a method and device for completing incomplete corpus. Specifically, the technical solution of the present invention is as follows:
[0005] On the one hand, the present invention discloses a method for completing incomplete corpus, comprising:
[0006] Collect user corpus;
[0007] Parsing the corpus to obtain corresponding entity relationship expression sentences;
[0008] Determining whether the entity relationship expression sentence contains missing person entities;
[0009] When it is determined that the entity relationship expression sentence has an incomplete person entity, the entity relationship expression sentence is matched in a pre-stored seed relationship library to complete the entity relationship expression sentence.
[0010] Preferably, matching the entity relationship expression sentence in a pre-stored seed relationship library, and completing the entity relationship expression sentence specifically includes:
[0011] According to the person entities already in the entity relationship expression sentence, a target seed is searched in a seed relationship library, wherein the target seed contains a person entity pair, and one of the person entities in the person entity pair is a person entity already in the entity relationship expression sentence;
[0012] Acquire a corresponding target seed relationship set according to the target seed; the target seed relationship set includes a plurality of relationship expressions;
[0013] Matching the relational expressions contained in the entity relation expression sentence in the target seed relation set;
[0014] When the relational expression included in the entity relation expression sentence matches the same relational expression in the target seed relation set, the entity relation expression sentence is completed according to the person entity pairs included in the seeds corresponding to the target seed relation set.
[0015] Preferably, before collecting user corpus, the method further includes:
[0016] Construct and store a seed relationship library, wherein the seed relationship library contains N seeds and corresponding seed relationship sets; specifically, the library includes:
[0017] Define a seed containing person entity pairs;
[0018] Extracting content containing person entity pairs in the seed from the collected documents;
[0019] Obtain a seed relationship expression according to the extracted content containing the seed entity pair;
[0020] According to the obtained seed relationship expression, a seed relationship set corresponding to the seed is established;
[0021] All defined seeds and their corresponding seed relationship sets are stored in the seed relationship library.
[0022] Preferably, the method for completing the incomplete corpus further includes:
[0023] When it is determined that the entity relationship expression sentence does not contain incomplete person entities, extracting the person entity pairs and relationship expressions contained in the entity relationship sentence;
[0024] Searching in the seed relationship library whether there is a target seed containing the extracted person entity pair;
[0025] When it is determined that the target seed containing the extracted person entity pair does not exist in the seed relationship library, the extracted person entity pair is used as a new seed in the seed relationship library, and a seed relationship set of the new seed is established, and the seed relationship set of the new seed contains the relationship expression contained in the entity relationship expression sentence.
[0026] Preferably, the method for completing the incomplete corpus further includes:
[0027] When it is determined that there is a target seed containing the extracted person entity pair in the seed relationship library, obtaining a target seed relationship set corresponding to the target seed;
[0028] Matching the relational expressions contained in the entity relation expression sentence in the target seed relation set;
[0029] When the relation expression extracted from the entity relation expression sentence does not match the same relation expression in the target seed relation set, the relation expression included in the entity relation expression sentence is expanded into the target seed relation set.
[0030] On the other hand, the present invention also discloses a device for completing incomplete corpus, comprising:
[0031] Corpus collection module, used to collect user corpus;
[0032] A corpus parsing module, used to parse the corpus to obtain corresponding entity relationship expression sentences;
[0033] An incompleteness judgment module is used to judge whether the entity relationship expression sentence has a person entity incompleteness;
[0034] The corpus completion module is used to match the entity relationship expression sentence in a pre-stored seed relationship library to complete the entity relationship expression sentence when it is determined that the entity relationship expression sentence has incomplete character entities.
[0035] Preferably, the corpus completion module includes:
[0036] A seed search submodule, used to search for a target seed in a seed relationship library according to the person entities already in the entity relationship expression sentence, wherein the target seed includes a person entity pair, and one of the person entities in the person entity pair is a person entity already in the entity relationship expression sentence;
[0037] A relation matching submodule is used to obtain a corresponding target seed relation set according to the target seed; the target seed relation set includes a plurality of relation expressions; and the relation expressions included in the entity relation expression sentence are matched in the target seed relation set;
[0038] The completion submodule is used to complete the entity relationship expression sentence according to the person entity pairs contained in the seed corresponding to the target seed relationship set when the relationship expression contained in the entity relationship expression sentence matches the same relationship expression in the target seed relationship set.
[0039] Preferably, the incomplete corpus completion device further comprises:
[0040] A storage module is constructed to construct and store a seed relationship library, wherein the seed relationship library contains N seeds and corresponding seed relationship sets; the storage module specifically includes:
[0041] The seed definition submodule is used to define seeds containing person entity pairs;
[0042] A content extraction submodule, for extracting content containing person entity pairs in the seed from the collected documents;
[0043] The expression generation submodule is used to obtain the seed relationship expression according to the extracted content containing the seed entity pair;
[0044] A collection submodule, used to establish a seed relationship set corresponding to the seed according to the obtained seed relationship expression;
[0045] The storage submodule is used to store all defined seeds and their corresponding seed relationship sets in the seed relationship library.
[0046] Preferably, the incomplete corpus completion device further comprises:
[0047] The extraction module is used to extract the person entity pairs and relationship expressions contained in the entity relationship sentence when it is determined that the entity relationship expression sentence does not contain incomplete person entities; so that the seed search submodule searches the seed relationship library for a target seed containing the extracted person entity pairs;
[0048] The expansion module is used to, when it is determined that there is no target seed containing the extracted person entity pair in the seed relationship library, use the extracted person entity pair as a new seed in the seed relationship library, and establish a seed relationship set of the new seed, wherein the seed relationship set of the new seed contains the relationship expression contained in the entity relationship expression sentence.
[0049] Preferably, the incomplete corpus completion device further comprises:
[0050] The seed search submodule is further configured to obtain a target seed relationship set corresponding to the target seed when it is determined that the target seed containing the extracted person entity pair exists in the seed relationship library;
[0051] The relationship matching submodule is further used to match the relationship expression included in the entity relationship expression sentence in the target seed relationship set;
[0052] The expansion module is also used to expand the relationship expression contained in the entity relationship expression sentence into the target seed relationship set when the relationship expression extracted from the entity relationship expression sentence does not match the same relationship expression in the target seed relationship set.
[0053] The present invention has at least one of the following technical effects:
[0054] (1) After collecting user corpus, the present invention parses the user corpus and generates corresponding relational expressions based on it. Then, if the relational expression is incomplete, the pre-stored seed relation library is used to match and complete it, so that the user can be responded to according to the completed information. The present invention can complete the user's incomplete corpus with a high accuracy rate, so that the user can be given correct feedback.
[0055] (2) In addition to completing incomplete user corpus, the present invention can also, when it is determined that the user corpus is not incomplete, add seeds in the seed relationship library and corresponding seed relationship sets when the target seed is not matched, or add relationship expressions to the target seed relationship sets when the target seed is matched but the relationship expression is not matched; this makes the seeds contained in the seed relationship library and the corresponding seed relationship sets more and more comprehensive, and also facilitates the subsequent better completion of incomplete corpus. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments 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 labor.
[0057] Figure 1 A flowchart of an embodiment of a method for completing incomplete corpus according to the present invention;
[0058] Figure 2 A flowchart of another embodiment of a method for completing incomplete corpus according to the present invention;
[0059] Figure 3 A flowchart of another embodiment of a method for completing incomplete corpus according to the present invention;
[0060] Figure 4 A flowchart of another embodiment of a method for completing incomplete corpus according to the present invention;
[0061] Figure 5 A flowchart of another embodiment of a method for completing incomplete corpus according to the present invention;
[0062] Figure 6 It is a structural block diagram of an embodiment of a device for completing incomplete corpus of the present invention;
[0063] Figure 7 It is a structural block diagram of another embodiment of a device for completing incomplete corpus according to the present invention;
[0064] Figure 8The present invention is a structural block diagram of another embodiment of a device for completing incomplete corpus according to the present invention.
[0065] Reference numerals:
[0066] 10--corpus collection module; 20--corpus parsing module; 30--incomplete judgment module; 40--corpus completion module; 41--seed search submodule; 42--relation matching submodule; 43--completion submodule; 50--construction storage module; 51--seed definition submodule 51; 52--content extraction submodule; 53--expression generation submodule; 54--collection submodule; 55--storage submodule; 60--extraction module; 70--expansion module. DETAILED DESCRIPTION
[0067] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0068] It should be understood that when used in this specification and the appended claims, the term "comprising" indicates the presence of the described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or collections.
[0069] In order to simplify the drawings, only the parts related to the present invention are schematically shown in each figure, and they do not represent the actual structure of the product. In addition, in order to simplify the drawings and facilitate understanding, in some figures, only one of the parts with the same structure or function is schematically drawn or marked. In this article, "one" not only means "only one", but also means "more than one".
[0070] It should be further understood that the term “and / or” used in the specification and appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0071] In a specific implementation, the terminal device described in the embodiments of the present application includes, but is not limited to, other portable devices such as mobile phones, laptop computers, tutoring machines, or tablet computers with touch-sensitive surfaces (e.g., touch screen displays and / or touch pads). It should also be understood that in some embodiments, the terminal device is not a portable communication device, but a desktop computer with a touch-sensitive surface (e.g., touch screen displays and / or touch pads).
[0072] In the following discussion, a terminal device including a display and a touch-sensitive surface is described. However, it should be understood that the terminal device may include one or more other physical user interface devices such as a physical keyboard, a mouse and / or a joystick.
[0073] The terminal device supports various applications, such as one or more of the following: a drawing application, a presentation application, a network creation application, a word processing application, a disk burning application, a spreadsheet application, a game application, a telephone application, a video conferencing application, an email application, an instant messaging application, a workout support application, a photo management application, a digital camera application, a digital camcorder application, a Web browsing application, a digital music player application, and / or a digital video player application.
[0074] Various applications that can be executed on the terminal device can use at least one common physical user interface device such as a touch-sensitive surface. One or more functions of the touch-sensitive surface and corresponding information displayed on the terminal can be adjusted and / or changed between applications and / or within corresponding applications. In this way, the common physical architecture of the terminal (e.g., the touch-sensitive surface) can support various applications with user interfaces that are intuitive and transparent to the user.
[0075] In addition, in the description of the present application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0076] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the specific implementation methods of the present invention will be described below with reference to the accompanying drawings. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings and other implementation methods can be obtained based on these drawings without creative work.
[0077] The present invention discloses a method for completing incomplete corpus, which is implemented as follows: Figure 1As shown, the completion method can be applied to terminal devices (for example, learning machines, tutoring machines, etc. In this embodiment, for ease of understanding, the tutoring machine is used as the subject for explanation, but those skilled in the art understand that the completion method of the incomplete corpus can also be applied to other terminal devices as long as the corresponding functions can be realized). The completion method of the incomplete corpus includes the following steps:
[0078] S101, collecting user corpus;
[0079] Specifically, when learning, the user will place the learning machine in front of him. The learning machine is equipped with a microphone to collect the user's voice, thereby obtaining user corpus. For example, the collected user corpus is: Li Bai wrote a poem for whom.
[0080] S102, parsing the corpus to obtain corresponding entity relationship expression sentences;
[0081] Specifically, after obtaining the user corpus, it can be semantically parsed, and the entities and entity relationship events contained in the corpus information can be obtained, thereby generating the corresponding entity relationship expression sentence: Li Bai wrote a poem for ____.
[0082] S103, determining whether the entity relationship expression sentence has a missing character entity;
[0083] Specifically, it can be seen from the entity relationship expression sentence whether there is an incomplete person entity. For example, "Li Bai wrote a poem for ____". Obviously, there is a missing person entity object in the entity relationship expression sentence, that is, it is impossible to know who Li Bai wrote the poem for from the entity relationship expression sentence. It is incomplete, and it can be judged that the entity relationship expression sentence has an incomplete person entity.
[0084] S104, when it is determined that the entity relationship expression sentence has an incomplete person entity, the entity relationship expression sentence is matched in a pre-stored seed relationship library to complete the entity relationship expression sentence.
[0085] Specifically, when it is determined that there is an incomplete person entity in the entity relationship expression sentence, then the incomplete entity needs to be completed. How to complete it? This requires matching in the pre-stored seed relationship library. The seed relationship library here contains many seeds, and each seed corresponds to a seed relationship set; each seed is composed of a pair of entity pairs. When matching, specifically, the corresponding seed must be found in the seed relationship library first, and then the seed relationship set corresponding to the seed must be found. If a matching relationship expression is found in the seed relationship set, the missing entity relationship expression sentence can be completed based on the person entity pair in the seed of the seed relationship set, that is, the incomplete corpus of the user is completed. After completion, the tutoring machine can respond to the user based on the completed entity relationship expression sentence.
[0086] After collecting the user corpus, this embodiment parses the user corpus and generates a corresponding relational expression sentence based on it. Then, if the relational expression sentence is incomplete, it uses a pre-stored seed relationship library to match and complete it, so that the user can be responded to according to the completed information.
[0087] Another embodiment of the method of the present invention is as follows Figure 2 As shown, including:
[0088] S201, collecting user corpus;
[0089] S202, parsing the corpus to obtain corresponding entity relationship expression sentences;
[0090] S203, determining whether the entity relationship expression sentence has a missing person entity;
[0091] S204, when it is determined that the entity relationship expression sentence has an incomplete person entity, a target seed is searched in a seed relationship library according to the person entities already in the entity relationship expression sentence, wherein the target seed includes a person entity pair, and one of the person entities in the person entity pair is a person entity already in the entity relationship expression sentence;
[0092] Specifically, for example, the incomplete entity relationship expression sentence is "Li Bai wrote a poem for ____", based on the existing character entity "Li Bai" in the expression, the seed containing the character entity "Li Bai" can be found in the seed relationship library, for example, 3 target seeds are found: target seed 1 (the character entity pair contained is: "Li Bai, Du Fu"); target seed 2 ("Li Bai, Wang Lun"); target seed 3 ("Li Bai, Meng Haoran").
[0093] S205, acquiring a corresponding target seed relationship set according to the target seed; the target seed relationship set includes a plurality of relationship expressions;
[0094] Specifically, after obtaining the target seed, the corresponding target seed relationship set is obtained based on the target seed. Since each seed has a unique corresponding seed relationship set, the seed relationship set contains several relationship expressions with the person entity pairs in the seed as objects. For example, after finding the above three target seeds, the seed relationship set corresponding to each target seed can be found based on the target seed, thereby obtaining each relationship expression in each relationship set. Specifically, the target seeds and their relationship sets found in the seed relationship library are shown in the following table:
[0095]
[0096] Table 1. Correspondence table of target seeds and their relationship sets
[0097] S206, matching the relational expressions included in the entity relation expression sentence in the target seed relation set;
[0098] Specifically, after obtaining each relational expression in the target seed relational set, the relational expressions contained in the entity relational expression sentence are matched one by one. For example, the entity relational expression sentence is: Li Bai wrote a poem for ____; then the relational expression it contains is: (Li Bai) Wrote a poem for ___; first match it with the target seed 1 relationship set, and you can match the relationship expression in the target seed 1 relationship set: X once wrote a poem for Y. After matching, you can continue to match the subsequent target seeds and the corresponding seed relationship sets, because there may be multiple matching situations. For example, the relationship expression "X once wrote a poem for Y" in the target seed 2 relationship set is successfully matched.
[0099] S207, when the relational expression included in the entity relational expression sentence matches the same relational expression in the target seed relational set, the entity relational expression sentence is completed according to the person entity pairs included in the seeds corresponding to the target seed relational set.
[0100] Specifically, when the same relational expression is successfully matched in step S206, the corresponding seed is found according to the seed relational set where the matched relational expression is located, and the previously incomplete entity relational expression sentence can be completed according to the person entity pairs contained in the seed. For example, if the semantically identical relational expression sentence "X once wrote a poem for Y" is matched in the target seed 1 relational set, then according to the person entity pairs contained in the target seed 1 relational set: Li Bai, Du Fu, the previously incomplete entity relational expression sentence can be completed: "Li Bai wrote a poem for Du Fu".
[0101] Similarly, since the semantically identical relational expression sentence "X once wrote a poem for Y" is matched in the target seed 2 relation set, and based on the character entity pairs contained in the target seed 2 relation set: Li Bai and Wang Lun, the previously incomplete entity relational expression sentence can be completed: "Li Bai wrote a poem for Wang Lun ”.
[0102] Based on the completed entity relationship expression sentence above, a response can be given to the user. For example, feedback can be given to the user: "Li Bai once wrote a poem for Du Fu, and Li Bai also wrote a poem for Wang Lun."
[0103] Another embodiment of the method for completing incomplete corpus of the present invention is based on any of the above embodiments. Figure 3 As shown, including:
[0104] S301 constructs and stores a seed relationship library, wherein the seed relationship library includes N seeds and corresponding seed relationship sets;
[0105] S302, collecting user corpus;
[0106] S303, parsing the corpus to obtain corresponding entity relationship expression sentences;
[0107] S304, determining whether the entity relationship expression sentence has a missing person entity;
[0108] S305, when it is determined that the entity relationship expression sentence has an incomplete person entity, the entity relationship expression sentence is matched in a pre-stored seed relationship library to complete the entity relationship expression sentence.
[0109] The step S301 of constructing and storing the seed relationship database specifically includes:
[0110] S311, defining a seed including a person entity pair;
[0111] For example, the character entity pairs included in definition seed 1 are Li Bai and Du Fu; the character entity pairs included in definition seed 2 are Li Bai and Wang Lun; the character entity pairs included in definition seed 3 are Li Bai and Meng Haoran.
[0112] S312, extracting content containing the person entity pair in the seed from the collected documents;
[0113] Specifically, after a large number of documents are collected, relevant content can be extracted from the documents based on the person entity pairs contained in each seed. For example, based on the person entity pairs in seed 1, the following relevant content is extracted:
[0114] (1) Du Fu once publicly stated that he was good friends with Li Bai from Shandong;
[0115] (2) Li Bai and Du Fu met in Luocheng;
[0116] (3) Li Bai once wrote a poem for Du Fu.
[0117] S313, obtaining a seed relationship expression according to the extracted content containing the seed entity pair;
[0118] Specifically, after obtaining the extracted content related to the seed entity pair, the relevant seed relationship expression is obtained based on the extracted specific content. For example, the character entity pair contained in seed 1 is Li Bai and Du Fu; we use X to represent Li Bai and Y to represent Du Fu, and then obtain the corresponding seed expression based on the extracted relevant content:
[0119] (1) Du Fu once publicly stated that he was good friends with Li Bai from Shandong;
[0120] Corresponding relational expression: X once publicly stated that he had a good relationship with Shandong Y.
[0121] (2) Li Bai and Du Fu met in Luocheng;
[0122] Corresponding relational expression: X and Y meet in Los Angeles
[0123] (3) Li Bai once wrote a poem for Du Fu.
[0124] Corresponding relational expression: X once wrote a poem for Y
[0125] S314, establishing a seed relationship set corresponding to the seed according to the obtained seed relationship expression;
[0126] Then, the obtained seed relationship expressions are collected to establish the seed relationship set corresponding to the seed. For example, the seed relationship set of seed 1 is established, which contains three relationship expressions: "X once publicly expressed that he was good friends with Shandong Y"; "X and Y met in Luocheng"; and "X once wrote a poem to Y".
[0127] S315, storing all defined seeds and their corresponding seed relationship sets in a seed relationship library.
[0128] Another embodiment of the method of the present invention, based on any of the above embodiments, adds a step of expanding the seed relationship library, specifically, Figure 4 As shown, including:
[0129] S401, collecting user corpus;
[0130] S402, parsing the corpus to obtain corresponding entity relationship expression sentences;
[0131] S403, determining whether the entity relationship expression sentence contains any missing person entity; if so, proceeding to step S404; otherwise, proceeding to step S405;
[0132] S404, matching the entity relationship expression sentence in a pre-stored seed relationship library to complete the entity relationship expression sentence;
[0133] S405, extracting person entity pairs and relationship expressions contained in the entity relationship sentence;
[0134] Specifically, if the entity relationship sentence is complete and does not contain any missing person entities, then the person entity pairs and relationship expressions contained in the entity relationship sentence can be extracted from the entity relationship sentence; for example, the entity relationship expression sentence obtained from the user corpus is: "Li Bai wrote a poem for Meng Haoran". After judging, the entity relationship expression sentence does not contain any missing person entities and is a complete sentence, so the person entity pairs: Li Bai, Meng Haoran, and the entity relationship expression can be extracted from the entity relationship expression sentence: (Character entity a) Wrote a poem for (Character entity b) .
[0135] S406, searching in the seed relationship database whether there is a target seed containing the extracted person entity pair; if not, proceeding to step S407;
[0136] Specifically, after extracting the character entity pair and the corresponding entity relationship expression, the corresponding seed is searched in the seed relationship library based on the character entity pair, that is, to see whether there is a seed containing the character entity pair "Li Bai, Meng Haoran" in the seed relationship library.
[0137] S407, in the seed relationship library, taking the extracted person entity pair as a new seed, establishing a seed relationship set of the new seed, wherein the seed relationship set of the new seed includes the relationship expression included in the entity relationship expression sentence.
[0138] Specifically, if the target seed containing the extracted person entity pair is not found in the seed relationship library, then a new seed and a corresponding new seed relationship set need to be added to the seed relationship library. For example, if the seed containing the person entity pair "Li Bai, Meng Haoran" is not found in the existing seed relationship library, then a new seed needs to be added to the seed relationship library, and the person entity pair contained in the new seed is defined as "Li Bai, Meng Haoran"; and the seed relationship set of the new seed is established, and the relationship expression contained in the seed relationship set of the new seed is: X wrote a poem for Y. Among them, X represents Li Bai and Y represents Meng Haoran in the new seed relationship set.
[0139] Through the scheme of this embodiment, in addition to completing the incomplete user corpus, the seed relationship library can also be expanded when it is determined that the user corpus is not incomplete, so that the seeds contained in the seed relationship library and the corresponding seed relationship sets are more and more comprehensive, which is also convenient for subsequent better completion of the incomplete corpus.
[0140] Another embodiment of the method of the present invention, based on the previous embodiment, adds an expansion process of the relational expression in the seed relational set, specifically, Figure 5 As shown, including:
[0141] S501, collecting user corpus;
[0142] S502, parsing the corpus to obtain corresponding entity relationship expression sentences;
[0143] S503, determining whether the entity relationship expression sentence contains any missing person entity; if so, proceeding to step S504; otherwise, proceeding to step S505;
[0144] S504, matching the entity relationship expression sentence in a pre-stored seed relationship library to complete the entity relationship expression sentence;
[0145] S505, extracting person entity pairs and relationship expressions contained in the entity relationship sentence;
[0146] S506, searching in the seed relationship database whether there is a target seed containing the extracted person entity pair; if so, proceeding to step S508; if not, proceeding to step S507;
[0147] S507, in the seed relationship library, taking the extracted person entity pair as a new seed, establishing a seed relationship set of the new seed, wherein the seed relationship set of the new seed includes the relationship expression included in the entity relationship expression sentence.
[0148] S508, obtaining a target seed relationship set corresponding to the target seed;
[0149] Specifically, when a target seed containing a person entity pair extracted from an entity relationship expression sentence is found in the seed relationship library, the target seed relationship set corresponding to the target seed can be further obtained. For example, the entity relationship expression sentence "Li Bai wrote a poem for Meng Haoran" contains the person entity pairs: Li Bai, Meng Haoran; the entity relationship expression contained is: (Character entity a) Wrote a poem for (Character entity b)If a seed with the character entity pair "Li Bai, Meng Haoran" is found in the seed relationship database, then this seed is the target seed. Then, based on the target seed, its corresponding target seed relationship set can be obtained, and the existing relationship expressions in the target seed relationship set can be known.
[0150] S509, matching the relational expressions included in the entity relation expression sentence in the target seed relation set;
[0151] Specifically, the entity relationship expression contained in the entity relationship expression sentence is (Character entity a) Wrote a poem for (Character entity b) " is matched with each relational expression in the target seed relational set. If the target seed relational set contains two relational expressions, specifically, X represents Li Bai and Y represents Meng Haoran, the relational expressions it contains are as follows:
[0152] (1) X and Y met in Weiyang;
[0153] (2) Y invited X to meet him in Xiangyang.
[0154] After matching, the entity relationship expression in the entity relationship expression sentence is consistent with the entity relationship expression in the target seed relationship set.
[0155] The expression match failed.
[0156] S510: When the relation expression extracted from the entity relation expression sentence does not match the same relation expression in the target seed relation set, the relation expression included in the entity relation expression sentence is expanded into the target seed relation set.
[0157] Specifically, if the entity relationship expression in the entity relationship expression sentence fails to match the relationship expression in the target seed relationship set, the entity relationship expression in the entity relationship expression sentence can be expanded in the target seed relationship set. For example, the entity relationship expression sentence "Li Bai wrote a poem for Meng Haoran" and the entity relationship expression "X wrote a poem for Y" (similarly, according to the definition in the target seed relationship set, X represents Li Bai and Y represents Meng Haoran) are added to the target seed relationship set. Then, the seed containing the person entity pair "Li Bai, Meng Haoran" now contains three relationship expressions in its corresponding seed relationship set:
[0158] (1) X and Y met in Weiyang;
[0159] (2) Y had invited X to meet him in Xiangyang;
[0160] (3)X wrote a poem and gave it to Y.
[0161] Through the scheme of this embodiment, in addition to completing incomplete user corpus, when it is determined that the user corpus is not incomplete, if the target seed is not matched, new seeds in the seed relationship library and the corresponding seed relationship set can be added, or when the target seed is matched but the relationship expression is not matched, the relationship expression can be added to the target seed relationship set; this makes the seeds contained in the seed relationship library and the corresponding seed relationship set more and more comprehensive, and also facilitates the subsequent better completion of the incomplete corpus.
[0162] Based on the same technical concept, the present invention also discloses a device for completing incomplete corpus, which can use the method of the present invention to complete the incomplete corpus, thereby giving the user corresponding feedback. Figure 6 As shown, including:
[0163] The corpus collection module 10 is used to collect user corpus; specifically, the corpus collection module 10 can be implemented by a voice collection device such as a microphone. For example, the user corpus collected is: Who did Li Bai meet in Luocheng?
[0164] The corpus parsing module 20 is used to parse the corpus to obtain the corresponding entity relationship expression sentence; specifically, after obtaining the user corpus, it can be semantically parsed, and then the entities and entity relationship events contained in the corpus information can be obtained, thereby generating the corresponding entity relationship expression sentence: Li Bai and ____ meet in Luocheng.
[0165] The incompleteness judgment module 30 is used to judge whether the entity relationship expression sentence contains a person entity incompleteness; specifically, the incompleteness judgment module 30 judges whether a person entity incompleteness exists in the entity relationship expression sentence, for example, Li Bai and ____ meet in Luocheng,
[0166] The corpus completion module 40 is used to match the entity relationship expression sentence in a pre-stored seed relationship library to complete the entity relationship expression sentence when it is determined that the entity relationship expression sentence has a missing person entity.
[0167] Specifically, when the incomplete judgment module 30 determines that there is an incomplete person entity in the entity relationship expression sentence, then the incomplete entity needs to be completed. How to complete it? This requires the corpus completion module 40 to match in the pre-stored seed relationship library. The seed relationship library here contains a lot of seeds, each seed corresponds to a seed relationship set; each seed is composed of a pair of entity pairs. When matching, specifically, the corpus completion module 40 must first find the corresponding seed in the seed relationship library, and then find the seed relationship set corresponding to the seed. If a matching relationship expression is found in the seed relationship set, then the missing entity relationship expression sentence can be completed according to the person entity pair in the seed of the seed relationship set.
[0168] In this embodiment, after the corpus collection module 10 collects the user corpus, the corpus parsing module 20 parses the user corpus and generates a corresponding relational expression sentence based on it. Then, the incompleteness judgment module 30 makes an incompleteness judgment on the relational expression sentence. When it is judged that the relational expression sentence has incomplete character entities, the corpus completion module 40 uses the pre-stored seed relationship library to match and complete it, so that the tutoring machine can respond to the user according to the completed information.
[0169] Another embodiment of the device of the present invention, as Figure 7 As shown, based on the above device embodiment, the corpus completion module 40 includes:
[0170] A seed search submodule 41 is used to search for a target seed in a seed relationship database according to the person entities already in the entity relationship expression sentence, wherein the target seed includes a person entity pair, and one of the person entities in the person entity pair is a person entity already in the entity relationship expression sentence;
[0171] Specifically, for example, if the incomplete entity relationship expression is "Li Bai and ____ meet in Luocheng", the seed search submodule 41 can search for seeds containing the person entity "Li Bai" in the seed relationship library based on the person entity "Li Bai" already in the expression.
[0172] The relationship matching submodule 42 is used to obtain the corresponding target seed relationship set according to the target seed; the target seed relationship set contains a number of relationship expressions; and the relationship expressions contained in the entity relationship expression sentence are matched in the target seed relationship set; specifically, after the seed search submodule 41 obtains the target seed, the relationship matching submodule 42 obtains the corresponding target seed relationship set according to the target seed. Since each seed has a unique corresponding seed relationship set, the seed relationship set contains a number of relationship expressions with the person entity pairs in the seed as objects.
[0173] The completion submodule 43 is used to complete the entity relationship expression sentence according to the character entity pair contained in the seed corresponding to the target seed relationship set when the relationship expression contained in the entity relationship expression sentence matches the same relationship expression in the target seed relationship set. Specifically, after obtaining each relationship expression in the target seed relationship set, the relationship expressions contained in the entity relationship expression sentence are matched one by one. For example, the entity relationship expression sentence is: Li Bai and ____ met in Luocheng, then match in the target seed relationship set to see if there is an identical relationship expression, and the identical relationship expression mainly refers to the same semantics. If so, it is considered a successful match, and then the entity relationship expression sentence can be completed according to the character entity pair "Li Bai, Du Fu" contained in the target seed: "Li Bai and Du Fu Meet in Los Angeles."
[0174] Preferably, based on any of the above device embodiments, the incomplete corpus completion device further comprises:
[0175] The storage module 50 is constructed and stored, and is used to construct and store a seed relationship library, wherein the seed relationship library includes N seeds and corresponding seed relationship sets; the storage module 50 specifically includes:
[0176] A seed definition submodule 51 is used to define a seed containing a person entity pair;
[0177] A content extraction submodule 52, for extracting content containing person entity pairs in the seed from the collected documents;
[0178] An expression generation submodule 53 is used to obtain a seed relationship expression according to the extracted content containing the seed entity pair;
[0179] A collection submodule 54 is used to establish a seed relationship set corresponding to the seed according to the obtained seed relationship expression;
[0180] The storage submodule 55 is used to store all defined seeds and their corresponding seed relationship sets in a seed relationship library.
[0181] Specifically, the seed definition submodule 51 defines the character entity pairs contained in seed 1 as Li Bai and Du Fu; defines the character entity pairs contained in seed 2 as Li Bai and Wang Lun; and defines the character entity pairs contained in seed 3 as Li Bai and Meng Haoran. After collecting a large number of documents, the content extraction submodule 52 can extract relevant content from the documents based on the character entity pairs contained in each seed. For example, based on the character entity pairs in seed 1, the following relevant content is extracted:
[0182] (1) Du Fu once publicly stated that he was good friends with Li Bai from Shandong;
[0183] (2) Li Bai and Du Fu met in Luocheng;
[0184] (3) Li Bai once wrote a poem for Du Fu.
[0185] After the content extraction submodule 52 obtains the extracted content related to the seed entity pair, the expression generation submodule 53 obtains the relevant seed relationship expression based on the extracted specific content. For example, the character entity pair contained in seed 1 is Li Bai and Du Fu; we use X to represent Li Bai and Y to represent Du Fu, and then obtain the corresponding seed expression based on the extracted relevant content:
[0186] (3) Du Fu once publicly stated that he was good friends with Li Bai from Shandong;
[0187] Corresponding relational expression: X once publicly stated that he had a good relationship with Shandong Y.
[0188] (4) Li Bai and Du Fu met in Luocheng;
[0189] Corresponding relational expression: X and Y meet in Los Angeles
[0190] (3) Li Bai once wrote a poem for Du Fu.
[0191] Corresponding relational expression: X once wrote a poem for Y
[0192] Then, the collection submodule 54 collects the obtained seed relationship expressions and establishes a seed relationship set corresponding to the seed. For example, a seed relationship set of seed 1 is established, which includes three relationship expressions: "X once publicly expressed that he was good friends with Shandong Y"; "X and Y met in Luocheng"; and "X once wrote a poem to Y".
[0193] Finally, the storage submodule 55 stores the previously defined seeds and their corresponding seed relationship sets in the seed relationship library.
[0194] Another embodiment of the device of the present invention, based on the above device embodiment, is as follows Figure 8 As shown, the incomplete corpus completion device further includes:
[0195] The extraction module 60 is used to extract the person entity pairs and relationship expressions contained in the entity relationship sentence when it is determined that the entity relationship expression sentence does not contain incomplete person entities; so that the seed search submodule 41 searches the seed relationship library for a target seed containing the extracted person entity pairs;
[0196] The expansion module 70 is used to, when it is determined that there is no target seed containing the extracted person entity pair in the seed relationship library, use the extracted person entity pair as a new seed in the seed relationship library, and establish a seed relationship set of the new seed, wherein the seed relationship set of the new seed contains the relationship expression contained in the entity relationship expression sentence.
[0197] Preferably, the incomplete corpus completion device further comprises:
[0198] The seed search submodule 41 is further configured to obtain a target seed relationship set corresponding to the target seed when it is determined that the target seed containing the extracted person entity pair exists in the seed relationship library;
[0199] The relationship matching submodule 42 is further used to match the relationship expression included in the entity relationship expression sentence in the target seed relationship set;
[0200] The expansion module 70 is further configured to expand the relational expression contained in the entity relational expression sentence into the target seed relational set when the relational expression extracted from the entity relational expression sentence does not match the same relational expression in the target seed relational set.
[0201] Through the corpus completion device of this embodiment, in addition to completing incomplete user corpus, when it is determined that the user corpus is not incomplete, if the target seed is not matched, new seeds in the seed relationship library and the corresponding seed relationship set can be added, or when the target seed is matched but the relationship expression is not matched, the relationship expression can be added to the target seed relationship set; this makes the seeds contained in the seed relationship library and the corresponding seed relationship set more and more comprehensive, and also facilitates the subsequent better completion of the incomplete corpus.
[0202] The incomplete corpus completion method of the present invention corresponds to the incomplete corpus completion device of the present invention. The technical details of the incomplete corpus completion method of the present invention are also applicable to the incomplete corpus completion device of the present invention. To reduce repetition, they are not described again.
[0203] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0204] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0205] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0206] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0207] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A method for completing incomplete corpus. It is characterized in that include: Constructing and storing a seed relationship library, wherein the seed relationship library includes N seeds and corresponding seed relationship sets; Specifically, the method includes: defining a seed containing a person entity pair; extracting content containing the person entity pair in the seed from the collected documents; obtaining a seed relationship expression according to the extracted content containing the seed entity pair; establishing a seed relationship set corresponding to the seed according to the obtained seed relationship expression; storing all defined seeds and their corresponding seed relationship sets in a seed relationship library; Collect user corpus; Parsing the corpus to obtain corresponding entity relationship expression sentences; Determining whether the entity relationship expression sentence contains missing person entities; When it is determined that the entity relationship expression sentence has incomplete person entities, the entity relationship expression sentence is matched in a pre-stored seed relationship library to complete the entity relationship expression sentence, including: according to the existing person entities in the entity relationship expression sentence, a target seed is searched in the seed relationship library, the target seed contains a person entity pair, and one of the person entities in the person entity pair is the person entity already in the entity relationship expression sentence; according to the target seed, a corresponding target seed relationship set is obtained; the target seed relationship set contains a plurality of relationship expressions; the relationship expressions contained in the entity relationship expression sentence are matched in the target seed relationship set; when the relationship expressions contained in the entity relationship expression sentence match the same relationship expression in the target seed relationship set, the entity relationship expression sentence is completed according to the person entity pair contained in the seed corresponding to the target seed relationship set.
2. A method for completing incomplete corpus according to claim 1, It is characterized in that Also includes: When it is determined that the entity relationship expression sentence does not contain incomplete person entities, extracting the person entity pairs and relationship expressions contained in the entity relationship expression sentence; Searching in the seed relationship library whether there is a target seed containing the extracted person entity pair; When it is determined that the target seed containing the extracted person entity pair does not exist in the seed relationship library, the extracted person entity pair is used as a new seed in the seed relationship library, and a seed relationship set of the new seed is established, and the seed relationship set of the new seed contains the relationship expression contained in the entity relationship expression sentence.
3. A method for completing incomplete corpus according to claim 2, It is characterized in that Also includes: When it is determined that there is a target seed containing the extracted person entity pair in the seed relationship library, obtaining a target seed relationship set corresponding to the target seed; Matching the relational expressions contained in the entity relation expression sentence in the target seed relation set; When the relation expression extracted from the entity relation expression sentence does not match the same relation expression in the target seed relation set, the relation expression included in the entity relation expression sentence is expanded into the target seed relation set.
4. A device for completing incomplete corpus, It is characterized in that include: Constructing a storage module, used to construct and store a seed relationship library, wherein the seed relationship library includes N seeds and corresponding seed relationship sets; The construction of the storage module specifically includes: The seed definition submodule is used to define seeds containing person entity pairs; A content extraction submodule, for extracting content containing person entity pairs in the seed from the collected documents; The expression generation submodule is used to obtain the seed relationship expression according to the extracted content containing the seed entity pair; A collection submodule, used to establish a seed relationship set corresponding to the seed according to the obtained seed relationship expression; A storage submodule, used to store all defined seeds and their corresponding seed relationship sets in a seed relationship library; Corpus collection module, used to collect user corpus; A corpus parsing module, used to parse the corpus to obtain corresponding entity relationship expression sentences; An incompleteness judgment module is used to judge whether the entity relationship expression sentence has a person entity incompleteness; A corpus completion module is used to match the entity relationship expression sentence in a pre-stored seed relationship library to complete the entity relationship expression sentence when it is determined that the entity relationship expression sentence has incomplete person entities, including: a seed search submodule, used to find a target seed in the seed relationship library according to the person entities already in the entity relationship expression sentence, wherein the target seed contains a person entity pair, and one of the person entities in the person entity pair is the person entity already in the entity relationship expression sentence; a relationship matching submodule, used to obtain a corresponding target seed relationship set according to the target seed; the target seed relationship set contains several relationship expressions; and the relationship expressions contained in the entity relationship expression sentence are matched in the target seed relationship set; a completion submodule, used to complete the entity relationship expression sentence according to the person entity pair contained in the seed corresponding to the target seed relationship set when the relationship expression contained in the entity relationship expression sentence matches the same relationship expression in the target seed relationship set.
5. The device for completing incomplete corpus according to claim 4, It is characterized in that Also includes: An extraction module, for extracting the person entity pairs and relationship expressions contained in the entity relationship expression sentence when it is determined that the entity relationship expression sentence does not contain any person entity incomplete; The seed search submodule searches the seed relationship library for a target seed containing the extracted person entity pair; The expansion module is used to, when it is determined that there is no target seed containing the extracted person entity pair in the seed relationship library, use the extracted person entity pair as a new seed in the seed relationship library, and establish a seed relationship set of the new seed, wherein the seed relationship set of the new seed contains the relationship expression contained in the entity relationship expression sentence.
6. The device for completing incomplete corpus according to claim 5, It is characterized in that Also includes: The seed search submodule is further configured to obtain a target seed relationship set corresponding to the target seed when it is determined that the target seed containing the extracted person entity pair exists in the seed relationship library; The relationship matching submodule is further used to match the relationship expression included in the entity relationship expression sentence in the target seed relationship set; The expansion module is further used to expand the relational expression contained in the entity relational expression sentence into the target seed relational set when the relational expression extracted from the entity relational expression sentence does not match the same relational expression in the target seed relational set.
Citation Information
Patent Citations
Entity relation extraction method and device
CN107784125A
A method and system for completing a semantically incomplete corpus
CN109344231A
