A system and method for constructing a question-answering intention knowledge base based on question framework
Through the Q&A intention knowledge base construction system based on the question frame, all words and word order information in the sentence are used to identify the frame and frame elements of the question, and the answer template is generated, which solves the difficulty of identifying frame elements and the inability to automatically obtain them in the existing technology. The problem of question parsing realizes the semantic analysis and answer generation of the question and answer system.
Patent Information
- Application Number
- CN202110040888.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-13
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2041-01-13
AI Technical Summary
It is difficult to identify sentence frame elements in the existing technology, and the analysis and answer form of the question cannot be automatically obtained, especially in the case of a sentence without a verb and a sequence of function words, resulting in the inability to eliminate entity ambiguity and the inability to identify the frame.
The Q&A intention knowledge base construction system based on the question framework is used, including the data layer, processing layer and application layer. Through the framework element dictionary and the Q&A intention knowledge base, all words and word order information in the sentence are used to build a sentence frame element dictionary to complete the sentence. Rewrite and generate target word strings to retain semantics to the greatest extent, identify frame names and frame elements, and generate answer templates.
It effectively eliminates word-level object ambiguity, identifies the frame and frame elements of the question, generates an answer form that conforms to the scene and semantics, and solves the problem of analyzing the question and answer intention in the question and answer system.
Smart Images

Figure CN112650846B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of constructing a question-answering intention knowledge base, and in particular to a system and method for constructing a question-answering intention knowledge base based on a question framework. Background Art
[0002] Sentence intent (sentence frame) is the meaning of the sentence in the real material world, that is, semantics. There are many kinds of semantics. Generally, the frame semantics (FrameNet) method is used to determine the name and frame elements of the frame according to the scene, and define the target word of the frame according to the predicate or verb in the sentence. This method of defining the target word of the entire sentence and determining the frame elements based on the predicate or verb part of the sentence will cause the following problems in practice:
[0003] (1) Entity ambiguity cannot be eliminated and framework elements cannot be identified
[0004] For example, in the question "How deep is the Maoba 3 well?", "Maoba 3" and "Maoba 3 well" are two real entities of completely different types. So which entity is "Maoba 3 well depth" or "Maoba 3 well depth"? This ambiguous problem cannot be solved at the word level. Only at a higher sentence level can the real intention and elements of the questioner be corrected through the knowledge base.
[0005] (2) Verb-free sentences cannot identify frames
[0006] English is a verb-based language, so identifying frames and frame elements based on verbs is successful, but it is clear that the target words cannot be defined when identifying question intent (frame), so the frame and frame elements of the question cannot be determined, resulting in the inability to parse the question and answer.
[0007] For example, the sentence "Maoba 3 well depth" has very clear semantics in the question-answering scenario. It is asking about the "well depth" of each well included in the "Maoba 3" gas gathering station. However, there are no verbs but only nouns in the question. NLP cannot recognize the frame and frame elements of such a sentence.
[0008] (3) Frame recognition is not possible even without function word sequences
[0009] Drawing on the slot method, entities are removed from the sentence, and the remaining function word sequence is used as the target word for frame recognition. However, since only half of the information is used, the frame and frame elements of the sentence cannot be recognized.
[0010] For a sentence with function words such as "What is the depth of Well MaoBa 3?", a target word sequence of function words " ,, What is the depth of" can be obtained by removing the entity words "MaoBa 3" and "Well depth" and retaining the slot positions. Through this target word, the sentence framework can be recognized. However, for a sentence without function words such as "MaoBa 3 Well depth", this function word sequence method cannot recognize the sentence framework and framework elements either.
[0011] (4) The parsing of a question sentence cannot automatically obtain the form of the answer sentence.
[0012] Since question sentences and answer sentences appear in pairs, different question sentences result in different answer sentences to maintain the consistency of word usage, tone, and semantics between the question sentence and the answer sentence. However, if only the question sentence is considered alone without taking the answer sentence into account, a smooth answer sentence form that conforms to the scenario and semantics cannot be obtained. Summary of the Invention
[0013] The purpose of the present invention is to provide a method for constructing a question-answer intention knowledge base based on a question sentence framework. This method for constructing a question-answer intention knowledge base based on a question sentence framework can solve the problems in the prior art that it is difficult to identify framework elements and it is impossible to automatically obtain the form of the answer sentence for the parsing of a question sentence.
[0014] To achieve the above purpose, the present invention provides the following technical solutions:
[0015] A system for constructing a question-answer intention knowledge base based on a question sentence framework, comprising: a data layer, including a question sentence corpus, a framework element dictionary, and a question-answer intention knowledge base; for storing files, reading and writing files, and modifying files;
[0016] A processing layer, including a framework element processing module and a question-answer sentence rewriting module, for rewriting sentences;
[0017] An application layer, including a question sentence analysis module, for outputting a candidate target word string formed by the rewritten sentence.
[0018] Based on the above technical solutions, the present invention can also be improved as follows:
[0019] Further, the question sentence corpus includes a serial number, a question sentence source, and a question sentence, and is used to record the relevant information of the question sentence.
[0020] Further, the format of the framework element dictionary includes the name of the framework and the framework element code; the framework element dictionary includes a question sentence parsing, and the question sentence parsing includes a first layer and a second layer. The first layer is used for sequence parsing, and the second layer is used for entailment relationship and hierarchical structure parsing.
[0021] Furthermore, the question-answering intention knowledge base includes a question target word string and a question-answering intention analysis, and the question-answering intention analysis includes a first part and a second part, the first part is the name of the framework, and the second part is the answer template.
[0022] Furthermore, the framework element processing module is used to find a word string from the framework element dictionary.
[0023] Furthermore, the rewriting module is used to replace characters in the word string in the sentence to complete the rewriting of the sentence. Each rewritten sentence will be added to the rewritten sentence set as a new original sentence for accumulation until all framework element character strings have been used to obtain the rewritten sentence set.
[0024] Furthermore, the question analysis module is used to establish a list of read-in questions, and output the frame target word strings formed by the rewritten sentences in reverse order according to the word string length.
[0025] A method for constructing a question-answering intention knowledge base based on a question frame, the method specifically comprising:
[0026] S101, constructing a sentence frame element dictionary according to the frame element dictionary and the question file;
[0027] S102, looping through the sentence frame element dictionary;
[0028] S103, looping the existing sentence target word string set to form a new candidate target word string set, and retaining the sentence in the new candidate target word string set;
[0029] S104, replacing corresponding words in the target word string with the sentence frame element dictionary, and updating the candidate target word string set;
[0030] S105, sorting the candidate target word strings by length, and outputting the candidate target word strings.
[0031] Furthermore, constructing the sentence frame element dictionary specifically includes: searching for each sentence in the question file, and when a word in the frame element dictionary appears in the sentence, collecting the sentence in the frame element dictionary to form a sentence frame element dictionary.
[0032] The present invention has the following advantages:
[0033] The question frame-based question-answering intention knowledge base construction system and method of the present invention utilize the information of all characters and word order in the question to the maximum extent, retain the semantics of the target word string of the question to the maximum extent, and can not only effectively eliminate word-level object ambiguity, but also realize the recognition of the frame name of the question, the analysis of the frame elements and the generation of the answer sentence through the target word string of the question, thereby solving the problem of the analysis of the question-answering intention in the question-answering system; and solving the problem in the prior art that it is difficult to identify the frame elements and cannot automatically obtain the answer form of the question analysis. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0035] Figure 1 A schematic diagram of a system for constructing a question-answering intention knowledge base in an embodiment of the present invention;
[0036] Figure 2 Schematic diagram of the process of constructing a question-answering intention knowledge base in an embodiment of the present invention;
[0037] Figure 3 It is a schematic diagram of the definition of the question-answer framework name encoding rules and framework elements in an embodiment of the present invention;
[0038] Figure 4 is a schematic diagram of the format of a question corpus in an embodiment of the present invention;
[0039] Figure 5 A schematic diagram of a framework element dictionary format according to an embodiment of the present invention;
[0040] Figure 6 Schematic diagram of the question-answer graph knowledge base format in an embodiment of the present invention.
[0041] Description of reference numerals:
[0042] Data layer 10, question corpus 101, framework element dictionary 102, question and answer intention knowledge base 103, processing layer 20, framework element processing module 201, question and answer sentence rewriting module 202, application layer 30, question and answer analysis module 301. DETAILED DESCRIPTION
[0043] The technical solution of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are part of the embodiments of the present invention, rather than 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.
[0044] like Figure 1 As shown, the present invention provides a question-answering intention knowledge base construction system based on a question frame, comprising:
[0045] The data layer 10 includes a question corpus 101, a framework element dictionary 102, and a question-answering intention knowledge base 103; and is used to store files, read and write files, and modify files;
[0046] The processing layer 20 includes a framework element processing module 201 and a question-answer sentence rewriting module 202, which is used to rewrite sentences;
[0047] The application layer 30 includes a question analysis module 301, which is used to output candidate target word strings formed by rewriting sentences.
[0048] Sentence intention (sentence frame) is the meaning of the sentence in the real material world, that is, semantics. There are many kinds of semantics. Generally, the frame semantics (FrameNet) method is adopted to determine the name and frame elements of the frame according to the scenario, and define the target word of the frame according to the predicate or verb in the sentence.
[0049] For example, in a social scenario, a framework called "verbal communication" is defined, which generally has framework elements such as "sender", "receiver", "information", and "medium", while verbs contained in sentences such as "say", "talk", "command", "tell", "discuss", "remind", "ask", "promise", "warn", and "threaten" are all target words of this framework.
[0050] For a specific sentence, the frame to which the sentence belongs is determined by identifying the target word. For example, "Zhang San told Li Si where the airport is," the target word "tell" indicates that the sentence belongs to the "verbal communication" frame, and "Zhang San," "Li Si," and "where the airport is" are all frame elements of this frame.
[0051] The entity words in the question are replaced with framework elements to form a complete word string that combines the real and imaginary words. This maximizes the use of the information of all the words in the sentence and constructs the most complete sentence framework target word string.
[0052] The specific operation is to first determine the entire question and answer (including question and answer) framework and question and answer framework element code (such as framework number F111, framework element code T, time, O object, P parameter) according to the question.
[0053] Secondly, according to the sentence frame and frame element code, a frame element dictionary 102 is constructed; then the frame element code is used to replace the corresponding entity words in the original question and answer sentences, and the question and answer sentences are rewritten (such as "What is the gas production of T1001 well on January 3, 2020" is rewritten as "What is TOP F111#TOP is Q").
[0054] The rewritten question sentence is defined as the target word under the selected frame for identifying the frame, and the rewritten answer sentence is used as the answer sentence template together with the question sentence to form the question-answer frame corresponding to the sentence; the question-answer frames of all the question sentences are put together to form the entire question-answer knowledge base.
[0055] Furthermore, if Figure 4 As shown, the question corpus 101 includes a sequence number, a question source and a question, and is used to record relevant information of the question.
[0056] Used to record question-related information. This information can be expanded to include information such as region and questioner, to prepare for more accurate question and answer in the future.
[0057] Furthermore, if Figure 5 As shown, the format of the frame element dictionary 102 includes the frame name and frame element code; the frame element dictionary 102 includes question parsing. Considering the granularity of time in Chinese natural language and the implication relationship of natural language such as "how much oil is produced", the question parsing includes a first layer and a second layer, the first layer is used for sequence parsing, and the second layer is used for implication relationship and hierarchical structure parsing. The definition of the question and answer frame name and the definition of the frame element are as follows Figure 2 As shown, the question sentence is defined as TOPVM5 elements, and the answer sentence is defined as TOPVMQ and other 6 elements.
[0058] Furthermore, if Figure 6 As shown in the question-answer graph knowledge base format, the question-answer intention knowledge base 103 includes a question target word string and a question-answer intention analysis, and the question-answer intention analysis includes a first part and a second part, wherein the question-answer intention analysis includes a first part and a second part separated by "@@@", the first part is the name of the framework, and the second part is the answer template.
[0059] Furthermore, the framework element processing module 201 is used to search for a word string from the framework element dictionary 102 .
[0060] Furthermore, the rewriting module is used to replace characters in the word string in the sentence to complete the rewriting of the sentence. Each rewritten sentence will be added to the rewritten sentence set as a new original sentence for accumulation until all framework element character strings have been used to obtain the rewritten sentence set.
[0061] The target word string set after the original question is rewritten includes both the sentence pattern constructed by the function word part of the original sentence and the framework or slot constructed by the content word part. Therefore, this method utilizes the information in the sentence and is the most complete way to construct the target words of the sentence framework.
[0062] Furthermore, the question analysis module 301 is used to establish a list of read-in questions, and output the frame target word strings formed by rewriting the questions in reverse order according to the length of the word strings. This is used for people to select and verify appropriate frame target word strings. For a simple question "What is the gas production of well 401-1?", since the number of dictionaries is very large, generally in the order of 1 million, 163 possible frame target word strings will be output, of which only "What is OP?" is the correct question frame target word string. The more complex the question, the more frame elements it contains, and the greater the number of frame target word strings output.
[0063] A method for constructing a question-answering intention knowledge base based on a question frame, the method specifically comprising:
[0064] S101, constructing a sentence frame element dictionary 102;
[0065] In this step, a sentence frame element dictionary 102 is constructed based on the frame element dictionary 102 and the question file; the frame element dictionary 102 is opened and the entire dictionary is read into the memory to speed up the processing. The input question file is opened to process each sentence in the question file; the sentences in the question file are read sentence by sentence. The frame element corresponding to each question is different, so each sentence needs to be searched separately.
[0066] As long as the words in the framework element dictionary 102 appear in a sentence, they are collected in the sentence framework element dictionary 102. The number of the sentence framework element dictionary 102 is large, and there may be complex inclusion relationships. For example, "1" may be a month data or a pound sign of an entity. In this case, all of them need to be collected in the sentence framework element dictionary 102.
[0067] S102, looping through the sentence frame element dictionary 102;
[0068] In this step, the sentence frame element dictionary 102 is looped; the sentence frame element dictionary 102dic is looped; and the entire element dictionary is looped. Every situation in the dictionary is exhaustively enumerated to check the possibility of each sentence rewriting to construct a candidate target word string.
[0069] S103, looping the existing sentence target word string set;
[0070] In this step, the existing sentence target word string set is looped to form a new candidate target word string set, and the sentence is retained in the new candidate target word string set; the existing sentence target word string set is looped; and the target word string set is updated to a single element dictionary. Because each time a sentence replaces a word in an element dictionary, the number of candidate target word string sets will increase, so the existing sentence target word string set here is a variable and constantly increasing set.
[0071] Here, all target word strings are updated. The sentence is retained in the new candidate target word string set; the original sentence is retained in the target candidate word string set to achieve the expansion of the candidate word string set. The automatic deduplication of sentences is achieved by adding new sets.
[0072] S104, updating the candidate target word string set;
[0073] In this step, the sentence frame element dictionary 102 is used to replace the corresponding words in the target word string, and the candidate target word string set is updated; the sentence frame element dictionary 102dic is used to replace the corresponding words in the target word string; the sentence after the new word replacement is also added to the target word string set. It should be noted that if there are several identical element words in the sentence, only one of the element words can be replaced each time, and the rest must wait for the later element words to be replaced.
[0074] Together with step S102, the next element word is processed. The key point is that the target word string set is an updated new set, which accumulates all non-repeated candidate target word strings from the original sentence to each dictionary processed in the middle;
[0075] S105, outputting candidate target word strings;
[0076] In this step, the candidate target word strings are sorted by length and the candidate target word strings are output.
[0077] Furthermore, constructing the sentence frame element dictionary 102 specifically includes: searching for each sentence in the question file, and when a word in the frame element dictionary 102 appears in the sentence, collecting the sentence in the frame element dictionary 102 to form the sentence frame element dictionary 102 .
[0078] Sort by the length of the candidate target word string: Sort the candidate target word string from small to large in length. This is because generally speaking, the longer the word, the clearer the semantics. Therefore, after replacement, the shorter the entire target word string, the more likely it is to be the correct target word string. This sorting can reduce the time it takes for people to find the correct target word string. Output all candidate target word string files; construct a target word string sequence for each question, and then record it in a file for output for manual inspection.
[0079] The method for constructing the question-answering intention knowledge base 103 based on the question frame is used as follows:
[0080] When in use, the operator constructs a sentence frame element dictionary 102 based on the frame element dictionary 102 and the question file; loops the sentence frame element dictionary 102; loops the existing sentence target word string set to form a new candidate target word string set, and retains the sentence in the new candidate target word string set; replaces the corresponding words in the target word string with the sentence frame element dictionary 102, and updates the candidate target word string set; sorts the candidate target word strings by length, and outputs the candidate target word strings.
[0081] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise" and the like indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the referred device or element must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as limiting the present invention.
[0082] In addition, the terms "first" and "second" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include or more of the features. In the description of the present invention, "multiple" means two or more, unless otherwise clearly and specifically defined. In addition, the terms "installed", "connected" and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal connection of two components. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0083] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A question-answering intention knowledge base construction system based on question framework, characterized in that: include: The data layer includes question corpus, frame element dictionary and question-answering intention knowledge base; Used to store files, read and write files, and modify files; The format of the frame element dictionary includes the name of the frame and the frame element code; the frame element dictionary includes question parsing, and the question parsing includes a first layer and a second layer, the first layer is used for sequence parsing, and the second layer is used for implication relationship and hierarchical structure parsing; The processing layer includes a framework element processing module and a question-answer sentence rewriting module, which is used to rewrite sentences; The application layer includes a question analysis module for outputting candidate target word strings formed by rewriting sentences.
2. The question-answering intention knowledge base construction system based on the question framework according to claim 1 is characterized in that: The question corpus includes a sequence number, a question source and a question, and is used to record relevant information of the question.
3. The question-answering intention knowledge base construction system based on the question framework according to claim 1 is characterized in that: The question-answering intention knowledge base includes a question target word string and a question-answering intention analysis, and the question-answering intention analysis includes a first part and a second part, wherein the first part is the name of the framework, and the second part is the answer template.
4. The question-answering intention knowledge base construction system based on the question framework according to claim 1 is characterized in that: The framework element processing module is used to find a word string from the framework element dictionary.
5. The question-answering intention knowledge base construction system based on the question framework according to claim 4 is characterized in that: The rewriting module is used to replace characters in the word string in the sentence to complete the rewriting of the sentence. Each rewritten sentence will be added to the rewritten sentence set as a new original sentence for accumulation until all framework element character strings have been used to obtain a rewritten sentence set.
6. The question-answering intention knowledge base construction system based on the question framework according to claim 5 is characterized in that: The question analysis module is used to establish a list of read-in questions, and to output the frame target word strings formed by the rewritten sentences in reverse order according to the word string length.
7. A method for constructing a question-answering intention knowledge base based on a question frame, characterized in that: The method specifically comprises: S101, constructing a sentence frame element dictionary according to the frame element dictionary and the question file; S102, looping through the sentence frame element dictionary; S103, looping the existing sentence target word string set to form a new candidate target word string set, and retaining the sentence in the new candidate target word string set; S104, replacing corresponding words in the target word string with the sentence frame element dictionary, and updating the candidate target word string set; S105, sorting the candidate target word strings by length, and outputting the candidate target word strings.
8. The method for constructing a question-answering intention knowledge base based on a question frame according to claim 7, characterized in that: Constructing the sentence frame element dictionary specifically includes: searching each sentence in the question file, and when a word in the frame element dictionary appears in the sentence, collecting the sentence in the frame element dictionary to form a sentence frame element dictionary.
