CN117972057A - Dialogue content processing method, equipment, storage medium and product - Google Patents

Dialogue content processing method, equipment, storage medium and product Download PDF

Info

Publication number
CN117972057A
CN117972057A CN202410133403.7A CN202410133403A CN117972057A CN 117972057 A CN117972057 A CN 117972057A CN 202410133403 A CN202410133403 A CN 202410133403A CN 117972057 A CN117972057 A CN 117972057A
Authority
CN
China
Prior art keywords
knowledge
dialogue content
question
generation model
sales
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
CN202410133403.7A
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.)
Rajax Network Technology Co Ltd
Zhejiang Koubei Network Technology Co Ltd
Original Assignee
Rajax Network Technology Co Ltd
Zhejiang Koubei Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Rajax Network Technology Co Ltd, Zhejiang Koubei Network Technology Co Ltd filed Critical Rajax Network Technology Co Ltd
Priority to CN202410133403.7A priority Critical patent/CN117972057A/en
Publication of CN117972057A publication Critical patent/CN117972057A/en
Pending legal-status Critical Current

Links

Abstract

The embodiment of the specification provides a dialogue content processing method, equipment, a storage medium and a product. The method comprises the following steps: acquiring dialogue content generated by a dialogue content generation model; wherein the dialogue content generation model is obtained by fine tuning a pre-training language model; setting a jump identifier for a sales object in the dialogue content generated by the dialogue content generation model; displaying the dialogue content and the jump identification of the sales object in the dialogue content in an interactive interface; and responding to the triggering operation of any jump mark, acquiring a sales page of a sales object indicated by the jump mark, and displaying the sales page in an interactive interface. The operation steps of the user are effectively reduced, and the sales page for displaying the sales object for the user is realized more quickly.

Description

Dialogue content processing method, equipment, storage medium and product
The application is a divisional application with the application date of 2023, 8, 22 and the application number of 2023110698998, and the application and creation names of a generation method, a training method of a model, equipment and a storage medium.
Technical Field
One or more embodiments of the present specification relate to the field of natural language processing, and in particular, to a dialog content processing method, an electronic device, a computer-readable storage medium, and a computer program product.
Background
In the related art, the interaction between the user and the APP (Application program) is mainly searching or recommending, for example, the user inputs a search word in a search box according to the own requirement, and the APP pushes a corresponding target object, such as dishes, commodities, services or articles, etc., to the user according to the search word; for example, the APP can use the user portrait, the historical behavior and the like as references, pre-determine the object to be recommended and display the object in the interactive interface for the user to select. The above manner may meet the user's needs to some extent, but is weak in the general intention, for example, the user wants to know "what food can be consumed for weight loss? "when searching, the requirement is long and not specific enough, so that the search return result is inaccurate; more recommendation is based on user portraits, historical behaviors and the like, and the recommendation can not be performed in real time and in a targeted manner on the slimming requirements of the user, so that the recommendation result is not accurate enough.
Disclosure of Invention
In view of this, one or more embodiments of the present specification provide a dialog content processing method, an electronic device, and a computer-readable storage medium.
In order to achieve the above object, one or more embodiments of the present disclosure provide the following technical solutions:
according to a first aspect of one or more embodiments of the present specification, a method for processing dialog content is provided, including:
Acquiring dialogue content generated by a dialogue content generation model; wherein the dialogue content generation model is obtained by fine tuning a pre-training language model;
Setting a jump identifier for a sales object in the dialogue content generated by the dialogue content generation model;
Displaying the dialogue content and the jump identification of the sales object in the dialogue content in an interactive interface; and
And responding to the triggering operation of any jump mark, acquiring a sales page of a sales object indicated by the jump mark, and displaying the sales page in an interactive interface.
According to a second aspect of one or more embodiments of the present specification, there is provided an electronic device comprising:
A processor;
a memory for storing processor-executable instructions;
Wherein the processor, when executing the executable instructions, is configured to implement the method of the first aspect.
According to a third aspect of embodiments of the present specification, there is provided a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of any of the methods described above.
One or more embodiments of the present disclosure provide a method for processing dialogue content, an electronic device, and a computer readable storage medium, where a skip identifier may be set for a sales object in dialogue content generated by a dialogue content generation model, and further the skip identifier of the sales object in dialogue content may be displayed together when the dialogue content is displayed in an interactive interface; the user can determine whether to trigger the jump identifier corresponding to the sales object according to actual needs, and the device can respond to the trigger operation of any jump identifier to acquire the sales page of the sales object indicated by the jump identifier and display the sales page in the interactive interface. In the process, the user can see the sales page of the sales object only by one operation (triggering the jump identifier corresponding to the sales object), so that the operation steps of the user are effectively reduced, and the sales page of the sales object is displayed for the user more quickly.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
Fig. 1 is a schematic structural diagram of an interactive system according to an exemplary embodiment.
Fig. 2A is a flow chart of a method for processing dialogue content according to an exemplary embodiment.
Fig. 2B is a flowchart of a training method of a dialog content generation model according to an exemplary embodiment.
Fig. 3 is a schematic diagram of a dish and its attributes according to an exemplary embodiment.
Fig. 4 is a schematic diagram of a knowledge graph according to an exemplary embodiment.
Fig. 5 is a flowchart of a dialog content generation method according to an exemplary embodiment.
FIG. 6 is a schematic diagram of a jump identifier for presenting dialog content and sales objects in the dialog content in an interactive interface, according to an example embodiment.
Fig. 7 is a schematic diagram of a sales page jumping from a dialog content presentation page to a sales object, as provided by an example embodiment.
Fig. 8 is a flowchart of a method for generating a prompt text according to an exemplary embodiment.
Fig. 9 is a schematic structural diagram of an electronic device according to an exemplary embodiment.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with one or more embodiments of the present specification. Rather, they are merely examples of apparatus and methods consistent with aspects of one or more embodiments of the present description as detailed in the accompanying claims.
It should be noted that: in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other embodiments, the method may include more or fewer steps than described in this specification. Furthermore, individual steps described in this specification, in other embodiments, may be described as being split into multiple steps; while various steps described in this specification may be combined into a single step in other embodiments.
User information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, presented data, etc.) referred to in this specification are both information and data authorized by the user or sufficiently authorized by the parties, and the collection, use and processing of relevant data requires compliance with relevant laws and regulations and standards of the relevant country and region, and is provided with corresponding operation portals for the user to choose authorization or denial.
Related terms are explained herein:
LLM: the large language model (Large Language Model) is a modeling mode based on statistics and natural language processing technology, and is trained on massive texts by utilizing a high-capacity model architecture (such as a transducer), so that a large amount of priori knowledge can be obtained by means of the pre-training, and model questions and answers are processes of giving related knowledge by instructions. Common LLMs include ChatGLM, chinese-Alpaca, ziya-Llama, baichuan, and the like.
SFT: the supervised fine tuning (Supervised Finetuning) acquires a smaller but higher quality dataset that may be present in the raw data or may be a model missing sample for further training of the pre-trained language model.
Prompt (hint): prompt can be understood as a way to specify the direction in which LLM generates emphasis, which is a piece of text or sentence that directs LLM to generate an output of a particular type, topic or format. Guiding a base model towards the desired a priori direction by means of elaborate hints (promts) is the method of the lowest current threshold, sometimes also referred to as gradient-free tuning. The promt uses the association and prior information seen during training, for example, by a promt approach like "you are a food expert …" to let the LLM output answers more biased towards the food dimension.
In the related art, the interaction between a user and an APP (Application) is mainly search or recommendation. For example, a user inputs a search word in a search box according to the self requirement, and the APP pushes a corresponding target object to the user according to the search word; for example, typing "hot and sour powder" in the search box, APP will push the store selling the hot and sour powder. For example, the APP will take the user portrait, the history behavior and the like as references, pre-determine the object to be recommended and display the object in the interactive interface for the user to select; for example, if the user portrait of a user is a dish like spicy taste, after the user opens the APP, the APP may display dishes or shops such as a Chongqing dish, a spicy and fragrant dish, or a chilli fried meat in the interactive interface for the user to select.
The above manner may meet the user's needs to some extent, but is weak in receiving general intention, for example, the user proposes "what food can be eaten by losing weight? "," what breakfast is eaten "," i do not want to eat rice, what other recommendations are? "if the intention is not clear enough, the requirement is long and not specific enough for searching, so that the correlation between the search return result and the problem is low, and the search return result is inaccurate; more, the recommendation is based on the user portrait, the history behavior and the like, and the instant appeal of the user, which is different from the history behavior, cannot be recommended in real time, and the recommendation result is not accurate enough.
Based on this, the embodiment of the present disclosure provides a method for generating dialogue content and a training method for a dialogue content generation model, which can perform fine tuning on a pre-trained language model (i.e., the above-mentioned large language model) in advance to obtain the dialogue content generation model. In the actual application process, after receiving a problem of a user, firstly judging whether the problem needs to be replied by combining with external knowledge, and if not, inputting the problem into a dialogue content generation model to be solved; if so, acquiring target knowledge from a preset knowledge base, and solving the problem, the target knowledge and a prompt text input dialogue content generation model corresponding to the target knowledge; in the embodiment, the fact that the external knowledge cannot be obtained in real time by only inputting the problem and solving the problem by the dialogue content generation model may be considered, and the defects such as lack of actual knowledge, incapability of processing the problem with strong timeliness or openness may exist.
In an exemplary embodiment, referring to fig. 1, fig. 1 is an interactive system provided in an embodiment of the present disclosure, where the interactive system includes a service end 100 and at least one client end 200, and the client end 200 may access the service end 100 through a network to use services provided by the service end 100, including, but not limited to, a commodity distribution service, a commodity purchase service, a reading service, an audio/video playing service, or a search service, for example.
The server 100 may be a program installed in a background device to provide a service to a user. As shown in fig. 1, the background device may be a server, which may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs (Content Delivery Network, content delivery networks), and basic cloud computing services such as big data and artificial intelligence platforms.
The client 200 may be a program installed in a user device to provide services to a user, the client 200 including, but not limited to, an application APP, a Web page, an applet, a plug-in or component, and the like. As shown in fig. 1, the user devices include, but are not limited to, smartphones, personal digital assistants, tablet computers, personal computers, notebook computers, virtual reality terminal devices, augmented reality terminal devices, and the like.
The dialog content generation method provided in the embodiment of the present disclosure may be executed by either one of the server 100 and the client 200, or by the combination of both (both each executing a part of the steps), which is not limited in any way. Taking the example that the server 100 executes the method for generating the dialogue content, the server 100 may be deployed with a dialogue content generation model, the client 200 may send the problem input by the user to the server 100, and the server 100 may execute the method for generating the dialogue content provided in the embodiment of the present disclosure to obtain the dialogue content, and then may send the dialogue content to the client 200, so that the client 200 may display the dialogue content. Alternatively, a session content generation model may be deployed in the client 200, and the session content generation method may be executed by the client 200.
The training method of the dialog content generation model provided in the embodiment of the present disclosure may be executed by the server 100, or may be executed by another electronic device different from the server 100, which is not limited in this embodiment.
In another exemplary embodiment, the method for generating the dialogue content and the method for training the dialogue content generation model provided in the embodiment of the present disclosure may be performed by the same electronic device or may be performed by different electronic devices, which is not limited in any way.
According to the method and the device, in some scenes, after the user asks related problems to obtain related dialogue contents, the user usually has the requirement of further knowing the sales condition of sales objects in the dialogue contents, the user needs to exit an interactive interface for displaying the dialogue contents, enter a search page according to the operation flow of the related technology, type the sales objects in a search box of the search page, click the search to see the sales pages of the sales objects in the interactive interface, the operation of the process is complicated, the operation is inconvenient, the user experience is poor, and the display efficiency of the sales pages is low.
Based on this, referring to fig. 2A, an embodiment of the present disclosure provides a method for processing dialogue content, including:
In S301, session content generated by the session content generation model is acquired; wherein the dialogue content generation model is obtained by fine tuning a pre-training language model;
In S302, a jump identifier is set for a sales object in the session content generated by the session content generation model;
In S303, displaying the session content and a jump identifier of a sales object in the session content in an interactive interface; and
In S304, in response to a trigger operation for any one of the jump identifiers, a sales page of the sales object indicated by the jump identifier is obtained, and the sales page is displayed in the interactive interface.
The embodiment realizes that the user can see the sales page of the sales object only by triggering the jump mark of the sales object, effectively reduces the operation steps of the user, and realizes that the sales page of the sales object is displayed for the user more quickly.
The training process of the dialog content generation model is described in the following as an example:
referring to fig. 2B, an embodiment of the present disclosure provides a training method for a dialog content generation model, including:
In S101, a first training data set is obtained, where the first training data set includes a plurality of problem samples and corresponding dialogue contents thereof; the plurality of issue samples includes a plurality of first issue samples and a plurality of second issue samples.
The first problem sample is a problem that does not need to refer to external knowledge, the second problem sample is a problem that needs to refer to external knowledge, and the specific problem can be specifically set according to the actual application scenario, which is not limited in this embodiment.
In S102, for the second problem sample, acquiring target knowledge from a preset knowledge base according to the second problem sample, and generating a prompt text corresponding to the target knowledge.
For example, a knowledge base may be preset, and target knowledge for answering the second question sample may be retrieved from the knowledge base. The prompt text can comprise a role prompt text and a dialogue content prompt text, wherein the role prompt text indicates that the pre-training language model answers from the angle of a designated role (such as a food family, a commodity evaluation family and the like); dialog content prompt text instructs the pre-trained language model to reply to the second question sample with reference to the target knowledge. That is, the prompt text may then control the specific form of knowledge injection so that the pre-trained language model can answer in a desired manner.
In S103, inputting the first question sample into a pre-training language model to generate a first predicted answer from the first question sample by the pre-training language model; and inputting the second question sample, target knowledge corresponding to the second question sample, and prompt text corresponding to the target knowledge into the pre-training language model to generate a second predicted reply by the pre-training language model according to the second question sample, the target knowledge, and the prompt text; the prompt text is used for prompting the pre-training language model to answer the second question sample by referring to the target knowledge; and training the pre-training language model by taking the error between the dialog content corresponding to the minimized first predicted reply and the first question sample and the error between the dialog content corresponding to the second predicted reply and the second question sample as optimization targets to obtain a dialog content generation model.
In this embodiment, the pre-training language model is fine-tuned by (1) the first question sample and the dialogue content corresponding to the first question sample, (2) the second question sample, the target knowledge corresponding to the second question sample, the prompt text corresponding to the target knowledge, and the dialogue content corresponding to the second question sample, so that the model internalization of the knowledge is realized, and the external knowledge can be used as a supplement, thereby being beneficial to improving the reply accuracy. The introduction of the second mode helps the pre-training language model to acquire more external knowledge, solves the problem of injecting real-time updated knowledge, and the combination of the two modes is beneficial to accurately solving the problem of general intention of the user and improves the accuracy of dialogue content and user satisfaction.
In some embodiments, a first training sample set (a number of problem samples and their corresponding dialog content) is described herein as exemplary:
The first training data set may include a plurality of problem samples that are classified into two types, that is, the first training sample set may include (1) a plurality of first problem samples and corresponding dialogue contents thereof; (2) A number of second question samples and their corresponding dialog content (i.e. "question-answer pairs"). The first problem sample is a problem requiring no external knowledge, and the second problem sample is a problem requiring external knowledge.
For example, the problem samples in the first training sample set may be constructed according to the historical problems raised by the real user in the platform, so that the distribution situation of the problem samples is the same as or similar to the distribution situation of the problems raised by the real user, and the number of different types of problem samples is balanced, so that the trained dialogue content generation model can cope with different types of actual problems.
For example, a question template may be prepared and then expanded for similar questions to obtain more question samples. For example, if a problem template is "what is eaten by breakfast", a similar problem expansion is performed, and then a problem sample such as "what is eaten by lunch", "what is eaten by dinner" can be obtained.
In one possible implementation, existing knowledge-graph may be utilized to construct the problem sample and its dialog content. The knowledge graph can be constructed according to the sales object and the attribute thereof, wherein the nodes in the knowledge graph comprise entity nodes and attribute nodes, any one entity node is used for representing the sales object, and at least one attribute node connected with any entity node is used for representing the attribute of the sales object.
For example, taking sales objects as dishes as an example, referring to fig. 3, a dish may include 16 attributes of { category, associated dish, throttle, city, taste, period, practice, scene, efficacy, food material, season, region, holiday, province, mood, crowd }; taking a dumpling as an example, a knowledge graph as shown in fig. 4 can be constructed based on the dishes and the attributes thereof.
For example, if the problem sample is "give me recommended spicy tofu", then the entity node related to the spicy tofu in the knowledge graph can be found, and according to the connection relationship between the entity node and other nodes, the dialogue content corresponding to the problem sample is generated.
In another possible implementation, other language models that are pre-trained may be utilized to obtain dialogue content corresponding to the problem sample. For example, the question sample and the prompt text corresponding to the question sample may be input into other language models that are pre-trained to enable the other language models to output desired dialog content.
In yet another possible implementation, an external search engine may be utilized to obtain dialogue content corresponding to the problem sample. The present embodiment does not impose any limitation on this.
In some embodiments, a knowledge base is illustrated herein:
the knowledge base may store only one type of knowledge, such as a structured knowledge graph. Or to increase reply accuracy and diversity, the knowledge base includes at least two knowledge sub-bases of different types, storing at least one of structured knowledge-graph and unstructured content such as text, images, video and audio.
By way of example, the knowledge base may include at least two of a first knowledge sub-base, a second knowledge sub-base, and a third knowledge sub-base.
Referring to fig. 4, the first knowledge sub-base includes a knowledge graph, wherein nodes in the knowledge graph include entity nodes and attribute nodes, any one entity node is used for representing a sales object, and at least one attribute node connected with any entity node is used for representing an attribute of the sales object; referring to fig. 3, taking sales objects as dishes as an example, one dish may include 16 attributes such as { category, dish, throttle, city, taste, period, practice, scene, efficacy, food material, season, region, holiday, province, mood, crowd }; of course, fewer or more attributes may be included, which is not limiting in this embodiment.
In one possible implementation, for missing edges in the knowledge graph, relationships between dishes and attributes may be constructed using other language models that are pre-trained, or relationships between dishes and attributes may also be constructed using knowledge searched by an external search engine. For example, the "crowd" has no mounting relationship between crowd and dishes in the original knowledge graph, and at least one of the pretrained other language models and encyclopedia knowledge can be utilized to perform reasoning, such as crowd of the old, soft food, porridge, xx porridge, and further such as crowd losing weight, low-fat food and cooking mode combination condition, xx salad, and the like, so as to perform reasoning and edge structuring, thereby constructing the mounting relationship between crowd and dishes.
In another possible implementation manner, for the existing connection relationship between the entity node and the attribute node in the knowledge graph, the answer of other pre-trained language models or the search content of an external search engine can be calibrated to improve the accuracy.
The second knowledge sub-base contains science popularization texts corresponding to different sales objects, for example, recipes or sources of different dishes (such as the making method of spicy bean curd, the origin of rice dumplings and the like), or the parts constitution, materials or origins of different commodities (such as the materials of clothes and the parts contained in an automobile model) and the like can be obtained from related science popularization websites.
The third knowledge sub-base contains several texts corresponding to different sales objects and their text vectors. The text vectors contained in the third knowledge sub-base are obtained by converting text input pre-trained vector generation models corresponding to different sales objects respectively.
The vector generation model is trained by the following modes: acquiring a second training data set, wherein the second training data set comprises a plurality of third problem samples, one part of the third problem samples carry correct dialogue contents, and the other part of the third problem samples carry error dialogue contents; the second training data set is input into a vector generation model, the third question sample and the answer text thereof are respectively converted into text vectors by the vector generation model, and the vector generation model is trained by taking the similarity between the text vectors of the third question sample and the text vectors of correct dialogue contents and the similarity between the text vectors of the third question sample and the text vectors of error dialogue contents as optimization targets. That is, the trained vector generation model enables as much similarity as possible between the text vector of the question and the text vector of the correct answer, and as much difference as possible between the text vector of the question and the text vector of the incorrect answer, so that some questions of unknown intent can be solved from vector angles.
For example, in a menu recommended scenario, the third question sample may be an ambiguous question such as "I do not know what to eat", "the belly is uncomfortable, does not want to eat", and the correct answer corresponding thereto such as "you recommended you eat the spot XX porridge bar, XX porridge is nutritious and delicious … …", and the incorrect answer corresponding thereto such as "just today's weather, temperature is 30 ℃ … …". The trained vector generation model can make the text vectors of the problem that the bellyband is uncomfortable, the text vectors of the problem that the bellyband is not wanted to eat and the text vectors of the problem that the correct answer is recommended to eat the point XX porridge bar, the XX porridge is nutritious and delicious … … are similar as possible, namely the distance between the two text vectors is as short as possible, while the text vectors of the problem that the bellyband is uncomfortable, the text vectors of the problem that the bellyband is not wanted to eat and the text vectors of the problem that the correct answer are just right today and the temperature is 30 ℃ … … are different as far as possible, namely the distance between the two text vectors is as far as possible. In some embodiments, for a second problem sample that needs external knowledge, target knowledge may be obtained from a preset knowledge base according to the second problem sample, and a prompt text corresponding to the target knowledge may be generated.
In one possible implementation, the knowledge base includes at least two of a first knowledge sub-base, a second knowledge sub-base, and a third knowledge sub-base. Target knowledge related to the second problem sample may be obtained from all knowledge sub-bases contained in the knowledge base.
In another possible implementation manner, intention recognition may be performed on the second problem sample to obtain intention information; carrying out slot extraction on the second problem sample to obtain slot information; and determining a target knowledge sub-base from at least two knowledge sub-bases according to the intention information and the slot position information, and acquiring target knowledge corresponding to the second problem sample from the target knowledge sub-base.
By way of example, the intent information may include, but is not limited to, "recommended intent," "popular intent," and "unknown intent," etc., and the slot information may include, but is not limited to, sales objects and attribute information of sales objects.
By way of example, intent recognition refers to determining what a user's intent or needs are based on given text content. This may be done by pre-trained intent recognition models. The training process of the intent recognition model involves the steps of:
(1) Data preparation: first, a labeled training data set needs to be prepared. The training dataset should contain a plurality of text samples and corresponding intention labels.
(2) Feature extraction: the text sample is converted into a representation of features that can be processed by the machine learning algorithm. The text is converted into a vector representation, for example using a bag of words model or TF-IDF method. Or may also use Word embedding (e.g., word2Vec, gloVe, etc.) for higher level feature representation.
(3) Model selection and training: a machine learning algorithm or a deep learning model suitable for the intent recognition task is selected. Machine learning algorithms include, for example, naive bayes, support Vector Machines (SVMs), decision trees, random forests, and the like; the deep learning model includes, for example, a Recurrent Neural Network (RNN), a long short term memory network (LSTM), a Convolutional Neural Network (CNN), and the like. The selected model is trained using training data.
(4) Model evaluation and tuning: and performing performance evaluation on the trained model by using an evaluation data set, and calculating indexes such as accuracy, recall rate, F1 value and the like of the model on the intention recognition task. For models with less than ideal performance, attempts may be made to adjust the super parameters, increase the amount of data, use regularization methods, etc. for tuning. Thereby obtaining the intention recognition model.
After training the intent recognition model, the model outputs predicted intent labels according to the input problems.
By way of example, slot extraction refers to the process of identifying and extracting specific information from a given text. In natural language processing, slots typically represent key information or parameters in text. The slot extraction can be achieved in several ways:
(1) Rule-based method: a predefined rule or regular expression is used to match and extract text information of a particular pattern, such as phone number, date, address, dish attributes (see fig. 3), etc.
(2) The machine learning method comprises the following steps: a model is trained using a machine learning algorithm to classify text sequences into different slot types. Common methods include sequence labeling models, such as Conditional Random Fields (CRF) or Recurrent Neural Networks (RNN), and deep learning based models, such as BERT, biLSTM, etc.
(3) Pre-training model method: the slot extraction is performed by means of fine tuning or transfer learning, using models that have been pre-trained on a large corpus.
Illustratively, a comprehensive model may also be pre-trained by machine learning methods for intent recognition and slot extraction, which is not limited in this embodiment.
After the intent information and slot information of the second problem sample are obtained, a category may be determined from the intent information and slot information. The category indicated by the intent information and slot information may be determined by:
(1) Rule matching: a series of rules are defined, and categories are determined by the degree to which the intent information and slot information match the rules. The rule may be a mapping relationship between different combinations of intention information and slot position information and different categories respectively.
(2) Machine learning classifier: the intent classifier is constructed using a machine learning method (e.g., naive bayes, support vector machines, random forests, etc.) or a deep learning model (e.g., convolutional neural network, recurrent neural network, etc.). And converting the intention information and the slot position information into feature vectors, and then training a classifier to classify.
(3) The mixing method comprises the following steps: combining rule matching and a machine learning classifier, utilizing the rule matching to quickly screen out some clear intention categories, and then classifying the rest text by using the machine learning classifier. This approach may improve the efficiency and accuracy of classification.
(4) Classification based on language model: text classification is performed using pre-trained language models (e.g., BERT, GPT, etc.). The intention information and the slot information are input, and classification judgment is performed by using the representation generated by the language model.
In a first possible case: if the intention information and the slot information indicate a first category, the first category represents recommending sales objects with the attribute specified by the slot information, and the first knowledge sub-base is determined as a target knowledge sub-base; and then searching a target node corresponding to the slot position information in the knowledge graph, and acquiring target knowledge corresponding to the second problem sample according to the connection relation between the target node and other nodes.
For example, assuming that the second problem sample is "which is spicy" and the intention information is "recommended dishes", the slot information is "spicy", after the first knowledge sub-base is determined to be the target knowledge sub-base, the target node corresponding to "spicy" may be searched in the knowledge graph, dishes related to "spicy" such as "spicy bean curd", "spicy rabbit head" and "hot pepper fried meat" may be further obtained according to the connection relationship between the entity node where the dishes are located and other attribute nodes, and other attribute information may be further obtained as the target knowledge.
In a second possible case, if the intention information and the slot information indicate a second category, the second category characterizes popular science of the composition or source of the sales object, and the second knowledge sub-base is determined as a target knowledge sub-base; and searching a science popularization text corresponding to the sales object indicated by the slot position information in the second knowledge sub-base to serve as target knowledge corresponding to the second problem sample.
For example, assuming that the second problem sample is "how to do the beancurd", the intention information is "introduction menu", the slot information is "beancurd", after determining that the second knowledge sub-base is the target knowledge sub-base, the science popularization text corresponding to "beancurd" may be searched as the target knowledge corresponding to the second problem sample.
In a third possible scenario, if the intent information and slot information indicate that they do not belong to the first category and the second category, such as, for example, "unknown intent" and no slot information, the third knowledge sub-base may be determined as a target knowledge sub-base to determine target knowledge from vector angles; and then, a text vector corresponding to the second problem sample can be obtained based on the vector generation model, the similarity between the text vector corresponding to the second problem sample and the text vector in the third knowledge sub-base is determined, and the text corresponding to the text vector with the similarity higher than the second preset threshold value in the third knowledge sub-base is used as the target knowledge corresponding to the second problem sample. The second preset threshold may be specifically set according to an actual application scenario, which is not limited in this embodiment, for example, the second preset threshold is greater than 90%. According to the method, the target knowledge is obtained from the third knowledge sub-base, so that the problem that some intentions of the user are not clear enough can be solved, and the accuracy of the reply and the satisfaction of the user are improved.
According to the embodiment, the external knowledge is obtained through the three modes, different types of problems of a user can be dealt with, and the accuracy and the diversity of the external knowledge are improved, so that the accuracy and the comprehensiveness of subsequent replies are improved.
After obtaining the target knowledge corresponding to the second problem sample, a prompt text corresponding to the target knowledge may be generated. For example, the prompt text may include a character prompt and a reply prompt, the character prompt indicating that the pre-trained language model is replied to from the perspective of a specified character (e.g., a food, a merchandise evaluator, etc.); a reply prompt instructs the pre-trained language model to reply to the second question sample with reference to the target knowledge. That is, the prompt text may then control the specific form of knowledge injection so that the pre-trained language model can answer in a desired manner. For example, the prompt text may be "you are a food expert, please answer on the XX target knowledge basis for the XX question".
In some embodiments, the pre-trained language model refers to a natural language processing model with huge parameter scale and learning capabilities, and may include, but is not limited to, GPT (GENERATIVE PRE-trained Transformer) models and their variant models, chinese language models and their variant models, and the like.
In some embodiments, for a first question sample that does not require external knowledge, the first question sample may be directly input into the pre-trained language model to generate a first predictive answer from the first question sample by the pre-trained language model; and for the second question sample requiring external knowledge, after the target knowledge corresponding to the second question sample and the prompt text corresponding to the target knowledge are obtained in the above manner, the second question sample, the target knowledge corresponding to the second question sample and the prompt text corresponding to the target knowledge may be input into the pre-training language model, so as to generate a second prediction reply according to the second question sample, the target knowledge and the prompt text by the pre-training language model.
During the training process, an evaluation function needs to be defined to measure the difference or error between the model prediction result and the real label. This evaluation Function, commonly referred to as Loss Function (Loss Function), is capable of measuring the performance of the model. Minimizing an error between the first predicted answer and dialog content corresponding to the first question sample may be based on (1); (2) And constructing a loss function by minimizing two optimization targets, namely errors between the second prediction answers and dialogue contents corresponding to the second question samples, and further minimizing the loss function through a predetermined optimization method. Common optimization methods include random gradient descent (Stochastic GRADIENT DESCENT, SGD), adam, RMSprop, and the like. These methods improve the predictive power of the model by adjusting the model parameters such that the loss function is gradually reduced.
Further, considering the complexity of natural language, there may be an error in the way only the loss function is calculated; thus, after the first predicted reply and the second predicted reply are obtained, evaluation information for the first predicted reply and evaluation information for the second predicted reply may be further obtained; and then training the pre-training language model by combining the evaluation information aiming at the first predicted reply and the evaluation information aiming at the second predicted reply while taking the error between the minimized first predicted reply and the dialogue content corresponding to the first question sample and the error between the second predicted reply and the dialogue content corresponding to the second question sample as optimization targets so as to further improve the accuracy of the model output result.
For example, the evaluation information for the first predicted reply and the evaluation information for the second predicted reply may be entered by a user in the interactive interface.
Illustratively, the evaluation information includes an evaluation result of at least one dimension; the dimensions include at least one of: security dimension, reply correctness dimension, reply diversity dimension, relevance dimension, reply format dimension, and platform feature dimension.
① The evaluation result of the security dimension is used for indicating whether the first predicted reply and the second predicted reply meet a preset rule.
For example, assuming that the first predicted reply contains a sensitive word or an illicit word that does not meet the preset specification, the result of the evaluation in the security dimension is that the preset specification is not met.
② The evaluation result of the answer correctness dimension is used for indicating whether the contents of the first predicted answer and the second predicted answer accord with objective facts.
For example, assuming that the first predicted response is "the kidney bean can treat cancer," which is clearly not in agreement with the fact, the result of the assessment in the response correctness dimension is not in agreement with the objective fact.
③ The evaluation of the diversity dimension of the replies is used to indicate whether more than one sales object is mentioned in the first predicted reply and the second predicted reply.
For example, assuming that the first question is "what breakfast" and the first predicted response contains multiple dishes such as "soy milk, deep-fried dough sticks, steamed bread, spicy soup", the results of the evaluation in the diversity dimension of the response are consistent.
④ The evaluation result of the correlation dimension is used for indicating the degree of correlation between the first question sample and the first predicted answer and the degree of correlation between the second question sample and the second predicted answer.
For example, in the food platform, assuming that the first question sample is "what is eaten by the midday festival", the first predictive answer is "the midday festival is one of the traditional holidays in China, and commonly there are conventions of eating rice dumplings, dragon boats, hanging mugwort, and the like. The rice dumplings are one of the most representative foods in the midday festival, and are often made of various food materials such as glutinous rice, meat, egg yolk and the like, and have sweet, soft and glutinous mouthfeel. Some areas can adopt plant leaves such as bamboo leaves, corn leaves and the like to wrap the rice dumplings, so that the fragrance and the nutritional value of the rice dumplings are increased. The dragon boat is also one of important activities of the midday festival, and is an activity integrating sports, culture and entertainment. People can form a fleet to play a competitive ferry at the middle opening of a river, a lake or the sea, commemorative love poets yield original. The hanging of the mugwort is also one of the traditional custom of the end noon festival, and the mugwort has the functions of mosquito expelling, pathogen avoiding, disease prevention and body building. People can hang moxa on a doorway, a window or hang the moxa on the body to avoid evil and pray for fortune. Overall, eating habit of the midday festival is various, and has strong local characteristics and cultural connotation. "wherein, the introduction of" Sailong "and" hanging wormwood "in the first predicted answer is less relevant to the first question sample, the evaluation result of the first predicted answer in the relevance dimension is 0.3 (which indicates 30% of relevant content).
⑤ The evaluation result of the reply format dimension is used for indicating whether the first predicted reply and the second predicted reply meet a preset text format or not; the preset text format includes at least one of a total score format, and a total score format.
For example, in the above example, for the first question sample being "what is eaten at noon", the first predicted answer is in total score total format, satisfying the preset text format.
⑥ The evaluation result of the platform dimension is used for indicating whether the first prediction reply and the second prediction reply meet the scene characteristics of the platform; such as in a food platform, there is a tendency to give replies from the viewpoint of the food family; also for example in medical platforms, it is preferable to give a response from the doctor's perspective.
For example, in a food platform, such as "how good nearby" a second question sample is, the second predictive answer is "you good! The restaurant is a private food family, and the nearby of the family is provided with XX rice lines, XX coconut chickens, XX simple meals, XX big gear and XX restaurant, and the family can be screened according to regions, tastes and the like to find a restaurant suitable for the family. Blessing you to get dinner-! ".
Illustratively, the pre-trained language model may be fine-tuned in three ways:
(1) And fine tuning the whole pre-training language model, and updating parameters of the whole pre-training language model.
(2) Most of the parameters of the pre-trained language model are frozen and only a relatively small set of model parameters are trimmed.
(3) The embedded layer (Embedding) of the pre-trained language model and each neural network layer are preceded by new parameters.
During model training, the model parameters are adjusted step by iterative optimization. Each training iteration includes the steps of forward propagation (Forward Propagation), calculation of loss function values, backward propagation (Backward Propagation), and parameter updating. The number of training iterations is typically adjusted dynamically by setting a fixed number of iterations or according to the performance of the model on the validation set.
For example, training tuning can be performed by any combination of different training data, different pre-training language models and different fine tuning modes, and finally, a dialogue content generation model meeting the requirements is obtained.
In some embodiments, referring to fig. 5, the embodiment of the present disclosure further provides a method for generating dialogue content, including:
in S201, a question of an input is received.
In S202, it is determined whether the question needs to be answered in conjunction with external knowledge.
In S203, if yes, acquiring target knowledge from a preset knowledge base according to the problem, and generating a prompt text corresponding to the target knowledge; inputting the questions, the target knowledge and the prompt text corresponding to the target knowledge into a dialogue content generation model, and generating dialogue content according to the questions, the target knowledge and the prompt text by the dialogue content generation model; the prompt text is used for prompting the dialogue content generation model to answer the question with reference to the target knowledge.
If not, S204, inputting the question into the dialogue content generation model, and generating dialogue content according to the question by the dialogue content generation model; the dialogue content generation model is obtained by fine tuning of a pre-training language model.
In this embodiment, considering that only the manner of inputting a question and solving the question by the dialogue content generation model cannot acquire some external knowledge in real time, there may be defects such as lack of actual knowledge, inability to process a problem with strong timeliness or openness, etc., so in order to further improve the accuracy of the answer, the application realizes that whether the inputted question needs to be combined with external knowledge first, and when determining that the question needs external knowledge, the target knowledge is injected into the dialogue content generation model through a prompt text to help the dialogue content generation model acquire more external knowledge, and the combination of the two dialogue content generation manners is beneficial to accurately solving the general intention problem of the user and improving the accuracy and satisfaction of the dialogue content.
For S201, the question may be a question that the user currently inputs in the interactive interface. Or in the case that the user performs multiple rounds of conversations with the electronic equipment, the problem can be a problem obtained by combining the historical problem input by the user and the problem input at the interactive interface currently in the multiple rounds of conversations, so that the conversation content generation model is convenient to make clear the user intention.
Referring to table 1, the problem sequence is a historical problem+a current input problem, and the problem obtained by combining the historical problem+the current input problem is input into the dialogue content generation model, so that the dialogue content generation model can more accurately learn the intention of the user, thereby growing the dialogue content with higher accuracy.
TABLE 1
Problem sequence Problems obtained after bonding
Recommending that some northern vegetables and I not eat meat Recommending northern vegetable dishes
Recommended breakfast + no-drink porridge Breakfast recommendation (without porridge)
Recommended breakfast + weight loss is appropriate and not like to drink porridge Searching for breakfast substitutes
What breakfast in summer+night woolen+which are suitable for the old Food recommendation for elderly people to eat
What is good for adults + i cannot eat too hot Finding a non-spicy ready-to-use food
Northern winter to eat what+southern woolen+Shanghai woolen Shanghai traditional food recommendation
For S202, as can be seen from the foregoing, the dialogue content generation model is obtained by fine tuning a pre-training language model based on a first training data set; the first training data set includes a number of first samples and a number of second samples. The first sample comprises a first question sample and corresponding dialogue content. The second sample comprises a second question sample, target knowledge corresponding to the second question sample, prompt text corresponding to the target knowledge and dialogue content corresponding to the second question sample; and obtaining target knowledge corresponding to the second problem sample from the knowledge base. The first problem sample is a problem requiring no reference to external knowledge, and the second problem sample is a problem requiring reference to external knowledge.
In one possible implementation manner, when judging whether an input problem needs to be replied with external knowledge, determining semantic similarity between the problem and a plurality of first problem samples respectively; and judging whether the questions need to be replied by combining external knowledge according to semantic similarity between the questions and a plurality of first question samples.
For example, if the semantic similarity between the question and at least one of the first question samples is higher than a first preset threshold, the dialogue content generation model has learned knowledge related to the question in a training phase, so that it may be determined that the question does not need to be replied with external knowledge; otherwise, the dialog content generation model lacks knowledge about the question, determining that the question needs to be answered in combination with external knowledge. It can be appreciated that the first preset threshold may be specifically set according to the actual application scenario, which is not limited in this embodiment, for example, the preset threshold is 85% or 90% or greater than 80%.
For S203, after determining that the inputted question needs to be replied with external knowledge, the target knowledge may be acquired from a preset knowledge base according to the question.
Illustratively, the knowledge base includes at least two knowledge sub-bases of different types. The intention recognition can be carried out on the problems to obtain intention information; extracting the slot position of the problem to obtain slot position information; and then determining a target knowledge sub-base from the at least two knowledge sub-bases according to the intention information and the slot position information, and acquiring target knowledge corresponding to the problem from the target knowledge sub-base. For the implementation process of intent recognition and slot extraction, reference is made to the above description, and details are not repeated here.
The knowledge base includes at least two of a first knowledge sub-base, a second knowledge sub-base, and a third knowledge sub-base.
(1) Referring to fig. 4, the first knowledge sub-base includes a knowledge graph, where nodes in the knowledge graph include entity nodes and attribute nodes, any one entity node is used to represent a sales object, and at least one attribute node connected with any entity node is used to represent an attribute of the sales object.
(2) The second knowledge sub-base contains science popularization texts corresponding to different sales objects.
(3) The third knowledge sub-base contains several texts corresponding to different sales objects and their text vectors. The text vectors contained in the third knowledge sub-base are obtained by converting texts corresponding to different sales objects respectively into a pre-trained vector generation model. For the training process of the vector generation model, reference is made to the above description, and will not be repeated here.
In a first possible case, if the intent information and the slot information indicate a first category that characterizes a recommendation for a sales object having an attribute specified by the slot information, the first knowledge sub-base may be determined as a target knowledge sub-base; and searching a target node corresponding to the slot position information in the knowledge graph, and acquiring target knowledge corresponding to the problem according to the connection relation between the target node and other nodes.
In a second possible case, if the intention information and the slot information indicate a second category, the second category characterizes popular science of the composition or source of the sales object, and the second knowledge sub-base is determined as a target knowledge sub-base; and searching a science popularization text corresponding to the sales object indicated by the slot position information in the second knowledge sub-base to serve as target knowledge corresponding to the problem.
In a third possible case, if the intention information and the slot information indicate that the text vectors do not belong to the first category and the second category, determining the third knowledge sub-base as a target knowledge sub-base, determining the similarity between the text vectors corresponding to the problem and the text vectors in the third knowledge sub-base, and taking the text corresponding to the text vectors with the similarity meeting the second condition in the third knowledge sub-base as the target knowledge corresponding to the problem. According to the method, the target knowledge is obtained from the third knowledge sub-base, so that the problem that some intentions of the user are not clear enough can be solved, and the accuracy of the reply and the satisfaction of the user are improved.
According to the embodiment, the external knowledge is acquired through the three modes, so that the accuracy and the diversity of the external knowledge can be improved, and the accuracy and the comprehensiveness of subsequent replies are improved.
After obtaining the target knowledge corresponding to the problem, a prompt text corresponding to the target knowledge may be generated. For example, the prompt text may include a character prompt text and a dialogue content prompt text, the character prompt text indicating that the dialogue content generation model is to answer from a designated character (e.g., a food family, a merchandise evaluator, etc.); the dialog content prompt text instructs the dialog content generation model to reply to the entered question with reference to the target knowledge. That is, the prompt text may then control the specific form of knowledge injection so that the dialog content generation model can answer in a desired manner. For example, the prompt text may be "you are a food expert, please refer to XX target knowledge for a response for XX questions".
Then, the question, the target knowledge, and the prompt text corresponding to the target knowledge may be input into a dialog content generation model, and dialog content may be generated by the dialog content generation model based on the question, the target knowledge, and the prompt text. In this embodiment, the target knowledge is injected into the dialogue content generation model through the prompt text, so that the dialogue content generation model is helped to acquire more external knowledge, the problem of the general intention of the user can be solved accurately, and the accuracy and satisfaction of the dialogue content are improved.
For S204, if the inputted question does not need to incorporate external knowledge, the question may be directly inputted into the dialogue content generation model, and the dialogue content is generated by the dialogue content generation model according to the question; the dialogue content generation model is obtained by fine tuning of a pre-training language model.
In some embodiments, from a security dimension perspective, after receiving an input problem, the problem may be first quality tested to obtain a first quality test result; if the first quality inspection result meets the first quality inspection condition, executing S102; otherwise, outputting prompt information that the problem does not accord with the preset regulation in the interactive interface. Illustratively, the first quality inspection condition indicates that the entered question does not contain a preset sensitive word or a preset contraband word; but is not limited thereto.
In some embodiments, from the safety dimension, after the dialogue content generation model generates the dialogue content, quality detection can be performed on the dialogue content generated by the dialogue content generation model to obtain a second quality inspection result; and if the second quality inspection result meets a second quality inspection condition, displaying dialogue content corresponding to the problem in the interactive interface. Illustratively, the second quality check condition indicates that the dialog content does not contain a preset sensitive word or a preset contraband word, and/or that the dialog content meets objective facts; but is not limited thereto.
In some embodiments, the dialog content includes at least one of text, images, video, and audio corresponding to the sales object. For example, referring to fig. 6 for a food product, the input question is "i want to eat sweet", and the dialog content generation model generates dialog content as shown in fig. 6.
In some embodiments, in order to further reduce user operations, after the dialogue content generated by the dialogue content generation model, a jump identifier may be further set for a sales object in the dialogue content generated by the dialogue content generation model, and then the dialogue content and the jump identifier of the sales object in the dialogue content are displayed in an interactive interface, as shown in fig. 6, and further, a sales page of the sales object indicated by the jump identifier may be obtained in response to a triggering operation of a user on any jump identifier in the interactive interface, and the sales page is displayed in the interactive interface. In the embodiment, the user does not need to exit the page of the current display dialogue content and search the sales objects in the dialogue content again, so that the operation steps of the user are reduced, and the user is further facilitated.
Illustratively, the sales object includes a dish, and the sales page is used for displaying at least one of at least one store containing the dish and purchase information of the dish. The sales object includes an article, and the sales page is used for displaying purchase information of the article, such as detailed description of the article, purchase control and the like.
For example, referring to fig. 7, in case that the user clicks on "banana with wire drawing", the electronic device may display stores including banana with wire drawing in the interactive interface in response to the clicking operation, so that the user selects one of the stores to order according to his actual requirement.
In some embodiments, referring to fig. 8, the embodiment of the present disclosure further provides a method for generating a prompt text, including:
In S301, a question of an input is received.
In S302, target knowledge corresponding to the problem is obtained from a preset knowledge base.
In S303, generating a prompt text according to the question and the target knowledge; the question, the target knowledge and the prompt text are used for being input into a dialogue content generation model to obtain dialogue content, and the prompt text is used for prompting the dialogue content generation model to answer the question by referring to the target knowledge.
In the embodiment of the specification, the target knowledge corresponding to the problem can be obtained, so that the prompt text is generated according to the problem and the target knowledge, the prompt text is used for prompting the dialogue content generation model to answer the problem by referring to the target knowledge, and the target knowledge is injected into the dialogue content generation model through the prompt text, so that the answer accuracy of the dialogue content generation model is improved.
In some embodiments, the alert text includes character alert text and dialog content alert text; the role prompt text is used for prompting the dialogue content generation model to answer from the angle of the appointed role; the dialogue content prompt text is used for prompting the dialogue content generation model to answer the questions with reference to the target knowledge.
In some embodiments, prior to S302, further comprising: judging whether the questions need to be replied by combining with external knowledge or not; if yes, S302 and S303 are performed.
In some embodiments, after S303, further comprising: inputting the questions, the target knowledge and the prompt text corresponding to the target knowledge into a dialogue content generation model, and generating dialogue content according to the questions, the target knowledge and the prompt text by the dialogue content generation model; the dialogue content generation model is obtained by fine tuning of a pre-training language model.
In some embodiments, if the question does not need to be answered in conjunction with external knowledge, inputting the question into the dialog content generation model, generating dialog content from the question by the dialog content generation model; the dialogue content generation model is obtained by fine tuning of a pre-training language model.
In some embodiments, the knowledge base includes at least two knowledge sub-bases of different types. The obtaining the target knowledge corresponding to the problem from the preset knowledge base comprises the following steps: carrying out intention recognition on the problem to obtain intention information; extracting the slot position of the problem to obtain slot position information; and determining a target knowledge sub-base from the at least two knowledge sub-bases according to the intention information and the slot position information, and acquiring target knowledge corresponding to the problem from the target knowledge sub-base.
In some embodiments, the knowledge base includes at least two of a first knowledge sub-base, a second knowledge sub-base, and a third knowledge sub-base. The first knowledge sub-base comprises a knowledge graph, wherein nodes in the knowledge graph comprise entity nodes and attribute nodes, any one entity node is used for representing a sales object, and at least one attribute node connected with any entity node is used for representing an attribute of the sales object. The second knowledge sub-base contains science popularization texts corresponding to different sales objects. The third knowledge sub-base contains several texts corresponding to different sales objects and their text vectors.
In some embodiments, the determining a target knowledge sub-base from the at least two knowledge sub-bases according to the intent information and the slot information includes: if the intention information and the slot information indicate a first category, the first category represents recommending sales objects with the attribute specified by the slot information, and the first knowledge sub-base is determined as a target knowledge sub-base; if the intention information and the slot position information indicate a second category, the second category represents that the composition or the source of the sales object is subject to science popularization, and the second knowledge sub-base is determined as a target knowledge sub-base; and if the intention information and the slot information indicate that the knowledge belongs to the first category and the second category, determining the third knowledge sub-base as a target knowledge sub-base.
In some embodiments, the obtaining the target knowledge corresponding to the problem from the target knowledge sub-base includes: if the target knowledge sub-base is the first knowledge sub-base, searching a target node corresponding to the slot position information in the knowledge graph, and acquiring target knowledge corresponding to the problem according to the connection relation between the target node and other nodes; if the target knowledge sub-base is the second knowledge sub-base, searching a science popularization text corresponding to the sales object indicated by the slot position information in the second knowledge sub-base as target knowledge corresponding to the problem; if the target knowledge sub-base is the third knowledge sub-base, determining the similarity between the text vectors corresponding to the problem and the text vectors in the third knowledge sub-base respectively, and taking the text corresponding to the text vectors with the similarity higher than a second preset threshold value in the third knowledge sub-base as the target knowledge corresponding to the problem.
For a specific implementation of the method for generating the prompt text, reference may be made to the relevant points of the foregoing embodiments, which are not described herein.
The various technical features of the above embodiments may be arbitrarily combined as long as there is no conflict or contradiction between the features, but are not described in detail, and therefore, the arbitrary combination of the various technical features of the above embodiments is also within the scope of the disclosure of the present specification.
Correspondingly, the embodiment of the specification also provides electronic equipment, which comprises a processor;
a memory for storing processor-executable instructions;
Wherein the processor implements the method of any of the above by executing the executable instructions.
Illustratively, fig. 9 is a schematic block diagram of an electronic device according to an exemplary embodiment. Referring to fig. 9, at a hardware level, the device includes a processor 902, an internal bus 904, a network interface 906, a memory 908, and a nonvolatile storage 910, although other hardware required by other services is also possible. One or more embodiments of the present description may be implemented in a software-based manner, such as by the processor 902 reading a corresponding computer program from the non-volatile memory 910 into the memory 908 and then running. Of course, in addition to software implementation, one or more embodiments of the present disclosure do not exclude other implementation manners, such as a logic device or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but may also be hardware or a logic device.
Accordingly, the present specification also provides a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of any of the methods described above.
The system, apparatus, module or unit set forth in the above embodiments may be implemented in particular by a computer chip or entity, or by a product having a certain function. A typical implementation device is a computer, which may be in the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or a combination of any of these devices.
In a typical configuration, a computer includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, read only compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic disk storage, quantum memory, graphene-based storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by the computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises the element.
The foregoing describes specific embodiments of the present disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
The terminology used in the one or more embodiments of the specification is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of the specification. As used in this specification, one or more embodiments and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any or all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used in one or more embodiments of the present description to describe various information, these information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of one or more embodiments of the present description. The word "if" as used herein may be interpreted as "at … …" or "at … …" or "in response to a determination" depending on the context.
The foregoing description of the preferred embodiment(s) is (are) merely intended to illustrate the embodiment(s) of the present invention, and it is not intended to limit the embodiment(s) of the present invention to the particular embodiment(s) described.

Claims (10)

1. A conversation content processing method, characterized by comprising:
Acquiring dialogue content generated by a dialogue content generation model; wherein the dialogue content generation model is obtained by fine tuning a pre-training language model;
Setting a jump identifier for a sales object in the dialogue content generated by the dialogue content generation model;
Displaying the dialogue content and the jump identification of the sales object in the dialogue content in an interactive interface; and
And responding to the triggering operation of any jump mark, acquiring a sales page of a sales object indicated by the jump mark, and displaying the sales page in an interactive interface.
2. The method of claim 1, wherein the dialog content comprises at least one of text, images, video, and audio corresponding to a sales object.
3. The method of claim 1, wherein the sales object comprises a dish, the sales page being for displaying at least one of at least one store containing the dish and purchase information of the dish; or alternatively
The sales object comprises a commodity, and the sales page is used for displaying purchasing information of the commodity.
4. The method of claim 1, wherein the obtaining the dialog content generated by the dialog content generation model comprises:
A question of receiving an input;
Judging whether the questions need to be replied by combining with external knowledge or not;
If yes, acquiring target knowledge from a preset knowledge base according to the problem, and generating a prompt text corresponding to the target knowledge; inputting the questions, the target knowledge and the prompt text corresponding to the target knowledge into a dialogue content generation model, and generating dialogue content according to the questions, the target knowledge and the prompt text by the dialogue content generation model; the prompt text is used for prompting the dialogue content generation model to answer the question by referring to the target knowledge;
If not, inputting the problem into the dialogue content generation model, and generating dialogue content according to the problem by the dialogue content generation model.
5. The method of claim 4, wherein the dialog content generation model is derived by fine tuning a pre-training language model based on a first training data set;
The first training data set includes a number of first samples and a number of second samples;
the first sample comprises a first question sample and corresponding dialogue content thereof;
The second sample comprises a second question sample, target knowledge corresponding to the second question sample, prompt text corresponding to the target knowledge and dialogue content corresponding to the second question sample; and obtaining target knowledge corresponding to the second problem sample from the knowledge base.
6. The method of claim 5, wherein said determining whether the question requires replying with external knowledge comprises:
determining semantic similarity between the problem and a plurality of first problem samples respectively;
If the semantic similarity between the question and at least one first question sample is higher than a first preset threshold, determining that the question does not need to be replied by combining external knowledge; otherwise, it is determined that the question needs to be answered in conjunction with external knowledge.
7. The method of claim 4, wherein the knowledge base comprises at least two knowledge sub-bases of different types;
the obtaining the target knowledge from the preset knowledge base according to the problem comprises the following steps:
carrying out intention recognition on the problem to obtain intention information; extracting the slot position of the problem to obtain slot position information;
And determining a target knowledge sub-base from the at least two knowledge sub-bases according to the intention information and the slot position information, and acquiring target knowledge corresponding to the problem from the target knowledge sub-base.
8. An electronic device, comprising:
A processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to implement the method of any one of claims 1 to 7 by executing the executable instructions.
9. A computer readable storage medium having stored thereon computer instructions which, when executed by a processor, implement the steps of the method of any of claims 1 to 7.
10. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, realizes the steps of the method according to any one of claims 1 to 7.
CN202410133403.7A 2023-08-22 2023-08-22 Dialogue content processing method, equipment, storage medium and product Pending CN117972057A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410133403.7A CN117972057A (en) 2023-08-22 2023-08-22 Dialogue content processing method, equipment, storage medium and product

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202311069899.8A CN116821308B (en) 2023-08-22 2023-08-22 Generation method, training method and device of model and storage medium
CN202410133403.7A CN117972057A (en) 2023-08-22 2023-08-22 Dialogue content processing method, equipment, storage medium and product

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
CN202311069899.8A Division CN116821308B (en) 2023-08-22 2023-08-22 Generation method, training method and device of model and storage medium

Publications (1)

Publication Number Publication Date
CN117972057A true CN117972057A (en) 2024-05-03

Family

ID=88126034

Family Applications (2)

Application Number Title Priority Date Filing Date
CN202410133403.7A Pending CN117972057A (en) 2023-08-22 2023-08-22 Dialogue content processing method, equipment, storage medium and product
CN202311069899.8A Active CN116821308B (en) 2023-08-22 2023-08-22 Generation method, training method and device of model and storage medium

Family Applications After (1)

Application Number Title Priority Date Filing Date
CN202311069899.8A Active CN116821308B (en) 2023-08-22 2023-08-22 Generation method, training method and device of model and storage medium

Country Status (1)

Country Link
CN (2) CN117972057A (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117076650B (en) * 2023-10-13 2024-02-23 之江实验室 Intelligent dialogue method, device, medium and equipment based on large language model
CN117076660B (en) * 2023-10-16 2024-01-26 浙江同花顺智能科技有限公司 Information recommendation method, device, equipment and storage medium
CN117093698B (en) * 2023-10-19 2024-01-23 四川蜀天信息技术有限公司 Knowledge base-based dialogue generation method and device, electronic equipment and storage medium
CN117252664A (en) * 2023-11-10 2023-12-19 浙江口碑网络技术有限公司 Medicine recommendation reason generation method, device, medium and equipment
CN117235238B (en) * 2023-11-13 2024-03-08 广东蘑菇物联科技有限公司 Question answering method, question answering device, storage medium and computer equipment
CN117251552B (en) * 2023-11-13 2024-02-27 腾讯科技(深圳)有限公司 Dialogue processing method and device based on large language model and electronic equipment
CN117436441A (en) * 2023-12-14 2024-01-23 浙江口碑网络技术有限公司 Text structure recognition method based on large language model

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10824658B2 (en) * 2018-08-02 2020-11-03 International Business Machines Corporation Implicit dialog approach for creating conversational access to web content
CN110874401B (en) * 2018-08-31 2023-12-15 阿里巴巴集团控股有限公司 Information processing method, model training method, device, terminal and computing equipment
CN113268609B (en) * 2021-06-22 2023-12-01 中国平安人寿保险股份有限公司 Knowledge graph-based dialogue content recommendation method, device, equipment and medium
CN113569020B (en) * 2021-06-22 2023-10-10 复旦大学 Dialogue management method for integrating knowledge reasoning and knowledge guiding in intelligent dialogue system
US20230009946A1 (en) * 2021-07-12 2023-01-12 International Business Machines Corporation Generative relation linking for question answering
CN113656572A (en) * 2021-08-26 2021-11-16 支付宝(杭州)信息技术有限公司 Conversation processing method and system
CN115587175B (en) * 2022-12-08 2023-03-14 阿里巴巴达摩院(杭州)科技有限公司 Man-machine conversation and pre-training language model training method and system and electronic equipment
CN116303962A (en) * 2023-03-21 2023-06-23 北京百度网讯科技有限公司 Dialogue generation method, training method, device and equipment for deep learning model
CN116561278A (en) * 2023-05-05 2023-08-08 科大讯飞股份有限公司 Knowledge question-answering method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN116821308A (en) 2023-09-29
CN116821308B (en) 2023-12-19

Similar Documents

Publication Publication Date Title
CN116821308B (en) Generation method, training method and device of model and storage medium
US20210319346A1 (en) Personal Taste Assessment Method and System
CN107563841B (en) Recommendation system based on user score decomposition
AU2021201077A1 (en) Recommendation system based on group profiles of personal taste
US20150169758A1 (en) Multi-partite graph database
CN111737426B (en) Method for training question-answering model, computer equipment and readable storage medium
CN109614618B (en) Method and device for processing foreign words in set based on multiple semantics
CN110119479A (en) A kind of restaurant recommendation method, apparatus, equipment and readable storage medium storing program for executing
Korpusik et al. Deep learning for database mapping and asking clarification questions in dialogue systems
Amac et al. Procedural reasoning networks for understanding multimodal procedures
WO2024002216A1 (en) Service problem attribution method and device
KR102300474B1 (en) Method and server for food ingredient pairing prediction using siamese neural network
CN110580285B (en) Product label determination method and device and electronic equipment
Han et al. The art of food: Meal image synthesis from ingredients
Ajmain et al. Enhancing Sentiment Analysis using Machine Learning Predictive Models to Analyze Social Media Reviews on Junk Food
CN117390142B (en) Training method and device for large language model in vertical field, storage medium and equipment
Dijkstra Cross-modal recipe analysis for fine-grained geographical mapping of food consumption from images and supermarket sales
Cunningham et al. FOODGPT: AMachine LEARNING APPROACH TO INGREDIENT SUBSTITUTION AND RECIPE RECOMMENDATION
CN116089594B (en) Method and device for extracting structured data from text based on BERT question-answering model
CN117932142A (en) Interactive recommendation method and interactive recommendation system based on large language model
CN117273868A (en) Shop recommendation method and device, electronic equipment and storage medium
Kanjirathinkal Explainable Recommendations
WO2022211730A1 (en) Machine learning methods and systems for assessing product concepts
CN115391489A (en) Topic recommendation method based on knowledge graph
CN117151119A (en) Content generation, model construction and data processing methods, devices, equipment and media

Legal Events

Date Code Title Description
PB01 Publication