CN109840255B - Reply text generation method, device, equipment and storage medium - Google Patents
Reply text generation method, device, equipment and storage medium Download PDFInfo
- Publication number
- CN109840255B CN109840255B CN201910020809.3A CN201910020809A CN109840255B CN 109840255 B CN109840255 B CN 109840255B CN 201910020809 A CN201910020809 A CN 201910020809A CN 109840255 B CN109840255 B CN 109840255B
- Authority
- CN
- China
- Prior art keywords
- question
- reply
- keyword
- target
- grammar structure
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Landscapes
- Machine Translation (AREA)
Abstract
The invention relates to the technical field of natural language processing, and discloses a reply text generation method, a device, equipment and a storage medium, wherein the method comprises the following steps: processing the question text through a bidirectional circulating neural network to acquire context data corresponding to each question keyword; acquiring a target answer grammar structure and word extraction rules associated with the target answer grammar structure according to each question keyword and context data corresponding to each question keyword; searching associated content corresponding to each question keyword in a graphic database, and generating a relation data table according to each question keyword and the searched associated content; and generating a reply text according to the target reply grammar structure, the word extraction rule and the relation data table. The invention can improve the accuracy of text analysis and the degree of fit between the question text and the answer text.
Description
Technical Field
The present invention relates to the field of semantic parsing technologies, and in particular, to a method, an apparatus, a device, and a storage medium for generating a reply text.
Background
The question and answer system is a system capable of automatically generating answer texts according to question texts input by users, and has wide application in the technical fields of intelligent customer service, machine chat and the like. In a question-answering system, the question text input by the user is usually written according to natural language, and since the natural language cannot be directly understood by the computer, a canonical semantic representation (formal meaning representation) needs to be generated according to the natural language, and the computer can understand the question posed by the user according to the canonical semantic representation, so that the computer can answer the question posed by the user. The generated standard semantic representation in the prior art is usually a structured query sentence written according to a structured query language (Structured Query Language, SQL), however, the grammar sequence limitation of the structured query sentence cannot be matched with the diversity of natural language to a certain extent, so that the analysis result of the question text is easy to deviate, the generated matching degree between the answer text and the question text is not high, and the user requirement cannot be met.
Disclosure of Invention
The invention mainly aims to provide a reply text generation method, device, equipment and storage medium, which aim to solve the technical problem of how to improve the degree of fit between a generated reply text and a question text.
In order to achieve the above object, the present invention provides a reply text generation method including the steps of:
extracting question keywords in a question text;
processing the question text through a bidirectional circulating neural network to acquire context data corresponding to each question keyword;
acquiring a target answer grammar structure and word extraction rules associated with the target answer grammar structure according to each question keyword and context data corresponding to each question keyword;
searching associated content corresponding to each question keyword in a graphic database, and generating a relation data table according to each question keyword and the searched associated content;
and generating a reply text according to the target reply grammar structure, the word extraction rule and the relation data table.
Preferably, the bidirectional recurrent neural network includes a first unidirectional recurrent neural network and a second unidirectional recurrent neural network;
the step of processing the question text through a bidirectional cyclic neural network to obtain context data corresponding to each question keyword specifically comprises the following steps:
extracting the above data of each question keyword through the first unidirectional circulating neural network;
extracting the following data of each question keyword through the second unidirectional circulating neural network;
context data corresponding to each question keyword is generated based on the context data and the context data corresponding to each question keyword.
Preferably, the step of obtaining a target answer grammar structure and a word extraction rule associated with the target answer grammar structure according to each question keyword and context data corresponding to each question keyword specifically includes:
acquiring a target question grammar structure according to each question keyword and the context data corresponding to each question keyword;
searching a plurality of corresponding reply grammar structures according to the target question grammar structure;
randomly selecting one of the plurality of reply grammar structures as a target reply grammar structure;
and acquiring word extraction rules associated with the target reply grammar structure according to the target reply grammar structure.
Preferably, the step of obtaining the target question grammar structure according to each question keyword and the context data corresponding to each question keyword specifically includes:
obtaining a plurality of grammar structure trees to be selected according to each question keyword;
and selecting one of the plurality of grammar structure trees to be selected according to each question keyword and the context data corresponding to each question keyword, and taking the selected grammar structure tree to be selected as a target question grammar structure.
Preferably, according to each question keyword and the context data corresponding to each question keyword, one of the plurality of grammar structure trees to be selected is selected, and the selected grammar structure tree to be selected is used as the target question grammar structure, which specifically comprises the following steps:
acquiring the parts of speech corresponding to each question keyword according to the context data corresponding to each question keyword;
calculating respective confidence probabilities of the plurality of grammar trees to be selected according to each question keyword and the part of speech corresponding to each question keyword;
and selecting one of the plurality of grammar trees to be selected, which has the largest confidence probability, and taking the selected grammar tree to be selected as a target question grammar structure.
Preferably, in the step of extracting the question keywords in the question text, the question keywords include a query word and a non-query word;
searching associated content corresponding to each question keyword in a graphic database, and generating a relational data table according to each question keyword and the searched associated content, wherein the method specifically comprises the following steps of:
searching associated content corresponding to each non-query word in the graphic database according to each query word;
and generating a relation data table according to each non-query word and the searched association content.
Preferably, the step of searching the graphic database for associated content corresponding to each non-query term according to each query term specifically includes:
searching nodes corresponding to the first qualifier in the graphic database, and taking the searched nodes as initial nodes;
determining a relation type for searching according to the query words;
searching a target node in a graph database according to the initial node and the searching relation type;
and taking the content corresponding to the searched target node as the associated content corresponding to the first qualifier.
In addition, in order to achieve the above object, the present invention also provides a reply text generating device, including:
the extraction module is used for extracting the question keywords in the question text;
the acquisition module is used for processing the questioning text through a bidirectional circulating neural network and acquiring context data corresponding to each questioning keyword;
the acquisition module is also used for acquiring a target reply grammar structure and word extraction rules associated with the target reply grammar structure according to each question keyword and the context data corresponding to each question keyword;
the generation module searches the associated content corresponding to each question keyword in the graphic database, and generates a relation data table according to each question keyword and the searched associated content;
the generating module is further configured to generate a reply text according to the target reply grammar structure, the word extraction rule, and the relational data table.
In addition, in order to achieve the above object, the present invention also proposes a reply text generation device including: a memory, a processor, and a reply text generation program stored on the memory and executable on the processor, the reply text generation program configured to implement the steps of the reply text generation method as described above.
In addition, in order to achieve the above object, the present invention also proposes a storage medium having stored thereon a reply text generation program which, when executed by a processor, implements the steps of the reply text generation method as described above.
According to the technical scheme, the questioning keywords in the questioning text are extracted; processing the question text through a bidirectional circulating neural network to acquire context data corresponding to each question keyword; acquiring a target answer grammar structure and word extraction rules associated with the target answer grammar structure according to each question keyword and context data corresponding to each question keyword; searching associated content corresponding to each question keyword in a graphic database, and generating a relation data table according to each question keyword and the searched associated content; and generating a reply text according to the target reply grammar structure, the word extraction rule and the relation data table, thereby being beneficial to improving the accuracy of text analysis and improving the degree of agreement between the question text and the reply text.
Drawings
FIG. 1 is a schematic diagram of a reply text generation device of a hardware runtime environment to which an embodiment of the present invention relates;
FIG. 2 is a flowchart of a first embodiment of a reply text generation method according to the present invention;
FIG. 3 is a flowchart of a second embodiment of the reply text generation method of the present invention;
FIG. 4 is a flowchart of a third embodiment of a reply text generation method according to the present invention;
FIG. 5 is a flowchart of a fourth embodiment of a reply text generation method according to the present invention;
fig. 6 is a block diagram showing the construction of a first embodiment of the reply text generation device of the present invention.
The achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
Referring to fig. 1, fig. 1 is a schematic diagram of a reply text generating device of a hardware running environment according to an embodiment of the present invention.
As shown in fig. 1, the reply text generation device may include: a processor 1001, such as a central processing unit (Central Processing Unit, CPU), a communication bus 1002, a user interface 1003, a network interface 1004, a memory 1005. Wherein the communication bus 1002 is used to enable connected communication between these components. The user interface 1003 may include a Display, an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may further include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a WIreless interface (e.g., a WIreless-FIdelity (WI-FI) interface). The Memory 1005 may be a high-speed random access Memory (Random Access Memory, RAM) or a stable nonvolatile Memory (NVM), such as a disk Memory. The memory 1005 may also optionally be a storage device separate from the processor 1001 described above.
Those skilled in the art will appreciate that the structure shown in fig. 1 does not constitute a limitation of the reply text generation device, and may include more or fewer components than shown, or may combine certain components, or may be arranged in a different arrangement of components.
As shown in fig. 1, an operating system, a network communication module, a user interface module, and a reply text generation program may be included in the memory 1005 as one type of storage medium.
In the reply text generation device shown in fig. 1, the network interface 1004 is mainly used for data communication with a network server; the user interface 1003 is mainly used for data interaction with a user; the processor 1001, the memory 1005 in the reply text generation device of the present invention may be provided in a reply text generation device that invokes a reply text generation program stored in the memory 1005 through the processor 1001 and executes the reply text generation method provided by the embodiment of the present invention.
An embodiment of the present invention provides a reply text generation method, referring to fig. 2, fig. 2 is a schematic flow chart of a first embodiment of the reply text generation method of the present invention.
In this embodiment, the reply text generation method includes the following steps:
step S100: extracting question keywords in a question text;
the question text is a text in which a question posed by the user is recorded, and specifically, the question text may be entered by text of the user or may be entered by voice of the user. The question keywords are words that can reflect the content of the question text, such as in the question text "What is the name of the president in America? "wherein the extracted question keywords may include" what "," name "," president "and" american ", it being understood that the extracted question keywords may include both a question word and a non-question word, wherein" what "is a question word," name "and" president "and" american "are non-question words according to english grammatical classification, and the question keywords may include only the non-question word.
In a specific implementation, the question text can be subjected to word segmentation by a word segmentation method (such as a dictionary-based word segmentation method) to obtain question keywords, all words obtained by the word segmentation can be used as the question keywords, the words obtained by the word segmentation can be screened to a certain extent according to factors such as part of speech, and the screened words are used as the question keywords.
Step S200: processing the question text through a bidirectional circulating neural network to acquire context data corresponding to each question keyword;
the context data is data that can reflect the context of each question keyword. It can be appreciated that the word ambiguous is often present in natural language, such as: the can in English can be used as a stateful verb to represent "can" or a noun to represent "can", and the context data is acquired in the step, so that the meaning of the word can be accurately analyzed, and further the grammar structure of the question text can be accurately analyzed. The cyclic neural network (Recurrent Neural Network, RNN) is an artificial neural network with nodes connected in a directed manner to form a loop, and is commonly used for processing information containing a sequence structure and can be used for extracting data with certain characteristics from a text. However, standard recurrent neural networks often cannot access future context information when processing sequences in time series. The bi-directional recurrent neural network (Bidirectional Recurrent Neural Network, BRNN) is a modified recurrent neural network, and is typically composed of two standard recurrent neural networks superimposed, so that each training sequence in the bi-directional recurrent neural network can form two recurrent neural networks respectively in opposite directions. The two-way recurrent neural network extracts the context data in the text more accurately than the standard recurrent neural network.
The present invention does not limit specific steps for processing the question text through the dual-loop neural network, in a specific implementation, the dual-loop neural network may include a first unidirectional loop neural network and a second unidirectional loop neural network, and step S200 may specifically include: extracting the above data of each question keyword through the first unidirectional circulating neural network; extracting the following data of each question keyword through the second unidirectional circulating neural network; context data corresponding to each question keyword is generated based on the context data and the context data corresponding to each question keyword. Specifically, the context data of each question keyword may be obtained by simply combining the context data and the context data of each question keyword.
Step S300: acquiring a target answer grammar structure and word extraction rules associated with the target answer grammar structure according to each question keyword and context data corresponding to each question keyword;
the target reply grammar structure refers to a grammar structure adopted by the generated reply text, and the target grammar structure can be specifically "subject (S) +predicate (P) +object (O, object)". The term extraction rule refers to a rule for extracting a vocabulary of a reply text, and specifically, in this embodiment, refers to a rule for extracting a vocabulary from a relational data table (see step S400 described below).
In a specific implementation, a plurality of reply grammar structures are preset, corresponding word extraction rules are set corresponding to different reply grammar structures, and the reply grammar structures and the corresponding word extraction rules can be stored in an associated mode, so that when a target reply grammar structure is extracted, the associated word extraction rules can be obtained through association relations. In the natural language question and answer, the question text and the answer text usually have the corresponding relation on the grammar structure, so the grammar structure adopted by the answer text can be obtained by further utilizing the corresponding relation of the question text and the answer text on the grammar structure. From a part of the question text, a grammatical structure of the question text obtained from each question keyword and the context data corresponding to each question keyword may be directly used as the target answer grammatical structure, for example, "What is the name of the president in America? The answer may be made using the same grammatical structure as the question text, for example, the answer text may be "Trump is the name of the president in America".
It is noted that the question keywords extracted in step S100 may not include the query words in the question text, which does not affect parsing of the grammar structure of the question text, for example: the grammar parsing is performed based on the word sequence "What is the name of the president in America" or the word sequence "is the name of the president in America" to obtain substantially the same grammar structure.
It can be appreciated that, in this embodiment, the analysis of the grammar structure uses the context data acquired through the dual-loop neural network, so that the acquired target reply grammar structure can conform to the context, which is beneficial to improving the accuracy of text analysis.
Step S400: searching associated content corresponding to each question keyword in a graphic database, and generating a relation data table according to each question keyword and the searched associated content;
the graph database is a database for storing relationship information between entities by using graph theory, and specifically is an object graph (graph) formed by nodes representing entities and edges representing relationships between the entities, so as to implement modeling, wherein the nodes and the edges can have own attributes. Different entities are associated according to different types of relationships to form a complex object diagram. The connection between objects in the graphic database is more direct than the relational database modeled by the table-to-table relationship, and thus the graphic database can have a faster reaction speed. In this embodiment, the image database may be Neo4J or the like. The associated content refers to content which has a specific relation with the question keyword in the graphic database, and it is understood that the content which has a specific relation with the question keyword can be generally used for replying to the question text. The relationship data table refers to a table capable of reflecting the relationship between each question keyword and the corresponding associated content, in a specific implementation, the question keyword may be used as a column name of the relationship data table, and the corresponding associated content may be used as a column value, and specifically, the relationship data table may be as follows:
table 1 an example of a relational data table
Referring to the above table, in the above relational data table, the first row is described as a column name, and the subsequent rows are described as column values. Note that the question keyword extracted in step S100 may not include the query word in the question text, that is, the above table may not include a column named "What", and it is understood that in this case, by extracting the word in the relational data table, the answer text may also be generated.
Step S500: and generating a reply text according to the target reply grammar structure, the word extraction rule and the relation data table.
It should be noted that, the data in the relational data table may not be arranged in the manner shown in table 1, and for relational data tables arranged in different manners, the word extraction rule should be set in a targeted manner according to the predetermined arrangement manner of the relational data table, so that words in the relational data table can be accurately used to generate the reply text.
In a specific implementation, words required for generating the reply text can be extracted from the relational data table according to the word extraction rule, and the words required for generating the reply text are arranged according to the target reply grammar structure, so that the reply text can be obtained. Specifically, if the question text is "What is the name of the president in America? The relation data table is shown in table 1, the target answer grammar structure is "subject+predicate+object+subject", and the extraction rule is: the subject is the column value with the highest association with other column names in the column where the name is, and the object and the subject are determined according to the column names, so that the reply text Trump is the name of the president in America can be obtained. The association between the name and other column names in the column can be obtained by querying a preset vocabulary relation table according to the extraction rule, wherein the preset vocabulary relation table can be obtained by counting the connection conditions among nodes in the graphic database.
It can be understood that, in this embodiment, the reply text is generated according to the target reply grammar structure, the word extraction rule and the relational data table, so that the degree of agreement between the reply text and the natural language in the grammar form can be improved, the reply text can conform to the thought mode of a natural person on the reply rule, and the degree of agreement between the reply text and the reply text can be improved.
In the embodiment, question keywords in the question text are extracted; processing the question text through a bidirectional circulating neural network to acquire context data corresponding to each question keyword; acquiring a target answer grammar structure and word extraction rules associated with the target answer grammar structure according to each question keyword and context data corresponding to each question keyword; searching associated content corresponding to each question keyword in a graphic database, and generating a relation data table according to each question keyword and the searched associated content; and generating a reply text according to the target reply grammar structure, the word extraction rule and the relation data table, thereby being beneficial to improving the accuracy of text analysis and improving the degree of agreement between the question text and the reply text.
Referring to fig. 3, fig. 3 is a flowchart illustrating a second embodiment of the reply text generation method according to the present invention.
Based on the first embodiment, in this embodiment, the step S300 may specifically include the following steps:
step S310: acquiring a target question grammar structure according to each question keyword and the context data corresponding to each question keyword;
the target question grammar structure is a grammar structure of a question text acquired as a target. It can be appreciated that the word ambiguous is often present in natural language, such as: the can in English can be used as a stateful verb to represent "can" or a noun to represent "can", and the context data is acquired in the step, so that the meaning of the word can be accurately analyzed, and further the grammar structure of the question text can be accurately analyzed. In a specific implementation, the context data may include data capable of representing parts of speech of each question keyword and capable of representing a fix relation between each question keyword.
Step S320: searching a plurality of corresponding reply grammar structures according to the target question grammar structure;
it should be noted that, a mapping relationship table corresponding to a grammar structure may be pre-established, where the mapping relationship table corresponding to a grammar structure can embody a correspondence relationship between a question grammar structure and a reply grammar structure. Thus, by querying the mapping relation table corresponding to the grammar structure, the reply grammar structure can be searched according to the target question grammar structure.
It will be appreciated that for the same question, a variety of different sentence patterns may be commonly used in natural language for answering, for example, for the question text "What is the name of the president in America? "may be in reply to" Trump is. "or" Trump is the name of the president ". It follows that according to one question grammar structure, a plurality of possible answer grammar structures can be provided for selection.
Step S330: randomly selecting one of the plurality of reply grammar structures as a target reply grammar structure;
it can be understood that in this step, the target reply grammar structure is obtained by means of random extraction, so that the diversity of forms of the reply text can be improved, and the generated reply text is more similar to the result of manual reply, so as to improve the user experience.
Step S340: and acquiring word extraction rules associated with the target reply grammar structure according to the target reply grammar structure.
It can be understood that in this embodiment, the target reply grammar structure is obtained by extraction, and then the word extraction rule is obtained according to the target reply grammar structure, so that before random extraction, only a plurality of reply grammar structures need to be obtained, and a plurality of word extraction rules do not need to be obtained, which is beneficial to reducing the calculation amount implemented in this embodiment.
In this embodiment, the target reply grammar structure is obtained by first randomly extracting, and then the word extraction rule is obtained, so that the diversity of the reply text in terms of form can be improved, the generated reply text is more similar to the result of manual reply, the user experience is improved, and the calculation amount can be reduced.
Referring to fig. 4, fig. 4 is a flowchart illustrating a third embodiment of the reply text generation method according to the present invention.
Based on the above-mentioned second embodiment, in this embodiment, the step S310 may specifically include the following steps:
step S311: obtaining a plurality of grammar structure trees to be selected according to each question keyword;
it should be noted that the syntax structure tree to be selected refers to a syntax structure in a tree shape. In a specific implementation, the grammar structure tree to be selected can be obtained through factors such as ordering of each question keyword in the question text, a form-related pruning relation among the question keywords and the like, and the grammar structure tree to be selected can be obtained through a context-free method and the like. It will be appreciated that grammar structures generated by a program are generally not able to completely disambiguate text, so that there are typically multiple available alternative grammar structure trees. Further, the plurality of syntax structure trees to be selected may be obtained by using different algorithms.
Step S312: and selecting one of the plurality of grammar structure trees to be selected according to each question keyword and the context data corresponding to each question keyword, and taking the selected grammar structure tree to be selected as a target question grammar structure.
It can be appreciated that the meaning of each question keyword in the question text can be determined more accurately according to the context data, so that one of the plurality of candidate grammar structure trees can be selected as the target question grammar structure accordingly.
The present invention is not limited to a specific manner of selecting the target question grammar structure, and in particular, the step S312 may include the steps of: acquiring the parts of speech corresponding to each question keyword according to the context data corresponding to each question keyword; calculating respective confidence probabilities of the plurality of grammar trees to be selected according to each question keyword and the part of speech corresponding to each question keyword; and selecting one of the plurality of grammar trees to be selected, which has the largest confidence probability, and taking the selected grammar tree to be selected as a target question grammar structure. Since the same word may have a plurality of parts of speech in natural language, determining the parts of speech of each question keyword through the context data is beneficial to eliminating possible divergence of each question keyword as a grammar component, thereby being beneficial to accurately analyzing the grammar structure of the question text. In a specific implementation, part-of-speech analysis of each question keyword can be implemented based on a Markov chain, so that the part-of-speech of each question keyword is obtained.
In this embodiment, a plurality of to-be-selected grammar structure trees are obtained, and a target question grammar structure is selected from the plurality of to-be-selected grammar structure trees according to each question keyword and the context data corresponding to each question keyword, so that parsing errors of the question text grammar structure are avoided, and accordingly, the matching degree between the question text and the answer text is improved.
Referring to fig. 5, fig. 5 is a flowchart illustrating a fourth embodiment of the reply text generation method according to the present invention.
Based on the first embodiment, in this embodiment, in the step S100, the question keyword includes a query word and a non-query word, and the step S400 may specifically include the following steps:
s410: searching associated content corresponding to each non-query word in the graphic database according to each query word;
it will be appreciated that natural language responses are typically required for questions, e.g. "when" in english, response time, location, and name. In this embodiment, the related content is searched in the graphic database according to each query term, so that the searched related content is more matched with the question text, and the matching degree between the question text and the answer text is improved.
The invention does not limit the specific mode of searching the related content according to the query words, and can particularly realize the searching of the related content by utilizing the searching function of the graphic database. In order to more purposefully search the associated content corresponding to each non-query word in the graphic database, the steps specifically may include: searching nodes corresponding to the first qualifier in the graphic database, and taking the searched nodes as initial nodes; determining a relation type for searching according to the query words; searching a target node in a graph database according to the initial node and the searching relation type; and taking the content corresponding to the searched target node as the associated content corresponding to the first qualifier. It will be appreciated that in a graph database, edges connected between different nodes typically have attributes, and the attributes of edges between different nodes can reflect the type of relationship between the nodes. The search relation type is determined through the query words, and the nodes are searched according to the search relation type, so that the search of the associated content can be realized more pertinently.
S420: and generating a relation data table according to each non-query word and the searched association content.
In this embodiment, when related content cannot be found in the graphic database according to the query, the generated relational data table may not have the corresponding related content. As shown in table 1, the related content of the query term may be other query terms, and the reply text may include reply content for the other query terms, which is beneficial to more comprehensively solving the user's query.
In this embodiment, the related content of the non-query word is searched according to the query word, so that the searched related content and the question text are more matched, thereby being beneficial to improving the matching degree between the question text and the answer text.
Furthermore, the embodiment of the present invention also proposes a storage medium having stored thereon a reply text generation program which, when executed by a processor, implements the steps of the reply text generation method as described above.
Referring to fig. 6, fig. 6 is a block diagram showing the construction of a first embodiment of the reply text generation device of the present invention.
As shown in fig. 6, the reply text generating device provided by the embodiment of the invention includes:
the extracting module 100 is used for extracting the question keywords in the question text;
the obtaining module 200 is configured to process the question text through a bidirectional recurrent neural network, and obtain context data corresponding to each question keyword;
the obtaining module 200 is further configured to obtain a target reply grammar structure and a word extraction rule associated with the target reply grammar structure according to each question keyword and context data corresponding to each question keyword;
the generating module 300 searches the associated content corresponding to each question keyword in the graphic database, and generates a relationship data table according to each question keyword and the searched associated content;
the generating module 300 is further configured to generate a reply text according to the target reply grammar structure, the word extraction rule, and the relational data table.
Other embodiments or specific implementations of the reply text generating device of the present invention may refer to the above method embodiments, and will not be described herein.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. read-only memory/random-access memory, magnetic disk, optical disk), comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the method according to the embodiments of the present invention.
The foregoing description is only of the preferred embodiments of the present invention, and is not intended to limit the scope of the invention, but rather is intended to cover any equivalents of the structures or equivalent processes disclosed herein or in the alternative, which may be employed directly or indirectly in other related arts.
Claims (7)
1. A reply text generation method, characterized in that the reply text generation method comprises the steps of:
extracting question keywords in a question text;
processing the question text through a bidirectional circulating neural network to acquire context data corresponding to each question keyword;
acquiring a target answer grammar structure and word extraction rules associated with the target answer grammar structure according to each question keyword and context data corresponding to each question keyword;
searching associated content corresponding to each question keyword in a graphic database, and generating a relation data table according to each question keyword and the searched associated content;
generating a reply text according to the target reply grammar structure, the word extraction rule and the relation data table;
the method specifically comprises the steps of obtaining a target answer grammar structure and word extraction rules associated with the target answer grammar structure according to each question keyword and context data corresponding to each question keyword, wherein the steps comprise:
acquiring a target question grammar structure according to each question keyword and the context data corresponding to each question keyword;
searching a plurality of corresponding reply grammar structures according to the target question grammar structure;
randomly selecting one of the corresponding reply grammar structures as a target reply grammar structure;
according to the target reply grammar structure, acquiring word extraction rules associated with the target reply grammar structure;
the step of obtaining the target question grammar structure according to each question keyword and the context data corresponding to each question keyword specifically comprises the following steps:
obtaining a plurality of grammar structure trees to be selected according to each question keyword;
selecting one of the plurality of grammar structure trees to be selected according to each question keyword and the context data corresponding to each question keyword, and taking the selected grammar structure tree to be selected as a target question grammar structure;
in the step of extracting the question keywords in the question text, the question keywords comprise query words and non-query words;
searching associated content corresponding to each question keyword in a graphic database, and generating a relational data table according to each question keyword and the searched associated content, wherein the method specifically comprises the following steps of:
searching associated content corresponding to each non-query word in the graphic database according to each query word;
generating a relation data table according to each non-query word and the searched association content;
the term extraction rule refers to a rule for extracting words from a relational data table.
2. The reply text generation method of claim 1, wherein the bi-directional recurrent neural network includes a first unidirectional recurrent neural network and a second unidirectional recurrent neural network;
the step of processing the question text through a bidirectional cyclic neural network to obtain context data corresponding to each question keyword specifically comprises the following steps:
extracting the above data of each question keyword through the first unidirectional circulating neural network;
extracting the following data of each question keyword through the second unidirectional circulating neural network;
context data corresponding to each question keyword is generated based on the context data and the context data corresponding to each question keyword.
3. The method for generating a response text according to claim 1, wherein one of the plurality of grammar structure trees to be selected is selected based on each question keyword and the context data corresponding to each question keyword, and the selected grammar structure tree to be selected is used as the target question grammar structure, and the method specifically comprises the steps of:
acquiring the parts of speech corresponding to each question keyword according to the context data corresponding to each question keyword;
calculating respective confidence probabilities of the plurality of grammar trees to be selected according to each question keyword and the part of speech corresponding to each question keyword;
and selecting one of the plurality of grammar trees to be selected, which has the largest confidence probability, and taking the selected grammar tree to be selected as a target question grammar structure.
4. The reply text generation method of claim 3, wherein the step of searching the graphic database for associated contents corresponding to each non-query word based on each query word, specifically comprises:
searching nodes corresponding to the first qualifier in the graphic database, and taking the searched nodes as initial nodes;
determining a relation type for searching according to the query words;
searching a target node in a graph database according to the initial node and the searching relation type;
and taking the content corresponding to the searched target node as the associated content corresponding to the first qualifier.
5. A reply text generation device characterized by comprising:
the extraction module is used for extracting the question keywords in the question text;
the acquisition module is used for processing the questioning text through a bidirectional circulating neural network and acquiring context data corresponding to each questioning keyword;
the acquisition module is also used for acquiring a target reply grammar structure and word extraction rules associated with the target reply grammar structure according to each question keyword and the context data corresponding to each question keyword;
the generation module searches the associated content corresponding to each question keyword in the graphic database, and generates a relation data table according to each question keyword and the searched associated content;
the generating module is further used for generating a reply text according to the target reply grammar structure, the word extraction rule and the relation data table;
according to each question keyword and the context data corresponding to each question keyword, acquiring a target answer grammar structure and a word extraction rule associated with the target answer grammar structure, wherein the word extraction rule specifically comprises the following steps:
acquiring a target question grammar structure according to each question keyword and the context data corresponding to each question keyword;
searching a plurality of corresponding reply grammar structures according to the target question grammar structure;
randomly selecting one of the corresponding reply grammar structures as a target reply grammar structure;
according to the target reply grammar structure, acquiring word extraction rules associated with the target reply grammar structure;
according to each question keyword and the context data corresponding to each question keyword, the target question grammar structure is obtained, and the method specifically comprises the following steps:
obtaining a plurality of grammar structure trees to be selected according to each question keyword;
selecting one of the plurality of grammar structure trees to be selected according to each question keyword and the context data corresponding to each question keyword, and taking the selected grammar structure tree to be selected as a target question grammar structure;
in the step of extracting the question keywords in the question text, the question keywords comprise query words and non-query words;
searching associated content corresponding to each question keyword in a graphic database, and generating a relationship data table according to each question keyword and the searched associated content, wherein the relationship data table specifically comprises the following steps:
searching associated content corresponding to each non-query word in the graphic database according to each query word;
generating a relation data table according to each non-query word and the searched association content;
the term extraction rule refers to a rule for extracting words from a relational data table.
6. A reply text generation device, characterized in that the reply text generation device comprises: a memory, a processor and a reply text generation program stored on the memory and executable on the processor, the reply text generation program configured to implement the steps of the reply text generation method of any one of claims 1 to 4.
7. A storage medium having stored thereon a reply text generation program which, when executed by a processor, implements the steps of the reply text generation method of any one of claims 1 to 4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910020809.3A CN109840255B (en) | 2019-01-09 | 2019-01-09 | Reply text generation method, device, equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910020809.3A CN109840255B (en) | 2019-01-09 | 2019-01-09 | Reply text generation method, device, equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109840255A CN109840255A (en) | 2019-06-04 |
CN109840255B true CN109840255B (en) | 2023-09-19 |
Family
ID=66883726
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910020809.3A Active CN109840255B (en) | 2019-01-09 | 2019-01-09 | Reply text generation method, device, equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109840255B (en) |
Families Citing this family (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110309282B (en) * | 2019-06-14 | 2021-08-27 | 北京奇艺世纪科技有限公司 | Answer determination method and device |
CN110309378B (en) * | 2019-06-28 | 2023-06-09 | 深圳前海微众银行股份有限公司 | Method, device and system for processing question replies |
CN110931012A (en) * | 2019-10-12 | 2020-03-27 | 深圳壹账通智能科技有限公司 | Reply message generation method and device, computer equipment and storage medium |
CN112199482B (en) * | 2020-09-30 | 2023-07-21 | 平安科技(深圳)有限公司 | Dialogue generation method, device, equipment and readable storage medium |
CN117033664B (en) * | 2023-09-28 | 2024-01-09 | 腾讯科技(深圳)有限公司 | Service sequence diagram generation method, device, computer equipment and storage medium |
CN117610506B (en) * | 2023-11-24 | 2024-04-30 | 中国人民解放军军事科学院系统工程研究院 | Text information extraction method and device |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105068661A (en) * | 2015-09-07 | 2015-11-18 | 百度在线网络技术(北京)有限公司 | Man-machine interaction method and system based on artificial intelligence |
CN106469212A (en) * | 2016-09-05 | 2017-03-01 | 北京百度网讯科技有限公司 | Man-machine interaction method based on artificial intelligence and device |
CN106997399A (en) * | 2017-05-24 | 2017-08-01 | 海南大学 | A kind of classification question answering system design method that framework is associated based on data collection of illustrative plates, Information Atlas, knowledge mapping and wisdom collection of illustrative plates |
CN108595494A (en) * | 2018-03-15 | 2018-09-28 | 腾讯科技(深圳)有限公司 | The acquisition methods and device of reply message |
WO2018226404A1 (en) * | 2017-06-09 | 2018-12-13 | Microsoft Technology Licensing, Llc | Machine reasoning based on knowledge graph |
-
2019
- 2019-01-09 CN CN201910020809.3A patent/CN109840255B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105068661A (en) * | 2015-09-07 | 2015-11-18 | 百度在线网络技术(北京)有限公司 | Man-machine interaction method and system based on artificial intelligence |
CN106469212A (en) * | 2016-09-05 | 2017-03-01 | 北京百度网讯科技有限公司 | Man-machine interaction method based on artificial intelligence and device |
WO2018040501A1 (en) * | 2016-09-05 | 2018-03-08 | 北京百度网讯科技有限公司 | Man-machine interaction method and apparatus based on artificial intelligence |
CN106997399A (en) * | 2017-05-24 | 2017-08-01 | 海南大学 | A kind of classification question answering system design method that framework is associated based on data collection of illustrative plates, Information Atlas, knowledge mapping and wisdom collection of illustrative plates |
WO2018226404A1 (en) * | 2017-06-09 | 2018-12-13 | Microsoft Technology Licensing, Llc | Machine reasoning based on knowledge graph |
CN108595494A (en) * | 2018-03-15 | 2018-09-28 | 腾讯科技(深圳)有限公司 | The acquisition methods and device of reply message |
Also Published As
Publication number | Publication date |
---|---|
CN109840255A (en) | 2019-06-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109840255B (en) | Reply text generation method, device, equipment and storage medium | |
US11640515B2 (en) | Method and neural network system for human-computer interaction, and user equipment | |
CN110222045B (en) | Data report acquisition method and device, computer equipment and storage medium | |
US10496928B2 (en) | Non-factoid question-answering system and method | |
US10503828B2 (en) | System and method for answering natural language question | |
CN112417102B (en) | Voice query method, device, server and readable storage medium | |
CN110717034A (en) | Ontology construction method and device | |
US7676519B2 (en) | Method and system for responding to requests relating to complex data maintained in a structured form | |
US20160275196A1 (en) | Semantic search apparatus and method using mobile terminal | |
WO2001096980A2 (en) | Method and system for text analysis | |
KR102292040B1 (en) | System and method for extracting knowledge based on machine reading | |
CN111506721A (en) | Question-answering system and construction method for domain knowledge graph | |
US20200089756A1 (en) | Preserving and processing ambiguity in natural language | |
JP2006244262A (en) | Retrieval system, method and program for answer to question | |
CN116991977B (en) | Domain vector knowledge accurate retrieval method and device based on large language model | |
KR101709055B1 (en) | Apparatus and Method for Question Analysis for Open web Question-Answering | |
CN112328800A (en) | System and method for automatically generating programming specification question answers | |
US20220058349A1 (en) | Data processing method, device, and storage medium | |
CN114818729A (en) | Method, device and medium for training semantic recognition model and searching sentence | |
WO2022022049A1 (en) | Long difficult text sentence compression method and apparatus, computer device, and storage medium | |
CN117932022A (en) | Intelligent question-answering method and device, electronic equipment and storage medium | |
İnce | Spell checking and error correcting application for Turkish | |
Dashti et al. | Correcting real-word spelling errors: A new hybrid approach | |
Setiaji et al. | Internet Answering Machine Based on Knowledge Representation | |
CN107203512B (en) | Method for extracting key elements from natural language input of user |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |