CN117539985A - Question-answering method and device based on language style, electronic equipment and storage medium - Google Patents

Question-answering method and device based on language style, electronic equipment and storage medium Download PDF

Info

Publication number
CN117539985A
CN117539985A CN202311333273.3A CN202311333273A CN117539985A CN 117539985 A CN117539985 A CN 117539985A CN 202311333273 A CN202311333273 A CN 202311333273A CN 117539985 A CN117539985 A CN 117539985A
Authority
CN
China
Prior art keywords
question
text
training
model
answering
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
CN202311333273.3A
Other languages
Chinese (zh)
Inventor
李良知
刘骁
叶馥颖
白明白
陈方毅
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xiamen Meishao Co ltd
Original Assignee
Xiamen Meishao 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 Xiamen Meishao Co ltd filed Critical Xiamen Meishao Co ltd
Priority to CN202311333273.3A priority Critical patent/CN117539985A/en
Publication of CN117539985A publication Critical patent/CN117539985A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/332Query formulation
    • G06F16/3329Natural language query formulation or dialogue systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • G06F16/3344Query execution using natural language analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/335Filtering based on additional data, e.g. user or group profiles
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/044Recurrent networks, e.g. Hopfield networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Mathematical Physics (AREA)
  • Databases & Information Systems (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Software Systems (AREA)
  • Human Computer Interaction (AREA)
  • Machine Translation (AREA)

Abstract

The embodiment of the application provides a question and answer method and device based on language style, electronic equipment and storage medium, and belongs to the technical field of artificial intelligence. The method comprises the following steps: acquiring a training corpus text with an original object speaking style; training a preset original question-answer model according to the training corpus text to obtain an initial question-answer model; acquiring language style selection data, and screening the initial question-answer model according to the language style selection data to obtain a target question-answer model; and acquiring a target question text, and performing question-answering processing on the target question text according to the target question-answering model. The embodiment of the application can provide a question-answering method with language style.

Description

Question-answering method and device based on language style, electronic equipment and storage medium
Technical Field
The present application relates to the field of artificial intelligence technologies, and in particular, to a language style-based question answering method and apparatus, an electronic device, and a storage medium.
Background
Currently, voice or text interactions can be implemented by AI conversation assistants to provide various assistance or services. In the related art, the answer to the question by the AI conversation assistant is a hard mechanical answer, i.e., a question-answering method with language style is lacking.
Disclosure of Invention
The embodiment of the application mainly aims to provide a question-answering method and device based on language styles, electronic equipment and storage medium, and aims to provide a question-answering method with language styles.
To achieve the above object, a first aspect of an embodiment of the present application provides a language style based question-answering method, which includes:
acquiring a training corpus text with an original object speaking style;
training a preset original question-answer model according to the training corpus text to obtain an initial question-answer model;
acquiring language style selection data, and screening the initial question-answer model according to the language style selection data to obtain a target question-answer model;
and acquiring a target question text, and performing question-answering processing on the target question text according to the target question-answering model.
In some embodiments, training the preset original question-answer model according to the training corpus text to obtain an initial question-answer model includes:
constructing first style indicating data and second style indicating data;
performing text splicing on the first style indicating data and the training corpus text to obtain a first text pair;
performing text splicing on the second style indicating data and the training corpus text to obtain a second text pair;
training the original question-answering model according to the first text pair and the second text pair to obtain the initial question-answering model.
In some embodiments, the question-answering processing of the target question text according to the target question-answering model includes:
determining target style indication data according to the language style selection data;
performing text splicing on the target question text and the target style indication data to obtain a target text pair;
and carrying out question-answering processing on the target text pairs according to the target question-answering model.
In some embodiments, the initial question-answering model includes a first question-answering model and a second question-answering model, the training corpus text includes a first corpus text and a second corpus text, the first corpus text and the second corpus text correspond to different speaking styles;
training a preset original question-answer model according to the training corpus text to obtain an initial question-answer model, wherein the training corpus text comprises the following steps:
training a first preset plug-in according to the first corpus text to obtain a first target plug-in;
combining the first target plug-in with the original question-answer model to obtain the first question-answer model;
training a second preset plug-in according to the second corpus text to obtain a second target plug-in;
and combining the second target plug-in with the original question-answer model to obtain the second question-answer model.
In some embodiments, the initial question-answering model includes a third question-answering model and a fourth question-answering model, the training corpus text includes a third corpus text and a fourth corpus text, the third corpus text and the fourth corpus text corresponding to different speaking styles;
training a preset original question-answer model according to the training corpus text to obtain an initial question-answer model, wherein the training corpus text comprises the following steps:
training the original question-answer model according to the third corpus text to obtain a third question-answer model;
training the original question-answering model according to the fourth corpus text to obtain the fourth question-answering model.
In some embodiments, the obtaining language style selection data includes:
acquiring a touch state of a preset style control;
and if the touch state indicates that touch is performed, taking the preset style data corresponding to the preset style control as the language style selection data.
In some embodiments, the obtaining language style selection data further comprises:
if the touch state indicates that the touch is not performed, acquiring object information of a login object;
the language style selection data is generated based on the object information.
To achieve the above object, a second aspect of the embodiments of the present application proposes a language style based question answering apparatus, the apparatus comprising:
the text acquisition module is used for acquiring a training corpus text with the speaking style of the original object;
the training module is used for training a preset original question-answer model according to the training corpus text to obtain an initial question-answer model;
the screening module is used for acquiring language style selection data, and screening the initial question-answering model according to the language style selection data to obtain a target question-answering model;
and the question and answer processing module is used for acquiring a target question text and carrying out question and answer processing on the target question text according to the target question and answer model.
To achieve the above object, a third aspect of the embodiments of the present application proposes an electronic device, which includes a memory and a processor, the memory storing a computer program, the processor implementing the method according to the first aspect when executing the computer program.
To achieve the above object, a fourth aspect of the embodiments of the present application proposes a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method of the first aspect.
According to the language style-based question-answering method and device, the electronic equipment and the storage medium, the initial question-answering models corresponding to different language styles can be obtained through training the different training expected texts and the original question-answering models, and the target question-answering model is obtained through screening the language style selection data from the initial question-answering models. Therefore, when the question-answering process is performed on the target question text based on the target question-answering model, answer text having a corresponding language style can be obtained. Therefore, compared with the mechanical reply in the related art, the embodiment of the application can realize the reply of switching the language wind format.
Drawings
FIG. 1 is a flow chart of a language style based question-answering method provided by embodiments of the present application;
fig. 2 is a flowchart of step S103 in fig. 1;
FIG. 3 is a flowchart of another embodiment of step S103 in FIG. 1;
fig. 4 is a flowchart of step S102 in fig. 1;
FIG. 5 is a flowchart of another embodiment of step S102 in FIG. 1;
FIG. 6 is a flowchart of another embodiment of step S102 in FIG. 1;
fig. 7 is a schematic structural diagram of a language style based question-answering device according to an embodiment of the present application;
fig. 8 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
It should be noted that although functional block division is performed in a device diagram and a logic sequence is shown in a flowchart, in some cases, the steps shown or described may be performed in a different order than the block division in the device, or in the flowchart. The terms first, second and the like in the description and in the claims and in the above-described figures, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of the present application only and is not intended to be limiting of the present application.
First, several nouns referred to in this application are parsed:
artificial intelligence (artificial intelligence, AI): is a new technical science for researching and developing theories, methods, technologies and application systems for simulating, extending and expanding the intelligence of people; artificial intelligence is a branch of computer science that attempts to understand the nature of intelligence and to produce a new intelligent machine that can react in a manner similar to human intelligence, research in this field including robotics, language recognition, image recognition, natural language processing, and expert systems. Artificial intelligence can simulate the information process of consciousness and thinking of people. Artificial intelligence is also a theory, method, technique, and application system that utilizes a digital computer or digital computer-controlled machine to simulate, extend, and expand human intelligence, sense the environment, acquire knowledge, and use knowledge to obtain optimal results.
AI conversation assistant: the AI conversation assistant is an artificial intelligence based software that is capable of natural language conversation with the user. Specifically, the AI conversation assistant analyzes and understands sentences input by the user, and then generates corresponding answers according to preset rules or models. The AI conversation assistant can be applied to the fields such as intelligent customer service, voice assistant, intelligent home control and the like.
Currently, AI conversation assistants predict the next word in text by means of unsupervised learning in deep learning based on a large amount of pre-trained text. Because of the large amount of pre-training text, AI conversation assistants cannot effectively form a specific language style during the pre-training process. Thus, the answers of the AI conversation assistant in the related art are typically hard mechanical, lacking any emotional-expressed language style. In the related art, the AI conversation assistant cannot set language style, character setting, etc., or needs to set language style, character setting for the AI assistant by means of the object inputting text instructions by itself. However, this method of self-entering instructions requires that the object describe the language style using large, accurate, and detailed text before beginning a dialog with the AI assistant. Therefore, the method for setting the language style lacks convenience and high efficiency, and has high requirements on the accuracy of the description of the object language style.
Based on the above, the embodiment of the application provides a question-answering method and device based on language style, electronic equipment and storage medium, and aims to improve the question-answering method with language style.
The language-style-based question and answer method, the device, the electronic equipment and the storage medium provided by the embodiment of the application are specifically described through the following embodiment, and the language-style-based question and answer method in the embodiment of the application is described first.
The embodiment of the application can acquire and process the related data based on the artificial intelligence technology. Among these, artificial intelligence (Artificial Intelligence, AI) is the theory, method, technique and application system that uses a digital computer or a digital computer-controlled machine to simulate, extend and extend human intelligence, sense the environment, acquire knowledge and use knowledge to obtain optimal results.
Artificial intelligence infrastructure technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, mechatronics, and the like. The artificial intelligence software technology mainly comprises a computer vision technology, a robot technology, a biological recognition technology, a voice processing technology, a natural language processing technology, machine learning/deep learning and other directions.
The embodiment of the application provides a question-answering method based on language style, and relates to the technical field of artificial intelligence. The question-answering method based on language style provided by the embodiment of the application can be applied to a terminal, a server side and software running in the terminal or the server side. In some embodiments, the terminal may be a smart phone, tablet, notebook, desktop, etc.; the server side can be configured as an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, and a cloud server for providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs, basic cloud computing services such as big data and artificial intelligent platforms and the like; the software may be an application or the like that implements a language-style-based question-answering method, but is not limited to the above form.
The subject application is operational with numerous general purpose or special purpose computer system environments or configurations. For example: personal computers, server computers, hand-held or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments that include any of the above systems or devices, and the like. The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
It should be noted that, in each specific embodiment of the present application, when related processing is required according to user information, user behavior data, user history data, user location information, and other data related to user identity or characteristics, permission or consent of the user is obtained first, and the collection, use, processing, and the like of these data comply with related laws and regulations and standards. In addition, when the embodiment of the application needs to acquire the sensitive personal information of the user, the independent permission or independent consent of the user is acquired through a popup window or a jump to a confirmation page or the like, and after the independent permission or independent consent of the user is explicitly acquired, necessary user related data for enabling the embodiment of the application to normally operate is acquired.
Fig. 1 is an optional flowchart of a language style based question-answering method provided in an embodiment of the present application, and the method in fig. 1 may include, but is not limited to, steps S101 to S104.
Step S101, obtaining a training corpus text with an original object speaking style;
step S102, training a preset original question-answer model according to a training corpus text to obtain an initial question-answer model;
step S103, language style selection data are obtained, and the initial question-answer model is screened according to the language style selection data to obtain a target question-answer model;
step S104, acquiring a target question text, and carrying out question-answering processing on the target question text according to a target question-answering model.
In the steps S101 to S104 illustrated in the embodiments of the present application, initial question-answer models corresponding to different language styles may be obtained through different training expected texts and original question-answer models, and the target question-answer model may be obtained by screening the initial question-answer models through language style selection data. Therefore, when the question-answering process is performed on the target question text based on the target question-answering model, answer text having a corresponding language style can be obtained. Therefore, compared with the mechanical reply in the related art, the embodiment of the application can realize the reply of switching the language wind format.
In step S101 of some embodiments, the training predicted text may refer to text having a speaking style of an original object, which may refer to any object, such as a boy, girl, child, elderly person, etc., and may be a specific animated character, real character, etc. It will be appreciated that for text of the same meaning, different subjects may have different expressions, i.e. different speaking styles for different subjects. Training predictive text may be obtained from books, videos, speech, etc.
In step S102 of some embodiments, the original question-answering model may refer to a model having question-answering capability but not language style setting capability, i.e., the original question-answering model may refer to an AI conversation assistant that has been trained in the related art. Among other things, the AI conversation assistant can be a Sequence-to-Sequence (Seq 2 Seq) model, such as a Recurrent Neural Network (RNN) based model and a transducer (transducer) based model. Alternatively, the model may be a pre-trained language model such as BERT, GPT, XLNet, which is not specifically limited to the embodiments of the present application. The original question-answer model is fine-tuned based on training the predicted text to obtain an initial question-answer model capable of generating text in a language style. It will be appreciated that when the original question-answer model is trained using training expected text corresponding to different styles of speech, an initial question-answer model corresponding to different language styles may be derived.
In step S103 of some embodiments, the language style selection data may refer to data representing a language style selected by the object, for example, a plurality of tags may be preset, and different tags correspond to different language styles. And acquiring corresponding language style selection data by responding to the action of the object touch tag. It will be appreciated that the labels may include labels corresponding to characters and labels corresponding to styles. Wherein, the labels corresponding to the characters can comprise XX star characters, XX cartoon characters, XX novel characters and the like, and the labels corresponding to the styles can comprise literature young, gentle, humorous and the like. And screening a corresponding model from the plurality of initial question-answer models according to the language style data, and taking the screened model as a target question-answer model.
Referring to fig. 2, in some embodiments, step S103 includes, but is not limited to including, step S201 through step S202.
Step S201, obtaining a touch state of a preset style control;
in step S202, if the touch status indicates that touch has been performed, the preset style data corresponding to the preset style control is used as language style selection data.
In step S201 of some embodiments, the preset label may be displayed in the form of a preset style control, which may be an avatar, a name, etc. of the corresponding character. And acquiring the touch state of clicking the preset style control by the object. It can be understood that the touch state may be a state of a preset style control when the residence time of the interface reaches a preset time after the object opens the corresponding interface; or, the state of the preset style control when the preset problem sending control is touched may be preset, which is not specifically limited in this embodiment of the present application.
In step S202 of some embodiments, if the touch state indicates that the preset style control has been touched by the object, the preset style data corresponding to the touched preset style control is used as language style selection data.
Referring to fig. 3, in some embodiments, step S103 further includes, but is not limited to including, step S301 through step S302.
Step S301, if the touch state indicates no touch, obtaining object information of a login object;
step S302, language style selection data is generated based on the object information.
In step S301 of some embodiments, if the touch status indicates that all the preset style controls are not touched by the object, then in order to still output text with language style, the object information of the login object may be acquired. It is understood that the login object may refer to an object to login to the corresponding application program, and the object information may include age, gender, preference, and the like.
In step S302 of some embodiments, the language style preference of the login object itself can be known through the object information, so that language style selection data matched with the object information can be screened out from the preset style data.
The step S201 to the step S202, and the step S301 to the step S302 have the advantage that the corresponding language style selection data can be obtained based on the touched state of the preset style control, or the corresponding language style selection data can be obtained based on the non-touched state of the preset style control and the object information, so that the language style selection data can be determined no matter what state is.
In step S104 of some embodiments, the target question text may refer to a question text for which the subject desires an answer. When the embodiment of the application is applied to an application program, the target question text can be acquired by responding to the typing operation of the object on the corresponding interface. And taking the target question text as input data of a target question-answering model, so as to perform question-answering processing on the target question text based on the target question-answering model, and obtaining an answer text corresponding to the target question text. It is understood that the answer text obtained has a language style corresponding to the language style selection data.
It can be appreciated that the method for training the original question-answering model in step S102 may include a plurality of methods, and three training methods are provided in this embodiment of the present application, and the three training methods are described below in connection with the foregoing embodiments respectively.
First, a first training method will be described.
Referring to fig. 4, in some embodiments, step S102 includes, but is not limited to including, step S401 through step S404.
Step S401, constructing first style indication data and second style indication data;
step S402, text splicing is carried out on the first style indication data and the training corpus text to obtain a first text pair;
step S403, performing text splicing on the second style indication data and the training corpus text to obtain a second text pair;
and step S404, training the original question-answering model according to the first text pair and the second text pair to obtain an initial question-answering model.
In step S401 of some embodiments, the first style indicating data and the second style indicating data are indicating data corresponding to different language styles (or character settings), for example, the first style indicating data may be "you are a gentle person", and the second style indicating data may be "please you communicate with XX novel character speaking mood". It will be appreciated that a plurality of different indicating data may be associated with the same language style.
In steps S402 to S403 of some embodiments, the first style indicating data is text-spliced with training expected text of a corresponding language style, to obtain a first text pair. And performing text splicing on the second style indicating data and the training corpus text of the corresponding language style to obtain a second text pair.
In step S404 of some embodiments, the first text pair and the second text pair are respectively used as input data of the original question-answer model, the original question-answer model is subjected to fine tuning training according to the first text pair, and the original question-answer model is subjected to fine tuning training according to the second text pair, so as to obtain the initial question-answer model.
The advantage of steps S401 to S404 is that the original question-answer model can be energized by performing fine tuning training on the original question-answer model according to the instruction data of different language styles, so that the original question-answer model can better understand the description of different instruction data on different language styles, even if the original question-answer model is more sensitive to the instruction data on language styles, and thus, texts with different language styles can be output after training.
It can be appreciated that the training method can train to obtain an initial question-answer model, so that the initial question-answer model can be used as a target question-answer model.
It will be appreciated that, corresponding to the method of training the original question-answering model described above, in some embodiments, step S104 includes, but is not limited to, the steps of:
determining target style indicating data according to the language style selecting data;
performing text splicing on the target problem text and the target style indication data to obtain a target text pair;
and carrying out question-answering processing on the target text pairs according to the target question-answering model.
In the actual question-answering stage, a plurality of initial style indicating data may be preset, and different initial style indicating data correspond to different language style selection data. The initial style indicating data is similar to the first style indicating data and the second style indicating data, and the embodiments of the present application will not be repeated here. Determining language style selection data according to the object touch preset style control, and taking initial style indication data corresponding to the determined language style selection data as target style indication data. And performing text splicing on the target style indicating data and the target problem text to obtain a target text pair. And taking the target text pair as input data of the target question-answering model to conduct question-answering processing on the target text pair based on the target question-answering model. It will be appreciated that since the target text pair includes target style indicating data, the target question-answer model may output answer text corresponding to the language style based on the target text.
Next, a second training method will be described.
Referring to fig. 5, in some embodiments, the initial question-answering model includes a first question-answering model and a second question-answering model, and the training predicted text includes a first corpus text and a second corpus text, the first corpus text and the second corpus text corresponding to different speaking styles, i.e., different language styles. Step S102 includes, but is not limited to, steps S501 to S504.
Step S501, training a first preset plug-in according to a first corpus text to obtain a first target plug-in;
step S502, combining the first target plug-in with the original question-answer model to obtain a first question-answer model;
step S503, training a second preset plug-in according to a second corpus text to obtain a second target plug-in;
step S504, combining the second target plug-in with the original question-answer model to obtain a second question-answer model.
In step S501 of some embodiments, the first preset plugin may be a lorea plugin, and training the first preset plugin through the first corpus text to obtain a first target plugin corresponding to the first corpus text language style.
In step S502 of some embodiments, a first target plug-in is installed to the model ontology, i.e. the first target plug-in is combined with the original question-answer model, resulting in a first question-answer model with output text having a corresponding language style.
In step S503 of some embodiments, the second preset plugin may be a lorea plugin, and training the second preset plugin through the second corpus text to obtain a second target plugin corresponding to the second corpus text language style.
In step S504 of some embodiments, a second target plug-in is installed to the model ontology, i.e., the second target plug-in is combined with the original question-answer model, resulting in a second question-answer model with output text having a corresponding language style.
The step S501 to the step S504 have the advantage that the training speed can be improved compared with the training of the original question-answer model directly by training the preset plug-in through corpus texts corresponding to different language styles and combining the target plug-in obtained by training with the original question-answer model.
It can be understood that the foregoing embodiments are only illustrative of two preset plug-ins, i.e., the first preset plug-in and the second preset plug-in, and the number of preset plug-ins is not specifically limited in the embodiments of the present application.
It can be appreciated that when training is performed in the above manner, the first target plug-in or the second plug-in may be selected by responding to an action of the object touch preset style control, so that the first question model or the second question model is obtained by combining with the original question model, and then question answering processing is performed on the target question text according to the first question model or the second question model.
Finally, a third training method will be described.
Referring to fig. 6, in some embodiments, the initial question-answering model includes a third question-answering model and a fourth question-answering model, and the training corpus text includes a third corpus text and a fourth corpus text, the third corpus text and the fourth corpus text corresponding to different speaking styles, i.e., the third corpus text and the fourth corpus text corresponding to different language styles. Step S102 includes, but is not limited to, including step S601 to step S602.
Step S601, training an original question-answer model according to a third corpus text to obtain a third question-answer model;
and step S602, training the original question-answering model according to the fourth corpus text to obtain a fourth question-answering model.
In step S601 to step S602 of some embodiments, the third corpus text is used as input data of the original question-answer model, and fine tuning training is performed on the original question-answer model based on the third corpus text, so as to obtain a third question-answer model. And taking the fourth corpus text as input data of the original question-answering model, and performing fine tuning training on the original question-answering model based on the fourth corpus text to obtain a fourth question-answering model.
The benefit of step S601 to step S602 is that the original question-answer model can be directly trained based on the corpus text, so that the accuracy of outputting the text with the corresponding language style by the third question-answer model (or the fourth question-answer model) obtained by training is improved.
It can be understood that the above embodiment is only exemplified by the third question-answer model and the fourth question-answer model, and further question-answer models are obtained according to the actual needs and corpus texts of different language styles, so that the embodiment of the application is not particularly limited.
Compared with the prior art, which only makes the output text have a certain language style (such as a certain popular language, etc.), the language style of the text output by the embodiment of the application can represent the speaking style of a specific character, that is, the embodiment of the application can realize specific character setting and character imitation. In addition, the generation of style texts in the related art depends on style migration, that is, a non-style text needs to be generated first, and then the non-style text is migrated to a certain style by using a style migration model. The method can solve the problems of information loss, incomplete style migration and the like in the implementation process, and the method for generating the text with the language style directly based on the target question-answering model can reduce the problems.
Referring to fig. 7, the embodiment of the present application further provides a language style-based question-answering device, which can implement the above-mentioned language style-based question-answering method, where the device includes:
a text obtaining module 701, configured to obtain a training corpus text having an original object speaking style;
the training module 702 is configured to train a preset original question-answer model according to a training corpus text, so as to obtain an initial question-answer model;
the screening module 703 is configured to obtain language style selection data, and screen the initial question-answer model according to the language style selection data to obtain a target question-answer model;
and the question and answer processing module 704 is used for acquiring the target question text and performing question and answer processing on the target question text according to the target question and answer model.
The specific implementation manner of the language-style-based question-answering device is basically the same as the specific embodiment of the above-mentioned language-style-based question-answering method, and will not be repeated here.
The embodiment of the application also provides electronic equipment, which comprises a memory and a processor, wherein the memory stores a computer program, and the processor realizes the question-answering method based on language style when executing the computer program. The electronic equipment can be any intelligent terminal including a tablet personal computer, a vehicle-mounted computer and the like.
Referring to fig. 8, fig. 8 illustrates a hardware structure of an electronic device according to another embodiment, the electronic device includes:
the processor 801 may be implemented by a general-purpose CPU (central processing unit), a microprocessor, an application-specific integrated circuit (ApplicationSpecificIntegratedCircuit, ASIC), or one or more integrated circuits, etc. for executing related programs to implement the technical solutions provided by the embodiments of the present application;
the memory 802 may be implemented in the form of read-only memory (ReadOnlyMemory, ROM), static storage, dynamic storage, or random access memory (RandomAccessMemory, RAM). Memory 802 may store an operating system and other application programs, and when implementing the technical solutions provided in the embodiments of the present application through software or firmware, relevant program codes are stored in memory 802, and the processor 801 invokes a language style-based question-answering method for executing the embodiments of the present application;
an input/output interface 803 for implementing information input and output;
the communication interface 804 is configured to implement communication interaction between the device and other devices, and may implement communication in a wired manner (e.g., USB, network cable, etc.), or may implement communication in a wireless manner (e.g., mobile network, WIFI, bluetooth, etc.);
a bus 805 that transfers information between the various components of the device (e.g., the processor 801, the memory 802, the input/output interface 803, and the communication interface 804);
wherein the processor 801, the memory 802, the input/output interface 803, and the communication interface 804 implement communication connection between each other inside the device through a bus 805.
The embodiment of the application also provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program realizes the question-answering method based on language style when being executed by a processor.
The memory, as a non-transitory computer readable storage medium, may be used to store non-transitory software programs as well as non-transitory computer executable programs. In addition, the memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory optionally includes memory remotely located relative to the processor, the remote memory being connectable to the processor through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The embodiments described in the embodiments of the present application are for more clearly describing the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application, and as those skilled in the art can know that, with the evolution of technology and the appearance of new application scenarios, the technical solutions provided by the embodiments of the present application are equally applicable to similar technical problems.
It will be appreciated by those skilled in the art that the technical solutions shown in the figures do not constitute limitations of the embodiments of the present application, and may include more or fewer steps than shown, or may combine certain steps, or different steps.
The above described apparatus embodiments are merely illustrative, wherein the units illustrated as separate components may or may not be physically separate, i.e. may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
Those of ordinary skill in the art will appreciate that all or some of the steps of the methods, systems, functional modules/units in the devices disclosed above may be implemented as software, firmware, hardware, and suitable combinations thereof.
The terms "first," "second," "third," "fourth," and the like in the description of the present application and in the above-described figures, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that embodiments of the present application described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be understood that in this application, "at least one" means one or more, and "a plurality" means two or more. "and/or" for describing the association relationship of the association object, the representation may have three relationships, for example, "a and/or B" may represent: only a, only B and both a and B are present, wherein a, B may be singular or plural. The character "/" generally indicates that the context-dependent object is an "or" relationship. "at least one of" or the like means any combination of these items, including any combination of single item(s) or plural items(s). For example, at least one (one) of a, b or c may represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", wherein a, b, c may be single or plural.
In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the above-described division of units is merely a logical function division, and there may be another division manner in actual implementation, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described above as separate components may or may not be physically separate, and components shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied essentially or in part or all of the technical solution or in part in the form of a software product stored in a storage medium, including multiple instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of the various embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing a program.
Preferred embodiments of the present application are described above with reference to the accompanying drawings, and thus do not limit the scope of the claims of the embodiments of the present application. Any modifications, equivalent substitutions and improvements made by those skilled in the art without departing from the scope and spirit of the embodiments of the present application shall fall within the scope of the claims of the embodiments of the present application.

Claims (10)

1. A language style based question-answering method, the method comprising:
acquiring a training corpus text with an original object speaking style;
training a preset original question-answer model according to the training corpus text to obtain an initial question-answer model;
acquiring language style selection data, and screening the initial question-answer model according to the language style selection data to obtain a target question-answer model;
and acquiring a target question text, and performing question-answering processing on the target question text according to the target question-answering model.
2. The method according to claim 1, wherein training the preset original question-answer model according to the training corpus text to obtain an initial question-answer model comprises:
constructing first style indicating data and second style indicating data;
performing text splicing on the first style indicating data and the training corpus text to obtain a first text pair;
performing text splicing on the second style indicating data and the training corpus text to obtain a second text pair;
training the original question-answering model according to the first text pair and the second text pair to obtain the initial question-answering model.
3. The method of claim 2, wherein said question-answering the target question text according to the target question-answering model comprises:
determining target style indication data according to the language style selection data;
performing text splicing on the target question text and the target style indication data to obtain a target text pair;
and carrying out question-answering processing on the target text pairs according to the target question-answering model.
4. The method of claim 1, wherein the initial question-answering model comprises a first question-answering model and a second question-answering model, the training corpus text comprises a first corpus text and a second corpus text, the first corpus text and the second corpus text correspond to different speaking styles;
training a preset original question-answer model according to the training corpus text to obtain an initial question-answer model, wherein the training corpus text comprises the following steps:
training a first preset plug-in according to the first corpus text to obtain a first target plug-in;
combining the first target plug-in with the original question-answer model to obtain the first question-answer model;
training a second preset plug-in according to the second corpus text to obtain a second target plug-in;
and combining the second target plug-in with the original question-answer model to obtain the second question-answer model.
5. The method of claim 1, wherein the initial question-answering model comprises a third question-answering model and a fourth question-answering model, the training corpus text comprises a third corpus text and a fourth corpus text, the third corpus text and the fourth corpus text correspond to different speaking styles;
training a preset original question-answer model according to the training corpus text to obtain an initial question-answer model, wherein the training corpus text comprises the following steps:
training the original question-answer model according to the third corpus text to obtain a third question-answer model;
training the original question-answering model according to the fourth corpus text to obtain the fourth question-answering model.
6. The method of any one of claims 1 to 5, wherein the obtaining language style selection data comprises:
acquiring a touch state of a preset style control;
and if the touch state indicates that touch is performed, taking the preset style data corresponding to the preset style control as the language style selection data.
7. The method of claim 6, wherein the obtaining language style selection data further comprises:
if the touch state indicates that the touch is not performed, acquiring object information of a login object;
the language style selection data is generated based on the object information.
8. A language style based question-answering apparatus, the apparatus comprising:
the text acquisition module is used for acquiring a training corpus text with the speaking style of the original object;
the training module is used for training a preset original question-answer model according to the training corpus text to obtain an initial question-answer model;
the screening module is used for acquiring language style selection data, and screening the initial question-answering model according to the language style selection data to obtain a target question-answering model;
and the question and answer processing module is used for acquiring a target question text and carrying out question and answer processing on the target question text according to the target question and answer model.
9. An electronic device comprising a memory storing a computer program and a processor implementing the method of any of claims 1 to 7 when the computer program is executed by the processor.
10. A computer readable storage medium storing a computer program, characterized in that the computer program, when executed by a processor, implements the method of any one of claims 1 to 7.
CN202311333273.3A 2023-10-16 2023-10-16 Question-answering method and device based on language style, electronic equipment and storage medium Pending CN117539985A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311333273.3A CN117539985A (en) 2023-10-16 2023-10-16 Question-answering method and device based on language style, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311333273.3A CN117539985A (en) 2023-10-16 2023-10-16 Question-answering method and device based on language style, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117539985A true CN117539985A (en) 2024-02-09

Family

ID=89785013

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311333273.3A Pending CN117539985A (en) 2023-10-16 2023-10-16 Question-answering method and device based on language style, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117539985A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117932043A (en) * 2024-03-22 2024-04-26 杭州食方科技有限公司 Dialogue style migration reply information display method, device, equipment and readable medium
CN118228829A (en) * 2024-05-20 2024-06-21 科大讯飞股份有限公司 Large language model personal setting privatization method and related device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117932043A (en) * 2024-03-22 2024-04-26 杭州食方科技有限公司 Dialogue style migration reply information display method, device, equipment and readable medium
CN118228829A (en) * 2024-05-20 2024-06-21 科大讯飞股份有限公司 Large language model personal setting privatization method and related device

Similar Documents

Publication Publication Date Title
CN111930940B (en) Text emotion classification method and device, electronic equipment and storage medium
CN106997370B (en) Author-based text classification and conversion
US20200042597A1 (en) Generating question-answer pairs for automated chatting
CN117539985A (en) Question-answering method and device based on language style, electronic equipment and storage medium
CN114787814A (en) Reference resolution
JP7093397B2 (en) Question answering robot generation method and equipment
CN108733703A (en) The answer prediction technique and device of question answering system, electronic equipment, storage medium
CN111897934A (en) Question and answer pair generation method and device
Bell et al. Microblogging as a mechanism for human–robot interaction
CN111275133A (en) Fusion method and device of classification models and storage medium
CN113642740B (en) Model training method and device, electronic equipment and medium
CN113392179A (en) Text labeling method and device, electronic equipment and storage medium
CN115292466B (en) Question-answering system implementation method, device, equipment, medium and program
CN114492661B (en) Text data classification method and device, computer equipment and storage medium
CN114492669B (en) Keyword recommendation model training method, recommendation device, equipment and medium
CN112329429B (en) Text similarity learning method, device, equipment and storage medium
CN116701604A (en) Question and answer corpus construction method and device, question and answer method, equipment and medium
CN117494761A (en) Information processing and model training method, device, equipment, medium and program product
CN116975249A (en) Dialogue interaction method, device, equipment and storage medium
CN117093688A (en) Question answering method, question answering device, electronic equipment and storage medium
CN116580704A (en) Training method of voice recognition model, voice recognition method, equipment and medium
CN116543798A (en) Emotion recognition method and device based on multiple classifiers, electronic equipment and medium
CN109002498B (en) Man-machine conversation method, device, equipment and storage medium
Yadav et al. An Empirical Study of Design Techniques of Chatbot, a Review
CN110636362A (en) Image processing method, device and system and electronic equipment

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