CN115391514A - Question and answer sentence generation method and device, electronic equipment and storage medium - Google Patents

Question and answer sentence generation method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115391514A
CN115391514A CN202211084555.XA CN202211084555A CN115391514A CN 115391514 A CN115391514 A CN 115391514A CN 202211084555 A CN202211084555 A CN 202211084555A CN 115391514 A CN115391514 A CN 115391514A
Authority
CN
China
Prior art keywords
text
target
segment
question
sentence
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
CN202211084555.XA
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.)
Jingdong Technology Information Technology Co Ltd
Original Assignee
Jingdong Technology Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Jingdong Technology Information Technology Co Ltd filed Critical Jingdong Technology Information Technology Co Ltd
Priority to CN202211084555.XA priority Critical patent/CN115391514A/en
Publication of CN115391514A publication Critical patent/CN115391514A/en
Pending legal-status Critical Current

Links

Images

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
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/06Asset management; Financial planning or analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Artificial Intelligence (AREA)
  • Finance (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Development Economics (AREA)
  • General Engineering & Computer Science (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Economics (AREA)
  • Data Mining & Analysis (AREA)
  • Human Computer Interaction (AREA)
  • Game Theory and Decision Science (AREA)
  • Human Resources & Organizations (AREA)
  • Operations Research (AREA)
  • Databases & Information Systems (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • General Business, Economics & Management (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • General Health & Medical Sciences (AREA)
  • Machine Translation (AREA)

Abstract

The disclosure provides a question and answer sentence generating method and device, electronic equipment and a storage medium. The method comprises the following steps: acquiring a text to be processed, wherein the text to be processed comprises: the method comprises the steps of obtaining a plurality of candidate text segments, determining a target text segment from the candidate text segments, wherein the target text segment corresponds to a target topic, and generating a question-answer sentence corresponding to the target topic according to the target text segment, so that the question-answer sentence corresponding to the target topic is generated according to a text to be processed, the generation effect of the question-answer sentence can be effectively improved, and the generated question-answer sentence can effectively meet business requirements in an actual conversation scene.

Description

Question and answer sentence generating method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of natural language processing technologies, and in particular, to a question and answer sentence generation method and apparatus, an electronic device, and a storage medium.
Background
In the field of natural language processing, an application scenario may be generated, for example, for question and answer sentences. And generating question-answer sentences, specifically refining a plurality of sentences in a text to obtain corresponding question-answer sentences, for example.
In the related art, when a question and answer sentence is generated for a text to be processed, the generation effect of the question and answer sentence is not good.
Disclosure of Invention
The present disclosure is directed to solving, at least to some extent, one of the technical problems in the related art.
Therefore, an object of the present disclosure is to provide a question and answer sentence generation method and apparatus, an electronic device, and a storage medium, so as to generate a question and answer sentence of a corresponding target topic according to a to-be-processed text, thereby effectively improving a generation effect of the question and answer sentence, and enabling the generated question and answer sentence to effectively meet a service requirement in an actual dialog scene.
The question-answer sentence generating method provided by the embodiment of the first aspect of the disclosure comprises the following steps: acquiring a text to be processed, wherein the text to be processed comprises: a plurality of candidate text segments; determining a target text segment from the candidate text segments, wherein the target text segment corresponds to a target subject; and generating a question-answer sentence corresponding to the target subject according to the target text segment.
In the question and answer sentence generating method provided in the embodiment of the first aspect of the disclosure, a to-be-processed text is obtained, where the to-be-processed text includes: the method comprises the steps of obtaining a plurality of candidate text segments, determining a target text segment from the candidate text segments, wherein the target text segment corresponds to a target topic, and generating a question-answer sentence corresponding to the target topic according to the target text segment, so that the question-answer sentence corresponding to the target topic is generated according to a text to be processed, the generation effect of the question-answer sentence can be effectively improved, and the generated question-answer sentence can effectively meet business requirements in an actual conversation scene.
A question-answer sentence generating device provided in an embodiment of a second aspect of the present disclosure includes: the acquisition module is used for acquiring a text to be processed, wherein the text to be processed comprises: a plurality of candidate text segments; the determining module is used for determining a target text segment from a plurality of candidate text segments, wherein the target text segment corresponds to a target subject; and the generating module is used for generating question-answering sentences corresponding to the target subjects according to the target text segments.
The question-answer sentence generating device provided by the embodiment of the second aspect of the present disclosure obtains a text to be processed, where the text to be processed includes: the method comprises the steps of obtaining a plurality of candidate text segments, determining a target text segment from the candidate text segments, wherein the target text segment corresponds to a target topic, and generating a question-answer sentence corresponding to the target topic according to the target text segment, so that the question-answer sentence corresponding to the target topic is generated according to a text to be processed, the generation effect of the question-answer sentence can be effectively improved, and the generated question-answer sentence can effectively meet business requirements in an actual conversation scene.
An embodiment of a third aspect of the present disclosure provides an electronic device, which includes a memory, a processor, and a computer program that is stored in the memory and is executable on the processor, and when the processor executes the program, the method for generating a question and answer sentence as set forth in the embodiment of the first aspect of the present disclosure is implemented.
A fourth aspect of the present disclosure provides a non-transitory computer-readable storage medium, on which a computer program is stored, where the program, when executed by a processor, implements the question and answer sentence generating method as set forth in the first aspect of the present disclosure.
An embodiment of a fifth aspect of the present disclosure provides a computer program product, which, when executed by an instruction processor in the computer program product, executes the question and answer sentence generating method as set forth in the embodiment of the first aspect of the present disclosure.
Additional aspects and advantages of the disclosure will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the disclosure.
Drawings
The above and/or additional aspects and advantages of the present disclosure will become apparent and readily appreciated from the following description of the embodiments, taken in conjunction with the accompanying drawings of which:
fig. 1 is a schematic flow chart of a question-answer sentence generating method according to an embodiment of the present disclosure;
fig. 2 is a schematic flow chart of a question-answer sentence generating method according to another embodiment of the present disclosure;
FIG. 3 is a flowchart illustrating a question and answer sentence generating method according to another embodiment of the disclosure;
fig. 4 is a schematic structural diagram of a question-answer sentence generating apparatus according to an embodiment of the present disclosure;
fig. 5 is a schematic structural diagram of a question-answer sentence generating apparatus according to another embodiment of the present disclosure;
FIG. 6 illustrates a block diagram of an exemplary electronic device suitable for use in implementing embodiments of the present disclosure.
Detailed Description
Reference will now be made in detail to the embodiments of the present disclosure, examples of which are illustrated in the accompanying drawings, wherein like reference numerals refer to the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the drawings are exemplary only for the purpose of illustrating the present disclosure and should not be construed as limiting the same. Rather, the embodiments of the disclosure include all changes, modifications and equivalents coming within the spirit and terms of the claims appended thereto.
It should be noted that, in the technical solution of the present disclosure, the processes of information acquisition, collection, storage, use, processing, etc. all conform to the regulations of related laws and regulations, and do not violate the customs of the public order.
Fig. 1 is a schematic flow chart of a question-answer sentence generating method according to an embodiment of the present disclosure.
It should be noted that the main execution body of the question and answer sentence generating method of this embodiment is a question and answer sentence generating device, which may be implemented in a software and/or hardware manner, and the device may be configured in an electronic device, and the electronic device may include, but is not limited to, a terminal, a server, and the like.
As shown in fig. 1, the question-answer sentence generating method includes:
s101: acquiring a text to be processed, wherein the text to be processed comprises: a plurality of candidate text segments.
In the execution process of the question and answer sentence generating method, the text to be processed currently may be referred to as a text to be processed, the text to be processed may be used to extract a corresponding question and answer sentence therefrom, and the text to be processed may be, for example, a financial text, a novel text, or the like, which is not limited to this.
In the embodiment of the present disclosure, the text to be processed may be composed of a plurality of text paragraphs, and the text paragraphs may be referred to as candidate text paragraphs.
In some embodiments, the text to be processed may be obtained by providing a corresponding data transmission interface for the question and answer sentence generating device in advance, and obtaining the text as the text to be processed through the data transmission interface, or obtaining the text to be processed, or obtaining any whole text, and then selecting a part of the text from the obtained whole text as the text to be processed, which is not limited.
Optionally, in some embodiments, the obtaining of the text to be processed may be obtaining an initial text, where the initial text includes: and determining a text segment to be processed from the plurality of initial text segments, wherein the text segment to be processed is the initial text segment carrying the target information, and deleting the text segment to be processed in the initial text to obtain the text to be processed.
In the initial stage of the execution of the question-answer sentence generating method, the obtained unprocessed text may be referred to as an initial text, and a text segment included in the initial text may be referred to as an initial text segment.
By way of example, the initial text may be, for example, the following text:
1. at present, white spirit plates step back down on the average line group, the tail tray has capital to enter the field for operation, the trend of slow pulling and rising occurs, but the 60-day average line is broken at present, the rising and falling conditions of the white spirit plates need to be noticed in recent days, and if the white spirit plates can stand above the 60-day average line again, batch entering and warehousing can be considered, and the white spirit plates are gradually added to a heavy warehouse; if the direction is selected to be downward, the left-side binning can be considered when the red line below is broken.
2. In the morning, the new energy vehicle vibrates and falls down, the supporting force of the 60-day average line is explored, the capital entering operation is carried out in the afternoon, the new energy vehicle is pushed back, the new energy vehicle is still located on the 60-day average line, the capital viewed in the market is expected to gradually enter the field and be added in a warehouse, however, due to the fact that the rising amplitude of the new energy vehicle in the last month is too fast, the possibility of stepping down and back is not eliminated in a short period, and therefore if the new energy vehicle wants to enter the field and be added in a warehouse, the risk of short-term fluctuation is resisted in a fixed-throw mode as much as possible.
3. The trend of the photovoltaic and the new energy vehicle is similar, 60-day average line is stepped back downwards in the tray for tentative support, then capital is added to the warehouse when the photovoltaic enters the field, the logic of the photovoltaic is started at present, even if a short line is adjusted downwards, the 20-day average line cannot be broken by a large probability, so if the photovoltaic can be kept on the 60-day average line in the week, the photovoltaic can be added to the warehouse when the short line is started, and if the 20-day average line is stepped back in the later period, extra manual warehouse addition is carried out.
4. Today's semiconductor plate mends and rises to be greater than new forms of energy car and photovoltaic, but present figure is awkward, and the top 60 days is the mean line has stronger pressure, has not accomplished the breakthrough now yet, so the risk is greater than the chance, and the little partner who wants to enter the field operation considers entering the field and adds the storehouse after stepping back 20 days mean lines at best.
5. The account number issues an operation sticker, an evaluation sticker, a quotation video and quotation live broadcast, and is guaranteed to be daily for no special reason.
6. Small buddies with related needs welcome click attention.
7. And (4) risk prompting: the above points are only personal opinions, do not form buying and selling suggestions, have risks in the market and need to be careful in investment.
The 1-7 text paragraphs included in the initial text may be referred to as initial text paragraphs.
The target information is redundant text information, which may be text information unrelated to the generation of question and answer sentences, such as a series of text information unrelated to articles, such as recommendation of an author account, attention seeking, lottery drawing, thank you readers, and the like, and is not limited thereto.
The initial text segment containing the target information in the initial text may be referred to as a to-be-processed text segment, and the to-be-processed text segment may be, for example, 5, 6, and 7 segments in the initial text of the above example, which is not limited to this.
That is to say, in the embodiment of the present disclosure, the initial text segment including the redundant text information may be determined from a plurality of initial text segments of the initial text, for example, whether the initial text segment includes keyword information corresponding to the redundant text information (for example, praise, comment, and the like, which is not limited to this) may be determined, and when the initial text segment includes keyword information corresponding to the redundant text information, the initial text segment is taken as a text segment to be processed, and then, the text segment to be processed in the initial text may be deleted, so as to obtain a text to be processed for generating the question and answer sentence.
For example, in the embodiment of the present disclosure, the 5 th to 7 th paragraphs may be determined as the text segments to be processed from the initial text of the above example, and the text segments to be processed in the initial text may be deleted, so that the 1 st to 4 th paragraphs are taken as the text segments to be processed, thereby, in the execution process of the subsequent question and answer sentence generating method, redundant text information in the initial text may be effectively removed, so that the question and answer sentence generating effect is ensured, the data processing amount is reduced, and the question and answer sentence generating efficiency is effectively improved.
S102: and determining a target text segment from the candidate text segments, wherein the target text segment corresponds to the target subject.
Each candidate text segment in the initial text may have a different content theme, which may be, for example, a weather prediction theme, a stock analysis theme, or the like, without limitation.
It is understood that, in the text to be processed, one candidate text segment may correspond to one content subject, or one content subject may be described by multiple candidate text segments.
Therefore, in the execution process of the method for generating the question-answer sentences, the multiple candidate text segments can be subject-divided in advance, so that the generated question-answer sentences can have corresponding content subjects, and the generation effect of the question-answer sentences is effectively improved.
The candidate text segment corresponding to the corresponding topic obtained by performing topic division on the candidate text segment may be referred to as a target text segment, and a topic corresponding to the target text segment may be referred to as a target topic, which is not limited to this.
In some embodiments, the target text segment is determined from the multiple candidate text segments, the multiple candidate text segments may be subjected to semantic parsing, for example, the multiple candidate text segments may be input into a semantic parsing model respectively to obtain a semantic parsing result output by the semantic parsing model, and the candidate text segments having the same semantic meaning are determined from the multiple candidate text segments as the target text segment according to the semantic parsing result, which is not limited herein.
In other embodiments, the target text segment may be determined from a plurality of candidate text segments, corresponding entity information may be respectively extracted from the plurality of candidate text segments, a candidate text segment having the same entity information is determined from the plurality of candidate text segments as the target text segment, and then, a subsequent question and answer sentence generating method may be triggered and executed based on the target text segment, which may be specifically referred to in the subsequent embodiments.
S103: and generating a question-answer sentence corresponding to the target subject according to the target text segment.
Taking the target text segment as the first candidate text segment in the initial text segment in the above example as an example, the question-answering sentence may be, for example: "{ is it proposed recently for liquor fund blocks to add bins? { white spirit foundation golden boards can be added into bins in batches and added into heavy bins step by step if the white spirit foundation golden boards can be newly stood above the 60-day average line; if the direction is selected to be downward, when the red line below is broken, the left bin adding can be considered, and the method is not limited.
In some embodiments, the question-answer sentence corresponding to the target topic is generated according to the target text segment, a corresponding question-answer sentence template may be obtained in advance for a corresponding service field, the key information in the corresponding target text segment is extracted according to the question-answer sentence template to serve as an answer sentence, and the obtained question-answer sentence and the obtained answer sentence are collectively used as the question-answer sentence, or any other possible manner may be adopted to generate the question-answer sentence corresponding to the target topic according to the target text segment, for example, a model prediction manner and a feature analysis manner, which is not limited herein.
In the embodiment of the present disclosure, by obtaining a to-be-processed text, the to-be-processed text includes: the method comprises the steps of obtaining a plurality of candidate text segments, determining a target text segment from the candidate text segments, wherein the target text segment corresponds to a target topic, and generating a question-answer sentence corresponding to the target topic according to the target text segment, so that the question-answer sentence corresponding to the target topic is generated according to a text to be processed, the generation effect of the question-answer sentence can be effectively improved, and the generated question-answer sentence can effectively meet business requirements in an actual conversation scene.
Fig. 2 is a schematic flow chart of a question-answer sentence generating method according to another embodiment of the present disclosure.
As shown in fig. 2, the question-answer sentence generating method includes:
s201: acquiring a text to be processed, wherein the text to be processed comprises: a plurality of candidate text segments.
For the description of S201, reference may be made to the foregoing embodiments, which are not described herein again.
S202: determining a degree of match value between adjacent candidate text segments, wherein the degree of match value describes a semantic degree of match between adjacent candidate text segments.
The adjacent candidate text segments may be, for example, the first segment and the second segment in the initial text, or the second segment and the third segment, which is not limited in this regard.
The value used for quantitatively describing the semantic matching degree between adjacent candidate text segments may be referred to as a matching degree value, and the matching degree value may be, for example, a euclidean distance between adjacent candidate text segments or a vector cosine between adjacent candidate text segments, which is not limited to this.
In some embodiments, the determining the matching degree value between adjacent candidate text segments may be determining a euclidean distance between adjacent candidate text segments, or determining a matching degree value between adjacent candidate text segments, or determining a vector cosine between adjacent candidate text segments, and using the determined euclidean distance between adjacent candidate text segments, or the vector cosine as the matching degree value, which is not limited in this respect.
Optionally, in some embodiments, determining the matching degree value between adjacent candidate text segments may be inputting the adjacent candidate text segments into the matching degree prediction model, and obtaining an output value of the matching degree prediction model as the matching degree value, and since the matching degree value between the adjacent candidate text segments is determined by combining the matching degree prediction model, the influence of other subjective factors on the determination of the matching degree value can be avoided, and the accuracy of the matching degree value is effectively improved.
The matching degree prediction model may be, for example, a siembert model, which implies a Dirichlet Allocation (LDA) model, and is not limited thereto.
For example, in the embodiment of the present disclosure, the first segment and the second segment in the initial text, or the second segment and the third segment may be respectively input into the matching degree prediction model, the matching degree prediction model performs matching degree prediction on adjacent candidate text segments (the first segment and the second segment, or the second segment and the third segment), and outputs a corresponding matching degree value, which is not limited thereto.
S203: and determining the target text segment according to the matching degree value and the adjacent candidate text segment.
According to the method and the device for determining the target text segment, after the matching degree value between the adjacent candidate text segments is determined, the target text segment can be determined according to the matching degree value and the adjacent candidate text segments, and the target text segment is determined according to the matching degree value and the adjacent candidate text segments, so that the adjacent candidate text segment with a high matching degree value can be determined from a plurality of candidate text segments to serve as the target text segment, and the determination effect of the target text segment can be effectively improved.
In some embodiments, the target text segment is determined according to the matching degree value and the adjacent candidate text segments, where it may be determined that the adjacent candidate text segment corresponding to the maximum matching degree value is used as the target candidate text segment, or it may be determined that the semantic matching degree between the adjacent candidate text segments is not up to the standard according to the matching degree value, and the adjacent candidate text segments are respectively used as the target text segments, which is not limited to this.
Optionally, in some embodiments, the target text segment is determined according to the matching degree value and the adjacent candidate text segment, and the target text segment may be determined according to the adjacent candidate text segment when the matching degree value is greater than or equal to the matching degree threshold, so that the target text segment is determined according to a clear and recyclable standard of the matching degree threshold, and thus, the determination effect of the target text segment may be effectively improved.
That is to say, in the embodiment of the present disclosure, the matching degree value between adjacent candidate text segments may be compared with a predetermined matching degree threshold, and if the matching degree value is greater than or equal to the matching degree threshold, the target text segment may be determined according to the adjacent candidate text segments.
For example, after determining the first segment and the second segment in the initial text, or after determining the matching degree values respectively corresponding to the second segment and the third segment, comparing the matching degree values with a predetermined matching degree threshold, and determining the target text segment according to the first segment and the second segment when it is determined that the matching degree value between the first segment and the second segment is greater than or equal to the matching degree threshold and the matching degree value between the second segment and the third segment is less than the matching degree threshold, which is not limited.
Optionally, in some embodiments, the target text segment is determined according to the adjacent candidate text segments, and the adjacent candidate text segments may be spliced and the spliced text segment is used as the target text segment, so that the adjacent candidate text segment can be used as a complete target text segment, and therefore, it can be effectively ensured that the target text segment can be used as a whole text to participate in a subsequent question and answer sentence generation task in an execution process of a subsequent question and answer sentence generation method, and a generation effect of the question and answer sentence is effectively guaranteed.
For example, after determining the matching degree values corresponding to the first segment and the second segment in the initial text, or the second segment and the third segment, respectively, the matching degree values are compared with a predetermined matching degree threshold, and when it is determined that the matching degree value between the first segment and the second segment is greater than or equal to the matching degree threshold and the matching degree value between the second segment and the third segment is less than the matching degree threshold, the first segment and the second segment in the initial text are spliced, and the text segment obtained by splicing is used as the target text segment, which is not limited.
S204: and generating a question-answer sentence corresponding to the target subject according to the target text segment.
For the description of S204, reference may be made to the foregoing embodiments specifically, and details are not repeated here.
In the embodiment of the present disclosure, by obtaining a to-be-processed text, the to-be-processed text includes: the method comprises the steps of obtaining a plurality of candidate text segments, determining matching degree values between adjacent candidate text segments, wherein the matching degree values describe semantic matching degrees between the adjacent candidate text segments, determining a target text segment according to the matching degree values and the adjacent candidate text segments, and determining the target text segment according to the matching degree values and the adjacent candidate text segments.
Fig. 3 is a schematic flowchart of a question and answer sentence generating method according to another embodiment of the disclosure.
As shown in fig. 3, the question-answer sentence generating method includes:
s301: acquiring a text to be processed, wherein the text to be processed comprises: a plurality of candidate text segments.
S302: and determining a target text segment from the candidate text segments, wherein the target text segment corresponds to the target subject.
For the description of S301 to S302, reference may be made to the above embodiments, which are not described herein again.
S303: and generating a reply sentence corresponding to the target subject according to the target text segment.
Wherein, the question-answer sentence may include: a query statement and a reply statement, which query statement may be, for example: { whether binning has recently been suggested for liquor fund blocks? The corresponding reply statement may be, for example: { white spirit foundation golden boards can be added into bins in batches and added into heavy bins step by step if the white spirit foundation golden boards can be newly stood above the 60-day average line; if the direction is selected downwards, the left-side binning can be considered when the red line below is broken, and the method is not limited.
In some embodiments, the reply sentence corresponding to the target topic is generated according to the target text segment, the summary information in the target text segment is extracted after the target text segment is determined, and the extracted summary information is used as the reply sentence corresponding to the target topic, or the reply sentence corresponding to the target topic is generated according to the target text segment, or a plurality of entities in the target text segment are extracted, and the reply sentence corresponding to the target topic is generated according to the plurality of extracted entities, which is not limited.
Optionally, in some embodiments, a reply sentence corresponding to the target topic is generated according to the target text segment, the target text segment may be input into the sentence generation model, and a sentence output by the sentence generation model is obtained as a reply sentence corresponding to the target topic, thereby implementing the joint sentence generation model, accurately generating the reply sentence corresponding to the target topic, and effectively improving the generation effect of the reply sentence.
The statement generation model may specifically be, for example: the pre-training language model, the transform-based bi-directional Encoder Representation (BERT) model, the GPT2 model, etc., are not limited thereto.
S304: an inquiry sentence corresponding to the reply sentence is determined.
The disclosed embodiments may determine an inquiry sentence corresponding to a reply sentence after generating the reply sentence corresponding to the target subject from the target text segment.
In some embodiments, determining the query sentence corresponding to the reply sentence may be, after determining the reply sentence, acquiring a corresponding query sentence template from the business field corresponding to the corresponding target topic, and using the corresponding query sentence template as the query sentence corresponding to the reply sentence, or determining the query sentence corresponding to the reply sentence, or acquiring key information in the reply sentence, inputting the key information into a pre-trained deep learning model, processing the key information by the deep learning model, and outputting the corresponding query sentence, which is not limited.
Optionally, in some embodiments, determining the query sentence corresponding to the reply sentence may be obtaining a plurality of candidate sentences, where the candidate sentences correspond to the first entity information, identifying the second entity information from the reply sentence, and when the first entity information and the second entity information match, taking the candidate sentence corresponding to the first entity information as the query sentence corresponding to the reply sentence.
The query statement set obtained in advance may be referred to as a candidate statement, the candidate statement may have corresponding entity information, the entity information may be referred to as first entity information, and the first entity information may be, for example, an entity, which is not limited to this.
The reply sentence may have corresponding entity information, which may be referred to as second entity information, and the second entity information may be, for example, an entity, which is not limited to this.
That is to say, in the embodiment of the present disclosure, a plurality of candidate sentences may be obtained, where the candidate sentences correspond to the first entity information, the second entity information is identified from the reply sentence, and then when the first entity information and the second entity information match, the candidate sentences corresponding to the first entity information are regarded as the query sentences corresponding to the reply sentence.
S305: the reply sentence and the question sentence are collectively referred to as a question-and-answer sentence.
In the embodiment of the disclosure, the answer sentence corresponding to the target topic is generated according to the target text segment, and the question sentence corresponding to the answer sentence is determined, so that the topic consistency of the question and answer sentence and the question sentence is effectively guaranteed, the question and answer sentence and the question sentence can be adapted, and the answer sentence and the question sentence are used as the question and answer sentence together, so that the generation effect of the question and answer sentence is effectively improved.
In the embodiment of the present disclosure, by obtaining a to-be-processed text, the to-be-processed text includes: the method comprises the steps of obtaining a plurality of candidate text segments, determining a target text segment from the candidate text segments, generating a reply sentence corresponding to a target topic according to the target text segment, and determining an inquiry sentence corresponding to the reply sentence, so that the topic consistency of the question-answer sentence and the inquiry sentence is effectively guaranteed, the question-answer sentence and the inquiry sentence can be matched, the reply sentence and the inquiry sentence are jointly used as the question-answer sentence, and the generation effect of the question-answer sentence is effectively improved.
Fig. 4 is a schematic structural diagram of a question-answer sentence generating device according to an embodiment of the present disclosure.
As shown in fig. 4, the question-answering sentence generating apparatus 40 includes:
an obtaining module 401, configured to obtain a to-be-processed text, where the to-be-processed text includes: a plurality of candidate text segments;
a determining module 402, configured to determine a target text segment from a plurality of candidate text segments, where the target text segment corresponds to a target topic; and
and a generating module 403, configured to generate a question and answer sentence corresponding to the target topic according to the target text segment.
In some embodiments of the present disclosure, as shown in fig. 5, fig. 5 is a schematic structural diagram of a question and answer sentence generating apparatus provided in another embodiment of the present disclosure, and the determining module 402 includes:
the first determining sub-module 4021 is configured to determine a matching degree value between adjacent candidate text segments, where the matching degree value describes a semantic matching degree between the adjacent candidate text segments;
the second determining sub-module 4022 is configured to determine a target text segment according to the matching degree value and the adjacent candidate text segment.
In some embodiments of the disclosure, the second determining sub-module 4022 is specifically configured to:
and if the matching degree value is greater than or equal to the matching degree threshold value, determining the target text segment according to the adjacent candidate text segments.
In some embodiments of the disclosure, the second determining sub-module 4022 is specifically configured to:
and splicing the adjacent candidate text segments, and taking the text segment obtained by splicing as a target text segment.
In some embodiments of the present disclosure, the first determining sub-module 4021 is further configured to:
and inputting the adjacent candidate text segments into the matching degree prediction model, and obtaining an output value of the matching degree prediction model as a matching degree value.
In some embodiments of the present disclosure, the generating module 403 includes:
the generating submodule 4031 is used for generating a reply sentence corresponding to the target subject according to the target text segment;
a third determining submodule 4032 for determining an inquiry sentence corresponding to the reply sentence;
a processing sub-module 4033 for making the answer sentence and the question sentence together as a question-answer sentence.
In some embodiments of the present disclosure, the generation submodule 4031 is further configured to:
and inputting the target text segment into the sentence generation model, and obtaining the sentence output by the sentence generation model as a reply sentence corresponding to the target subject.
In some embodiments of the present disclosure, the third determining sub-module 4032 is further configured to:
acquiring a plurality of candidate sentences, wherein the candidate sentences correspond to the first entity information;
identifying second entity information from the reply sentence;
and if the first entity information and the second entity information are matched, taking the candidate sentence corresponding to the first entity information as the inquiry sentence corresponding to the reply sentence.
In some embodiments of the present disclosure, the obtaining module 401 is further configured to:
acquiring an initial text, wherein the initial text comprises: a plurality of initial text segments;
determining a text segment to be processed from a plurality of initial text segments, wherein the text segment to be processed is an initial text segment carrying target information;
and deleting the text segment to be processed in the initial text to obtain the text to be processed.
In some embodiments of the present disclosure, the target information is redundant textual information.
Corresponding to the question-answer sentence generating method provided in the embodiments of fig. 1 to 3, the present disclosure also provides a question-answer sentence generating device, and since the question-answer sentence generating device provided in the embodiments of the present disclosure corresponds to the question-answer sentence generating method provided in the embodiments of fig. 1 to 3, the implementation manner of the question-answer sentence generating method is also applicable to the question-answer sentence generating device provided in the embodiments of the present disclosure, and is not described in detail in the embodiments of the present disclosure.
In this embodiment, by obtaining a to-be-processed text, the to-be-processed text includes: the method comprises the steps of obtaining a plurality of candidate text segments, determining a target text segment from the candidate text segments, wherein the target text segment corresponds to a target topic, and generating a question-answer sentence corresponding to the target topic according to the target text segment, so that the question-answer sentence corresponding to the target topic is generated according to a text to be processed, the generation effect of the question-answer sentence can be effectively improved, and the generated question-answer sentence can effectively meet business requirements in an actual conversation scene.
In order to implement the above embodiment, the present disclosure further provides an electronic device, including: the present invention provides a question and answer sentence generating method, which is provided by the aforementioned embodiments of the present disclosure, when the processor executes a program.
In order to achieve the above embodiments, the present disclosure also proposes a non-transitory computer-readable storage medium on which a computer program is stored, which when executed by a processor implements the question-and-answer sentence generation method as proposed by the foregoing embodiments of the present disclosure.
In order to implement the foregoing embodiments, the present disclosure also provides a computer program product, which when executed by an instruction processor in the computer program product, executes the question-answer sentence generation method as set forth in the foregoing embodiments of the present disclosure.
FIG. 6 illustrates a block diagram of an exemplary electronic device suitable for use in implementing embodiments of the present disclosure. The electronic device 12 shown in fig. 6 is only an example and should not bring any limitations to the functionality and scope of use of the embodiments of the present disclosure.
As shown in FIG. 6, electronic device 12 is embodied in the form of a general purpose computing device. The components of the electronic device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that couples various system components including the system memory 28 and the processing unit 16.
Bus 18 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, industry Standard Architecture (ISA) bus, micro Channel Architecture (MAC) bus, enhanced ISA bus, video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Electronic device 12 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by electronic device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
Memory 28 may include computer system readable media in the form of volatile Memory, such as Random Access Memory (RAM) 30 and/or cache Memory 32. The electronic device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 6, and commonly referred to as a "hard drive").
Although not shown in FIG. 6, a disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a Compact disk Read Only Memory (CD-ROM), a Digital versatile disk Read Only Memory (DVD-ROM), or other optical media) may be provided. In these cases, each drive may be connected to bus 18 by one or more data media interfaces. Memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the disclosure.
A program/utility 40 having a set (at least one) of program modules 42 may be stored, for example, in memory 28, such program modules 42 including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which or some combination of which may comprise an implementation of a network environment. Program modules 42 generally perform the functions and/or methodologies of the embodiments described in this disclosure.
Electronic device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), with one or more devices that enable a user to interact with electronic device 12, and/or with any devices (e.g., network card, modem, etc.) that enable electronic device 12 to communicate with one or more other computing devices. Such communication may be through an input/output (I/O) interface 22. Also, the electronic device 12 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public Network such as the Internet) via the Network adapter 20. As shown, the network adapter 20 communicates with other modules of the electronic device 12 via the bus 18. It should be understood that although not shown in the figures, other hardware and/or software modules may be used in conjunction with electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processing unit 16 executes various functional applications and data processing by running a program stored in the system memory 28, for example, implementing the question and answer sentence generation method mentioned in the foregoing embodiment.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice in the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
It should be noted that, in the description of the present disclosure, the terms "first", "second", etc. are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. Further, in the description of the present disclosure, "a plurality" means two or more unless otherwise specified.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and the scope of the preferred embodiments of the present disclosure includes other implementations in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the embodiments of the present disclosure.
It should be understood that portions of the present disclosure may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried out in the method of implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and the program, when executed, includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present disclosure may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present disclosure. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
Although embodiments of the present disclosure have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present disclosure, and that changes, modifications, substitutions and alterations may be made to the above embodiments by those of ordinary skill in the art within the scope of the present disclosure.

Claims (13)

1. A question-answer sentence generating method, comprising:
acquiring a text to be processed, wherein the text to be processed comprises: a plurality of candidate text segments;
determining a target text segment from the plurality of candidate text segments, wherein the target text segment corresponds to a target subject; and
and generating a question-answer sentence corresponding to the target subject according to the target text segment.
2. The method of claim 1, wherein said determining a target text segment from said plurality of candidate text segments comprises:
determining a matching degree value between adjacent candidate text segments, wherein the matching degree value describes the semantic matching degree between the adjacent candidate text segments;
and determining the target text segment according to the matching degree value and the adjacent candidate text segments.
3. The method of claim 2, wherein said determining said target segment of text based on said degree of match value and said neighboring said candidate segments of text comprises:
and if the matching degree value is greater than or equal to the matching degree threshold value, determining the target text segment according to the adjacent candidate text segments.
4. The method of claim 3, wherein said determining said target segment of text based on said neighboring said candidate segments of text comprises:
and splicing the adjacent candidate text segments, and taking the text segment obtained by splicing as the target text segment.
5. The method of claim 2, wherein said determining a degree of match value between adjacent ones of said candidate text segments comprises:
and inputting the adjacent candidate text segments into a matching degree prediction model, and obtaining an output value of the matching degree prediction model as the matching degree value.
6. The method according to any one of claims 1-5, wherein the generating a question-and-answer sentence corresponding to the target subject from the target text segment comprises:
generating a reply sentence corresponding to the target subject according to the target text segment;
determining an inquiry sentence corresponding to the reply sentence;
the answer sentence and the question sentence are collectively referred to as the question-answer sentence.
7. The method of claim 6, wherein generating a reply sentence corresponding to the target topic from the target text segment comprises:
and inputting the target text segment into a sentence generation model, and obtaining a sentence output by the sentence generation model as a reply sentence corresponding to the target subject.
8. The method of claim 6, wherein said determining an inquiry sentence corresponding to the reply sentence, comprises:
obtaining a plurality of candidate sentences, wherein the candidate sentences correspond to first entity information;
identifying second entity information from the reply sentence;
and if the first entity information is matched with the second entity information, taking the candidate sentence corresponding to the first entity information as the inquiry sentence corresponding to the reply sentence.
9. The method of any one of claims 1-5, wherein the obtaining the text to be processed comprises:
obtaining an initial text, wherein the initial text comprises: a plurality of initial text segments;
determining a text segment to be processed from a plurality of initial text segments, wherein the text segment to be processed is the initial text segment carrying target information;
deleting the text segment to be processed in the initial text to obtain the text to be processed.
10. The method of claim 9, wherein the target information is redundant text information.
11. A question-answer sentence generating apparatus comprising:
the acquisition module is used for acquiring a text to be processed, wherein the text to be processed comprises: a plurality of candidate text segments;
the determining module is used for determining a target text segment from the candidate text segments, wherein the target text segment corresponds to a target subject; and
and the generating module is used for generating question and answer sentences corresponding to the target subject according to the target text segment.
12. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-10.
13. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-10.
CN202211084555.XA 2022-09-06 2022-09-06 Question and answer sentence generation method and device, electronic equipment and storage medium Pending CN115391514A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211084555.XA CN115391514A (en) 2022-09-06 2022-09-06 Question and answer sentence generation method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211084555.XA CN115391514A (en) 2022-09-06 2022-09-06 Question and answer sentence generation method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115391514A true CN115391514A (en) 2022-11-25

Family

ID=84123933

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211084555.XA Pending CN115391514A (en) 2022-09-06 2022-09-06 Question and answer sentence generation method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115391514A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116089589A (en) * 2023-02-10 2023-05-09 阿里巴巴达摩院(杭州)科技有限公司 Question generation method and device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116089589A (en) * 2023-02-10 2023-05-09 阿里巴巴达摩院(杭州)科技有限公司 Question generation method and device
CN116089589B (en) * 2023-02-10 2023-08-29 阿里巴巴达摩院(杭州)科技有限公司 Question generation method and device

Similar Documents

Publication Publication Date Title
CN110377740B (en) Emotion polarity analysis method and device, electronic equipment and storage medium
CN107436916B (en) Intelligent answer prompting method and device
CN112349294B (en) Voice processing method and device, computer readable medium and electronic equipment
CN112163081A (en) Label determination method, device, medium and electronic equipment
CN112214576B (en) Public opinion analysis method, public opinion analysis device, terminal equipment and computer readable storage medium
CN111951782A (en) Voice question and answer method and device, computer readable storage medium and electronic equipment
CN107844531B (en) Answer output method and device and computer equipment
CN113849623A (en) Text visual question answering method and device
CN117520503A (en) Financial customer service dialogue generation method, device, equipment and medium based on LLM model
CN116882372A (en) Text generation method, device, electronic equipment and storage medium
CN115391514A (en) Question and answer sentence generation method and device, electronic equipment and storage medium
CN114662484A (en) Semantic recognition method and device, electronic equipment and readable storage medium
CN116402166B (en) Training method and device of prediction model, electronic equipment and storage medium
CN110008807A (en) A kind of training method, device and the equipment of treaty content identification model
CN113298495A (en) Resume screening method, resume screening device, terminal device and storage medium
CN112464927A (en) Information extraction method, device and system
CN111783424A (en) Text clause dividing method and device
CN116186219A (en) Man-machine dialogue interaction method, system and storage medium
CN114528851B (en) Reply sentence determination method, reply sentence determination device, electronic equipment and storage medium
CN115577109A (en) Text classification method and device, electronic equipment and storage medium
CN114757299A (en) Text similarity judgment method and device and storage medium
CN114372478A (en) Knowledge distillation-based question and answer method, terminal equipment and storage medium
CN114297380A (en) Data processing method, device, equipment and storage medium
CN111178038B (en) Document similarity recognition method and device based on latent semantic analysis
Bruchansky Political footprints: Political discourse analysis using pre-trained word vectors

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