CN111831807A - Intention recognition method, and nutrition knowledge question-answering method and device - Google Patents

Intention recognition method, and nutrition knowledge question-answering method and device Download PDF

Info

Publication number
CN111831807A
CN111831807A CN202010677838.XA CN202010677838A CN111831807A CN 111831807 A CN111831807 A CN 111831807A CN 202010677838 A CN202010677838 A CN 202010677838A CN 111831807 A CN111831807 A CN 111831807A
Authority
CN
China
Prior art keywords
text
intention
conversation
training
knowledge
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010677838.XA
Other languages
Chinese (zh)
Inventor
刘邦长
孔飞
张航飞
庄博然
吴思凡
杨云清
常德杰
刘朝振
刘红霞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Miaoyijia Health Technology Group Co ltd
Original Assignee
Beijing Miaoyijia Health Technology Group Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Miaoyijia Health Technology Group Co ltd filed Critical Beijing Miaoyijia Health Technology Group Co ltd
Priority to CN202010677838.XA priority Critical patent/CN111831807A/en
Publication of CN111831807A publication Critical patent/CN111831807A/en
Pending legal-status Critical Current

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
    • 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/36Creation of semantic tools, e.g. ontology or thesauri
    • G06F16/367Ontology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/289Phrasal analysis, e.g. finite state techniques or chunking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/289Phrasal analysis, e.g. finite state techniques or chunking
    • G06F40/295Named entity recognition
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G16INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR SPECIFIC APPLICATION FIELDS
    • G16HHEALTHCARE INFORMATICS, i.e. INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR THE HANDLING OR PROCESSING OF MEDICAL OR HEALTHCARE DATA
    • G16H20/00ICT specially adapted for therapies or health-improving plans, e.g. for handling prescriptions, for steering therapy or for monitoring patient compliance
    • G16H20/60ICT specially adapted for therapies or health-improving plans, e.g. for handling prescriptions, for steering therapy or for monitoring patient compliance relating to nutrition control, e.g. diets

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Artificial Intelligence (AREA)
  • Computational Linguistics (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Mathematical Physics (AREA)
  • Evolutionary Computation (AREA)
  • Software Systems (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Databases & Information Systems (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Human Computer Interaction (AREA)
  • Evolutionary Biology (AREA)
  • Nutrition Science (AREA)
  • Epidemiology (AREA)
  • Medical Informatics (AREA)
  • Primary Health Care (AREA)
  • Public Health (AREA)
  • Animal Behavior & Ethology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Machine Translation (AREA)

Abstract

The invention provides an intention identification method, a nutrition knowledge question-answering method and a nutrition knowledge question-answering device, which comprise the following steps: acquiring a session text input by a user; determining text sequence characteristics corresponding to the conversation text according to a preset knowledge graph; the preset knowledge graph comprises a plurality of nutrition knowledge entities and the incidence relation among the nutrition knowledge entities; and recognizing the conversation intention of the user based on the conversation text and the text sequence features through an intention prediction model obtained by pre-training. The invention can effectively improve the accuracy of intention recognition, thereby improving the user experience.

Description

Intention recognition method, and nutrition knowledge question-answering method and device
Technical Field
The invention relates to the technical field of deep learning, in particular to an intention identification method, a nutritional knowledge question-answering method and a nutritional knowledge question-answering device.
Background
With the development of socioeconomic and the progress of science and technology, people pay more and more attention to the problem of self nutrition and health. At present, the rapid development of artificial intelligence technology enables a human-computer interaction robot to more enter the daily life of people, so that an intelligent conversation robot can be produced in the application scene of intelligent nutrition questions and answers. Most of the current conversation robots are of a search type and a generation type, wherein the search type is a question and answer result fed back based on a search pattern matching method, and because strict requirements are made on a data input form, a standard format cannot be ensured to be input by a user, so that wrong answers are answered; the generation formula is to obtain answers from question sentences based on deep learning techniques, etc., which usually results in disorder of language sequence of answers. Therefore, recognizing a user intention based on a user dialog and then providing a user with a desired service according to the user intention is an important technical means for improving the user experience.
In a traditional user intention identification method, firstly, a user input text needs to be obtained, characteristics such as part of speech, word frequency and the like are extracted from the text by adopting a word segmentation technology and a manual extraction mode, a word vector of each word in the text is calculated based on the characteristics, and finally, the word vector is input into a trained intention classification model to obtain an intention result. However, the above method adopts a manual method to extract features, which not only needs to consume large labor cost and time cost, but also causes low accuracy of intention identification, and further causes poor user experience effect.
Disclosure of Invention
In view of the above, the present invention provides an intention identification method, a nutritional knowledge question answering method and a nutritional knowledge question answering device, which can effectively improve the accuracy of intention identification, thereby improving user experience.
In a first aspect, an embodiment of the present invention provides an intention identification method, including: acquiring a session text input by a user; determining text sequence characteristics corresponding to the conversation text according to a preset knowledge graph; the preset knowledge graph comprises a plurality of nutrition knowledge entities and an incidence relation among the nutrition knowledge entities; and identifying the conversation intention of the user based on the conversation text and the text sequence features through an intention prediction model obtained through pre-training.
In one embodiment, the step of determining the text sequence feature corresponding to the conversation text according to a preset knowledge graph includes: performing word segmentation processing on the conversation text to obtain a plurality of conversation words included in the conversation text; identifying a nutrition knowledge entity corresponding to each conversation participle; and determining the association relation between the nutritional knowledge entities corresponding to the conversation participles based on a preset knowledge graph to obtain the text sequence characteristics corresponding to the conversation text.
In one embodiment, the training step of the intention prediction model includes: acquiring a training text; wherein the training text carries an intention label, and the intention label is used for representing a conversation intention corresponding to the training text; preprocessing the training text to obtain a word vector matrix corresponding to the training text; wherein the word vector matrix is input to the intent prediction model; training the intent prediction model based on the word vector matrix.
In an embodiment, the step of preprocessing the training text to obtain a word vector matrix corresponding to the training text includes: performing word segmentation processing on the training text to obtain a plurality of training words included in the training text; identifying a nutrition knowledge entity corresponding to each training participle; and generating a word vector matrix corresponding to the training text based on the nutrition knowledge entity corresponding to each training segmented word by using a specified pre-training model.
In one embodiment, the step of training the intent prediction model based on the word vector matrix includes: generating a unit matrix according to the preset knowledge graph; generating a first matrix according to the intention labels carried by the training texts and a preset intention dictionary; wherein the intention dictionary contains numbers corresponding to respective conversation intents; generating a second matrix based on a preset matrix conversion function, the identity matrix, the word vector matrix and the first matrix; wherein the second matrix is an output of the intent prediction model; training the intent prediction model based on the word vector matrix and the second matrix.
In a second aspect, an embodiment of the present invention further provides a method for questioning and answering nutritional knowledge, including: recognizing a conversation text input by a user by adopting the method provided by any one of the first aspect to obtain a conversation intention of the user; and determining a nutrition knowledge answer corresponding to the session text based on the session intention.
In a third aspect, an embodiment of the present invention further provides an intention identifying apparatus, including: the text acquisition module is used for acquiring a session text input by a user; the feature determination module is used for determining text sequence features corresponding to the session text according to a preset knowledge graph; the preset knowledge graph comprises a plurality of nutrition knowledge entities and an incidence relation among the nutrition knowledge entities; and the intention identification module is used for identifying the conversation intention of the user based on the conversation text and the text sequence characteristics through an intention prediction model obtained by pre-training.
In a fourth aspect, an embodiment of the present invention further provides a nutritional knowledge question-answering device, including: a text recognition module, configured to recognize a session text input by a user by using any one of the methods provided in the first aspect, so as to obtain a session intention of the user; and the answer determining module is used for determining a nutrition knowledge answer corresponding to the conversation text based on the conversation intention.
In a fifth aspect, an embodiment of the present invention further provides an electronic device, including a processor and a memory; the memory has stored thereon a computer program which, when executed by the processor, performs the method of any one of the aspects as provided in the first aspect, or performs the method as provided in the second aspect.
In a sixth aspect, the present invention further provides a computer storage medium for storing computer software instructions for the method provided in any one of the first aspect, or for executing the method provided in the second aspect.
According to the intention recognition method and device provided by the embodiment of the invention, firstly, a conversation text input by a user is obtained, then, a text sequence feature corresponding to the conversation text is determined according to a preset knowledge graph comprising a plurality of nutrition knowledge entities and the incidence relation among the nutrition knowledge entities, and the conversation intention of the user is recognized based on the conversation text and the text sequence feature through an intention prediction model obtained through pre-training. The method determines the text sequence characteristics of the conversation text based on the preset knowledge graph, and optimizes the acquisition mode of the text sequence characteristics, so that the accuracy rate of intention identification is improved well, and the user experience is improved effectively.
According to the method and the device for question answering of the nutritional knowledge, provided by the embodiment of the invention, the method provided by the intention identification method and the device is adopted to identify the conversation text input by the user to obtain the conversation intention of the user, and then the nutritional knowledge answer corresponding to the conversation text is determined based on the conversation intention. According to the method, the intention recognition method with high accuracy is used for recognizing the conversation intention of the user, and on the basis, more accurate nutrition knowledge answers corresponding to the conversation texts can be obtained, so that the user experience is effectively improved.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 is a schematic flow chart of an intention identifying method according to an embodiment of the present invention;
FIG. 2 is a flow chart illustrating another method for identifying intentions according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating a method for training an intention recognition model according to an embodiment of the present invention;
FIG. 4 is a schematic flow chart of a nutrition knowledge question-answering method according to an embodiment of the present invention;
FIG. 5 is a schematic flow chart of another method for questioning and answering nutrition knowledge according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an intention identifying apparatus according to an embodiment of the present invention;
FIG. 7 is a schematic structural diagram of a nutrition knowledge question-answering device according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the embodiments, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
At present, the existing intention identification method has the problem of low accuracy, and in order to improve the problem, the invention provides the intention identification method, the nutrition knowledge question-answering method and the nutrition knowledge question-answering device, so that the intention identification accuracy can be effectively improved, and the user experience is further improved.
To facilitate understanding of the present embodiment, first, an intention identification method disclosed in the present embodiment is described in detail, referring to a schematic flow chart of the intention identification method shown in fig. 1, where the method mainly includes the following steps S102 to S106:
step S102, obtaining the conversation text input by the user. In one embodiment, conversational speech of a user may be received and converted from an audio format to a text format to obtain conversational text of the user.
And step S104, determining text sequence characteristics corresponding to the conversation text according to a preset knowledge graph. The preset knowledge graph comprises a plurality of nutrition knowledge entities and the incidence relation among the nutrition knowledge entities, the nutrition knowledge entities can comprise recipes, food materials, food material claims, food material efficacies, crowd labels, categories, nutrients, tastes, cooking methods, seasons, festivals and the like, and the text sequence features can be used for representing the incidence relation among the nutrition knowledge entities contained in the conversation text and the nutrition knowledge entities contained in the conversation text. In one embodiment, the method may include performing word segmentation on a session text to obtain a plurality of session words included in the session text, and then identifying a nutritional knowledge entity corresponding to each session word, so as to determine an association relationship between the nutritional knowledge entities corresponding to each session word based on a preset knowledge graph to obtain a text sequence feature corresponding to the session text.
And step S106, recognizing the conversation intention of the user based on the conversation text and the text sequence characteristics through an intention prediction model obtained by pre-training. The intention prediction model may adopt CNN or RNN, etc., and in one embodiment, the conversation text and the text sequence feature are used as input of the intention prediction model, and the intention prediction model performs intention recognition on the conversation text based on the text sequence feature to determine the conversation intention of the user.
According to the intention recognition method provided by the embodiment of the invention, firstly, a conversation text input by a user is obtained, then, a text sequence feature corresponding to the conversation text is determined according to a preset knowledge graph comprising a plurality of nutrition knowledge entities and the incidence relation among the nutrition knowledge entities, and the conversation intention of the user is recognized based on the conversation text and the text sequence feature through an intention prediction model obtained through pre-training. The method determines the text sequence characteristics of the conversation text based on the preset knowledge graph, and optimizes the acquisition mode of the text sequence characteristics, so that the accuracy rate of intention identification is improved well, and the user experience is improved effectively.
To facilitate understanding of the step S104, an embodiment of the present invention provides a specific implementation manner for determining a text sequence feature corresponding to a conversation text according to a preset knowledge graph, which is shown in the following steps a to c:
step a, performing word segmentation processing on the conversation text to obtain a plurality of conversation words contained in the conversation text. Where the segmentation process is used to identify words in the conversational text, for example, "how much energy is in milk," segmenting it may result in conversational segmentation such as "milk", "energy", "is", "how much", and so on.
And b, identifying the nutrition knowledge entities corresponding to the conversation participles. The nutritional knowledge entities may include, for example, recipes, food materials, food material claims, food material efficacies, crowd labels, categories, nutrients, tastes, cooking methods, seasons, festivals, and the like, and in one embodiment, the nutritional knowledge entities corresponding to the conversation participles may be identified by bilstm + crf.
And c, determining the association relation between the nutrition knowledge entities corresponding to the conversation participles based on a preset knowledge graph to obtain the text sequence characteristics corresponding to the conversation text. During specific implementation, the preset knowledge graph comprises the association relation among all the nutrition knowledge entities, so that the nutrition knowledge entities corresponding to the conversation participles can be determined based on the preset knowledge graph. Furthermore, the embodiment of the invention can add alias fields to the nutritional knowledge entities to expand entity synonyms, so that the obtained text sequence features are more accurate.
In order to improve the accuracy of the prediction intention of the intention prediction model, the embodiment of the invention provides an implementation method for training the intention prediction model, which can be specifically seen in the following steps 1 to 3:
step 1, obtaining a training text. The training text carries intention labels, the intention labels are used for representing conversation intentions corresponding to the training text, and the training text can also be called as corpus text.
And 2, preprocessing the training text to obtain a word vector matrix corresponding to the training text. Where the word vector matrix is used as input to the intent prediction model. In one embodiment, the following steps 2.1 to 2.3 may be referred to perform preprocessing on the training text to obtain a word vector matrix corresponding to the training text:
and 2.1, performing word segmentation on the training text to obtain a plurality of training words contained in the training text. In one embodiment, the segmentation tool uses the ending segmentation to add self-defined segmentation entities according to the nutritional knowledge entities of the nutritional knowledge graph (i.e., the preset knowledge graph) and the relationship nodes between the nutritional knowledge entities, so as to enhance the model prediction accuracy in a specific scene.
And 2.2, identifying the nutrition knowledge entities corresponding to the training participles. In one embodiment, the training segmentations may be named entity recognition using bilstm + crf.
And 2.3, generating a word vector matrix corresponding to the training text based on the nutrition knowledge entity corresponding to each training segmented word by using the specified pre-training model. In one embodiment, because the bert model contains contextual information, the pre-training model may select the bert model to account for the impact of word ambiguity on the sentence. For example: 1. does grape contain vitamin a? 2. Is the grape rich in vitamin a? Where "containing" in the text is understood to mean "containing, including", then the general model may classify the intentions of text 1 and text 2 into a class of "food nutrient intentions", which in fact is understood from context that the intent of text 1 is a "food nutrient intent" and the intent of text 2 is a "food claim intent".
And 3, training an intention prediction model based on the word vector matrix.
Further, an embodiment of the present invention provides an implementation manner for training an intention prediction model based on a word vector matrix, which may specifically refer to the following steps 3.1 to 3.4:
and 3.1, generating a unit matrix according to a preset knowledge graph. In one embodiment, an identity matrix of N x N is generated based on the number of intent classes N defined by the nutritional profile.
And 3.2, generating a first matrix according to the intention labels carried by the training texts and a preset intention dictionary. Wherein, the intention dictionary contains the number corresponding to each conversation intention. In one embodiment:
(1) the word vector matrix X per sentence generated by the bert model is extracted as input to an intent prediction model (also referred to as a classification model). For example, let X [ [1.3475627e-01, 4.0937680e-01-3.2051080e-01,. ], 5.0852495e-01, 3.9479968e-01, -5.4695266e-01], [2.9033303e-01, 4.5425275e-01, 9.4555683e-02, ], 9.2707604e-02, 5.0772732e-01, -4.8531148e-01], [4.1562864e-01, 1.9385587e-01, -4.1968378e-01, ], 2.8151971e-01, 5.7822663e-01, -5.9243882e-01] ].
(2) Mapping the intention of the training text labeled according to the training data into an intention dictionary dic, and generating a first matrix M, for example, assuming that dic { "food detail intention": 1, "food efficacy intention": 2, …, "collect user information intention": 10}, and setting the mapping function as map, wherein the first matrix M is map (X, dic); let M ═ 1,1, 2.., 10], where M [0] ═ 1 represents a predefined intent class 1, M [2] ═ 2 represents a predefined intent class 2, and M [ -1] ═ 10 represents a predefined intent class 10.
And 3.3, generating a second matrix based on the preset matrix conversion function, the unit matrix, the word vector matrix and the first matrix. Wherein the second matrix is output as the intent prediction model. In one embodiment, the classification model output is defined as a second matrix Y, defining a transformation matrix function transform, where Y ═ transform (X, M, N), then the second matrix Y [ [0.1.0.. 0.0.], [1.0.. 0.0.] 0.0., [0.0.0.. 0.1.0.] ]. Further, the matrix X, Y is fed into the deep neural network model, and an intention probability vector may be output, for example, if P [ [0.9,0.001,.. 0.01], [0.002,0.99,. 0.008],. 0., [0.0006,0.0012,. 0.998] ], and finally an intention probability corresponding to the text is obtained, and the intention of the user is determined.
And 3.4, training an intention prediction model according to the word vector matrix and the second matrix.
To facilitate understanding of the intention identification method provided in the above embodiment, an embodiment of the present invention provides another intention identification method, and referring to a flow chart of another intention identification method shown in fig. 2, the method mainly includes the following steps S202 to S206:
step S202, according to the design of the nutrition question-answering scene, obtaining a user request text as a model corpus. Wherein, the user request text is also the above-mentioned session text.
And step S204, extracting the text sequence characteristics of the model corpus by combining the nutrition knowledge map. In one embodiment, each nutrient knowledge entity and the association relationship thereof in the nutrient knowledge map can be mapped to the model corpus to obtain the text sequence characteristics.
And step S206, inputting the model linguistic data and the text sequence characteristics into the deep neural network model to obtain the user intention category. The deep neural network model is also the above-mentioned intention recognition model, and the user intention category is also the above-mentioned conversation intention.
In addition, an embodiment of the present invention further provides a method for training an intention recognition model, referring to a flow diagram of the method for training an intention recognition model shown in fig. 3, the method mainly includes the following steps S302 to S312:
step S302, performing word segmentation processing on the corpus text (i.e., the training text) by using jieba word segmentation.
Step S304, naming entity recognition based on the text sequence features.
Step S306, training a word vector model.
Step S308, mapping the text word vector and the intention recognition.
And S310, processing a data format, and defining an input matrix and an output matrix of the deep neural network model.
Step S312, training a deep neural network model based on the input matrix and the output matrix.
Based on the intention identification method provided by the above embodiment, the embodiment of the invention provides a nutrition knowledge question-answering method, referring to the flow diagram of the nutrition knowledge question-answering method shown in fig. 4, the method mainly comprises the following steps S402 to S404:
step S402, recognizing the conversation text input by the user by using the intention recognition method provided in the foregoing embodiment, to obtain the conversation intention of the user. In one embodiment, the intent categories of conversational intent may include, but are not limited to, the following:
(1) the food detail intention is: for example, "what is a cherry long? ".
(2) Food nutrient intent: for example, "what is the energy of milk? "," what food has the highest (low) vitamin C content? "," is fat in the peanut? ".
(3) The food efficacy intention is: for example, "what is a benefit to eat tomatoes? ".
(4) The food claims to intend: for example, "what are all foods with low protein? ".
(5) Intent to get snack: for example, "what featured snacks in Sichuan? ".
(6) Acquiring holiday-related food intents: for example, "what is usually eaten in winter solstice? ".
(7) Acquiring the food taboo intention of the population: for example, "what can be eaten with hypertension? "," what cannot be eaten by diabetic patients? ".
(8) Obtaining the intention of the related food of the vegetable series: for example, "what are all Hunan dishes? ".
(9) Diet recommendation intent: for example, "what is what in the morning? "
(10) Collecting user information intents: for example, "what is your age? "" body weight? "what do you have a food restriction? ".
In a specific implementation, the conversation intention of the user can be identified through the intention identification method provided by the above embodiment.
And step S404, determining a nutrition knowledge answer corresponding to the conversation text based on the conversation intention.
The question-answering method of the nutritional knowledge provided by the embodiment of the invention identifies the conversation intention of the user by using the intention identification method with higher accuracy, and on the basis, more accurate answers of the nutritional knowledge corresponding to the conversation text can be obtained, so that the user experience is effectively improved.
In order to facilitate understanding of the method for questioning and answering nutritional knowledge provided by the above embodiment, another method for questioning and answering nutritional knowledge is provided in the embodiment of the present invention, referring to a schematic flow chart of another method for questioning and answering nutritional knowledge shown in fig. 5, the method is applied to an intelligent nutritional questioning and answering conversation robot, and the method mainly includes the following steps S502 to S508:
step S502, a request text (i.e., the above-mentioned session text) input by the user is received.
Step S504, the request text is input to the intention prediction model.
In step S506, the conversation intention of the user is output through the intention prediction model.
In step S508, a response answer (i.e., the above-mentioned nutrition knowledge answer) is obtained according to the intention of the user corresponding to the conversation intention.
In summary, the embodiment of the present invention has at least the following features:
(1) the embodiment of the invention is different from the current database storage form by establishing the nutrition knowledge map, thereby greatly optimizing the accuracy and rapidity of intention identification.
(2) The intelligent nutrition question-answering structure provided by the embodiment of the invention is simple in design, fully accords with a mechanism of human-computer natural conversation, and improves user experience.
(3) Most of current intention recognition models are pattern matching, machine learning models and the like, the intention recognition accuracy is low, so that a robot cannot answer questions of a user quickly and accurately, and many question-answering systems are most common based on a chatting mode. According to the intelligent interactive robot, the intelligent interactive robot is designed by taking the nutritional knowledge question and answer as scenes, and the expectation that people can scientifically and reasonably answer the health problems in the faster and faster life rhythm at present is met; according to the invention, by designing the nutrition knowledge map and the intention recognition algorithm model, the accuracy rate of the model based on the scene question-answering system is high, and the user experience is enhanced.
(4) The mapping mode between the nutrition knowledge map entity and the intention and the utilization of the deep neural network model are not limited to neural networks such as CNN (CNN) or RNN (bilstm), and the accuracy rate of intention identification is further improved.
Based on the intention identification method provided by the above embodiment, an intention identification device is provided in the embodiment of the present invention, referring to a schematic structural diagram of an intention identification device shown in fig. 6, the device mainly includes the following parts:
a text obtaining module 602, configured to obtain a session text input by a user.
The feature determination module 604 is configured to determine a text sequence feature corresponding to the session text according to a preset knowledge graph; the preset knowledge graph comprises a plurality of nutrition knowledge entities and the incidence relation among the nutrition knowledge entities.
And an intention recognition module 606 for recognizing the conversation intention of the user based on the conversation text and the text sequence features through an intention prediction model obtained by pre-training.
The intention recognition device provided by the embodiment of the invention firstly obtains a conversation text input by a user, then determines a text sequence characteristic corresponding to the conversation text according to a preset knowledge graph comprising a plurality of nutrition knowledge entities and an incidence relation among the nutrition knowledge entities, and recognizes the conversation intention of the user based on the conversation text and the text sequence characteristic through an intention prediction model obtained through pre-training. The method determines the text sequence characteristics of the conversation text based on the preset knowledge graph, and optimizes the acquisition mode of the text sequence characteristics, so that the accuracy rate of intention identification is improved well, and the user experience is improved effectively.
In one embodiment, the feature determining module 604 is further configured to: performing word segmentation processing on the session text to obtain a plurality of session words contained in the session text; identifying a nutrition knowledge entity corresponding to each conversation participle; and determining the association relation between the nutritional knowledge entities corresponding to the conversation participles based on a preset knowledge graph to obtain the text sequence characteristics corresponding to the conversation text.
In one embodiment, the apparatus further comprises a training module configured to: acquiring a training text; the training text carries intention labels, and the intention labels are used for representing conversation intentions corresponding to the training text; preprocessing a training text to obtain a word vector matrix corresponding to the training text; wherein, the word vector matrix is used as the input of the intention prediction model; an intent prediction model is trained based on the word vector matrix.
In one embodiment, the training module is further configured to: performing word segmentation processing on the training text to obtain a plurality of training words contained in the training text; identifying a nutrition knowledge entity corresponding to each training participle; and generating a word vector matrix corresponding to the training text based on the nutrition knowledge entity corresponding to each training segmented word by using the specified pre-training model.
In one embodiment, the training module is further configured to: generating a unit matrix according to a preset knowledge graph; generating a first matrix according to the intention labels carried by the training text and a preset intention dictionary; the intention dictionary comprises numbers corresponding to all conversation intents; generating a second matrix based on a preset matrix conversion function, the identity matrix, the word vector matrix and the first matrix; wherein the second matrix is an output of the intent prediction model; an intent prediction model is trained based on the word vector matrix and the second matrix.
Based on the nutrition knowledge question-answering method provided by the embodiment, the embodiment of the invention provides a nutrition knowledge question-answering device, which is shown in a structural schematic diagram of the nutrition knowledge question-answering device shown in fig. 7, and the device mainly comprises the following parts:
a text recognition module 702, configured to recognize a session text input by a user by using the intention recognition method provided in the foregoing embodiment, so as to obtain a session intention of the user.
And an answer determining module 704, configured to determine, based on the conversation intention, a nutritional knowledge answer corresponding to the conversation text.
According to the question-answering device for the nutritional knowledge, provided by the embodiment of the invention, the conversation intention of the user is identified by using the intention identification method with higher accuracy, and on the basis, more accurate answers of the nutritional knowledge corresponding to the conversation text can be obtained, so that the user experience is effectively improved.
The device provided by the embodiment of the present invention has the same implementation principle and technical effect as the method embodiments, and for the sake of brief description, reference may be made to the corresponding contents in the method embodiments without reference to the device embodiments.
The embodiment of the invention provides electronic equipment, which particularly comprises a processor and a storage device; the storage means has stored thereon a computer program which, when executed by the processor, performs the method of any of the above described embodiments.
Fig. 8 is a schematic structural diagram of an electronic device 100 according to an embodiment of the present invention, where the electronic device 100 includes: the device comprises a processor 80, a memory 81, a bus 82 and a communication interface 83, wherein the processor 80, the communication interface 83 and the memory 81 are connected through the bus 82; the processor 80 is arranged to execute executable modules, such as computer programs, stored in the memory 81.
The Memory 81 may include a high-speed Random Access Memory (RAM) and may also include a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. The communication connection between the network element of the system and at least one other network element is realized through at least one communication interface 83 (which may be wired or wireless), and the internet, a wide area network, a local network, a metropolitan area network, etc. may be used.
Bus 82 may be an ISA bus, PCI bus, EISA bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one double-headed arrow is shown in FIG. 8, but that does not indicate only one bus or one type of bus.
The memory 81 is used for storing a program, the processor 80 executes the program after receiving an execution instruction, and the method executed by the apparatus defined by the flow process disclosed in any of the foregoing embodiments of the present invention may be applied to the processor 80, or implemented by the processor 80.
The processor 80 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 80. The Processor 80 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the device can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, or a discrete hardware component. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in a memory 81, and the processor 80 reads the information in the memory 81 and performs the steps of the above method in combination with its hardware.
The computer program product of the readable storage medium provided in the embodiment of the present invention includes a computer readable storage medium storing a program code, where instructions included in the program code may be used to execute the method described in the foregoing method embodiment, and specific implementation may refer to the foregoing method embodiment, which is not described herein again.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
Finally, it should be noted that: the above-mentioned embodiments are only specific embodiments of the present invention, which are used for illustrating the technical solutions of the present invention and not for limiting the same, and the protection scope of the present invention is not limited thereto, although the present invention is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive the technical solutions described in the foregoing embodiments or equivalent substitutes for some technical features within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present invention, and they should be construed as being included therein. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. An intent recognition method, comprising:
acquiring a session text input by a user;
determining text sequence characteristics corresponding to the conversation text according to a preset knowledge graph; the preset knowledge graph comprises a plurality of nutrition knowledge entities and an incidence relation among the nutrition knowledge entities;
and identifying the conversation intention of the user based on the conversation text and the text sequence features through an intention prediction model obtained through pre-training.
2. The method according to claim 1, wherein the step of determining the text sequence feature corresponding to the conversation text according to a preset knowledge graph comprises:
performing word segmentation processing on the conversation text to obtain a plurality of conversation words included in the conversation text;
identifying a nutrition knowledge entity corresponding to each conversation participle;
and determining the association relation between the nutritional knowledge entities corresponding to the conversation participles based on a preset knowledge graph to obtain the text sequence characteristics corresponding to the conversation text.
3. The method of claim 1, wherein the step of training the intent prediction model comprises:
acquiring a training text; wherein the training text carries an intention label, and the intention label is used for representing a conversation intention corresponding to the training text;
preprocessing the training text to obtain a word vector matrix corresponding to the training text; wherein the word vector matrix is input to the intent prediction model;
training the intent prediction model based on the word vector matrix.
4. The method according to claim 3, wherein the step of preprocessing the training text to obtain a word vector matrix corresponding to the training text comprises:
performing word segmentation processing on the training text to obtain a plurality of training words included in the training text;
identifying a nutrition knowledge entity corresponding to each training participle;
and generating a word vector matrix corresponding to the training text based on the nutrition knowledge entity corresponding to each training segmented word by using a specified pre-training model.
5. The method of claim 3, wherein the step of training the intent prediction model based on the word vector matrix comprises:
generating a unit matrix according to the preset knowledge graph;
generating a first matrix according to the intention labels carried by the training texts and a preset intention dictionary; wherein the intention dictionary contains numbers corresponding to respective conversation intents;
generating a second matrix based on a preset matrix conversion function, the identity matrix, the word vector matrix and the first matrix; wherein the second matrix is an output of the intent prediction model;
training the intent prediction model based on the word vector matrix and the second matrix.
6. A method for questioning and answering nutritional knowledge, which is characterized by comprising the following steps:
recognizing the conversation text input by a user by adopting the method of any one of claims 1 to 5 to obtain the conversation intention of the user;
and determining a nutrition knowledge answer corresponding to the session text based on the session intention.
7. An intention recognition apparatus, comprising:
the text acquisition module is used for acquiring a session text input by a user;
the feature determination module is used for determining text sequence features corresponding to the session text according to a preset knowledge graph; the preset knowledge graph comprises a plurality of nutrition knowledge entities and an incidence relation among the nutrition knowledge entities;
and the intention identification module is used for identifying the conversation intention of the user based on the conversation text and the text sequence characteristics through an intention prediction model obtained by pre-training.
8. A question-answering device for nutritional knowledge, comprising:
a text recognition module, configured to recognize a conversation text input by a user by using the method according to any one of claims 1 to 5, so as to obtain a conversation intention of the user;
and the answer determining module is used for determining a nutrition knowledge answer corresponding to the conversation text based on the conversation intention.
9. An electronic device comprising a processor and a memory;
the memory has stored thereon a computer program which, when executed by the processor, performs the intention-recognition method of any one of claims 1 to 5, or the question-and-answer method of nutritional knowledge of claim 6.
10. A computer storage medium storing computer software instructions for the method of intent recognition according to any one of claims 1 to 5 or for performing the method of questioning and answering of nutritional knowledge according to claim 6.
CN202010677838.XA 2020-07-14 2020-07-14 Intention recognition method, and nutrition knowledge question-answering method and device Pending CN111831807A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010677838.XA CN111831807A (en) 2020-07-14 2020-07-14 Intention recognition method, and nutrition knowledge question-answering method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010677838.XA CN111831807A (en) 2020-07-14 2020-07-14 Intention recognition method, and nutrition knowledge question-answering method and device

Publications (1)

Publication Number Publication Date
CN111831807A true CN111831807A (en) 2020-10-27

Family

ID=72924164

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010677838.XA Pending CN111831807A (en) 2020-07-14 2020-07-14 Intention recognition method, and nutrition knowledge question-answering method and device

Country Status (1)

Country Link
CN (1) CN111831807A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115982391A (en) * 2023-03-17 2023-04-18 恒生电子股份有限公司 Information processing method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107943860A (en) * 2017-11-08 2018-04-20 北京奇艺世纪科技有限公司 The recognition methods and device that the training method of model, text are intended to
CN109857844A (en) * 2018-12-29 2019-06-07 北京三快在线科技有限公司 Intension recognizing method, device, electronic equipment based on dialog text of ordering
US10331402B1 (en) * 2017-05-30 2019-06-25 Amazon Technologies, Inc. Search and knowledge base question answering for a voice user interface

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10331402B1 (en) * 2017-05-30 2019-06-25 Amazon Technologies, Inc. Search and knowledge base question answering for a voice user interface
CN107943860A (en) * 2017-11-08 2018-04-20 北京奇艺世纪科技有限公司 The recognition methods and device that the training method of model, text are intended to
CN109857844A (en) * 2018-12-29 2019-06-07 北京三快在线科技有限公司 Intension recognizing method, device, electronic equipment based on dialog text of ordering

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
高扬: "《人工智能与机器人先进技术丛书 智能摘要与深度学习》", 30 April 2019, 北京理工大学出版社, pages: 45 - 54 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115982391A (en) * 2023-03-17 2023-04-18 恒生电子股份有限公司 Information processing method and device

Similar Documents

Publication Publication Date Title
CN117033608B (en) Knowledge graph generation type question-answering method and system based on large language model
CN110795543B (en) Unstructured data extraction method, device and storage medium based on deep learning
CN108829757B (en) Intelligent service method, server and storage medium for chat robot
CN108304911B (en) Knowledge extraction method, system and equipment based on memory neural network
CN110727779A (en) Question-answering method and system based on multi-model fusion
CN110990543A (en) Intelligent conversation generation method and device, computer equipment and computer storage medium
CN110083693B (en) Robot dialogue reply method and device
CN112164391A (en) Statement processing method and device, electronic equipment and storage medium
CN111783394A (en) Training method of event extraction model, event extraction method, system and equipment
CN113590850A (en) Multimedia data searching method, device, equipment and storage medium
CN108388553B (en) Method for eliminating ambiguity in conversation, electronic equipment and kitchen-oriented conversation system
CN112101031B (en) Entity identification method, terminal equipment and storage medium
CN110795913A (en) Text encoding method and device, storage medium and terminal
CN110895559A (en) Model training method, text processing method, device and equipment
CN114757176A (en) Method for obtaining target intention recognition model and intention recognition method
CN111611350B (en) Response method and device based on health knowledge and electronic equipment
CN115714030A (en) Medical question-answering system and method based on pain perception and active interaction
CN110969005B (en) Method and device for determining similarity between entity corpora
CN111831807A (en) Intention recognition method, and nutrition knowledge question-answering method and device
CN107783958B (en) Target statement identification method and device
CN116881409A (en) Commodity information automatic question-answering method based on e-commerce knowledge graph
CN116595170A (en) Medical text classification method based on soft prompt
CN114358579A (en) Evaluation method, evaluation device, electronic device, and computer-readable storage medium
CN113657112A (en) Method and device for reading article
CN113407683A (en) Text information processing method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination