CN114239602A - Session method, apparatus and computer program product - Google Patents

Session method, apparatus and computer program product Download PDF

Info

Publication number
CN114239602A
CN114239602A CN202111402647.3A CN202111402647A CN114239602A CN 114239602 A CN114239602 A CN 114239602A CN 202111402647 A CN202111402647 A CN 202111402647A CN 114239602 A CN114239602 A CN 114239602A
Authority
CN
China
Prior art keywords
information
dialogue
dialogue information
context cache
entity
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
CN202111402647.3A
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.)
China Construction Bank Corp
Original Assignee
China Construction Bank Corp
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 China Construction Bank Corp filed Critical China Construction Bank Corp
Priority to CN202111402647.3A priority Critical patent/CN114239602A/en
Publication of CN114239602A publication Critical patent/CN114239602A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis
    • G06F40/35Discourse or dialogue representation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/25Fusion techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/253Grammatical analysis; Style critique
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/268Morphological analysis
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Health & Medical Sciences (AREA)
  • Computational Linguistics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Health & Medical Sciences (AREA)
  • Data Mining & Analysis (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Evolutionary Computation (AREA)
  • Evolutionary Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Machine Translation (AREA)

Abstract

The present application relates to a conversation method, apparatus, computer device, storage medium and computer program product. The method comprises the following steps: first dialogue information input by a user is received. Performing entity extraction on the first dialogue information to obtain an entity extraction result; and matching the entity extraction result in a preset knowledge base. And if the matching result exists, outputting the corresponding answer in the preset knowledge base as the reply information. And if the matching result does not exist, acquiring the fused dialogue information by fusing the first dialogue information and the context cache information, taking the fused dialogue information as the first dialogue information, and returning to the step of performing entity extraction on the first dialogue information. By adopting the method, the success rate of multi-turn conversation can be greatly improved, the workload of knowledge base management personnel is reduced, and the maintenance cost of the knowledge base in the later period is reduced.

Description

Session method, apparatus and computer program product
Technical Field
The present application relates to the field of artificial intelligence recognition and classification technologies, and in particular, to a conversation method, an apparatus, a computer device, a storage medium, and a computer program product.
Background
The human-computer multi-turn conversation is an important component of the natural language interactive robot and is also one of the difficulties. The traditional interaction methods mainly comprise two methods, one is a rule-based method, such as a slot filling method, a finite automaton method and the like; one is a dialogue management technique that is trained using machine learning based on statistical models, such as bayesian networks, graph modeling, etc.
With the development of more and more intellectualization in the field of robots, the conversation process is realized mechanically by originally adopting a rule-based human-computer interaction method, the naturalness of human-computer interaction is low, the complexity of a calculation algorithm of the human-computer interaction method completely based on a statistical model is high, the degree of freedom cannot be controlled artificially, the human-computer interaction method is difficult to correct when unsatisfactory response occurs, and the method needs to collect and arrange mass forecasts, so that the realization degree is complex. Therefore, the two traditional interaction methods are used for carrying out human-computer multi-round conversation, the workload of design and development is large, the user experience is not high, and the fact that natural language interaction between human and computers can be effectively carried out cannot be guaranteed.
Disclosure of Invention
In view of the foregoing, it is necessary to provide a conversation method, apparatus, computer device, storage medium and computer program product for solving the above technical problems.
In a first aspect, the present application provides a session method. The method comprises the following steps:
receiving first dialogue information input by a user;
performing entity extraction on the first dialogue information to obtain an entity extraction result; matching the entity extraction result in a preset knowledge base;
if the matching result exists, outputting the corresponding answer in the preset knowledge base as reply information;
if the matching result does not exist, obtaining stored context cache information, wherein the context cache information comprises second dialogue information input by the user and received in the dialogue at the time, and a syntax analysis result of each second dialogue information;
and if the first dialogue information can be fused with the context cache information, fusing the first dialogue information with the context cache information to obtain fused dialogue information, taking the fused dialogue information as the first dialogue information, and returning to the step of performing entity extraction on the first dialogue information.
In one embodiment, if the first dialog information can be fused with the context cache information, the fusing the first dialog information with the context cache information to obtain fused dialog information includes:
determining a question type of the first dialog information;
determining that the first dialog information can be fused with the context cache information if the question type belongs to a fusible question type;
and fusing the first dialogue information and the context cache information by adopting a fusion mode corresponding to the problem type of the first dialogue information to obtain fused dialogue information.
In one embodiment, the determining the question type of the first dialogue information includes:
performing syntactic analysis on the first dialogue information to obtain a syntactic analysis result;
determining a sentence structure of the first dialogue information and the part of speech of each word according to the syntactic analysis result;
determining a question type of the first dialogue information based on the sentence structure and the part of speech of each word.
In one embodiment, the determining the question type of the first dialogue information based on the sentence structure and the part of speech of each word includes:
if the sentence pattern structure is determined to lack the subject based on the part of speech of each word, determining the problem type of the first dialogue information as a missing subject;
and if the words with the parts of speech as pronouns exist, determining the problem type of the first dialogue information as unknown.
In one embodiment, the determining the question type of the first dialog information further includes:
determining a problem type of the first dialog information as an entity transition if the entity of the first dialog information is different from the entity in the context cache information.
In one embodiment, the fusing the first dialog information and the context cache information in a fusion manner corresponding to the question type of the first dialog information to obtain fused dialog information includes:
if the problem type is a missing subject, searching a subject from the context cache information, and completing the subject into the first dialogue information to obtain merged dialogue information;
if the question type is unknown, searching a word matched with the pronouns from the context cache information based on the position of the pronouns in the first dialogue information, replacing the pronouns in the first dialogue information with the words, and obtaining the merged dialogue information;
and if the problem type is entity conversion, replacing the entity in the first dialogue information by the entity in the context cache information to obtain the merged dialogue information, or replacing the entity in the context cache information by the entity in the first dialogue information to obtain the merged dialogue information.
In one embodiment, the method further comprises:
and if the question type does not belong to the fusible question type, determining that the first dialogue information cannot be fused with the context cache information, determining a question return question based on the first dialogue information, and replying the question return question as reply information.
In a second aspect, the present application further provides a session device. The device comprises:
the entity matching module is used for receiving first dialogue information input by a user; performing entity extraction on the first dialogue information to obtain an entity extraction result, and matching the entity extraction result in a preset knowledge base;
the matching result judging module is used for outputting the corresponding answer in the preset knowledge base as the reply information if the matching result exists; if the matching result does not exist, obtaining stored context cache information, wherein the context cache information comprises second dialogue information input by the user and received in the dialogue at the time, and a syntax analysis result of each second dialogue information;
and the information fusion module is used for fusing the first dialogue information and the context cache information to obtain fused dialogue information if the first dialogue information can be fused with the context cache information, and returning the step of performing entity extraction on the first dialogue information by taking the fused dialogue information as the first dialogue information.
In one embodiment, the information fusion module, when fusing the first dialog information and the context cache information to obtain fused dialog information if the first dialog information can be fused with the context cache information, includes: a question type for determining the first dialog information; determining that the first dialog information can be fused with the context cache information if the question type belongs to a fusible question type; and fusing the first dialogue information and the context cache information by adopting a fusion mode corresponding to the problem type of the first dialogue information to obtain fused dialogue information.
In one embodiment, the manner of determining the question type of the first dialogue information by the information fusion module includes: the first dialogue information is used for carrying out syntactic analysis to obtain a syntactic analysis result; determining a sentence structure of the first dialogue information and the part of speech of each word according to the syntactic analysis result; determining a question type of the first dialogue information based on the sentence structure and the part of speech of each word.
In one embodiment, the information fusion module, when determining the question type of the first dialogue information based on the sentence structure and the part of speech of each word, includes: determining the question type of the first dialogue information as a missing subject if the sentence structure is determined to lack the subject based on the part of speech of each word; and if the words with the parts of speech as pronouns exist, determining the problem type of the first dialogue information as unknown.
In one embodiment, when determining the question type of the first dialog information based on the sentence structure and the part of speech of each word, the information fusion module further includes: determining that the type of problem for the first dialog information is an entity transition if the entity for the first dialog information is different from the entity in the context cache information.
In one embodiment, the information fusion module, when fusing the first dialog information and the context cache information in a fusion manner corresponding to the problem type of the first dialog information to obtain fused dialog information, includes:
if the problem type is a missing subject, finding a subject from the context cache information, and completing the subject into the first dialogue information to obtain merged dialogue information; if the problem type is unknown, searching a word matched with the pronouns from the context cache information based on the position of the pronouns in the first dialogue information, replacing the pronouns in the first dialogue information with the words, obtaining fused dialogue information, if the problem type is entity conversion, replacing the entity in the first dialogue information with the entity in the context cache information, obtaining the fused dialogue information, or replacing the entity in the context cache information with the entity in the first dialogue information, and obtaining the fused dialogue information.
In one embodiment, the apparatus further comprises: question module is asked;
the question return module is used for determining that the first dialogue information can not be fused with the context cache information if the question type does not belong to a fusible question type, determining a question return based on the first dialogue information, and returning the question return as a reply message.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor implementing the steps of the method described above when executing the computer program.
In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method described above.
In a fifth aspect, the present application further provides a computer program product. The computer program product comprises a computer program which, when being executed by a processor, carries out the steps of the above-mentioned method.
According to the conversation method, the conversation device, the computer equipment, the storage medium and the computer program product, grammar analysis can be carried out according to historical conversation information received in the conversation, analysis results are stored in context cache information according to time sequence, when the conversation information input by a user is received and needs to be replied, the conversation information which cannot directly obtain answers is automatically fused with the context cache information, and the optimal answer is found according to the fused conversation information. By using the conversation method, when the conversation information which can not directly obtain the answer is received, the complete conversation information can be obtained by means of analysis and extraction of the previous context cache information, so that the reply information which is more consistent with the current conversation context is matched to the user according to the complete conversation information, the success rate of the multiple rounds of conversations is greatly improved, meanwhile, as the conversation process does not need to manually add the linguistic data or perform the external logic on the whole conversation process, the workload of knowledge base management personnel is reduced, and the maintenance cost of the knowledge base in the later period is reduced.
Drawings
FIG. 1 is a diagram of an application environment of a session method in one embodiment;
FIG. 2 is a flow diagram that illustrates a method for conversation in one embodiment;
FIG. 3 is a flowchart illustrating the steps of fusing the first session information with the context cache information to obtain fused session information if the first session information can be fused with the context cache information in one embodiment;
FIG. 4 is a flow chart illustrating a session method in another embodiment;
FIG. 5 is a block diagram showing the structure of a conversation device in one embodiment;
FIG. 6 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The session method provided by the embodiment of the application can be applied to the application environment shown in fig. 1. Wherein the client communicates with the server 104 through the terminal 102 using a network. The data storage system may store data that the server 104 needs to process. The data storage system may be integrated on the server 104, or may be located on the cloud or other network server. The user inputs first dialogue information on the terminal 102, the server 104 performs entity extraction on the first dialogue information to obtain an entity extraction result, the entity extraction result is matched in a pre-stored knowledge base, if no matching result exists, the server 104 acquires stored context cache information, the context cache information and the first dialogue information are fused, the process of entity extraction and matching is performed according to the fused information, when the matching result is obtained, answers stored in the pre-stored knowledge base are used as reply information, and the reply information is output to the terminal 102 through a network. The terminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, internet of things devices and portable wearable devices, and the internet of things devices may be smart speakers, smart televisions, smart robots, smart car-mounted devices, and the like. The portable wearable device can be a smart watch, a smart bracelet, and the like. The server 104 may be implemented as a stand-alone server or as a server cluster comprised of multiple servers.
In one embodiment, as shown in fig. 2, a session method is provided, which is described by taking the method as an example applied to the server 104 in fig. 1, and includes the following steps:
step 202, receiving first dialogue information input by a user.
The first dialogue information is information input by the user according to the question of the user needing consultation. It is to be understood that the first dialog information may be text information or voice information input by the user, which is not limited by the present invention.
Specifically, receiving first dialogue information input by a user through an intelligent terminal, wherein the first dialogue information is information input by the user according to a problem needing consultation.
Step 204, performing entity extraction on the first dialogue information to obtain an entity extraction result; and matching the entity extraction result in a preset knowledge base.
The entity extraction is also called named entity identification, and the entity extraction task has two keywords: find & classify, find named entity, and classify. In the specific code implementation, which types of entity words are extracted in advance is defined according to a specific training data set, for example, three types of entities of a name, a place name and an organization name are defined in a people daily data set, and after model training is completed, the task is to extract three types of entity words from an input sentence and identify the entity to which the word belongs.
The entity extraction result is an entity term in the first dialogue information detected by the algorithm and classification information of the entity term obtained by inquiring the entity term. It is understood that the entity extraction may be implemented by using methods such as SoftMax, CRF, Span pointer network, etc., and the present invention is not limited thereto.
Specifically, the server has a predefined entity extraction algorithm in advance, wherein the entity extraction algorithm is obtained by training according to specific data of a corresponding business field. And carrying out entity extraction on the first dialogue information input by the user by using a corresponding entity extraction algorithm to obtain entity words and classification information corresponding to the entity words.
In one embodiment, the terminal is an intelligent robot:
the user inquires: how much the gold card is spent in the year?
The intelligent robot transmits the 'gold card annual fee' to the server through the network, the server takes the 'gold card annual fee' as first dialogue information input by a user, entity extraction is carried out on the first dialogue information, and an entity extraction result is as follows: gold card (credit card) means that the gold card is classified by detecting that the entity is the gold card, and the gold card is the credit card.
The preset knowledge base is the question-answer pair information which is generated and recorded according to the inline service rule corresponding to the application field. For example, in the field of financial investment, a preset knowledge base records common financial management questions related to financial investment and answers corresponding to the questions.
Specifically, the entity words and the entity word classification are inquired in a preset knowledge base, the inquired question and answer pairs and first dialogue information input by a user are matched and calculated through a matching algorithm, and whether a matching result exists or not is determined according to a preset matching degree threshold value.
The preset matching degree threshold may be determined according to a service requirement, for example, if the guidance operation is normal, the matching degree threshold may be set to be 75%; if the specific service is actually handled, the threshold value of the matching degree can be set to be 85% -95%.
In step 206, if there is a matching result, the corresponding answer in the preset knowledge base is output as a reply message.
Specifically, when the matching calculation value obtained after the matching calculation is compared with the matching degree threshold value, if the matching calculation value is greater than the matching degree threshold value, it is determined that a matching result exists, and the answer in the inquired question and answer information is output to the terminal as the reply information.
In step 208, if there is no matching result, the stored context cache information is obtained, where the context cache information includes the second session information received in the current session and the syntax analysis result of each second session information.
The second dialogue information is the dialogue information input by the user in the previous rounds of dialogue in the current dialogue. The second dialogue information grammar analysis result is the analysis result obtained by analyzing the syntax and part of speech of the dialogue information input by the user in the first rounds of dialogue. Specifically, the syntactic analysis result is obtained by splitting a sentence according to a syntactic structure to obtain main sentence, predicate sentence, object, definite sentence, shape, complement sentence, and other related sentence main information corresponding to the sentence. The part-of-speech analysis result is part-of-speech information obtained by analyzing the part-of-speech of each word, such as nouns, verbs, auxiliary verbs and the like, after the words are segmented in the sentence.
Specifically, when the matching calculation value obtained after the matching calculation is compared with the matching degree threshold, if the matching calculation value is smaller than the matching degree threshold, it is determined that no matching result exists, and the server reads the context cache information stored in advance.
In one embodiment, the context cache information further comprises corresponding reply information output by the server according to the dialog information.
In one embodiment, the upper limit of the buffer capacity of the context buffer information is set according to the service requirements of the application field and the actual performance of the system, and if the context buffer information exceeds the preset upper limit value, the system will use the new context buffer information to cover the original context buffer information.
And step 210, if the first dialogue information can be fused with the context cache information, fusing the first dialogue information with the context cache information to obtain fused dialogue information, taking the fused dialogue information as the first dialogue information, and returning to the step of performing entity extraction on the first dialogue information.
Specifically, after the first dialog information and the context cache information are acquired and whether the two pieces of information can be fused is determined, the two pieces of information are fused to obtain fused dialog information, the dialog information is used as the first dialog information, and the new first dialog information is returned to the step 206 to repeat the steps. The information fusion refers to a process of modifying or supplementing the first dialogue information by using the information related to the first dialogue information existing in the context cache information.
The conversation method can perform grammar analysis according to the historical conversation information received in the conversation, the analysis results are stored in the context cache information according to the time sequence, when the conversation information input by the user is received and needs to be replied, the conversation information which can not directly obtain answers is automatically fused with the context cache information, and the optimal answer is found according to the fused conversation information. By using the conversation method, when the conversation information which can not directly obtain the answer is received, the complete conversation information can be obtained by means of analysis and extraction of the previous context cache information, so that the reply information which is more consistent with the current conversation context is matched to the user according to the complete conversation information, the success rate of the multiple rounds of conversations is greatly improved, meanwhile, as the conversation process does not need to manually add the linguistic data or perform the external logic on the whole conversation process, the workload of knowledge base management personnel is reduced, and the maintenance cost of the knowledge base in the later period is reduced.
In one embodiment, as shown in fig. 3, if the first dialog information can be merged with the context cache information, the step 210 of merging the first dialog information with the context cache information to obtain the merged dialog information includes the following steps:
step 302, determine a problem type of the first dialog information.
And if the first dialogue information cannot be matched with the corresponding question-answer pair in the preset knowledge base, the first dialogue information is considered to have a problem.
Specifically, when it is determined that the first dialogue information is not matched with the corresponding question-answer pair in the preset knowledge base, it is determined what kind of question the question of the first dialogue information belongs to.
If the problem type belongs to a fusible problem type, it is determined that the first dialog information can be fused with the context cache information, step 304.
If the problem exists in the first dialogue information, the problem can be solved by fusing the first dialogue information and the context cache information, and then the problem is classified into a fusible problem type. It is understood that in the present embodiment, the fusible problem types include, but are not limited to, subject missing, unknown reference, entity transition, and the like.
Specifically, if the problem in the first dialogue information is determined to be a fusible problem type after being judged, it is determined that the first dialogue information and the context cache information can be fused.
And step 306, fusing the first dialogue information and the context cache information by adopting a fusion mode corresponding to the problem type of the first dialogue information to obtain fused dialogue information.
Specifically, a corresponding fusion mode is determined according to the determined problem type of the first dialogue information, and the first dialogue information and the context cache information are fused by adopting the corresponding fusion mode to obtain fused information. Wherein, each question type has a corresponding fusion mode.
In this embodiment, when the first dialog information of the user cannot obtain the matching result in the preset knowledge base, the problem existing in the first dialog information is automatically judged, the problem type of the problem is determined, and the context cache information and the first dialog information are fused according to the fusion scheme corresponding to the problem type to obtain the fused dialog information. By using the session method in the embodiment, the problem that the first session information cannot obtain the matching result from the preset knowledge base can be automatically solved, the session success rate is improved, and the user experience is improved.
In one embodiment, step 302, determining the problem type of the first dialog information comprises the steps of:
step 1, carrying out syntactic analysis on the first dialogue information to obtain a syntactic analysis result.
Specifically, the first dialogue information is split according to the syntax structure to obtain a syntax analysis result, wherein the syntax analysis result is the main information, the predicate information, the object information, the fixed information, the shape information, the complement information and other related sentence main information corresponding to the first dialogue information,
and 2, determining the sentence structure of the first dialogue information and the part of speech of each word according to the syntactic analysis result.
Specifically, a sentence structure of the first dialogue information is first determined according to the syntactic analysis result; and performing word segmentation processing on the first dialogue information, and determining components, such as subjects, predicates, objects, pronouns and the like, of each word in the sentence according to the sentence structure and the syntactic analysis result.
And 3, determining the question type of the first dialogue information based on the sentence structure and the part of speech of each word.
Specifically, the question type of the first dialogue information is judged according to the sentence structure and the part of speech of the word, and the question type of the first dialogue information is determined.
In one embodiment, step 3, determining the question type of the first dialogue information based on the sentence structure and the part of speech of each word, includes the following steps:
if the sentence pattern structure is determined to lack the subject based on the part of speech of each word, determining the problem type of the first dialogue information as a missing subject; and if the words with the parts of speech as pronouns exist, determining the problem type of the first dialogue information as the unclear reference.
Specifically, if the part of speech of each word in the first dialogue information has no subject, the sentence structure of the first dialogue information is determined to be lack of the subject, and the problem type of the first dialogue information is defined as the missing subject. If there is a word with part of speech as a pronoun in each word of the first dialogue information, the pronoun does not have a proper referring word in the first information, and the problem type of the first dialogue information is defined as unknown referring.
In the above-described embodiment, the sentence structure of the first dialogue information and the part of speech of each word are determined by the result of the syntactic analysis, thereby determining the question type of the first dialogue information. By using the method in the embodiment, the problem type of the first dialogue information can be determined quickly and accurately, and the subsequent judgment of whether the first dialogue information can be fused with the context cache information and the subsequent search of the fusion mode corresponding to the problem type are facilitated.
In one embodiment, step 302, determining the question type of the first dialog information further comprises: determining the problem type of the first dialog information as entity transition if the entity of the first dialog information is different from the entity in the context cache information.
And the entity in the context cache is the entity which extracts the last round of session information in the current conversation.
Specifically, the entity words extracted from the first session information are compared with the entity words extracted from the previous session information, and if the two are different, the problem type of the first session information is determined to be entity transition.
In this embodiment, the problem type of the first dialogue information is determined by comparing the entity words of the current round of dialogue with the entity words of the previous round of dialogue cached in the context cache information. By using the method in the embodiment, whether the entity in the first dialogue western information is changed or not can be automatically judged through the first dialogue information and the context cache information, so that the problem type of the first dialogue information can be quickly and accurately determined, the subsequent judgment of whether the first dialogue information can be fused with the context cache information or not and the subsequent search of the fusion mode corresponding to the problem type are facilitated.
In one embodiment, step 306, fusing the first dialog information and the context cache information by using a fusion mode corresponding to the question type of the first dialog information to obtain fused dialog information, includes the following steps:
and step 1, if the problem type is a missing subject, searching the subject from the context cache information, and completing the subject into the first dialogue information to obtain the merged dialogue information.
Specifically, when the problem type of the first dialogue information is determined to be the missing subject, context cache information is obtained, subject information in the previous round of conversation is searched in the context cache information, the subject is complemented into the first dialogue information, and the merged dialogue information is obtained.
In one embodiment, the bank credit card business handling is used as an application environment, and the terminal is an intelligent robot:
the context cache information caches the session information of the first rounds:
the user: you good, i want to do a credit card.
Wherein, the sentence pattern analysis: subject (i), predicate (wanted), object (information card). Word segmentation: hello (helpword), me (noun), want to do (verb), open (quantifier), credit card (noun)
The robot comprises: good, I have gold card, silver card and ordinary card now three kinds.
The user: how many years are the bank card required?
Wherein, the sentence pattern analysis: subject (silver), predicate (required), object (year). Word segmentation: silver card (noun), needs (verb), number (doubtful word), annual fee (noun).
The robot comprises: 200 yuan per year.
Taking the dialog information input by the user at this time as first dialog information:
the user: is there a gift for insurance?
Wherein, the sentence pattern analysis: subject (none), predicate (present), object (insurance). Word segmentation: there are (verbs), gifts (verbs), insurance (nouns).
At this time, the server can know from the parsing result that the problem type of the first session information is the missing subject, and then obtains the session information of the previous round in the context cache information:
the user: how many years are the bank card required?
Wherein, the sentence pattern analysis: subject (silver), predicate (required), object (year). Word segmentation: silver card (noun), needs (verb), number (doubtful word), annual fee (noun).
The robot comprises: 200 yuan per year.
Finding out that the subject is the silver card from the conversation information, and completing the silver card to the subject position of the first conversation information to obtain the fused conversation information as follows: is the bank card present with insurance?
And 2, if the problem type is unknown, searching words matched with the pronouns from the context cache information based on the positions of the pronouns in the first dialogue information, replacing the pronouns in the first dialogue information with the words, and obtaining the merged dialogue information.
Specifically, when the problem type of the first dialogue information is determined to be unknown, the position of the pronouns in the first dialogue information is determined, the context cache information is obtained, words matched with the pronouns in the previous conversation are searched in the context cache information, the pronouns in the first dialogue information are replaced by the words, and the merged dialogue information is obtained.
In one embodiment, the bank credit card business handling is used as an application environment, and the terminal is an intelligent robot:
the context cache information caches the session information of the first rounds:
the user: you good, i want to do a credit card.
Wherein, the sentence pattern analysis: subject (i), predicate (wanted), object (information card). Word segmentation: hello (helpword), me (noun), want to do (verb), open (quantifier), credit card (noun)
The robot comprises: good, I have gold card, silver card and ordinary card now three kinds.
The user: how many years are the bank card required?
Wherein, the sentence pattern analysis: subject (silver), predicate (required), object (year). Word segmentation: silver card (noun), needs (verb), number (doubtful word), annual fee (noun).
The robot comprises: 200 yuan per year.
Taking the dialog information input by the user at this time as first dialog information:
the user: is it a gift for insurance?
Wherein, the sentence pattern analysis: subject (it), predicate (with gift), object (insurance). Word segmentation: it (pronouns), has (verbs), gifts (verbs), insurance (nouns).
At this time, the server can know from the parsing result that if the problem type of the first session information is unknown, the server obtains the session information of the previous round in the context cache information:
the user: how many years are the bank card required?
Wherein, the sentence pattern analysis: subject (silver), predicate (required), object (year). Word segmentation: silver card (noun), needs (verb), number (doubtful word), annual fee (noun).
The robot comprises: 200 yuan per year.
Finding out noun as silver card from the conversation information, using the silver card to replace pronoun (it) in the first conversation information, obtaining the fused conversation information: is the bank card present with insurance?
And 3, if the problem type is entity conversion, replacing the entity in the first dialogue information by the entity in the context cache information to obtain the merged dialogue information, or replacing the entity in the context cache information by the entity in the first dialogue information to obtain the merged dialogue information.
Specifically, after the problem type of the first dialogue information is determined to be entity conversion, context cache information is obtained, entity words extracted in the previous round of conversation are searched in the context cache information, the entity words in the first dialogue information are replaced by the entity words, and fused dialogue information is obtained. Or the entity in the first session information is replaced by the entity in the previous session information, and other information in the previous session information is reserved to obtain the fused session information.
In one embodiment, the bank credit card business handling is used as an application environment, and the terminal is an intelligent robot:
the context cache information caches the session information of the first rounds:
the user: you good, i want to do a credit card.
Wherein, the sentence pattern analysis: subject (i), predicate (wanted), object (information card). Word segmentation: hello (helpword), me (noun), want to do (verb), open (quantifier), credit card (noun)
The robot comprises: good, I have gold card, silver card and ordinary card now three kinds.
The user: how much the gold card is spent in the year?
Wherein, the sentence pattern analysis: subject (gold card, annual fee), object (size). Word segmentation: gold card (noun), annual fee (noun), size (doubtful word). And (3) entity extraction: gold card (credit card).
Machine: 800 a year, but a life accident risk with 500 ten thousand of value is given.
Taking the dialog information input by the user at this time as first dialog information:
the user: silver card coating?
Wherein, the sentence pattern analysis: none. Word segmentation: silver cards (nouns), wool (interrogatories). And (3) entity extraction: silver cards (credit cards).
Specifically, taking the 'silver card wool' as the first session information, the matching result cannot be obtained in the preset knowledge base, and the previous round of session information in the context cache information is obtained:
the user: how much the gold card is spent in the year?
Wherein, the sentence pattern analysis: subject (gold card, annual fee), object (size). Word segmentation: gold card (noun), annual fee (noun), size (doubtful word). And (3) entity extraction: gold card (credit card).
Machine: 800 a year, but a life accident risk with 500 ten thousand of value is given.
It can be seen that the entity in the previous round of session information is a gold card (credit card), the entity in the first round of session information is replaced by a silver card, and the fused session information is obtained: how much a bank card year is spent?
In the above embodiment, after the problem type of the first dialog information is determined, the first dialog information is fused with the statement cache information according to the fusion mode corresponding to the problem type, so as to obtain the fused dialog information. By using the method of the embodiment, when the first dialogue information can not obtain the matching result in the preset knowledge base, the first dialogue information can be automatically fused with the context cache information according to the fusion mode corresponding to the type of the problem of the first dialogue information, the problem in the first dialogue information is solved by using the statement cache information, the whole dialogue process does not need to be artificially added in a prediction mode or subjected to a foreign logic mode, the success rate of multiple rounds of dialogue is improved, the workload of knowledge base management personnel is reduced, and the maintenance cost of the knowledge base in the later period is greatly reduced.
In one embodiment, step 306, fusing the first dialog information and the context cache information in a fusion manner corresponding to the question type of the first dialog information, and after obtaining the fused dialog information, the method further includes: and if the question type does not belong to the fusible question type, determining that the first dialogue information cannot be fused with the context cache information, determining a question return question based on the first dialogue information, and replying the question return question as reply information.
Specifically, if it is determined that the question type of the first dialog information does not belong to the fusible question type, the first dialog information cannot solve its own question by fusing with the context cache information, and at this time, a question return question is generated based on the first dialog information and is replied as reply information.
In one embodiment, the bank credit card business handling is used as an application environment, and the terminal is an intelligent robot:
the information input by the user at this time is the first dialogue information:
the user: you good, i want to do a card.
Wherein, the sentence pattern analysis: subject (i), predicate (wanted), object (card). Word segmentation: hello (helpword), me (noun), wanted-to-do (verb), sheet (quantifier), card (noun).
And (3) entity extraction: air conditioner
Specifically, the specific information of the card is not clear here, and the context cache information of the current session is not generated in the system, so that the question type of the first session information does not belong to the fusible question type, and the server generates a question back according to the ambiguous information in the first session information, that is: ask what card you want to do? And outputting the question as reply information to the intelligent robot terminal, and replying the user question.
In this embodiment, when it is determined that the question type of the first dialogue information does not belong to the fusible question type, the server generates a corresponding question response according to ambiguous information in the first dialogue information, and replies to the user question with the question response as reply information. By using the method in the embodiment, when the first dialogue information is ambiguous, a corresponding question can be generated, and more information can be obtained through the response of the user to the question, so that the best matching reply information can be obtained. The whole conversation process does not need to be artificially added or subjected to external logic, the workload of knowledge base management personnel is reduced while the success rate of multiple rounds of conversations is improved, and the maintenance cost of the knowledge base in the later period is greatly reduced.
In one embodiment, as shown in fig. 4, there is provided a conversation method, including the steps of:
the embodiment relates to a terminal and a server, and the terminal is taken as an example of an intelligent robot and is applied to a banking business handling environment. The intelligent robot is communicated with the server through a network, receives conversation information input by a user and sends the conversation information to the server through the network, and the server comprises a data storage system which stores a preset knowledge base and context cache information. The context cache information comprises second dialogue information received in the dialogue and a grammar analysis result of each second dialogue information. The second dialogue information is the dialogue information input by the user in the previous rounds of dialogue in the current dialogue. The preset knowledge base is the question-answer pair information which is generated and recorded according to the inline business rules corresponding to the application field.
The intelligent robot receives conversation information input by a user, the conversation information is sent to a server through a network, and the server takes the received conversation information as first conversation information; and extracting the keywords in the first dialogue information, comparing the extracted keywords with the keywords in the context cache information, and determining whether the dialogue context is changed.
If the conversation context is changed, context cache information of the current conversation context is created in the server, and then syntactic analysis is carried out on the first conversation information; if the session context does not send a change, the first session information is parsed directly.
And segmenting words of the sentences in the first dialogue information, and determining the part of speech of each word in the first dialogue information according to the syntactic analysis result. And simultaneously performing entity extraction on the first dialogue information. The analysis results are recorded in the context cache information of the created current session context.
And inquiring a preset knowledge base according to the extracted entity, matching the first dialogue information with question and answer information inquired according to the entity, and determining whether a matching result exists. If the matching result exists, the answer information in the matching result is used as reply information to be returned to the intelligent robot; and if the matching result does not exist, determining the problem type of the first dialogue information.
If the problem type is subject missing, searching the subject from the context cache information to complete the conversation information of the first conversation information; if the problem type is that the reference is unknown, searching corresponding reference words from the context cache information for replacement; if the problem type is entity conversion, the corresponding entity words are searched from the context cache information for replacement. And if the types of the existing questions do not belong to the three types, generating a question return question according to the first dialogue information, sending the question return question to the intelligent robot, returning the question to the user and further collecting the information. And replying the answer dialogue information according to the question asked by the user, sending the answer dialogue information to the server by the intelligent robot, taking the received answer dialogue information as new first dialogue information by the server, and returning to the step of judging whether the sentence is sent or not. Until the session is ended.
It should be understood that, although the steps in the flowcharts related to the embodiments are shown in sequence as indicated by the arrows, the steps are not necessarily executed in sequence as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a part of the steps in the flowcharts related to the above embodiments may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of performing the steps or stages is not necessarily sequential, but may be performed alternately or alternately with other steps or at least a part of the steps or stages in other steps.
Based on the same inventive concept, the embodiment of the present application further provides a session device for implementing the above-mentioned session method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme described in the above method, so specific limitations in one or more embodiments of the session device provided below can refer to the limitations on the session method in the foregoing, and details are not described herein again.
In one embodiment, as shown in fig. 5, there is provided a conversation apparatus including: an entity matching module 402, a matching result judging module 404 and an information fusion module 406, wherein:
an entity matching module 402, configured to receive first session information input by a user; and performing entity extraction on the first dialogue information to obtain an entity extraction result, and matching the entity extraction result in a preset knowledge base.
A matching result determining module 404, configured to output a corresponding answer in the preset knowledge base as a reply message if a matching result exists; and if the matching result does not exist, obtaining the stored context cache information, wherein the context cache information comprises second dialogue information received in the dialogue and the grammar analysis result of each second dialogue information.
And an information fusion module 406, configured to fuse the first session information with the context cache information if the first session information can be fused with the context cache information, obtain fused session information, use the fused session information as the first session information, and return to the step of performing entity extraction on the first session information.
The conversation device can perform grammar analysis according to historical conversation information received in the conversation, stores analysis results in the context cache information according to the time sequence, automatically fuses the conversation information which cannot directly obtain answers with the context cache information when the conversation information input by a user is received and the user needs to reply, and finds the optimal answer according to the fused conversation information. By using the conversation device, when the conversation information which can not directly obtain answers is received, the complete conversation information can be obtained by means of analysis and extraction of the previous context cache information, so that the reply information which is more consistent with the current conversation context is matched to the user according to the complete conversation information, the success rate of multiple rounds of conversation is greatly improved, and meanwhile, the conversation process does not need artificial corpus addition or external logic on the whole conversation process, the workload of knowledge base management personnel is reduced, and the maintenance cost of a knowledge base in the later period is reduced.
In one embodiment, the information fusion module, when the first dialog information can be fused with the context cache information, and the first dialog information is fused with the context cache information, and the fused dialog information is obtained, includes: a question type for determining first dialogue information; if the problem type belongs to a fusible problem type, determining that the first session information can be fused with context cache information; and fusing the first dialogue information and the context cache information by adopting a fusion mode corresponding to the problem type of the first dialogue information to obtain fused dialogue information.
In one embodiment, the manner of determining the question type of the first dialogue information by the information fusion module comprises the following steps: the first dialogue information is used for carrying out syntactic analysis to obtain a syntactic analysis result; determining a sentence pattern structure of the first dialogue information and the part of speech of each word according to the syntactic analysis result; based on the sentence structure and the part of speech of each word, the question type of the first dialogue information is determined.
In one embodiment, the information fusion module, when determining the question type of the first dialogue information based on the sentence structure and the part of speech of each word, includes: determining the question type of the first dialogue information as a missing subject if the sentence pattern structure is determined to lack the subject based on the part of speech of each word; and if the words with the parts of speech as pronouns exist, determining the problem type of the first dialogue information as the unclear reference.
In one embodiment, when determining the question type of the first dialog information based on the sentence structure and the part of speech of each word, the information fusion module further includes: the method further includes determining that the type of problem with the first dialog information is an entity transition if the entity of the first dialog information is different from the entity in the context cache information.
In one embodiment, the information fusion module, when fusing the first dialog information and the context cache information in a fusion mode corresponding to the problem type of the first dialog information to obtain fused dialog information, includes:
if the problem type is a missing subject, searching the subject from the context cache information, and completing the subject into the first dialogue information to obtain the merged dialogue information; if the problem type is unknown, based on the position of the pronouns in the first dialogue information, searching words matched with the pronouns from the context cache information, replacing the pronouns in the first dialogue information with the words, obtaining the merged dialogue information, if the problem type is entity conversion, replacing the entities in the first dialogue information with the entities in the context cache information, obtaining the merged dialogue information, or replacing the entities in the context cache information with the entities in the first dialogue information, and obtaining the merged dialogue information.
In one embodiment, the session device further includes: question module is asked;
the question return module is used for determining that the first dialogue information cannot be fused with the context cache information if the question type does not belong to the fusible question type, determining a question return based on the first dialogue information, and replying the question return as reply information.
The respective modules in the above-described session device may be implemented in whole or in part by software, hardware, and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as shown in fig. 6. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for storing preset knowledge base data and context cache information data. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a conversational method.
Those skilled in the art will appreciate that the architecture shown in fig. 6 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
receiving first dialogue information input by a user;
performing entity extraction on the first dialogue information to obtain an entity extraction result; matching the entity extraction result in a preset knowledge base;
if the matching result exists, outputting the corresponding answer in the preset knowledge base as the reply information;
if the matching result does not exist, obtaining stored context cache information, wherein the context cache information comprises second dialogue information input by a user and received in the dialogue, and a syntax analysis result of each second dialogue information;
and if the first dialogue information can be fused with the context cache information, fusing the first dialogue information with the context cache information to obtain fused dialogue information, taking the fused dialogue information as the first dialogue information, and returning to the step of performing entity extraction on the first dialogue information.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
determining a problem type of the first dialogue information;
if the problem type belongs to a fusible problem type, determining that the first session information can be fused with context cache information;
and fusing the first dialogue information and the context cache information by adopting a fusion mode corresponding to the problem type of the first dialogue information to obtain fused dialogue information.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
performing syntactic analysis on the first dialogue information to obtain a syntactic analysis result;
determining a sentence pattern structure of the first dialogue information and the part of speech of each word according to the syntactic analysis result;
based on the sentence structure and the part of speech of each word, the question type of the first dialogue information is determined.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
if the sentence pattern structure is determined to lack the subject based on the part of speech of each word, determining the problem type of the first dialogue information as a missing subject;
and if the words with the parts of speech as pronouns exist, determining the problem type of the first dialogue information as the unclear reference.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
determining the problem type of the first dialog information as entity transition if the entity of the first dialog information is different from the entity in the context cache information.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
if the problem type is a missing subject, searching the subject from the context cache information, and completing the subject into the first dialogue information to obtain the merged dialogue information;
if the problem type is unknown, searching words matched with the pronouns from the context cache information based on the positions of the pronouns in the first dialogue information, replacing the pronouns in the first dialogue information with the words, and obtaining the merged dialogue information;
and if the problem type is entity conversion, replacing the entity in the first dialogue information by the entity in the context cache information to obtain the merged dialogue information, or replacing the entity in the context cache information by the entity in the first dialogue information to obtain the merged dialogue information.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
and if the question type does not belong to the fusible question type, determining that the first dialogue information cannot be fused with the context cache information, determining a question return question based on the first dialogue information, and replying the question return question as reply information.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
receiving first dialogue information input by a user;
performing entity extraction on the first dialogue information to obtain an entity extraction result; matching the entity extraction result in a preset knowledge base;
if the matching result exists, outputting the corresponding answer in the preset knowledge base as the reply information;
if the matching result does not exist, obtaining stored context cache information, wherein the context cache information comprises second dialogue information input by a user and received in the dialogue, and a syntax analysis result of each second dialogue information;
and if the first dialogue information can be fused with the context cache information, fusing the first dialogue information with the context cache information to obtain fused dialogue information, taking the fused dialogue information as the first dialogue information, and returning to the step of performing entity extraction on the first dialogue information.
In one embodiment, the computer program when executed by the processor further performs the steps of:
determining a problem type of the first dialogue information;
if the problem type belongs to a fusible problem type, determining that the first session information can be fused with context cache information;
and fusing the first dialogue information and the context cache information by adopting a fusion mode corresponding to the problem type of the first dialogue information to obtain fused dialogue information.
In one embodiment, the computer program when executed by the processor further performs the steps of:
performing syntactic analysis on the first dialogue information to obtain a syntactic analysis result;
determining a sentence pattern structure of the first dialogue information and the part of speech of each word according to the syntactic analysis result;
based on the sentence structure and the part of speech of each word, the question type of the first dialogue information is determined.
In one embodiment, the computer program when executed by the processor further performs the steps of:
if the sentence pattern structure is determined to lack the subject based on the part of speech of each word, determining the problem type of the first dialogue information as a missing subject;
and if the words with the parts of speech as pronouns exist, determining the problem type of the first dialogue information as the unclear reference.
In one embodiment, the computer program when executed by the processor further performs the steps of:
determining the problem type of the first dialog information as entity transition if the entity of the first dialog information is different from the entity in the context cache information.
In one embodiment, the computer program when executed by the processor further performs the steps of:
if the problem type is a missing subject, searching the subject from the context cache information, and completing the subject into the first dialogue information to obtain the merged dialogue information;
if the problem type is unknown, searching words matched with the pronouns from the context cache information based on the positions of the pronouns in the first dialogue information, replacing the pronouns in the first dialogue information with the words, and obtaining the merged dialogue information;
and if the problem type is entity conversion, replacing the entity in the first dialogue information by the entity in the context cache information to obtain the merged dialogue information, or replacing the entity in the context cache information by the entity in the first dialogue information to obtain the merged dialogue information.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and if the question type does not belong to the fusible question type, determining that the first dialogue information cannot be fused with the context cache information, determining a question return question based on the first dialogue information, and replying the question return question as reply information.
In one embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, performs the steps of:
receiving first dialogue information input by a user;
performing entity extraction on the first dialogue information to obtain an entity extraction result; matching the entity extraction result in a preset knowledge base;
if the matching result exists, outputting the corresponding answer in the preset knowledge base as the reply information;
if the matching result does not exist, obtaining stored context cache information, wherein the context cache information comprises second dialogue information input by a user and received in the dialogue, and a syntax analysis result of each second dialogue information;
and if the first dialogue information can be fused with the context cache information, fusing the first dialogue information with the context cache information to obtain fused dialogue information, taking the fused dialogue information as the first dialogue information, and returning to the step of performing entity extraction on the first dialogue information.
In one embodiment, the computer program when executed by the processor further performs the steps of:
determining a problem type of the first dialogue information;
if the problem type belongs to a fusible problem type, determining that the first session information can be fused with context cache information;
and fusing the first dialogue information and the context cache information by adopting a fusion mode corresponding to the problem type of the first dialogue information to obtain fused dialogue information.
In one embodiment, the computer program when executed by the processor further performs the steps of:
performing syntactic analysis on the first dialogue information to obtain a syntactic analysis result;
determining a sentence pattern structure of the first dialogue information and the part of speech of each word according to the syntactic analysis result;
based on the sentence structure and the part of speech of each word, the question type of the first dialogue information is determined.
In one embodiment, the computer program when executed by the processor further performs the steps of:
if the sentence pattern structure is determined to lack the subject based on the part of speech of each word, determining the problem type of the first dialogue information as a missing subject;
and if the words with the parts of speech as pronouns exist, determining the problem type of the first dialogue information as the unclear reference.
In one embodiment, the computer program when executed by the processor further performs the steps of:
determining the problem type of the first dialog information as entity transition if the entity of the first dialog information is different from the entity in the context cache information.
In one embodiment, the computer program when executed by the processor further performs the steps of:
if the problem type is a missing subject, searching the subject from the context cache information, and completing the subject into the first dialogue information to obtain the merged dialogue information;
if the problem type is unknown, searching words matched with the pronouns from the context cache information based on the positions of the pronouns in the first dialogue information, replacing the pronouns in the first dialogue information with the words, and obtaining the merged dialogue information;
and if the problem type is entity conversion, replacing the entity in the first dialogue information by the entity in the context cache information to obtain the merged dialogue information, or replacing the entity in the context cache information by the entity in the first dialogue information to obtain the merged dialogue information.
In one embodiment, the computer program when executed by the processor further performs the steps of:
and if the question type does not belong to the fusible question type, determining that the first dialogue information cannot be fused with the context cache information, determining a question return question based on the first dialogue information, and replying the question return question as reply information.
It should be noted that, the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, presented data, etc.) referred to in the present application are information and data authorized by the user or sufficiently authorized by each party.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high-density embedded nonvolatile Memory, resistive Random Access Memory (ReRAM), Magnetic Random Access Memory (MRAM), Ferroelectric Random Access Memory (FRAM), Phase Change Memory (PCM), graphene Memory, and the like. Volatile Memory can include Random Access Memory (RAM), external cache Memory, and the like. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others. The databases referred to in various embodiments provided herein may include at least one of relational and non-relational databases. The non-relational database may include, but is not limited to, a block chain based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, quantum computing based data processing logic devices, etc., without limitation.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.

Claims (17)

1. A method for a session, the method comprising:
receiving first dialogue information input by a user;
performing entity extraction on the first dialogue information to obtain an entity extraction result; matching the entity extraction result in a preset knowledge base;
if the matching result exists, outputting the corresponding answer in the preset knowledge base as reply information;
if the matching result does not exist, obtaining stored context cache information, wherein the context cache information comprises second dialogue information input by the user and received in the dialogue at the time, and a syntax analysis result of each second dialogue information;
and if the first dialogue information can be fused with the context cache information, fusing the first dialogue information with the context cache information to obtain fused dialogue information, taking the fused dialogue information as the first dialogue information, and returning to the step of performing entity extraction on the first dialogue information.
2. The method of claim 1, wherein the merging the first session information with the context cache information to obtain merged session information if the first session information can be merged with the context cache information comprises:
determining a question type of the first dialog information;
determining that the first dialog information can be fused with the context cache information if the question type belongs to a fusible question type;
and fusing the first dialogue information and the context cache information by adopting a fusion mode corresponding to the problem type of the first dialogue information to obtain fused dialogue information.
3. The method of claim 2, wherein the determining the problem type of the first dialog information comprises:
performing syntactic analysis on the first dialogue information to obtain a syntactic analysis result;
determining a sentence structure of the first dialogue information and the part of speech of each word according to the syntactic analysis result;
determining a question type of the first dialogue information based on the sentence structure and the part of speech of each word.
4. The method of claim 3, wherein determining the question type of the first dialog information based on the sentence structure and the part of speech of each word comprises:
if the sentence pattern structure is determined to lack the subject based on the part of speech of each word, determining the problem type of the first dialogue information as a missing subject;
and if the words with the parts of speech as pronouns exist, determining the problem type of the first dialogue information as unknown.
5. The method of claim 3, wherein the determining the problem type of the first dialog information further comprises:
determining a problem type of the first dialog information as an entity transition if the entity of the first dialog information is different from the entity in the context cache information.
6. The method according to claim 5, wherein the fusing the first dialog information with the context cache information in a fusion manner corresponding to the question type of the first dialog information to obtain fused dialog information comprises:
if the problem type is a missing subject, searching a subject from the context cache information, and completing the subject into the first dialogue information to obtain merged dialogue information;
if the question type is unknown, searching a word matched with the pronouns from the context cache information based on the position of the pronouns in the first dialogue information, replacing the pronouns in the first dialogue information with the words, and obtaining the merged dialogue information;
and if the problem type is entity conversion, replacing the entity in the first dialogue information by the entity in the context cache information to obtain the merged dialogue information, or replacing the entity in the context cache information by the entity in the first dialogue information to obtain the merged dialogue information.
7. The method of claim 2, further comprising:
and if the question type does not belong to the fusible question type, determining that the first dialogue information cannot be fused with the context cache information, determining a question return question based on the first dialogue information, and replying the question return question as reply information.
8. A conversation apparatus, characterized in that the apparatus comprises:
the entity matching module is used for receiving first dialogue information input by a user; performing entity extraction on the first dialogue information to obtain an entity extraction result, and matching the entity extraction result in a preset knowledge base;
the matching result judging module is used for outputting the corresponding answer in the preset knowledge base as the reply information if the matching result exists; if the matching result does not exist, obtaining stored context cache information, wherein the context cache information comprises second dialogue information input by the user and received in the dialogue at the time, and a syntax analysis result of each second dialogue information;
and the information fusion module is used for fusing the first dialogue information and the context cache information to obtain fused dialogue information if the first dialogue information can be fused with the context cache information, and returning the step of performing entity extraction on the first dialogue information by taking the fused dialogue information as the first dialogue information.
9. The apparatus of claim 8, wherein the information fusion module, when fusing the first session information with the context cache information to obtain fused session information if the first session information can be fused with the context cache information, comprises: a question type for determining the first dialog information; determining that the first dialog information can be fused with the context cache information if the question type belongs to a fusible question type; and fusing the first dialogue information and the context cache information by adopting a fusion mode corresponding to the problem type of the first dialogue information to obtain fused dialogue information.
10. The apparatus of claim 9, wherein the information fusion module determines the problem type of the first dialog information by: the first dialogue information is used for carrying out syntactic analysis to obtain a syntactic analysis result; determining a sentence structure of the first dialogue information and the part of speech of each word according to the syntactic analysis result; determining a question type of the first dialogue information based on the sentence structure and the part of speech of each word.
11. The apparatus of claim 10, wherein the information fusion module, when determining the question type of the first dialog information based on the sentence structure and the part of speech of each word, comprises: determining the question type of the first dialogue information as a missing subject if the sentence structure is determined to lack the subject based on the part of speech of each word; and if the words with the parts of speech as pronouns exist, determining the problem type of the first dialogue information as unknown.
12. The apparatus of claim 10, wherein the information fusion module, when determining the question type of the first dialog information based on the sentence structure and the part of speech of each word, further comprises: determining that the type of problem for the first dialog information is an entity transition if the entity for the first dialog information is different from the entity in the context cache information.
13. The apparatus according to claim 11, wherein the information fusion module, when fusing the first dialog information and the context cache information in a fusion manner corresponding to the question type of the first dialog information to obtain fused dialog information, includes:
if the problem type is a missing subject, finding a subject from the context cache information, and completing the subject into the first dialogue information to obtain merged dialogue information; if the problem type is unknown, searching a word matched with the pronouns from the context cache information based on the position of the pronouns in the first dialogue information, replacing the pronouns in the first dialogue information with the words, obtaining fused dialogue information, if the problem type is entity conversion, replacing the entity in the first dialogue information with the entity in the context cache information, obtaining the fused dialogue information, or replacing the entity in the context cache information with the entity in the first dialogue information, and obtaining the fused dialogue information.
14. The apparatus of claim 9, further comprising: question module is asked;
the question return module is used for determining that the first dialogue information can not be fused with the context cache information if the question type does not belong to a fusible question type, determining a question return based on the first dialogue information, and returning the question return as a reply message.
15. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 7.
16. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
17. A computer program product comprising a computer program, characterized in that the computer program realizes the steps of the method of any one of claims 1 to 7 when executed by a processor.
CN202111402647.3A 2021-11-19 2021-11-19 Session method, apparatus and computer program product Pending CN114239602A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111402647.3A CN114239602A (en) 2021-11-19 2021-11-19 Session method, apparatus and computer program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111402647.3A CN114239602A (en) 2021-11-19 2021-11-19 Session method, apparatus and computer program product

Publications (1)

Publication Number Publication Date
CN114239602A true CN114239602A (en) 2022-03-25

Family

ID=80750897

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111402647.3A Pending CN114239602A (en) 2021-11-19 2021-11-19 Session method, apparatus and computer program product

Country Status (1)

Country Link
CN (1) CN114239602A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117743559A (en) * 2024-02-20 2024-03-22 厦门国际银行股份有限公司 Multi-round dialogue processing method, device and equipment based on RAG

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117743559A (en) * 2024-02-20 2024-03-22 厦门国际银行股份有限公司 Multi-round dialogue processing method, device and equipment based on RAG

Similar Documents

Publication Publication Date Title
WO2021042503A1 (en) Information classification extraction method, apparatus, computer device and storage medium
CN110717514A (en) Session intention identification method and device, computer equipment and storage medium
CN111859960A (en) Semantic matching method and device based on knowledge distillation, computer equipment and medium
CN111222305A (en) Information structuring method and device
CN110033382B (en) Insurance service processing method, device and equipment
CN110162780A (en) The recognition methods and device that user is intended to
CN111309881A (en) Method and device for processing unknown questions in intelligent question answering, computer equipment and medium
CN111177307A (en) Test scheme and system based on semantic understanding similarity threshold configuration
WO2019227629A1 (en) Text information generation method and apparatus, computer device and storage medium
CN112926308A (en) Method, apparatus, device, storage medium and program product for matching text
CN110399473B (en) Method and device for determining answers to user questions
CN115481229A (en) Method and device for pushing answer call, electronic equipment and storage medium
US11875128B2 (en) Method and system for generating an intent classifier
CN114239602A (en) Session method, apparatus and computer program product
Ali et al. K-means clustering to improve the accuracy of decision tree response classification
CN110931002B (en) Man-machine interaction method, device, computer equipment and storage medium
CN113111157B (en) Question-answer processing method, device, computer equipment and storage medium
CN112580366B (en) Emotion recognition method, electronic device and storage device
CN113095073B (en) Corpus tag generation method and device, computer equipment and storage medium
CA3170100A1 (en) Text processing method and device and computer-readable storage medium
CN116150353A (en) Training method for intention feature extraction model, intention recognition method and related device
CN114333813A (en) Implementation method and device for configurable intelligent voice robot and storage medium
CN116541517A (en) Text information processing method, apparatus, device, software program, and storage medium
CN113362169A (en) Catalytic recovery optimization method and device
CN111552785A (en) Method and device for updating database of human-computer interaction system, computer equipment and 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