CN114328852A - Text processing method, related device and equipment - Google Patents

Text processing method, related device and equipment Download PDF

Info

Publication number
CN114328852A
CN114328852A CN202110990618.7A CN202110990618A CN114328852A CN 114328852 A CN114328852 A CN 114328852A CN 202110990618 A CN202110990618 A CN 202110990618A CN 114328852 A CN114328852 A CN 114328852A
Authority
CN
China
Prior art keywords
question
title
text
target
target text
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
CN202110990618.7A
Other languages
Chinese (zh)
Inventor
周辉阳
闫昭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202110990618.7A priority Critical patent/CN114328852A/en
Publication of CN114328852A publication Critical patent/CN114328852A/en
Pending legal-status Critical Current

Links

Images

Abstract

The embodiment of the application discloses a text processing method based on a natural language processing technology, a related device and equipment, wherein an application scene at least comprises various terminals, such as: mobile phones, computers, vehicle-mounted terminals, and the like. The method in the embodiment of the application comprises the following steps: acquiring a target text, wherein the target text comprises a first title, a second title and a target text paragraph, and the hierarchy of the second title in the target text is higher than that of the first title in the target text; extracting a target key phrase from the first title and the second title; inputting the target key phrase into a first question generation model, and outputting a first question through the first question generation model, wherein the first question corresponds to the target text paragraph; and generating a first question-answer pair according to the first question and the target text paragraph. Because the first title and the second title have different hierarchies in the target text and summarize the target text paragraph from different angles, more information is contained, and the generated problem is more accurate.

Description

Text processing method, related device and equipment
Technical Field
The present application relates to the field of artificial intelligence, and in particular, to a text processing method, a related apparatus, and a device.
Background
With the development of artificial intelligence, intelligent question answering plays an increasingly important role on intelligent service platforms such as intelligent customer service, intelligent robots and intelligent sound boxes. How to construct question-answering systems also becomes a hot topic of research.
In a text processing method, a terminal device may disassemble a text to be processed to obtain a title and a text passage, and use the title as a question and the text passage as an answer. In the text to be processed, a text paragraph may be preceded by a plurality of headings, in which case, a heading closest to the text paragraph is used as a question of the text paragraph to form a question-answer pair (QA) corresponding to the text paragraph.
In this method, the terminal device directly takes a heading closest to a position of a text paragraph in the text as a problem of the text paragraph, and since the amount of information contained in one heading is small, the generated problem may correspond to a large range, and the accuracy of the problem is reduced.
Disclosure of Invention
In view of this, the present application provides a method, a related apparatus, and a device for text processing, which extract a target keyword group from a first title and a second title of a target text, and generate a first question corresponding to a target text paragraph according to the target keyword group. The first title and the second title have different levels in the target text, and summarize the target text paragraph from different angles, so that more information is contained, and the generated problem is more accurate.
One aspect of the present application provides a method for text processing, including:
the method comprises the steps of obtaining a target text, wherein the target text comprises a first title, a second title and a target text paragraph, the hierarchy of the second title in the target text is higher than that of the first title in the target text, and the first title and the second title are both used for summarizing the content of the target text paragraph;
extracting a target key phrase from the first title and the second title;
inputting the target key phrase into a first question generation model, and outputting a first question through the first question generation model, wherein the first question corresponds to the target text paragraph;
and generating a first question-answer pair according to the first question and the target text paragraph.
Another aspect of the present application provides a text processing apparatus, including:
the device comprises an acquisition unit, a processing unit and a display unit, wherein the acquisition unit is used for acquiring a target text, the target text comprises a first title, a second title and a target text paragraph, the hierarchy of the second title in the target text is higher than that of the first title in the target text, and the first title and the second title are both used for summarizing the content of the target text paragraph;
a processing unit to:
extracting a target key phrase from the first title and the second title;
inputting the target key phrase into a first question generation model, and outputting a first question through the first question generation model, wherein the first question corresponds to the target text paragraph;
and generating a first question-answer pair according to the first question and the target text paragraph.
In one possible design, in an implementation manner of another aspect of the embodiment of the present application, the processing unit is further configured to:
extracting an abstract from a target text paragraph;
inputting the abstract into a second question generation model, and outputting a second question through the second question generation model, wherein the second question corresponds to the target text paragraph;
and generating a second question-answer pair according to the second question and the target text paragraph.
In one possible design, in an implementation manner of another aspect of the embodiment of the present application, the processing unit is specifically configured to:
performing word segmentation processing and part-of-speech tagging on the first title and the second title through a first keyword algorithm to obtain M words, wherein M is a positive integer;
determining a first candidate key phrase from M words, wherein the first candidate key phrase comprises N words, the parts of speech of the N words are target parts of speech, and N is a positive integer less than or equal to M;
marking the sentence components of the first title and the second title through a second keyword algorithm to obtain a marking result;
determining a second candidate key phrase according to the labeling result;
and determining the intersection of the first candidate key phrase and the second candidate key phrase as a target key phrase.
In one possible design, in an implementation manner of another aspect of the embodiment of the present application, the obtaining unit is further configured to: obtaining a sample question set, wherein the sample question set comprises at least one sample question;
according to the sample question set, acquiring grammatical features of at least one sample question;
acquiring a keyword set of a sample text, wherein the keyword set is contained in a title of the sample text, and the keywords in the keyword set are sequentially arranged according to the hierarchical sequence of the title in the sample text;
and training a first question generation model according to the grammatical features and the keyword set.
In one possible design, in an implementation manner of another aspect of the embodiment of the present application, the first question generation model includes a text processing model; a processing unit, specifically configured to:
inputting the grammatical feature and the keyword set into a text processing model, and determining the value of a loss function of the training text processing model;
and if the value of the loss function of the training text processing model is less than or equal to a preset threshold value, determining that the training of the first problem generation model is finished.
In one possible design, in an implementation manner of another aspect of the embodiment of the present application, the text processing apparatus further includes a display unit, configured to:
displaying a file uploading interface of the question-answering system, wherein the file uploading interface comprises a file uploading control;
responding to a touch instruction aiming at the file uploading control, and displaying a text list, wherein the text list comprises at least one text;
and the acquisition unit is specifically used for responding to a selection instruction aiming at the target text in the text list and acquiring the target text.
In one possible design, in an implementation manner of another aspect of the embodiment of the present application, the display unit is further configured to:
displaying a question bar and an answer bar on a setting interface of the question-answering system, wherein the question bar is used for displaying a first question, the answer bar is used for displaying a target text paragraph, and the setting interface further comprises a storage control;
responding to an operation instruction aiming at the question bar, and displaying the modified question;
responding to an operation instruction aiming at the answer bar, and displaying the modified answer;
and the processing unit is also used for responding to the touch instruction aiming at the saving control and saving the modified question-answer pair.
Another aspect of the present application provides a computer device, comprising: a memory, a processor, and a bus system; the memory is used for storing program codes; the processor is configured to execute the text processing method of any of the above aspects according to instructions in the program code.
Another aspect of the present application provides a computer-readable storage medium having stored therein instructions, which when executed on a computer, cause the computer to perform the text processing method of any one of the above aspects.
According to another aspect of the application, a computer program product or computer program is provided, comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the text processing method of any one of the above aspects.
According to the technical scheme, the embodiment of the application has the following advantages:
in the embodiment of the application, a target keyword group is extracted from a first title and a second title of a target text, and a first question corresponding to a target text paragraph is generated according to the target keyword group. The first title and the second title have different levels in the target text, and summarize the target text paragraph from different angles, so that more information is contained, and the generated problem is more accurate.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a schematic diagram of an architecture of a text processing method according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a text processing method according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a target text provided by an embodiment of the present application;
FIG. 4 is a schematic diagram of a directory provided by an embodiment of the present application;
FIG. 5 is a schematic diagram of a file upload interface provided in an embodiment of the present application;
FIG. 6 is a schematic view of a document processing interface provided in an embodiment of the present application;
FIG. 7 is a schematic view of a setup interface provided by an embodiment of the present application;
fig. 8 is a schematic structural diagram of a text processing apparatus according to an embodiment of the present application;
FIG. 9 is a schematic structural diagram of a computer device according to an embodiment of the present application;
fig. 10 is another schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
The embodiment of the application provides a text processing method, a related device and equipment, wherein a target key phrase is extracted from a first title and a second title of a target text, and a first question corresponding to a target text paragraph is generated according to the target key phrase. The first title and the second title have different levels in the target text, and summarize the target text paragraph from different angles, so that more information is contained, and the generated problem is more accurate.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims of the present application and in the drawings described above, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are, for example, capable of operation in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "corresponding" 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.
First, some nouns that may appear in the embodiments of the present application are explained.
1. Artificial Intelligence (AI).
Artificial intelligence is a theory, method, technique and application system that uses a digital computer or a machine controlled by a digital computer to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use the knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technique of computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can react in a manner similar to human intelligence. Artificial intelligence is the research of the design principle and the realization method of various intelligent machines, so that the machines have the functions of perception, reasoning and decision making.
The artificial intelligence technology is a comprehensive subject and relates to the field of extensive technology, namely the technology of a hardware level and the technology of a software level. The artificial intelligence infrastructure generally includes 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 voice processing technology, a natural language processing technology, machine learning/deep learning and the like.
2. Natural Language Processing (NLP).
Natural language processing technology is an important direction in the fields of computer science and artificial intelligence. It studies various theories and methods that enable efficient communication between humans and computers using natural language. Natural language processing is a science integrating linguistics, computer science and mathematics. Therefore, the research in this field will involve natural language, i.e. the language that people use everyday, so it is closely related to the research of linguistics. Natural language processing techniques typically include text processing, semantic understanding, machine translation, robotic question and answer, knowledge mapping, and the like.
3. Unstructured text.
The unstructured text refers to text which is not refined, summarized or generalized, the unstructured text comprises headings and paragraphs, corresponding text paragraphs are arranged under each heading, and the content of the text paragraphs is related to the headings. The titles in the text may constitute a hierarchical directory. In practical applications, common reports, papers, prose and the like belong to unstructured texts. In the text processing method provided by the embodiment of the application, the processed object includes an unstructured text. Unlike an unstructured text, the structured text in the embodiment of the present application refers to a text embodied in a question and answer form, or a text obtained after an unstructured text is refined by using a knowledge map or the like. The text embodied in the question-answering form includes text formed according to question-answering conversations, for example, text describing a question-answering conversation between the user and the intelligent question-answering system.
The text processing method provided by the embodiment of the application provides technical support for intelligent question-answering systems such as robot question-answering systems. Referring to fig. 1, fig. 1 is a schematic diagram of an architecture of a text processing method according to an embodiment of the present disclosure.
It should be understood that the text processing method provided by the application can be applied to a system or a program containing a text processing function in the terminal device. As shown in fig. 1, the terminal device may establish a communication connection with the server. The terminal device can obtain the target text and analyze the target text to obtain a first title, a second title and a target text paragraph. Wherein the level of the second title in the target text is higher than the level of the first title in the target text. Colloquially, the first heading may be understood as a subtitle corresponding to the target text paragraph and the second heading may be understood as a headline corresponding to the target text paragraph. Assuming that the first title is a secondary title, then the second title is a primary title. Furthermore, the first heading and the second heading may each summarize the content of the target text paragraph, that is, in the target text, the first heading and the second heading are above the target text paragraph. The terminal equipment extracts a target key phrase from the first title and the second title, inputs the key phrase into the first question generation model, and obtains a first question corresponding to the target text paragraph. It can be understood that the operation process of the first problem generation model can be performed in the server, thereby saving the operation resources of the terminal device. The terminal equipment can obtain a first question-answer pair according to the first question and the target text paragraph.
In the embodiment of the application, a target keyword group is extracted from a first title and a second title of a target text, and a first question corresponding to a target text paragraph is generated according to the target keyword group. The first title and the second title have different levels in the target text, and summarize the target text paragraph from different angles, so that more information is contained, and the generated problem is more accurate.
It can be understood that fig. 1 shows a terminal device, in an actual scenario, there may be more types of terminal devices participating in the text processing, and the specific number and type depend on the actual scenario, which is not limited herein, and in addition, fig. 1 shows one server, but in an actual scenario, there may also be participation of multiple servers, especially in a scenario of multi-model training interaction, the specific number of servers depends on the actual scenario.
In this embodiment, the server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server that provides basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a network service, cloud communication, a middleware service, a domain name service, a security service, a Content Delivery Network (CDN), a big data and artificial intelligence platform, and the like. The terminal device may be, but is not limited to, a smart phone, a tablet computer, a notebook computer, a vehicle-mounted terminal, a desktop computer, a smart speaker, a smart watch, and the like. The terminal device and the server may be directly or indirectly connected through a wired or wireless communication manner, and the terminal device and the server may be connected to form a block chain network, which is not limited herein.
Referring to fig. 2, fig. 2 is a flowchart of text processing provided in an embodiment of the present application, where the embodiment of the present application at least includes the following steps:
201. the method comprises the steps of obtaining a target text, wherein the target text comprises a first title, a second title and a target text paragraph, the hierarchy of the second title in the target text is higher than that of the first title, and the first title and the second title are used for summarizing the content of the target text paragraph.
In the text processing process, the terminal device may obtain the target text, and analyze the target text to obtain the first title, the second title, and the first paragraph. For example, the content of the target text is described by taking the target text as an example shown in fig. 3. Referring to fig. 3, fig. 3 is a schematic diagram of a target text. As shown in fig. 3, the target text is a text about "travel boutique in XX", and includes a target text paragraph "XXX family's main dish taste is praise, and food material is fresh … …; the main dish in XXX shop has pure taste … …; XXX. In the embodiment shown in fig. 3, the target text paragraph is preceded by multiple hierarchical titles in the target text, and in general, "one and XX gourmet editions" is called a primary title, "1 and chinese cuisine complete" is called a secondary title, and "1.1 and north cuisine recommendations" is called a tertiary title. Of these titles, the first-level title is highest in the target text, and the third-level title is lowest in the target text. Assuming that the first title is a third title, "north dish recommendation", the second title may be a second title, a first title and a second title, and is selected according to the requirements of the actual application, and the specific details are not limited herein. It will be appreciated that the contents of the target text passage can be summarized, whether it be the first heading or the second heading. Except that the different levels of headings summarize the target text passage to a different extent.
Alternatively, a plurality of hierarchical titles can form a catalog of target text. Referring to fig. 4, fig. 4 is a schematic diagram of a directory according to an embodiment of the present disclosure. In natural language, the catalog can reflect not only the rough content of the text but also the arrangement of the content in the text and the association relationship between text paragraphs.
202. And extracting the target key phrase from the first title and the second title.
After acquiring the first title and the second title, the terminal device may acquire the target keyword group from the first title and the second title. In practical application, the target keyword group may include at least one word, and the parts of speech of each word may be the same or different, and are not limited herein.
Illustratively, in the embodiment shown in fig. 3 or fig. 4, the terminal device extracts the target keyword set from the first heading "1.1, north dish recommendation", the second heading "1, complete chinese food series" and "one, XX food compilation", which may be [ "XX", "food", "chinese food" and "north dish" ].
203. And inputting the target key phrase into a first question generation model, and outputting a first question through the first question generation model, wherein the first question corresponds to the target text paragraph.
After the terminal device obtains the target keyword group, the target keyword group is input to the first problem generation model. The purpose of the first question generation model is to expand the input keywords and output a complete question. Therefore, the terminal device may obtain the first question through the first question generation model, wherein the first question corresponds to the target text paragraph. Illustratively, assuming that the target key phrase includes [ "XX ground", "gourmet", "chinese meal", and "north dish" ], the first question obtained according to the first question generation model may be "what is the cuisine of XX ground, what is the cuisine of chinese meal? ".
204. And generating a first question-answer pair according to the first question and the target text paragraph.
After the terminal equipment obtains the first question, a first question-answer pair is generated according to the first question and the target text paragraph. Wherein the question in the first question-answer pair is a first question, and the answer is a target text paragraph.
In the embodiment of the application, a target keyword group is extracted from a first title and a second title of a target text, and a first question corresponding to a target text paragraph is generated according to the target keyword group. The first title and the second title have different levels in the target text, and summarize the target text paragraph from different angles, so that more information is contained, and the generated problem is more accurate.
Optionally, on the basis of the embodiment corresponding to fig. 2, in an optional embodiment of the text processing method provided in the embodiment of the present application, the text processing method further includes:
extracting an abstract from a target text paragraph;
inputting the abstract into a second question generation model, and outputting a second question through the second question generation model, wherein the second question corresponds to the target text paragraph;
and generating a second question-answer pair according to the second question and the target text paragraph.
After the terminal device acquires the target text paragraph, the summary can be acquired according to the target text paragraph. It is understood that the abstract is a summary expression of the content of the target text passage, and can reflect the content core or the subject of the target text passage, and is usually a short sentence. Specifically, after acquiring the target text paragraph, the terminal device can input the target text paragraph into the abstract extraction model, and obtain the abstract corresponding to the target text paragraph through the abstract extraction model.
Optionally, the terminal device may train the abstract extraction model before acquiring the abstract according to the target text paragraph. The text in the sample text set for training the summarization extraction model may be text corresponding to a certain text type, for example, text relating to employment guidance, text relating to travel strategies, or text relating to popular science, etc. The abstract extraction model obtained by training is more targeted and has higher applicability in a certain vertical field. The text type in the sample text set is selected according to the requirements of the practical application, and is not limited here. The loss function that trains the abstract extraction model may be a cross entropy loss function (cross entrophy).
After the terminal device obtains the summary, the terminal device inputs the summary into the second problem generation model. The second question generation model can expand the short sentence and convert the sentence into a complete question. Therefore, the terminal device may obtain the second question through the second question generation model, where the second question corresponds to the target text paragraph. And after the terminal equipment obtains the second question, generating a second question-answer pair according to the target text paragraph of the second question. The question in the second question-answer pair is the second question and the answer is the target text paragraph.
Illustratively, in the embodiment shown in FIG. 3, the contents of the target text passage include "XXX family main ordering taste praise, food material freshness … …; the main dish in XXX shop has pure taste … …; XXX restaurant … … ", assuming that the summary obtained by the terminal device includes" different main dishes for each store ", the second question obtained by inputting the summary into the second question generation model may be" what are the main dishes for each store? ".
In the embodiment of the application, the terminal device can generate a first question corresponding to the target text paragraph according to the title of the target text, and can also generate a second question corresponding to the target text paragraph according to the target text paragraph, and ask the target text paragraph from multiple dimensions, so that the range of the question-answer pairs is enriched. In a scenario of applying question-answer pairs, such as an intelligent question-answer system, the hit rate of questions is improved, and the accuracy of the intelligent question-answer system is improved.
In the embodiment of the application, different numbers of question-answer pairs can be obtained according to the relationship between the first question and the second question. If the first question and the second question are the same, meaning that the target text paragraph is the answer, the questions asked are consistent, and the terminal device generates a group of question-answer pairs. The question in the set of question-answer pairs is either a first question or a second question and the answer is the target text paragraph.
If the first question and the second question are different, meaning that the target text paragraph is taken as an answer, the question to be asked is different, and the terminal device generates two question-answer pairs. The question of the first of the two question-answer pairs is the first question and the answer is the target text paragraph. The question of the second question-answer pair is the second question and the answer is the target text paragraph.
In the embodiment of the application, the number of the obtained question-answer pairs is different according to the difference of the relationship between the first question and the second question, and the content of the question-answer pairs is further enriched. Meanwhile, in the natural language, different questions may exist for the same answer, and the text processing method provided by the embodiment of the application is more suitable for the practical application of the natural language, so that the accuracy of the question-answering system applying the text processing method is improved.
Optionally, on the basis of the embodiment corresponding to fig. 2, in an optional embodiment of the text processing method provided in the embodiment of the present application, the extracting the target keyword group from the first title and the second title includes:
performing word segmentation processing and part-of-speech tagging on the first title and the second title through a first keyword algorithm to obtain M words, wherein M is a positive integer;
determining a first candidate key phrase from M words, wherein the first candidate key phrase comprises N words, the parts of speech of the N words are target parts of speech, and N is a positive integer less than or equal to M;
marking the sentence components of the first title and the second title through a second keyword algorithm to obtain a marking result;
determining a second candidate key phrase according to the labeling result;
and determining the intersection of the first candidate key phrase and the second candidate key phrase as a target key phrase.
Illustratively, the process of extracting keywords will be described by taking the first keyword algorithm as textrank4zh algorithm and the second keyword algorithm as a Decomposable Neural Paraphrase Generation (DNPG) algorithm.
Through the textrank4zh algorithm, the terminal device performs word segmentation processing on the first title and the second title to obtain M words, and labels the part of speech of each of the M words. And then, screening the M words, and determining N words, wherein the parts of speech of the N words are target parts of speech, wherein M and N are positive integers, and N is less than M. These N words are included in the first candidate keyword group.
The DNPG algorithm labels components in a sentence and can play a role in distinguishing the sentence components. Optionally, the component labeled 1 is a template component in the sentence, and the component labeled 0 is a keyword component in the sentence. Wherein, the template components comprise tone words, punctuation marks and the like. The keyword component refers to a key part in the sentence, such as a main predicate element structure in the sentence. And the terminal equipment can acquire the second candidate key phrase through the labeling result of the DNPG algorithm. Then, the terminal device compares the first candidate keyword group with the second candidate keyword group, and determines that the intersection is the first keyword group.
It can be understood that, in natural language, there is a precedence order between words, so as to avoid the problem caused by improper order, in the candidate keyword group and the target keyword group, each word may be arranged in sequence according to the hierarchy of the title. That is, among the candidate keyword group and the target keyword group, the keyword extracted from the title having a high hierarchy is ranked before the keyword extracted from the title having a low hierarchy.
Illustratively, assuming that the first title is "north dish recommendation", the second title is "XX gourmet co-edit", the first candidate keyword set extracted by the textrank4zh algorithm includes [ "XX gourmet", "co-edit", "north dish" ]; the labeling result obtained by the DNPG algorithm is (000001100011), and the corresponding second candidate key words are [ "XX land", "gourmet", "north dish" ]. The terminal device may determine that the intersection of the two candidate keyword sets [ "XX ground", "gourmet", "north dish" ] is the target keyword set.
In the embodiment of the application, the terminal device combines different algorithms, extracts the target keyword group from the first title and the second title, and improves the accuracy and robustness of obtaining the target keyword group by the terminal device by utilizing the respective advantages of the different algorithms.
Optionally, before extracting the target keyword group according to the first title and the second title, the terminal device may train a keyword group extraction model. The input sample for training the keyword group extraction model may be a sample title set, or may be other types of text data sets, such as a sample question set, which is not limited herein. The algorithm for training the keyword extraction model may be the above mentioned algorithm, and is not limited herein. After the keyword group extraction model is trained, the terminal device may input the first title and the second title into the keyword group extraction model to obtain the target keyword group.
Optionally, on the basis of the embodiment corresponding to fig. 2, in an optional embodiment of the text processing method provided in the embodiment of the present application, the text processing method further includes:
obtaining a sample question set, wherein the sample question set comprises at least one sample question;
according to the sample question set, acquiring grammatical features of at least one sample question;
acquiring a keyword set of a sample text, wherein the keyword set is contained in a title of the sample text, and the keywords in the keyword set are sequentially arranged according to the hierarchical sequence of the title in the sample text;
and training a first question generation model according to the grammatical features and the keyword set.
Before inputting the target keyword group into the first question generation model, the terminal device trains the first question generation model.
In the embodiment of the present application, the first problem generation model may also be trained. The first problem generation model may be trained using pre-training plus downstream task fine-tuning. Specifically, in the pre-training process, a set of sample questions is input to the pre-training model, so that the pre-training model learns the grammatical features of the sample questions. Where the grammatical features of a sample question may be expressed as an expression associated with the question, for example, in the general case where questions all end with a question mark. Questions include questions such as "why", "where", "when", etc. Optionally, the pre-training model may be a Bidirectional Encoded Representation (BERT) model of the transformer, and may also be other pre-training models, for example, an OpenAI-GTP model, where the type of the pre-training model is selected according to the needs of the actual application, and is not limited herein.
And acquiring a keyword set from the title of the sample text, wherein the keywords in the keyword set are sequentially arranged according to the hierarchical sequence of the titles in the sample text. Through the pre-training process, the pre-training model has learned the grammatical features of the sample problem. The downstream task of the first question generation model is to generate questions according to the keyword set, a transformer can be selected as a basic model, and the first question generation model is trained according to the keyword set and the grammatical features.
Optionally, on the basis of the embodiment corresponding to fig. 2, in an optional embodiment of the text processing method provided in the embodiment of the present application, the first question generation model includes a text processing model; training a first problem generation model according to the grammatical features and the keyword set, wherein the training comprises the following steps:
inputting the grammatical feature and the keyword set into a text processing model, and determining the value of a loss function of the training text processing model;
and if the value of the loss function of the training text processing model is less than or equal to a preset threshold value, determining that the training of the first problem generation model is finished.
The first problem generation model comprises a text processing model, and a transformer can be used as a basic model to complete processes such as encoding and decoding. In the process of training the first question generation model according to the keyword set and the grammatical features, the keyword set and the grammatical features can be used as the input of the model, the output of the model (namely, the questions generated in the training process) is recorded, and the values of the loss functions in the process of training the text processing model are determined. And if the value of the loss function is smaller than or equal to the preset threshold, the accuracy of the first problem generation model is considered to meet the requirement of practical application, and the training of the first problem generation model is completed. Wherein, the loss function used for training the first problem generation model can be a cross entropy loss function. It can be understood that after the training of the first question generation model is completed, the terminal device may obtain the first question according to the target keyword group through the first question generation model. In the process of using the first problem generation model, the first problem generation model can be further optimized, so that the output of the model is more accurate.
In the embodiment of the application, the problem generation model can be trained in a pre-training and downstream task fine-tuning mode, the pre-training can reduce the training cost, and the operation resources of the terminal equipment are saved.
Similarly, the terminal device may also train a second problem generation model, similar to the training process type of the first problem generation model. Specifically, the terminal device may train the second problem generation model in a pre-training plus downstream task fine-tuning manner. Specifically, in the pre-training process, a set of sample questions is input to the pre-training model, so that the pre-training model learns the grammatical features of the sample questions. The grammatical features of the sample problem and the specific contents of the pre-training model are referred to the above description, and are not repeated here.
The terminal equipment can also obtain the abstract set from the sample text. Through the pre-training process, the pre-training model has learned the grammatical features of the sample problem. The downstream task of the second question generation model is to generate questions according to the abstract set, a transformer can be selected as a basic model, and the second question generation model is trained according to the abstract set and the grammatical features. Wherein, the loss function used for training the second problem generation model can be a cross-entropy loss function. It can be understood that after the second question generation model completes training, the terminal device may obtain the second question according to the abstract through the second question generation model.
Optionally, on the basis of the embodiment corresponding to fig. 2, in an optional embodiment of the text processing method provided in the embodiment of the present application, the text processing method further includes:
displaying a file uploading interface of the question-answering system, wherein the file uploading interface comprises a file uploading control;
responding to a touch instruction aiming at the file uploading control, and displaying a text list, wherein the text list comprises at least one text;
acquiring a target text, comprising: and responding to a selection instruction aiming at the target text in the text list to acquire the target text.
It can be understood that the text processing method provided by the embodiment of the application can be applied to an intelligent question-answering system. The provider or the research and development personnel of the intelligent question-answering system can provide the target text to the terminal equipment to obtain the question-answering pairs. To explain this situation, please refer to fig. 5, where fig. 5 is a schematic diagram of a file uploading interface provided in an embodiment of the present application.
The terminal device may display a file upload interface as shown in an interface a in fig. 5, where the file upload interface includes a file upload control 501. The terminal device displays a text list 502 in response to a touch instruction for the file upload control 501. As shown in fig. 5, at least one text is included in the text list 502. The format of the text may be various formats, such as a docx format, a pdf format, or other formats, for example, a doc format, which is not limited herein.
The terminal equipment can also respond to a selection instruction aiming at the target text in the text list to acquire the target text. In the embodiment shown in the interface a in fig. 5, assuming that the target text is "text 2. docx", after the terminal device acquires the target text, a file upload interface shown in the interface B in fig. 5 may be displayed.
Optionally, in practical application, the number of the target texts has multiple situations, and the target texts may include one text or a larger number of texts as shown in an interface B of fig. 5, so that synchronous processing of multiple texts is realized, and generation efficiency of question and answer pairs is improved. The number of the target texts is selected according to the requirements of the practical application, and is not limited herein. In the interface B, the terminal device can also respond to a touch instruction aiming at the reselection control, display a list similar to the text list 502 and determine a target text from the list so as to realize the replacement of the target text.
In the embodiment of the application, the terminal equipment can select the target text from various types of texts, so that the flexibility of the text processing method provided by the embodiment of the application is improved.
Optionally, the terminal device may further respond to the touch instruction for the "submit" control, and display a file processing interface shown in fig. 6 to process the target text. Referring to fig. 6, fig. 6 is a schematic diagram of a document processing interface according to an embodiment of the present disclosure.
The terminal device can display the progress condition of processing the target text. In the embodiment shown in fig. 6, the terminal device is performing "text extraction" on the target text. "text extraction" may be understood as separating the title and text passage in the target text. "attribute mapping" can be understood to distinguish which data in the target text is a title and which data is a paragraph of text. And generates questions based on the title or abstract. "data cleansing" is the modification and optimization of the generated problem to make it more logical to natural language. The question-answer fusion can be understood as a process of matching questions and answers. After the construction is completed, the terminal device may display a setting interface shown in fig. 7.
Optionally, on the basis of the embodiment corresponding to fig. 2, in an optional embodiment of the text processing method provided in the embodiment of the present application, the text processing method further includes:
displaying a question bar and an answer bar on a setting interface of the question-answering system, wherein the question bar is used for displaying a first question, the answer bar is used for displaying a target text paragraph, and the setting interface further comprises a storage control;
responding to an operation instruction aiming at the question bar, and displaying the modified question;
responding to an operation instruction aiming at the answer bar, and displaying the modified answer;
and responding to the touch instruction aiming at the saving control, and saving the modified question-answer pairs.
After generating the question-answer pairs, the terminal device may display the question-answer pairs on the setting interface shown in fig. 7. The terminal device may also modify the question-answer pair, which is described below with reference to fig. 7, and fig. 7 shows a schematic diagram of a setting interface provided in the embodiment of the present application.
For example, in the embodiment shown in fig. 7, the terminal device displays two question-answer pairs by taking the case that the first question and the second question are different. As shown in fig. 7, the setup interface includes a question bar 701 and an answer bar 702. In the embodiment shown in fig. 7, multiple questions for the same answer may be displayed in the same question bar, and it is understood that in practical applications, only one question may be displayed in one question bar, which is not limited herein.
The user can select the problem in the problem bar and edit the problem to obtain the modified problem. That is, the terminal device may modify the question of the question bar in response to the operation instruction for the question bar, and display the modified question. Similarly, the user may select an answer in the answer bar and edit the answer to obtain a modified answer. That is, the terminal device may modify the answer of the answer bar in response to the operation instruction for the answer bar, and display the modified answer. After modification, the terminal device may respond to the touch instruction directed to the saving control 703 and save the modified question-answer pair.
In the embodiment of the application, after the terminal device generates the question-answer pair, the question-answer pair can be modified, so that the question-answer pair stored in the terminal device is more in line with the application scene, the text processing method provided by the embodiment of the application is further optimized, and meanwhile, the intelligent question-answer system applying the text processing method is in line with the personalized requirements of the user.
Optionally, after the terminal device generates the question-answer pair, the question-answer pair may not be modified. And directly responding to the touch instruction aiming at the storage control, and storing the question-answer pairs on the terminal equipment.
Optionally, after the terminal device generates the question-answer pair, the question-answer pair may not be displayed, and the question-answer pair is directly stored on the terminal device.
It is understood that after the terminal device stores the question-answer pairs, the question-answer pairs can be used as a database of the intelligent question-answer system. When providing intelligent question-answering service, receiving conversation question through conversation mode such as text conversation or voice conversation. And searching a database for a target question matched with the proposed question and a target question-answer pair in which the target question is positioned. I.e. a recall process is performed. And then, according to the confidence coefficient between the target problem and the session problem, corresponding treatment is carried out.
If the confidence between the target question and the session question is greater than or equal to the preset threshold and the number of the target questions is one, the terminal device outputs the corresponding answer of the target question as the answer of the session question to the session. If the number of the target questions is larger than one, and the confidence degree between each target question and the session question is larger than or equal to a preset threshold value, the terminal device may select the answer corresponding to the target question with the highest confidence degree as the answer of the session question and output the answer to the session. If the number of the target problems is more than one and the confidence between each target problem and the session problem is less than the preset threshold, the terminal device may output the target problems to the session in a set manner. Wherein the set of target questions comprises target questions matching the session questions. Then, the terminal device may respond to a selection instruction for a certain target question in the target question set, and output an answer corresponding to the target question as an answer to the conversation question to the conversation. Since the intelligent question-answering system is not the focus of the present application, it will not be described herein.
In order to better implement the above-mentioned aspects of the embodiments of the present application, the following also provides related apparatuses for implementing the above-mentioned aspects. Referring to fig. 8, fig. 8 is a schematic structural diagram of a text processing apparatus according to an embodiment of the present disclosure, the text processing apparatus includes:
an acquisition unit 801 configured to:
the method comprises the steps of obtaining a target text, wherein the target text comprises a first title, a second title and a target text paragraph, the hierarchy of the second title in the target text is higher than that of the first title in the target text, and the first title and the second title are both used for summarizing the content of the target text paragraph;
a processing unit 802 for:
extracting a target key phrase from the first title and the second title;
inputting the target key phrase into a first question generation model, and outputting a first question through the first question generation model, wherein the first question corresponds to the target text paragraph;
and generating a first question-answer pair according to the first question and the target text paragraph.
Optionally, on the basis of the embodiment corresponding to fig. 8, in another embodiment of the text processing apparatus 800 provided in the embodiment of the present application, the processing unit 802 is further configured to extract a summary from the target text passage;
inputting the abstract into a second question generation model, and outputting a second question through the second question generation model, wherein the second question corresponds to the target text paragraph;
and generating a second question-answer pair according to the second question and the target text paragraph.
Optionally, on the basis of the embodiment corresponding to fig. 8, in another embodiment of the text processing apparatus 800 provided in the embodiment of the present application, the processing unit 802 is specifically configured to:
performing word segmentation processing and part-of-speech tagging on the first title and the second title through a first keyword algorithm to obtain M words, wherein M is a positive integer;
determining a first candidate key phrase from M words, wherein the first candidate key phrase comprises N words, the parts of speech of the N words are target parts of speech, and N is a positive integer less than or equal to M;
marking the sentence components of the first title and the second title through a second keyword algorithm to obtain a marking result;
determining a second candidate key phrase according to the labeling result;
and determining the intersection of the first candidate key phrase and the second candidate key phrase as a target key phrase.
Optionally, on the basis of the embodiment corresponding to fig. 8, in another embodiment of the text processing apparatus 800 provided in the embodiment of the present application, the text processing apparatus 800 includes:
the obtaining unit 801 is further configured to:
obtaining a sample question set, wherein the sample question set comprises at least one sample question;
according to the sample question set, acquiring grammatical features of at least one sample question;
acquiring a keyword set of a sample text, wherein the keyword set is contained in a title of the sample text, and the keywords in the keyword set are sequentially arranged according to the hierarchical sequence of the title in the sample text;
the processing unit 802 is further configured to train a first question generation model according to the grammatical feature and the keyword set.
Optionally, on the basis of the embodiment corresponding to fig. 8, in another embodiment of the text processing apparatus 800 provided in this embodiment of the present application, the first question generation model includes a text processing model, and the processing unit 802 is specifically configured to:
inputting the grammatical feature and the keyword set into a text processing model, and determining the value of a loss function of the training text processing model;
and if the value of the loss function of the training text processing model is less than or equal to a preset threshold value, determining that the training of the first problem generation model is finished.
Optionally, on the basis of the embodiment corresponding to fig. 8, in another embodiment of the text processing apparatus 800 provided in the embodiment of the present application, the text processing apparatus 800 further includes a display unit 803, configured to:
displaying a file uploading interface of the question-answering system, wherein the file uploading interface comprises a file uploading control;
responding to a touch instruction aiming at the file uploading control, and displaying a text list, wherein the text list comprises at least one text;
the obtaining unit 801 is specifically configured to obtain a target text in response to a selection instruction for the target text in the text list.
Optionally, on the basis of the embodiment corresponding to fig. 8, in another embodiment of the text processing apparatus 800 provided in the embodiment of the present application, the text processing apparatus 800 includes:
a display unit 803, further configured to:
displaying a question bar and an answer bar on a setting interface of the question-answering system, wherein the question bar is used for displaying a first question, the answer bar is used for displaying a target text paragraph, and the setting interface further comprises a storage control;
responding to an operation instruction aiming at the question bar, and displaying the modified question;
responding to an operation instruction aiming at the answer bar, and displaying the modified answer;
the processing unit 802 is further configured to save the modified question-answer pair in response to the touch instruction for the saving control.
In the embodiment of the present application, a computer device is also provided, and the computer device is explained below. Referring to fig. 9, fig. 9 is a schematic structural diagram of a computer device 900 according to an embodiment of the present disclosure, which may include one or more Central Processing Units (CPUs) 910 (e.g., one or more processors) and a memory 920, and one or more storage media 930 (e.g., one or more mass storage devices) for storing applications 931 or data 932. Memory 920 and storage media 930 may be, among other things, transient storage or persistent storage. The program stored on storage medium 930 may include one or more modules (not shown), each of which may include a sequence of instructions operating on computer device 900. Still further, the central processor 910 may be arranged to communicate with the storage medium 930 to execute a series of instruction operations in the storage medium 930 on the computer device 900.
The computer apparatus 900 may also include one or more power supplies 940, one or more wired or wireless network interfaces 950, one or more input-output interfaces 960, and/or one or more operating systems 933, such as a Windows ServerTM,Mac OS XTM,UnixTM,LinuxTM,FreeBSDTMAnd so on.
The steps performed by the terminal device in the above-described embodiment may be based on the computer device configuration shown in fig. 9.
Fig. 10 is a schematic view of another structure of the computer device provided in the embodiment of the present application, and fig. 10 shows a structure of the computer device provided in the embodiment of the present application based on the structure shown in fig. 10. As shown in fig. 10, for convenience of explanation, only the parts related to the embodiments of the present application are shown, and details of the technology are not disclosed, please refer to the method part of the embodiments of the present application. The computer device may be any terminal device including a Personal Computer (PC), a tablet PC, a Personal Digital Assistant (PDA), and the like, taking the computer device as the PC as an example:
fig. 10 is a block diagram illustrating a partial structure of a PC related to the computer device provided in the embodiment of the present application. Referring to fig. 10, the PC includes: radio Frequency (RF) circuitry 1010, memory 1020, input unit 1030, display unit 1040, sensor 1050, audio circuitry 1060, WiFi module 1070, processor 1080, and power supply 1090. Those skilled in the art will appreciate that the PC architecture shown in fig. 10 is not intended to be limiting, and that in actual practice a PC may include more or fewer components than shown, or some components may be combined, or a different arrangement of components.
The respective constituent components of the PC will be described specifically with reference to fig. 10:
the RF circuit 1010 may be used for transceiving information or for receiving and transmitting signals during a call. In general, RF circuit 1010 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like. In addition, the RF circuitry 1010 may also communicate with networks and other devices via wireless communications. The wireless communication may use any communication standard or protocol, including but not limited to global system for mobile communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Message Service (SMS), etc.
The memory 1020 may be used to store software programs and modules, and the processor 1080 executes various functional applications of the PC and data processing by operating the software programs and modules stored in the memory 1020. The memory 1020 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the PC, and the like. Further, the memory 1020 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The input unit 1030 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the PC. For example, in the embodiment of the present application, the input unit 1030 may receive an input target text. Specifically, the input unit 1030 may include a touch panel 1031 and other input devices 1032. The touch panel 1031, also referred to as a touch screen, may collect touch operations by a user (e.g., operations by a user on or near the touch panel 1031 using any suitable object or accessory such as a finger, a stylus, etc.) and drive corresponding connection devices according to a preset program. Alternatively, the touch panel 1031 may include two parts, a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 1080, and can receive and execute commands sent by the processor 1080. In addition, the touch panel 1031 may be implemented by various types such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. The input unit 1030 may include other input devices 1032 in addition to the touch panel 1031. In particular, other input devices 1032 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a track ball, a mouse, a joystick, or the like.
The display unit 1040 may be used to display information input by a user or information provided to the user and various menus of the PC. The display unit 1040 may include a display panel 1041, and optionally, the display panel 1041 may be configured in the form of a Liquid Crystal Display (LCD), an organic light-emitting diode (OLED), or the like. Further, the touch panel 1031 can cover the display panel 1041, and when the touch panel 1031 detects a touch operation on or near the touch panel 1031, the touch operation is transmitted to the processor 1080 to determine the type of the touch event, and then the processor 1080 provides a corresponding visual output on the display panel 1041 according to the type of the touch event. Although in fig. 10, the touch panel 1031 and the display panel 1041 are two separate components to implement the input and output functions of the PC, in some embodiments, the touch panel 1031 and the display panel 1041 may be integrated to implement the input and output functions of the PC.
The PC may also include at least one sensor 1050, such as a light sensor, motion sensor, and other sensors. As for other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which can be configured by the PC, the description thereof is omitted.
Audio circuitry 1060, speaker 1061, microphone 1062 may provide an audio interface between the user and the PC. The audio circuit 1060 can transmit the electrical signal converted from the received audio data to the speaker 1061, and the electrical signal is converted into a sound signal by the speaker 1061 and output; on the other hand, the microphone 1062 converts the collected sound signal into an electrical signal, which is received by the audio circuit 1060 and converted into audio data, which is then processed by the audio data output processor 1080 and then sent to, for example, another PC via the RF circuit 1010, or output to the memory 1020 for further processing. Illustratively, in a PC to which the text processing method provided by the present invention is applied, voice interaction can be performed through the audio circuit 1060, so as to implement intelligent voice question answering.
WiFi belongs to short-range wireless transmission technology, and the PC can help the user send and receive e-mails, browse web pages, access streaming media, etc. through the WiFi module 1070, which provides the user with wireless broadband internet access. Although fig. 10 shows the WiFi module 1070, it is understood that it does not belong to the essential constitution of the PC, and may be omitted entirely as needed within the scope not changing the essence of the invention.
Processor 1080 is the control hub of the PC and interfaces various interfaces and lines to various portions of the overall PC to perform various functions and process data of the PC by running or executing software programs and/or modules stored in memory 1020 and invoking data stored in memory 1020 to thereby monitor the PC as a whole. Optionally, processor 1080 may include one or more processing units; optionally, processor 1080 may integrate an application processor, which primarily handles operating systems, user interfaces, application programs, etc., and a modem processor, which primarily handles wireless communications. It is to be appreciated that the modem processor described above may not be integrated into processor 1080.
The PC also includes a power supply 1090 (e.g., a battery) for powering the various components, which may optionally be logically coupled to the processor 1080 via a power management system to manage charging, discharging, and power consumption via the power management system.
Although not shown, the PC may further include a camera, a bluetooth module, etc., which will not be described herein.
In the embodiment of the present application, the processor 1080 included in the terminal device further has the following functions:
the method comprises the steps of obtaining a target text, wherein the target text comprises a first title, a second title and a target text paragraph, the hierarchy of the second title in the target text is higher than that of the first title in the target text, and the first title and the second title are both used for summarizing the content of the target text paragraph;
extracting a target key phrase from the first title and the second title;
inputting the target key phrase into a first question generation model, and outputting a first question through the first question generation model, wherein the first question corresponds to the target text paragraph;
and generating a first question-answer pair according to the first question and the target text paragraph.
The steps performed by the terminal device in the above-described embodiment may be based on the computer device configuration shown in fig. 10.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of a unit is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a management apparatus for interactive video, or a network device) to execute all or part of the steps of the method of the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (10)

1. A method of text processing, comprising:
acquiring a target text, wherein the target text comprises a first title, a second title and a target text paragraph, the hierarchy of the second title in the target text is higher than that of the first title in the target text, and the first title and the second title are both used for summarizing the content of the target text paragraph;
extracting a target key phrase from the first title and the second title;
inputting the target keyword group into a first question generation model, and outputting a first question through the first question generation model, wherein the first question corresponds to the target text paragraph;
and generating a first question-answer pair according to the first question and the target text paragraph.
2. The method of claim 1, further comprising:
extracting a summary from the target text passage;
inputting the abstract into a second question generation model, and outputting a second question through the second question generation model, wherein the second question corresponds to the target text paragraph;
and generating a second question-answer pair according to the second question and the target text paragraph.
3. The method according to claim 1 or 2, wherein the extracting the target keyword group from the first title and the second title comprises:
performing word segmentation processing and part-of-speech tagging on the first title and the second title through a first keyword algorithm to obtain M words, wherein M is a positive integer;
determining a first candidate keyword group from the M words, wherein the first candidate keyword group comprises N words, the parts of speech of the N words are target parts of speech, and N is a positive integer less than or equal to M;
labeling sentence components of the first title and the second title through a second keyword algorithm to obtain labeling results;
determining a second candidate key phrase according to the labeling result;
determining the intersection of the first candidate key phrase and the second candidate key phrase as the target key phrase.
4. The method according to claim 1 or 2, wherein before said inputting the target keyword set into the first question generation model, the method further comprises:
obtaining a sample question set, wherein the sample question set comprises at least one sample question;
according to the sample question set, acquiring grammatical features of the at least one sample question;
acquiring a keyword set of a sample text, wherein the keyword set is contained in a title of the sample text, and the keywords in the keyword set are sequentially arranged according to the hierarchical order of the title in the sample text;
and training a first question generation model according to the grammatical features and the keyword set.
5. The method of claim 4, wherein the first question generation model comprises a text processing model; the training of the first question generation model according to the grammatical features and the keyword set comprises the following steps:
inputting the grammatical feature and the keyword set into the text processing model, and determining the value of a loss function for training the text processing model;
and if the value of the loss function for training the text processing model is smaller than or equal to a preset threshold value, determining that the training of the first problem generation model is completed.
6. The method according to claim 1 or 2, characterized in that the method further comprises:
displaying a file uploading interface of a question-answering system, wherein the file uploading interface comprises a file uploading control;
displaying a text list in response to a touch instruction for the file uploading control, wherein the text list comprises at least one text;
the acquiring of the target text comprises:
and responding to a selection instruction aiming at the target text in the text list, and acquiring the target text.
7. The method of claim 6, wherein after the generating the first question-answer pair, the method further comprises:
displaying a question bar and an answer bar on a setting interface of the question-answering system, wherein the question bar is used for displaying the first question, the answer bar is used for displaying the target text paragraph, and the setting interface further comprises a saving control;
responding to an operation instruction aiming at the question bar, and displaying the modified question;
responding to an operation instruction aiming at the answer bar, and displaying the modified answer;
and responding to the touch instruction aiming at the saving control, and saving the modified question-answer pairs.
8. A text processing apparatus, comprising:
the device comprises an acquisition unit, a processing unit and a display unit, wherein the acquisition unit is used for acquiring a target text, the target text comprises a first title, a second title and a target text paragraph, the hierarchy of the second title in the target text is higher than that of the first title, and the first title and the second title are both used for summarizing the content of the target text paragraph;
the processing unit is used for extracting a target key phrase from the first title and the second title;
the processing unit is further configured to input the target keyword group to a first question generation model, and output a first question through the first question generation model, where the first question corresponds to the target text paragraph;
the processing unit is further configured to generate a first question-answer pair according to the first question and the target text paragraph.
9. A computer device, wherein the computer device comprises a processor and a memory:
the memory is used for storing program codes;
the processor is configured to perform the method of any one of claims 1 to 7 according to instructions in the program code.
10. A computer readable storage medium having stored therein instructions which, when run on a computer, cause the computer to perform the method of any of the preceding claims 1 to 7.
CN202110990618.7A 2021-08-26 2021-08-26 Text processing method, related device and equipment Pending CN114328852A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110990618.7A CN114328852A (en) 2021-08-26 2021-08-26 Text processing method, related device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110990618.7A CN114328852A (en) 2021-08-26 2021-08-26 Text processing method, related device and equipment

Publications (1)

Publication Number Publication Date
CN114328852A true CN114328852A (en) 2022-04-12

Family

ID=81045530

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110990618.7A Pending CN114328852A (en) 2021-08-26 2021-08-26 Text processing method, related device and equipment

Country Status (1)

Country Link
CN (1) CN114328852A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114741315A (en) * 2022-04-28 2022-07-12 深圳市紫光同创电子有限公司 Use case updating method and device, electronic equipment and storage medium
CN115269807A (en) * 2022-08-17 2022-11-01 北京中科深智科技有限公司 Question-answer pair joint generation model based on question type recognition
CN117540003A (en) * 2024-01-09 2024-02-09 腾讯科技(深圳)有限公司 Text processing method and related device
WO2024041009A1 (en) * 2022-08-25 2024-02-29 华为云计算技术有限公司 Method and device for generating question and answer pairs, and computer cluster and storage medium
CN117540003B (en) * 2024-01-09 2024-04-26 腾讯科技(深圳)有限公司 Text processing method and related device

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114741315A (en) * 2022-04-28 2022-07-12 深圳市紫光同创电子有限公司 Use case updating method and device, electronic equipment and storage medium
CN115269807A (en) * 2022-08-17 2022-11-01 北京中科深智科技有限公司 Question-answer pair joint generation model based on question type recognition
CN115269807B (en) * 2022-08-17 2023-06-30 北京中科深智科技有限公司 Question-answer pair combination generation model based on question type recognition
WO2024041009A1 (en) * 2022-08-25 2024-02-29 华为云计算技术有限公司 Method and device for generating question and answer pairs, and computer cluster and storage medium
CN117540003A (en) * 2024-01-09 2024-02-09 腾讯科技(深圳)有限公司 Text processing method and related device
CN117540003B (en) * 2024-01-09 2024-04-26 腾讯科技(深圳)有限公司 Text processing method and related device

Similar Documents

Publication Publication Date Title
CN110381388B (en) Subtitle generating method and device based on artificial intelligence
US11580350B2 (en) Systems and methods for an emotionally intelligent chat bot
WO2022078102A1 (en) Entity identification method and apparatus, device and storage medium
CN110598046B (en) Artificial intelligence-based identification method and related device for title party
CN114328852A (en) Text processing method, related device and equipment
CN108763552B (en) Family education machine and learning method based on same
CN110795528A (en) Data query method and device, electronic equipment and storage medium
CN110795538B (en) Text scoring method and related equipment based on artificial intelligence
CN110717026B (en) Text information identification method, man-machine conversation method and related devices
CN112214605A (en) Text classification method and related device
CN110852109A (en) Corpus generating method, corpus generating device, and storage medium
CN112232066A (en) Teaching outline generation method and device, storage medium and electronic equipment
CN111597804A (en) Entity recognition model training method and related device
CN111314771B (en) Video playing method and related equipment
CN114357278B (en) Topic recommendation method, device and equipment
CN113822038A (en) Abstract generation method and related device
CN112749252A (en) Text matching method based on artificial intelligence and related device
CN111553163A (en) Text relevance determining method and device, storage medium and electronic equipment
CN112036135B (en) Text processing method and related device
CN112307198B (en) Method and related device for determining abstract of single text
CN113821609A (en) Answer text acquisition method and device, computer equipment and storage medium
CN112328783A (en) Abstract determining method and related device
CN110781274A (en) Question-answer pair generation method and device
CN115599903A (en) Object tag obtaining method and device, electronic equipment and storage medium
CN113703883A (en) Interaction method and related 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