CN106682221B - Question-answer interaction response method and device and question-answer system - Google Patents

Question-answer interaction response method and device and question-answer system Download PDF

Info

Publication number
CN106682221B
CN106682221B CN201710004348.1A CN201710004348A CN106682221B CN 106682221 B CN106682221 B CN 106682221B CN 201710004348 A CN201710004348 A CN 201710004348A CN 106682221 B CN106682221 B CN 106682221B
Authority
CN
China
Prior art keywords
search
searched
keyword
searching
answer
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
Application number
CN201710004348.1A
Other languages
Chinese (zh)
Other versions
CN106682221A (en
Inventor
姚贡之
朱频频
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Xiaoi Robot Technology Co Ltd
Original Assignee
Shanghai Xiaoi Robot Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Shanghai Xiaoi Robot Technology Co Ltd filed Critical Shanghai Xiaoi Robot Technology Co Ltd
Priority to CN201710004348.1A priority Critical patent/CN106682221B/en
Publication of CN106682221A publication Critical patent/CN106682221A/en
Application granted granted Critical
Publication of CN106682221B publication Critical patent/CN106682221B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • G06F16/3344Query execution using natural language analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/332Query formulation
    • G06F16/3329Natural language query formulation or dialogue systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Artificial Intelligence (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Mathematical Physics (AREA)
  • Human Computer Interaction (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • General Health & Medical Sciences (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

A response method, a device and a question-answering system of question-answering interaction are provided, wherein the method comprises the following steps: matching questions in a knowledge base according to a user request, and acquiring answers corresponding to the questions, wherein the knowledge base comprises a plurality of questions and answers corresponding to the questions; and when the answer is a search instruction comprising at least one search keyword and a search address, searching in the data source pointed by the search address according to the search keyword to obtain a search result for responding to the user request. The technical scheme of the invention realizes the optimization of the response mode of question-answer interaction, thereby improving the development efficiency aiming at natural language search.

Description

Question-answer interaction response method and device and question-answer system
Technical Field
The invention relates to the technical field of computers, in particular to a question-answer interaction response method, a question-answer interaction response device and a question-answer system.
Background
With the development of intelligent question and answer technology, an intelligent question and answer system is adopted in more and more platforms (such as a QQ, Skype, an e-commerce customer service system, an MSN platform, a WeChat platform, a short message service platform and the like). The intelligent question-answering system can output corresponding answers based on the questions of the user.
In the prior art, for different application platforms, output contents provided by intelligent question answering systems loaded inside the application platforms are often different, and thus input contents of users during searching are also greatly different. When a developer designs an intelligent question-answering system, the developer needs to develop an adaptive search function for each application platform. For example, for an automobile query platform, a search function for an automobile query needs to be developed; for the disease diagnosis and treatment platform, a search function for disease diagnosis and treatment needs to be developed.
However, in the prior art, the workload of developers is increased by the design mode of the intelligent question-answering systems of different application platforms, and the development efficiency is low.
Disclosure of Invention
The invention solves the technical problem of how to realize the optimization of the response mode of question-answer interaction, thereby improving the development efficiency aiming at natural language search.
In order to solve the above technical problem, an embodiment of the present invention provides a response method for question-answer interaction, where the response method for question-answer interaction includes:
matching questions in a knowledge base according to a user request, and acquiring answers corresponding to the questions, wherein the knowledge base comprises a plurality of questions and answers corresponding to the questions; and when the answer is a search instruction comprising at least one search keyword and a search address, searching in the data source pointed by the search address according to the search keyword to obtain a search result for responding to the user request.
Optionally, the response method further includes: and outputting the search result.
Optionally, the search instruction includes a matching pattern; the searching in the data source pointed by the search address according to the search keyword comprises: and performing traversal search in the data source pointed by the search address according to the search keyword in a mode designated by the matching mode.
Optionally, the data source is a two-dimensional table; the traversing search in the data source pointed by the search address according to the search keyword comprises: and matching the search keywords with the terms in all search columns or search rows in the two-dimensional table.
Optionally, the matching pattern includes one or more of: beginning with the search key, ending with the search key, and including the search key.
Optionally, the search instruction includes a first content template; the outputting the search result comprises: and when the search is successful, adding the searched data into the first content template and outputting.
Optionally, the search instruction includes a second content template; the outputting the search result comprises: and when the search fails, outputting the second content template to prompt the user that the data matched with the search keyword is not searched.
Optionally, the search instruction includes a maximum number of returned results; the outputting the search result further comprises: if the number of the searched data is less than or equal to the maximum number of the returned results, outputting all the searched data; and if the number of the searched data is larger than the maximum returned result number, outputting the searched data with the maximum returned result number.
Optionally, the search instruction includes a set number of searches; the searching in the data source pointed by the search address according to the search keyword comprises: and when the search fails, sending prompt information, and searching again based on the input of the user until the search times reach the set search times.
Optionally, the search instruction includes a search mode, where the search mode includes a fuzzy search or an accurate search; the searching in the data source pointed by the search address according to the search keyword comprises: when the searching mode is the accurate searching, and when the searched content only contains the searching keyword, the searched content is used as the searching result; and when the search mode is the fuzzy search and the searched content contains the search keyword, taking the searched content as the search result.
In order to solve the above technical problem, an embodiment of the present invention further provides a response device for question-answer interaction, where the response device for question-answer interaction includes:
the system comprises an answer obtaining module, a question analyzing module and a question analyzing module, wherein the answer obtaining module is used for matching questions in a knowledge base according to user requests and obtaining answers corresponding to the questions, and the knowledge base comprises a plurality of questions and answers corresponding to the questions; and the searching module is used for searching in the data source pointed by the searching address according to the searching keyword when the answer is a searching instruction comprising at least one searching keyword and the searching address so as to obtain a searching result for responding to the user request.
Optionally, the response device further includes: and the output module is used for outputting the search result.
Optionally, the search instruction includes a matching pattern; the search module comprises: and the traversal searching unit is used for performing traversal searching in the data source pointed by the search address according to the search keyword in a mode designated by the matching mode.
Optionally, the data source is a two-dimensional table; and the traversal search unit matches the search keyword with words in all search columns or search rows in the two-dimensional table.
Optionally, the matching pattern includes one or more of: beginning with the search key, ending with the search key, and including the search key.
Optionally, the search instruction includes a first content template; the output module includes: and the first content unit is used for adding the searched data into the first content template and outputting the data when the search is successful.
Optionally, the search instruction includes a second content template; the output module includes: and the second content unit is used for outputting the second content template when the search fails so as to prompt the user that the data matched with the search keyword is not searched.
Optionally, the search instruction includes a maximum number of returned results; the output module includes: a total output unit configured to output all of the searched data when the number of the searched data is less than or equal to the maximum number of returned results; a maximum number output unit, configured to output the searched data of the maximum number of returned results if the number of the searched data is greater than the maximum number of returned results.
Optionally, the search instruction includes a set number of searches; the search module comprises: and the prompting unit is used for sending prompting information when the search fails and searching again based on the input of the user until the search frequency reaches the set search frequency.
Optionally, the search instruction includes a search mode, where the search mode includes a fuzzy search or an accurate search; the search module comprises: the accurate searching unit is used for taking the searched content as the searching result when the searching mode is the accurate searching and the searched content only contains the searching keyword; and the fuzzy search unit is used for taking the searched content as the search result when the searched content contains the search keyword when the search mode is the fuzzy search.
In order to solve the technical problem, the embodiment of the invention also discloses a question-answering system which comprises a question-answering interactive response device.
Compared with the prior art, the technical scheme of the embodiment of the invention has the following beneficial effects:
according to the technical scheme, the problems in a knowledge base are matched according to a user request, and answers corresponding to the problems are obtained, wherein the knowledge base comprises a plurality of problems and corresponding answers; and when the answer is a search instruction comprising at least one search keyword and a search address, searching in the data source pointed by the search address according to the search keyword to obtain a search result for responding to the user request. According to the technical scheme, the search instruction is obtained by matching in the knowledge base according to the user request, the search is carried out in the data source pointed by the search address in the search instruction based on the search keyword in the search instruction, the search of different data sources with different data contents is realized, and the search result for responding to the user request is obtained. The scheme of the embodiment of the invention avoids the response mode aiming at a single application platform in the prior art, realizes the optimization of the response mode of question-answer interaction, and further improves the development efficiency of developers aiming at natural language search; meanwhile, when the data source to be searched is changed, the search address in the search instruction can be adaptively changed, so that the flexibility of a response mode of question-answer interaction is improved, the workload of developers is further reduced, and the development efficiency is improved.
Further, the search instruction includes a first content template; the outputting the search result comprises: when the search is successful, adding the searched data into the first content template and outputting; the search instruction comprises a second content template; the outputting the search result comprises: and when the search fails, outputting the second content template to prompt the user that the data matched with the search keyword is not searched. According to the technical scheme, the first content template and the second content template are configured in the search instruction, so that the search result can be informed to the user by respectively utilizing the first content template or the second content template when the search is successful or failed, and the flexibility of response to question-answer interaction is further realized.
Drawings
FIG. 1 is a flow chart of a response method of question-answer interaction according to an embodiment of the present invention;
FIG. 2 is a flow chart of another method for responding to a question-answer interaction in accordance with an embodiment of the present invention;
FIG. 3 is a schematic structural diagram of a response apparatus for question-answer interaction according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of another response device for question-answer interaction according to an embodiment of the present invention.
Detailed Description
As described in the background art, in the prior art, the design manner of the intelligent question answering systems for different application platforms increases the workload of developers, and the development efficiency is low.
According to the embodiment of the invention, the search instruction is obtained by matching in the knowledge base according to the user request, and the search is carried out in the data source pointed by the search address in the search instruction based on the search keyword in the search instruction, so that the search of different data sources with different data contents is realized, and the search result for responding to the user request is obtained. The embodiment of the invention avoids the response mode aiming at a single application platform in the prior art, realizes the optimization of the response mode of question-answer interaction, and further improves the development efficiency of developers aiming at natural language search; meanwhile, when the data source to be searched is changed, the search address in the search instruction can be adaptively changed, so that the flexibility of a response mode of question-answer interaction is improved, the workload of developers is further reduced, and the development efficiency is improved.
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in detail below.
Fig. 1 is a flowchart of a response method of question-answer interaction according to an embodiment of the present invention.
The response method of the question-answer interaction shown in fig. 1 may include the following steps:
step S101: matching questions in a knowledge base according to a user request, and acquiring answers corresponding to the questions, wherein the knowledge base comprises a plurality of questions and answers corresponding to the questions;
step S102: and when the answer is a search instruction comprising at least one search keyword and a search address, searching in the data source pointed by the search address according to the search keyword to obtain a search result for responding to the user request.
In particular implementations, the knowledge base may include a plurality of questions. The knowledge base may also include answers to the plurality of questions. Specifically, the knowledge base may store a plurality of knowledge points, each including one or more preset questions and corresponding answer information. The user request may be voice data input by a user. More specifically, the user request may be a user question.
The most primitive and simplest form of knowledge point may be the Frequently Asked Questions (FAQ) that are commonly used at ordinary times, the general form being a "question-answer" pair. For example, "tariff for a coloring ring back tone" is a well-expressed standard question description. The question in a question-answer pair should not be construed narrowly as a "question" but broadly as an "input" with a corresponding "output". For example, for semantic recognition for a control system, an instruction of a user, for example "turn on radio", should also be understood as a "question", in which case the corresponding "answer" may be a call to a control program for executing the corresponding control.
In a specific implementation, in step S101, the user request may be matched with a question in the knowledge base, and when the question in the knowledge base is matched, an answer corresponding to the question is obtained. Specifically, whether the user request is matched with the problem in the knowledge base or not can be judged by calculating the highest semantic similarity between the user request and the problem in the knowledge base; and when the highest semantic similarity reaches a set threshold, determining that the user request is matched with the problems in the knowledge base. Specifically, a plurality of semantic similarities between the user request and a plurality of problems in the knowledge base can be respectively calculated, and the maximum semantic similarity is selected as the highest semantic similarity. It should be understood by those skilled in the art that any practicable manner may be adopted to calculate the semantic similarity, for example, the word frequency inverse file frequency, the word vector distance, and the like, which is not limited in this embodiment of the present invention.
In a specific implementation, the answer corresponding to the question in the knowledge base may be in a text format or an instruction format. When the answer corresponding to the question in the knowledge base is in the instruction format, the answer can control to execute the corresponding operation. It is understood that if the user requests that the determined answer is an answer in a text format, the answer may be directly output; if the answer determined by the user request is a search instruction, the instruction may control the search operation to be performed.
In a specific implementation, if the answer determined by the user request is a search instruction, in step S102, a search may be performed in the data source pointed to by the search address in the search instruction based on the search keyword in the search instruction. The search instruction may include at least one search keyword and a search address, where the search keyword may correspond to semantics of the user request. For example, the search instruction may be "search (k: $ [ nano-strand name 1] $ [ nano-strand name 2], nano-strand name, ds (attachment 1))", where the search keywords are the part of speech "$ [ nano-strand name 1 ]" and the part of speech "$ [ nano-strand name 2 ]", and the search address is "(attachment 1)". The part of speech can be divided according to the semantic meaning of the word, a group of related words are organized together to form a part of speech library with a tree structure, any non-leaf node in the tree structure is called a part of speech (generalized part of speech), and the first-level part of speech directly containing the word is called a narrow-sense part of speech. The purpose of defining the part of speech is mainly to use semantic information carried by the part of speech to carry out semantic similarity calculation. Specifically, since a plurality of knowledge points in the knowledge base may be configured in advance, at least one search keyword and a search address included in an answer in each knowledge point may also be configured in advance. In an application scenario with multiple different data sources, different search keywords and search addresses may be configured in the answers, respectively, to meet the requirements of the user for question-answer interaction with multiple data contents.
It is understood that when a search result is obtained for responding to the user request, the search result may be a result when the search is successful, and then the content of the data source responding to the user request may be included in the search result at this time; the search result may also be a result when the search fails, and then the search result may include a prompt responding to the request of the user, and the like.
The embodiment of the invention obtains the search instruction by matching in the knowledge base according to the user request, and searches in the data source pointed by the search address in the search instruction based on the search keyword in the search instruction, thereby realizing the search of different data sources with different data contents and obtaining the search result for responding to the user request; the response mode aiming at a single application platform in the prior art is avoided, the optimization of the response mode of question-answer interaction is realized, and the development efficiency of developers aiming at natural language search is further improved; meanwhile, when the data source to be searched is changed, the search address in the search instruction can be adaptively changed, so that the flexibility of a response mode of question-answer interaction is improved, the workload of developers is further reduced, and the development efficiency is improved.
Preferably, the response method of the question-answer interaction shown in fig. 1 may further include the following steps: and outputting the search result. That is, when the search operation in step S102 fails or succeeds, the present embodiment outputs the search result responding to the user request, so as to avoid unnecessary waiting of the user when there is no output, and improve the user experience. When the search operation is successful, the output search result is the content obtained by the search; when the search operation fails, the output search result may be a failure prompt or the like.
Fig. 2 is a flowchart of another response method of question-answer interaction according to an embodiment of the present invention.
The response method of the question-answer interaction shown in fig. 2 may include the following steps:
step S201: matching questions in a knowledge base according to a user request, and acquiring answers corresponding to the questions;
step S202: when the answer is a search instruction comprising at least one search keyword and a search address, performing traversal search in a data source pointed by the search address according to the search keyword in a mode designated by the matching mode;
step S203: matching the search keywords with words in all search columns or search rows in the two-dimensional table;
step S204: judging whether the search is successful, if so, entering a step S206, otherwise, entering a step S205;
step S205: outputting the second content template to prompt the user that data matched with the search keyword is not searched;
step S206: adding the searched data into the first content template and outputting;
step S207: judging whether the number of the searched data is less than or equal to the maximum number of returned results, if so, entering a step S208, otherwise, entering a step S209;
step S208: outputting all the searched data;
step S209: outputting the searched data of the maximum number of returned results.
In the embodiment of the present invention, a data source is taken as a two-dimensional table, for example, EXCEL is taken as an example for explanation, and no limitation to the embodiment of the present invention is made. It will be appreciated by those skilled in the art that the data source may also be in any other implementable form, such as a tree-structured data source.
The step S101 shown in fig. 1 can be referred to for specific implementation of the step S201 in the embodiment of the present invention, and details are not described here.
In a specific implementation, when the answer determined by the user request is a search instruction including at least one search keyword and a search address, the search instruction may further include a matching pattern. Then in step S202, a traversal search may be performed within the data source pointed to by the search address according to the search key in a manner specified by the matching pattern. In particular, the matching pattern may include one or more of: beginning with the search key, ending with the search key, and including the search key. If the matching pattern starts with the search keyword, in step S202, when performing traversal search in the data source pointed by the search address, if the beginning of the content in the data source is the search keyword, the content matches the search keyword, the content is the content to be searched, and the search is successful this time. For example, the search key is "horse", and if the content within the data source is "horse ×" (where the symbol "") then the content matches the search key "horse". Correspondingly, the matching mode is that when the search keyword is ended, the content in the data source is matched with the search keyword if the end of the content is the search keyword; when the matching pattern is the one containing the search keyword, it means that the content in the data source matches the search keyword as long as the content contains the search keyword.
It is understood that in practical application scenarios, the matching mode can be selectively configured by the user to improve the search flexibility.
Specifically, in step S203, the search keyword may be matched with the terms in all search columns or search rows in the two-dimensional table. For example, in an application scenario for automobile query, a search line is an automobile brand, a search column is an automobile price and an automobile model, then when a search keyword is "bmw", the search line is matched, and when the search keyword is "bmw", the matched content includes the price of bmw and the model of bmw; in other words, the search result at this time may be data of one row and multiple columns in a two-dimensional table.
In a specific implementation, after the traversal search of the data source is completed, in step S204, it is determined whether the search is successful. Specifically, if data matching the search keyword is searched within the data source, it is determined that the search is successful; if the data matched with the search key word is not searched in the data source, the search is judged to fail.
In a specific implementation, when the answer determined by the user request is a search instruction including at least one search keyword and a search address, the search instruction may further include a second content template. In step S204, if the search fails, the user is prompted using the second content template that data matching the search keyword is not searched. For example, when the search fails, a "Xiao i temporarily does not know $ [ Naemouth name 1] of the stock code, and waits for you to check it" is output.
Accordingly, the search instruction may also include a first content template. In step S205, if the search is successful, the searched data is added to the first content template and output. That is, when data matching the search keyword is searched, the data is output using the first content template. For example, when the search is successful, output "$ [ nano stock name 1] that the nano-Stark stock code is $ (nano stock code)", where $ (nano stock code) is the searched data.
It is understood that, in an actual application scenario, the first content template and the second content template may be selectively configured by a user to improve flexibility of response of the question-answering interaction.
According to the embodiment of the invention, the first content template and the second content template are configured in the search instruction, so that the search result can be respectively informed to the user by using the first content template or the second content template when the search is successful or the search is failed, and the flexibility of response to the question-answer interaction is further realized.
In a specific implementation, the search instruction may further include a maximum number of returned results. In step S207, when the search is successful, it may be determined whether the number of the searched data is less than or equal to the maximum number of returned results, and if so, all of the searched data is output in step S208. Otherwise, the searched data of the maximum number of returned results is output in step S209. That is, the maximum number of returned results is configured in the search instruction to limit the number of searched data presented to the user, so that the output is optimized, and the user experience is improved.
Preferably, the search instruction may further include setting a number of searches. And sending prompt information before outputting the second content template after the search fails, and searching again based on the input of the user until the search times reach the set search times. In other words, before the number of searches does not reach the set number of searches, if the search fails, prompt information is sent first to prompt the user that data matched with the search keyword is not searched, so that the user can select to continue searching. For example, when the first search fails, a prompt message "do not find the stock code of $ [ na share name 1] by mini i, and do not need to continue searching" is sent, and the user inputs "please continue searching" by voice, so that the search can be performed again.
In the embodiment, the search times are set through configuration, so that search failure caused by a small number of search errors can be avoided, and further optimization of response to question-answer interaction is realized.
Preferably, the search instruction may further include a search mode, where the search mode includes a fuzzy search or an accurate search; the searching in the data source pointed by the search address according to the search keyword comprises: when the searching mode is the accurate searching, and when the searched content only contains the searching keyword, the searched content is used as the searching result; and when the search mode is the fuzzy search and the searched content contains the search keyword, taking the searched content as the search result. For example, if the search keyword is "farley", when the search mode is the accurate search, only if the searched content is "farley", the content may be used as the search result; when the search mode is the fuzzy search, when the searched content is "faradaic", or "faradaic", the content can be used as the search result. That is, the accuracy of the search can be improved by using the precise search mode, and the comprehensiveness of the search can be improved by using the fuzzy search mode.
It can be understood that, in an actual application scenario, the search mode may be selectively configured by the user to improve flexibility of response of the question-answering interaction.
The embodiment of the invention realizes the expandability of response of question-answer interaction by configuring various search parameters, such as a matching mode, a search mode, the maximum returned result quantity, the set search times, the first content template, the second content template and the like in the search instruction.
Fig. 3 is a schematic structural diagram of a response apparatus for question-answer interaction according to an embodiment of the present invention.
The device 30 for responding to question-answer interaction shown in fig. 3 may include an answer obtaining module 301 and a searching module 302.
The answer obtaining module 301 is configured to match questions in a knowledge base according to a user request, and obtain answers corresponding to the questions, where the knowledge base includes a plurality of questions and answers corresponding to the questions;
the search module 302 is configured to, when the answer is a search instruction including at least one search keyword and a search address, search in a data source pointed by the search address according to the search keyword to obtain a search result for responding to the user request.
In particular implementations, the knowledge base may include a plurality of questions. The knowledge base may also include answers to the plurality of questions. Specifically, the knowledge base may store a plurality of knowledge points, each including one or more preset questions and corresponding answer information. The user request may be voice data input by a user. More specifically, the user request may be a user question.
In a specific implementation, the answer obtaining module 301 may match the user request with the questions in the knowledge base, and obtain the answer corresponding to the question when the question in the knowledge base is matched. Specifically, whether the user request is matched with the problem in the knowledge base or not can be judged by calculating the highest semantic similarity between the user request and the problem in the knowledge base; and when the highest semantic similarity reaches a set threshold, determining that the user request is matched with the problems in the knowledge base. Specifically, a plurality of semantic similarities between the user request and a plurality of problems in the knowledge base can be respectively calculated, and the maximum semantic similarity is selected as the highest semantic similarity. It should be understood by those skilled in the art that any practicable manner may be adopted to calculate the semantic similarity, for example, the word frequency inverse file frequency, the word vector distance, and the like, which is not limited in this embodiment of the present invention.
In a specific implementation, the answer corresponding to the question in the knowledge base may be in a text format or an instruction format. When the answer corresponding to the question in the knowledge base is in the instruction format, the answer can control to execute the corresponding operation. It is understood that if the user requests that the determined answer be an answer in a text format, the answer may be directly output.
In particular implementations, if the answer determined by the user request is a search instruction, the search module 302 may search within the data source pointed to by the search address in the search instruction based on a search keyword in the search instruction. The search instruction may include at least one search keyword and a search address, where the search keyword may correspond to semantics of the user request. For example, the search instruction may be "search (k: $ [ nano-strand name 1] $ [ nano-strand name 2], nano-strand name, ds (attachment 1))", where the search keywords are the part of speech "$ [ nano-strand name 1 ]" and the part of speech "$ [ nano-strand name 2 ]", and the search address is "(attachment 1)". Specifically, since a plurality of knowledge points in the knowledge base may be configured in advance, at least one search keyword and a search address included in an answer in each knowledge point may also be configured in advance. In an application scenario with multiple different data sources, different search keywords and search addresses may be configured in the answers, respectively, to meet the requirements of the user for question-answer interaction with multiple data contents.
It is understood that when a search result is obtained for responding to the user request, the search result may be a result when the search is successful, and then the content of the data source responding to the user request may be included in the search result at this time; the search result may also be a result when the search fails, and then the search result may include a prompt responding to the request of the user, and the like.
The embodiment of the invention obtains the search instruction by matching in the knowledge base according to the user request, and searches in the data source pointed by the search address in the search instruction based on the search keyword in the search instruction, thereby realizing the search of different data sources with different data contents and obtaining the search result for responding to the user request; the response mode aiming at a single application platform in the prior art is avoided, the optimization of the response mode of question-answer interaction is realized, and the development efficiency of developers aiming at natural language search is further improved; meanwhile, when the data source to be searched is changed, the search address in the search instruction can be adaptively changed, so that the flexibility of a response mode of question-answer interaction is improved, the workload of developers is further reduced, and the development efficiency is improved.
Fig. 4 is a schematic structural diagram of another response device for question-answer interaction according to an embodiment of the present invention.
The response device 40 for question-answer interaction shown in fig. 4 may include an answer obtaining module 401, a search module 402 and an output module 403; the search module 402 may include a traversal search unit 4021, a prompt unit 4022, an exact search unit 4023, and a fuzzy search unit 4024. The output module 403 may include a first content unit 4031, a second content unit 4032, a total output unit 4033, and a maximum number output unit 4034.
The answer obtaining module 401 is configured to match questions in a knowledge base according to a user request, and obtain answers corresponding to the questions, where the knowledge base includes a plurality of questions and answers corresponding to the questions; the searching module 402 is configured to, when the answer is a search instruction including at least one search keyword and a search address, search in a data source pointed by the search address according to the search keyword to obtain a search result for responding to the user request.
The answer obtaining module 401 and the search module 402 according to the embodiment of the present invention may refer to the answer obtaining module 301 and the search module 302 shown in fig. 3, and are not described herein again.
Preferably, the device 40 for responding to question-answer interaction may further include an output module 403, and the output module 403 may output the search result. That is, if the search operation of the search module 402 fails or succeeds, the output module 403 outputs the search result responding to the user request, so as to avoid unnecessary waiting of the user when there is no output, thereby improving the user experience.
In a specific implementation, when the answer determined by the user request is a search instruction including at least one search keyword and a search address, the search instruction may further include a matching pattern. The traversal search unit 4021 may perform a traversal search within the data source to which the search address points according to the search key in a manner specified by the matching pattern. Specifically, the matching patterns include one or more of: beginning with the search key, ending with the search key, and including the search key.
In particular, the data source may be a two-dimensional table, such as EXCEL; the traversal search unit 4021 may match the search keyword with terms in all search columns or search rows in the two-dimensional table. And if the matching mode is that the search keyword is started, and when the traversal search is carried out in the data source pointed by the search address, if the beginning of the content in the data source is the search keyword, the content is matched with the search keyword, the content is the content to be searched, and the search is successful. For example, the search key is "BMW", and if the content within the data source is "BMW", then the content matches the search key "BMW". Correspondingly, the matching mode is that when the search keyword is ended, the content in the data source is matched with the search keyword if the end of the content is the search keyword; when the matching pattern is the one containing the search keyword, it means that the content in the data source matches the search keyword as long as the content contains the search keyword.
It is understood that in practical application scenarios, the matching mode can be selectively configured by the user to improve the search flexibility.
It will be appreciated by those skilled in the art that the data source may also be in any other implementable form, such as a tree-structured data source.
In specific implementation, after the traversal search of the data source is completed, whether the search is successful or not can be judged. Specifically, if data matching the search keyword is searched within the data source, it is determined that the search is successful; if the data matched with the search key word is not searched in the data source, the search is judged to fail.
In a specific implementation, when the answer determined by the user request is a search instruction including at least one search keyword and a search address, the search instruction may further include a second content template. In step S204, if the search fails, the second content unit 4032 is configured to output the second content template when the search fails, so as to prompt the user that data matching the search keyword is not searched. For example, when the search fails, a "Xiao i temporarily does not know $ [ Naemouth name 1] of the stock code, and waits for you to check it" is output.
Accordingly, the search instruction may also include a first content template. The first content unit 4031 is used to add the searched data to the first content template and output the first content template when the search is successful. That is, when data matching the search keyword is searched, the data is output using the first content template. For example, when the search is successful, output "$ [ nano stock name 1] that the nano-Stark stock code is $ (nano stock code)", where $ (nano stock code) is the searched data.
It is understood that, in an actual application scenario, the first content template and the second content template may be selectively configured by a user to improve flexibility of response of the question-answering interaction.
According to the embodiment of the invention, the first content template and the second content template are configured in the search instruction, so that the search result can be respectively informed to the user by using the first content template or the second content template when the search is successful or the search is failed, and the flexibility of response to the question-answer interaction is further realized.
In a specific implementation, the search instruction may further include a maximum number of returned results. When the search is successful, it may be determined whether the number of the searched data is less than or equal to the maximum number of returned results, and if so, all the output units 4033 output all the searched data. Otherwise, the maximum number output unit 4034 outputs the searched data of the maximum number of returned results. That is, the maximum number of returned results is configured in the search instruction to limit the number of searched data presented to the user, so that the output is optimized, and the user experience is improved.
Preferably, the search instruction may further include setting a number of searches. The prompt unit 4022 may further send prompt information before the search fails and the second content template is output, and re-search based on the user input until the number of searches reaches the set number of searches. In other words, before the number of searches does not reach the set number of searches, if the search fails, prompt information is sent first to prompt the user that data matched with the search keyword is not searched, so that the user can select to continue searching. For example, when the first search fails, a prompt message "do not find the stock code of $ [ na share name 1] by mini i, and do not need to continue searching" is sent, and the user inputs "please continue searching" by voice, so that the search can be performed again.
In the embodiment, the search times are set through configuration, so that search failure caused by a small number of search errors can be avoided, and further optimization of response to question-answer interaction is realized.
Preferably, the search instruction may further include a search mode, where the search mode includes a fuzzy search or an accurate search; the searching in the data source pointed by the search address according to the search keyword comprises: when the search mode is the accurate search, the accurate search unit 4023 may take the searched content as the search result when the searched content only includes the search keyword; when the search mode is the fuzzy search, the fuzzy search unit 4024 may use the searched content as the search result when the searched content includes the search keyword. For example, if the search keyword is "farley", when the search mode is the accurate search, only if the searched content is "farley", the content may be used as the search result; when the search mode is the fuzzy search, when the searched content is "faradaic", or "faradaic", the content can be used as the search result. That is, the accuracy of the search can be improved by using the precise search mode, and the comprehensiveness of the search can be improved by using the fuzzy search mode.
It can be understood that, in an actual application scenario, the search mode may be selectively configured by the user to improve flexibility of response of the question-answering interaction.
The embodiment of the invention also discloses a question-answering system which can comprise a question-answering interaction response device 30 shown in fig. 3 or a question-answering interaction response device 40 shown in fig. 4. The question-answering system can further comprise a knowledge base, wherein the knowledge base comprises a plurality of questions and corresponding answers.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer-readable storage medium, and the storage medium may include: ROM, RAM, magnetic or optical disks, and the like.
Although the present invention is disclosed above, the present invention is not limited thereto. Various changes and modifications may be effected therein by one skilled in the art without departing from the spirit and scope of the invention as defined in the appended claims.

Claims (19)

1. A method for responding to a question-answer interaction, comprising:
matching questions in a knowledge base according to a user request, and acquiring answers corresponding to the questions, wherein the knowledge base stores a plurality of knowledge points, each knowledge point comprises one or more preset questions and corresponding answers, the answers are in a text format or an instruction format, and when the answers are in a search instruction format, the answers comprise at least one preset search keyword and a preset search address; when the answer is a search instruction comprising at least one search keyword and a search address, searching in a data source pointed by the search address according to the search keyword to obtain a search result for responding to the user request;
outputting the search result;
when the answer is in a text format, directly outputting the answer;
matching questions in the knowledge base according to user requests includes: and judging whether the user request is matched with the problems in the knowledge base or not by calculating the highest semantic similarity between the user request and the problems in the knowledge base, and determining that the user request is matched with the problems in the knowledge base when the highest semantic similarity reaches a set threshold.
2. The response method of claim 1, wherein the search instruction comprises a matching pattern; the searching in the data source pointed by the search address according to the search keyword comprises:
and performing traversal search in the data source pointed by the search address according to the search keyword in a mode designated by the matching mode.
3. The response method of claim 2, wherein the data source is a two-dimensional table; the traversing search in the data source pointed by the search address according to the search keyword comprises:
and matching the search keywords with the terms in all search columns or search rows in the two-dimensional table.
4. The response method of claim 2, wherein the matching pattern comprises one or more of: beginning with the search key, ending with the search key, and including the search key.
5. The response method of claim 1, wherein the search instruction comprises a first content template; the outputting the search result comprises:
and when the search is successful, adding the searched data into the first content template and outputting.
6. The response method of claim 5, wherein the search instruction comprises a second content template; the outputting the search result comprises:
and when the search fails, outputting the second content template to prompt the user that the data matched with the search keyword is not searched.
7. The response method of claim 5, wherein the search instruction comprises a maximum number of returned results; the outputting the search result further comprises:
if the number of the searched data is less than or equal to the maximum number of the returned results, outputting all the searched data;
and if the number of the searched data is larger than the maximum returned result number, outputting the searched data with the maximum returned result number.
8. The response method according to any one of claims 1 to 7, wherein the search instruction includes setting a number of searches; the searching in the data source pointed by the search address according to the search keyword comprises:
and when the search fails, sending prompt information, and searching again based on the input of the user until the search times reach the set search times.
9. The response method according to any one of claims 1 to 7, wherein the search instruction includes a search mode, the search mode including a fuzzy search or a precise search; the searching in the data source pointed by the search address according to the search keyword comprises:
when the searching mode is the accurate searching, and when the searched content only contains the searching keyword, the searched content is used as the searching result;
and when the search mode is the fuzzy search and the searched content contains the search keyword, taking the searched content as the search result.
10. A response device for question-answer interaction, comprising:
the answer obtaining module is used for matching questions in a knowledge base according to user requests and obtaining answers corresponding to the questions, the knowledge base stores a plurality of knowledge points, each knowledge point comprises one or more preset questions and corresponding answers, the answers are in a text format or an instruction format, and when the answers are in a search instruction format, the answers comprise at least one preset search keyword and a preset search address; the search module is used for searching in a data source pointed by the search address according to the search keyword to obtain a search result for responding to the user request when the answer is a search instruction comprising at least one search keyword and the search address;
the output module is used for outputting the search result or directly outputting the answer when the answer is in a text format;
the answer obtaining module judges whether the user request is matched with the questions in the knowledge base or not by calculating the highest semantic similarity between the user request and the questions in the knowledge base, and determines that the user request is matched with the questions in the knowledge base when the highest semantic similarity reaches a set threshold.
11. The response unit of claim 10, wherein the search instruction comprises a matching pattern; the search module comprises:
and the traversal searching unit is used for performing traversal searching in the data source pointed by the search address according to the search keyword in a mode designated by the matching mode.
12. The response unit of claim 11, wherein the data source is a two-dimensional table; and the traversal search unit matches the search keyword with words in all search columns or search rows in the two-dimensional table.
13. The response device of claim 11, wherein the matching pattern comprises one or more of: beginning with the search key, ending with the search key, and including the search key.
14. The response unit of claim 11, wherein the search instruction comprises a first content template; the output module includes:
and the first content unit is used for adding the searched data into the first content template and outputting the data when the search is successful.
15. The response unit of claim 14, wherein the search instruction comprises a second content template; the output module includes:
and the second content unit is used for outputting the second content template when the search fails so as to prompt the user that the data matched with the search keyword is not searched.
16. The response unit of claim 14, wherein the search instruction comprises a maximum number of returned results; the output module includes:
a total output unit configured to output all of the searched data when the number of the searched data is less than or equal to the maximum number of returned results;
a maximum number output unit, configured to output the searched data of the maximum number of returned results if the number of the searched data is greater than the maximum number of returned results.
17. The response device according to any one of claims 10 to 16, wherein the search instruction includes a set number of searches; the search module comprises:
and the prompting unit is used for sending prompting information when the search fails and searching again based on the input of the user until the search frequency reaches the set search frequency.
18. The response device of any one of claims 10 to 16, wherein the search instruction comprises a search mode, the search mode comprising a fuzzy search or a precise search; the search module comprises:
the accurate searching unit is used for taking the searched content as the searching result when the searching mode is the accurate searching and the searched content only contains the searching keyword;
and the fuzzy search unit is used for taking the searched content as the search result when the searched content contains the search keyword when the search mode is the fuzzy search.
19. A question-answering system comprising a question-answering interactive response device according to any one of claims 10 to 18.
CN201710004348.1A 2017-01-04 2017-01-04 Question-answer interaction response method and device and question-answer system Active CN106682221B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710004348.1A CN106682221B (en) 2017-01-04 2017-01-04 Question-answer interaction response method and device and question-answer system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710004348.1A CN106682221B (en) 2017-01-04 2017-01-04 Question-answer interaction response method and device and question-answer system

Publications (2)

Publication Number Publication Date
CN106682221A CN106682221A (en) 2017-05-17
CN106682221B true CN106682221B (en) 2020-04-21

Family

ID=58848949

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710004348.1A Active CN106682221B (en) 2017-01-04 2017-01-04 Question-answer interaction response method and device and question-answer system

Country Status (1)

Country Link
CN (1) CN106682221B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109783612B (en) * 2018-12-29 2020-12-29 上海智臻智能网络科技股份有限公司 Report data positioning method and device, storage medium and terminal

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101566984A (en) * 2008-07-11 2009-10-28 博采林电子科技(深圳)有限公司 Search engine used in personal hand-held equipment and resource search method
CN102419776A (en) * 2011-12-31 2012-04-18 北京百度网讯科技有限公司 Method and equipment for meeting multi-dimensional search requirement of user
CN104965918A (en) * 2015-07-06 2015-10-07 无锡天脉聚源传媒科技有限公司 Keyword query-based search method and apparatus
CN105653576A (en) * 2015-12-16 2016-06-08 上海智臻智能网络科技股份有限公司 Information searching method and apparatus, manual position service method and system
CN106203052A (en) * 2016-08-19 2016-12-07 乔中力 Intelligent LED exchange method and device

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102098300A (en) * 2010-12-30 2011-06-15 百度在线网络技术(北京)有限公司 Knowledge information interactive service method, platform and site
US20130138480A1 (en) * 2011-11-30 2013-05-30 Xin Luna Dong Method and apparatus for exploring and selecting data sources
CN103425714A (en) * 2012-05-25 2013-12-04 北京搜狗信息服务有限公司 Query method and system
KR102131099B1 (en) * 2014-02-13 2020-08-05 삼성전자 주식회사 Dynamically modifying elements of User Interface based on knowledge graph
US10055505B2 (en) * 2015-09-22 2018-08-21 International Business Machines Corporation Maintaining continuous access to web content
CN105630938A (en) * 2015-12-23 2016-06-01 深圳市智客网络科技有限公司 Intelligent question-answering system
CN105787134B (en) * 2016-04-07 2019-09-20 上海智臻智能网络科技股份有限公司 Intelligent answer method, apparatus and system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101566984A (en) * 2008-07-11 2009-10-28 博采林电子科技(深圳)有限公司 Search engine used in personal hand-held equipment and resource search method
CN102419776A (en) * 2011-12-31 2012-04-18 北京百度网讯科技有限公司 Method and equipment for meeting multi-dimensional search requirement of user
CN104965918A (en) * 2015-07-06 2015-10-07 无锡天脉聚源传媒科技有限公司 Keyword query-based search method and apparatus
CN105653576A (en) * 2015-12-16 2016-06-08 上海智臻智能网络科技股份有限公司 Information searching method and apparatus, manual position service method and system
CN106203052A (en) * 2016-08-19 2016-12-07 乔中力 Intelligent LED exchange method and device

Also Published As

Publication number Publication date
CN106682221A (en) 2017-05-17

Similar Documents

Publication Publication Date Title
US10796696B2 (en) Tailoring an interactive dialog application based on creator provided content
CN109002510B (en) Dialogue processing method, device, equipment and medium
US8661023B1 (en) Optimizing search query logic to speed retrieval
US11461317B2 (en) Method, apparatus, system, device, and storage medium for answering knowledge questions
CN106991112B (en) Information query method and device
CN110941655B (en) Data format conversion method and device
CN109408799B (en) Semantic decision method and system
CN111309751A (en) Big data processing method and device
CN117521625A (en) Question answering method, question answering device, electronic equipment and medium
CN111221841A (en) Real-time processing method and device based on big data
CN117874210B (en) Autonomous interactive question-answering method, system, equipment and medium
CN112231544A (en) RPA robot search method, device and equipment combining RPA and AI
US20220172712A1 (en) Machine learning to propose actions in response to natural language questions
CN109033082B (en) Learning training method and device of semantic model and computer readable storage medium
CN110955712A (en) Development API processing method and device based on multiple data sources
CN117827879A (en) Method, device, equipment and medium for converting storage process
CN106682221B (en) Question-answer interaction response method and device and question-answer system
CN109885812B (en) Method and device for dynamically adding hotwords and readable storage medium
CN115203378A (en) Retrieval enhancement method, system and storage medium based on pre-training language model
CN111737425B (en) Response method, device, server and storage medium
CN112084768A (en) Multi-round interaction method and device and storage medium
CN111221843A (en) Big data processing method and device
TWI780502B (en) Speech recognition system, command generation system, and speech recognition method thereof
CN111797636B (en) Offline semantic analysis method and system
CN110263055B (en) Parameter prompting method, device, equipment and storage medium

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