CN115730591A - User service method, device, equipment and storage medium based on knowledge graph - Google Patents

User service method, device, equipment and storage medium based on knowledge graph Download PDF

Info

Publication number
CN115730591A
CN115730591A CN202211529331.5A CN202211529331A CN115730591A CN 115730591 A CN115730591 A CN 115730591A CN 202211529331 A CN202211529331 A CN 202211529331A CN 115730591 A CN115730591 A CN 115730591A
Authority
CN
China
Prior art keywords
entity
user
preset
text
slot filling
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
CN202211529331.5A
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.)
Shanghai Pudong Development Bank Co Ltd
Original Assignee
Shanghai Pudong Development Bank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Pudong Development Bank Co Ltd filed Critical Shanghai Pudong Development Bank Co Ltd
Priority to CN202211529331.5A priority Critical patent/CN115730591A/en
Publication of CN115730591A publication Critical patent/CN115730591A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention discloses a user service method, a device, equipment and a storage medium based on a knowledge graph, wherein the method comprises the following steps: acquiring a user query text to be replied, and performing word segmentation and feature extraction processing on the user query text to obtain a feature vector sequence corresponding to a word sequence of the user query text; inputting the characteristic vector sequence into a preset intention recognition model to obtain a query field and an intention recognition result of the user query text; inputting the characteristic vector sequence into a preset entity slot filling model to obtain a target entity slot filling result of the user query text; and on the basis of a preset user service knowledge graph, generating a target inquiry reply text according to the inquiry field, the intention identification result and the target entity slot filling result, and completing user service. The technical scheme of the embodiment of the invention can improve the accuracy of the robot customer service recognition semantics.

Description

User service method, device, equipment and storage medium based on knowledge graph
Technical Field
The embodiment of the invention relates to the technical field of artificial intelligence, in particular to a user service method, a user service device, user service equipment and a storage medium based on a knowledge graph.
Background
In some business fields, in order to improve the efficiency of serving customers, the semantics of the users are recognized by robot customer service in an artificial intelligence mode, and information interaction is performed with the customers. In the process of serving the client, the robot service determines the user intention through understanding, clarifying and the like, and performs the next action based on the intention recognition result, such as answering, calling an API and the like to complete the service task.
However, because the language habits of different users are different, the same language characters have different semantics in different scenes, and the accuracy of the robot customer service in identifying the client semantics still needs to be improved.
Disclosure of Invention
The embodiment of the invention provides a knowledge graph-based user service method, a knowledge graph-based user service device, a knowledge graph-based user service equipment and a storage medium, so that the accuracy of recognizing semantics of characters with the same language in different scenes can be improved by a robot customer service, and the accuracy of recognizing the semantics of a client by the robot customer service is improved.
In a first aspect, an embodiment of the present invention provides a method for providing a user service based on a knowledge graph, where the method includes:
acquiring a user query text to be replied, and performing word segmentation and feature extraction processing on the user query text to obtain a feature vector sequence corresponding to a word sequence of the user query text;
inputting the characteristic vector sequence into a preset intention recognition model to obtain a query field and an intention recognition result of the user query text;
inputting the characteristic vector sequence into a preset entity slot filling model to obtain a target entity slot filling result of the user query text, wherein the preset entity slot filling model is a model obtained by training under the common constraint of a loss function of the preset intention recognition model and a corresponding slot filling model loss function;
and on the basis of a preset user service knowledge graph, generating a target inquiry reply text according to the inquiry field, the intention identification result and the target entity slot filling result, and completing user service.
In a second aspect, an embodiment of the present invention provides a knowledge-graph-based user service apparatus, where the apparatus includes:
the query text acquisition module is used for acquiring a query text of a user to be replied, and performing word segmentation and feature extraction processing on the query text of the user to obtain a feature vector sequence corresponding to a word sequence of the query text of the user;
the text intention identification module is used for inputting the characteristic vector sequence into a preset intention identification model to obtain an inquiry field, an intention identification result and a corresponding intention identification loss function of the user inquiry text;
the entity slot filling module is used for inputting the characteristic vector sequence into a preset entity slot filling model, and enabling the preset entity slot filling model to output a target entity slot filling result of the user query text under the common constraint of the intention recognition loss function and the corresponding slot filling loss function;
and the reply text generation module is used for generating a target inquiry reply text according to the inquiry field, the intention recognition result and the target entity slot filling result on the basis of a preset user service knowledge graph, so as to finish the user service.
In a third aspect, an embodiment of the present invention provides a computer device, where the computer device includes:
one or more processors;
a memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the knowledgegraph-based user services method of any of the embodiments.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the method for providing a knowledge-graph-based user service according to any embodiment.
According to the technical scheme provided by the embodiment of the invention, a query text of a user to be replied is obtained, and word segmentation and feature extraction processing are carried out on the query text of the user to obtain a feature vector sequence corresponding to a word sequence of the query text of the user; inputting the characteristic vector sequence into a preset intention recognition model to obtain a query field and an intention recognition result of the user query text; inputting the characteristic vector sequence into a preset entity slot filling model to obtain a target entity slot filling result of the user query text, wherein the preset entity slot filling model is a model obtained by training under the common constraint of a loss function of the preset intention recognition model and a corresponding slot filling model loss function; and on the basis of presetting a user service knowledge graph, generating a target inquiry reply text according to the inquiry field, the intention identification result and the target entity slot filling result, and completing user service. The technical scheme of the embodiment of the invention solves the problem that the robot customer service in the prior art cannot accurately identify the semantics of the language characters in different scenes, so that the robot customer service can improve the accuracy of identifying the semantics of the same language characters in different scenes and improve the accuracy of identifying the semantics of the robot customer service.
Drawings
FIG. 1 is a flow chart of a method for providing a knowledge-graph based user service according to an embodiment of the present invention;
FIG. 2 is a flow chart of another method for providing a knowledge-graph based user service according to an embodiment of the present invention;
FIG. 3 is a flow chart of a knowledge-graph updating method according to an embodiment of the present invention;
FIG. 4 is a flowchart of a knowledge-graph based user service process provided by an embodiment of the present invention;
FIG. 5 is a schematic structural diagram of a knowledge-graph based user service device according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a flowchart of a method for providing a user service based on a knowledge-graph according to an embodiment of the present invention, where the embodiment of the present invention is applicable to a scenario where a robot service identifies semantics of a user and performs information interaction with the user, and the method may be performed by a user service apparatus based on a knowledge-graph, and the apparatus may be implemented by software and/or hardware.
As shown in fig. 1, the method for serving a user based on a knowledge-graph includes the following steps:
s110, obtaining a user query text to be replied, and performing word segmentation and feature extraction processing on the user query text to obtain a feature vector sequence corresponding to a word sequence of the user query text.
The user query text to be replied can be understood as a user query text which needs to be replied by the customer service robot, the user query text can be a text for recording the query requirements of the user, and the user query text can be obtained by performing voice recognition on query voice sent by the user. The word sequence may be an arrangement sequence of each word segment in the query text, and specifically, the word segmentation processing is performed on the user query text to obtain the word sequence of the user query text. The feature vector sequence may be an arrangement sequence of feature vectors, and words in the word sequence may be sequentially input into the pre-trained language model RoBERTa-wm to obtain a feature vector sequence corresponding to the word sequence of the user query text.
And S120, inputting the characteristic vector sequence into a preset intention recognition model to obtain a query field and an intention recognition result of the user query text.
The preset intention recognition model can be a preset model for recognizing the field and intention to which the characteristic vector sequence belongs, and the input characteristic vector sequence can be analyzed through the preset intention recognition model to obtain the inquiry field and intention recognition result of the characteristic vector sequence, namely the inquiry field and intention recognition result of the user inquiry text. The query field can be a field related to the user query text, for example, the query field can be a financial field, a chemical field, an electrical field or a mechanical field, and the like, and by determining the query field, the robot customer service can more accurately service the semantics of the user query text according to the semantic specifications of different fields, so that the accuracy of the robot customer service in identifying the customer semantics is improved. Accordingly, the intention recognition result may be a result of recognizing the intention of the user to query the text, for example, the intention of the user to query the text may be an operation of asking how to perform a certain financial transfer in the financial field.
S130, inputting the characteristic vector sequence into a preset entity slot filling model to obtain a target entity slot filling result of the user query text.
The preset entity slot filling model is a model obtained by training under the common constraint of a loss function of a preset intention recognition model and a corresponding slot filling model loss function. The slot filling can be a data processing mode for performing entity identification and semantic slot filling on the text, the entity can be an entity naming word in the text, such as a name of a person, a place name, an organization name and the like, the entity in the text inquired by a user can be identified through the slot filling, and the entity is filled into the semantic slot, so that a robot customer service can conveniently perform a subsequent service flow according to the filled semantic slot, and the accuracy of the subsequent processing flow is improved; the slot filling model is also a model for filling slots in the text. The loss function of the preset intention recognition model may be a function representing a risk or a degree of loss of the intention recognition by the preset intention recognition model, and accordingly, the slot filling model loss function represents a risk or a degree of loss of the slot filling by the slot filling model. The preset entity slot filling model is a model obtained by training under the common constraint of the loss function of the preset intention recognition model and the loss function of the corresponding slot filling model, so that the slot recognition result of the preset entity slot filling model can be closer to the corresponding intention scene, and the accuracy of slot filling is improved.
And S140, on the basis of a preset user service knowledge graph, generating a target inquiry reply text according to the inquiry field, the intention recognition result and the target entity slot filling result, and completing user service.
The preset user service knowledge graph can be a knowledge graph constructed based on knowledge content in the user service business field, and can be obtained by steps of named entity identification, attribute acquisition, classification linear model construction entity relation, structured data forming of an initial knowledge graph, increment of the initial knowledge graph and the like.
The preset user service knowledge graph comprises mapping relations between inquiry entity words and reply entity words, further the preset user service knowledge graph also comprises user service knowledge graphs in different fields, inquiry entity words in a user inquiry text can be determined according to intention recognition results and target entity slot filling results, and corresponding reply entity words can be determined according to the user service knowledge graph in the same field as the inquiry entity words.
The target query reply text may be a text which needs to reply the user query text, and the robot service completes a reply task on the user query text by outputting the target query reply text.
According to the technical scheme provided by the embodiment of the invention, a query text of a user to be replied is obtained, and word segmentation and feature extraction processing are carried out on the query text of the user, so that a feature vector sequence corresponding to a word sequence of the query text of the user is obtained; inputting the characteristic vector sequence into a preset intention recognition model to obtain a query field of a user query text and an intention recognition result; inputting the characteristic vector sequence into a preset entity slot filling model to obtain a target entity slot filling result of a text queried by a user, wherein the preset entity slot filling model is a model obtained by training under the common constraint of a loss function of a preset intention recognition model and a corresponding slot filling model loss function; and on the basis of the preset user service knowledge graph, generating a target inquiry reply text according to the inquiry field, the intention recognition result and the target entity slot filling result, and completing the user service. The technical scheme of the embodiment of the invention solves the problem that the robot customer service in the prior art can not accurately identify the semantics of the language characters in different scenes, so that the robot customer service can improve the accuracy of identifying the semantics of the same language characters in different scenes, and the accuracy of the robot customer service in identifying the semantics of the customer is improved.
Fig. 2 is a flowchart of another knowledge graph-based user service method provided in an embodiment of the present invention, where the embodiment of the present invention is applicable to a scenario where a robot customer service identifies semantics of a user and performs information interaction with the user, and the present embodiment further illustrates how to perform word segmentation and feature extraction processing on a user query text based on the above embodiment; how to enable the preset entity slot filling model to output a target entity slot filling result of a user query text under the common constraint of an intention recognition loss function and a corresponding slot filling loss function; and generating a target inquiry reply text according to the inquiry field, the intention recognition result and the target entity slot filling result on the basis of the preset user service knowledge graph. The device can be realized by software and/or hardware, and is integrated in a computer device with application development function.
As shown in fig. 2, the method for providing a service to a user based on a knowledge-graph includes the following steps:
s210, obtaining a user query text to be replied, and performing word segmentation processing on the user query text to obtain a word sequence string.
The user query text to be replied can be understood as a user query text which needs to be replied by the customer service robot, the user query text can be a text for recording the query requirements of the user, and the user query text can be obtained by performing voice recognition on query voice sent by the user. The word sequence string may be a set of word segments with sequences, and specifically, the word segmentation processing is performed on the text queried by the user to obtain a plurality of word segments, and each word segment is ordered to obtain the word sequence string.
The word sequence string may be an arrangement sequence of each word segment in the query text, and specifically, the word sequence string of the query text of the user may be obtained by performing word segmentation processing on the query text of the user.
S220, respectively inputting each word in the word sequence string into a pre-training language model RoBERTA-wm for feature extraction, and obtaining a feature vector sequence corresponding to the word sequence string.
The feature vector sequence can be the arrangement sequence of the feature vectors, and the features in the word sequence string can be extracted by sequentially inputting each word in the word sequence string into the pre-trained language model RoBERTA-wm to obtain the feature vector sequence corresponding to the word sequence string.
And S230, inputting the characteristic vector sequence into a preset intention recognition model to obtain a query field and an intention recognition result of the user query text.
The preset intention recognition model can be a preset model for recognizing the field and intention to which the characteristic vector sequence belongs, and the input characteristic vector sequence can be analyzed through the preset intention recognition model to obtain the inquiry field and intention recognition result of the characteristic vector sequence, namely the inquiry field and intention recognition result of the user inquiry text. The query field can be a field related to the user query text, for example, the query field can be a financial field, a chemical field, an electrical field or a mechanical field, and the like, and by determining the query field, the robot customer service can more accurately service the semantics of the user query text according to the semantic specifications of different fields, so that the accuracy of the robot customer service in identifying the customer semantics is improved. Accordingly, the intention recognition result may be a result of recognizing the intention of the user to query the text, for example, the intention of the user to query the text may be an operation of asking how to perform a certain financial transfer in the financial field.
S240, inputting the characteristic vector sequence into a preset entity slot filling model to obtain a target entity slot filling result of the user query text.
The preset entity slot filling model is a model obtained by training under the common constraint of a loss function of a preset intention recognition model and a corresponding slot filling model loss function. The slot filling can be a data processing mode for performing entity identification and semantic slot filling on the text, the entity can be an entity naming word in the text, such as a name of a person, a place name, an organization name and the like, the entity in the text inquired by a user can be identified through the slot filling, the entity is filled into the semantic slot, a robot customer service can conveniently perform a subsequent service flow according to the filled semantic slot, and the accuracy of the subsequent processing flow is improved; the slot filling model is also a model for filling slots in the text. The loss function may be a function representing a risk or degree of loss of the intent recognition, and accordingly, the slot fill model loss function represents a risk or degree of loss of slot filling by the slot fill model. The preset entity slot filling model is a model obtained by training under the common constraint of the loss function of the preset intention recognition model and the corresponding slot filling model loss function, so that the slot recognition result of the preset entity slot filling model can be closer to the corresponding intention scene, and the accuracy of slot filling is improved.
Further, the target entity slot filling result may be a result of slot filling processing performed on the user query text, and the target entity slot filling result may be obtained by inputting the feature vector sequence into a preset entity slot filling model for processing.
The training process of the preset entity slot filling model comprises the following steps: inputting a sample feature vector sequence of a query text sample into a feature extraction layer formed by stacking a plurality of bidirectional long and short term memory networks in an initial entity slot filling model for semantic feature extraction and time sequence feature extraction to obtain a corresponding sample semantic feature vector and a corresponding sample time sequence feature vector; carrying out entity classification identification according to the sample semantic feature vector and the sample time sequence feature vector, carrying out entity slot filling based on the entity classification identification result, and calculating an initial slot filling loss function; carrying out weighted summation calculation on the initial slot filling loss function and an intention identification loss function determined by carrying out intention identification on the sample characteristic vector sequence through a preset intention identification model to obtain a target slot filling loss function; and adjusting parameters of the initial entity slot filling model according to the target slot filling loss function so as to finish the training of the preset entity slot filling model.
The entity classification and identification are carried out according to the sample semantic feature vector and the sample time sequence feature vector, and the entity slot filling is carried out based on the entity classification and identification result, and the method comprises the following steps: inputting the sample semantic feature vector and the sample time sequence feature vector into a full connection layer for vector mapping to obtain the semantic feature vector and the time sequence feature vector of a preset label space; and performing entity prediction on the semantic feature vector and the time sequence feature vector of the preset label space through a preset conditional random field to obtain an entity recognition prediction result so as to complete entity slot filling.
And S250, confirming the service process conversation state corresponding to the user inquiry text through a preset discriminant model according to the target entity slot filling result.
The preset discriminant model may be a preset model for judging a business process conversation state corresponding to a user query text, and the business process conversation state may be a state in which a robot service in a user service business process has a conversation with a user, for example, the business process conversation state may be a state in which a user question is being listened to or a user question is being answered by the service robot. And analyzing the slot filling result of the target entity through a preset discriminant model, and confirming the business process conversation state corresponding to the text inquired by the user.
And S260, determining a target reply action according to the confidence coefficient of the business process conversation state.
The confidence may be an index indicating the correctness of the business process dialog state. The targeted response action may be an action that requires the bot to attend to the user, such as a targeted response action including a question, clarification, or confirmation. The target reply action may be determined according to the confidence of the business process dialog state, for example, when the confidence according to the business process dialog state is smaller than a preset confidence threshold, the customer service robot needs to perform a query user action to determine the correctness of the business process dialog state.
And S270, generating a target inquiry reply text according to the target reply template of the target reply action based on the preset user service knowledge graph.
The preset user service knowledge graph can be a preset knowledge graph used for user service, the preset user service knowledge graph comprises mapping relations between inquiry entity words and reply entity words, further, the preset user service knowledge graph also comprises user service knowledge graphs in different fields, inquiry entity words in a user inquiry text can be determined according to intention recognition results and target entity slot position filling results, and then corresponding reply entity words can be determined according to the user service knowledge graph in the same field as the inquiry entity words. The target reply template may be a template used for replying to the query text of the user, and there is a corresponding reply template for each reply action, for example, when the target reply action is a query, the target reply template is a preset reply template corresponding to the query action. The target query reply text can be a text which needs to reply the user query text, the robot service completes a reply task on the user query text by outputting the target query reply text, and the target query reply text can be generated by arranging and combining words of reply entities according to the format of a target reply template.
According to the technical scheme provided by the embodiment of the invention, a word sequence string is obtained by acquiring the query text of the user to be replied and performing word segmentation processing on the query text of the user; respectively inputting each word in the word sequence string into a pre-training language model RoBERTA-wwm for feature extraction to obtain a feature vector sequence corresponding to the word sequence string; inputting the characteristic vector sequence into a preset intention recognition model to obtain a query field of a user query text and an intention recognition result; inputting the characteristic vector sequence into a preset entity slot filling model to obtain a target entity slot filling result of a user query text; confirming a business process conversation state corresponding to a user inquiry text through a preset discriminant model according to a target entity slot position filling result; determining a target reply action according to the confidence of the business process conversation state; and generating a target inquiry reply text according to a target reply template of the target reply action based on a preset user service knowledge graph. The technical scheme of the embodiment of the invention solves the problem that the robot customer service in the prior art cannot accurately identify the semantics of the language characters in different scenes, so that the robot customer service can improve the accuracy of identifying the semantics of the same language characters in different scenes and improve the accuracy of identifying the semantics of the robot customer service.
Fig. 3 is a flowchart of a method for updating a knowledge graph according to an embodiment of the present invention, where the embodiment of the present invention is applicable to a scenario of updating a knowledge graph for a user service, and the present embodiment further illustrates how to update a preset user service knowledge graph when any entity exists in a dialog text composed of any user query text and a corresponding target query reply text as a new entity that is not matched in a set of known entities in a preset user service knowledge graph, where the apparatus may be implemented in a software and/or hardware manner and is integrated in a computer device with an application development function.
As shown in fig. 3, the method for providing a service to a user based on a knowledge-graph includes the following steps:
s310, when any entity exists in a dialog text formed by any user query text and the corresponding target query reply text and is a new entity which is not matched in a known entity set in a preset user service knowledge graph, extracting attribute information of the any entity.
The entity may be an entity naming word in the text, such as a person name, a place name, an organization name, and the like. The preset user service knowledge graph can be a knowledge graph constructed based on knowledge content in the user service business field, and can be obtained by steps of named entity identification, attribute acquisition, classification linear model construction entity relation, structural data forming of an initial knowledge graph, increment of the initial knowledge graph and the like. The attribute information may be information describing characteristics of the entity, such as names of scenic spots, addresses of the scenic spots, characteristic scenic spots, traffic volume, and the like. When any entity exists in a dialog text formed by any user query text and a corresponding target query reply text and is a new entity which is not matched in a known entity set in a preset user service knowledge graph, the mapping relation of the new entity does not exist in the preset user service knowledge graph, so that the preset user service knowledge graph needs to be updated, and because the attribute information of the entity is an important factor for constructing the knowledge graph, the attribute information of any entity can be extracted firstly.
And S320, mapping any entity to a superior entity corresponding to the attribute information to obtain a new mapping relation map between the entities.
The higher level entity corresponding to the attribute information may be another entity having a higher level relationship with the attribute information, and the higher level relationship may be an overall relationship formed by the content and some specific contents in the structure, for example, the entity having a higher level relationship with the attribute information such as "more passenger traffic, attractive scenery, popular scenic spots" may be a five-star scenic spot. When any entity is mapped to the upper entity corresponding to the attribute information, a new mapping relation map between the entities can be obtained.
S330, adding the new mapping relation map into the preset user knowledge map, and performing clustering combination of mapping relations to obtain an updated target user knowledge map.
The target user knowledge graph can be a knowledge graph required for user service, and the target user knowledge graph can be obtained by updating a preset user knowledge graph. The new mapping relation map is added to the preset user knowledge map, clustering and merging of the mapping relations are carried out, the existing knowledge map can be regarded as a seed map, the newly obtained mapping relation is supplemented on the basis of the seed map, and the similar mapping relations are merged through clustering, so that the self-learning efficiency of the knowledge map is improved.
Exemplarily, fig. 4 is a workflow diagram for performing a user service based on a knowledge graph according to an embodiment of the present invention, and as shown in fig. 4, the workflow of the user service is as follows: firstly, acquiring a query text, and performing word segmentation processing on the query text to obtain a word sequence string; then, extracting the characteristics of each word in the word sequence string to obtain a characteristic vector sequence corresponding to the word sequence string; performing intention recognition according to the characteristic vector sequence to obtain a query field of a query text and an intention recognition result; inputting the characteristic vector sequence into a preset entity slot filling model to obtain an entity slot filling result of the query text; confirming a service process conversation state corresponding to the query text through a preset discriminant model according to the entity slot filling result; determining a reply action according to the confidence of the business process conversation state; generating a reply text according to a reply template of the reply action based on the knowledge graph of the inquiry field; then, whether a new entity which is not recorded in the knowledge graph exists in the query text and the reply text is judged; if yes, mapping the new entity to the upper entity corresponding to the attribute information to obtain a new mapping relation map between the entities, adding the new mapping relation map to the user knowledge map, and performing clustering combination of mapping relations to obtain an updated user knowledge map; if not, the user service is ended.
According to the technical scheme provided by the embodiment of the invention, when any entity exists in a dialog text formed by any user query text and a corresponding target query reply text and is a new entity which is not matched in a known entity set in a preset user service knowledge graph, the attribute information of the any entity is extracted; mapping any entity to a superior entity corresponding to the attribute information to obtain a new mapping relation map between the entities; and adding the new mapping relation map into the preset user knowledge map, and performing clustering combination of mapping relations to obtain an updated target user knowledge map. According to the technical scheme of the embodiment of the invention, the knowledge map can be updated in a self-learning mode, so that the customer service robot can perform user service based on the updated knowledge map, and the accuracy of the user service is further improved.
Fig. 5 is a schematic structural diagram of a user service apparatus based on a knowledge graph according to an embodiment of the present invention, where the embodiment of the present invention is applicable to a scenario where a robot service identifies semantics of a user and performs information interaction with the user, and the apparatus may be implemented by software and/or hardware and integrated in a computer device with an application development function.
As shown in fig. 5, the user service apparatus based on knowledge-graph includes: a query text acquisition module 410, a text intent recognition module 420, an entity slot population module 430, and a reply text generation module 440.
The query text acquisition module 410 is configured to acquire a query text of a user to be replied, perform word segmentation and feature extraction processing on the query text of the user, and obtain a feature vector sequence corresponding to a word sequence of the query text of the user; a text intention recognition module 420, configured to input the feature vector sequence into a preset intention recognition model, so as to obtain a query field of the user query text, an intention recognition result, and a corresponding intention recognition loss function; an entity slot filling module 430, configured to input the feature vector sequence into a preset entity slot filling model, and enable the preset entity slot filling model to output a target entity slot filling result of the user query text under the common constraint of the intention identification loss function and a corresponding slot filling loss function; and the reply text generation module 440 is configured to generate a target query reply text according to the query field, the intention identification result, and the target entity slot filling result on the basis of a preset user service knowledge graph, so as to complete user service.
According to the technical scheme provided by the embodiment of the invention, a user query text to be replied is obtained, and word segmentation and feature extraction processing are carried out on the user query text to obtain a feature vector sequence corresponding to a word sequence of the user query text; inputting the characteristic vector sequence into a preset intention recognition model to obtain a query field of a user query text and an intention recognition result; inputting the characteristic vector sequence into a preset entity slot filling model to obtain a target entity slot filling result of a text queried by a user, wherein the preset entity slot filling model is a model obtained by training under the common constraint of a loss function of a preset intention recognition model and a corresponding slot filling model loss function; and on the basis of the preset user service knowledge graph, generating a target inquiry reply text according to the inquiry field, the intention recognition result and the target entity slot filling result, and completing the user service. The technical scheme of the embodiment of the invention solves the problem that the robot customer service in the prior art can not accurately identify the semantics of the language characters in different scenes, so that the robot customer service can improve the accuracy of identifying the semantics of the same language characters in different scenes, and the accuracy of the robot customer service in identifying the semantics of the customer is improved.
In an alternative embodiment, the query text acquiring module 410 is specifically configured to: performing word segmentation processing on a user query text to obtain a word sequence string; and respectively inputting each word in the word sequence string into a pre-training language model RoBERTA-wwm for feature extraction to obtain a feature vector sequence corresponding to the word sequence string.
In an alternative embodiment, the user service device based on knowledge-graph further comprises: the entity slot filling model training module is used for: inputting a sample feature vector sequence of a query text sample into a feature extraction layer formed by stacking a plurality of bidirectional long and short term memory networks in an initial entity slot filling model for semantic feature extraction and time sequence feature extraction to obtain a corresponding sample semantic feature vector and a corresponding sample time sequence feature vector; carrying out entity classification identification according to the sample semantic feature vector and the sample time sequence feature vector, carrying out entity slot filling based on the entity classification identification result, and calculating an initial slot filling loss function; carrying out weighted summation calculation on the initial slot filling loss function and an intention identification loss function determined by carrying out intention identification on the sample characteristic vector sequence through a preset intention identification model to obtain a target slot filling loss function; and adjusting parameters of the initial entity slot filling model according to the target slot filling loss function so as to finish the training of the preset entity slot filling model.
In an optional implementation manner, the reply text generation module 440 is specifically configured to: confirming a business process conversation state corresponding to a user inquiry text through a preset discriminant model according to a target entity slot position filling result, and determining a target reply action according to the confidence coefficient of the business process conversation state, wherein the target reply action comprises any one of inquiry, clarification or confirmation; and generating a target inquiry reply text according to a target reply template of the target reply action based on a preset user service knowledge graph.
In an alternative embodiment, the user service device based on knowledge-graph further comprises: a user knowledge graph update module to: when any entity exists in a dialog text formed by any user query text and a corresponding target query reply text and is a new entity which is not matched in a known entity set in a preset user service knowledge graph, extracting attribute information of any entity; and mapping and classifying any entity according to the attribute information of any entity, and updating any entity into a preset user knowledge graph according to the classification result.
In an optional implementation manner, the user knowledge graph updating module is specifically configured to: mapping any entity to a superior entity corresponding to the attribute information to obtain a new mapping relation map between the entities; and adding the new mapping relation map into a preset user knowledge map, and performing clustering combination on the mapping relation to obtain an updated target user knowledge map.
In an optional embodiment, the entity slot filling model training module is specifically configured to: inputting the sample semantic feature vector and the sample time sequence feature vector into a full connection layer for vector mapping to obtain a semantic feature vector and a time sequence feature vector of a preset label space; and performing entity prediction on the semantic feature vector and the time sequence feature vector of the preset label space through a preset conditional random field to obtain an entity recognition prediction result so as to complete entity slot filling.
The user service device based on the knowledge graph provided by the embodiment of the invention can execute the user service method based on the knowledge graph provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.
Fig. 6 is a schematic structural diagram of a computer device according to an embodiment of the present invention. FIG. 6 illustrates a block diagram of an exemplary computer device 12 suitable for use in implementing embodiments of the present invention. The computer device 12 shown in FIG. 6 is only an example and should not impose any limitations on the functionality or scope of use of embodiments of the present invention. The computer device 12 may be any terminal device with computing capabilities and may be configured with a knowledge-graph based user service device.
As shown in FIG. 6, computer device 12 is in the form of a general purpose computing device. The components of computer device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that couples various system components including the system memory 28 and the processing unit 16.
Bus 18 may be one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, or a local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, industry Standard Architecture (ISA) bus, micro-channel architecture (MAC) bus, enhanced ISA bus, video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Computer device 12 typically includes a variety of computer system readable media. Such media can be any available media that is accessible by computer device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM) 30 and/or cache 32. Computer device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 6, commonly referred to as a "hard drive"). Although not shown in FIG. 6, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 by one or more data media interfaces. System memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
A program/utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 42 generally carry out the functions and/or methodologies of embodiments of the invention as described.
Computer device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), with one or more devices that enable a user to interact with computer device 12, and/or with any devices (e.g., network card, modem, etc.) that enable computer device 12 to communicate with one or more other computing devices. Such communication may be through an input/output (I/O) interface 22. Also, computer device 12 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network such as the Internet) through network adapter 20. As shown, the network adapter 20 communicates with the other modules of the computer device 12 over the bus 18. It should be understood that although not shown in FIG. 6, other hardware and/or software modules may be used in conjunction with computer device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, to name a few.
The processing unit 16 executes programs stored in the system memory 28 to perform various functional applications and data processing, such as implementing a method for providing a knowledge-graph-based user service according to an embodiment of the present invention, the method including:
acquiring a user query text to be replied, and performing word segmentation and feature extraction processing on the user query text to obtain a feature vector sequence corresponding to a word sequence of the user query text;
inputting the characteristic vector sequence into a preset intention recognition model to obtain a query field and an intention recognition result of the user query text;
inputting the characteristic vector sequence into a preset entity slot filling model to obtain a target entity slot filling result of the user query text, wherein the preset entity slot filling model is a model obtained by training under the common constraint of a loss function of the preset intention recognition model and a corresponding slot filling model loss function;
and on the basis of presetting a user service knowledge graph, generating a target inquiry reply text according to the inquiry field, the intention identification result and the target entity slot filling result, and completing user service.
The present embodiment provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method for a knowledge-graph based user service as provided in any embodiment of the present invention, comprising:
acquiring a user query text to be replied, and performing word segmentation and feature extraction processing on the user query text to obtain a feature vector sequence corresponding to a word sequence of the user query text;
inputting the characteristic vector sequence into a preset intention recognition model to obtain a query field and an intention recognition result of the user query text;
inputting the characteristic vector sequence into a preset entity slot filling model to obtain a target entity slot filling result of the user query text, wherein the preset entity slot filling model is a model obtained by training under the common constraint of a loss function of the preset intention recognition model and a corresponding slot filling model loss function;
and on the basis of presetting a user service knowledge graph, generating a target inquiry reply text according to the inquiry field, the intention identification result and the target entity slot filling result, and completing user service.
Computer storage media for embodiments of the invention may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. The computer-readable storage medium may be, for example but not limited to: an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, smalltalk, C + +, or the like, as well as conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It will be understood by those skilled in the art that the modules or steps of the invention described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of computing devices, and optionally they may be implemented by program code executable by a computing device, such that it may be stored in a memory device and executed by a computing device, or it may be separately fabricated into various integrated circuit modules, or it may be fabricated by fabricating a plurality of modules or steps thereof into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments illustrated herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in some detail by the above embodiments, the invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the invention, and the scope of the invention is determined by the scope of the appended claims.

Claims (10)

1. A user service method based on knowledge graph is characterized by comprising the following steps:
acquiring a user query text to be replied, and performing word segmentation and feature extraction processing on the user query text to obtain a feature vector sequence corresponding to a word sequence of the user query text;
inputting the characteristic vector sequence into a preset intention recognition model to obtain a query field and an intention recognition result of the user query text;
inputting the characteristic vector sequence into a preset entity slot filling model to obtain a target entity slot filling result of the user query text, wherein the preset entity slot filling model is a model obtained by training under the common constraint of a loss function of the preset intention recognition model and a corresponding slot filling model loss function;
and on the basis of a preset user service knowledge graph, generating a target inquiry reply text according to the inquiry field, the intention identification result and the target entity slot filling result, and completing user service.
2. The method of claim 1, wherein the performing word segmentation and feature extraction on the user query text to obtain a feature vector sequence corresponding to a word sequence of the user query text comprises:
performing word segmentation processing on the user query text to obtain a word sequence string;
and respectively inputting each word in the word sequence string into a pre-training language model RoBERTA-wwm for feature extraction to obtain a feature vector sequence corresponding to the word sequence string.
3. The method of claim 1, wherein the training process of the pre-defined physical slot filling model comprises:
inputting a sample feature vector sequence of a query text sample into a feature extraction layer formed by stacking a plurality of bidirectional long and short term memory networks in an initial entity slot filling model for semantic feature extraction and time sequence feature extraction to obtain a corresponding sample semantic feature vector and a corresponding sample time sequence feature vector;
performing entity classification identification according to the sample semantic feature vector and the sample time sequence feature vector, performing entity slot filling based on an entity classification identification result, and calculating an initial slot filling loss function;
carrying out weighted summation calculation on the initial slot filling loss function and an intention identification loss function determined by carrying out intention identification on the sample characteristic vector sequence through the preset intention identification model to obtain a target slot filling loss function;
and adjusting parameters of the initial entity slot filling model according to the target slot filling loss function so as to finish the training of the preset entity slot filling model.
4. The method of claim 1, wherein generating a target query reply text based on the intent recognition result and the target entity slot filling result based on a preset user service knowledge graph comprises:
confirming the business process conversation state corresponding to the user inquiry text through a preset discriminant model according to the target entity slot filling result,
determining a target reply action according to the confidence of the business process conversation state, wherein the target reply action comprises any action of question tracing, clarification or confirmation;
and generating a target inquiry reply text according to the target reply template of the target reply action based on the preset user service knowledge graph.
5. The method according to any one of claims 1-4, further comprising:
when any entity exists in a dialog text formed by any user query text and a corresponding target query reply text and is a new entity which is not matched in a known entity set in the preset user service knowledge graph, extracting attribute information of the any entity;
and mapping and classifying any entity according to the attribute information of any entity, and updating any entity into the preset user knowledge graph according to the classification result.
6. The method according to claim 5, wherein the mapping and classifying the any entity according to the attribute information of the any entity, and updating the any entity into the preset user knowledge graph according to the classification result comprises:
mapping any entity to an upper entity corresponding to the attribute information to obtain a new mapping relation map between the entities;
and adding the new mapping relation map into the preset user knowledge map, and performing clustering combination of mapping relations to obtain an updated target user knowledge map.
7. The method of claim 3, wherein the performing entity classification identification according to the sample semantic feature vector and the sample time sequence feature vector and entity slot filling based on the result of entity classification identification comprises:
inputting the sample semantic feature vector and the sample time sequence feature vector into a full connection layer for vector mapping to obtain a semantic feature vector and a time sequence feature vector of a preset label space;
and performing entity prediction on the semantic feature vector and the time sequence feature vector of the preset label space through a preset conditional random field to obtain an entity recognition prediction result so as to complete entity slot filling.
8. A knowledge-graph-based user service apparatus, comprising:
the query text acquisition module is used for acquiring a query text of a user to be replied, and performing word segmentation and feature extraction processing on the query text of the user to obtain a feature vector sequence corresponding to a word sequence of the query text of the user;
the text intention identification module is used for inputting the characteristic vector sequence into a preset intention identification model to obtain an inquiry field, an intention identification result and a corresponding intention identification loss function of the user inquiry text;
the entity slot filling module is used for inputting the characteristic vector sequence into a preset entity slot filling model, and enabling the preset entity slot filling model to output a target entity slot filling result of the user query text under the common constraint of the intention recognition loss function and the corresponding slot filling loss function;
and the reply text generation module is used for generating a target inquiry reply text according to the inquiry field, the intention recognition result and the target entity slot filling result on the basis of a preset user service knowledge graph, so as to finish the user service.
9. A computer device, characterized in that the computer device comprises:
one or more processors;
a memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the knowledgegraph-based user services method of any of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored, which program, when being executed by a processor, is adapted to carry out a method for a knowledgegraph-based user service as claimed in any one of claims 1 to 7.
CN202211529331.5A 2022-11-30 2022-11-30 User service method, device, equipment and storage medium based on knowledge graph Pending CN115730591A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211529331.5A CN115730591A (en) 2022-11-30 2022-11-30 User service method, device, equipment and storage medium based on knowledge graph

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211529331.5A CN115730591A (en) 2022-11-30 2022-11-30 User service method, device, equipment and storage medium based on knowledge graph

Publications (1)

Publication Number Publication Date
CN115730591A true CN115730591A (en) 2023-03-03

Family

ID=85299683

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211529331.5A Pending CN115730591A (en) 2022-11-30 2022-11-30 User service method, device, equipment and storage medium based on knowledge graph

Country Status (1)

Country Link
CN (1) CN115730591A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117648930A (en) * 2023-11-22 2024-03-05 平安创科科技(北京)有限公司 Combined task realization method, device, equipment and medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117648930A (en) * 2023-11-22 2024-03-05 平安创科科技(北京)有限公司 Combined task realization method, device, equipment and medium

Similar Documents

Publication Publication Date Title
CN108345692B (en) Automatic question answering method and system
CN110069608B (en) Voice interaction method, device, equipment and computer storage medium
CN113064964A (en) Text classification method, model training method, device, equipment and storage medium
US10592782B2 (en) Image analysis enhanced related item decision
CN112860993A (en) Method, device, equipment, storage medium and program product for classifying points of interest
US11257029B2 (en) Pickup article cognitive fitment
CN115730591A (en) User service method, device, equipment and storage medium based on knowledge graph
CN111310065A (en) Social contact recommendation method and device, server and storage medium
CN114360027A (en) Training method and device for feature extraction network and electronic equipment
US11366973B2 (en) Method and apparatus for determining a topic
CN114119123A (en) Information pushing method and device
CN116756281A (en) Knowledge question-answering method, device, equipment and medium
CN110287384A (en) Intelligent Service method, device and equipment
WO2021151354A1 (en) Word recognition method and apparatus, computer device, and storage medium
US20230127907A1 (en) Intention identification in dialogue system
CN114925680A (en) Logistics interest point information generation method, device, equipment and computer readable medium
CN114638308A (en) Method and device for acquiring object relationship, electronic equipment and storage medium
CN113806541A (en) Emotion classification method and emotion classification model training method and device
CN112785234A (en) Goods recommendation method, device, equipment and storage medium
CN112163078A (en) Intelligent response method, device, server and storage medium
CN114077858A (en) Vector data processing method, device, equipment and storage medium
CN114547448B (en) Data processing method, model training method, device, equipment, storage medium and program
CN112417310B (en) Method for establishing intelligent service index and recommending intelligent service
US20230138741A1 (en) Social network adapted response
CN113779980A (en) Method and device for recognizing text

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