WO2018149326A1 - 一种自然语言问句答案的生成方法、装置及服务器 - Google Patents

一种自然语言问句答案的生成方法、装置及服务器 Download PDF

Info

Publication number
WO2018149326A1
WO2018149326A1 PCT/CN2018/075410 CN2018075410W WO2018149326A1 WO 2018149326 A1 WO2018149326 A1 WO 2018149326A1 CN 2018075410 W CN2018075410 W CN 2018075410W WO 2018149326 A1 WO2018149326 A1 WO 2018149326A1
Authority
WO
WIPO (PCT)
Prior art keywords
intent
keyword
question
word
template
Prior art date
Application number
PCT/CN2018/075410
Other languages
English (en)
French (fr)
Inventor
张增明
姜飞俊
陈永健
汪洋
胡于响
沈慧
王成龙
杨洋
Original Assignee
阿里巴巴集团控股有限公司
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 阿里巴巴集团控股有限公司 filed Critical 阿里巴巴集团控股有限公司
Publication of WO2018149326A1 publication Critical patent/WO2018149326A1/zh

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/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/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/284Lexical analysis, e.g. tokenisation or collocates

Definitions

  • the present application relates to the field of intelligent question and answer technology, and in particular, to a method, a device and a server for generating a natural language question answer based on an intention recognition model and a keyword extraction model.
  • the intelligent question answering system is a system that provides users with personalized information services by interacting with users in a form of question-and-answer, accurately positioning the knowledge required by users such as websites or online stores.
  • intelligent question and answer is implemented by adopting a preset rule. For example, enumerate all possible questions and answers to the questions, and then abstract a rule for each question. Specifically, when generating the answer of the current question, it is checked whether the current question and each rule match in sequence, and if yes, the answer specified by the rule is executed to obtain an answer.
  • the present application provides an automatic generation method for question answers based on a pre-trained intent recognition model and a keyword extraction model, which is used to enumerate all intents in the domain, ie, a question, in a manner of pre-establishing an ontology.
  • the purpose of the inquiry is to configure the corresponding intent template according to the intent, that is, what kind of question can be configured to be answered by the intent template and how to answer. Further, training based on the intent template can more accurately identify the user intent.
  • the intent recognition model, and the keyword extraction model is used to extract the keywords of the user's question to assign values to the intent parameters in the intent template, so that the logic in the intent template can be executed to automatically generate the answer of the question.
  • the present application also provides an automatic generation device for an answer to a question and a server, such as a question and answer engine, etc., to ensure the implementation and application of the above method in practice.
  • the present application discloses a method for generating an answer to a question, the method comprising:
  • At least the keyword is extracted according to the pre-trained keyword extraction model to obtain a word labeling result, where the word labeling result includes: whether each participle of the question is a keyword and each keyword Word type;
  • the method in response to the triggering question, at least according to the pre-trained keyword extraction model, labeling the question to obtain a word labeling result, including:
  • the domain dictionary is used to store a correspondence relationship between each domain word and its corresponding word type;
  • the determining, according to the first label result and the second label result, the word labeling result of each participle in the word segment set includes:
  • the participle is determined to be a non-keyword.
  • the domain dictionary is generated by:
  • the attribute value corresponding to each attribute is used as a keyword, and the entity tag and the attribute name are used as the word type of the keyword, and the associated vocabulary of the keyword is also determined as a keyword, and the associated vocabulary includes: a synonym , synonyms, spoken expressions and aliases.
  • the determining the target intent of the question according to the word labeling result and the pre-trained intent recognition model including:
  • the intent template includes: determining all intent parameters required for an intent
  • the current intent is determined as the target intent
  • next candidate intent is selected as the current intention according to the order of the credibility, and the current intent template corresponding to the current intent is executed to determine whether the keywords in the word labeling result are complete. The steps until the plurality of candidate intents are selected.
  • the word type of each keyword in the word labeling result is used to assign all the intent parameters, and it is determined whether the all intent parameters can be assigned successfully.
  • the determining the target intent of the question according to the word labeling result and the pre-trained intent recognition model including:
  • At least the word labeling result is used as an input of the pre-trained intent recognition model to obtain a plurality of candidate intents and their corresponding credibility;
  • the first few candidate intents of the preset number are selected as the intent to be selected, and the intent to be selected is sent to the terminal for selection by the user, and the intention of the user selection returned by the terminal is determined.
  • the intention For the purpose of the intention;
  • the intent template includes: between the intent parameter and a parameter problem Correspondence relationship
  • the missing intent parameter is obtained according to a parameter input returned by the client and input by the user.
  • the method further includes:
  • the conversation content input by the user is saved into a conversation database, the conversation content including: an intention selected by the user and/or a parameter answer input by the user.
  • the method further includes:
  • the at least the word labeling result is used as an input of the pre-trained intent recognition model, and the plurality of candidate intents and their corresponding credibility are obtained, including:
  • the word tagging result and the dialog content are input into the pre-trained intent recognition model to obtain a plurality of candidate intents and their corresponding credibility.
  • the word type of each keyword in the word tagging result is used to assign all the intent parameters in the target intent template, and it is determined whether the all intent parameters can be assigned successfully.
  • the intent template is generated by:
  • the intent is for expressing the query purpose of the question, the intent includes: querying the attributes of the entity, asking the entity All relationships between the entity, querying other attributes or all attributes of the entity through one or more attributes of the entity, and/or asking the relationship of the entity through one or more attributes of the entity;
  • the intent template includes: a template identifier, a template description, a parameter parameter corresponding to the intent parameter and the intent parameter, an example sentence group corresponding to the intent, and a combination rule of each example sentence group;
  • the template identifier is used to uniquely represent an intent template, and the template description is used to describe the purpose of the intent template;
  • the intent parameter is a parameter corresponding to determining an intent, and the parameter problem is: when the corresponding intent parameter is missing
  • the example sentence in the example sentence group includes a variable name of the entity, and is used to indicate a problem that the intention template can solve, and the combination rule of each example sentence group is used to represent: example sentences in different example sentence groups Combination method.
  • the intent recognition model and the keyword extraction model are trained in the following manner:
  • a machine learning algorithm is adopted, and an intent classification model and a keyword extraction model are obtained by training.
  • the generating the training corpus according to the example sentence group and the example sentence combination rule configured in the intent template including:
  • variable value list includes: a variable name of the entity, a variable value of the entity, and a correspondence relationship between the two;
  • variable values of the entities in the variable value list are respectively replaced with the variable names in the variable example sentences to obtain a real example sentence;
  • the training corpus includes: a template identifier corresponding to the real example sentence and each keyword included in the real example sentence and a type thereof.
  • the target answer corresponding to the target intent is obtained according to the pre-configured target intent template corresponding to the target intent, including:
  • the application also discloses a generating device for answering a natural language question, the generating device is integrated on a server, and the generating device comprises:
  • the keyword labeling unit is configured to: in response to the triggering question, mark the question sentence according to the pre-trained keyword extraction model to obtain a word labeling result, where the word labeling result includes: whether each participle of the question sentence is Keywords and word types for each keyword;
  • An intention determining unit configured to determine a target intent of the question according to the word labeling result and the pre-trained intent recognition model
  • the answer obtaining unit is configured to acquire a target answer corresponding to the target intent according to a pre-configured target intent template corresponding to the target intent.
  • a word segment subunit for segmenting the question sentence to obtain a word segmentation set of the question sentence
  • a first marking subunit configured to perform keyword marking on each participle in the word segmentation to obtain a first marking result based on a domain dictionary corresponding to a domain to which the question belongs;
  • a second marking subunit configured to extract a model based on a pre-trained keyword, and perform keyword marking on each participle in the word segmentation to obtain a second marking result;
  • the domain dictionary is used to save each domain word and its corresponding Correspondence between word types;
  • a first determining subunit configured to determine a word labeling result of each participle in the word segment set according to the first labeling result and the second labeling result.
  • the first determining subunit includes:
  • a first determining subunit configured to determine, for each participle in the word segmentation set, whether the first tag result and the second tag result are both marked as keywords
  • a second determining subunit configured to determine the participle as a keyword if the first judging subunit is YES, and determine the keyword according to the first marking result or the second marking result Type of word;
  • the third determining subunit is configured to determine the participle as a non-keyword if the result of the first determining subunit is that the first marking result is marked as a keyword and the second marking result is marked as a non-keyword.
  • the intention determining unit comprises:
  • a first model processing subunit configured to use the word labeling result as an input of the pre-trained intent recognition model to obtain a plurality of candidate intents and corresponding credibility;
  • a fourth determining subunit configured to determine a candidate intent with the highest credibility among the plurality of candidate intents as a current intent
  • a second determining subunit configured to determine, according to the current intent template corresponding to the current intent, whether each keyword in the word labeling result is complete; the intent template includes: determining all intent parameters required for an intent;
  • a fifth determining subunit configured to determine the current intent as a target intent if the result of the second determining subunit is YES;
  • the triggering subunit is configured to trigger the second determining subunit after the selecting subunit selects the next candidate intent until the plurality of candidate intents are selected.
  • the intention determining unit comprises:
  • a second model processing subunit configured to use at least the word labeling result as an input of the pre-trained intent recognition model to obtain a plurality of candidate intents and their corresponding credibility;
  • a sixth determining subunit configured to determine a candidate intent with the highest credibility among the plurality of candidate intents as a current intent
  • a third determining subunit configured to determine whether the credibility of the current intent is greater than a preset credibility threshold
  • a seventh determining subunit configured to determine the current intent as the target intent if the result of the third determining subunit is greater than
  • Selecting a subunit configured to select, in the case that the result of the third determining subunit is no, the first plurality of candidate intents of the preset number as the intent to be selected;
  • a sending subunit configured to send the to-be-selected intent to the terminal for selection by the user
  • An eighth determining subunit configured to determine, by the terminal, an intention of the user selection as a target intention
  • a fourth determining subunit configured to determine, according to the target intent template corresponding to the target intent, whether each keyword in the word labeling result is complete;
  • a ninth determining subunit configured to determine, as a result of the fourth determining subunit, a intent parameter corresponding to the incomplete keyword as a missing intent parameter
  • a problem generating subunit configured to generate a parameter problem related to the target intent according to the missing intent parameter and the target intent template
  • the intent template includes: a correspondence between the intent parameter and the parameter problem
  • a parameter obtaining subunit configured to obtain the missing intent parameter according to a parameter input returned by the client and input by the user.
  • the answer obtaining unit includes:
  • An assignment subunit configured to assign a value to the intent parameter according to an intent parameter configured in the target intent template, to obtain a query parameter
  • a source data obtaining subunit configured to obtain source data of the target answer according to the query parameter
  • a processing subunit configured to process the source data according to a preset processing manner to obtain processed source data
  • the application also discloses a server, comprising: the aforementioned generating device.
  • the embodiments of the present application include the following advantages:
  • the training intent recognition model and the keyword extraction model can more accurately identify the intent, and extract more accurate keywords to prepare the intent parameter for the execution intent logic, the answer generation is not only improved. Efficiency and accuracy, and can also talk with the user, further clarify the user's true intention when the user does not express the intention, or further obtain the complete intent parameter, etc., in the case of clarifying the user's intention, thereby making the present.
  • the flexibility of the application embodiment is also better than the rule-based method in the prior art, and the user can have a dialogue with the user experience.
  • FIG. 2 is a schematic structural view of a body in the present application.
  • FIG. 4 is a flow chart of a training intent recognition model and a keyword extraction model in the present application
  • FIG. 5 is a scenario architecture diagram of the present application in practical application.
  • Embodiment 6 is a flowchart of Embodiment 1 of a method for generating an answer to a question in the present application
  • Embodiment 7 is a flowchart of Embodiment 2 of a method for generating an answer to a question in the present application
  • Embodiment 8 is a flowchart of Embodiment 3 of a method for generating an answer to a question in the present application
  • Embodiment 9 is a structural block diagram of Embodiment 1 of a device for generating an answer to a question in the present application
  • FIG. 10 is a structural block diagram of the determining intent unit 902 in Embodiment 2 of the generating device of the question answer of the present application;
  • FIG. 11 is a block diagram showing the structure of the determination intent unit 902 in the third embodiment of the apparatus for generating an answer to the question in the present application.
  • Ontology is the concept in the knowledge map, which can be understood as an abstraction to the real world. After human beings analyze the real world, many entities can be abstracted, and each entity has its own attributes. There is a relationship between entities and entities. Then the ontology can be understood as the expression and description of the relationship between these entities and entities.
  • poets and poems are two entities, each of which has its own attributes.
  • the attributes of the poet can include: name, dynasty, etc.
  • the attributes of the poem can include: content, title, dynasty, type Wait.
  • the ontology describes the relationship between the entity and the entity
  • all the schemas of the domain can be learned from the ontology, so that the intent of all the problems in the domain can be enumerated.
  • intent questions can be enumerated: ask the poet's work, ask the poet's dynasty, ask the poet's gender, ask the poet's content, ask the poetry's dynasty, ask The type of poetry, or, the author of the poem.
  • the question and answer engine automatically gives an answer after the user enters the question, and the question and answer engine allows the user to enter the question in the form of a natural language.
  • the process of getting the answer by the question answering engine according to the question input by the user is as follows: Firstly, the user's intention expressed by the user is understood by parsing the keyword language given by the user; then the answer is obtained by querying the knowledge base or by some algorithm; finally, giving the answer in the form of natural language The answer.
  • the question and answer engine can include a single round of question and answer engines and multiple rounds of question and answer engines.
  • the single-round question and answer engine is a question and answer, that is, the user asks a question, in which the intention and the keyword are clearly given, and the question and answer engine outputs an answer.
  • the multi-round question and answer engine can comprehensively identify the user's intention and parse the slot according to the user's current problem and past question and answer records (Context, Context), when the various parameters required for unclear intention or intention are not fully satisfied.
  • the question and answer engine will take control of the conversation and ask questions to the user until the user clearly expresses the intent and the complete slot, and the question and answer engine will give an answer.
  • the multi-round question-and-answer engine asks questions in the form of dialogues, and the experience for the user is like communicating with a real person.
  • an intent template is used to represent an intent.
  • An intent template may include a name of the intent, various slots satisfying the intent to execute, and execution logic of the intent.
  • the intent execution logic is configured in the intent template in the form of a groovy dynamic script.
  • Slot is an intent to execute parameters, for example, "What songs Jay Chou sang", “Jay Chou” is a slot. "What is the next sentence of the moonlight in front of the bed?" The question “Moonlight in front of the bed” is a slot. If the intention is treated as a sentence, then the slot is the keyword in the question; if the intent is treated as a function, then the slot is the parameter.
  • Slot extraction is to extract the slot in the user problem. If you want to answer a question correctly, slot extraction is very important. If the slot extracts an error, it directly leads to an intent parameter error, which in turn causes the result of the intent execution to be incorrect. Therefore, to answer a question correctly, slot extraction is very important.
  • Groovy is a scripting language that is fully compatible with Java syntax and can be executed dynamically in Java. Based on this feature, the groovy language can be used as the bearer of the execution logic in the intent template, ie the execution logic can be configured, so the execution logic can be rewritten without recompiling or restarting the system, which is extremely It facilitates the maintenance of the system and enhances the scalability of the system.
  • a knowledge base a knowledge map
  • the knowledge map stores knowledge in the form of graphs, which is different from relational databases.
  • the embodiment of the present application includes two kinds of reasoning, one is reasoning of knowledge, and the other is reasoning of user intention.
  • the embodiments of the present application mainly focus on the reasoning of the user's intention, because the reasoning of knowledge is the category of the knowledge mapping system.
  • the knowledge base records that A is the father of B, and B is the father of C.
  • the reasoning of the user's intention is to infer the user's intention based on the past context and the current user problem, as well as the automatically generated questions to the user and the user's answer.
  • Table 1 where Q is the user's question and A is the engine answer:
  • the machine will attempt to query the user's intent and reason the user's current intent based on the user's response and context.
  • the machine did not know the user's specific intentions, so the machine raised the question, and then the user expressed the concrete intention of how high the Eiffel Tower.
  • the machine understands that the user's intent is to query the height of an entity, and the entity is the Eiffel Tower, so the machine goes to the knowledge base to get the height attribute of the Eiffel Tower and then returns it to the user.
  • the user puts forward "how to go there" and expresses an intention to explicitly plan to go to a certain route.
  • the intent to plan a route to a certain place has two parameters, one is the starting point and the other is the ending point.
  • the machine can get the end point from the context of the Eiffel Tower, but do not know the starting point, so the machine can not perform this intention, so the machine raises questions about the starting point, and finally the machine gets the user said that the starting point is the Arc de Triomphe.
  • the machine will ask the user's intent as the first Q.
  • the machine can interpret what the user calls the Arc de Triomphe as a starting point for planning the intention to go to a certain route.
  • the starting point for the machine to plan the route to a certain place is the Arc de Triomphe.
  • the intention is to draw the planned route.
  • the machine can conclude from the context that the user's question is to change the starting point, so the machine gives the results of the planned route from Notre Dame to the Eiffel Tower.
  • a flow chart of configuring an intent template in the present application may include the following steps:
  • Step 101 Establish an ontology within the domain.
  • the city has attributes such as name and country
  • the attraction has attributes such as name and type.
  • Step 102 Generate a domain dictionary according to the ontology in the domain.
  • a domain dictionary containing the entity attribute value and the attribute name of the entity is generated.
  • the domain dictionary can be generated according to the following steps A1 to A2:
  • Step A1 Acquire each attribute of each entity in the domain.
  • each attribute included in each entity in the ontology is obtained.
  • the entities included in the ontology may be acquired by the city, the scenic spot, and the like, and the city may have the name, the country to which it belongs, and the like, and the attraction has attributes such as name, type, and business hours.
  • Step A2 using the attribute value corresponding to each attribute as a keyword, and using the entity tag and the attribute name as the word type of the keyword, and determining the synonyms, synonyms, and aliases of the keyword as keywords.
  • the obtained attribute value corresponding to each attribute is used as a keyword, and the entity tag and the attribute name are used as the word type of the keyword.
  • the names of cities are “Beijing” and “Shanghai”, and the country to which they belong is “China”.
  • “Beijing”, “Shanghai” and “China” are used as keywords; “city name” and “country country” are taken as Word type.
  • synonyms, synonyms, and aliases of the determined keywords may also be determined as keywords. For example, “China's capital” is an alias for the keyword "Beijing”, so the "China's capital” is also used as a keyword.
  • word types of keywords and keywords can also be determined by manual addition and supplementation.
  • the attribute value corresponding to each attribute of each entity acquired, and each attribute name of each entity as a word type can constitute a domain dictionary in the field. Since the keywords in a sentence can be determined by referring to the domain dictionary, in the subsequent process, using the domain dictionary, the sentence can be parsed and the words in the sentence can be extracted. In particular, domain dictionaries are very important for the role of the unpopular field.
  • ### is a separator, the separator is preceded by a keyword, followed by the word type corresponding to the keyword.
  • the domain dictionary has only a list of keywords, that is, only keywords, and no word types corresponding to the keywords. Such a domain dictionary can only recognize keywords in a sentence, and cannot determine the type of keywords.
  • Step 103 Determine the intent of all the questions in each field according to the relationship between the entities represented by the entities in the domain.
  • the first point is to ask about the attributes of the entity.
  • the second point is to ask all relationships between entities.
  • the above-mentioned tourism domain ontology has three kinds of relationships, and can have three kinds of intentions as shown below:
  • the third point is to query other attributes or all attributes of the entity through one or more attributes of the entity.
  • one or more attributes of an entity are located to the entity, and then other attributes of the entity are queried.
  • the above-mentioned urban entity may have the following intent: ⁇ Which country is the name of xxx? (Locate to the city by name, query country attributes) Which cities are included in the country whose name is xxx? (Query the name attribute by country to the city).
  • the fourth point is to query the relationship of the entity through one or more attributes of the entity.
  • the fourth point is the same as the method described in the third point above, where the entity is first located; the difference is that the third point is the attribute of the query entity, and the fourth point is the relationship of the query entity.
  • the third point is the attribute of the query entity
  • the fourth point is the relationship of the query entity.
  • the four methods described in the first point to the fourth point above all possible intents can be enumerated by the ontology, and the four methods constitute the intent enumeration algorithm. Some of the intents enumerated are not actually useful in real situations. For example, ask for the ID attribute, so the result of the intent enumeration may require some manual verification.
  • the first point is a special case of the third point, which is to locate the entity by name attribute and then query other attributes of the entity.
  • Step 104 Configure a corresponding intent template for each determined intent.
  • the intent template is responsible for answering a certain type of intent, for example, the following question: ⁇ What attractions does Hangzhou contain? What are the attractions in Xi'an? What are the fun places in Nanjing? ⁇ , each of these questions is an intent to ask what attractions a city has, all of which can be solved with an intent template. For another example, ⁇ How do you get to the Louvre from the Eiffel Tower? Planning a route from Notre Dame to the Eiffel Tower to take me from Notre Dame to the Louvre ⁇ , the question of planning the route to a place can also be solved with an intent template. It can be considered that the intent template is a configuration file of the intent to indicate how the intent corresponding to the configuration file should generate an answer.
  • the intent template may include: a template identifier, a template description, a parameter parameter corresponding to the intent parameter and the intent parameter, an example sentence group corresponding to the intent, and a combination rule of each example sentence group.
  • the template identifier is used to uniquely represent an intent template, and the template description is used to describe the purpose of the intent template; the intent parameter is a parameter corresponding to determining an intent; the parameter question is: a corresponding intent The problem that needs to be sent to the user when the parameter is missing; the example sentence in the example sentence group includes the variable name of the entity, and is used to indicate a problem that the intent template can solve; the combination rule of each example sentence group is used to represent: different example sentence groups The combination of the example sentences in .
  • the template description of the first intent template may be “find the attraction of a certain city”; the template description of the second intent template may be “planning a route from a certain place to a certain place”.
  • the intent parameter of the first intent template is the city name; the intent parameter of the second intent template has two, one is the starting point (startPoi) and the other is the end point (endPoi). If the user does not give an intent parameter during the conversation, the default parameter question needs to be used to ask the user. Table 6 below is the configuration of the complete intent parameter:
  • the example sentence group corresponding to the intent template indicates what kind of problem is suitable for solving with this template.
  • the example group is filled in by the designer of the template, and is generally summarized by the frequently asked questions in the analysis field.
  • the first example of an intent to find a city's attractions the example group can be as shown in Table 7 below:
  • this type of question is classified into this intent template in the problem classification.
  • the group of example sentences listed above does not have a group of tags.
  • the default is a group of example sentences. Therefore, there is no assembly logic between the example sentences.
  • the intent template that uses the question-and-answer format to dialogue is a single-round dialogue intention template.
  • the single-round dialog intention template is applicable to the question-and-answer application scenario, and the real example sentence generated using the example sentences in the single-round dialog intention template does not contain context information.
  • the server asks the user for a number of sentences, and then obtains the user's intention, and obtains more intent parameters. Therefore, the server needs to consider the context when answering the question of multiple rounds of dialogue, and when the intention of the user is not clearly obtained, or if more intent parameters are not obtained, further inquiry to the user is required. Further, the intent parameter or intention expressed by the user in the context can be fully considered in answering the question of the multiple rounds of dialogue.
  • the multi-round dialog intention template needs to explicitly set the group concept when configuring the example sentence, for example, the example sentence configuration shown in Table 9 below: There are six groups in total, and each group starts with a "#" symbol. If there is an "intent" keyword after the group number, it means that the group is given with a clear intention. Otherwise, the group may just express an intent parameter.
  • the first group gives both the intention and all the parameters required, and is an expression of a complete problem. If there is only the first group, the multi-round dialog intent template is converted into a single-round dialogue intention template. It can be seen that the single-round dialogue intention template is a special form of the multi-round dialogue intention template.
  • Each row in the above combination rule table represents a combination rule in which the number represents a group number.
  • the combination rule 10 "2, 3, 6" means that a sentence is randomly selected from the second group, and then a sentence is randomly selected from the third group, and then a sentence is randomly selected from the sixth group, and finally The three sentences are sequentially connected to form a set of multiple sentence examples.
  • each of the combination rules in Table 10 can obtain an example sentence of a multi-sentence question.
  • combination rule 1 "1" which is a separate combination of the first group of example sentences in Table 9
  • three different multi-sentence problems as shown below can be obtained.
  • the multiple sentence sentences corresponding to the multiple sentences may be incomplete, for example, a certain parameter may be missing, or may be complete, for example, a plurality of sentence sentences combined by the combination rule 5.
  • the multiple sentence sentences of the multi-sentence questions generated by each combination rule always contain an example sentence expressing the intention.
  • the example sentence groups 1 and 3 shown in Table 9 are all example sentence groups expressing the intention, so in the combination rule in Table 10, sentences in the example sentence group 1 or the example sentence group 3 are always used for combination. . This is to simulate a real scene where the user's question is not classified into any intent template when the user does not provide enough parameters and intent. Therefore, in order to obtain the user's intention, all of the example sentence combination rules contain at least one sentence expressing the intention.
  • the execution represented by the groovy script may also be configured.
  • Logic by executing the groovy script, can generate an answer to the user's question.
  • the step of executing the groovy script to generate an answer to the user's question may include: obtaining data, processing data, and generating an answer.
  • the acquisition of data refers to the source data to obtain the generated answer.
  • Processing data refers to processing the source data that generates the answer. Under normal circumstances, after obtaining the source data, it is generally not directly displayed to the user. The source data needs to be processed, including control check, format conversion, and algorithm processing, in order to obtain data that can be directly displayed to the user.
  • the answer is generated by collating the processed source data and presenting it to the user. After the data obtained by processing the source data, if it is directly displayed to the user, the system appears to be somewhat blunt. Therefore, the processed source data is colloquialized, and some reply templates can be applied in the process of colloquialization, or a string concatenation method can be adopted.
  • the intent template is a configuration rather than a code.
  • it can be implemented by changing the configuration of the execution logic in the intent template.
  • you need to increase the answer to a new intent question simply add the configuration of the execution logic in the corresponding intent template.
  • the embodiment of the present application uses the groovy script to implement the above three steps of acquiring data, processing data, and generating an answer.
  • the answer can be generated by simply executing the groovy script in the corresponding intent template.
  • ID is a template identifier for uniquely identifying a template
  • Desc is a template description for the purpose of describing a template in natural language
  • ArArgs is an intent parameter, which is required for the intent template. All the parameters, “Argument_script” is the script for assigning the intent parameter, “Data_retrieve_script” is the data acquisition script, “Data_process_script” is the data processing script, “Answer_generate_script” is the generation answer script, "Corpus” is the example sentence group, "Assemble_rule” is the example sentence group The combination rule of the group.
  • a plan function of a planner variable is directly used to obtain a route.
  • the script does not explain how the planner variable is initialized.
  • the planner variable is a route planning engine
  • the plan function is the entry function of the route plan.
  • Intent template When executing the script, before initializing the groovy executor, it is necessary to initialize the planner variable. This is done in the actual engine. After the initialization is completed, set the planner variable to the environment variable of the groovy execution engine. Then it can be used directly in the groovy script, so the above script will not report an error.
  • groovy script allows the question and answer engine of the intent template to answer any question, because the execution data acquisition script can get any data, whether it is directly querying the database, finding the knowledge map, calling the search engine, or calling other related systems, etc. Etc., can be achieved.
  • you can also perform complex data processing operations which may require complex algorithms for data processing
  • you can also perform complex data processing operations which may require complex algorithms for data processing
  • you can also perform complex data processing operations which may require complex algorithms for data processing
  • the single-round dialogue intention template is simple, the example sentence is simple, and the maintenance is simple. It is suitable for a simple scenario of one question and one answer (ie, the embodiment shown in FIG. 7), and the single-round dialogue intention template is one of the multi-round dialogue intention templates.
  • the multi-round dialog intent template is slightly more complicated, but can be applied to more scenarios (ie, the embodiment shown in FIG. 8), and the multi-round dialog intent template can communicate with the user in the form of a dialogue to mine the potential intention of the user, and thus Answer questions based on intent and therefore be more intelligent.
  • the intent template contains the example group corresponding to each question that the user may raise, and the intent template is configured with a groovy script that can execute the execution logic of the intent of each question raised by the user, and then It is necessary to utilize the configured intent to train the intent recognition model and the keyword extraction model in the embodiment of the present application.
  • the intent recognition model can be used to identify the intent of the question for a question, for example, a question is "How do you go from Ul Dame to the Louvre", enter the result of the question mark
  • the consciousness recognition model may obtain a plurality of candidate intents of the question and a credibility of the plurality of candidate intents, and the credibility may be used to indicate a likelihood of the candidate intent for the candidate, the higher the credibility, the corresponding candidate
  • the intention is that the likelihood of a user's true intent is greater.
  • the candidate intent can be represented by a template identification ID.
  • the intent recognition model is a natural language classifier
  • the natural language classifier is a machine learning model. No matter which machine learning algorithm is used, the same training corpus, that is, the natural language text with the mark, is required.
  • Table 14 a table is shown as an example of a natural language text with a mark.
  • a machine learning algorithm can be used to train the intent recognition model.
  • SVM Support Vector Machine
  • the process of generating the training corpus is the process of executing the example sentence combination rule in the configured intention template, and replacing the variable name of the entity in the example sentence with the variable value to generate the real example sentence.
  • the keyword extraction model is a sequence labeling model. Sequence labeling is a type of labeling each sequence in a sentence (that is, each participle after the word segmentation). Therefore, when training the keyword extraction model, the training can be performed according to the word labeling result of each real example sentence (for example, the real example sentence in Table 14), wherein the word labeling result may include: part-of-speech tagging of each participle, whether each participle is a key The labeling of words, as well as the labeling of word types for individual keywords, and so on.
  • the word labeling result can be: "How _r from _p Louvre _ns to _v Eiffel Tower _ns ## # plan_route_to_poi###O O B-startPoi O B-endPoi", in the labeling result, the content before the first separator "###" "How _r from _p Louvre _ns to _v Eiffel The tower _ns” is a word labeling result, the content "plan_route_to_poi” between the first separator and the second separator is the intent template ID corresponding to the real example sentence, and the content after the second separator "O O B -startPoi O B-endPoi” is a keyword labeling result, indicating that the participles "how” and “slave” are not keywords, while “Louvre” is a keyword, and the word type is "starting point", and the word
  • the embodiment may include the following steps 401 to 405:
  • Step 401 Obtain a variable value list of the entity, where the variable value list includes: a variable name of the entity, a variable value of the entity, and a correspondence between the two.
  • steps 401 to 404 are processes for generating training corpus.
  • these example sentences include the variable names of the entities, such as "City_name", and are only a collection of questions, which is a summary of the patterns of all possible questions.
  • This example sentence is not a real sentence because there is a variable name in the example sentence. If you replace these variable names with real variable values, such as replacing "City_name” with "Beijing", you can generate real example sentences. Therefore, the premise of generating a real record is a collection of all possible variable values of an entity's variable name.
  • variable name is "City_name”
  • possible variable value sets are: ⁇ Hangzhou, Suzhou, Beijing, Shanghai, London, Paris, etc. ⁇ . Therefore, by replacing the variable value in the set of variable values with the variable name in the example sentence, a set of real example sentences as shown below can be generated: ⁇ Which country is Hangzhou? Which country is Suzhou? Which country is Beijing? Which country is Shanghai? Which country is London? Which country is Paris? and many more ⁇
  • variable value of the attribute of the entity type and the attribute name is obtained from the knowledge base.
  • the above variable name "City_name”
  • the entity type is "City”
  • the attribute name is "name”
  • the variable value of the entity is obtained from the outside. For example, crawling from an external web page, etc.
  • manual maintenance Rely on the user's experience to add the corresponding variable values.
  • variable values such as the height variable named "$ ⁇ height ⁇ " and the weight variable named "$ ⁇ weight ⁇ ”.
  • Variable values for such variable names can be generated in a random manner. "Height” can generate a random integer between 100 and 230, representing the possible variable value (in centimeters).
  • the number of variable values is generally larger than the number of real example sentences generated.
  • the value of the variable is too much, it will increase the workload of obtaining the list of variable values of the entity, and it will also affect the system performance, so it is not the more the better.
  • Those skilled in the art can autonomously select the number of variable values when obtaining a list of variable values of the entity.
  • Step 402 Generate a variable example sentence including the variable name of the entity according to the combination rule of the example sentence group and the example sentence group configured in the intention template.
  • a variable example sentence including a variable name is generated according to a combination rule of the example sentence group and the example sentence group in the already configured intention template.
  • the example sentences in the intent template are unstructured, and the example sentences that have been edited in the intent template can be parsed, and the example sentences are stored in a certain data structure, for example, in the memory, and the subsequent use.
  • the example group can have only one group, that is, all the example sentences are numbered as "1", or other
  • the default group number is OK.
  • example sentence groups there are a plurality of example sentence groups, and "1, 2, 3, " can be used for each example sentence group number.
  • the combination rule of the example sentence group can also be obtained by reading the configured intent template.
  • the data structure of the combination rule for storing the example sentence group can also have many options, and the basis for the selection is to see if it is convenient for subsequent processing programs to use.
  • the combination rule of the example sentence group is used to indicate which number of example sentence groups need to be combined together. For example, the combination rule of the example sentence group is "1, 2", which means that it needs to be from the first example sentence group and the second example sentence group. Select an example sentence to generate a variable example sentence. For a single-round intent target, the combination rule of the example sentence group can be directly "1", or other default rules.
  • the example sentence group and its combination rules can be read to generate a certain number of real example sentences. Assume that the example sentence group and its combination rules have been parsed into a data structure (json format) as shown in Table 15.
  • the system performance may be degraded. It is possible to preset a number of real example sentences generated by a combination rule, for example, generate at most 100 real example sentences.
  • an example sentence can be randomly selected from each of the example sentence groups specified in the combination rule, and the type of the example sentence group is taken. If the type of the example sentence group is "intent", the real example sentence is marked as a template identification ID. If the type of the example sentence group is a keyword slot, a flag "-slot" is added after the template ID, indicating that the real example sentence is not directly indicated. Intent, but provide intent parameters. Then, according to the example sentence group specified by the combination rule, the example sentences including the variable name can be assembled to form a plurality of round variable example sentences.
  • Step 403 Replace the variable values of the entities in the variable value list with the variable names in the variable example sentences to obtain a real example sentence.
  • variable value of each entity in the variable value list obtained in step 401 is used to replace the variable in the variable example sentence shown in Table 16, and the real example sentence can be obtained.
  • the variable value list obtained in step 401 is used to replace the variable in the variable example sentence shown in Table 16, and the real example sentence can be obtained.
  • the "###" symbol is a separator, and the content before the separator is a real example sentence, and the content after the separator is the template identification ID corresponding to the real example sentence.
  • Step 404 Mark the real example sentence to obtain a training corpus; the training corpus includes: a template identifier corresponding to the real example sentence and each keyword included in the real example sentence and a type thereof.
  • the real example sentences shown in Table 17 need to be marked to obtain training corpus, which can be used to train the intent recognition model and the keyword extraction model in the embodiment of the present application.
  • the training corpus obtained in this step can be directly used as a specific format input required by the training intention recognition model and the keyword extraction model.
  • Table 18 shows an example of the format of the training corpus.
  • the "BOS (begin of session)" is the start tag of a set of training corpus
  • "EOS (end of session)” is the end tag of a set of training corpora.
  • the "word segmentation and part-of-speech tagging result” may be the result of segmentation and part-of-speech tagging of a real example sentence, that is, the template tag ID of the real example sentence, and the "keyword slot tag” is performed for each participle in the real example sentence. Whether it is a keyword slot and a tag of the keyword slot type. In the "slot tag", you can use "O" to indicate that the participle is not a slot.
  • the word labeling results as shown in Table 19 can be obtained by the label processing, and the word labeling results can be directly used for the training input of the machine learning algorithm.
  • the "O O B-startPoi O B-endPoi" is the result of the keyword tag, wherein the first character “O” is used to indicate that the corresponding participle "how” is not the key Word, the second character “O” is used to indicate that the corresponding participle “from” is not a keyword, and the third character “B” indicates that the corresponding participle "Notre Dame de Paris” is a keyword whose word type is the starting point "startPoi”
  • the fourth character “O” is used to indicate that the corresponding participle "go” is not a keyword, and the fifth character “B” indicates that the corresponding participle "Louvre” is a keyword, and the word type is the end point "endPoi”.
  • the above steps 401 to 404 are processes for generating a training corpus according to the example sentence group and the example sentence combination rule configured in the intention template.
  • Step 405 Using a machine learning algorithm according to the training corpus, training to obtain an intent classification model and a keyword extraction model.
  • a machine learning algorithm can be used to train the intent classification model and keyword extraction.
  • a machine learning algorithm can train only one model to simultaneously perform template classification and keyword slot extraction, which is a joint model.
  • RNN recurrent neural network
  • the training corpus can provide three different channels, one is the word vector channel, the second is the part of speech channel, and the third is the slot labeling channel.
  • the single-round dialogue mode and the multi-round dialogue mode require different models.
  • the single-round dialogue mode only needs to consider the judgment of the current question. Only the current sentence is divided into words and part of speech, intention identification and slot extraction.
  • the intent recognition model and the keyword extraction model required by the multi-round dialogue method are more complicated.
  • the input of the model includes not only the result of the current sentence, but also the content of the historical conversation (ie, the context) before the sentence.
  • the intent recognition model and the keyword extraction model reference context determine the intent of the current sentence and perform slot extraction.
  • the single-round dialogue mode or the multi-round conversation mode can be solved by using a corresponding deep learning algorithm. Therefore, the embodiment of the present application can realize the intention identification of the single-round dialogue mode, or can be simultaneously implemented.
  • the intent recognition and slot extraction of the single-round dialogue mode can also realize the intent recognition and slot extraction of the multi-round dialogue mode.
  • the intention recognition model and the keyword extraction model are simultaneously trained as an example for description.
  • the consciousness recognition model can be used to determine the intent of a question
  • the keyword extraction model is used to extract the keyword, and whether each word segment is a keyword and a word.
  • the result of the type tag Therefore, embodiments of the present application can be applied to an automatically generated field of question answers, such as a question and answer engine.
  • FIG. 5 it is a scene architecture diagram of a method for generating an answer to the question in the application.
  • the user sends a question to the server 502 through the client 501 to ask for the answer that he or she wants.
  • the server 502 can extract the Hangzhou keyword using the pre-trained keyword extraction model. And the two keywords of the attraction, and the word type is "city name" and "tour place", and then the pre-trained intent recognition model can be used to obtain the question, which is to ask Hangzhou's scenic spot, and then can be generated by the determined intention
  • the answer to the question is presented to the user via client 501.
  • the server 502 can be implemented by using a question and answer engine or the like.
  • Embodiment 1 of a method for generating an answer to a question in the present application is shown.
  • This embodiment can be applied to the server 502 shown in FIG.
  • a question and answer engine or the like the embodiment may include the following steps:
  • Step 601 responsive to the triggering question, at least according to the pre-trained keyword extraction model, labeling the question to obtain a word labeling result, where the word labeling result includes: whether each participle of the question is a keyword and each The word type of the keyword.
  • the user sends a question to the server, for example, the question and answer engine through the client, and the server can analyze the question, not only according to the keyword extraction model, but also determines the keyword type of the question and the word type of the keyword.
  • the intent of the inquiry of the question can also be determined based on the intent recognition model.
  • keyword extraction the word segmentation and part-of-speech tagging may be performed first.
  • the word segmentation in the question sentence is a noun or a verb
  • the question is extracted according to the pre-trained keyword extraction model to obtain the word labeling result.
  • the word labeling result may include: whether each participle of the question is a keyword and a word type of each keyword.
  • step 601 may include steps B1 to B3:
  • Step B1 Perform word segmentation on the question sentence to obtain a word segmentation set of the question question.
  • the word segmentation is processed and the part of speech is marked to obtain a word segmentation with part-of-speech tagging.
  • Step B2 performing keyword labeling on each participle in the word segmentation group to obtain a first labeling result based on a domain dictionary corresponding to the domain to which the question belongs, and extracting a model based on a pre-trained keyword, Each participle in the set is subjected to keyword tagging to obtain a second tag result.
  • the domain dictionary corresponding to the domain to which the question belongs, keyword segmentation is performed on each participle in the word segmentation to obtain the first tag result.
  • the domain dictionary is used to store the correspondence between the words of each domain and their corresponding word types, or some domain words are not labeled with the word type, and therefore, the first marker result obtained by marking each segmentation word based on the domain dictionary, It may include both keywords and corresponding word types, and may only include keywords. Since there may be a phenomenon in the domain dictionary that one domain word contains another domain word, if the word types of the two domain words are different, there will be a problem that it is impossible to determine which word type to use when marking.
  • the longest priority marking algorithm can be used for marking, that is, when there is a word type conflict, the domain word with the longest length is preferentially marked.
  • the domain dictionary has the following words: Hangzhou, West Lake, Museum, and West Lake Museum, and the question is “The West Lake Museum on the side of Hangzhou West Lake”, the first mark based on the domain dictionary to mark the question.
  • the result is: "Hangzhou _B-City-name / West Lake _B / on the side of a _O / West Lake Museum _B-scenic spots name.”
  • "West Lake Museum” can be labeled as "West Lake Museum _B-scenic spots name”, or can be marked as: "West Lake _B Museum _B”, but according to the longest priority marking algorithm, " The West Lake Museum is longer than the West Lake and the Museum, so the priority is “West Lake Museum _B-scenic spots name”.
  • labeling based on the domain dictionary is the most direct way to identify the keyword slot in the question, and only considering that each participle itself is a local priority method.
  • the user may have input errors, etc., resulting in the first mark result based on the domain dictionary being empty, and the domain words in the domain dictionary may be mixed, so the unimportant participles in the question will also be Mark it out, which will have a big impact on the resulting answer.
  • it is necessary to use a pre-trained keyword extraction model to mark the question at the same time.
  • the keyword extraction and word type tagging of the question will consider the structure of the question, and determine whether each participle is a keyword and determine the word type of each keyword. It is a global method. . For example, suppose the question is “How do you get from the Eiffel Tower to Ul Dame?”, using the pre-trained keyword extraction model, you have learned the sentence “How to get from $ ⁇ startPoi ⁇ to $ ⁇ endPoi ⁇ ? You can make the following second mark result: "From _O Eiffel Tower _B-startPoi to _O Paris _B Notre Dame _I-endPoi how _O go _O?_O"
  • Step B3 Determine a word labeling result of each participle in the word segment set according to the first label result and the second label result.
  • the final word mark result of the question can be determined. For example, it may be determined whether each of the first mark result and the second mark result are marked as a keyword for each participle in the word segment set, and if yes, the participle is determined as a keyword, and according to the first mark result Or the word type marked in the second tag result to determine the word type of the keyword. And if the first mark result is marked as a keyword and the second mark result is marked as a non-keyword, the participle is determined to be a non-keyword.
  • the second annotation result based on the keyword extraction model considers that the segmentation word is not a keyword
  • the second annotation result is subject to the second annotation result, and the segmentation term is no longer used. Determined as a keyword.
  • the word mark result can be in the form of a word mark matrix, including each participle And whether the participle is a keyword and the result of the word type.
  • a word mark matrix can be found in Table 20.
  • Step 602 Determine a target intent of the question according to the word labeling result and the pre-trained intent recognition model.
  • the word labeling result of the question sentence obtained in step 601 is input as the pre-trained intent recognition model, thereby obtaining a plurality of candidate intents of the question and the credibility corresponding to each candidate intent.
  • the intent recognition model outputs the following three candidate intents: plan_route_to_poi, get_scenic spots_of_city, and get_name_of_city, respectively, corresponding to a credibility of 0.9, 0.4 and 0.3. It can be seen that the candidate intent is actually the template identification ID of the configured intent template.
  • the candidate intent "plan_route_to_poi” corresponds to the intention for planning the route
  • the candidate intent “get_scenic spots_of_city” corresponds to the intent to acquire the attraction of one city
  • the candidate intent “get_name_of_city” corresponds to the intent to acquire the name of a city.
  • the candidate intent "plan_route_to_poi” corresponds to the highest score of 0.9, indicating that the candidate intent "plan_route_to_poi” is most likely the target intent of the question, and most likely reflects the true purpose of the user's question.
  • Step 603 Acquire a target answer corresponding to the target intent according to a pre-configured target intent template corresponding to the target intent.
  • the target intent template may be respectively corresponding to the target intent template, and according to the target intent template, the target answer corresponding to the target intent may be obtained according to the method for obtaining the target answer configured in the target intent template, and Return to the client.
  • step 603 may include steps C1 to C4:
  • Step C1 Assign a value to the intent parameter according to the intent parameter configured in the target intent template to obtain a query parameter.
  • the word labeling result obtained in step 601 is used to assign an intent parameter to obtain a query parameter.
  • the intent parameter has been configured in the target intent template, which may include the starting point parameter "startPoi” and the end point parameter "endPoi”.
  • the result can be marked according to the words indicated in Table X.
  • the name of the starting point keyword is: “Notre Dame de Paris”
  • the name of the ending keyword is "Arc de Triomphe”
  • the starting point parameter "startPoi” and the end point parameter "endPoi” are assigned respectively.
  • the script can be configured in the intent template. For example, if the script is executed for the parameter assigned to the parameter, this step can directly run the parameter execution script configured in the target intent template to assign a value to the intent parameter.
  • all execution scripts in the embodiments of the present application can be implemented by using a groovy script.
  • This approach greatly simplifies the number of groovy scripts and enhances the functionality of groovy scripts. For example, initialize a java class, which is used to perform a more complex operation, and then set the instance of this class to the groovy execution engine. In other groovy scripts, you can directly call the methods of this class.
  • Step C2 Acquire source data of the target answer according to the query parameter.
  • the source data of the template answer is obtained.
  • the data acquisition script configured in the target intent template can be executed directly.
  • the data acquisition script defines how to get the relevant data, execute the script, get the data directly, and return according to the user-defined return value type.
  • Step C3 processing the source data according to a preset processing manner to obtain processed source data.
  • the data processing script configured in the target intent template can be executed to implement processing of the source data.
  • the data processing script can receive the return value of the data acquisition script as input, perform data processing, and return a user-defined return value type.
  • Step C4 Generate the target answer according to the processed source data.
  • the answer generation script in the target intent template can be executed to implement the generation of the target answer.
  • the return value of the data processing script can be used as input, the answer assembly is performed, or a specific behavior action is performed, and the user-defined return value type is returned, and the return value of the answer generation script is used as the target answer, and the target answer can be By returning to the user through the client, the user can get the answer corresponding to the question question or the execution result of the final action action.
  • the intent template includes an execution script for obtaining an answer, and subsequent operations such as modifying the execution script may be performed, so that the maintainability of the intent template is better.
  • the script can be directly executed according to the intent template corresponding to the determined intent to obtain an answer, thereby improving the efficiency of the server such as the question and answer engine.
  • the example template is also configured with an example sentence that can answer the question. Therefore, the intention template can be used to conveniently answer the question asked by the user and automatically give the answer to the question.
  • Embodiment 2 of a method for generating an answer to a question of the present application is shown.
  • This embodiment is mainly an example of a form of a single-round conversation, that is, a question can be directly returned according to a question asked by a user.
  • the application scenario may include the following steps:
  • Step 701 responsive to the triggering question, labeling the question according to the pre-trained keyword extraction model to obtain a word labeling result, where the word labeling result includes: whether each participle of the question is a keyword and each key The word type of the word.
  • step 701 can refer to the introduction of step 601, and details are not described herein again.
  • Step 702 The word labeling result is used as an input of the pre-trained intent recognition model to obtain a plurality of candidate intents and corresponding credibility.
  • Step 703 Determine a candidate intent with the highest credibility among the plurality of candidate intents as a current intent.
  • the target intent is determined based on the credibility of each candidate intent.
  • the candidate with the highest credibility is used as the current intent to make an intent decision, that is, selecting the most suitable candidate from the plurality of candidate intents
  • the intent of the situation is the intended intent.
  • Step 704 Determine whether the keywords in the word labeling result are complete according to the current intent template corresponding to the current intent. If yes, proceed to step 705. If not, proceed to step 706.
  • all the intent parameters configured in the current intent template may be obtained, because the answer to generate the question requires the values of all intent parameters, so reference may be made to all intent parameters configured in the current intent template.
  • the keywords in the word labeling result that is, whether all the intent parameters in the current intent template can be successfully assigned according to each keyword and the corresponding word type.
  • Step 705 Determine the current intent as a target intent.
  • the current intent is determined as the target intent.
  • Step 706 Select the next candidate intent as the current intention according to the order of credibility from high to low, and return to step 704 until the plurality of candidate intents are all selected, and when the target intent cannot be determined, the return to the client cannot be performed. Generate an answer to the question.
  • the next candidate intent is selected as the current intent according to the order of credibility from high to low, and it is determined whether all the intent parameters in the newly selected current intent can be all assigned. Until multiple candidate intents are selected. If all the candidate intents are not selected, the answer to the question may not be generated, and the information that cannot generate the answer may be further returned to the user through the client.
  • Step 707 Acquire a target answer corresponding to the target intent according to a pre-configured target intent template corresponding to the target intent.
  • each script configured in the target intent template is further executed, thereby obtaining a target answer of the question.
  • all the possible intents of the user can be enumerated by pre-establishing the ontology, and then each intent is stored in the manner of an intent template, each of which is responsible for solving the problem of the corresponding intent.
  • the intent template may include an intent parameter, a solution logic of the intent, and a possible question form of the intent.
  • the model is extracted through the pre-trained keyword, and the question is classified into a specific intent, and then The extracted keywords are used as the parameters of the intent, and the corresponding logic in the intent template is executed, that is, the script configured in the intent template is executed to obtain the answer to the question.
  • the training corpus of the training model in the embodiment of the present application is generated according to the combination rule of the example sentence group and the example sentence group in the intention template, so the keyword extraction model and the intention recognition model obtained by the training can more accurately extract keywords and perform The intent is categorized so that the answers generated in this embodiment are also more accurate.
  • Embodiment 3 of a method for generating an answer to a question in the present application is shown, which is mainly an example of a multi-round conversation form, that is, an answer cannot be directly returned according to a question asked by a user, and needs to be provided to the user.
  • the application scenario in which the problem is returned and the target intent is determined according to the user's input, the embodiment may include the following steps:
  • Step 801 responsive to the triggering question, at least according to the pre-trained keyword extraction model, labeling the question to obtain a word labeling result, where the word labeling result includes: whether each participle of the question is a keyword and each The word type of the keyword.
  • the server will mark the result of the current question and the keyword extraction result of the historical question as the input of the keyword extraction model. , to extract keywords from the current question.
  • this step can be Get the conversation content in the session database.
  • the historical question has been extracted from the keyword, and the keyword extraction result is stored in the context of the historical conversation, that is, the keyword extraction result of the historical question can be directly obtained from the conversation database, and the current question is asked.
  • the word labeling result of the sentence is used as the input of the keyword extraction model to extract the keyword from the current question. It can be understood that the keyword extraction result is not static and may change as the content of the conversation changes.
  • Step 802 At least use the word labeling result as an input of the pre-trained intent recognition model to obtain a plurality of candidate intents and their corresponding credibility.
  • This step is different from step 702 in that the input of the intent to identify the model in this step may include the keyword extraction result of the user's historical question and the intention recognition result, in addition to the word annotation result of the current question submitted by the user.
  • the keyword extraction result and the intention recognition result may be used to assist the current question to identify the intent. Because the embodiment applies an application scenario in the form of multiple rounds of dialogue, the content input by the user, for example, the question will include necessary information, such as an intent parameter, etc., and therefore, after the word is subsequently marked by the user.
  • the intent recognition result of the historical question and the keyword extraction result are also used as input of the intent recognition model, thereby obtaining a plurality of candidate intents of the current question and corresponding corresponding Reliability.
  • this step can get the conversation content from the session database. Since the historical question has been extracted by the keyword, and the keyword extraction result is stored in the context of the historical conversation, that is, after the candidate intent is parsed, part of the parameter of the candidate intent comes from the keyword extraction result of the current sentence. The other part comes from the context of the conversation. Specifically, for each current question input by the user, the word labeling result of the current question, and the intention recognition result of the historical question and the keyword extraction result are used as input of the intention recognition model to obtain the current question. The intention to identify the result. It can be understood that the candidate intent is not static and may change as the content of the conversation changes.
  • Step 803 Determine a candidate intent with the highest credibility among the plurality of candidate intents as a current intent.
  • the candidate intent with the highest degree of credibility among the plurality of candidate intents obtained in step 802 is determined as the current intent.
  • Step 804 Determine whether the credibility of the current intent is greater than a preset credibility threshold. If yes, go to step 806; if not, go to step 805.
  • this step it is determined whether the maximum value of the credibility is greater than a preset credibility threshold, for example, 0.8. If it is greater than, the current intent with the highest credibility may be considered as the target intent.
  • a preset credibility threshold for example, 0.8.
  • Step 805 Select the first plurality of candidate intents of the preset number as the intent to be selected, and send the to-be-selected intention to the terminal for the user to select.
  • the candidate intents may be sorted according to the order of credibility, and multiple candidate intents of the preset number are selected as the candidate to be selected. intention. For example, the first two candidate intents are selected as the intent to be selected, and sent to the client, so that the user can select an intent to match the actual purpose from the two to-be-selected intents. Further, the user can select the intent later. As a goal intention.
  • the server may generate a selection question including the two intents to be selected and return to the user.
  • the content of the selection question may be from the "desc" field of the intent template, for example, the "desc" field with two intents to be selected is the content shown in Table 21, respectively.
  • the generated selection question can be: "Would you like to plan the route to the Arc de Triomphe, or to get an introduction to the Arc de Triomphe?".
  • Step 806 Determine the intention of the user selection returned by the terminal as the target intention, or determine the current intention as the target intention.
  • the user After returning the selection question to the client and displaying it to the user, the user will input an answer according to the selection question, for example, input "plan to the Arc de Triomphe", then the user may select the intention to "plan to the Arc de Triomphe", thereby The intent is determined as the target intent.
  • the server can send the selection question to the user again or more times until the user's target intention is determined, or when all the "desc" fields are combined, If the user's target intent cannot be determined, the process of returning the content of the intent cannot be determined to the client, and the process of generating the answer to the question is ended; or if the user changes his or her original intention, in this case, the current question can also be ended.
  • the process of generating the answer to the sentence turns to the processing and execution of the user's new intention.
  • Step 807 Determine whether the keywords in the word labeling result are complete according to the target intent template corresponding to the target intent. If not, proceed to step 808. If complete, proceed to step 811.
  • step 704 After determining the target intent, it is determined whether the keywords in the word labeling result are complete according to all the intent parameters configured in the corresponding target intent template. For a specific judgment process, reference may be made to the description of step 704, and details are not described herein again.
  • Step 808 Determine an intent parameter corresponding to the incomplete keyword as a missing intent parameter; and generate a parameter problem related to the target intent according to the missing intent parameter and the target intent template.
  • the keyword in the word labeling result is incomplete, and the incomplete keyword corresponds to those intent parameters that cannot be assigned. These intent parameters are determined as missing intent parameters.
  • Step 809 Return the parameter question to the client for display to the user, and the intent template includes: a correspondence between the intent parameter and the parameter problem.
  • the generated query question is sent to the client and displayed to the user according to the missing intent parameter and the parameter problem corresponding to the missing intent parameter in the target intent template.
  • the parameter problem is generated from the intent template.
  • each intent parameter is set at the time of definition. If the intent parameter is missing, it needs to be asked. Therefore, the parameter problem corresponding to the missing parameter here. Randomly select a question in the list and return it to the user.
  • Step 810 Acquire the missing intent parameter according to the parameter input returned by the client and input by the user, and proceed to step 811.
  • the user may give the corresponding intent parameter in the next round of dialogue, and the missing intent parameter can be obtained from the parameter answer input by the user.
  • the missing intent parameter can be obtained from the parameter answer input by the user.
  • all the intent parameters of the target intent template You can assign values.
  • the server will also stop asking questions about the intent parameter that is currently missing.
  • Step 811 Acquire a target answer corresponding to the target intent according to a pre-configured target intent template corresponding to the target intent.
  • step 603. if all the intent parameters of the target intent template can be assigned, the pre-configured script in the target intent template can be executed to generate the target answer of the target intent.
  • the pre-configured script in the target intent template can be executed to generate the target answer of the target intent.
  • the integrity judgment of determining the intent parameter of the target intention and the target intention is actually a kind of reasoning, that is, the user's true intention is inferred according to the content provided by the user.
  • this embodiment does not determine the target intention based on the intent parameter priority matching, but determines the target intention based on the principle of credibility priority. Because in the form of a single round of dialogue, the user will express the intention and intention parameters in a question as much as possible, and in the case of multiple rounds of dialogue, the user may prefer to express it arbitrarily, that is, a question or a sentence may only express it.
  • the embodiment may further include:
  • the conversation content input by the user is saved into a conversation database, the conversation content including: an intention selected by the user and/or a parameter answer input by the user.
  • the server After the server generates a question to return to the client and presents it to the user, the user may enter their own answer according to the question, or the user will select their own intention according to the question, so the conversation content input by the user can be Temporarily saved to the session database. Alternatively, it can be cached in memory. Subsequently, the user-selected intent can be obtained from the session database or the memory, or the intent parameter can be queried from the conversation content.
  • the conversation content in the conversation database may also be updated, or the conversation content input by the user may be deleted when the preset time period is reached.
  • the content of these conversations is not static with time.
  • the value of the original intent or intent parameter is also overwritten by the new value.
  • these conversations are not permanent. For example, a time threshold can be set, and the conversation content can be deleted when the time threshold is reached. Or, when the user sends a new question and a new conversation content is generated, the last conversation content cannot affect the current conversation, so the last conversation content can be deleted.
  • the reasonable inference of the embodiment makes it possible to clarify the intention of the user and obtain the complete intent parameter, thereby realizing dialogue with the user and automatically generating the answer required by the user according to the content of the conversation, which not only improves the accuracy of the answer generation.
  • the rate can also make the generated answers more in line with the user's habits.
  • the interaction with the user's conversation is also very friendly. The user does not need to learn a special interaction method, and can directly communicate with the server through the dialogue in daily life. Engine communication.
  • the present application further provides an apparatus for generating an answer to a question
  • the generating The device may be integrated on the server side, such as a question and answer engine, etc., and the generating device may include:
  • the keyword labeling unit 901 is configured to: in response to the triggering question, mark the question sentence according to the pre-trained keyword extraction model to obtain a word labeling result, where the word labeling result includes: whether each participle of the question sentence includes The word type for the keyword and each keyword.
  • the keyword labeling unit 901 can include:
  • a word segment subunit configured to perform segmentation on the question sentence to obtain a word segmentation set of the question sentence;
  • a first tag subunit configured to be based on a domain dictionary corresponding to a domain to which the question sentence belongs, in the word segment set Each participle performs a keyword tag to obtain a first tag result;
  • a second tag subunit is configured to extract a model based on the pre-trained keyword, and perform keyword tagging on each participle in the segmentation set to obtain a second tag result;
  • the domain dictionary may be generated by: acquiring each attribute of each entity in the domain; using the attribute value corresponding to each attribute as a keyword, and using the entity tag and the attribute name as the word type of the keyword, and Synonyms, synonyms, and aliases of the keyword are determined as keywords.
  • the first determining subunit may include:
  • a first determining subunit configured to determine, for each participle in the word segmentation set, whether the first tag result and the second tag result are both marked as keywords
  • a second determining subunit configured to be in the first determining sub If the unit is YES, the participle is determined as a keyword, and the word type of the keyword is determined according to the first mark result or the second mark result; and the third determining subunit is used for When the result of the first judging subunit is that the first marking result is marked as a keyword and the second marking result is marked as a non-keyword, the participle is determined as a non-keyword.
  • the intention determining unit 902 is configured to determine a target intent of the question according to the word labeling result and the pre-trained intent recognition model.
  • the answer obtaining unit 903 is configured to acquire a target answer corresponding to the target intent according to a target intent template corresponding to the target intent configured in advance.
  • the answer obtaining unit 903 may include:
  • An assignment subunit configured to assign a value to the intent parameter according to an intent parameter configured in the target intent template, to obtain a query parameter; and a source data obtaining subunit, configured to acquire source data of the target answer according to the query parameter; a subunit, configured to process the source data according to a preset processing manner to obtain processed source data; and generate a subunit, configured to generate the target answer according to the processed source data.
  • the intent template can be generated in the following ways:
  • the intent is intended to express the inquiry purpose of the question
  • the intent includes: querying an attribute of the entity, inquiring about all relationships between the entities, and querying other attributes or all attributes of the entity through one or more attributes of the entity, And/or querying the relationship of the entity by one or more attributes of the entity
  • the template of the intent includes: a template identifier, a template description, a parameter parameter corresponding to the intent parameter and the intent parameter, an example sentence group corresponding to the intent, and each example sentence a combination rule of the group
  • the template identifier is used to uniquely represent an intent template, and the template description is used to describe the purpose of the intent template
  • the intent parameter is a parameter corresponding to determining an intent
  • the parameter problem is: The problem that needs to be sent to the user when the corresponding intent parameter is missing, the example sentence in the example sentence group includes the variable name of the entity
  • the intent recognition model and the keyword extraction model can be trained in the following ways:
  • the training corpus is generated according to the example sentence group and the example sentence combination rule configured in the intention template; the machine learning algorithm is adopted according to the training corpus, and the intention classification model and the keyword extraction model are trained.
  • the training corpus can be generated in the following ways:
  • variable value list includes: a variable name of the entity, a variable value of the entity, and a correspondence between the two; generating a variable including the entity according to a combination rule of the example sentence group and the example sentence group configured in the intention template a variable example of a variable; a variable value of each entity in the variable value list is respectively replaced with a variable name in the variable example sentence to obtain a real example sentence; the real example sentence is marked to obtain a training corpus; and the training corpus is obtained;
  • the method includes: a template identifier corresponding to the real example sentence and each keyword included in the real example sentence and a type thereof.
  • the intent template includes an execution script for obtaining an answer, and subsequent operations such as modifying the execution script may be performed, so that the maintainability of the intent template is better.
  • the script can be directly executed according to the intent template corresponding to the determined intent to obtain an answer, thereby improving the efficiency of the server such as the question and answer engine.
  • the example template is also configured with an example sentence that can answer the question. Therefore, the intention template can be used to conveniently answer the question asked by the user and automatically give the answer to the question.
  • the present application further provides an embodiment 2 of a device for generating an answer to a question
  • the generating device may be integrated on the server side, for example, a question answering engine or the like.
  • the embodiment may generate an answer to the user's question in the form of a single-round dialog.
  • the intent determining unit 902 in the generating device may include:
  • the first model processing sub-unit 1001 is configured to use the word labeling result as an input of the pre-trained intent recognition model to obtain a plurality of candidate intents and corresponding credibility.
  • the fourth determining subunit 1002 is configured to determine, as the current intent, the candidate intent with the highest credibility among the plurality of candidate intents.
  • the second determining sub-unit 1003 is configured to determine, according to the current intent template corresponding to the current intent, whether each keyword in the word labeling result is complete; the intent template includes: determining all intent parameters required for an intent.
  • the fifth determining subunit 1004 is configured to determine the current intent as the target intent if the result of the second determining subunit is YES.
  • the subunit 1005 is selected to select the next candidate intent as the current intent in the order of reliability from high to low in the case where the result of the second judging subunit is NO.
  • the triggering subunit 1006 is configured to trigger the second determining subunit after the selecting subunit selects the next candidate intent until the plurality of candidate intents are selected.
  • the second determining subunit may specifically include:
  • a parameter obtaining subunit configured to obtain all the intent parameters configured in the current intent template
  • an assignment subunit configured to use the word type of each keyword in the word annotation result to assign a value to the all intent parameters
  • an evaluation judging unit configured to determine whether the all intent parameters can be successfully assigned.
  • all possible intents of the user can be enumerated by pre-establishing the ontology, and then each intent is stored in the manner of an intent template, and each intent template is responsible for solving the problem of the corresponding intent.
  • the intent template may include an intent parameter, a solution logic of the intent, and a possible question form of the intent.
  • the model is extracted through the pre-trained keyword, and the question is classified into a specific intent, and then The extracted keywords are used as the parameters of the intent, and the corresponding logic in the intent template is executed, that is, the script configured in the intent template is executed to obtain the answer to the question.
  • the training corpus of the training model in the embodiment of the present application is generated according to the combination rule of the example sentence group and the example sentence group in the intention template, so the keyword extraction model and the intention recognition model obtained by the training can more accurately extract keywords and perform The intent is categorized so that the answers generated in this embodiment are also more accurate.
  • the present application further provides an apparatus 3 for generating an answer to a question
  • the generating device may be integrated on the server side, for example, a question answering engine or the like.
  • the embodiment may generate an answer to the user's question in the form of a single-round dialog.
  • the intent determining unit 902 in the generating device may include:
  • the second model processing sub-unit 1101 is configured to obtain the plurality of candidate intents and their corresponding credibility by using at least the word tagging result as an input of the pre-trained intent recognition model.
  • the sixth determining subunit 1102 is configured to determine a candidate intent with the highest credibility among the plurality of candidate intents as a current intent.
  • the third determining sub-unit 1103 is configured to determine whether the credibility of the current intent is greater than a preset credibility threshold.
  • the seventh determining subunit 1104 is configured to determine the current intent as the target intent if the result of the third determining subunit is greater than.
  • the sub-unit 1105 is selected to select, in the case that the result of the third determining sub-unit is no, the first few candidate intents of the preset number are selected as the intent to be selected.
  • the sending subunit 1106 is configured to send the to-be-selected intent to the terminal for selection by the user.
  • the eighth determining subunit 1107 is configured to determine the intention of the user selection returned by the terminal as the target intent.
  • the fourth determining sub-unit 1108 is configured to determine, according to the target intent template corresponding to the target intent, whether each keyword in the word labeling result is complete.
  • the ninth determining subunit 1109 is configured to determine, as a result of the fourth determining subunit, whether the intent parameter corresponding to the incomplete keyword is a missing intent parameter.
  • the problem generation sub-unit 1110 is configured to generate a parameter problem related to the target intent according to the missing intent parameter and the target intent template.
  • the problem returning sub-unit 1111 is configured to return the parameter question to the client for display to the user;
  • the intent template includes: a correspondence between the intent parameter and the parameter question.
  • the parameter acquisition sub-unit 1112 is configured to obtain the missing intent parameter according to a parameter input returned by the client and input by the user.
  • the intent determination unit 902 may further include:
  • the saving subunit is configured to save the conversation content input by the user into the conversation database, where the conversation content includes: an intent selected by the user and/or a parameter answer input by the user.
  • the intent determination unit 902 may further include:
  • the update subunit is configured to update the content of the conversation in the session database, or delete the subunit, and delete the content of the conversation input by the user when the preset time period is reached.
  • the second model processing sub-unit 1101 may specifically include:
  • a dialog acquisition subunit the conversation content is obtained from the conversation database; and an input subunit, configured to input the word annotation result and the conversation content into the pre-trained intent recognition model, to obtain a plurality of candidate intents and Corresponding credibility.
  • the fourth determining subunit 1108 may specifically include:
  • a parameter acquisition subunit configured to acquire all intent parameters configured in the target intent template
  • an assignment subunit configured to use a word type of each keyword in the word annotation result, in the target intent template All the intent parameters are assigned, and the evaluation judging unit is used to determine whether all the intent parameters can be assigned successfully.
  • the generating device in this embodiment not only the question that the user initially asks is used as the input of the keyword extraction model or the consciousness recognition model, but also the user's intention cannot be determined or the intention of the user can be determined, but the intention parameter is incomplete.
  • the question is continued to the user so that the user can select his or her intention or supplement the intent parameter according to the question. Therefore, the reasonable inference of the embodiment makes it possible to clarify the intention of the user and obtain the complete intent parameter, thereby realizing dialogue with the user and automatically generating the answer required by the user according to the content of the conversation, which not only improves the accuracy of the answer generation.
  • the rate can also make the generated answers more in line with the user's habits.
  • the interaction with the user's conversation is also very friendly. The user does not need to learn a special interaction method, and can directly communicate with the server through the dialogue in daily life. Engine communication.

Abstract

一种自然语言问句答案的生成方法、装置及服务器,其中,问句答案的生成方法包括:响应于触发问句,至少依据预先训练的关键词提取模型对所述问句进行标注得到词标注结果(601),所述词标注结果包括:所述问句的各分词是否为关键词以及各关键词的词类型;依据所述词标注结果和预先训练的意图识别模型,确定所述问句的目标意图(602);依据预先配置的、与所述目标意图对应的目标意图模板,获取所述目标意图对应的目标答案(603)。采用该方法,基于意图模板来训练得到能够更为准确的识别用户意图的意图识别模型,以及采用关键词提取模型来提取用户的问句的关键词来为意图模板中的意图参数赋值,从而可以执行意图模板中的逻辑来自动生成问句的答案。

Description

一种自然语言问句答案的生成方法、装置及服务器
本申请要求2017年02月16日递交的申请号为201710084397.0、发明名称为“一种自然语言问句答案的生成方法、装置及服务器”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及智能问答技术领域,特别涉及一种基于意图识别模型和关键词提取模型的、自然语言问句答案的生成方法,装置及服务器。
背景技术
在互联网越来越发展的今天,很多网站或者网店等都采用智能问答系统来回答各种问题的咨询。智能问答系统是以一问一答的形式,精确的定位网站或网店等用户所需要的提问知识,通过与用户进行交互,为用户提供个性化的信息服务的系统。
在现有技术中,通过采用预先设定规则的方式来实现智能问答。例如,枚举所有可能的问句以及问句的回答,然后对每种问句抽象出一个规则。具体在生成当前问句的回答时,依次检查当前问句和每个规则是否匹配,如果匹配,则执行该规则指定的回答方式获取答案。
发明内容
但是发明人在研究过程中发现,现有技术中,对规则的配置比较麻烦,将规则配错的可能性很大,而且各个规则之间可能互相矛盾,添加新规则的时候还需要不和其他的已有规则冲突。因此,基于规则的智能问答的维护成本较大。具体执行时,因为问句要和每个规则的对应关系都尝试匹配,如果规则的数量较多,就会使得匹配的效率也较低。并且,匹配不到规则的时候,就无法回答用户提出的问题,因此灵活性较低,即如果希望能够回答某个问句,就必须增加一条和该问句对应的规则才行。
基于此,本申请提供了一种基于预先训练的意图识别模型和关键词提取模型的问句答案的自动生成方法,用以采用预先建立本体的方式枚举领域内的所有意图,即一个问句的询问目的,再依据意图来配置相对应的意图模板,即配置好什么样的问句能够被该意图模板回答以及如何回答,进一步的,基于意图模板来训练得到能够更为准确的识别用户意图的意图识别模型,以及采用关键词提取模型来提取用户的问句的关键词来为意 图模板中的意图参数赋值,从而可以执行意图模板中的逻辑来自动生成问句的答案。
本申请还提供了一种问句答案的自动生成装置和服务器例如问答引擎等,用以保证上述方法在实际中的实现及应用。
为了解决上述问题,本申请公开了一种问句答案的生成方法,该方法包括:
响应于触发问句,至少依据预先训练的关键词提取模型对所述问句进行标注得到词标注结果,所述词标注结果包括:所述问句的各分词是否为关键词以及各关键词的词类型;
依据所述词标注结果和预先训练的意图识别模型,确定所述问句的目标意图;
依据预先配置的、与所述目标意图对应的目标意图模板,获取所述目标意图对应的目标答案。
其中,所述响应于触发问句,至少依据预先训练的关键词提取模型对所述问句进行标注得到词标注结果,包括:
对所述问句进行分词,得到所述问句的分词集合;
基于所述问句所属的领域对应的领域词典,对所述分词集合中的各分词进行关键词标记得到第一标记结果;以及,基于预先训练的关键词提取模型,对所述分词集合中的各分词进行关键词标记得到第二标记结果;所述领域词典用于保存各领域词及其对应的词类型之间的对应关系;
依据所述第一标记结果和第二标记结果,确定所述分词集合中的各分词的词标注结果。
其中,所述依据所述第一标记结果和第二标记结果,确定所述分词集合中的各分词的词标注结果,包括:
针对分词集合中的各分词,判断所述第一标记结果和第二标记结果是否都标注为关键词,如果是,则将该分词确定为关键词,并依据所述第一标记结果或第二标记结果确定所述关键词的词类型;
如果第一标记结果标注为关键词而第二标记结果标注为非关键词,则将该分词确定为非关键词。
其中,所述领域词典通过以下方式生成:
获取领域内各实体的各属性;
将所述各属性对应的属性值作为关键词,并将实体标签和属性名作为关键词的词类型,以及,将所述关键词的关联词汇也确定为关键词,所述关联词汇包括:同义词、近 义词、口语表达词和别名。
其中,所述依据所述词标注结果和预先训练的意图识别模型,确定所述问句的目标意图,包括:
将所述词标注结果作为所述预先训练的意图识别模型的输入,得到多个候选意图及对应的可信度;
将所述多个候选意图中可信度最高的候选意图确定为当前意图;
依据所述当前意图对应的当前意图模板,判断所述词标注结果中各关键词是否完整;所述意图模板包括:确定一意图所需要的全部意图参数;
如果完整,则将所述当前意图确定为目标意图;
如果不完整,则按照可信度从高到底的顺序选择下一个候选意图作为当前意图,并执行所述依据所述当前意图对应的当前意图模板,判断所述词标注结果中各关键词是否完整的步骤,直至所述多个候选意图都选择完毕。
其中,所述依据所述当前意图对应的当前意图模板,判断所述词标注结果中各关键词是否完整,包括:
获取所述当前意图模板中配置的全部意图参数;
采用所述词标注结果中的各关键词的词类型,为所述全部意图参数进行赋值,并判断所述全部意图参数是否能赋值成功。
其中,所述依据所述词标注结果和预先训练的意图识别模型,确定所述问句的目标意图,包括:
至少将所述词标注结果作为所述预先训练的意图识别模型的输入,得到多个候选意图及其对应的可信度;
将所述多个候选意图中可信度最高的候选意图确定为当前意图;
判断所述当前意图的可信度是否大于预设可信度阈值,如果大于,则将所述当前意图确定为所述目标意图;
如果不大于,则选取预设个数的前若干个候选意图作为待选择意图,并将所述待选择意图发送至终端以供用户选择,以及,将所述终端返回的、用户选择的意图确定为目标意图;
依据所述目标意图对应的目标意图模板,判断所述词标注结果中各关键词是否完整,如果不完整,则将不完整的关键词对应的意图参数确定为缺少的意图参数;依据所述缺少的意图参数和所述目标意图模板,生成所述目标意图相关的参数问题;将所述参数问 题返回给客户端以便显示给用户;所述意图模板包括:所述意图参数和参数问题之间的对应关系;
根据所述客户端返回的、用户输入的参数答案获取所述缺少的意图参数。
其中,所述方法还包括:
将用户输入的对话内容保存至会话数据库中,所述对话内容包括:用户选择的意图和/或用户输入的参数答案。
其中,所述方法还包括:
对所述会话数据库中的对话内容进行更新,
或者,在到达预设的时间周期的时候,将用户输入的对话内容进行删除。
其中,所述至少将所述词标注结果作为所述预先训练的意图识别模型的输入,得到多个候选意图及其对应的可信度,包括:
从会话数据库中获取所述对话内容;
将所述词标注结果和所述对话内容输入预先训练的意图识别模型的,得到多个候选意图及其对应的可信度。
其中,所述依据所述目标意图对应的目标意图模板,判断所述词标注结果中各关键词是否完整,包括:
获取所述目标意图模板中配置的全部意图参数;
采用所述词标注结果中的各关键词的词类型,为所述目标意图模板中的全部意图参数进行赋值,并判断所述全部意图参数是否能赋值成功。
其中,所述意图模板通过以下方式生成:
依据领域内各本体所表示出的各实体之间的关系,确定各领域内所有问句的意图;所述意图用于表述问句的询问目的,所述意图包括:询问实体的属性,询问实体之间的所有关系,通过实体的一个或多个属性询问该实体的其他属性或所有属性,和/或,通过实体的一个或多个属性询问该实体的关系;
为确定的各意图配置对应的意图模板,所述意图模板包括:模板标识,模板描述,意图参数及意图参数对应的参数问题,意图对应的例句组,以及,各例句组的组合规则;所述模板标识用于唯一表示一个意图模板,所述模板描述用于描述所述意图模板的目的;所述意图参数为确定一个意图所对应的参数,所述参数问题为:对应的意图参数缺失时需要向用户发送的问题,所述例句组中的例句包括实体的变量名,用于表示所述意图模板能解决的问题,所述各例句组的组合规则用于表示:不同例句组中的例句的组合方式。
其中,所述意图识别模型和关键词提取模型通过以下方式训练:
依据所述意图模板中配置的例句组和例句组合规则,生成训练语料;
依据所述训练语料采用机器学习算法,训练得到意图分类模型和关键词提取模型。
其中,所述依据所述意图模板中配置的例句组和例句组合规则,生成训练语料,包括:
获取实体的变量值列表,所述变量值列表包括:实体的变量名、实体的变量值及两者的对应关系;
依据意图模板中配置的例句组和例句组的组合规则,生成包括实体的变量名的变量例句;
将所述变量值列表中各实体的变量值,分别对应替换所述变量例句中的变量名,得到真实例句;
对所述真实例句进行标记,得到训练语料;所述训练语料包括:所述真实例句对应的模板标识和所述真实例句中包括的各关键词及其类型。
其中,依据预先配置的、与所述目标意图对应的目标意图模板,获取所述目标意图对应的目标答案,包括:
依据目标意图模板中配置的意图参数,为所述意图参数赋值,得到查询参数;
依据所述查询参数获取所述目标答案的源数据;
对所述源数据按照预设处理方式进行处理得到处理后的源数据;
依据所述处理后的源数据生成所述目标答案。
本申请还公开了一种自然语言问句答案的生成装置,该生成装置集成于服务器上,该生成装置包括:
关键词标注单元,用于响应于触发问句,至少依据预先训练的关键词提取模型对所述问句进行标注得到词标注结果,所述词标注结果包括:所述问句的各分词是否为关键词以及各关键词的词类型;
意图确定单元,用于依据所述词标注结果和预先训练的意图识别模型,确定所述问句的目标意图;
答案获取单元,用于依据预先配置的、与所述目标意图对应的目标意图模板,获取所述目标意图对应的目标答案。
其中,所述关键词标注单元包括:
分词子单元,用于对所述问句进行分词,得到所述问句的分词集合;
第一标记子单元,用于基于所述问句所属的领域对应的领域词典,对所述分词集合中的各分词进行关键词标记得到第一标记结果;
第二标记子单元,用于基于预先训练的关键词提取模型,对所述分词集合中的各分词进行关键词标记得到第二标记结果;所述领域词典用于保存各领域词及其对应的词类型之间的对应关系;
第一确定子单元,用于依据所述第一标记结果和第二标记结果,确定所述分词集合中的各分词的词标注结果。
其中,所述第一确定子单元包括:
第一判断子单元,用于针对分词集合中的各分词,判断所述第一标记结果和第二标记结果是否都标注为关键词;
第二确定子单元,用于在所述第一判断子单元的如果为是的情况下,将该分词确定为关键词,并依据所述第一标记结果或第二标记结果确定所述关键词的词类型;
第三确定子单元,用于在所述第一判断子单元的结果为第一标记结果标注为关键词而第二标记结果标注为非关键词的情况下,将该分词确定为非关键词。
其中,所述意图确定单元包括:
第一模型处理子单元,用于将所述词标注结果作为所述预先训练的意图识别模型的输入,得到多个候选意图及对应的可信度;
第四确定子单元,用于将所述多个候选意图中可信度最高的候选意图确定为当前意图;
第二判断子单元,用于依据所述当前意图对应的当前意图模板,判断所述词标注结果中各关键词是否完整;所述意图模板包括:确定一意图所需要的全部意图参数;
第五确定子单元,用于在所述第二判断子单元的结果为是的情况下,将所述当前意图确定为目标意图;
选择子单元,用于在所述第二判断子单元的结果为否的情况下,按照可信度从高到底的顺序选择下一个候选意图作为当前意图;
触发子单元,用于在选择子单元选择下一个候选意图之后,触发所述的第二判断子单元,直至所述多个候选意图都选择完毕。
其中,所述意图确定单元包括:
第二模型处理子单元,用于至少将所述词标注结果作为所述预先训练的意图识别模型的输入,得到多个候选意图及其对应的可信度;
第六确定子单元,用于将所述多个候选意图中可信度最高的候选意图确定为当前意图;
第三判断子单元,用于判断所述当前意图的可信度是否大于预设可信度阈值;
第七确定子单元,用于在所述第三判断子单元的结果为大于的情况下,将所述当前意图确定为所述目标意图;
选取子单元,用于在所述第三判断子单元的结果为否的情况下,选取预设个数的前若干个候选意图作为待选择意图;
发送子单元,用于将所述待选择意图发送至终端以供用户选择;
第八确定子单元,用于将所述终端返回的、用户选择的意图确定为目标意图;
第四判断子单元,用于依据所述目标意图对应的目标意图模板,判断所述词标注结果中各关键词是否完整;
第九确定子单元,用于在所述第四判断子单元的结果为否的情况下,将不完整的关键词对应的意图参数确定为缺少的意图参数;
问题生成子单元,用于依据所述缺少的意图参数和所述目标意图模板,生成所述目标意图相关的参数问题;
问题返回子单元,用于将所述参数问题返回给客户端以便显示给用户;所述意图模板包括:所述意图参数和参数问题之间的对应关系;
参数获取子单元,用于根据所述客户端返回的、用户输入的参数答案获取所述缺少的意图参数。
其中,所述答案获取单元包括:
赋值子单元,用于依据目标意图模板中配置的意图参数,为所述意图参数赋值,得到查询参数;
源数据获取子单元,用于依据所述查询参数获取所述目标答案的源数据;
处理子单元,用于对所述源数据按照预设处理方式进行处理得到处理后的源数据;
生成子单元,用于依据所述处理后的源数据生成所述目标答案。
本申请还公开了一种服务器,所述服务器包括:前述的生成装置。
与现有技术相比,本申请实施例包括以下优点:
在本申请实施例中,因为训练的意图识别模型和关键词提取模型能够更为准确的识别意图,并且提取更为准确的关键词为执行意图逻辑做意图参数的准备,所以不仅提高了答案生成的效率和准确度,还能与用户进行对话,在用户没有表达意图的时候进一步 的明确用户的真实意图,或者,在明确用户的意图的情况下进一步的获取完整的意图参数等,从而使得本申请实施例的灵活性也比现有技术中基于规则的方式更好,且能与用户进行对话,用户的体验也较高。
当然,实施本申请的任一产品并不一定需要同时达到以上所述的所有优点。
附图说明
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1是本申请中配置意图模板的流程图;
图2是本申请中本体的一个结构示意图;
图3是本申请的本体的另一个结构示意图;
图4是本申请中训练意图识别模型和关键词提取模型的流程图;
图5是本申请在实际应用中的场景架构图;
图6是本申请的问句答案的生成方法实施例1的流程图;
图7是本申请的问句答案的生成方法实施例2的流程图;
图8是本申请的问句答案的生成方法实施例3的流程图;
图9是本申请的问句答案的生成装置实施例1的结构框图;
图10是本申请的问句答案的生成装置实施例2中确定意图单元902的结构框图;
图11是本申请的问句答案的生成装置实施例3中确定意图单元902的结构框图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
为了方便本领域技术人员对本申请的理解,下面首先对本申请中出现的术语进行介绍。
本体(ontology)
本体是知识图谱里面的概念,可以理解为对现实世界的抽象。人类经过对现实世界的分析之后,可以抽象出来很多的实体,并且,每个实体又有自己的属性,实体和实体之间存在着某种关系。那么本体就可以理解为这些实体和实体之间关系的表达和描述。
例如,在诗歌领域,诗人和诗为两个实体,这两个实体分别有各自的属性,其中,诗人的属性可以包括:名字、朝代等;诗的属性可以包括:内容、标题、朝代、类型等。并且,诗人和诗这两个实体之间存在着写与被写的关系。
因为本体描述了实体和实体之间的关系,所以从本体就能了解到这个领域的所有模式,从而可以枚举出关于这个领域的所有问题的意图。例如,在诗歌领域,从诗歌领域存在的本体中,可以枚举出下面这些意图的问题:问诗人的作品,问诗人的朝代,问诗人的性别,问诗的内容,问诗的朝代,问诗的类型,或者,问诗的作者。
问答引擎
问答引擎在用户输入问题后,自动给出答案,并且问答引擎允许用户以自然语言的形式输入问题。问答引擎根据用户输入的问题得到答案的过程为:首先,通过解析用户给出的关键词语,理解用户表达的意图;然后通过查询知识库或者通过某种算法得到答案;最后以自然语言的形式给出答案。问答引擎可以包括单轮的问答引擎和多轮的问答引擎。其中,单轮的问答引擎是一问一答,即用户问一个问题,在此问题中明确给出了意图和关键词(slot),问答引擎输出一个答案。多轮的问答引擎可以根据用户的当前问题以及过往的问答记录(上下文,Context)综合识别出用户的意图并解析slot,当遇到意图不清晰或者意图所需的各种参数没有完全满足条件时,问答引擎会掌控对话,对用户进行提问,直到用户清晰的表达了意图以及完整的slot,问答引擎才会给出答案。多轮的问答引擎通过对话的形式问问题,给用户的体验就像是在和一个真实的人交流。
意图模板
意图是在用户当前提出的问题中,用户想表达的目的。例如,用户问“周杰伦唱过哪些歌曲”的意图是找某个歌手唱的歌;例如,用户问“床前明月光的下一句是什么”的意图是寻找一句诗的下一句。在本申请实施例中,使用意图模板来表示一个意图。一个意图模板可以包括意图的名称、满足意图执行的各种参数(slot),以及意图的执行逻辑,在本申请实施例中,意图的执行逻辑以groovy动态脚本的形式配置在意图模板中。
具体回答用户某个带有意图的问题时,首先要提取用户问题中的slot,给意图模板中的参数赋值,然后执行groovy脚本配置的执行逻辑,最终得到groovy脚本返回的答案。
关键词slot
slot是意图执行的参数,例如,“周杰伦唱过哪些歌曲”这个问题,“周杰伦”就是一个slot。“床前明月光的下一句是什么”这个问题,“床前明月光”就是一个slot。如果把意图看成一个句子,那么slot就是问题中的关键词;如果把意图看成一个函数,那么slot就是参数。
slot提取就是提取用户问题中的slot。如果要正确的回答一个问题,slot提取是十分重要的。如果slot提取错误,直接导致意图的参数错误,进而造成意图执行的结果错误。因此,要正确的回答一个问题,slot提取是十分重要的。
groovy动态脚本
groovy是一种脚本语言,完全兼容java语法,并且可在java中动态执行。基于这种特性,groovy语言可以作为意图模板中的执行逻辑的承载者,即执行逻辑是可以被配置的,所以执行逻辑可以在不需要重新编译或者重启系统的情况下被改写,这极大的方便了系统的维护,也增强了系统的可扩展性。
知识库
知识库即知识图谱,是对实体、属性以及实体之间的关系进行建模和存储的系统。知识图谱是以图的方式存储知识,这点区别于关系型数据库。
推理(reasoning)
本申请实施例中包括两种推理,一种是对知识的推理,另一种是对用户意图的推理。本申请实施例主要侧重于对用户意图的推理,因为对知识的推理是知识图谱系统的范畴。例如,知识库中记载了A是B的父亲,B是C的父亲,当查询C的爷爷是谁,就需要使用“爷爷=父亲的父亲”推理规则来推理。而对用户意图的推理是根据过往的上下文和当前的用户问题,以及自动生成的对用户的提问和用户的回答,推理出用户的意图。例如,下面表1所示的关于旅游领域的人机对话,其中,Q是用户提问,A是引擎回答:
表1
Figure PCTCN2018075410-appb-000001
Figure PCTCN2018075410-appb-000002
从上述表1的人机对话可以看出,机器会试图询问用户的意图,并根据用户的回答以及上下文推理出用户当前的意图。当用户只说埃菲尔铁塔时,机器并不知道用户的具体意图,于是机器提出了问题,然后用户表达了埃菲尔铁塔有多高的具体意图。此时,机器明白了用户的意图是查询一个实体的高度,并且实体是埃菲尔铁塔,于是机器去知识库里面获取埃菲尔铁塔的高度属性,然后返回给用户。
接着用户提出“怎么去那里呢”,表达了一个明确规划去某地路线的意图。但是规划去某地路线的意图有两个参数,一个是起点,一个是终点。机器从上下文中可以得到终点是埃菲尔铁塔,但是不知道起点,因此机器无法执行这个意图,于是机器提出关于起点的问题,最后机器得到用户所说起点是凯旋门。
一般情况下,当用户说出一个实体的名称但是没有表达任何意图时,机器会像第一个Q那样,询问用户的意图。当机器已经有了足够的上下文时,机器可以将用户所说的凯旋门理解为,规划去某地路线这个意图的一个起点参数。此时,机器得到规划去某地路线意图的起点是凯旋门,终点是埃菲尔铁塔后,执行这个意图得出规划后的路线。当用户提出“如果从巴黎圣母院呢”的问题时,机器通过上下文可以得出用户提出问题的目的是更改起点,于是,机器给出从巴黎圣母院到埃菲尔铁塔的规划路线的执行结果。
为了方便本领域技术人员对本申请中的意图模板有更深刻的理解,参考图1所示,为本申请中配置意图模板的流程图,配置意图模板的流程可以包括步骤:
步骤101:建立领域内的本体。
当对一个新领域设计智能问答引擎的时候,需要建立该领域内的本体。具体的,通过分析该领域,抽象出该领域包含什么内容,以及这些内容之间的关系,那么抽象出的内容就是实体(entity),内容之间的关系就是实体之间的关系(relation),最终建立该领域的本体(ontology)。
例如,当对诗歌领域设计智能问答引擎时,通过数据调研发现这个领域里面有诗人和诗,那么诗人和诗就是实体。并且,诗人和诗都有自己的一些属性,例如,诗人有姓 名、性别、朝代等属性,诗有名称、内容等属性。此外,诗人和诗之间存在着写与被写的关系,建立如图2所示的本体。
例如,当对旅游领域进行分析时,为了方便将问题简化,只考虑旅游领域里面有城市和景点两个实体。其中,城市有名称、国家等属性,景点有名称、类型等属性。城市和景点之间存在包含和被包含的关系,以及,景点之间存在如何到达的关系,可以建立如图3所示的本体。
步骤102:依据领域内的本体生成领域词典。
根据已经确定出的包括实体和实体间关系的本体,生成一个包含实体属性值和实体的属性名的领域词典。具体的,可以根据以下步骤A1~步骤A2生成领域词典:
步骤A1:获取领域内各实体的各属性。
根据领域内确定出的本体,获取本体中各实体所包含的各属性。例如,对旅游领域确定出的本体,可以获取到本体所包含的实体有城市和景点等,并且可以获取到,城市具有名称、所属的国家等属性,景点具有名称、类型、营业时间等属性。
步骤A2:将所述各属性对应的属性值作为关键词,并将实体标签和属性名作为关键词的词类型,以及,将所述关键词的同义词、近义词和别名确定为关键词。
在获取到城市的名称、所属的国家等属性后,将获取的各属性对应的属性值作为关键词,将实体标签和属性名作为关键词的词类型。例如,城市的名称有“北京”和“上海”,所属的国家为“中国”,那么将“北京”、“上海”和“中国”作为关键词;将“城市名称”和“所属国家”作为词类型。进一步的,还可以将确定出的关键词的同义词、近义词和别名确定为关键词。例如,“中国的首都”是关键词“北京”的别名,所以,将“中国的首都”同样作为关键词。
此外,还可以通过人工添加和补充的方式来来确定关键词和关键词的词类型。
此时,将获取的各实体的各属性对应的属性值,以及各实体的各属性名作为词类型,就可以构成本领域的领域词典。由于通过查阅领域词典就可以确定一个句子中的关键词,因此,在后续的流程中,利用领域词典,就可以解析句子并提取句子中的关键词(slot)。特别的,领域词典对于冷门领域的作用是非常重要的。
例如,有一份如下表2所示的词典:
表2
Figure PCTCN2018075410-appb-000003
Figure PCTCN2018075410-appb-000004
其中,“###”是分隔符,分隔符前面是关键词,后面是关键词对应的词类型。特别情况下,领域词典中只有关键词列表,即只有关键词,没有关键词对应的词类型,这样的领域词典只能识别出句子中的关键词,不能确定关键词的类型。
当对如下的句子进行处理的时候:{窗前明月光是李白写的吗?},就可以提取到如下所示的关键词:{${Poem_content,窗前明月光}是${Poem_author,李白}写的吗?}。
步骤103:依据领域内各本体所表示出的各实体之间的关系,确定各领域内所有问句的意图。
其中,本实施例中的意图用于表述问句的询问目的,意图可以包括以下四点:
第一点、询问实体的属性。
例如,对上述的城市实体,可以有如下表3所示的意图:
表3
Figure PCTCN2018075410-appb-000005
例如,对上述的景点实体,可以有如下表4所示的意图:
表4
Figure PCTCN2018075410-appb-000006
第二点、询问实体之间的所有关系。
例如,上述的旅游领域本体,一共有三种关系,可以有如下所示的三种意图:
{城市有哪些景点?(城市到景点的关系)景点属于哪个城市?(景点到城市的关系)从这个景点怎么到另一个景点?(景点到景点的关系)}
第三点、通过实体的一个或多个属性询问该实体的其他属性或所有属性。
具体的,通过一个实体的某个或多个属性定位到实体,然后查询实体的其他属性。
例如上述的城市实体,可以有如下意图:{名称是xxx的城市是哪个国家的?(通过名称定位到城市,查询国家属性)名称是xxx的国家包含哪些城市?(通过国家定位 到城市,查询名称属性)}。
第四点、通过实体的一个或多个属性询问该实体的关系。
具体的,第四点和上述第三点所描述的方法相同的地方是先定位到实体;不同的地方是上述第三点是查询实体的属性,而第四点是查询实体的关系。例如,对于上述城市实体,可以有如下表5所示的意图:
表5
Figure PCTCN2018075410-appb-000007
通过上述第一点到第四点介绍的四种方法,可以通过本体枚举出所有可能的意图,这四种方法构成了意图枚举算法。这种枚举出来的意图有些是在真实场景下没有实际用处的。例如,问ID属性,因此意图枚举的结果可能需要一定的人工验证。实际上第一点是第三点的一个特例,即是通过名称属性定位到实体,然后查询实体的其他属性。
步骤104:为确定的各意图配置对应的意图模板。
具体的,意图模板负责对某一类意图的解答,例如,下面所示的问句:{杭州包含什么景点?西安有哪些景点?南京有哪些好玩的地方?},其中的每一个问句都是一个意图,即问一个城市有哪些景点,所有这些问题都可以用一个意图模板来解决。再例如,{从埃菲尔铁塔怎么去卢浮宫?规划一条从巴黎圣母院到埃菲尔铁塔的路线带我从巴黎圣母院去卢浮宫},所示的规划到某地的路线的问句,也都可以用一个意图模板来解决。可以认为,意图模板是意图的一个配置文件,用来表示与该配置文件对应的意图应该如何生成答案。
具体的,意图模板可以包括:模板标识,模板描述,意图参数及意图参数对应的参数问题,意图对应的例句组,以及,各例句组的组合规则。
其中,所述模板标识用于唯一表示一个意图模板,所述模板描述用于描述所述意图模板的目的;所述意图参数为确定一个意图所对应的参数;所述参数问题为:对应的意图参数缺失时需要向用户发送的问题;所述例句组中的例句包括实体的变量名,用于表示所述意图模板能解决的问题;所述各例句组的组合规则用于表示:不同例句组中的例句的组合方式。
具体的,上述第一个意图模板的模板描述可以为“找某个城市的景点”;第二个意图模板的模板描述可以为“规划从某地到某地的路线”。第一个意图模板的意图参数是 城市名称;第二个意图模板的意图参数有两个,一个是起点(startPoi),一个是终点(endPoi)。如果用户在对话的过程中没有给出意图参数,需要使用默认的参数问题来询问用户,下面表6是完整的意图参数的配置:
表6
Figure PCTCN2018075410-appb-000008
在上述意图参数后面的以“q:”开头的句子就是参数问题,一个意图参数可以对应多个参数问题,具体用的时候随机取一个参数问题即可。
具体的,意图模板对应的例句组指示了什么样的问题适合用这个模板来解决。其中,例句组由模板的设计者自己填写,一般通过分析领域经常问到的问题总结得到。例如,上述第一个寻找某个城市的景点的意图模板,其例句组可以如下表7所示:
表7
Figure PCTCN2018075410-appb-000009
由于上述寻找城市的景点的意图适合用这种类型的语句来询问,所以,在问题分类中这种类型的问题会被分类到这个意图模板中。
上述例句组中给出了具体的例句句式,重点是对句式的总结,构成了所有可能问题模式的集合。由于在实际的应用场景中,实体是一个变量,所以将变量填充到例句之后,可以生成多个真实例句。例如,${city_name}可以是西安、伦敦、杭州、上海等,将这些实体名称填充到表7所示例句的${city_name}中,可以生成如下所示的真实语句:{杭州包含什么景点?杭州有哪些景点?杭州有哪些好玩的地方?西安包含什么景点?西安有哪些景点?西安有哪些好玩的地方?……}。
上面列举的例句组中没有组的标记,默认是一组例句,因此不存在例句间的组装逻辑,这种采用一问一答形式来对话的意图模板属于单轮对话意图模板。单轮对话意图模 板适用于一问一答的应用场景,并且采用单轮对话意图模板中的例句生成的真实例句不包含上下文的信息。
在意图模板中除了单轮对话意图模板外,还存在多轮对话意图模板。多轮对话意图模板中的问题有多个,且包含上下文(Context)的多句问题,具体的多句问题可以如下表8所示:
表8
Figure PCTCN2018075410-appb-000010
从上述的多句问题可以看出,服务器向用户询问了多句,才得到了用户的意图,并且得到了较多的意图参数。因此,服务器在回答多轮对话的问题时需要考虑上下文,并且当没有清楚的得到用户的意图,或者没有得到较多的以意图参数时,需要进一步的对用户询问。进一步的,在回答多轮对话的问题时可以充分考虑到上下文中用户表达的意图参数或意图。
需要说明的是,多轮对话意图模板在配置例句的时候需要明确设置组的概念,例如下面表9所示的例句配置:一共有六组,每组以“#”符号开始。如果组号后面有“intent”关键字,则表示这个组是有明确意图的给出,否则,这个组可能只是表达某个意图参数。
表9
Figure PCTCN2018075410-appb-000011
Figure PCTCN2018075410-appb-000012
从上述多轮对话意图模板配置的例句中,可以看出,第一组既给出了意图又给出了所需的所有参数,是一个完整的问题的表达。如果只有第一组,多轮对话意图模板就转化为单轮对话意图模板,可见,单轮对话意图模板是多轮对话意图模板的特殊形式。
如果将上述多轮对话意图模板中的各例句组按照一定的组合规则来组合,具体的组合方式如下表10所示:
表10
Figure PCTCN2018075410-appb-000013
上述的组合规则表中的每一行代表一个组合规则,其中数字代表组号。例如组合规则10“2,3,6”,所表示的意思是从第二组中随机选取一句话,再从第三组中随机选取一句话,再从第六组中随机选取一句话,最后将这三句话顺序连接起来,构成了一组多句问题例句。
按照同样的方式,表10中的每一种组合规则都可以得到一种多句问题的例句。例如,对于组合规则1:“1”,就是表9中第一组例句的单独组合,对例句中包括的实体的变量名进行填充之后,可以得到如下所示的三个不同的多句问题的真实例句:{怎么从巴黎圣母院去埃菲尔铁塔?从巴黎圣母院去埃菲尔铁塔,有什么路线?规划从巴黎圣母院去埃菲尔铁塔的路线?},其中,这里三个多句问题的真实例句,都表示了同一个含义。
再例如,根据组合规则12:“3,4,6”,可以得到如下表11所示的多句问题的真实例句,其中每组真实例句包含三句:
表11
Figure PCTCN2018075410-appb-000014
可以看出,多句问题所对应的多句例句有可能是不完整的,例如缺少某个参数,也有可能是完整的,例如,组合规则5所组合出来的多句例句。但是,每个组合规则生成的多句问题的多句例句,总会包含一个表达意图的例句。例如,表9所示的例句组1和3这两个例句组都是表达意图的例句组,所以表10中的组合规则里,总会采用例句组1或者例句组3里的句子来进行组合。这是为了模拟真实场景中,在用户没有提供足够的参数和意图时,用户的问题不会被分类到任何一个意图模板。因此,为了获取用户意图,在所有的例句组合规则都至少包含一个表达意图的句子。
此外,除了在意图模板中配置上述模板标识,模板描述,意图参数及意图参数对应的参数问题,意图对应的例句组,以及,各例句组的组合规则,还可以配置采用groovy脚本所表示的执行逻辑,执行该groovy脚本就可以生成对用户提问的答案。具体的,执 行groovy脚本生成用户提问的答案的步骤可以包括:获取数据、处理数据和生成答案。
其中,获取数据指的是要获取生成答案的源数据。解决任何问题都需要有相应的数据。例如,回答一个城市有哪些景点,需要获取这个城市的所有景点的信息,这些景点信息就是生成答案的源数据。回答一个景点的开关门时间需要有这个景点的实体数据。
处理数据指的是对生成答案的源数据进行处理。一般情况下,获取到了源数据后一般无法直接展示给用户,需要对源数据进行处理,包括控制检查、格式转化和算法加工等,才能得到可以直接展示给用户的数据。
生成答案是将处理后的源数据进行口语化,并展示给用户。经过了对源数据的处理后得到的数据,如果直接展示给用户显得系统有些生硬。因此,对处理后的源数据进行口语化,在口语化的过程中可以套用一些回复模板,或者采用字符串拼接的方式。
需要说明的是,意图模板是一种配置而不是代码。当需要改变意图模板中的执行逻辑时,可以通过改变意图模板中执行逻辑的配置来实现。当需要增加对某个新意图问题的回答时,只需增加相应的意图模板中执行逻辑的配置即可。为了增加意图模板的灵活性,本申请实施例使用groovy脚本来实现上述获取数据、处理数据和生成答案三个步骤。当一个用户问题被分配到具体的意图模板时,只需动态执行相应意图模板中的groovy脚本即可生成答案。
为了更清楚的介绍意图模板,意图模板的典型结构如下表12所示:
表12
Figure PCTCN2018075410-appb-000015
更详细的,意图为“规划从某地到某地的路线”的多轮对话意图模板的示例,如下表13所示:
表13
Figure PCTCN2018075410-appb-000016
Figure PCTCN2018075410-appb-000017
Figure PCTCN2018075410-appb-000018
在表13中,“ID”为模板标识,用于唯一标识一个模板,“Desc”为模板描述,用于采用自然语言描述一个模板的目的,“Args”为意图参数,为该意图模板所需要的所有参数,“Argument_script”为意图参数赋值的脚本,“Data_retrieve_script”为数据获取脚本,“Data_process_script”为数据处理脚本,“Answer_generate_script”为生成答案脚本,“Corpus”为例句组,“Assemble_rule”为例句组的组合规则。
需要说明的是,在表13的字段“data_retrieve_script”中,直接使用了一个planner变量的plan函数来获取路线。而脚本里面并没有说明planner变量是如何初始化的。实际上planner变量是一个路线规划引擎,plan函数是路线规划的入口函数。意图模板在执行脚本的时候,在初始化groovy执行器之前,是需要初始化planner变量的,这个是在实际的引擎里面完成的,初始化完成之后,将planner这个变量设置到groovy执行引擎的环境变量里面,然后在groovy脚本里面就可以直接使用了,所以上述脚本是不会报错的。
采用groovy脚本可以使意图模板的问答引擎可以回答任何的问题,因为执行数据获取脚本可以获取到任何的数据,无论是直接查询数据库,查找知识图谱,调用搜索引擎,或者调用其他的相关系统,等等,都可以实现。对于在其他非groovy脚本,也可以将复 杂的数据处理操作(可能需要复杂的算法来进行数据处理),首先在问答引擎里面实现,然后将访问入口放置在groovy的环境变量里面,这样就可以直接调用这个环境变量来进行数据处理。所以本申请实施例中采用groovy脚本,可以大量减少意图模板中的groovy脚本的量,却又可以使这些groovy脚本执行从简单到复杂的任意逻辑操作。
通过上述对单轮对话意图模板和多轮对话意图模板的介绍,可以得出这二者都有自己特定的使用场景,各有特点。单轮对话意图模板简单,例句简单,维护也简单,适用于一问一答这种简单的场景(即图7所示的实施例),并且单轮对话意图模板是多轮对话意图模板的一种特殊形式。多轮对话意图模板稍微复杂,但是可以适用于更多的场景(即图8所示的实施例),并且,多轮对话意图模板可以以对话的形式与用户沟通来挖掘用户的潜在意图,进而根据意图来回答问题,因此更加智能化。
在介绍完意图模板如何配置之后,意图模板中包含用户可能提出的每个问题所对应的例句组,并且意图模板中配置了可以完成用户提出的每个问题的意图的执行逻辑的groovy脚本,接着需要利用配置好的意图来训练本申请实施例中的意图识别模型和关键词提取模型。其中,意图识别模型可以用于针对一个问句,识别出该问句的意图,例如,一个问句是“请问从巴黎圣母院到卢浮宫怎么走”,将该问句的词标注结果输入意识识别模型可以得到该问句的多个候选意图及所述多个候选意图的可信度,可信度可以用于表示对于的候选意图的可能性大小,可信度越高,对应的候选意图是用户询问的真实意图的可能性就越大。其中,候选意图可以采用模板标识ID来表示。
在本申请实施例中,意图识别模型是自然语言分类器,而自然语言分类器是机器学习模型,无论采用哪种机器学习算法,都需要同样的训练语料,即带有标记的自然语言文本。其中,参考表14所示,为带有标记的自然语言文本的例子示意表。
表14
自然语言语句 标记(label)
杭州有哪些景点 get_city_scenery
西安有什么好玩的地方 get_city_scenery
巴黎圣母院什么时候关门呢? get_scenery_opentime
怎么从卢浮宫去埃菲尔铁塔呢? plan_route_to_poi
利用上述表14所示的大量的训练语料,就可以采用机器学习算法训练意图识别模型。例如,支持向量机(SVM,Support Vector Machine)是一个有监督的机器学习模型, 通常用来进行模式识别、分类、以及回归分析等。其中,生成训练语料的过程,就是执行配置的意图模板中的例句组合规则,并将例句中实体的变量名替换为变量值生成真实例句的过程。
而关键词提取模型是一种序列标注模型,序列标注就是对句子中的各个序列(即是分词之后的各分词)标注类型。因此,训练关键词提取模型的时候,就可以依据各真实例句(例如表14中的真实例句)的词标注结果进行训练,其中词标注结果可以包括:各个分词的词性标注,各个分词是否为关键词的标注,以及各个关键词的词类型的标注,等等。
例如,对于表14中的真实例句“怎么从卢浮宫去埃菲尔铁塔呢?”,其词标注结果可以为:“怎么_r从_p卢浮宫_ns去_v埃菲尔铁塔_ns ### plan_route_to_poi###O O B-startPoi O B-endPoi”,在标注结果中,第一个分隔符“###”前的内容“怎么_r从_p卢浮宫_ns去_v埃菲尔铁塔_ns”为词标注结果,第一个分隔符和第二个分隔符之间的内容“plan_route_to_poi”为该真实例句对应的意图模板ID,而第二个分隔符之后的内容“O O B-startPoi O B-endPoi”为关键词标注结果,表示分词“怎么”和“从”不是关键词,而“卢浮宫”是关键词,且词类型为“起点”,分词“去”也不是关键词,而“埃菲尔铁塔”是关键词,且词类型为“终点”。依据大量真实例句的词标注结果即可训练得到关键词提取模型,该关键词提取模型有对线上问句进行关键词提取。
因此,在介绍完意图模板的配置过程之后,参考图4,示出了本申请训练意图识别模型和关键词提取模型的流程图,本实施例可以包括以下步骤401~步骤405:
步骤401:获取实体的变量值列表,所述变量值列表包括:实体的变量名、实体的变量值及两者的对应关系。
在本实施例的流程中,步骤401~步骤404是生成训练语料的过程。
在本实施例中,意图模板中虽然配置了例句,但是这些例句包括了实体的变量名,例如“City_name”,并且只是问法的集合,是对所有可能的问句的模式的总结。这种例句不是真实的句子,因为例句中有变量名。而如果将这些变量名都替换为真实的变量值,例如将“City_name”替换为“北京”,则可以生成真实例句。因此生成真实记录的前提,是一个实体的变量名的所有可能的变量值的集合。
例如,对于意图模板中配置的例句“${City_name}是哪个国家的?”,其中的变量名就是“City_name”,其可能的变量值的集合有:{杭州,苏州,北京,上海,伦敦,巴黎,等等}。因此,将该变量值的集合中的变量值替换为例句中的变量名,就能生成 如下所示的真实例句的集合:{杭州是哪个国家的?苏州是哪个国家的?北京是哪个国家的?上海是哪个国家的?伦敦是哪个国家的?巴黎是哪个国家的?等等}
而在本在步骤中,针对一个领域,为了得到实体的变量值的列表,可以有如下所示的方法:第一,从知识库中获取实体的类型和属性名的属性的值。例如,上述的变量名“City_name”,实体的类型是“City”,属性名是“name”,所以可以查询知识库获取实体“City”的属性名“name”的属性值,就可以得到相当多的实体的变量值。第二,从外部获取。例如,从外部的网页爬取等。第三,人工维护。依靠用户的经验自己添加相应的变量值。第四,随机产生,不过第四种方式适合某些不可枚举的变量值,例如身高的变量名为“${height}”、体重的变量名为“${weight}”等。这种变量名的变量值可以通过随机的方式产生,“身高”可以生成100到230之间的随机整数,就代表可能的变量值(单位为厘米)。
一般情况下,如果希望生成的真实例句不会重复,即有相同的变量值被填充到例句的变量名中,所以变量值的个数一般要比生成的真实例句的个数要多。当然,如果变量值太多的话,也会增加获取实体的变量值列表的工作量,也会影响系统性能,所以也不是越多越好。本领域技术人员可以在获取实体的变量值列表时自主选择变量值的个数。
步骤402:依据意图模板中配置的例句组和例句组的组合规则,生成包括实体的变量名的变量例句。
在本步骤中,依据已经配置好的意图模板中的例句组和例句组的组合规则,来生成包括变量名的变量例句。其中,意图模板中的例句是非结构化的,可以通过解析意图模板中已经编辑好的例句,并将例句存储在一定的数据结构中,例如存在内存里面,方面后续的使用。这里的存储例句的数据结构可以有很多种选择,主要看是否方便输出给后续的处理程序来使用。
这里需要注意的是,因为意图模板中,针对于直接根据用户询问的问句生成答案的单轮形式的情况,例句组可以只有一组,即所有例句都编号为“1”,或者,添加其他的默认组编号均可。而对于需要向用户返回问题并根据用户的回答才能确定用户的意图的多轮形式的情况,例句组就有多个,可以分别采用“1、2、3……”等为各例句组编号。
而例句组的组合规则,也可以通过读取配置好的意图模板中而得到。同样的,存储例句组的组合规则的数据结构也可以有很多种选择,选择的依据是看是否方便后续的处理程序来使用。例句组的组合规则用于表示需要将哪几个例句组的例句组合在一起,例如例句组的组合规则为“1,2”,则说明需要从第一个例句组和第二个例句组中分别选择 一个例句来生成变量例句。而对于单轮形式的意图目标,其中的例句组的组合规则可以直接为“1”,或者其他的默认规则。
因为例句组和例句组的组合规则都存储在特定的数据结构中,接着就可以读取例句组及其组合规则来生成一定数量的真实例句。假设,例句组及其组合规则已经解析成如表15所示的数据结构(json格式)。
表15
Figure PCTCN2018075410-appb-000019
Figure PCTCN2018075410-appb-000020
在实际应用中,为了避免真实例句的数量过多也会造成系统性能的降低,可以预先设定一个组合规则最多生成多少条真实例句,例如,最多生成100条真实例句。
在生成真实例句的过程中,可以从组合规则中指定的每个例句组里面随机选择一条例句,并带上例句组的类型。如果例句组的类型是“intent”,则将该真实例句标记为模板标识ID,如果例句组的类型是关键词slot,则在模板ID后面添加标记“-slot”,说明该真实例句不是直接表明意图,而是提供意图参数。接着按照组合规则指定的例句组,就可以将包括变量名的例句拼装起来,形成多轮变量例句。
参考表16所示,为按照组合规则1和2,得到的变量例句的例子。
表16
Figure PCTCN2018075410-appb-000021
步骤403:将所述变量值列表中各实体的变量值,分别对应替换所述变量例句中的变量名,得到真实例句。
接着将步骤401中获取到的变量值列表中各实体的变量值,来对应替换表16所示的变量例句中的变量,就可以得到真实例句。例如,从变量值列表中随机获取一个变量值,替换变量例句中相应的变量名。因此,上述表16中的生成的变量例句,经过步骤403可以得到表17所示的真实例句的例子。在表17中,“###”符号是分隔符,该分隔符前的内容是真实例句,该分隔符后的内容该真实例句对应的模板标识ID。
表17
Figure PCTCN2018075410-appb-000022
步骤404:对所述真实例句进行标记,得到训练语料;所述训练语料包括:所述真实例句对应的模板标识和所述真实例句中包括的各关键词及其类型。
本步骤需要对表17所示的真实例句进行标记处理,从而得到训练语料,可以用来训练本申请实施例中的意图识别模型和关键词提取模型。其中,本步骤中得到的训练语料可以直接作为训练意图识别模型和关键词提取模型需要的、特定格式的输入。其中,表18示出了训练语料的一种格式示例。
表18
Figure PCTCN2018075410-appb-000023
其中“BOS(begin of session)”是一组训练语料的开始标记,而“EOS(end of session)”是一组训练语料的结束标记。“分词和词性标注结果”可以是对一个真实例句进行分词和词性标记的结果,句子标记即是该真实例句的模板标识ID,“关键词slot标记”是对该真实例句中的每个分词进行是否为关键词slot以及关键词slot类型的标记。在“slot标记”中,可以采用“O”来表示这个分词不是slot,可以采用“B”表示这个分词是slot且是该slot的开始,可以采用“I”表示这个分词是一个slot的继续,因此,从前面最相 邻的“B”到连续出现的“I”对应的分词,就构成了一个完整的slot。“B”和“I”后的标记内容,是该slot的词类型。
因此,针对表18中生成的真实例句,就可以通过标记处理,得到如表19所示的词标注结果,该词标注结果可以直接用于机器学习算法的训练输入。
表19
Figure PCTCN2018075410-appb-000024
在表19中,针对第一条训练语料“怎么_r从_p巴黎圣母院_ns去_v卢浮宫_ns ### plan_route_to_poi###O O B-startPoi O B-endPoi”,其中的“怎么_r从_p巴黎圣母院_ns去_v卢浮宫_ns”,即第一个分隔符“###”之前的内容,是对该真实例句的分词和词性标记结果。其中的“plan_route_to_poi”,即第一个分隔符“###”和第二个分隔符“###”之间的内容,是意图模板的模板标识。其中的“O O B-startPoi O B-endPoi”,即第二个分隔符之后的内容,是关键词标记的结果,其中第一个字符“O”用于表示对应的分词“怎么”不是关键词,第二个字符“O”用于表示对应的分词“从”不是关键词,第三个字符“B”表示对应的分词“巴黎圣母院”是关键词,其词类型为起点“startPoi”,第四个字符“O”用于表示对应的分词“去”不是关键词,第五个字符“B”表示对应的分词“卢浮宫”是关键词,其词类型为终点“endPoi”。以此类推,本领域技术人员可以确定表X中其他训练语料的含义。
以上步骤401~步骤404是依据所述意图模板中配置的例句组和例句组合规则,生成训练语料的过程。
步骤405:依据所述训练语料采用机器学习算法,训练得到意图分类模型和关键词提取模型。
有了步骤404生成的训练语料,就可以使用机器学习算法来训练意图分类模型和关键词提取。当然,在实际应用中,本领域技术人员可以仅训练一个模型来同时进行模板分类和关键词slot提取,这就是联合模型(joint model)。例如,最有效的递归神经网络(RNN)。
本领域技术人员也可以只训练意图识别模型,例如,最有效的卷积神经网络(CNN)进行文本分类,并且可以采用多通道进行输入,增强模型判断的准确率。如表X所示的训练语料一共可以提供三种不同的通道,一种是词向量通道,第二种是词性通道,第三种是slot标注通道。
当然,本领域技术人员也可以同时训练出意图识别模型和关键词提取模型,其中,意图识别模型有进行问句的意图识别,关键词提取模型有对问句进行关键词的标记和类型标记。
另外,单轮对话方式和多轮对话方式需要不同的模型,单轮对话方式只需要考虑对当前这一个问句的判断,仅对当前这句话进行分词和词性标注、意图识别以及slot提取即可;而多轮对话方式需要的意图识别模型和关键词提取模型都更加复杂,模型的输入不仅包括当前这句话的标记结果,也包括这句话之前的历史对话内容(即上下文),由 意图识别模型和关键词提取模型参考上下文来确定当前这句话的意图并进行slot提取。在本申请实施例中,无论是单轮对话方式还是多轮对话方式,都可以采用相应的深度学习算法来解决,因此本申请实施例既可以实现单轮对话方式的意图识别,也可以同时实现单轮对话方式的意图识别和slot提取,也可以实现多轮对话方式的意图识别及其slot提取。
在本申请实施例中,以同时训练得到意图识别模型和关键词提取模型为例进行说明。在训练得到意图识别模型和关键词提取模型之后,可以采用意识识别模型来确定一个问句的意图,以及采用关键词提取模型对该问句进行关键词提取,得到各分词是否为关键词以及词类型的标记结果。因此,本申请实施例可以应用于问题答案的自动生成领域,例如,问答引擎。参考图5,是本申请的问句答案的生成方法在实际应用中的场景架构图。在图5中,用户通过客户端501向服务器502发送一个问句,来询问自己想要的答案,例如,杭州的景点都包括哪些,服务器502则可以采用预先训练的关键词提取模型提取出杭州和景点两个关键词,并且词类型为“城市名称”和“旅游地点”,接着可以依据预先训练的意图识别模型得到该问句是要问杭州的景点,接着就可以通过确定的意图来生成该问句的答案,并通过客户端501展示给用户。其中,服务器502可以采用问答引擎等实现。
基于图5所示的场景架构图,参考图6所示,示出了本申请一种问句答案的生成方法实施例1的流程图,本实施例可以应用于图5所示的服务器502上,例如,问答引擎等,本实施例可以包括以下步骤:
步骤601:响应于触发问句,至少依据预先训练的关键词提取模型对所述问句进行标注得到词标注结果,所述词标注结果包括:所述问句的各分词是否为关键词以及各关键词的词类型。
在本步骤中,用户通过客户端向服务器例如问答引擎发送了一个问题,则服务器可以对该问句进行分析,不仅依据关键词提取模型确定出该问句包括的关键词及关键词的词类型,还能依据意图识别模型确定出该问句的询问的意图。进行关键词提取的时候,可以先对问句进行分词和词性标注,例如,问句中的分词是名词还是动词等,再依据预先训练的关键词提取模型对该问句进行标注得到词标注结果,词标注结果可以包括:问句的各分词是否为关键词以及各关键词的词类型。
具体的,步骤601可以包括步骤B1~步骤B3:
步骤B1:对所述问句进行分词,得到所述问句的分词集合。
首先,对问句进行分词处理并进行词性标注,得到具有词性标注的分词集合。
步骤B2:基于所述问句所属的领域对应的领域词典,对所述分词集合中的各分词进行关键词标记得到第一标记结果;以及,基于预先训练的关键词提取模型,对所述分词集合中的各分词进行关键词标记得到第二标记结果。
根据该问句所属的领域对应的领域词典,对分词集合中的各分词进行关键词标记得到第一标记结果。其中,领域词典用于保存各领域词及其对应的词类型之间的对应关系,或者,有些领域词没有标注词类型,因此,基于领域词典对各分词进行标记得到的第一标记结果中,可能同时包括关键词和对应的词类型,也可能仅包括关键词。由于领域词典中可能出现一个领域词包含另一个领域词的现象,如果这两个领域词的词类型不同,则在标记的时候就会出现无法确定采用哪一个词类型的问题。在本实施例中可以这里采用最长优先标记算法来进行标记,即:当存在词类型冲突的时候,优先标记长度最长的领域词。
例如,领域词典中有如下的词:杭州,西湖,博物馆,和西湖博物馆,而问句为“杭州西湖的边上有一座西湖博物馆”,则基于领域词典对该问句进行标记的第一标记结果为:“杭州_B-City-name/西湖_B/的边上有一座_O/西湖博物馆_B-scenic spots name”。参考领域词典中的领域词,“西湖博物馆”既可以标记为“西湖博物馆_B-scenic spots name”,也可以标记为:“西湖_B博物馆_B”,但是按照最长优先标记算法,“西湖博物馆”的长度比“西湖”和“博物馆”都长,所以优先标记为“西湖博物馆_B-scenic spots name”。可见,关键词“杭州”、“西湖”和“西湖博物馆”都标记为关键词,并且“杭州”和“西湖博物馆”同时也被标记出了词类型,而“西湖”因为在领域词典未给出词类型,所以也没有被标记出词类型。
以上可知,基于领域词典进行标注是一种最直接的方式来识别问句中的关键词slot,只考虑各个分词本身是一种局部优先的方法。而在实际应用中,用户可能会出现输入错误等,导致基于领域词典的第一标记结果为空,而且领域词典中的领域词可能会比较杂,因此会将问句中的不重要的分词也标记出来,这就会对最终生成的答案造成比较大的影响。在这种情况,需要采用预先训练的关键词提取模型同时对问句进行标记。
基于关键词提取模型对问句进行关键词提取及词类型的标记,会同时考虑问句的结构,从而确定各分词是否为关键词以及确定各关键词的词类型,是一种全局性的方法。例如,假设问句为“从埃菲尔铁塔到巴黎圣母院怎么走?”,采用预先训练的关键词提 取模型已经学习到了“从${startPoi}到${endPoi}怎么走?”的句式,因此可以做出如下的第二标记结果:“从_O埃菲尔铁塔_B-startPoi到_O巴黎_B圣母院_I-endPoi怎么_O走_O?_O”
步骤B3:依据所述第一标记结果和第二标记结果,确定所述分词集合中的各分词的词标注结果。
在本步骤中,针对步骤B2中得到的第一标记结果和第二标记结果,则可以确定问句的最终词标注结果。例如,可以针对分词集合中的各分词,判断所述第一标记结果和第二标记结果是否都将其标注为关键词,如果是,则将该分词确定为关键词,并依据第一标记结果或第二标记结果中标记出的词类型来确定该关键词的词类型。而如果第一标记结果标注为关键词而第二标记结果标注为非关键词,则将该分词确定为非关键词。即,如果基于领域词典的第一标注结果认为一个分词是关键词,而基于关键词提取模型的第二标注结果认为该分词不是关键词,则以第二标注结果为准,不再将该分词确定为关键词。
例如,用户发送的问句为“帮我规划一条从巴黎圣母院到凯旋门的路线?”,根据该问句可以生成词标记结果,该词标记结果可以是词标记矩阵的形式,其中包括各分词和分词是否为关键词以及词类型的标记结果。一种词标记矩阵的示例可以参考表20所示。
表20
Figure PCTCN2018075410-appb-000025
Figure PCTCN2018075410-appb-000026
其中,表20中的“-”代表没有标注结果。
步骤602:依据所述词标注结果和预先训练的意图识别模型,确定所述问句的目标意图。
在本步骤中,则将步骤601中得到的问句的词标注结果,作为预先训练的意图识别模型的输入,从而得到该问句多个候选意图,以及各候选意图对应的可信度。例如,针对表X中的词标注结果,根据各关键词及词类型的标注结果,意图识别模型输出以下三个候选意图:plan_route_to_poi,get_scenic spots_of_city,和,get_name_of_city,分别对应的可信度为0.9、0.4和0.3。可见,候选意图其实是配置好的意图模板的模板标识ID。候选意图“plan_route_to_poi”对应于用于规划路线的意图,而候选意图“get_scenic spots_of_city”对应于用于获取一个城市的景点的意图,而候选意图“get_name_of_city”对应于用于获取一个城市的名字的意图,其中,候选意图“plan_route_to_poi”对应的可信度0.9的分值最高,说明该候选意图“plan_route_to_poi”最有可能是该问句的目标意图,最有可能反映出用户提问的真实目的。
步骤603:依据预先配置的、与所述目标意图对应的目标意图模板,获取所述目标意图对应的目标答案。
在本步骤中,根据确定的目标意图可以分别对应到目标意图模板,再依据该目标意图模板,可以根据目标意图模板中配置的获取目标答案的方法,来获取该目标意图对应的目标答案,并返回给客户端。
具体的,步骤603的实现过程可以包括步骤C1~步骤C4:
步骤C1:依据目标意图模板中配置的意图参数,为所述意图参数赋值,得到查询参数。
在本步骤中,因为一个意图模板中均配置了意图参数,因此,采用步骤601中得到的词标注结果为意图参数进行赋值从而得到查询参数。例如,对于目标意图“plan_route_to_poi”,在目标意图模板中已经配置好意图参数,可以包括起点参数 “startPoi”和终点参数“endPoi”。则可以根据表X示意的词标注结果,起点关键词的名字为:“巴黎圣母院”,终点关键词的名字为“凯旋门”,则分别为起点参数“startPoi”和终点参数“endPoi”赋值,得到查询参数“巴黎圣母院”和“凯旋门”。
在实际应用中,可以在意图模板中配置好脚本,例如,为参数赋值的参数执行脚本,则本步骤即可直接运行目标意图模板中配置的参数执行脚本,从而为意图参数赋值。
可以理解的是,在实际应用,可以采用groovy脚本实现本申请实施例中的所有执行脚本。在执行脚本之前,可以先对groovy执行引擎进行初始化,并在groovy引擎中设置相应的变量,这些变量可以直接在意图模板中配置的groovy脚本中进行使用而无需再行声明。采用这种方式可以大量简化groovy脚本的数量,并且增强groovy脚本的功能。例如,初始化一个java的类,该类用来执行一个比较复杂的操作,然后将这个类的实例设置到groovy执行引擎中,则在其他的groovy脚本里面,可直接调用这个类的方法。
步骤C2:依据所述查询参数获取所述目标答案的源数据。
然后,再依据赋值后的查询参数来获取模板答案的源数据。例如,可以直接执行目标意图模板中配置的数据获取脚本。数据获取脚本中定义了如何获取相关的数据,执行这个脚本,直接获取数据,并按照用户自定义的返回值类型进行返回。
步骤C3:对所述源数据按照预设处理方式进行处理得到处理后的源数据。
在本步骤中,可以执行目标意图模板中配置的数据处理脚本实现对源数据的处理。其中,数据处理脚本可以接收数据获取脚本的返回值作为输入,并进行数据处理,并返回用户自定义的返回值类型。
步骤C4:依据所述处理后的源数据生成所述目标答案。
在本步骤中,可以执行目标意图模板中的答案生成脚本实现目标答案的生成。其中,可以数据处理脚本的返回值作为输入,进行答案拼装,或者执行特定的行为action,并返回用户自定义的返回值类型,并将答案生成脚本的返回值作为目标答案,可以将该目标答案通过客户端返回给用户,用户就可以得到提问的问句对应的答案或者最终行为action的执行结果。
可见,采用本申请实施例,通过意图模板的配置,可以生成足够多的训练语料,进而使得预先训练关键词提取模型和意图识别模型,对问句的关键期提取和意图的确定更为准确。并且,该意图模板中包括了获取答案的执行脚本,后续可以对执行脚本进行修改等操作,使得意图模板的可维护性更好。并且,根据确定的意图对应的意图模板可以直接执行脚本从而获得答案,从而提高了服务器例如问答引擎的效率。此外,意图模板 中还配置了能回答出问题的问句的例句,因此,使用意图模板可以方便的回答用户提问的问题,自动给出问题的答案。
参考图7所示,示出了本申请一种问句答案的生成方法实施例2的流程图,本实施例主要为单轮对话形式的示例,即根据用户提问的问句可以直接返回答案的应用场景,本实施例可以包括以下步骤:
步骤701:响应于触发问句,依据预先训练的关键词提取模型对所述问句进行标注得到词标注结果,所述词标注结果包括:所述问句的各分词是否为关键词以及各关键词的词类型。
在本实施例中,步骤701的实现可以参考步骤601的介绍,在此不再赘述。
步骤702:将所述词标注结果作为所述预先训练的意图识别模型的输入,得到多个候选意图及对应的可信度。
在本步骤中,将词标注结果作为意图识别模型的输入,可以得到多个候选意图及对应的可信度。具体可以参考步骤602的介绍。
步骤703:将所述多个候选意图中可信度最高的候选意图确定为当前意图。
在单轮对话形式中,以各候选意图的可信度为准来确定目标意图,首先,将可信度最高的候选意图作为当前意图进行意图决策,即从多个候选意图中选择最符合实际情况的意图作为目标意图。
步骤704:依据所述当前意图对应的当前意图模板,判断所述词标注结果中各关键词是否完整,如果完整,则进入步骤705,如果不完整,则进入步骤706。
对该当前意图对应的当前意图模板,可以获取到该当前意图模板中配置的所有意图参数,因为生成问句的答案需要所有意图参数的值,所以可以参考当前意图模板中配置的所有意图参数,来判断词标注结果中的各关键词是否完整,即是否能依据各关键词及对应的词类型,对当前意图模板中的所有意图参数成功进行赋值。
步骤705:将所述当前意图确定为目标意图。
如果当前意图模板的所有意图参数都能被赋值,则将当前意图确定为目标意图。
步骤706:按照可信度从高到底的顺序选择下一个候选意图作为当前意图,并返回步骤704,直至所述多个候选意图都选择完毕,仍然无法确定目标意图的时候,向客户端返回无法生成问题答案。
如果当前意图模板的所有意图参数不能都被赋值,则按照可信度从高到底的顺序选 择下一个候选意图作为当前意图,并继续判断新选择的当前意图中的全部意图参数是否能全部被赋值,直至多个候选意图都选择完毕。如果所有的候选意图都没有被选中,则可以不生成该问句的答案,进一步可以将无法生成答案的信息通过客户端返回给用户。
步骤707:依据预先配置的、与所述目标意图对应的目标意图模板,获取所述目标意图对应的目标答案。
如果能够确定得到目标意图,则进一步执行该目标意图模板中配置的各脚本,从而得到该问句的目标答案。
其中,在本实施例中,这里采用某一个意图模板的所有意图参数是否能被赋值作为确定目标意图的依据,因为意图分类模型可能存在着一定的失败率,可信度最高的候选意图可能不是真实的用户意图,因此,在得到候选意图之后再通过意图参数来约束,往往可以确定出到真实的用户意图。
在本实施例中,通过预先建立本体可以枚举用户所有可能的意图,然后将各个意图以意图模板的方式存储,每个意图模板负责解决对应的意图的问题。意图模板可以包括意图参数、意图的解决逻辑以及意图的可能问句形式,针对用户提出的问题,通过预先训练的关键词提取模型和,将该问句归类到一个具体的意图上,然后将提取的关键词作为意图的参数,执行意图模板里面对应的逻辑,即执行意图模板中配置的脚本从而得到问题的答案。本申请实施例中训练模型的大量训练语料都是根据意图模板中的例句组和例句组的组合规则生成的,因此训练得到的关键词提取模型和意图识别模型更能准确的提取关键词并进行意图归类,从而使得本实施例中生成的答案也能更准确。
参考图8所示,示出了本申请一种问句答案的生成方法实施例3的流程图,主要为多轮对话形式的示例,即不能根据用户提问的问句直接返回答案,需要向用户返回问题并根据用户的输入才能确定目标意图的应用场景,本实施例可以包括以下步骤:
步骤801:响应于触发问句,至少依据预先训练的关键词提取模型对所述问句进行标注得到词标注结果,所述词标注结果包括:所述问句的各分词是否为关键词以及各关键词的词类型。
在本实施例中,与步骤701不同的是,针对每一次用户提出的当前问句,服务器都会将当前问句的词标注结果,以及历史问句的关键词提取结果作为关键词提取模型的输入,来对当前问句进行关键词提取。
其中,在多轮对话形式中,对于用户的历史对话内容,例如,历史问句,对历史问 句的意图识别结果和关键词提取结果等,可以保存至会话数据库中,则本步骤就可以从会话数据库中获取对话内容。因为历史问句已经进行过关键词提取,且关键词提取结果都存储在历史对话内容即上下文中,因此,可以直接从会话数据库中获取到历史问句的关键词提取结果,将其和当前问句的词标注结果一并作为关键词提取模型的输入,来对当前问句进行关键词提取。可以理解的是,关键词提取结果也不是一成不变的,可能随着对话内容的改变而改变。
步骤802:至少将所述词标注结果作为所述预先训练的意图识别模型的输入,得到多个候选意图及其对应的可信度。
本步骤与步骤702的不同之处在于,本步骤中意图识别模型的输入,除了用户提出的当前问句的词标注结果,还可以包括用户的历史问句的关键词提取结果和意图识别结果,其中,关键词提取结果和意图识别结果可以用于对当前问句辅助识别意图。因为本实施例应用的是多轮对话形式的应用场景,所以用户每一次输入的内容例如问句中也会包括必要的信息,例如意图参数等,因此,对用户后续输入的内容进行词标注之后,除了将词标注结果作为意图识别模型的输入,还会将历史问句的意图识别结果和关键词提取结果也作为意图识别模型的输入,从而得到当前问句的多个候选意图及对应的可信度。
其中,本步骤就可以从会话数据库中获取对话内容。因为历史问句已经进行过关键词提取,且关键词提取结果都存储在历史对话内容即上下文中,因此,解析出了候选意图之后,候选意图的参数一部分来自于对当前语句的关键词提取结果,另一部分来自于对话内容的上下文中。具体的,针对用户每一次输入的当前问句,将该当前问句的词标注结果,以及历史问句的意图识别结果和关键词提取结果,都作为意图识别模型的输入,来获取当前问句的意图识别结果。可以理解的是,候选意图也不是一成不变的,可能随着对话内容的改变而改变。
步骤803:将所述多个候选意图中可信度最高的候选意图确定为当前意图。
在本步骤中将步骤802中得到的多个候选意图中可信度最高的候选意图确定为当前意图。
步骤804:判断所述当前意图的可信度是否大于预设可信度阈值,如果大于,则进入步骤806;如果不大于,则进入步骤805。
在本步骤中,判断可信度的最大值是否大于预设可信度阈值,例如,0.8,如果大于,则可以认为选择可信度最大的当前意图作为目标意图。
步骤805:选取预设个数的前若干个候选意图作为待选择意图,并将所述待选择意 图发送至终端以供用户选择。
而如果可信度的最大值都小于预设可信度阈值,则可以按照可信度从大到小的顺序给候选意图进行排序,并选取前预设个数的多个候选意图作为待选择意图。例如,选取前两个候选意图作为待选择意图,并发送给客户端,以便用户可以从这两个待选择意图中选择与自己实际目的相符合的意图,进一步的,后续可以将用户选择的意图作为目标意图。
具体的,服务器可以生成包括这两个待选择意图的选择问句返回给用户。选择问句的内容可以来自于意图模板的“desc”字段,例如有两个待选择意图的“desc”字段分别为表21所示的内容。
表21
plan_route_to_poi 规划到${poi}的路线
get_poi_desc 获取${poi}的介绍
则生成的选择问句可以为:“请问您是想规划到凯旋门的路线,还是获取凯旋门的介绍呢?”。
步骤806:将所述终端返回的、用户选择的意图确定为目标意图,或者,将当前意图确定为所述目标意图。
将选择问句返回至客户端展示给用户之后,用户会根据选择问句输入答案,例如输入“规划到凯旋门的路线”,则可以认为用户选择的意图为“规划到凯旋门的路线”,从而将该意图确定为目标意图。
可以理解的是,如果发送一次选择问句无法确定目标意图,服务器可以再次或者多次向用户发送选择问句,直至确定出用户的目标意图,或者当所有的“desc”字段都组合完毕,仍然不能确定出用户的目标意图,则返回无法确定意图的内容给客户端,结束生成问句的答案的流程;或者,用户如果改变了其最初的意图,在这种情况下,也可以结束当前问句的答案生成的流程,转而对用户新意图的处理和执行。
步骤807:依据所述目标意图对应的目标意图模板,判断所述词标注结果中各关键词是否完整,如果不完整,则进入步骤808,如果完整,则进入步骤811。
在确定目标意图之后,依据对应的目标意图模板中配置的全部意图参数,来判断词标注结果中各关键词是否完整。具体的判断过程可以参考步骤704的介绍,在此不再赘述。
步骤808:将不完整的关键词对应的意图参数确定为缺少的意图参数;依据所述缺 少的意图参数和所述目标意图模板,生成所述目标意图相关的参数问题。
在本实施例中,如果依据词标注结果无法对目标意图模板中的意图参数进行赋值,则说明词标注结果中的关键词不完整,不完整的关键词就对应了无法赋值的那些意图参数,将这些意图参数确定为缺少的意图参数。
步骤809:将所述参数问题返回给客户端以便显示给用户,所述意图模板包括:所述意图参数和参数问题之间的对应关系。
进一步的,依据缺少的意图参数和目标意图模板中该缺少的意图参数对应的参数问题,来生成询问问题发送至客户端展示给用户。
其中,参数问题的生成来自于意图模板,在意图模板中,每个意图参数在定义的时候都被设置了一些如果该意图参数缺失需要询问的问题,因此,这里从缺失的参数对应的参数问题列表中随机选择一个问题返回给用户即可。
步骤810:根据所述客户端返回的、用户输入的参数答案获取所述缺少的意图参数,进入步骤811。
生成参数问题询问用户后,用户可能在下一轮对话中给出相应的意图参数,就可以从用户输入的参数答案中获取到缺少的意图参数,在这种情况下,目标意图模板的全部意图参数就都可以赋值了。或者,如果用户改变意图,则服务器也会停止对当前意图缺失的意图参数的提问。
步骤811:依据预先配置的、与所述目标意图对应的目标意图模板,获取所述目标意图对应的目标答案。
在本步骤中,如果目标意图模板的全部意图参数都能被赋值,就可以接着执行该目标意图模板中预先配置的脚本,来生成该目标意图的目标答案,具体过程可以参考步骤603所示,在此不再赘述。
需要说明的是,在多轮对话形式中,确定目标意图和目标意图的意图参数的完整性判断,实际上是一种推理,即根据用户提供的内容,推理出用户真正的意图。与单轮对话形式不同的是,本实施例并非基于意图参数优先匹配来确定目标意图,而是基于可信度优先的原则来确定目标意图。因为在单轮对话形式中用户会在一个问句中尽量全的表达意图和意图参数,而多轮对话形式时,用户可能倾向于随意的表达,即一个问句或者一句话里面可能只表达了意图,但是没有任何的参数,例如“可以帮我规划一条路线吗?”,对于这个问句,如果按照意图参数优先匹配的原则,则一条候选意图都匹配不上,因为用户没有提供任何的意图参数,但是用户却明确的表达了意图,因此在多轮对 话形式中采用可信度优先的方式,可以更为准确的发掘用户的意图。
在本实施例中,为了方便挖掘用户的潜在意图,进行用户的真实意图的推理,本实施例还可以包括:
将用户输入的对话内容保存至会话数据库中,所述对话内容包括:用户选择的意图和/或用户输入的参数答案。
在服务器生成问句返回给客户端并展示给用户之后,用户可能会根据问句来输入自己的答案,或者,用户会根据问句来选择自己的意图,因此,可以将用户输入的这些对话内容暂时保存至会话数据库中。或者,也可以缓存至内存中。后续可以再从会话数据库或内存中获取到用户选择的意图,或者从对话内容中查询到意图参数等。
进一步的,在将对话内容保存至会话数据库或者内存后,还可以对所述会话数据库中的对话内容进行更新,或者,在到达预设的时间周期的时候,将用户输入的对话内容进行删除。因为在多轮对话形式中,涉及到用户和服务器例如问答引擎之间的对话,需要保存用户的历史对话内容以及涉及到的意图、意图参数等。可以理解的是,这些对话内容也不是随着时间一成不变的,随着用户和服务器的对话内容的推进,原本的意图或意图参数的值也会被新的值覆盖。同样,这些对话内容也不是永久存在的,例如可以设置一个时间阈值,当达到该时间阈值的时候就可以删除该对话内容。或者,在用户发送了新的问题产生了新的对话内容的时候,上一次的对话内容就不能影响到当前这次对话,因此,可以将上一次的这些对话内容删除。
可见,在本实施例中,不仅会将用户最开始提问的问句作为关键词提取模型或意识识别模型的输入,还会在无法确定用户的意图或者能确定用户的意图可是意图参数不完整的情况下,向用户继续提问以便用户能够根据问题来选择自己的意图或者补充意图参数。因此,本实施例经过合理的推理就有可能能够明确用户的意图及获取到完整的意图参数,从而实现与用户对话并且根据对话内容能够自动生成用户所需的答案,不仅提高了答案生成的准确率,还能使得生成的答案更符合用户的习惯,与用户的对话交互也非常友好,用户不需要去学习一种专门的交互方式,直接通过日常生活中的对话的方式就可以与服务器例如问答引擎交流。
对于前述的方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书 中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本申请所必须的。
与上述本申请一种问句答案的生成方法实施例1所提供的方法相对应,参见图9,本申请还提供了一种问句答案的生成装置实施例,在本实施例中,该生成装置可以集成于服务器端,例如问答引擎等,该生成装置可以包括:
关键词标注单元901,用于响应于触发问句,至少依据预先训练的关键词提取模型对所述问句进行标注得到词标注结果,所述词标注结果包括:所述问句的各分词是否为关键词以及各关键词的词类型。
其中,所述关键词标注单元901可以包括:
分词子单元,用于对所述问句进行分词,得到所述问句的分词集合;第一标记子单元,用于基于所述问句所属的领域对应的领域词典,对所述分词集合中的各分词进行关键词标记得到第一标记结果;第二标记子单元,用于基于预先训练的关键词提取模型,对所述分词集合中的各分词进行关键词标记得到第二标记结果;所述领域词典用于保存各领域词及其对应的词类型之间的对应关系;以及,第一确定子单元,用于依据所述第一标记结果和第二标记结果,确定所述分词集合中的各分词的词标注结果。
其中,所述领域词典可以通过以下方式生成:获取领域内各实体的各属性;将所述各属性对应的属性值作为关键词,并将实体标签和属性名作为关键词的词类型,以及,将所述关键词的同义词、近义词和别名确定为关键词。
其中,所述第一确定子单元可以包括:
第一判断子单元,用于针对分词集合中的各分词,判断所述第一标记结果和第二标记结果是否都标注为关键词;第二确定子单元,用于在所述第一判断子单元的如果为是的情况下,将该分词确定为关键词,并依据所述第一标记结果或第二标记结果确定所述关键词的词类型;以及,第三确定子单元,用于在所述第一判断子单元的结果为第一标记结果标注为关键词而第二标记结果标注为非关键词的情况下,将该分词确定为非关键词。
意图确定单元902,用于依据所述词标注结果和预先训练的意图识别模型,确定所述问句的目标意图。
答案获取单元903,用于依据预先配置的、与所述目标意图对应的目标意图模板,获取所述目标意图对应的目标答案。
其中,所述答案获取单元903可以包括:
赋值子单元,用于依据目标意图模板中配置的意图参数,为所述意图参数赋值,得到查询参数;源数据获取子单元,用于依据所述查询参数获取所述目标答案的源数据;处理子单元,用于对所述源数据按照预设处理方式进行处理得到处理后的源数据;以及,生成子单元,用于依据所述处理后的源数据生成所述目标答案。
其中,意图模板可以通过以下方式生成:
依据领域内各本体所表示出的各实体之间的关系,确定各领域内所有问句的意图;为确定的各意图配置对应的意图模板。其中,所述意图用于表述问句的询问目的,所述意图包括:询问实体的属性,询问实体之间的所有关系,通过实体的一个或多个属性询问该实体的其他属性或所有属性,和/或,通过实体的一个或多个属性询问该实体的关系;所述意图模板包括:模板标识,模板描述,意图参数及意图参数对应的参数问题,意图对应的例句组,以及,各例句组的组合规则;所述模板标识用于唯一表示一个意图模板,所述模板描述用于描述所述意图模板的目的;所述意图参数为确定一个意图所对应的参数,所述参数问题为:对应的意图参数缺失时需要向用户发送的问题,所述例句组中的例句包括实体的变量名,用于表示所述意图模板能解决的问题,所述各例句组的组合规则用于表示:不同例句组中的例句的组合方式。
其中,意图识别模型和关键词提取模型可以通过以下方式训练:
依据所述意图模板中配置的例句组和例句组合规则,生成训练语料;依据所述训练语料采用机器学习算法,训练得到意图分类模型和关键词提取模型。
其中,训练语料可以通过以下方式生成:
获取实体的变量值列表,所述变量值列表包括:实体的变量名、实体的变量值及两者的对应关系;依据意图模板中配置的例句组和例句组的组合规则,生成包括实体的变量名的变量例句;将所述变量值列表中各实体的变量值,分别对应替换所述变量例句中的变量名,得到真实例句;对所述真实例句进行标记,得到训练语料;所述训练语料包括:所述真实例句对应的模板标识和所述真实例句中包括的各关键词及其类型。
可见,采用本申请实施例的生成装置,预先通过意图模板的配置,可以生成足够多的训练语料,进而使得预先训练关键词提取模型和意图识别模型,对问句的关键期提取和意图的确定更为准确。并且,该意图模板中包括了获取答案的执行脚本,后续可以对执行脚本进行修改等操作,使得意图模板的可维护性更好。并且,根据确定的意图对应的意图模板可以直接执行脚本从而获得答案,从而提高了服务器例如问答引擎的效率。此外,意图模板中还配置了能回答出问题的问句的例句,因此,使用意图模板可以方便 的回答用户提问的问题,自动给出问题的答案。
与上述本申请一种问句答案的生成方法实施例2所提供的方法相对应,参见图10,本申请还提供了一种问句答案的生成装置实施例2,在本实施例中,该生成装置可以集成于服务器端,例如问答引擎等,本实施例可以生成单轮对话形式中关于用户的问句的答案,该生成装置中的意图确定单元902可以包括:
第一模型处理子单元1001,用于将所述词标注结果作为所述预先训练的意图识别模型的输入,得到多个候选意图及对应的可信度。
第四确定子单元1002,用于将所述多个候选意图中可信度最高的候选意图确定为当前意图。
第二判断子单元1003,用于依据所述当前意图对应的当前意图模板,判断所述词标注结果中各关键词是否完整;所述意图模板包括:确定一意图所需要的全部意图参数。
第五确定子单元1004,用于在所述第二判断子单元的结果为是的情况下,将所述当前意图确定为目标意图。
选择子单元1005,用于在所述第二判断子单元的结果为否的情况下,按照可信度从高到底的顺序选择下一个候选意图作为当前意图。
触发子单元1006,用于在选择子单元选择下一个候选意图之后,触发所述的第二判断子单元,直至所述多个候选意图都选择完毕。
其中,所述第二判断子单元具体可以包括:
参数获取子单元,用于获取所述当前意图模板中配置的全部意图参数;赋值子单元,用于采用所述词标注结果中的各关键词的词类型,为所述全部意图参数进行赋值;以及,赋值判断子单元,用于判断所述全部意图参数是否能赋值成功。
采用本实施例的生成装置,通过预先建立本体可以枚举用户所有可能的意图,然后将各个意图以意图模板的方式存储,每个意图模板负责解决对应的意图的问题。意图模板可以包括意图参数、意图的解决逻辑以及意图的可能问句形式,针对用户提出的问题,通过预先训练的关键词提取模型和,将该问句归类到一个具体的意图上,然后将提取的关键词作为意图的参数,执行意图模板里面对应的逻辑,即执行意图模板中配置的脚本从而得到问题的答案。本申请实施例中训练模型的大量训练语料都是根据意图模板中的例句组和例句组的组合规则生成的,因此训练得到的关键词提取模型和意图识别模型更能准确的提取关键词并进行意图归类,从而使得本实施例中生成的答案也能更准确。
与上述本申请一种问句答案的生成方法实施例3所提供的方法相对应,参见图11,本申请还提供了一种问句答案的生成装置实施例3,在本实施例中,该生成装置可以集成于服务器端,例如问答引擎等,本实施例可以生成单轮对话形式中关于用户的问句的答案,该生成装置中的意图确定单元902可以包括:
第二模型处理子单元1101,用于至少将所述词标注结果作为所述预先训练的意图识别模型的输入,得到多个候选意图及其对应的可信度。
第六确定子单元1102,用于将所述多个候选意图中可信度最高的候选意图确定为当前意图。
第三判断子单元1103,用于判断所述当前意图的可信度是否大于预设可信度阈值。
第七确定子单元1104,用于在所述第三判断子单元的结果为大于的情况下,将所述当前意图确定为所述目标意图。
选取子单元1105,用于在所述第三判断子单元的结果为否的情况下,选取预设个数的前若干个候选意图作为待选择意图。
发送子单元1106,用于将所述待选择意图发送至终端以供用户选择。
第八确定子单元1107,用于将所述终端返回的、用户选择的意图确定为目标意图。
第四判断子单元1108,用于依据所述目标意图对应的目标意图模板,判断所述词标注结果中各关键词是否完整。
第九确定子单元1109,用于在所述第四判断子单元的结果为否的情况下,将不完整的关键词对应的意图参数确定为缺少的意图参数。
问题生成子单元1110,用于依据所述缺少的意图参数和所述目标意图模板,生成所述目标意图相关的参数问题。
问题返回子单元1111,用于将所述参数问题返回给客户端以便显示给用户;所述意图模板包括:所述意图参数和参数问题之间的对应关系。
参数获取子单元1112,用于根据所述客户端返回的、用户输入的参数答案获取所述缺少的意图参数。
其中,所述意图确定单元902还可以包括:
保存子单元,用于将用户输入的对话内容保存至会话数据库中,所述对话内容包括:用户选择的意图和/或用户输入的参数答案。
其中,所述意图确定单元902还可以包括:
更新子单元,用于对所述会话数据库中的对话内容进行更新,或者,删除子单元,用于在到达预设的时间周期的时候,将用户输入的对话内容进行删除。
其中,所述第二模型处理子单元1101具体可以包括:
对话获取子单元,从会话数据库中获取所述对话内容;以及,输入子单元,用于将所述词标注结果和所述对话内容输入预先训练的意图识别模型的,得到多个候选意图及其对应的可信度。
其中,所述第四判断子单元1108具体可以包括:
参数获取子单元,用于获取所述目标意图模板中配置的全部意图参数;以及,赋值子单元,用于采用所述词标注结果中的各关键词的词类型,为所述目标意图模板中的全部意图参数进行赋值,赋值判断子单元,用于判断所述全部意图参数是否能赋值成功。
采用本实施例中的生成装置,不仅会将用户最开始提问的问句作为关键词提取模型或意识识别模型的输入,还会在无法确定用户的意图或者能确定用户的意图可是意图参数不完整的情况下,向用户继续提问以便用户能够根据问题来选择自己的意图或者补充意图参数。因此,本实施例经过合理的推理就有可能能够明确用户的意图及获取到完整的意图参数,从而实现与用户对话并且根据对话内容能够自动生成用户所需的答案,不仅提高了答案生成的准确率,还能使得生成的答案更符合用户的习惯,与用户的对话交互也非常友好,用户不需要去学习一种专门的交互方式,直接通过日常生活中的对话的方式就可以与服务器例如问答引擎交流。
需要说明的是,本说明书中的各个实施例均采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似的部分互相参见即可。对于装置类实施例而言,由于其与方法实施例基本相似,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在 另外的相同要素。
以上对本申请所提供的一种自然语言问句答案的生成方法、装置和服务器进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。

Claims (22)

  1. 一种自然语言问句答案的生成方法,其特征在于,该方法包括:
    响应于触发问句,至少依据预先训练的关键词提取模型对所述问句进行标注得到词标注结果,所述词标注结果包括:所述问句的各分词是否为关键词以及各关键词的词类型;
    依据所述词标注结果和预先训练的意图识别模型,确定所述问句的目标意图;
    依据预先配置的、与所述目标意图对应的目标意图模板,获取所述目标意图对应的目标答案。
  2. 根据权利要求1所述的方法,其特征在于,所述响应于触发问句,至少依据预先训练的关键词提取模型对所述问句进行标注得到词标注结果,包括:
    对所述问句进行分词,得到所述问句的分词集合;
    基于所述问句所属的领域对应的领域词典,对所述分词集合中的各分词进行关键词标记得到第一标记结果;以及,基于预先训练的关键词提取模型,对所述分词集合中的各分词进行关键词标记得到第二标记结果;所述领域词典用于保存各领域词及其对应的词类型之间的对应关系;
    依据所述第一标记结果和第二标记结果,确定所述分词集合中的各分词的词标注结果。
  3. 根据权利要求2所述的方法,其特征在于,所述依据所述第一标记结果和第二标记结果,确定所述分词集合中的各分词的词标注结果,包括:
    针对分词集合中的各分词,判断所述第一标记结果和第二标记结果是否都标注为关键词,如果是,则将该分词确定为关键词,并依据所述第一标记结果或第二标记结果确定所述关键词的词类型;
    如果第一标记结果标注为关键词而第二标记结果标注为非关键词,则将该分词确定为非关键词。
  4. 根据权利要求2所述的方法,其特征在于,所述领域词典通过以下方式生成:
    获取领域内各实体的各属性;
    将所述各属性对应的属性值作为关键词,并将实体标签和属性名作为关键词的词类型,以及,将所述关键词的关联词汇也确定为关键词,所述关联词汇包括:同义词、近义词、口语表达词和别名。
  5. 根据权利要求1所述的方法,其特征在于,所述依据所述词标注结果和预先训 练的意图识别模型,确定所述问句的目标意图,包括:
    将所述词标注结果作为所述预先训练的意图识别模型的输入,得到多个候选意图及对应的可信度;
    将所述多个候选意图中可信度最高的候选意图确定为当前意图;
    依据所述当前意图对应的当前意图模板,判断所述词标注结果中各关键词是否完整;所述意图模板包括:确定一意图所需要的全部意图参数;
    如果完整,则将所述当前意图确定为目标意图;
    如果不完整,则按照可信度从高到底的顺序选择下一个候选意图作为当前意图,并执行所述依据所述当前意图对应的当前意图模板,判断所述词标注结果中各关键词是否完整的步骤,直至所述多个候选意图都选择完毕。
  6. 根据权利要求5所述的方法,其特征在于,所述依据所述当前意图对应的当前意图模板,判断所述词标注结果中各关键词是否完整,包括:
    获取所述当前意图模板中配置的全部意图参数;
    采用所述词标注结果中的各关键词的词类型,为所述全部意图参数进行赋值,并判断所述全部意图参数是否能赋值成功。
  7. 根据权利要求1所述的方法,其特征在于,所述依据所述词标注结果和预先训练的意图识别模型,确定所述问句的目标意图,包括:
    至少将所述词标注结果作为所述预先训练的意图识别模型的输入,得到多个候选意图及其对应的可信度;
    将所述多个候选意图中可信度最高的候选意图确定为当前意图;
    判断所述当前意图的可信度是否大于预设可信度阈值,如果大于,则将所述当前意图确定为所述目标意图;
    如果不大于,则选取预设个数的前若干个候选意图作为待选择意图,并将所述待选择意图发送至终端以供用户选择,以及,将所述终端返回的、用户选择的意图确定为目标意图;
    依据所述目标意图对应的目标意图模板,判断所述词标注结果中各关键词是否完整,如果不完整,则将不完整的关键词对应的意图参数确定为缺少的意图参数;依据所述缺少的意图参数和所述目标意图模板,生成所述目标意图相关的参数问题;将所述参数问题返回给客户端以便显示给用户;所述意图模板包括:所述意图参数和参数问题之间的对应关系;
    根据所述客户端返回的、用户输入的参数答案获取所述缺少的意图参数。
  8. 根据权利要求7所述的方法,其特征在于,还包括:
    将用户输入的对话内容保存至会话数据库中,所述对话内容包括:用户选择的意图和/或用户输入的参数答案。
  9. 根据权利要求8所述的方法,其特征在于,还包括:
    对所述会话数据库中的对话内容进行更新,
    或者,在到达预设的时间周期的时候,将用户输入的对话内容进行删除。
  10. 根据权利要求8所述的方法,其特征在于,所述至少将所述词标注结果作为所述预先训练的意图识别模型的输入,得到多个候选意图及其对应的可信度,包括:
    从会话数据库中获取所述对话内容;
    将所述词标注结果和所述对话内容输入预先训练的意图识别模型的,得到多个候选意图及其对应的可信度。
  11. 根据权利要求7所述的方法,其特征在于,所述依据所述目标意图对应的目标意图模板,判断所述词标注结果中各关键词是否完整,包括:
    获取所述目标意图模板中配置的全部意图参数;
    采用所述词标注结果中的各关键词的词类型,为所述目标意图模板中的全部意图参数进行赋值,并判断所述全部意图参数是否能赋值成功。
  12. 根据权利要求1所述的方法,其特征在于,所述意图模板通过以下方式生成:
    依据领域内各本体所表示出的各实体之间的关系,确定各领域内所有问句的意图;所述意图用于表述问句的询问目的,所述意图包括:询问实体的属性,询问实体之间的所有关系,通过实体的一个或多个属性询问该实体的其他属性或所有属性,和/或,通过实体的一个或多个属性询问该实体的关系;
    为确定的各意图配置对应的意图模板,所述意图模板包括:模板标识,模板描述,意图参数及意图参数对应的参数问题,意图对应的例句组,以及,各例句组的组合规则;所述模板标识用于唯一表示一个意图模板,所述模板描述用于描述所述意图模板的目的;所述意图参数为确定一个意图所对应的参数,所述参数问题为:对应的意图参数缺失时需要向用户发送的问题,所述例句组中的例句包括实体的变量名,用于表示所述意图模板能解决的问题,所述各例句组的组合规则用于表示:不同例句组中的例句的组合方式。
  13. 根据权利要求12所述的方法,其特征在于,所述意图识别模型和关键词提取 模型通过以下方式训练:
    依据所述意图模板中配置的例句组和例句组合规则,生成训练语料;
    依据所述训练语料采用机器学习算法,训练得到意图分类模型和关键词提取模型。
  14. 根据权利要求13所述的方法,其特征在于,所述依据所述意图模板中配置的例句组和例句组合规则,生成训练语料,包括:
    获取实体的变量值列表,所述变量值列表包括:实体的变量名、实体的变量值及两者的对应关系;
    依据意图模板中配置的例句组和例句组的组合规则,生成包括实体的变量名的变量例句;
    将所述变量值列表中各实体的变量值,分别对应替换所述变量例句中的变量名,得到真实例句;
    对所述真实例句进行标记,得到训练语料;所述训练语料包括:所述真实例句对应的模板标识和所述真实例句中包括的各关键词及其类型。
  15. 根据权利要求1所述的方法,其特征在于,依据预先配置的、与所述目标意图对应的目标意图模板,获取所述目标意图对应的目标答案,包括:
    依据目标意图模板中配置的意图参数,为所述意图参数赋值,得到查询参数;
    依据所述查询参数获取所述目标答案的源数据;
    对所述源数据按照预设处理方式进行处理得到处理后的源数据;
    依据所述处理后的源数据生成所述目标答案。
  16. 一种自然语言问句答案的生成装置,其特征在于,该生成装置集成于服务器上,该生成装置包括:
    关键词标注单元,用于响应于触发问句,至少依据预先训练的关键词提取模型对所述问句进行标注得到词标注结果,所述词标注结果包括:所述问句的各分词是否为关键词以及各关键词的词类型;
    意图确定单元,用于依据所述词标注结果和预先训练的意图识别模型,确定所述问句的目标意图;
    答案获取单元,用于依据预先配置的、与所述目标意图对应的目标意图模板,获取所述目标意图对应的目标答案。
  17. 根据权利要求16所述的装置,其特征在于,所述关键词标注单元包括:
    分词子单元,用于对所述问句进行分词,得到所述问句的分词集合;
    第一标记子单元,用于基于所述问句所属的领域对应的领域词典,对所述分词集合中的各分词进行关键词标记得到第一标记结果;
    第二标记子单元,用于基于预先训练的关键词提取模型,对所述分词集合中的各分词进行关键词标记得到第二标记结果;所述领域词典用于保存各领域词及其对应的词类型之间的对应关系;
    第一确定子单元,用于依据所述第一标记结果和第二标记结果,确定所述分词集合中的各分词的词标注结果。
  18. 根据权利要求17所述的装置,其特征在于,所述第一确定子单元包括:
    第一判断子单元,用于针对分词集合中的各分词,判断所述第一标记结果和第二标记结果是否都标注为关键词;
    第二确定子单元,用于在所述第一判断子单元的如果为是的情况下,将该分词确定为关键词,并依据所述第一标记结果或第二标记结果确定所述关键词的词类型;
    第三确定子单元,用于在所述第一判断子单元的结果为第一标记结果标注为关键词而第二标记结果标注为非关键词的情况下,将该分词确定为非关键词。
  19. 根据权利要求16所述的装置,其特征在于,所述意图确定单元包括:
    第一模型处理子单元,用于将所述词标注结果作为所述预先训练的意图识别模型的输入,得到多个候选意图及对应的可信度;
    第四确定子单元,用于将所述多个候选意图中可信度最高的候选意图确定为当前意图;
    第二判断子单元,用于依据所述当前意图对应的当前意图模板,判断所述词标注结果中各关键词是否完整;所述意图模板包括:确定一意图所需要的全部意图参数;
    第五确定子单元,用于在所述第二判断子单元的结果为是的情况下,将所述当前意图确定为目标意图;
    选择子单元,用于在所述第二判断子单元的结果为否的情况下,按照可信度从高到底的顺序选择下一个候选意图作为当前意图;
    触发子单元,用于在选择子单元选择下一个候选意图之后,触发所述的第二判断子单元,直至所述多个候选意图都选择完毕。
  20. 根据权利要求16所述的装置,其特征在于,所述意图确定单元包括:
    第二模型处理子单元,用于至少将所述词标注结果作为所述预先训练的意图识别模型的输入,得到多个候选意图及其对应的可信度;
    第六确定子单元,用于将所述多个候选意图中可信度最高的候选意图确定为当前意图;
    第三判断子单元,用于判断所述当前意图的可信度是否大于预设可信度阈值;
    第七确定子单元,用于在所述第三判断子单元的结果为大于的情况下,将所述当前意图确定为所述目标意图;
    选取子单元,用于在所述第三判断子单元的结果为否的情况下,选取预设个数的前若干个候选意图作为待选择意图;
    发送子单元,用于将所述待选择意图发送至终端以供用户选择;
    第八确定子单元,用于将所述终端返回的、用户选择的意图确定为目标意图;
    第四判断子单元,用于依据所述目标意图对应的目标意图模板,判断所述词标注结果中各关键词是否完整;
    第九确定子单元,用于在所述第四判断子单元的结果为否的情况下,将不完整的关键词对应的意图参数确定为缺少的意图参数;
    问题生成子单元,用于依据所述缺少的意图参数和所述目标意图模板,生成所述目标意图相关的参数问题;
    问题返回子单元,用于将所述参数问题返回给客户端以便显示给用户;所述意图模板包括:所述意图参数和参数问题之间的对应关系;
    参数获取子单元,用于根据所述客户端返回的、用户输入的参数答案获取所述缺少的意图参数。
  21. 根据权利要求16所述的装置,其特征在于,所述答案获取单元包括:
    赋值子单元,用于依据目标意图模板中配置的意图参数,为所述意图参数赋值,得到查询参数;
    源数据获取子单元,用于依据所述查询参数获取所述目标答案的源数据;
    处理子单元,用于对所述源数据按照预设处理方式进行处理得到处理后的源数据;
    生成子单元,用于依据所述处理后的源数据生成所述目标答案。
  22. 一种服务器,其特征在于,所述服务器包括:权利要求16~21任意一项所述的装置。
PCT/CN2018/075410 2017-02-16 2018-02-06 一种自然语言问句答案的生成方法、装置及服务器 WO2018149326A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710084397.0 2017-02-16
CN201710084397.0A CN108446286B (zh) 2017-02-16 2017-02-16 一种自然语言问句答案的生成方法、装置及服务器

Publications (1)

Publication Number Publication Date
WO2018149326A1 true WO2018149326A1 (zh) 2018-08-23

Family

ID=63169712

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/075410 WO2018149326A1 (zh) 2017-02-16 2018-02-06 一种自然语言问句答案的生成方法、装置及服务器

Country Status (3)

Country Link
CN (1) CN108446286B (zh)
TW (1) TWI746690B (zh)
WO (1) WO2018149326A1 (zh)

Cited By (73)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109145104A (zh) * 2018-09-29 2019-01-04 北京百度网讯科技有限公司 用于对话交互的方法和装置
CN109408051A (zh) * 2018-12-03 2019-03-01 福建省天奕网络科技有限公司 一种识别安卓游戏应用开发引擎的方法及终端
CN109658114A (zh) * 2018-12-21 2019-04-19 万达信息股份有限公司 大型语料库的高效智能客服方法
CN109741824A (zh) * 2018-12-21 2019-05-10 质直(上海)教育科技有限公司 一种基于机器学习的医疗问诊方法
CN109829038A (zh) * 2018-12-11 2019-05-31 平安科技(深圳)有限公司 基于深度学习的问答反馈方法、装置、设备及存储介质
CN109858528A (zh) * 2019-01-10 2019-06-07 平安科技(深圳)有限公司 推荐系统训练方法、装置、计算机设备及存储介质
CN109871543A (zh) * 2019-03-12 2019-06-11 广东小天才科技有限公司 一种意图获取方法及系统
CN110032623A (zh) * 2018-12-12 2019-07-19 阿里巴巴集团控股有限公司 用户问句与知识点标题的匹配方法和装置
CN110110048A (zh) * 2019-05-10 2019-08-09 科大讯飞股份有限公司 问询指引方法及装置
CN110209790A (zh) * 2019-06-06 2019-09-06 阿里巴巴集团控股有限公司 问答匹配方法和装置
CN110390006A (zh) * 2019-07-23 2019-10-29 腾讯科技(深圳)有限公司 问答语料生成方法、装置和计算机可读存储介质
CN110399473A (zh) * 2019-06-28 2019-11-01 阿里巴巴集团控股有限公司 为用户问题确定答案的方法和装置
CN110413746A (zh) * 2019-06-25 2019-11-05 阿里巴巴集团控股有限公司 对用户问题进行意图识别的方法及装置
CN110442689A (zh) * 2019-06-25 2019-11-12 平安科技(深圳)有限公司 一种问答关系排序方法、装置、计算机设备及存储介质
CN110502608A (zh) * 2019-07-05 2019-11-26 平安科技(深圳)有限公司 基于知识图谱的人机对话方法及人机对话装置
CN110532397A (zh) * 2019-07-19 2019-12-03 平安科技(深圳)有限公司 基于人工智能的问答方法、装置、计算机设备及存储介质
CN110674273A (zh) * 2019-09-17 2020-01-10 安徽信息工程学院 一种分词的智能问答机器人训练方法
CN110750998A (zh) * 2019-10-14 2020-02-04 腾讯科技(深圳)有限公司 一种文本输出方法、装置、计算机设备和存储介质
CN110795528A (zh) * 2019-09-05 2020-02-14 腾讯科技(深圳)有限公司 一种数据查询方法、装置、电子设备及存储介质
CN110795482A (zh) * 2019-10-16 2020-02-14 浙江大华技术股份有限公司 数据对标方法、装置、及存储装置
CN110866099A (zh) * 2019-10-30 2020-03-06 南昌众荟智盈信息技术有限公司 一种基于智能音箱语音交互的智能管家服务方法及系统
CN110874399A (zh) * 2018-08-31 2020-03-10 阿里巴巴集团控股有限公司 信息处理方法、装置、计算设备及终端
WO2020062006A1 (en) * 2018-09-28 2020-04-02 Entit Software Llc Intent and context-aware dialogue based virtual assistance
CN111104505A (zh) * 2019-12-30 2020-05-05 浙江阿尔法人力资源有限公司 信息提示方法、装置、设备和存储介质
CN111159330A (zh) * 2018-11-06 2020-05-15 阿里巴巴集团控股有限公司 一种数据库查询语句的生成方法及装置
CN111177339A (zh) * 2019-12-06 2020-05-19 百度在线网络技术(北京)有限公司 对话生成方法、装置、电子设备及存储介质
CN111178081A (zh) * 2018-11-09 2020-05-19 中移(杭州)信息技术有限公司 语义识别的方法、服务器、电子设备及计算机存储介质
CN111241249A (zh) * 2020-01-21 2020-06-05 苏宁云计算有限公司 人机对话方法、装置、计算机设备和存储介质
CN111309889A (zh) * 2020-02-27 2020-06-19 支付宝(杭州)信息技术有限公司 用于文本处理的方法和装置
CN111309306A (zh) * 2020-02-24 2020-06-19 福建天晴数码有限公司 人机交互的对话管理系统
CN111324712A (zh) * 2020-02-18 2020-06-23 山东汇贸电子口岸有限公司 对话回复方法及服务端
CN111368045A (zh) * 2020-02-21 2020-07-03 平安科技(深圳)有限公司 用户意图识别方法、装置、设备及计算机可读存储介质
CN111428123A (zh) * 2019-01-09 2020-07-17 阿里巴巴集团控股有限公司 查询方法和装置
CN111563140A (zh) * 2019-01-25 2020-08-21 阿里巴巴集团控股有限公司 一种意图识别方法及装置
CN111651600A (zh) * 2020-06-02 2020-09-11 携程计算机技术(上海)有限公司 语句多意图识别方法、系统、电子设备及存储介质
CN111724909A (zh) * 2020-06-28 2020-09-29 北京来也网络科技有限公司 一种结合rpa和ai的疫情排查方法和装置
CN111737401A (zh) * 2020-06-22 2020-10-02 首都师范大学 一种基于Seq2set2seq框架的关键词组预测方法
CN111783440A (zh) * 2020-07-02 2020-10-16 北京字节跳动网络技术有限公司 意图识别方法、装置、可读介质及电子设备
CN111814481A (zh) * 2020-08-24 2020-10-23 深圳市欢太科技有限公司 购物意图识别方法、装置、终端设备及存储介质
CN111859951A (zh) * 2020-06-19 2020-10-30 北京百度网讯科技有限公司 语言模型的训练方法、装置、电子设备及可读存储介质
CN111881294A (zh) * 2020-07-30 2020-11-03 本识科技(深圳)有限公司 一种语料标注系统、方法及存储介质
CN111881266A (zh) * 2019-07-19 2020-11-03 马上消费金融股份有限公司 一种应答方法及装置
CN112035647A (zh) * 2020-09-02 2020-12-04 中国平安人寿保险股份有限公司 一种基于人机交互的问答方法、装置、设备及介质
CN112052311A (zh) * 2019-05-20 2020-12-08 天津科技大学 一种基于词向量技术和知识图谱检索的短文本问答方法及装置
CN112270182A (zh) * 2020-11-12 2021-01-26 佰聆数据股份有限公司 一种基于多轮对话问答式的分析思路衍生方法、系统及存储介质
CN112287079A (zh) * 2019-12-09 2021-01-29 北京来也网络科技有限公司 结合rpa和ai的问答对获取方法、装置、介质及电子设备
CN112289398A (zh) * 2020-08-17 2021-01-29 上海柯林布瑞信息技术有限公司 病理报告解析方法及装置、存储介质、终端
CN112328871A (zh) * 2020-10-27 2021-02-05 深圳集智数字科技有限公司 一种基于rpa模块的回复生成方法、装置、设备及存储介质
CN112347760A (zh) * 2020-11-16 2021-02-09 北京京东尚科信息技术有限公司 意图识别模型的训练方法及装置、意图识别方法及装置
CN112347776A (zh) * 2019-08-09 2021-02-09 金色熊猫有限公司 医疗数据处理方法及装置、存储介质、电子设备
CN112417110A (zh) * 2020-10-27 2021-02-26 联想(北京)有限公司 一种信息处理方法及装置
CN112528002A (zh) * 2020-12-23 2021-03-19 北京百度网讯科技有限公司 对话识别方法、装置、电子设备和存储介质
CN112580298A (zh) * 2019-09-29 2021-03-30 大众问问(北京)信息科技有限公司 一种标注数据获取方法、装置及设备
CN112685546A (zh) * 2020-12-29 2021-04-20 平安普惠企业管理有限公司 人机多轮对话方法、装置及计算机可读存储介质
CN112765310A (zh) * 2020-12-11 2021-05-07 北京航天云路有限公司 一种基于深度学习与相似度匹配的知识图谱问答的方法
CN112818096A (zh) * 2021-01-26 2021-05-18 广州三星通信技术研究有限公司 对话生成方法及其装置
CN112860913A (zh) * 2021-02-24 2021-05-28 广州汇通国信科技有限公司 一种知识图谱的本体创建方法
CN112988986A (zh) * 2019-12-02 2021-06-18 阿里巴巴集团控股有限公司 人机交互方法、装置与设备
CN113139615A (zh) * 2021-05-08 2021-07-20 北京联合大学 一种基于嵌入式设备的无人驾驶环境目标检测方法
CN113139044A (zh) * 2021-05-10 2021-07-20 中国电子科技集团公司第二十八研究所 一种用于问答系统的支持多意图切换的问答多轮对话方法
CN113221555A (zh) * 2021-05-07 2021-08-06 支付宝(杭州)信息技术有限公司 一种基于多任务模型的关键词识别方法、装置及设备
CN113282734A (zh) * 2021-06-28 2021-08-20 中国平安人寿保险股份有限公司 基于结构化数据的问答处理方法、装置、设备及介质
CN113283666A (zh) * 2021-06-10 2021-08-20 中国人民解放军国防科技大学 一种卫星群的启发式智能任务推理与决策方法
CN113282729A (zh) * 2021-06-07 2021-08-20 北京金山数字娱乐科技有限公司 基于知识图谱的问答方法及装置
WO2021174783A1 (zh) * 2020-03-02 2021-09-10 平安科技(深圳)有限公司 近义词推送方法、装置、电子设备及介质
CN113486151A (zh) * 2021-07-13 2021-10-08 盛景智能科技(嘉兴)有限公司 故障维修知识点查询方法、装置、电子设备和存储介质
CN113569578A (zh) * 2021-08-13 2021-10-29 上海淇玥信息技术有限公司 一种用户意图识别方法、装置和计算机设备
CN113609248A (zh) * 2021-08-20 2021-11-05 北京金山数字娱乐科技有限公司 词权重生成模型训练方法及装置、词权重生成方法及装置
CN113761139A (zh) * 2020-08-10 2021-12-07 北京沃东天骏信息技术有限公司 一种意图预判的方法和装置
CN115132178A (zh) * 2022-07-15 2022-09-30 科讯嘉联信息技术有限公司 一种基于深度学习的语义端点检测系统
CN116737910A (zh) * 2023-08-10 2023-09-12 腾讯科技(深圳)有限公司 智能对话处理方法、装置、设备及存储介质
CN117708337A (zh) * 2024-02-05 2024-03-15 杭州杰竞科技有限公司 一种面向复杂定域的人机交互方法和系统
CN109858528B (zh) * 2019-01-10 2024-05-14 平安科技(深圳)有限公司 推荐系统训练方法、装置、计算机设备及存储介质

Families Citing this family (69)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109376847A (zh) * 2018-08-31 2019-02-22 深圳壹账通智能科技有限公司 用户意图识别方法、装置、终端及计算机可读存储介质
CN109344234A (zh) * 2018-09-06 2019-02-15 和美(深圳)信息技术股份有限公司 机器阅读理解方法、装置、计算机设备和存储介质
CN109213846A (zh) * 2018-09-13 2019-01-15 山西卫生健康职业学院 一种自然语言处理系统
CN109344238A (zh) * 2018-09-18 2019-02-15 阿里巴巴集团控股有限公司 用户问句的补词方法和装置
CN109522393A (zh) * 2018-10-11 2019-03-26 平安科技(深圳)有限公司 智能问答方法、装置、计算机设备和存储介质
CN109446306A (zh) * 2018-10-16 2019-03-08 浪潮软件股份有限公司 一种基于任务驱动的多轮对话的智能问答方法
CN109783621B (zh) * 2018-12-17 2021-10-08 北京百度网讯科技有限公司 对话生成方法、装置及设备
CN111353026A (zh) * 2018-12-21 2020-06-30 沈阳新松机器人自动化股份有限公司 一种智能法务律师助手客服系统
WO2020132985A1 (zh) * 2018-12-26 2020-07-02 深圳市优必选科技有限公司 模型的自训练方法、装置、计算机设备及存储介质
CN109727598A (zh) * 2018-12-28 2019-05-07 浙江省公众信息产业有限公司 大噪音语境下的意图识别方法
CN109753658B (zh) * 2018-12-29 2023-09-19 百度在线网络技术(北京)有限公司 交互方法和装置
CN111459977B (zh) * 2019-01-18 2023-10-24 微软技术许可有限责任公司 自然语言查询的转换
CN109800296B (zh) * 2019-01-21 2022-03-01 四川长虹电器股份有限公司 一种基于用户真实意图的语意模糊识别方法
CN109783510A (zh) * 2019-01-22 2019-05-21 深圳追一科技有限公司 客服辅助机器人、方法及系统
CN110019753B (zh) * 2019-01-24 2023-06-20 创新先进技术有限公司 针对用户问句输出反问问句的方法和装置
CN109885652A (zh) * 2019-01-25 2019-06-14 北京奇艺世纪科技有限公司 一种操作执行方法、装置及计算机可读存储介质
CN111563208B (zh) * 2019-01-29 2023-06-30 株式会社理光 一种意图识别的方法、装置及计算机可读存储介质
CN109840276A (zh) * 2019-02-12 2019-06-04 北京健康有益科技有限公司 基于文本意图识别的智能对话方法、装置和存储介质
CN109947916B (zh) * 2019-03-01 2023-08-08 河北尚云信息科技有限公司 基于气象领域知识图谱的问答系统装置及问答方法
CN109871128B (zh) * 2019-03-13 2022-07-01 广东小天才科技有限公司 一种题型识别方法及装置
CN109960811B (zh) * 2019-03-29 2024-04-26 联想(北京)有限公司 一种数据处理方法、装置及电子设备
CN109977317B (zh) * 2019-04-03 2021-04-27 恒生电子股份有限公司 数据查询方法及装置
CN110083685B (zh) * 2019-04-26 2021-05-04 北京零秒科技有限公司 用于意图识别的数据配置方法及装置
CN110222049A (zh) * 2019-05-07 2019-09-10 北京来也网络科技有限公司 基于多轮对话的数据处理方法及装置
CN110147551B (zh) * 2019-05-14 2023-07-11 腾讯科技(深圳)有限公司 多类别实体识别模型训练、实体识别方法、服务器及终端
CN112000798A (zh) * 2019-05-27 2020-11-27 广东小天才科技有限公司 一种语文题型的答案获取方法及装置
CN110175223A (zh) * 2019-05-29 2019-08-27 北京搜狗科技发展有限公司 一种实现问题生成的方法及装置
CN110287209A (zh) * 2019-06-10 2019-09-27 北京百度网讯科技有限公司 问答处理方法、装置、设备和存储介质
CN110427467B (zh) * 2019-06-26 2022-10-11 深圳追一科技有限公司 问答处理方法、装置、计算机设备和存储介质
WO2021008015A1 (zh) * 2019-07-18 2021-01-21 平安科技(深圳)有限公司 意图识别方法、设备及计算机可读存储介质
CN110598028B (zh) * 2019-09-06 2023-10-20 创新先进技术有限公司 图像分类方法、装置及存储介质、电子设备
CN110704641B (zh) * 2019-10-11 2023-04-07 零犀(北京)科技有限公司 一种万级意图分类方法、装置、存储介质及电子设备
CN110717027B (zh) * 2019-10-18 2022-07-12 易小博(武汉)科技有限公司 多轮智能问答方法、系统以及控制器和介质
CN111107156A (zh) * 2019-12-26 2020-05-05 苏州思必驰信息科技有限公司 用于主动发起对话的服务端处理方法及服务器、能够主动发起对话的语音交互系统
CN111222323B (zh) * 2019-12-30 2024-05-03 深圳市优必选科技股份有限公司 一种词槽抽取方法、词槽抽取装置及电子设备
CN111324708A (zh) * 2020-02-07 2020-06-23 普强时代(珠海横琴)信息技术有限公司 一种基于人机交互的自然语言处理系统
WO2021168650A1 (zh) * 2020-02-25 2021-09-02 京东方科技集团股份有限公司 一种问题查询装置、方法、设备及存储介质
CN111400495A (zh) * 2020-03-17 2020-07-10 重庆邮电大学 一种基于模板特征的视频弹幕消费意图识别方法
CN111460124B (zh) * 2020-04-21 2023-08-25 文思海辉智科科技有限公司 智能交互方法、装置及机器人
CN113488035A (zh) * 2020-04-28 2021-10-08 海信集团有限公司 一种语音信息的处理方法、装置、设备及介质
CN111553162B (zh) * 2020-04-28 2023-09-22 腾讯科技(深圳)有限公司 一种意图识别的方法以及相关装置
CN111708800A (zh) * 2020-05-27 2020-09-25 北京百度网讯科技有限公司 查询方法、装置及电子设备
CN111708873B (zh) * 2020-06-15 2023-11-24 腾讯科技(深圳)有限公司 智能问答方法、装置、计算机设备和存储介质
CN111723559B (zh) * 2020-06-19 2023-06-23 思必驰科技股份有限公司 一种实时信息抽取方法及装置
CN111737990B (zh) * 2020-06-24 2023-05-23 深圳前海微众银行股份有限公司 一种词槽填充方法、装置、设备及存储介质
CN111966781B (zh) * 2020-06-28 2024-02-20 北京百度网讯科技有限公司 数据查询的交互方法及装置、电子设备和存储介质
CN111767381A (zh) * 2020-06-30 2020-10-13 北京百度网讯科技有限公司 自动问答方法和装置
CN111506723B (zh) * 2020-07-01 2020-11-13 平安国际智慧城市科技股份有限公司 问答响应方法、装置、设备及存储介质
CN111767384A (zh) * 2020-07-08 2020-10-13 上海风秩科技有限公司 人机对话的处理方法、装置、设备及存储介质
CN111738008B (zh) * 2020-07-20 2021-04-27 深圳赛安特技术服务有限公司 基于多层模型的实体识别方法、装置、设备及存储介质
CN113742462A (zh) * 2020-07-20 2021-12-03 北京沃东天骏信息技术有限公司 一种答案监控方法和装置
CN112000787B (zh) * 2020-08-17 2021-05-14 上海小鹏汽车科技有限公司 语音交互方法、服务器和语音交互系统
CN112035645A (zh) * 2020-09-01 2020-12-04 平安科技(深圳)有限公司 数据查询方法以及系统
CN112328758A (zh) * 2020-10-27 2021-02-05 创泽智能机器人集团股份有限公司 一种会话意图识别方法、装置、设备及存储介质
CN112328762B (zh) * 2020-11-04 2023-12-19 平安科技(深圳)有限公司 基于文本生成模型的问答语料生成方法和装置
CN112507089A (zh) * 2020-11-25 2021-03-16 厦门渊亭信息科技有限公司 一种基于知识图谱的智能问答引擎及其实现方法
CN112541739B (zh) * 2020-12-15 2022-04-15 平安科技(深圳)有限公司 问答意图分类模型的测试方法、装置、设备及介质
CN112559715B (zh) * 2020-12-24 2023-09-22 北京百度网讯科技有限公司 态度的识别方法、装置、设备及存储介质
CN112784030B (zh) * 2021-01-28 2022-08-26 北京三快在线科技有限公司 一种生成样本的方法、装置、存储介质及电子设备
CN112989003B (zh) * 2021-04-01 2023-04-18 网易(杭州)网络有限公司 意图识别方法、装置、处理设备及介质
CN113157893B (zh) * 2021-05-25 2023-12-15 网易(杭州)网络有限公司 多轮对话中意图识别的方法、介质、装置和计算设备
CN113641803B (zh) * 2021-06-30 2023-06-06 腾讯科技(深圳)有限公司 一种数据处理方法、装置、设备及存储介质
CN113360779B (zh) * 2021-08-09 2023-01-20 智者四海(北京)技术有限公司 内容推荐方法及装置、计算机设备及可读介质
US20230135625A1 (en) * 2021-10-28 2023-05-04 International Business Machines Corporation Automated generation of dialogue flow from documents
CN113901793A (zh) * 2021-12-08 2022-01-07 北京来也网络科技有限公司 结合rpa和ai的事件抽取方法及装置
CN114490975B (zh) * 2021-12-31 2023-02-07 马上消费金融股份有限公司 用户问题的标注方法及装置
CN114595321A (zh) * 2022-03-23 2022-06-07 康键信息技术(深圳)有限公司 问题标注方法、装置、电子设备及存储介质
CN115292457A (zh) * 2022-06-30 2022-11-04 腾讯科技(深圳)有限公司 知识问答方法、装置、计算机可读介质及电子设备
CN116842168B (zh) * 2023-08-30 2023-11-14 汉王科技股份有限公司 跨领域问题处理方法、装置、电子设备及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103810218A (zh) * 2012-11-14 2014-05-21 北京百度网讯科技有限公司 一种基于问题簇的自动问答方法和装置
CN105096942A (zh) * 2014-05-21 2015-11-25 清华大学 语义分析方法和装置
CN105354300A (zh) * 2015-11-05 2016-02-24 上海智臻智能网络科技股份有限公司 一种信息推荐方法及装置
US20160210962A1 (en) * 2015-01-19 2016-07-21 Ncsoft Corporation Methods and systems for analyzing communication situation based on dialogue act information

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040167875A1 (en) * 2003-02-20 2004-08-26 Eriks Sneiders Information processing method and system
TWI269192B (en) * 2003-08-11 2006-12-21 Univ Nat Cheng Kung Semantic emotion classifying system
CN1741013A (zh) * 2004-08-27 2006-03-01 英业达股份有限公司 一种客户服务自动答疑系统及其方法
US10019484B2 (en) * 2013-07-17 2018-07-10 Google Llc Third party search applications for a search system
KR101678787B1 (ko) * 2015-07-15 2016-12-06 포항공과대학교 산학협력단 자동질의응답 방법 및 그 장치
CN105389307A (zh) * 2015-12-02 2016-03-09 上海智臻智能网络科技股份有限公司 语句意图类别识别方法及装置
CN105701253B (zh) * 2016-03-04 2019-03-26 南京大学 中文自然语言问句语义化的知识库自动问答方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103810218A (zh) * 2012-11-14 2014-05-21 北京百度网讯科技有限公司 一种基于问题簇的自动问答方法和装置
CN105096942A (zh) * 2014-05-21 2015-11-25 清华大学 语义分析方法和装置
US20160210962A1 (en) * 2015-01-19 2016-07-21 Ncsoft Corporation Methods and systems for analyzing communication situation based on dialogue act information
CN105354300A (zh) * 2015-11-05 2016-02-24 上海智臻智能网络科技股份有限公司 一种信息推荐方法及装置

Cited By (111)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110874399B (zh) * 2018-08-31 2023-11-10 阿里巴巴集团控股有限公司 信息处理方法、装置、计算设备及终端
CN110874399A (zh) * 2018-08-31 2020-03-10 阿里巴巴集团控股有限公司 信息处理方法、装置、计算设备及终端
WO2020062006A1 (en) * 2018-09-28 2020-04-02 Entit Software Llc Intent and context-aware dialogue based virtual assistance
CN109145104A (zh) * 2018-09-29 2019-01-04 北京百度网讯科技有限公司 用于对话交互的方法和装置
CN109145104B (zh) * 2018-09-29 2023-04-18 北京百度网讯科技有限公司 用于对话交互的方法和装置
CN111159330B (zh) * 2018-11-06 2023-06-20 阿里巴巴集团控股有限公司 一种数据库查询语句的生成方法及装置
CN111159330A (zh) * 2018-11-06 2020-05-15 阿里巴巴集团控股有限公司 一种数据库查询语句的生成方法及装置
CN111178081A (zh) * 2018-11-09 2020-05-19 中移(杭州)信息技术有限公司 语义识别的方法、服务器、电子设备及计算机存储介质
CN109408051A (zh) * 2018-12-03 2019-03-01 福建省天奕网络科技有限公司 一种识别安卓游戏应用开发引擎的方法及终端
CN109829038A (zh) * 2018-12-11 2019-05-31 平安科技(深圳)有限公司 基于深度学习的问答反馈方法、装置、设备及存储介质
WO2020119031A1 (zh) * 2018-12-11 2020-06-18 平安科技(深圳)有限公司 基于深度学习的问答反馈方法、装置、设备及存储介质
CN110032623A (zh) * 2018-12-12 2019-07-19 阿里巴巴集团控股有限公司 用户问句与知识点标题的匹配方法和装置
CN109741824A (zh) * 2018-12-21 2019-05-10 质直(上海)教育科技有限公司 一种基于机器学习的医疗问诊方法
CN109658114A (zh) * 2018-12-21 2019-04-19 万达信息股份有限公司 大型语料库的高效智能客服方法
CN109741824B (zh) * 2018-12-21 2023-08-04 质直(上海)教育科技有限公司 一种基于机器学习的医疗问诊方法
CN111428123A (zh) * 2019-01-09 2020-07-17 阿里巴巴集团控股有限公司 查询方法和装置
CN109858528A (zh) * 2019-01-10 2019-06-07 平安科技(深圳)有限公司 推荐系统训练方法、装置、计算机设备及存储介质
CN109858528B (zh) * 2019-01-10 2024-05-14 平安科技(深圳)有限公司 推荐系统训练方法、装置、计算机设备及存储介质
CN111563140B (zh) * 2019-01-25 2023-04-14 阿里巴巴集团控股有限公司 一种意图识别方法及装置
CN111563140A (zh) * 2019-01-25 2020-08-21 阿里巴巴集团控股有限公司 一种意图识别方法及装置
CN109871543B (zh) * 2019-03-12 2023-10-24 广东小天才科技有限公司 一种意图获取方法及系统
CN109871543A (zh) * 2019-03-12 2019-06-11 广东小天才科技有限公司 一种意图获取方法及系统
CN110110048A (zh) * 2019-05-10 2019-08-09 科大讯飞股份有限公司 问询指引方法及装置
CN112052311A (zh) * 2019-05-20 2020-12-08 天津科技大学 一种基于词向量技术和知识图谱检索的短文本问答方法及装置
CN110209790B (zh) * 2019-06-06 2023-08-25 创新先进技术有限公司 问答匹配方法和装置
CN110209790A (zh) * 2019-06-06 2019-09-06 阿里巴巴集团控股有限公司 问答匹配方法和装置
CN110442689A (zh) * 2019-06-25 2019-11-12 平安科技(深圳)有限公司 一种问答关系排序方法、装置、计算机设备及存储介质
CN110413746A (zh) * 2019-06-25 2019-11-05 阿里巴巴集团控股有限公司 对用户问题进行意图识别的方法及装置
CN110399473B (zh) * 2019-06-28 2023-08-29 创新先进技术有限公司 为用户问题确定答案的方法和装置
CN110399473A (zh) * 2019-06-28 2019-11-01 阿里巴巴集团控股有限公司 为用户问题确定答案的方法和装置
CN110502608B (zh) * 2019-07-05 2023-10-10 平安科技(深圳)有限公司 基于知识图谱的人机对话方法及人机对话装置
CN110502608A (zh) * 2019-07-05 2019-11-26 平安科技(深圳)有限公司 基于知识图谱的人机对话方法及人机对话装置
CN110532397B (zh) * 2019-07-19 2023-06-09 平安科技(深圳)有限公司 基于人工智能的问答方法、装置、计算机设备及存储介质
CN110532397A (zh) * 2019-07-19 2019-12-03 平安科技(深圳)有限公司 基于人工智能的问答方法、装置、计算机设备及存储介质
CN111881266A (zh) * 2019-07-19 2020-11-03 马上消费金融股份有限公司 一种应答方法及装置
CN110390006B (zh) * 2019-07-23 2023-11-10 腾讯科技(深圳)有限公司 问答语料生成方法、装置和计算机可读存储介质
CN110390006A (zh) * 2019-07-23 2019-10-29 腾讯科技(深圳)有限公司 问答语料生成方法、装置和计算机可读存储介质
CN112347776A (zh) * 2019-08-09 2021-02-09 金色熊猫有限公司 医疗数据处理方法及装置、存储介质、电子设备
CN110795528A (zh) * 2019-09-05 2020-02-14 腾讯科技(深圳)有限公司 一种数据查询方法、装置、电子设备及存储介质
CN110795528B (zh) * 2019-09-05 2023-10-13 腾讯科技(深圳)有限公司 一种数据查询方法、装置、电子设备及存储介质
CN110674273A (zh) * 2019-09-17 2020-01-10 安徽信息工程学院 一种分词的智能问答机器人训练方法
CN112580298A (zh) * 2019-09-29 2021-03-30 大众问问(北京)信息科技有限公司 一种标注数据获取方法、装置及设备
CN112580298B (zh) * 2019-09-29 2024-05-07 大众问问(北京)信息科技有限公司 一种标注数据获取方法、装置及设备
CN110750998A (zh) * 2019-10-14 2020-02-04 腾讯科技(深圳)有限公司 一种文本输出方法、装置、计算机设备和存储介质
CN110750998B (zh) * 2019-10-14 2023-10-31 腾讯科技(深圳)有限公司 一种文本输出方法、装置、计算机设备和存储介质
CN110795482A (zh) * 2019-10-16 2020-02-14 浙江大华技术股份有限公司 数据对标方法、装置、及存储装置
CN110795482B (zh) * 2019-10-16 2022-11-22 浙江大华技术股份有限公司 数据对标方法、装置、及存储装置
CN110866099B (zh) * 2019-10-30 2023-05-09 上海益商网络科技有限公司 一种基于智能音箱语音交互的智能管家服务方法及系统
CN110866099A (zh) * 2019-10-30 2020-03-06 南昌众荟智盈信息技术有限公司 一种基于智能音箱语音交互的智能管家服务方法及系统
CN112988986A (zh) * 2019-12-02 2021-06-18 阿里巴巴集团控股有限公司 人机交互方法、装置与设备
CN111177339A (zh) * 2019-12-06 2020-05-19 百度在线网络技术(北京)有限公司 对话生成方法、装置、电子设备及存储介质
CN111177339B (zh) * 2019-12-06 2023-07-25 百度在线网络技术(北京)有限公司 对话生成方法、装置、电子设备及存储介质
CN112287079A (zh) * 2019-12-09 2021-01-29 北京来也网络科技有限公司 结合rpa和ai的问答对获取方法、装置、介质及电子设备
CN111104505B (zh) * 2019-12-30 2023-08-25 浙江阿尔法人力资源有限公司 信息提示方法、装置、设备和存储介质
CN111104505A (zh) * 2019-12-30 2020-05-05 浙江阿尔法人力资源有限公司 信息提示方法、装置、设备和存储介质
CN111241249A (zh) * 2020-01-21 2020-06-05 苏宁云计算有限公司 人机对话方法、装置、计算机设备和存储介质
CN111324712A (zh) * 2020-02-18 2020-06-23 山东汇贸电子口岸有限公司 对话回复方法及服务端
CN111368045B (zh) * 2020-02-21 2024-05-07 平安科技(深圳)有限公司 用户意图识别方法、装置、设备及计算机可读存储介质
CN111368045A (zh) * 2020-02-21 2020-07-03 平安科技(深圳)有限公司 用户意图识别方法、装置、设备及计算机可读存储介质
CN111309306A (zh) * 2020-02-24 2020-06-19 福建天晴数码有限公司 人机交互的对话管理系统
CN111309306B (zh) * 2020-02-24 2023-07-28 福建天晴数码有限公司 人机交互的对话管理系统
CN111309889B (zh) * 2020-02-27 2023-04-14 支付宝(杭州)信息技术有限公司 用于文本处理的方法和装置
CN111309889A (zh) * 2020-02-27 2020-06-19 支付宝(杭州)信息技术有限公司 用于文本处理的方法和装置
WO2021174783A1 (zh) * 2020-03-02 2021-09-10 平安科技(深圳)有限公司 近义词推送方法、装置、电子设备及介质
CN111651600B (zh) * 2020-06-02 2023-04-07 携程计算机技术(上海)有限公司 语句多意图识别方法、系统、电子设备及存储介质
CN111651600A (zh) * 2020-06-02 2020-09-11 携程计算机技术(上海)有限公司 语句多意图识别方法、系统、电子设备及存储介质
CN111859951B (zh) * 2020-06-19 2024-03-26 北京百度网讯科技有限公司 语言模型的训练方法、装置、电子设备及可读存储介质
CN111859951A (zh) * 2020-06-19 2020-10-30 北京百度网讯科技有限公司 语言模型的训练方法、装置、电子设备及可读存储介质
CN111737401A (zh) * 2020-06-22 2020-10-02 首都师范大学 一种基于Seq2set2seq框架的关键词组预测方法
CN111724909A (zh) * 2020-06-28 2020-09-29 北京来也网络科技有限公司 一种结合rpa和ai的疫情排查方法和装置
CN111783440A (zh) * 2020-07-02 2020-10-16 北京字节跳动网络技术有限公司 意图识别方法、装置、可读介质及电子设备
CN111783440B (zh) * 2020-07-02 2024-04-26 北京字节跳动网络技术有限公司 意图识别方法、装置、可读介质及电子设备
CN111881294B (zh) * 2020-07-30 2023-10-24 本识科技(深圳)有限公司 一种语料标注系统、方法及存储介质
CN111881294A (zh) * 2020-07-30 2020-11-03 本识科技(深圳)有限公司 一种语料标注系统、方法及存储介质
CN113761139A (zh) * 2020-08-10 2021-12-07 北京沃东天骏信息技术有限公司 一种意图预判的方法和装置
CN112289398A (zh) * 2020-08-17 2021-01-29 上海柯林布瑞信息技术有限公司 病理报告解析方法及装置、存储介质、终端
CN111814481B (zh) * 2020-08-24 2023-11-14 深圳市欢太科技有限公司 购物意图识别方法、装置、终端设备及存储介质
CN111814481A (zh) * 2020-08-24 2020-10-23 深圳市欢太科技有限公司 购物意图识别方法、装置、终端设备及存储介质
CN112035647A (zh) * 2020-09-02 2020-12-04 中国平安人寿保险股份有限公司 一种基于人机交互的问答方法、装置、设备及介质
CN112035647B (zh) * 2020-09-02 2023-11-24 中国平安人寿保险股份有限公司 一种基于人机交互的问答方法、装置、设备及介质
CN112328871A (zh) * 2020-10-27 2021-02-05 深圳集智数字科技有限公司 一种基于rpa模块的回复生成方法、装置、设备及存储介质
CN112417110A (zh) * 2020-10-27 2021-02-26 联想(北京)有限公司 一种信息处理方法及装置
CN112328871B (zh) * 2020-10-27 2024-04-26 深圳集智数字科技有限公司 一种基于rpa模块的回复生成方法、装置、设备及存储介质
CN112270182A (zh) * 2020-11-12 2021-01-26 佰聆数据股份有限公司 一种基于多轮对话问答式的分析思路衍生方法、系统及存储介质
CN112347760A (zh) * 2020-11-16 2021-02-09 北京京东尚科信息技术有限公司 意图识别模型的训练方法及装置、意图识别方法及装置
CN112765310A (zh) * 2020-12-11 2021-05-07 北京航天云路有限公司 一种基于深度学习与相似度匹配的知识图谱问答的方法
CN112528002A (zh) * 2020-12-23 2021-03-19 北京百度网讯科技有限公司 对话识别方法、装置、电子设备和存储介质
CN112528002B (zh) * 2020-12-23 2023-07-18 北京百度网讯科技有限公司 对话识别方法、装置、电子设备和存储介质
CN112685546A (zh) * 2020-12-29 2021-04-20 平安普惠企业管理有限公司 人机多轮对话方法、装置及计算机可读存储介质
CN112685546B (zh) * 2020-12-29 2023-10-31 王福山 人机多轮对话方法、装置及计算机可读存储介质
CN112818096A (zh) * 2021-01-26 2021-05-18 广州三星通信技术研究有限公司 对话生成方法及其装置
CN112860913B (zh) * 2021-02-24 2024-03-08 广州汇通国信科技有限公司 一种知识图谱的本体创建方法
CN112860913A (zh) * 2021-02-24 2021-05-28 广州汇通国信科技有限公司 一种知识图谱的本体创建方法
CN113221555B (zh) * 2021-05-07 2023-11-14 支付宝(杭州)信息技术有限公司 一种基于多任务模型的关键词识别方法、装置及设备
CN113221555A (zh) * 2021-05-07 2021-08-06 支付宝(杭州)信息技术有限公司 一种基于多任务模型的关键词识别方法、装置及设备
CN113139615A (zh) * 2021-05-08 2021-07-20 北京联合大学 一种基于嵌入式设备的无人驾驶环境目标检测方法
CN113139044A (zh) * 2021-05-10 2021-07-20 中国电子科技集团公司第二十八研究所 一种用于问答系统的支持多意图切换的问答多轮对话方法
CN113282729A (zh) * 2021-06-07 2021-08-20 北京金山数字娱乐科技有限公司 基于知识图谱的问答方法及装置
CN113283666B (zh) * 2021-06-10 2023-07-07 中国人民解放军国防科技大学 一种卫星群的启发式智能任务推理与决策方法
CN113283666A (zh) * 2021-06-10 2021-08-20 中国人民解放军国防科技大学 一种卫星群的启发式智能任务推理与决策方法
CN113282734A (zh) * 2021-06-28 2021-08-20 中国平安人寿保险股份有限公司 基于结构化数据的问答处理方法、装置、设备及介质
CN113486151A (zh) * 2021-07-13 2021-10-08 盛景智能科技(嘉兴)有限公司 故障维修知识点查询方法、装置、电子设备和存储介质
CN113569578A (zh) * 2021-08-13 2021-10-29 上海淇玥信息技术有限公司 一种用户意图识别方法、装置和计算机设备
CN113569578B (zh) * 2021-08-13 2024-03-08 上海淇玥信息技术有限公司 一种用户意图识别方法、装置和计算机设备
CN113609248A (zh) * 2021-08-20 2021-11-05 北京金山数字娱乐科技有限公司 词权重生成模型训练方法及装置、词权重生成方法及装置
CN115132178A (zh) * 2022-07-15 2022-09-30 科讯嘉联信息技术有限公司 一种基于深度学习的语义端点检测系统
CN115132178B (zh) * 2022-07-15 2023-01-10 科讯嘉联信息技术有限公司 一种基于深度学习的语义端点检测系统
CN116737910B (zh) * 2023-08-10 2024-03-29 腾讯科技(深圳)有限公司 智能对话处理方法、装置、设备及存储介质
CN116737910A (zh) * 2023-08-10 2023-09-12 腾讯科技(深圳)有限公司 智能对话处理方法、装置、设备及存储介质
CN117708337A (zh) * 2024-02-05 2024-03-15 杭州杰竞科技有限公司 一种面向复杂定域的人机交互方法和系统
CN117708337B (zh) * 2024-02-05 2024-04-26 杭州杰竞科技有限公司 一种面向复杂定域的人机交互方法和系统

Also Published As

Publication number Publication date
CN108446286B (zh) 2023-04-25
TWI746690B (zh) 2021-11-21
TW201832104A (zh) 2018-09-01
CN108446286A (zh) 2018-08-24

Similar Documents

Publication Publication Date Title
WO2018149326A1 (zh) 一种自然语言问句答案的生成方法、装置及服务器
US20200301954A1 (en) Reply information obtaining method and apparatus
US10496749B2 (en) Unified semantics-focused language processing and zero base knowledge building system
CN108491443B (zh) 由计算机实施的与用户对话的方法和计算机系统
KR100533810B1 (ko) 백과사전 질의응답 시스템의 지식베이스 반자동 구축 방법
CN106649825B (zh) 语音交互系统及其创建方法和装置
CN111159385B (zh) 一种基于动态知识图谱的无模板通用智能问答方法
CN106601237B (zh) 交互式语音应答系统及其语音识别方法
CN108268580A (zh) 基于知识图谱的问答方法及装置
WO2017196784A1 (en) Ontology discovery based on distributional similarity and lexico-semantic relations
CN104050256A (zh) 基于主动学习的问答方法及采用该方法的问答系统
JP2020071869A (ja) 動画基盤求人求職マッチングサーバーおよび方法
US10326863B2 (en) Speed and accuracy of computers when resolving client queries by using graph database model
CN112579733B (zh) 规则匹配方法、规则匹配装置、存储介质及电子设备
WO2024011813A1 (zh) 一种文本扩展方法、装置、设备及介质
CN110427478A (zh) 一种基于知识图谱的问答搜索方法及系统
CN114691831A (zh) 一种基于知识图谱的任务型汽车故障智能问答系统
CN114218472A (zh) 基于知识图谱的智能搜索系统
CN112507089A (zh) 一种基于知识图谱的智能问答引擎及其实现方法
CN116244412A (zh) 多意图识别方法及装置
CN116821290A (zh) 面向多任务对话的大语言模型训练方法和交互方法
CN111553138A (zh) 用于规范内容结构文档的辅助写作方法及装置
CN110750632B (zh) 一种改进的中文alice智能问答方法及系统
CN112559718A (zh) 对话处理的方法、装置、电子设备和存储介质
CN115878818B (zh) 一种地理知识图谱构建方法、装置、终端及存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18754098

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18754098

Country of ref document: EP

Kind code of ref document: A1