CN115827838A - Dialog generation method and system based on story continuous writing and dynamic knowledge base - Google Patents

Dialog generation method and system based on story continuous writing and dynamic knowledge base Download PDF

Info

Publication number
CN115827838A
CN115827838A CN202211475495.4A CN202211475495A CN115827838A CN 115827838 A CN115827838 A CN 115827838A CN 202211475495 A CN202211475495 A CN 202211475495A CN 115827838 A CN115827838 A CN 115827838A
Authority
CN
China
Prior art keywords
knowledge
story
knowledge base
conversation
initial
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
CN202211475495.4A
Other languages
Chinese (zh)
Inventor
张笑涵
于济凡
李涓子
侯磊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Zhipu Huazhang Technology Co ltd
Tsinghua University
Original Assignee
Beijing Zhipu Huazhang Technology Co ltd
Tsinghua University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Zhipu Huazhang Technology Co ltd, Tsinghua University filed Critical Beijing Zhipu Huazhang Technology Co ltd
Priority to CN202211475495.4A priority Critical patent/CN115827838A/en
Publication of CN115827838A publication Critical patent/CN115827838A/en
Pending legal-status Critical Current

Links

Images

Landscapes

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

Abstract

The application provides a dialog generation method and a system based on story continuation and a dynamic knowledge base, wherein the method comprises the following steps: acquiring an initial story input by a user, and determining a conversation role from the initial story; constructing a knowledge base, extracting knowledge related to the conversation role from the initial story, storing the knowledge in the knowledge base, and acquiring external supplementary knowledge related to the existing knowledge in the knowledge base to update the knowledge base; generating a dialogue interacted with the user based on the updated knowledge in the knowledge base and the initial story, and acquiring the dialogue returned by the user; extracting event knowledge in the conversation content, performing story continuation writing based on the initial story and the event knowledge, and storing the story after the story continuation writing into a knowledge base; and circularly updating the knowledge base, interacting with the user and continuously writing the story until the conversation is finished based on the story after continuous writing. The method generates the dialogue based on the dynamic knowledge base and the continuous writing framework of the character story, and improves the fidelity and the interestingness of the dialogue with the AI.

Description

Dialog generation method and system based on story continuous writing and dynamic knowledge base
Technical Field
The application relates to the technical field of natural language processing, in particular to a dialog generation method and system based on story continuation and a dynamic knowledge base.
Background
With the development of natural language processing technology, the application rate of the ultra-large scale pre-training language model is gradually improved, and further, each downstream natural language processing task is more fully solved. As one of the core tasks of natural language processing, the generation of a dialog between an intelligent AI robot and a user has also begun to progress toward higher fidelity and higher performance.
In the related art, when a dialog system is constructed, a Knowledge-based dialog (KGD) construction system is generally adopted, and the KGD is to reasonably add linguistic data or text content related to Knowledge before a normal dialog system is generated, so as to improve the information content and accuracy of a dialog generation result.
However, the KGD system adopted in the above-mentioned dialog generation method generally constructs a stable knowledge resource pool, and the constructed dialog system is insufficient in self-growing property and ability to maintain interest of long-term dialog, so that it is easy for the user to lose interest, and finally abandon the dialog. In addition, in the control process of generating the large model to be used, the problems of error propagation, logic confusion and the like are easily generated, and the reliability and the attraction degree are further reduced.
Therefore, how to improve the fidelity of the dialog system and the interest of generating the content is a problem which needs to be solved urgently at present.
Disclosure of Invention
The present application is directed to solving, at least to some extent, one of the technical problems in the related art.
Therefore, a first objective of the present application is to provide a dialog generating method based on story continuation and a dynamic knowledge base, which generates a dialog based on a dynamic knowledge base and a character story continuation framework, and improves fidelity and interestingness of the dialog with an AI.
A second object of the present application is to propose a dialog generation system based on story continuation and dynamic knowledge base.
A third object of the present application is to propose a non-transitory computer-readable storage medium.
To achieve the above object, a first embodiment of the present application proposes a dialog generating method based on story continuation and a dynamic knowledge base, which includes the following steps:
acquiring an initial story input by a user, and determining a conversation role from the initial story;
constructing a knowledge base, extracting knowledge related to the conversation role from the initial story, storing the knowledge in the knowledge base, and acquiring external supplementary knowledge related to the existing knowledge in the knowledge base to update the knowledge base;
generating a dialogue interacted with the user based on the updated knowledge in the knowledge base and the initial story, and acquiring the dialogue returned by the user;
extracting event knowledge in the conversation content, performing story continuation based on the initial story and the event knowledge, and storing the story after the story continuation into the knowledge base;
and circularly updating the knowledge base, interacting conversation with the user and story continuation based on the story after continuation of writing until the conversation is finished.
Optionally, in one embodiment of the application, the extracting of the knowledge related to the conversational character from the initial story includes: training a preset pre-training model to generate an information extraction model as an extractor; and extracting the knowledge triples related to the conversation characters from the initial story through an information extraction model according to the schema of the first extraction task.
Optionally, in an embodiment of the present application, acquiring external supplementary knowledge related to the existing knowledge in the knowledge base includes: and acquiring the external supplementary knowledge from an external knowledge base, or completing the search of the external supplementary knowledge through an external search engine in the Internet.
Optionally, in an embodiment of the present application, the knowledge base includes: structured knowledge comprising the knowledge triplets related to the conversational character and the external supplemental knowledge, and unstructured text that is extensible story content.
Optionally, in an embodiment of the application, generating a dialog for interacting with the user based on the updated knowledge in the knowledge base and the initial story includes: and under a machine reading understanding frame, a preset pre-training language model is used as a base, and the conversation is generated according to the knowledge in the knowledge base and the initial story through a preset conversation generation frame.
Optionally, in an embodiment of the present application, extracting event knowledge from the dialog content includes: and extracting the event knowledge from the dialog content according to a schema of a second extraction task through the information extraction model.
Optionally, in an embodiment of the present application, performing story continuation based on the initial story and the event knowledge includes: and performing post mask prediction based on the initial story and the event knowledge, and performing extension and completion of the initial story through a pre-training language model.
To achieve the above object, a second aspect of the present application provides a dialog generating system based on story continuation and dynamic knowledge base, including the following modules:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring an initial story input by a user and determining a conversation role from the initial story;
the updating module is used for constructing a knowledge base, extracting knowledge related to the conversation role from the initial story, storing the knowledge into the knowledge base, and acquiring external supplementary knowledge related to the existing knowledge in the knowledge base so as to update the knowledge base;
the generating module is used for generating a conversation interacted with the user based on the updated knowledge in the knowledge base and the initial story, and acquiring the conversation returned by the user;
the continuous writing module is used for extracting event knowledge in the conversation content, carrying out story continuous writing based on the initial story and the event knowledge and storing the story after continuous writing into the knowledge base;
and the circulating module is used for circularly updating the knowledge base, interacting with the user and continuously writing the story based on the continuously written story until the conversation is finished.
Optionally, in an embodiment of the application, the update module is specifically configured to: training a preset pre-training model, and generating an information extraction model as an extractor; and extracting the knowledge triples related to the conversation characters from the initial story through an information extraction model according to the schema of the first extraction task.
In order to implement the foregoing embodiments, the third aspect of the present application further provides a non-transitory computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the dialog generation method based on the story continuation and the dynamic knowledge base in the foregoing embodiments is implemented.
The technical scheme provided by the embodiment of the application at least has the following beneficial effects: according to the method and the system, the initial background story input by the user is extracted, and external knowledge is supplemented to construct a knowledge base capable of being dynamically updated. And then generating a dialogue according to the content of the knowledge base and the story content to interact with the user, extracting knowledge of the dialogue content, and performing story continuation by combining with the original accident. And updating the knowledge base according to the continuous written story, and performing next round of dialogue generation and interaction. By iterating the above processes, the continuous story writing and the dynamic knowledge base updating are realized. Therefore, the method and the system realize story continuation based on the initial background story and the dynamic knowledge base, and reasonably combine knowledge maintenance, story continuation and dialogue generation to generate a structure of a dialogue system. Therefore, when the dialogue system is built, a self-growing dynamic knowledge base and an extended background story are continuously maintained for the background of the dialogue system, so that the dialogue system is more real, dialogue contents are more novel and interesting, interest of users is promoted, interaction time is prolonged, and user experience is improved.
Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Drawings
The above and/or additional aspects and advantages of the present application will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which
Fig. 1 is a flowchart of a dialog generation method based on story continuation and a dynamic knowledge base according to an embodiment of the present application;
fig. 2 is a flowchart of a specific dialog generation method based on story continuation and a dynamic knowledge base according to an embodiment of the present application;
fig. 3 is a schematic diagram of a dialog generation principle proposed in an embodiment of the present application;
fig. 4 is a schematic structural diagram of a dialog generating system based on story continuation and a dynamic knowledge base according to an embodiment of the present application.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like reference numerals refer to the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the drawings are illustrative and intended to be illustrative of the invention and are not to be construed as limiting the invention.
It should be noted that, a KGD system adopted in the current dialog generation method generally constructs a static knowledge resource pool, lacks of high-speed update of knowledge, and does not update the personality of an intelligent agent, and the main objective is to generate a dialog with high information degree, which is not high in anthropomorphic degree and interest, and is difficult for a person to generate dependence and trust for a long-term dialog. Therefore, the application provides a dialog generation method and a dialog generation system based on story continuation and a dynamic knowledge base, which are used for enhancing the fidelity of dialog AI and the interest of generating contents.
A dialog generation method and system based on story continuation and a dynamic knowledge base according to an embodiment of the present invention will be described with reference to the accompanying drawings.
Fig. 1 is a flowchart of a dialog generating method based on story continuation and a dynamic knowledge base according to an embodiment of the present application, as shown in fig. 1, the method includes the following steps:
step S101, obtaining an initial story input by a user, and determining a conversation character from the initial story.
It should be noted that the dialog generation method of the present application links two tasks of story continuation and dialog generation, and the present application not only compensates for the completeness of the story, but also organically combines the story and the dialog to carry out the dialog between the story and the user.
Specifically, the initial story is a background part and an initial part of a story, a user can select a story which is expected to be subjected to conversation according to own preference and input the story into the intelligent AI conversation robot, only the initial part of the story needs to be input, and the application can be subjected to conversation with the user in the story background set by the user. The input story may be different types of story texts such as a novel, a drama, and the like, and is not limited in the present application.
Where a conversation character is a target object of a conversation with a user, the conversation character may be one of the characters in a story input by the user. For example, the content of the initial story may be analyzed to determine the hero of the story as a conversational character.
And S102, constructing a knowledge base, extracting knowledge related to the conversation role from the initial story, storing the knowledge into the knowledge base, and acquiring external supplementary knowledge related to the existing knowledge in the knowledge base so as to update the knowledge base.
Specifically, a database with updatable data content is created for the background of the dialog system while the dialog system is constructed, so that the self-growing dynamic knowledge base is continuously maintained later. Then, the knowledge related to the conversational character is extracted from the input initial story and stored in a knowledge base.
The knowledge related to the conversation role can be a series of related knowledge such as the character relationship, the character, the preference, the external characteristics and other characteristics of the conversation role, and the extracted knowledge is stored in a knowledge base in a certain form, so that the database is updated.
When the knowledge related to the conversation role is specifically extracted, as a possible implementation mode, the method can be used for firstly training a preset pre-training model to generate an information extraction model as an extractor, and then extracting the knowledge triples related to the conversation role from the initial story through the information extraction model according to the schema of the first extraction task.
In this embodiment, the preset pre-training model is determined according to an Information Extraction model expected to be generated, for example, when an open knowledge Extraction model such as a Universal Information Extraction model (UIE) is selected as an extractor for knowledge Extraction, ERINE may be selected as the pre-training model.
The ERINE model structurally adopts an Encoder part of a Transformer as a model main stem for training, applies a Knowledge Masking strategy of three levels to a pre-training task in the ERNIE pre-training process, and enables the ERNIE to learn more linguistic Knowledge through the tasks of the three levels. The UIE model can realize various types of key information extraction tasks such as entity extraction, relation extraction, event extraction and emotion analysis, and the UIE model can support information extraction of different fields and extraction targets, so that the UIE model is adopted as an extractor to be better suitable for different types of stories input by users.
In specific implementation, an ERNIE 3.0 pre-training model can be selected as a base to train the UIE model, and the specific training process can refer to modes in the related technology, such as the method from unstructured text to structured output, the generation of structural relationship and the improvement of semantic representation to construct an object function for pre-training.
Further, after generating the UIE model, knowledge triplets associated with the conversational character are extracted from the initial story through the UIE model. Specifically, the UIE model may represent different information extraction task structures through a unified structure generation operation, so that a unified structure output may be generated under different information extraction tasks. However, it is understood that the UIE model may perform different extraction tasks due to the need to extract different related knowledge, and the UIE model may extract the knowledge needed for a particular task according to the schema of the extraction task.
In this embodiment, the first extraction task is to extract the knowledge task related to the conversational character from the initial story, and the schema of the task may be "character: { character, character relationship, preference } "so that knowledge triples related to conversation roles can be extracted. During specific implementation, the schema of the task can be added before the initial story, the UIE model is jointly input, and the UIE model is finely adjusted by combining with the schema and then extracts knowledge triples related to the conversation role, such as (role A, characteristics, general) and the like.
Furthermore, after the knowledge related to the conversation role is acquired and stored in the knowledge base, the external knowledge is supplemented. The external knowledge is not included in the set story acquired through an external means, and the external knowledge is also related to the conversation character, so that the extracted knowledge is supplemented, for example, after the knowledge of the (character a, character, general) is extracted in the above example, the acquired external knowledge may be (character a, character mild) ", (character a, hobby, reading)", and the like.
In particular, in one embodiment of the present application, the acquiring of external supplementary knowledge related to the existing knowledge in the knowledge base comprises: and acquiring external supplementary knowledge from an external knowledge base, or completing the search of the external supplementary knowledge in the Internet through an external search engine.
Specifically, for the first mode, the external knowledge base may be a predetermined database storing a large amount of knowledge, such as ATOMIC _ zh, from which other supplementary knowledge related to the existing knowledge is acquired. For the second mode, the knowledge content range searched by the dialog system is expanded to the whole internet, the knowledge search range is large enough, the updating speed is fast enough, the dynamic knowledge capability is realized in partial scenes, and the search of related content can be completed by an external search engine.
Thereby, the dynamic knowledge base is further updated by acquiring external knowledge. As can be seen from the description in the foregoing embodiments, the contents in the dynamic knowledge base constructed by the present application include: structured knowledge and unstructured text, i.e.
Figure BDA0003959791150000061
Wherein, the structural knowledge K =<k i >Comprises extracting knowledge triple and external supplementary knowledge related to conversation roles, and unstructured text S =<s i >Is the extendable story content, namely the initial story set by the user and the story content which is subsequently written.
And step S103, generating a dialogue interacted with the user based on the knowledge in the updated knowledge base and the initial story, and acquiring the dialogue returned by the user.
Specifically, based on the content in the current knowledge base and the initial story content, dialog controllable generation is performed to generate an utterance to communicate with the user.
In one embodiment of the present application, generating a dialog for interaction with a user includes: and under a machine reading understanding framework, a preset pre-training language model is used as a base, and a conversation is generated according to knowledge in a knowledge base and an initial story through a preset conversation generation framework.
Specifically, a machine reading understanding frame (MRC) may extract corresponding answer spans in context through query, and perform 2 multi-classification tasks. Specifically, when generating a dialogue sentence, a pre-training language model (PLM) is used as a base to perform pre-training. The pre-training language model uses a large amount of linguistic data in advance to pre-learn super-large-scale parameters, the model can be used for conveniently generating high-quality fluent language characters, and a specific pre-training language model can be selected according to actual conversation needs during specific application, for example, a GLM-10B Chinese version can be used as a substrate, or bilingual bidirectional dense models such as GLM-130B and the like can be used. Then, after training is complete, the dialog generation framework using XDAI in conjunction with knowledge base content and story content generates utterances of the turn that interact with the user.
After the dialog system generates the dialog, if the dialog is not closed, namely the user carries out multiple rounds of dialogs with the dialog system, in each round of dialog, the dialog returned by the user can be obtained, so that story continuation writing and dynamic knowledge base updating can be carried out by combining the words of the user in the following process, and the next round of dialog is generated according to the words of the user, so that the generated dialog has pertinence.
And step S104, extracting event knowledge in the conversation content, performing story continuation based on the initial story and the event knowledge, and storing the story after the story continuation into a knowledge base.
The dialogue content comprises dialogs generated by the dialogue system in the previous round of dialogue and dialogs returned by the user. According to the method and the system, the events in the conversation content of each turn of the user and the system are extracted, and the set initial story is continued according to the event knowledge.
In one embodiment of the present application, extracting event knowledge from dialog content includes: and extracting the event knowledge from the dialogue contents according to the outline of the second extraction task through the information extraction model. Specifically, the information extraction model, i.e., the model used in the above embodiment to extract knowledge related to a conversational character, is a UIE model in this embodiment, the second extraction task is a task to extract event knowledge from conversational content, and since the current extraction task is to extract an event in a conversation, the schema of the second extraction task is "character: { event } ". The specific process of extracting event knowledge may refer to the above knowledge related to extracting a dialog role, and will not be described herein again.
Furthermore, story continuation writing is carried out according to the existing initial story and the extracted event knowledge, namely, the follow-up content of the initial story is completed. In one embodiment of the application, story continuation is performed based on initial story and event knowledge, including: post mask prediction is performed based on initial story and event knowledge, and extension and completion of the initial story are performed through a pre-trained language model. Specifically, the pre-trained language model used for story continuation may be the same as the pre-trained language model used in generating a dialog, and in this embodiment, the post-mask prediction is performed using the knowledge of events in the original story and dialog, and story completion and generation are performed using GLM. And then, adding the stories which are written in turn into the knowledge base, and realizing further updating of the knowledge base.
And step S105, circularly updating the knowledge base, interacting with the user and continuously writing the story based on the story after continuous writing until the dialogue is finished.
Specifically, it is determined whether or not the conversation is ended, for example, whether or not a user input utterance for ending the conversation, such as "good, goodbye", "end of conversation", or the like, is received. And if the conversation is determined not to be ended, repeatedly updating the knowledge base, and carrying out interactive conversation and story continuation with the user, namely repeatedly carrying out the related operations from the step S102 to the step S104 in a new round of conversation, wherein the related operations comprise extracting knowledge by combining event knowledge in the previous round of conversation interaction, acquiring external supplementary knowledge, generating the conversation of the current round and the like by using a UIE model, and if the conversation of the current round is not closed, continuously carrying out the extraction of the event knowledge and the story continuation till the conversation is ended.
Therefore, the method for story continuation based on the initial background story and the dynamic knowledge base and the dialogue system structure which reasonably combines knowledge maintenance, story continuation and dialogue generation are realized.
To sum up, according to the dialog generation method based on story continuation and the dynamic knowledge base, the initial background story input by the user is extracted, and external knowledge is supplemented to construct the knowledge base capable of being dynamically updated. And then generating a dialogue according to the content of the knowledge base and the story content to interact with the user, extracting knowledge of the dialogue content, and combining the original events to carry out story continuation. And updating the knowledge base according to the continuous written story, and performing next round of dialogue generation and interaction. By iterating the above processes, the continuous story writing and the dynamic knowledge base updating are realized. Therefore, the method realizes story continuation based on the initial background story and the dynamic knowledge base, and reasonably combines knowledge maintenance, story continuation and dialogue generation to generate the structure of the dialogue system. Therefore, when the method constructs the dialogue system, a self-growing dynamic knowledge base and an extended background story are continuously maintained for the background of the dialogue system, so that the dialogue system is more real, the dialogue content is more novel and interesting, the interest of a user is favorably aroused, the interaction time is prolonged, and the user experience is improved.
Based on the above embodiments, in order to more clearly describe the specific processing flow of the dialog generating method based on story continuation and dynamic knowledge base of the present application, a specific dialog generating method proposed by combining a specific background story is explained in an embodiment of the present application. Fig. 2 is a flowchart of a specific dialog generation method based on story continuation and a dynamic knowledge base according to an embodiment of the present application, and fig. 3 is a schematic diagram of a principle of generating a dialog according to the embodiment of the present application.
As shown in fig. 2, the method comprises the steps of:
step S201, acquiring a setting input by the user, and confirming the role.
Specifically, in the embodiment of the application, a story input by a user is acquired first, and a character image in the story is used as a setting of the AI conversation robot. The story is; "in the past, there was a homeowner, and the only property left to those three children at death was a mill, a donkey, and a boot-worn cat. The heritage is quickly emptied by children, and neither notary nor lawyer can go to the site, because they can certainly take the heritage as own. As a result, the strongest and strong old takes away the mill, the clever second old takes away the donkey, and finally only the cat leaves the fresh but only the third old with fresh. Although this cat seems to catch mice only, there are no mice in home \8230 \ 8230; "rat in home \" 8230; ". By analyzing the story content, the character is determined to be "cat wearing boots".
In step S202, the knowledge base starts to be updated.
Specifically, the knowledge triplets related to the conversation roles are extracted by using open knowledge extraction models such as UIE: "(cat wearing boots, original owner, mill owner), (cat wearing boots, current owner, old three), (old three, character, general) \8230;". In this process, in this embodiment, the ERINE is used as a pre-training model, the UIE extraction tool is used as an extractor, and the schema is set as "role: { character, character relationship, preference } ".
Step S203, acquiring external supplementary knowledge.
Specifically, other supplementary knowledge related to the existing knowledge, such as "(cat, is a kind of mammal) (cat, likes, catches mouse) (cat, respects his owner)" is obtained from an external knowledge base, such as ATOMIC _ zh, and the knowledge base is further updated.
And step S204, carrying out controllable generation of the conversation.
Specifically, based on knowledge base content and story content, dialog controllable generation is performed using a framework such as MRC, which generation is performed using a dialog generation framework of XDAI, mainly using a pre-trained language model GLM-10B chinese version as a basis.
Step S205 determines whether the session is closed, and if not, extracts event knowledge.
Specifically, if the dialog is closed, the flow is ended, and if the dialog is not closed, the knowledge in the dialog is extracted by using the UIE model based on the dialog content, and the schema is set as a role: { event } ".
And step S206, completing and generating stories.
Specifically, on the basis of step S205, post mask prediction is performed using knowledge of events in the original story and the dialog, and story completion and generation are performed using GLM.
Step S207, the knowledge update is repeated.
Specifically, on the basis of step S206, the UIE model is used again to extract the related knowledge, and the above steps S202 to S204 are repeatedly performed.
Therefore, the principle of dialog generation in the present application is as shown in fig. 3, and a self-growing dynamic knowledge base and an extended background story are continuously maintained for the background while constructing a dialog system, so that the dialog system is more real, and the content is more novel and interesting.
It should be noted that, for the specific implementation of each step in this embodiment, reference may be made to the related description of the foregoing embodiment, and details are not described here again.
In order to realize the embodiment, the application also provides a dialog generating system based on story continuation and a dynamic knowledge base. Fig. 4 is a schematic structural diagram of a dialog generating system based on story continuation and a dynamic knowledge base according to an embodiment of the present application.
As shown in FIG. 4, the system includes an acquisition module 100, an update module 200, a generation module 300, a write-resume module 400, and a loop module 500.
The obtaining module 100 is configured to obtain an initial story input by a user, and determine a conversation character from the initial story.
And the updating module 200 is used for constructing a knowledge base, extracting the knowledge related to the conversation role from the initial story, storing the knowledge into the knowledge base, and acquiring external supplementary knowledge related to the existing knowledge in the knowledge base so as to update the knowledge base.
And the generating module 300 is used for generating a dialog interacted with the user based on the knowledge in the updated knowledge base and the initial story, and acquiring the dialog returned by the user.
And the continuous writing module 400 is used for extracting the event knowledge in the conversation content, performing story continuous writing based on the initial story and the event knowledge, and storing the story after continuous writing into a knowledge base.
And the circulation module 500 is used for circularly updating the knowledge base, interacting with the user and continuously writing the story until the conversation is finished based on the continuously written story.
Optionally, in an embodiment of the present application, the update module 200 is specifically configured to: training a preset pre-training model to generate an information extraction model as an extractor; and extracting the knowledge triples related to the conversation characters from the initial story through the information extraction model according to the schema of the first extraction task.
Optionally, in an embodiment of the present application, the updating module 200 is further configured to: and acquiring external supplementary knowledge from an external knowledge base, or completing the search of the external supplementary knowledge in the Internet through an external search engine.
Optionally, in one embodiment of the application, the knowledge base includes structured knowledge and unstructured text, wherein the structured knowledge includes knowledge triplets and external supplemental knowledge related to conversational characters, and the unstructured text is extensible story content.
Optionally, in an embodiment of the present application, the generating module 300 is specifically configured to: and under a machine reading understanding framework, a preset pre-training language model is used as a base, and the conversation is generated according to knowledge in a knowledge base and an initial story through a preset conversation generation framework.
Optionally, in an embodiment of the present application, the write-resuming module 400 is specifically configured to: and extracting the event knowledge from the dialogue contents according to the outline of the second extraction task through the information extraction model.
Optionally, in an embodiment of the present application, the continuation module 400 is further configured to: post mask prediction is performed based on initial story and event knowledge, and extension and completion of the initial story are performed through a pre-trained language model.
It should be noted that the foregoing description of the embodiment of the dialog generating method based on story continuation and dynamic knowledge base is also applicable to the system of this embodiment, and the implementation principle is the same, and is not described herein again.
To sum up, the dialog generation system based on story continuation and the dynamic knowledge base according to the embodiment of the present application extracts the initial background story input by the user, and supplements external knowledge to construct a knowledge base capable of being dynamically updated. And then generating a dialogue according to the content of the knowledge base and the story content to interact with the user, extracting knowledge of the dialogue content, and performing story continuation by combining with the original accident. And updating the knowledge base according to the continuous written story, and performing next round of dialogue generation and interaction. By iterating the above processes, the continuous story writing and the dynamic knowledge base updating are realized. Therefore, the system realizes story continuation based on the initial background story and the dynamic knowledge base, and reasonably combines knowledge maintenance, story continuation and dialogue generation to generate a structure of a dialogue system. Therefore, when the system constructs a conversation system, a self-growing dynamic knowledge base and an extended background story are continuously maintained for the background of the system, so that the conversation system is more real, the conversation content is more novel and interesting, the interest of a user is favorably aroused, the interaction time is prolonged, and the user experience is improved.
In order to implement the above embodiments, the present invention further provides a non-transitory computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the dialog generation method based on the story continuation and the dynamic knowledge base according to the embodiment of the first aspect of the present application.
In the description herein, reference to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the application. In the present specification, if a schematic expression of the above-described terms is employed in a plurality of embodiments or examples, it does not mean that the embodiments or examples are the same. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Moreover, various embodiments or examples and features of various embodiments or examples described in this specification can be combined and combined by one skilled in the art without being mutually inconsistent.
Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present application, "plurality" means at least two, e.g., two, three, etc., unless specifically limited otherwise.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing steps of a custom logic function or process, and alternate implementations are included within the scope of the preferred embodiment of the present application in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present application.
The logic and/or steps represented in the flowcharts or otherwise described herein, e.g., an ordered listing of executable instructions that can be considered to implement logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via for instance optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.
It should be understood that portions of the present application may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. If implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried out in the method of implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and the program, when executed, includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present application may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc. Although embodiments of the present application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present application, and that variations, modifications, substitutions and alterations may be made to the above embodiments by those of ordinary skill in the art within the scope of the present application.

Claims (10)

1. A dialog generation method based on story continuation and a dynamic knowledge base is characterized by comprising the following steps:
acquiring an initial story input by a user, and determining a conversation role from the initial story;
constructing a knowledge base, extracting knowledge related to the conversation role from the initial story, storing the knowledge in the knowledge base, and acquiring external supplementary knowledge related to the existing knowledge in the knowledge base to update the knowledge base;
generating a dialogue interacted with the user based on the updated knowledge in the knowledge base and the initial story, and acquiring the dialogue returned by the user;
extracting event knowledge in the conversation content, performing story continuation based on the initial story and the event knowledge, and storing the story after the story continuation into the knowledge base;
and circularly updating the knowledge base, interacting conversation with the user and story continuation based on the story after continuation of writing until the conversation is finished.
2. The dialog generation method of claim 1 wherein the extracting of the knowledge relating to the dialog character from the initial story comprises:
training a preset pre-training model to generate an information extraction model as an extractor;
and extracting the knowledge triples related to the conversation characters from the initial story through an information extraction model according to the schema of the first extraction task.
3. The dialog generation method of claim 1 wherein said obtaining external supplemental knowledge related to the existing knowledge in the knowledge base comprises:
and acquiring the external supplementary knowledge from an external knowledge base, or completing the search of the external supplementary knowledge in the Internet through an external search engine.
4. The dialog generation method of claim 2 wherein the knowledge base comprises: structured knowledge comprising the knowledge triplets related to the conversational character and the external supplemental knowledge, and unstructured text that is extensible story content.
5. The dialog generation method of claim 1 wherein generating a dialog for interaction with the user based on the updated knowledge in the knowledge base and the initial story comprises:
and under a machine reading understanding frame, a preset pre-training language model is used as a base, and the conversation is generated according to the knowledge in the knowledge base and the initial story through a preset conversation generation frame.
6. The dialog generation method according to claim 2, wherein the extracting of the event knowledge in the dialog content comprises:
and extracting the event knowledge from the dialogue content according to a schema of a second extraction task through the information extraction model.
7. The dialog generation method of claim 1 wherein said story-continuation based on the initial story and the event knowledge comprises:
and performing post mask prediction based on the initial story and the event knowledge, and performing extension and completion of the initial story through a pre-training language model.
8. A dialog generation system based on story continuation and a dynamic knowledge base, comprising the following modules:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring an initial story input by a user and determining a conversation role from the initial story;
the updating module is used for constructing a knowledge base, extracting knowledge related to the conversation role from the initial story, storing the knowledge into the knowledge base, and acquiring external supplementary knowledge related to the existing knowledge in the knowledge base so as to update the knowledge base;
the generating module is used for generating a conversation interacted with the user based on the updated knowledge in the knowledge base and the initial story, and acquiring the conversation returned by the user;
the continuous writing module is used for extracting event knowledge in the conversation content, carrying out story continuous writing based on the initial story and the event knowledge and storing the story after continuous writing into the knowledge base;
and the circulating module is used for circularly updating the knowledge base, interacting conversation with the user and continuously writing the story based on the continuously written story until the conversation is finished.
9. The dialog generation system of claim 8 wherein the update module is specifically configured to:
training a preset pre-training model to generate an information extraction model as an extractor;
and extracting the knowledge triples related to the conversation characters from the initial story through an information extraction model according to the schema of the first extraction task.
10. A non-transitory computer-readable storage medium having stored thereon a computer program, wherein the computer program, when executed by a processor, implements the method for dialog generation based on storytelling and dynamic knowledge base of any of claims 1-7.
CN202211475495.4A 2022-11-23 2022-11-23 Dialog generation method and system based on story continuous writing and dynamic knowledge base Pending CN115827838A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211475495.4A CN115827838A (en) 2022-11-23 2022-11-23 Dialog generation method and system based on story continuous writing and dynamic knowledge base

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211475495.4A CN115827838A (en) 2022-11-23 2022-11-23 Dialog generation method and system based on story continuous writing and dynamic knowledge base

Publications (1)

Publication Number Publication Date
CN115827838A true CN115827838A (en) 2023-03-21

Family

ID=85530742

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211475495.4A Pending CN115827838A (en) 2022-11-23 2022-11-23 Dialog generation method and system based on story continuous writing and dynamic knowledge base

Country Status (1)

Country Link
CN (1) CN115827838A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116543082A (en) * 2023-05-18 2023-08-04 无锡捷通数智科技有限公司 Digital person generation method and device and digital person generation system
CN117093679A (en) * 2023-06-19 2023-11-21 无码科技(杭州)有限公司 Large language model intelligent inquiry dialogue method, system, equipment and medium
CN117910581A (en) * 2024-01-22 2024-04-19 上海算法创新研究院 Quotation writing method oriented to text automatic generation

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116543082A (en) * 2023-05-18 2023-08-04 无锡捷通数智科技有限公司 Digital person generation method and device and digital person generation system
CN117093679A (en) * 2023-06-19 2023-11-21 无码科技(杭州)有限公司 Large language model intelligent inquiry dialogue method, system, equipment and medium
CN117093679B (en) * 2023-06-19 2024-04-02 无码科技(杭州)有限公司 Large language model intelligent inquiry dialogue method, system, equipment and medium
CN117910581A (en) * 2024-01-22 2024-04-19 上海算法创新研究院 Quotation writing method oriented to text automatic generation

Similar Documents

Publication Publication Date Title
Uc-Cetina et al. Survey on reinforcement learning for language processing
JP7421604B2 (en) Model pre-training method and device, text generation method and device, electronic equipment, storage medium and computer program
CN115827838A (en) Dialog generation method and system based on story continuous writing and dynamic knowledge base
CN108962224B (en) Joint modeling method, dialogue method and system for spoken language understanding and language model
CN108287820B (en) Text representation generation method and device
CN110795913B (en) Text encoding method, device, storage medium and terminal
KR20190019962A (en) Architectures and processes for computer learning and understanding
US20200027443A1 (en) Task-independent conversational systems
CN116932708A (en) Open domain natural language reasoning question-answering system and method driven by large language model
CN113158608A (en) Processing method, device and equipment for determining parameters of analog circuit and storage medium
CN110457661B (en) Natural language generation method, device, equipment and storage medium
Steels et al. How to make construction grammars fluid and robust
CN110297885B (en) Method, device and equipment for generating real-time event abstract and storage medium
CN107688583A (en) The method and apparatus for creating the training data for natural language processing device
US11481609B2 (en) Computationally efficient expressive output layers for neural networks
CN117216234A (en) Artificial intelligence-based speaking operation rewriting method, device, equipment and storage medium
CN117808946A (en) Method and system for constructing secondary roles based on large language model
Jung et al. Hybrid user intention modeling to diversify dialog simulations
CN117057414B (en) Text generation-oriented multi-step collaborative prompt learning black box knowledge distillation method and system
CN110287999B (en) Story generation method and device based on hidden variable model
CN117216547A (en) Model training method, language processing method, device and computer equipment
CN115114939B (en) Training method of translation model, sentence translation method, sentence translation device, sentence translation equipment and sentence translation program
CN116186219A (en) Man-machine dialogue interaction method, system and storage medium
Kiesel et al. Simulating Follow-Up Questions in Conversational Search
CN114048309A (en) Question-driven social network answer abstract automatic generation method and device

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