CN112613322A - Text processing method, device, equipment and storage medium - Google Patents

Text processing method, device, equipment and storage medium Download PDF

Info

Publication number
CN112613322A
CN112613322A CN202011501996.6A CN202011501996A CN112613322A CN 112613322 A CN112613322 A CN 112613322A CN 202011501996 A CN202011501996 A CN 202011501996A CN 112613322 A CN112613322 A CN 112613322A
Authority
CN
China
Prior art keywords
understood
question
text
character
answer
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.)
Granted
Application number
CN202011501996.6A
Other languages
Chinese (zh)
Other versions
CN112613322B (en
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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN202011501996.6A priority Critical patent/CN112613322B/en
Publication of CN112613322A publication Critical patent/CN112613322A/en
Priority to PCT/CN2021/097086 priority patent/WO2022127040A1/en
Application granted granted Critical
Publication of CN112613322B publication Critical patent/CN112613322B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N5/00Computing arrangements using knowledge-based models
    • G06N5/04Inference or reasoning models
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Computational Linguistics (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Machine Translation (AREA)

Abstract

The embodiment of the application discloses a text processing method, a text processing device, text processing equipment and a storage medium, and the method comprises the following steps: acquiring a text to be understood, wherein the text to be understood comprises a question to be understood and a plurality of article fragments to be understood; inputting the text to be understood into a reading understanding model, and determining question type labels to which the questions to be understood belong, question type labels of questions answered by the article fragments to be understood, feature labels of characters in the text to be understood and position labels of the characters through a semantic analysis layer of the reading understanding model; and determining the initial character position and the terminal character position of the answer text of the question to be understood through a semantic matching layer of the reading understanding model, and determining the answer text of the question to be understood. By adopting the embodiment of the application, the machine reading understanding efficiency and the accuracy can be improved.

Description

Text processing method, device, equipment and storage medium
Technical Field
The present application relates to the field of natural language processing, and in particular, to a text processing method, apparatus, device, and storage medium.
Background
Currently, with the development of artificial intelligence technology, more and more inference models are used for natural language processing. The reading understanding model taking the natural language processing technology as the core can help people to read, understand and answer questions. The fragment extraction type reading understanding is a task in natural language processing, can well extract target information from a large amount of text materials, and can ensure that an output result is a sentence in the text materials. At present, the construction of a reading understanding model of a fragment extraction class is mainly based on Bidirectional encoding representation translation (Bert) class technology. As a mainstream training language model at present, the Bert model can show a better result in most language training tasks. However, in the reading and understanding task, the question and the article are semantically coded in the Bert model based on the vocabulary, and the Bert model cannot reasonably analyze the meaning of the question through the vocabulary coding because the information quantity of the question and the article is not matched. And because the length of the question is limited, the Bert model is difficult to find the association among all the questions through the vocabulary coding, so that the response pertinence made by the reading understanding model is poor, and the reading understanding efficiency is low.
Disclosure of Invention
Embodiments of the present application provide a text processing method, an apparatus, a device, and a storage medium, which can label a question type of a text to be understood to obtain an association between a question to be understood and an article to be understood in the question type, and can improve reading understanding efficiency and accuracy, and have high applicability.
In a first aspect, an embodiment of the present application provides a text processing method, where the method includes:
acquiring a text to be understood, wherein the text to be understood comprises a problem to be understood and a plurality of article fragments to be understood;
inputting the text to be understood into a reading understanding model, and determining question type labels to which the questions to be understood belong and question type labels of questions answered by the article fragments to be understood through a semantic analysis layer of the reading understanding model;
determining the feature labels of the characters in the text to be understood and the position labels of the characters through a semantic analysis layer of the reading understanding model;
determining a starting character position and an ending character position of an answer text of the question to be understood based on a question type label to which the question to be understood belongs, a question type label of a question answered by each article segment to be understood, a feature label of each character in the text to be understood and a position label of each character through a semantic matching layer of the reading understanding model;
and determining the answer text of the question to be understood from the text to be understood according to the starting character position and the ending character position.
In the embodiment of the application, the semantic relevance of the to-be-understood question and the to-be-understood article can be enhanced in the dimension of the question type by labeling the question type to which the to-be-understood question belongs in the to-be-understood text and the question type answered by each to-be-understood article fragment; and performing feature labeling and position labeling on each character in the text to be understood after the question type is determined, and inputting the character labeled and position labeled and input into a semantic matching layer, so that the semantic matching layer can perform character-level reading understanding on the text to be understood, and obtain the initial character position and the terminal character position of the answer text of the question to be understood in the article to be understood, thereby obtaining the answer text of the question to be understood and improving the accuracy of reading understanding.
With reference to the first aspect, in a possible implementation manner, before the entering the text to be understood into the reading understanding model, the method further includes:
collecting a plurality of sample fragments of reading understanding texts, wherein the sample fragments comprise question fragments and answer fragments corresponding to the question fragments;
determining question type labels of the question fragments in the sample fragments and question type labels of the questions answered by the answer fragments;
determining the feature label of each character in each sample segment and the position label of each character;
and training a semantic analysis layer and a semantic matching layer of the reading understanding model based on the question type label of each question segment, the question type label of the question answered by each answer segment, the feature label of each character in the sample segment and the position label of each character.
In the embodiment of the application, the question types of the question fragments in the sample fragments and the question types answered by the answer fragments are labeled, and the semantic analysis layer is trained, so that the relevance of the question fragments and the answer fragments on the dimension of the question types in the semantic analysis layer can be enhanced. By performing semantic annotation on the sample segments after classification and annotation and training the semantic matching layer, the semantic matching layer can perform character-level reading and understanding on the text to be understood to obtain the initial character position and the terminal character position of the answer text of the question to be understood in the article to be understood, so that the answer text of the question to be understood is obtained, and the accuracy of reading and understanding is further improved.
With reference to the first aspect, in one possible implementation manner, the training the semantic analysis layer and the semantic matching layer of the reading understanding model based on the question type labels to which the question fragments belong, the question type labels of the questions answered by the answer fragments, the feature labels of the characters in the sample fragments, and the position labels of the characters includes:
obtaining a first semantic matching layer network parameter obtained by training a semantic matching layer of the reading understanding model based on a question type label of a question fragment included in any sample fragment, a question type label of a question answered by an answer fragment corresponding to the question fragment, a feature label of each character in any sample fragment and a position label of each character;
determining the score of the first semantic matching layer network parameters through a gating cycle layer of the reading understanding model;
when the score of the first semantic matching layer network parameter is larger than or equal to a threshold value, determining the network parameter of the semantic matching layer as the first semantic matching layer network parameter through the gating circulating layer;
when the score of the first semantic matching layer network parameter is smaller than a threshold value, determining the network parameter of the semantic matching layer as a second semantic matching layer network parameter through the gating circulating layer;
the second semantic matching layer network parameters are semantic matching layer network parameters obtained by training the semantic matching layer of the reading understanding model based on question type labels to which question fragments included in previous sample fragments belong, question type labels to questions answered by answer fragments corresponding to the question fragments, feature labels of characters in the previous sample fragments, and position labels of the characters, and the previous sample fragments are sample fragments to which the reading understanding model is input before any sample fragment.
In the embodiment of the application, the score of the first semantic matching layer network parameters is determined by reading the gating cycle layer of the understanding model, sample fragments with low quality can be removed, and sample fragments with low contribution degree to training of the semantic matching layer are removed, so that the semantic matching layer network parameters of the semantic matching layer are more accurate, the training efficiency of the semantic matching layer is improved, and the accuracy of reading understanding is further improved.
With reference to the first aspect, in one possible implementation manner, the determining, by the semantic matching layer of the reading understanding model, a start character position and an end character position of the answer text of the question to be understood based on the question type label to which the question to be understood belongs, the question type label of the question answered by each article segment to be understood, the feature label of each character in the text to be understood, and the position label of each character includes:
determining a plurality of preselected initial character positions and a plurality of preselected end character positions from the article text to be understood through a semantic matching layer of the reading understanding model based on the question type labels to which the questions to be understood belong, the question type labels of the questions answered by the article fragments to be understood, the feature labels of the characters in the text to be understood and the position labels of the characters so as to obtain a plurality of preselected answer texts;
determining scores of the preselected answer texts for answering the questions to be understood based on the matching degree of the preselected answer texts and the questions to be understood through the semantic matching layer;
and taking the preselected start character position and the preselected end character position of the preselected answer text with the highest score in the preselected answer texts as the start character position and the end character position of the answer text of the question to be understood to obtain the answer text of the question to be understood.
With reference to the first aspect, in a possible implementation manner, the determining, from the text to be understood, an answer text of the question to be understood according to the starting character position and the ending character position includes:
and if the character distance between the initial character position and the terminal character position of the answer text of the question to be understood is within a threshold interval, determining the text between the initial character position and the terminal character position from the text to be understood as the answer text of the question to be understood, and outputting the answer text of the question to be understood.
In the embodiment of the application, the answer texts can be further screened based on the length of characters between the starting character position and the ending character position of the answer texts of the questions to be understood, the length of the answer texts can be further limited, and information irrelevant to the questions to be understood in the answer texts is removed, so that redundancy of the answer texts is reduced, and reading and understanding efficiency is improved.
With reference to the first aspect, in one possible implementation manner, the acquiring a plurality of sample fragments of the reading comprehension text includes:
collecting a plurality of sample fragments of reading and understanding texts from the Internet; and/or
Collecting a plurality of sample fragments of reading understanding texts from a target domain database, wherein the target domain database at least comprises a medical domain database generated based on diagnosis and treatment data and pathological data of the medical domain;
wherein, each sample segment of the reading comprehension text comprises a question segment and an answer segment corresponding to the question segment.
In a second aspect, an embodiment of the present application provides a text processing apparatus, including:
the text acquisition module is used for acquiring a text to be understood, and the text to be understood comprises a question to be understood and a plurality of article fragments to be understood;
the classification marking module is used for inputting the text to be understood into a reading understanding model, and determining question type marks to which the questions to be understood belong and question type marks of questions answered by the article fragments to be understood through a semantic analysis layer of the reading understanding model;
the semantic annotation module is used for determining the feature annotation of each character in the text to be understood and the position annotation of each character through a semantic analysis layer of the reading understanding model;
and a semantic matching module, configured to determine, through a semantic matching layer of the reading understanding model, a start character position and an end character position of an answer text of the to-be-understood question based on a question type label to which the to-be-understood question belongs, a question type label of a question answered by each to-be-understood article segment, a feature label of each character in the to-be-understood text, and a position label of each character, and determine the answer text of the to-be-understood question from the to-be-understood text according to the start character position and the end character position.
With reference to the second aspect, in a possible implementation manner, the semantic matching module includes:
a text confirmation unit, configured to determine, through a semantic matching layer of the reading understanding model, a plurality of preselected start character positions and a plurality of preselected end character positions from the article text to be understood based on a question type label to which the question to be understood belongs, a question type label of a question answered by each article segment to be understood, a feature label of each character in the text to be understood, and a position label of each character, so as to obtain a plurality of preselected answer texts;
the answer scoring unit is used for determining the score of each preselected answer text for answering the question to be understood based on the matching degree of each preselected answer text and the question to be understood through the semantic matching layer;
and the answer confirmation unit is used for taking the preselected starting character position and the preselected ending character position of the preselected answer text with the highest score in the preselected answer texts as the starting character position and the ending character position of the answer text of the question to be understood so as to obtain the answer text of the question to be understood.
With reference to the second aspect, in a possible implementation manner, the semantic matching module further includes:
and an answer output unit, configured to determine, from the text to be understood, a text between the start character position and the end character position as an answer text of the question to be understood, and output the answer text of the question to be understood, if a character distance between the start character position and the end character position of the answer text of the question to be understood is within a threshold interval.
In a third aspect, an embodiment of the present application provides a terminal device, where the terminal device includes a processor and a memory, and the processor and the memory are connected to each other. The memory is configured to store a computer program that supports the terminal device to execute the method provided by the first aspect and/or any one of the possible implementation manners of the first aspect, where the computer program includes program instructions, and the processor is configured to call the program instructions to execute the method provided by the first aspect and/or any one of the possible implementation manners of the first aspect.
In a fourth aspect, the present application provides a computer-readable storage medium, in which a computer program is stored, the computer program including program instructions, which, when executed by a processor, cause the processor to perform the method provided by the first aspect and/or any one of the possible implementation manners of the first aspect.
In the embodiment of the application, the semantic relevance of the to-be-understood question and the to-be-understood article can be enhanced in the dimension of the question type by labeling the question type to which the to-be-understood question belongs in the to-be-understood text and the question type answered by each to-be-understood article fragment; and performing feature labeling and position labeling on each character in the text to be understood after the question type is determined, and inputting the character labeled and position labeled and input into a semantic matching layer, so that the semantic matching layer can perform character-level reading understanding on the text to be understood, and obtain the initial character position and the terminal character position of the answer text of the question to be understood in the article to be understood, thereby obtaining the answer text of the question to be understood and improving the accuracy of reading understanding.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flow chart of a text processing method according to an embodiment of the present application;
FIG. 2 is a schematic flowchart of training a reading understanding model according to an embodiment of the present application;
FIG. 3 is another schematic flow chart diagram of a text processing method provided in an embodiment of the present application;
FIG. 4 is a schematic structural diagram of a text processing apparatus according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a terminal device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Natural language processing is an important direction in the fields of computer science and artificial intelligence, and is mainly used for researching various theories and methods for realizing effective communication between people and computers by using natural language. However, natural language processing is difficult to implement, and the fundamental reason for the difficulty is the wide variety of ambiguities or ambiguities that exist at various levels of natural language text and dialog. Thus, performing natural language processing entails disambiguation, i.e., the need to convert potentially ambiguous natural language input into some unambiguous computer internal representation. Many machine learning algorithms have been applied to perform natural language processing tasks, but these algorithms typically rely on hard rule class matching implementations. Therefore, more and more research is focused on natural language processing models, which give different weights to each inference element and make decisions according to the probability obtained by final calculation. Such models can yield many possible answers rather than just a relative certainty, thereby yielding more reliable results and increasing the applicability and compatibility of natural language processing models. Among them, the Bert model, as a currently mainstream natural language processing model, can show a better result in most language training tasks (e.g., Machine Reading Comprehension (MRC) tasks). Therefore, the Bert model can be used as a reading understanding model to answer questions according to given context, and the understanding degree of the reading understanding model to the natural language text can be tested. Common MRC tasks can be divided into four types: filling in blank, selecting multiple items, extracting segments and freely answering. The fragment extraction type reading understanding model can well extract target information which a user wants to pay attention to from a large amount of text materials, and can ensure that an output result is an original sentence of the material. In general, a reading comprehension model is composed of the following parts: embedding (Embedding), Feature Extraction (Feature Extraction), Context-Interaction (Context-Question Interaction), Answer Prediction (Answer Prediction). Wherein the embedding is used to map the words to corresponding word vectors; extracting the context information of the questions and articles by the feature extraction; contextual interaction is used to extract relevance between articles and questions, and attention mechanisms are usually introduced in order to fully extract relevance between articles and questions; the answer prediction is used to output a final answer (in the reading comprehension model for performing the segment extraction task, the final answer is an answer text) based on the information obtained in the above-described several sections. The method provided by the embodiment of the present application may be executed by a system or a terminal device equipped with a function of implementing text processing based on a reading understanding model, and for convenience of description, the method for processing a text provided by the embodiment of the present application will be described below with the terminal device as an execution main body.
Taking the example of constructing a reading understanding model (i.e., a reading understanding model) in the medical field to perform segment-extraction type reading understanding on the medical problem, the terminal device may improve or reconstruct a commonly used reading understanding model (e.g., a Bert model), and may be determined specifically according to an actual application scenario, which is not limited herein. In the present application, the reading understanding model includes, but is not limited to, a semantic analysis layer and a semantic matching layer, the medical problems belong to categories including, but not limited to, pneumonia, bronchitis, upper respiratory infection, tuberculosis, asthma and other diseases, and the medical problems include, but not limited to, location problems, time problems, people problems, event problems, reason problems, method problems and other categories. The terminal device constructs a reading understanding model, including but not limited to collecting a plurality of sample fragments of the reading understanding text from an internet or a target domain database, and constructs the reading understanding model by using the plurality of sample fragments. The target domain database may include: a medical field database generated based on the diagnosis and treatment data and the pathological data of the medical field, or a medical equipment field database generated based on the existing equipment data and the geographic position data of the medical institution. The sample segment may include a question segment (e.g., question segment 1, question segment 2, etc.) and an answer segment (e.g., answer segment 1, answer segment 2, etc.) corresponding to the question segment in the article segment. And the terminal equipment carries out problem category marking on each sample segment to obtain the sample segment after classification marking. The terminal equipment marks the question category of each sample segment, including marking the question type of the question segment in each sample segment, and marks the question type of one question segment as the question type answered by the answer segment corresponding to the question segment. For example, the terminal device labels the question types of the question segment 1 (e.g., how does the cold treat. The terminal device labels the question types of the question segment 2 (e.g., what causes the lung inflammation. And the terminal equipment performs semantic labeling on the classified and labeled sample fragments to obtain the sample fragments, including but not limited to performing feature labeling on each character in the sample fragments and labeling the position of each character. For example, the terminal device performs pinyin labeling, stroke number labeling and character position labeling on each character in the sample segment. The terminal semantically labels the question fragment 1 (how does the cold treat: do the senses (gan, 13, [ 1 ]) give rise to (mao, 9, [ 2 ]) such as (ru, 6, [ 3 ]) what (he, 7, [ 4 ]) is treated (zhi, 8, [ 5 ]) and (liao, 7, [ 6 ]) are treated (liao, 7, [ 6 ])? (# #, #, [ 7 ]). The terminal equipment adds a separator (the position is [ 8 ]) between the question segment 1 and the answer segment 1, and semantically labels the answer segment 1 (suggesting that the patient is in bed for rest and light diet) corresponding to the question segment 1 as follows: a (jian, 8, [ 9 ]) is built (jian, 5, [ 10 ]) to (yi, 5, [ 10 ]) the (huan, 11, [ 11 ]) person (zhe, 8, [ 12 ]) bed (wo, 8, [ 13 ]) (chuang, 7, [ 14 ]) rest (xiu, 6, [ 15 ]) rest (xi, 10, [ 16 ]), clear (qing, 11, [ 17 ]) light (dan, 12, [ 18 ]) drink (yin, 7, [ 19 ]) food (shi, 9, [ 20 ]). Further, the terminal device may train a semantic analysis layer and a semantic matching layer of the reading understanding model by using the classified and labeled sample fragment, so that the trained reading understanding model may output, based on any input text, a question type label of a question to be understood included in the text and a question type label of a question answered by an article fragment to be understood included in the text.
In some feasible implementation manners, the terminal device acquires a text to be understood, and performs problem type labeling and semantic labeling on the text to be understood through a trained reading understanding model. For example, the question types of the question to be understood as question 1 (how does the cold treat. The question types of the questions answered by the article section 2 to be understood (the patient is advised to rest in bed, light diet) can be labeled as "upper respiratory tract infection" and "method questions" by reading the understanding model. And the reading understanding model can also label the characteristics of each character in the text to be understood and the position of each character. For example, by performing feature labeling on each character of the problem to be understood in the text to be understood and labeling the position (position in the text to be understood) of each character through reading the understanding model, the problem to be understood 1 can be obtained: do the senses (gan, 13, [ 1 ]) give rise to (mao, 9, [ 2 ]) such as (ru, 6, [ 3 ]) what (he, 7, [ 4 ]) is treated (zhi, 8, [ 5 ]) and (liao, 7, [ 6 ]) are treated (liao, 7, [ 6 ])? (# #, #, [ 7 ]). A separator (the position is [ 8 ]) is added between the question 1 to be understood and the article segment 1 to be understood. The semantically labeled article fragment 1 to be understood can be obtained by reading a semantic analysis layer of the understanding model: the (gan, 13, [ 9 ] head (macro, 9, [ 10 ]) is (shi, 9, [ 11 ]) to (yi, 1, [ 12 ]) species (zhong, 9, [ 13 ]) common (chang, 11, [ 14 ]) to (jian, 4, [ 15 ]) acute (ji, 9, [ 17 ]) acute (xin, 8, [ 18 ]) upper (shang, 3, [ 19 ] respiratory (hu, 8, [ 20 ]) respiratory (xi, 6, [ 21 ] tract (dao, 11, [ 22 ]) disease (bingg, 9, [ 23 ] toxin (du, 9, [ 24 ] gong, [ 8 ], [ 25 ] para [ 25 ], [ 25 ] head, 13 ]) (gang, 26), [ 26 ], 3, [ 19 ] respiratory (hu, 8, [ 20 ]) respiratory, 9, [ 24 ] para [ 25 ] para [ 28 ], 10 ] para [ 28 ]). A separator (position is [ 31 ]) is added between the article segment 1 to be understood and the article segment 2 to be understood, so as to distinguish the article segment 1 to be understood from the article segment 2 to be understood. The semantically labeled article fragment 2 to be understood can be obtained by reading the semantic analysis layer of the understanding model: a (jian, 8, [ 32 ]) is built (jian, 5, [ 33 ]) to (yi, 5, [ 33 ]) the patient (huan, 11, [ 34 ] (zhe, 8, [ 35 ]) to (wo, 8, [ 36 ]) bed (chuang, 7, [ 37 ]) to (xiu, 6, [ 38 ]) to (xi, 10, [ 39 ]), clear (qing, 11, [ 40 ]) light (dan, 12, [ 41 ]) drink (yin, 7, [ 42 ]) to (shi, 9, [ 43 ]). And inputting the marked questions to be understood and the fragments of the articles to be understood into a reading understanding model for semantic matching, and determining the initial character positions (32) and the terminal character positions (43) of the answer texts of the questions to be understood in the articles to be understood through the reading understanding model so as to obtain the answer texts of the questions to be understood (suggesting that the patient is in bed for rest and light diet).
Referring to fig. 1 in detail, fig. 1 is a flow chart illustrating a text processing method according to an embodiment of the present disclosure. The method provided by the embodiment of the application can include the steps of obtaining a text to be understood, wherein the text to be understood comprises a question to be understood (for example, a question 1 to be understood and the like) and a plurality of article segments to be understood (for example, an article segment 1 to be understood, an article segment 2 to be understood and the like). The terminal equipment inputs the text to be understood into a semantic analysis layer of the reading and understanding model, and the problem type labeling and semantic labeling are carried out on the text to be understood through the semantic analysis layer so as to obtain the labeled problem to be understood and each article fragment to be understood. The terminal equipment inputs the marked questions to be understood and the fragments of the articles to be understood into a semantic matching layer for semantic matching, and determines the initial character position and the terminal character position of the answer text of the questions to be understood in the articles to be understood through the semantic matching layer so as to obtain the answer text of the questions to be understood. For convenience of description, the method provided by the embodiment of the present application will be described below by taking a reading understanding model constructed in the medical field to perform a segment extraction type reading understanding on a medical problem as an example. The method provided by the embodiment of the application can comprise the following steps:
s101: and the terminal equipment acquires the text to be understood.
In some possible embodiments, the terminal device acquires a text to be understood, where the text to be understood includes a question to be understood (e.g., question 1 to be understood, etc.) and a plurality of article segments to be understood (e.g., article segment 1 to be understood, article segment 2 to be understood, etc.). For example, the terminal device may acquire the text to be understood including a question to be understood 1 (e.g., how is a cold treated. In some application scenarios, the length of the article to be understood may be relatively long and larger than the length range limited by the reading understanding model, and the terminal device may divide the article to be understood into a plurality of article segments to be understood, combine each article segment to be understood with the problem to be understood, and sequentially input the reading understanding model for reading understanding. The method may be determined according to an actual application scenario, and is not limited herein.
S102: and the terminal equipment inputs the text to be understood into a reading understanding model, and determines the question type label of the question to be understood and the question type label of the question answered by each article segment to be understood through a semantic analysis layer of the reading understanding model.
In some possible embodiments, the terminal device may input the text to be understood into a trained reading understanding model, and perform question type labeling and semantic labeling on the text to be understood through a semantic analysis layer of the reading understanding model. For example, the question types of the questions answered by the article segment 1 to be understood (how does the cold treat.
S103: and determining the feature labels of the characters in the text to be understood and the position labels of the characters through a semantic analysis layer of a reading understanding model.
In some feasible embodiments, feature labeling and position labeling of each character in the text to be understood can be simultaneously performed by reading the semantic analysis layer of the understanding model, so that the labeled problem to be understood and each article fragment to be understood are obtained. The semantic labeling includes, but is not limited to, labeling the characteristics of each character in the sample fragment, and labeling the position of each character. For example, by performing feature labeling on each character of the to-be-understood question in the to-be-understood text and labeling the position (position in the to-be-understood text) of each character through the reading understanding model, the to-be-understood question 1 after semantic labeling can be obtained: do the senses (gan, 13, [ 1 ]) give rise to (mao, 9, [ 2 ]) such as (ru, 6, [ 3 ]) what (he, 7, [ 4 ]) is treated (zhi, 8, [ 5 ]) and (liao, 7, [ 6 ]) are treated (liao, 7, [ 6 ])? (# #, #, [ 7 ]). A separator (the position is [ 8 ]) is added between the question 1 to be understood and the article segment 1 to be understood. The semantically labeled article fragment 1 to be understood can be obtained by reading a semantic analysis layer of the understanding model: the (gan, 13, [ 9 ] head (macro, 9, [ 10 ]) is (shi, 9, [ 11 ]) to (yi, 1, [ 12 ]) species (zhong, 9, [ 13 ]) common (chang, 11, [ 14 ]) to (jian, 4, [ 15 ]) acute (ji, 9, [ 17 ]) acute (xin, 8, [ 18 ]) upper (shang, 3, [ 19 ] respiratory (hu, 8, [ 20 ]) respiratory (xi, 6, [ 21 ] tract (dao, 11, [ 22 ]) disease (bingg, 9, [ 23 ] toxin (du, 9, [ 24 ] gong, [ 8 ], [ 25 ] para [ 25 ], [ 25 ] head, 13 ]) (gang, 26), [ 26 ], 3, [ 19 ] respiratory (hu, 8, [ 20 ]) respiratory, 9, [ 24 ] para [ 25 ] para [ 28 ], 10 ] para [ 28 ]). A separator (position is [ 31 ]) is added between the article segment 1 to be understood and the article segment 2 to be understood, so as to distinguish the article segment 1 to be understood from the article segment 2 to be understood. The semantically labeled article fragment 2 to be understood can be obtained by reading the semantic analysis layer of the understanding model: a (jian, 8, [ 32 ]) is built (jian, 5, [ 33 ]) to (yi, 5, [ 33 ]) the patient (huan, 11, [ 34 ] (zhe, 8, [ 35 ]) to (wo, 8, [ 36 ]) bed (chuang, 7, [ 37 ]) to (xiu, 6, [ 38 ]) to (xi, 10, [ 39 ]), clear (qing, 11, [ 40 ]) light (dan, 12, [ 41 ]) drink (yin, 7, [ 42 ]) to (shi, 9, [ 43 ]).
In some possible implementations, please refer to fig. 2 together, and fig. 2 is a schematic flowchart illustrating a process of training a reading understanding model according to an embodiment of the present application. The method for training the reading understanding model may include the following implementation manners provided in the steps S201 to S208.
S201: the terminal device collects a plurality of sample fragments for reading and understanding the text.
In some possible embodiments, the method for the terminal device to collect a plurality of sample segments of the reading comprehension text may include, but is not limited to, the terminal device collecting a plurality of sample segments of the reading comprehension text from the internet, where the sample segments include question segments (e.g., question segment 1, question segment 2, etc.) and answer segments (e.g., answer segment 1, answer segment 2, etc.) corresponding to the question segments in the article segments.
S202: and the terminal equipment determines the question type label of each question segment in each sample segment and the question type label of the question answered by each answer segment.
In some possible embodiments, the terminal device may perform problem category labeling on each sample segment to obtain a classified and labeled sample segment. The terminal device may label the question category of each sample segment, including labeling the question type to which the question segment belongs in each sample segment, and label the question type to which one question segment belongs as the question type answered by the answer segment corresponding to the question segment. The question types of the question segment 1 (how does the cold treat. The terminal device may label the question types of the question segment 2 (what is the cause of lung inflammation.
S203: and the terminal equipment determines the feature label of each character in each sample fragment and the position label of each character.
In some possible embodiments, the terminal device may perform semantic annotation on the classified and annotated sample segment to obtain a semantically annotated sample segment. The terminal device can label the characteristics of each character in each sample segment after classification and labeling the position of each character. For example, by performing pinyin labeling, stroke number labeling, and character position labeling on each character in the sample segment after classification labeling, the question segment 1 (how does cold treat: do the senses (gan, 13, [ 1 ]) give rise to (mao, 9, [ 2 ]) such as (ru, 6, [ 3 ]) what (he, 7, [ 4 ]) is treated (zhi, 8, [ 5 ]) and (liao, 7, [ 6 ]) are treated (liao, 7, [ 6 ])? (# #, #, [ 7 ]). Adding a separator (the position is [ 8 ]) between the question segment 1 and the answer segment 1, and semantically labeling the answer segment 1 (suggesting that the patient is in bed for rest and light diet) corresponding to the question segment 1 as follows: a (jian, 8, [ 9 ]) is built (jian, 5, [ 10 ]) to (yi, 5, [ 10 ]) the (huan, 11, [ 11 ]) person (zhe, 8, [ 12 ]) bed (wo, 8, [ 13 ]) (chuang, 7, [ 14 ]) rest (xiu, 6, [ 15 ]) rest (xi, 10, [ 16 ]), clear (qing, 11, [ 17 ]) light (dan, 12, [ 18 ]) drink (yin, 7, [ 19 ]) food (shi, 9, [ 20 ]).
S204: and the terminal equipment inputs the question type label of each question segment, the question type label of the question answered by each answer segment, the feature label of each character in the sample segment and the position label of each character into a semantic analysis layer and a semantic matching layer.
S205: and the gating circulation layer acquires a first semantic matching layer network parameter obtained by training the semantic matching layer of the reading understanding model based on any sample fragment.
S206: and the gating circulation layer determines the grade of the first semantic matching layer network parameters.
S207: and when the score of the first semantic matching layer network parameter is greater than or equal to a threshold value, the gating circulating layer determines the network parameter of the semantic matching layer as the first semantic matching layer network parameter.
S208: and when the score of the first semantic matching layer network parameter is smaller than a threshold value, the gating circulation layer determines the network parameter of the semantic matching layer as a second semantic matching layer network parameter.
In some possible embodiments, after a sample segment is input into the semantic matching layer and semantic matching is trained by the sample segment, the gating cycle layer may obtain semantic matching layer network parameters (assumed as the first semantic matching layer network parameters) of the semantic matching layer. And determining the score of the semantic matching layer network parameters through the gating circulating layer, and judging the score of the semantic matching layer network parameters. When the score of the semantic matching layer network parameters is larger than or equal to the threshold value, the gating circulation layer determines the network parameters of the semantic matching layer as the first semantic matching layer network parameters through the updating gate of the gating circulation layer. And when the score of the semantic matching layer network parameters is smaller than a threshold value, the gating cycle layer determines the network parameters of the semantic matching layer as second semantic matching layer network parameters through a reset gate. The second semantic matching layer network parameters are semantic matching layer network parameters obtained after training the semantic matching layer of the reading understanding model based on question type labels to which question fragments included in previous sample fragments belong, question type labels to questions answered by answer fragments corresponding to the question fragments, feature labels of characters in the previous sample fragments and position labels of the characters. Here, the preceding sample segment is a sample segment that is input to the reading understanding model before any one of the sample segments and used for training the semantic matching layer.
In some possible embodiments, after a sample fragment is input into the semantic matching layer, the gated loop layer may obtain semantic matching layer network parameters (assumed as first semantic matching layer network parameters) of the semantic matching layer and store the semantic matching layer network parameters in the gated loop layer, perform comprehensive scoring on the semantic matching layer network parameters after n (n is a positive integer greater than 1 and can be freely set by a user) sample fragments stored in the gated loop layer are input into the semantic matching layer, and determine the comprehensive scoring of the semantic matching layer network parameters. And when the comprehensive score of the semantic matching layer network parameters is greater than or equal to a threshold value, the gating circulation layer determines the network parameters of the semantic matching layer as the first semantic matching layer network parameters by updating a gate. And when the comprehensive score of the semantic matching layer network parameters is smaller than a threshold value, the gating circulation layer determines the network parameters of the semantic matching layer as second semantic matching layer network parameters through a reset gate. The second semantic matching layer network parameters are semantic matching layer network parameters obtained by training the semantic matching layer of the reading understanding model based on question type labels to which question fragments included in previous sample fragments belong, question type labels to questions answered by answer fragments corresponding to the question fragments, feature labels of characters in the previous sample fragments, and position labels of the characters, and the previous sample fragments are sample fragments to which the reading understanding model is input before the n sample fragments.
Specifically, semantic matching layer network parameters of the semantic matching layer after the ith (i is a positive integer) sample segment is input are obtained, the gate control loop layer determines the score of the semantic matching layer network parameters, and the semantic matching layer network parameters are restored or updated to obtain the ith group of semantic matching layer network parameters. When the (i + 1) th sample fragment is input into the semantic matching layer, the semantic matching layer is trained by utilizing the (i) th group of semantic matching layer network parameters, so that the semantic matching layer network parameters controlled by the gating circulating layer at the (i) th moment can be applied to training of the semantic matching layer at the (i + 1) th moment.
S104: and determining the initial character position and the terminal character position of the answer text of the question to be understood and determining the answer text of the question to be understood based on the labeled text to be understood through the semantic matching layer of the reading understanding model.
In some possible embodiments, the labeled questions to be understood and the sections of the articles to be understood are input into a reading understanding model for semantic matching, and the starting character positions (32) and the ending character positions (43) of the answer texts of the questions to be understood are determined in the articles to be understood through the reading understanding model so as to obtain the answer texts of the questions to be understood (suggesting that the patient is in bed for rest and light diet).
In the embodiment of the application, the semantic relevance of the to-be-understood question and the to-be-understood article can be enhanced in the dimension of the question type by labeling the question type to which the to-be-understood question belongs in the to-be-understood text and the question type answered by each to-be-understood article fragment; and performing feature labeling and position labeling on each character in the text to be understood after the question type is determined, and inputting the character labeled and position labeled and input into a semantic matching layer, so that the semantic matching layer can perform character-level reading understanding on the text to be understood, and obtain the initial character position and the terminal character position of the answer text of the question to be understood in the article to be understood, thereby obtaining the answer text of the question to be understood and improving the accuracy of reading understanding.
Referring to fig. 3, fig. 3 is another schematic flow chart of a text processing method according to an embodiment of the present application.
S301: and the terminal equipment acquires the text to be understood.
In some possible embodiments, the terminal device acquires a text to be understood, where the text to be understood includes a question to be understood (e.g., question 1 to be understood, etc.) and a plurality of article segments to be understood (e.g., article segment 1 to be understood, article segment 2 to be understood, etc.). For example, the terminal device may acquire the text to be understood including a question to be understood 1 (how is a cold treated. In some application scenarios, the length of the article to be understood may be relatively long, and is greater than the length range limited by the reading understanding model, so that the article to be understood may be divided into a plurality of article segments to be understood, each article segment to be understood is combined with the problem to be understood, and the reading understanding model is sequentially input for reading understanding. The method may be determined according to an actual application scenario, and is not limited herein.
S302: and the terminal equipment inputs the text to be understood into a reading understanding model, and determines the question type label of the question to be understood and the question type label of the question answered by each article segment to be understood through a semantic analysis layer of the reading understanding model.
In some possible embodiments, the terminal device may input the text to be understood into a trained reading understanding model, and perform question type labeling and semantic labeling on the text to be understood through a semantic analysis layer of the reading understanding model. For example, the question types of the question to be understood 1 (how is cold treated.
S303: and determining the feature labels of the characters in the text to be understood and the position labels of the characters through a semantic analysis layer of a reading understanding model.
In some feasible embodiments, feature labeling and position labeling of each character in the text to be understood can be simultaneously performed by reading the semantic analysis layer of the understanding model, so that the labeled problem to be understood and each article fragment to be understood are obtained. The semantic labeling includes, but is not limited to, labeling the characteristics of each character in the sample fragment, and labeling the position of each character. For example, by performing feature labeling on each character of the to-be-understood question in the to-be-understood text and labeling the position (position in the to-be-understood text) of each character through the reading understanding model, the to-be-understood question 1 after semantic labeling can be obtained: do the senses (gan, 13, [ 1 ]) give rise to (mao, 9, [ 2 ]) such as (ru, 6, [ 3 ]) what (he, 7, [ 4 ]) is treated (zhi, 8, [ 5 ]) and (liao, 7, [ 6 ]) are treated (liao, 7, [ 6 ])? (# #, #, [ 7 ]). A separator (the position is [ 8 ]) is added between the question 1 to be understood and the article segment 1 to be understood. The semantically labeled article fragment 1 to be understood can be obtained by reading a semantic analysis layer of the understanding model: the (gan, 13, [ 9 ] head (macro, 9, [ 10 ]) is (shi, 9, [ 11 ]) to (yi, 1, [ 12 ]) species (zhong, 9, [ 13 ]) common (chang, 11, [ 14 ]) to (jian, 4, [ 15 ]) acute (ji, 9, [ 17 ]) acute (xin, 8, [ 18 ]) upper (shang, 3, [ 19 ] respiratory (hu, 8, [ 20 ]) respiratory (xi, 6, [ 21 ] tract (dao, 11, [ 22 ]) disease (bingg, 9, [ 23 ] toxin (du, 9, [ 24 ] gong, [ 8 ], [ 25 ] para [ 25 ], [ 25 ] head, 13 ]) (gang, 26), [ 26 ], 3, [ 19 ] respiratory (hu, 8, [ 20 ]) respiratory, 9, [ 24 ] para [ 25 ] para [ 28 ], 10 ] para [ 28 ]). A separator (position is [ 31 ]) is added between the article segment 1 to be understood and the article segment 2 to be understood, so as to distinguish the article segment 1 to be understood from the article segment 2 to be understood. The semantically labeled article fragment 2 to be understood can be obtained by reading the semantic analysis layer of the understanding model: a (jian, 8, [ 32 ]) is built (jian, 5, [ 33 ]) to (yi, 5, [ 33 ]) the patient (huan, 11, [ 34 ] (zhe, 8, [ 35 ]) to (wo, 8, [ 36 ]) bed (chuang, 7, [ 37 ]) to (xiu, 6, [ 38 ]) to (xi, 10, [ 39 ]), clear (qing, 11, [ 40 ]) light (dan, 12, [ 41 ]) drink (yin, 7, [ 42 ]) to (shi, 9, [ 43 ]).
S304: and determining a plurality of preselected initial character positions and a plurality of preselected end character positions from the article text to be understood through a semantic matching layer of the reading understanding model based on the question type labels to which the questions to be understood belong, the question type labels of the questions answered by the article fragments to be understood, the feature labels of the characters in the text to be understood and the position labels of the characters so as to obtain a plurality of preselected answer texts.
S305: and determining the scores of the preselected answer texts for answering the questions to be understood through the semantic matching layer based on the matching degree of the preselected answer texts and the questions to be understood.
In some possible embodiments, the preselected answer text and the question to be understood may be matrix-vectorized, and the similarity of the two matrices may be calculated as the matching degree of the preselected answer text and the question to be understood.
In particular, the preselected answer text and the question to be understood may also be subjected to matrix vectorization, and a feature matrix of the question to be understood is calculated, the meaning represented by the feature matrix may be a keyword in the question to be understood, and the similarity between the preselected answer text matrix and the feature matrix of the question to be understood is calculated as the matching degree between the preselected answer text and the question to be understood.
S306: and taking the preselected start character position and the preselected end character position of the preselected answer text with the highest score in the preselected answer texts as the start character position and the end character position of the answer text of the question to be understood to obtain the answer text of the question to be understood.
In some feasible embodiments, it may be determined whether a character distance between a start character position and an end character position of the answer text of the question to be understood is within a threshold interval, and if so, determining the answer text of the question to be understood from the text to be understood according to the start character position and the end character position, and outputting the answer text of the question to be understood; if not, the output answer text does not exist. The length of the answer text can be further limited, and information irrelevant to the question to be understood in the answer text is eliminated, so that redundancy of the answer text is reduced, and reading and understanding efficiency is further improved.
In the embodiment of the application, the semantic relevance of the to-be-understood question and the to-be-understood article can be enhanced in the dimension of the question type by labeling the question type to which the to-be-understood question belongs in the to-be-understood text and the question type answered by each to-be-understood article fragment; and performing feature labeling and position labeling on each character in the text to be understood after the question type is determined, and inputting the character labeled and position labeled and input into a semantic matching layer, so that the semantic matching layer can perform character-level reading understanding on the text to be understood, and obtain the initial character position and the terminal character position of the answer text of the question to be understood in the article to be understood, thereby obtaining the answer text of the question to be understood and improving the accuracy of reading understanding.
Referring to fig. 4, fig. 4 is a schematic structural diagram of a text processing apparatus according to an embodiment of the present application.
The text obtaining module 401 is configured to obtain a text to be understood, where the text to be understood includes a question to be understood and a plurality of article fragments to be understood.
In some possible embodiments, a text to be understood, which includes a question to be understood and a plurality of article fragments to be understood, is acquired by the text acquisition module 401. For example, the text acquisition module 401 acquires the text to be understood including a question to be understood 1 (how is a cold treated. In some application scenarios, the length of the article to be understood may be relatively long, and is greater than the length range limited by the reading understanding model, so that the article to be understood may be divided into a plurality of article segments to be understood, each article segment to be understood is combined with the problem to be understood, and the reading understanding model is sequentially input for reading understanding. The method may be determined according to an actual application scenario, and is not limited herein.
The classification labeling module 402 is configured to input a text to be understood into a semantic analysis layer, perform question type labeling and semantic labeling on the text to be understood to obtain labeled questions to be understood and article fragments to be understood, where the question type labeling includes labeling a question type to which the question belongs and labeling a question type answered by each article fragment to be understood, and the semantic labeling includes performing feature labeling on each character in the text to be understood and labeling a position of each character.
In some possible implementations, the text to be understood can be question-type labeled and semantically labeled by the classification labeling module 402. The question types to be understood as the question 1 (how does the cold treat.
A semantic labeling module 403, configured to determine, through a semantic analysis layer of the reading understanding model, a feature label of each character in the text to be understood and a position label of each character.
In some possible embodiments, the semantic labeling module 403 may label features of each character in the text to be understood and label the position of each character at the same time, so as to obtain the labeled problem to be understood and each article fragment to be understood. The semantic labeling includes, but is not limited to, labeling the characteristics of each character in the sample fragment, and labeling the position of each character. For example, the semantic labeling module 403 performs feature labeling on each character of the to-be-understood question in the to-be-understood text and labels the position (position in the to-be-understood text) of each character, so as to obtain the to-be-understood question 1 after semantic labeling: do the senses (gan, 13, [ 1 ]) give rise to (mao, 9, [ 2 ]) such as (ru, 6, [ 3 ]) what (he, 7, [ 4 ]) is treated (zhi, 8, [ 5 ]) and (liao, 7, [ 6 ]) are treated (liao, 7, [ 6 ])? (# #, #, [ 7 ]). A separator (the position is [ 8 ]) is added between the question 1 to be understood and the article segment 1 to be understood. Obtaining a semantic labeled article fragment 1 to be understood: the (gan, 13, [ 9 ] head (macro, 9, [ 10 ]) is (shi, 9, [ 11 ]) to (yi, 1, [ 12 ]) species (zhong, 9, [ 13 ]) common (chang, 11, [ 14 ]) to (jian, 4, [ 15 ]) acute (ji, 9, [ 17 ]) acute (xin, 8, [ 18 ]) upper (shang, 3, [ 19 ] respiratory (hu, 8, [ 20 ]) respiratory (xi, 6, [ 21 ] tract (dao, 11, [ 22 ]) disease (bingg, 9, [ 23 ] toxin (du, 9, [ 24 ] gong, [ 8 ], [ 25 ] para [ 25 ], [ 25 ] head, 13 ]) (gang, 26), [ 26 ], 3, [ 19 ] respiratory (hu, 8, [ 20 ]) respiratory, 9, [ 24 ] para [ 25 ] para [ 28 ], 10 ] para [ 28 ]). A separator (position is [ 31 ]) is added between the article segment 1 to be understood and the article segment 2 to be understood, so as to distinguish the article segment 1 to be understood from the article segment 2 to be understood. The semantically labeled article fragment 2 to be understood can be obtained by reading the semantic analysis layer of the understanding model: a (jian, 8, [ 32 ]) is built (jian, 5, [ 33 ]) to (yi, 5, [ 33 ]) the patient (huan, 11, [ 34 ] (zhe, 8, [ 35 ]) to (wo, 8, [ 36 ]) bed (chuang, 7, [ 37 ]) to (xiu, 6, [ 38 ]) to (xi, 10, [ 39 ]), clear (qing, 11, [ 40 ]) light (dan, 12, [ 41 ]) drink (yin, 7, [ 42 ]) to (shi, 9, [ 43 ]).
A semantic matching module 404, configured to determine, through a semantic matching layer of the reading understanding model, a start character position and an end character position of an answer text of the question to be understood based on a question type label to which the question to be understood belongs, a question type label of a question answered by each article segment to be understood, a feature label of each character in the text to be understood, and a position label of each character, and determine the answer text of the question to be understood from the text to be understood according to the start character position and the end character position.
In some possible embodiments, the semantic matching module 404 may perform matrix vectorization on the preselected answer text and the question to be understood, and calculate the similarity between the two matrices as the matching degree of the preselected answer text and the question to be understood.
Specifically, the semantic matching module 404 may also perform matrix vectorization on the preselected answer text and the question to be understood, and calculate a feature matrix of the question to be understood, where the meaning represented by the feature matrix may be a keyword in the question to be understood, and calculate a similarity between the preselected answer text matrix and the feature matrix of the question to be understood as a matching degree between the preselected answer text and the question to be understood. Furthermore, the preselected start character position and the preselected end character position of the preselected answer text with the highest score can be used as the start character position and the end character position of the answer text of the question to be understood, so as to obtain the answer text of the question to be understood, and at the moment, the matching degree of the answer text and the question to be understood is the highest.
In some possible embodiments, the semantic matching module 404 includes:
and a text confirmation unit, configured to determine, by using a semantic matching layer of the reading understanding model, a plurality of preselected start character positions and a plurality of preselected end character positions from the article text to be understood based on the question type labels to which the questions to be understood belong, the question type labels of the questions answered by the article fragments to be understood, the feature labels of the characters in the text to be understood, and the position labels of the characters, so as to obtain a plurality of preselected answer texts.
And the answer scoring unit is used for determining the score of each preselected answer text for answering the question to be understood based on the matching degree of each preselected answer text and the question to be understood through the semantic matching layer.
And the answer confirmation unit is used for taking the preselected starting character position and the preselected ending character position of the preselected answer text with the highest score in the preselected answer texts as the starting character position and the ending character position of the answer text of the question to be understood so as to obtain the answer text of the question to be understood.
In some possible embodiments, the semantic matching module 404 further includes:
and an answer output unit, configured to determine, from the text to be understood, a text between the start character position and the end character position as an answer text of the question to be understood, and output the answer text of the question to be understood, if a character distance between the start character position and the end character position of the answer text of the question to be understood is within a threshold interval.
In the embodiment of the application, the semantic relevance of the to-be-understood question and the to-be-understood article can be enhanced in the dimension of the question type by labeling the question type to which the to-be-understood question belongs in the to-be-understood text and the question type answered by each to-be-understood article fragment; and performing feature labeling and position labeling on each character in the text to be understood after the question type is determined, and inputting the character labeled and position labeled and input into a semantic matching layer, so that the semantic matching layer can perform character-level reading understanding on the text to be understood, and obtain the initial character position and the terminal character position of the answer text of the question to be understood in the article to be understood, thereby obtaining the answer text of the question to be understood and improving the accuracy of reading understanding.
Referring to fig. 5, fig. 5 is a schematic structural diagram of a terminal device provided in an embodiment of the present application. As shown in fig. 5, the terminal device in this embodiment may include: one or more processors 501 and memory 502. The processor 501 and the memory 502 are connected by a bus 503. The memory 502 is used for storing a computer program comprising program instructions, and the processor 501 is used for executing the program instructions stored in the memory 502 to perform the following operations:
acquiring a text to be understood, wherein the text to be understood comprises a problem to be understood and a plurality of article fragments to be understood;
inputting the text to be understood into a reading understanding model, and determining question type labels to which the questions to be understood belong and question type labels of questions answered by the article fragments to be understood through a semantic analysis layer of the reading understanding model;
determining the feature labels of the characters in the text to be understood and the position labels of the characters through a semantic analysis layer of the reading understanding model;
determining a starting character position and an ending character position of an answer text of the question to be understood based on a question type label to which the question to be understood belongs, a question type label of a question answered by each article segment to be understood, a feature label of each character in the text to be understood and a position label of each character through a semantic matching layer of the reading understanding model;
and determining the answer text of the question to be understood from the text to be understood according to the starting character position and the ending character position.
In some possible embodiments, the processor 501 is further configured to:
collecting a plurality of sample fragments of reading understanding texts, wherein the sample fragments comprise question fragments and answer fragments corresponding to the question fragments;
determining question type labels of the question fragments in the sample fragments and question type labels of the questions answered by the answer fragments;
determining the feature label of each character in each sample segment and the position label of each character;
and training a semantic analysis layer and a semantic matching layer of the reading understanding model based on the question type label of each question segment, the question type label of the question answered by each answer segment, the feature label of each character in the sample segment and the position label of each character.
In some possible embodiments, the processor 501 is configured to:
obtaining a first semantic matching layer network parameter obtained by training a semantic matching layer of the reading understanding model based on a question type label of a question fragment included in any sample fragment, a question type label of a question answered by an answer fragment corresponding to the question fragment, a feature label of each character in any sample fragment and a position label of each character;
determining the score of the first semantic matching layer network parameters through a gating cycle layer of the reading understanding model;
when the score of the first semantic matching layer network parameter is larger than or equal to a threshold value, determining the network parameter of the semantic matching layer as the first semantic matching layer network parameter through the gating circulating layer;
when the score of the first semantic matching layer network parameter is smaller than a threshold value, determining the network parameter of the semantic matching layer as a second semantic matching layer network parameter through the gating circulating layer;
the second semantic matching layer network parameters are semantic matching layer network parameters obtained by training the semantic matching layer of the reading understanding model based on question type labels to which question fragments included in previous sample fragments belong, question type labels to questions answered by answer fragments corresponding to the question fragments, feature labels of characters in the previous sample fragments, and position labels of the characters, and the previous sample fragments are sample fragments to which the reading understanding model is input before any sample fragment.
In some possible embodiments, the processor 501 is configured to:
determining a plurality of preselected initial character positions and a plurality of preselected end character positions from the article text to be understood through a semantic matching layer of the reading understanding model based on the question type labels to which the questions to be understood belong, the question type labels of the questions answered by the article fragments to be understood, the feature labels of the characters in the text to be understood and the position labels of the characters so as to obtain a plurality of preselected answer texts;
determining scores of the preselected answer texts for answering the questions to be understood based on the matching degree of the preselected answer texts and the questions to be understood through the semantic matching layer;
and taking the preselected start character position and the preselected end character position of the preselected answer text with the highest score in the preselected answer texts as the start character position and the end character position of the answer text of the question to be understood to obtain the answer text of the question to be understood.
In some possible embodiments, the processor 501 is configured to:
and if the character distance between the initial character position and the terminal character position of the answer text of the question to be understood is within a threshold interval, determining the text between the initial character position and the terminal character position from the text to be understood as the answer text of the question to be understood, and outputting the answer text of the question to be understood.
In some possible embodiments, the processor 501 is configured to:
collecting a plurality of sample fragments of reading and understanding texts from the Internet; and/or
Collecting a plurality of sample fragments of reading understanding texts from a target domain database, wherein the target domain database at least comprises a medical domain database generated based on diagnosis and treatment data and pathological data of the medical domain;
wherein, each sample segment of the reading comprehension text comprises a question segment and an answer segment corresponding to the question segment.
In some possible embodiments, the processor 501 may be a Central Processing Unit (CPU), and the processor may be other general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 502 may include both read-only memory and random access memory, and provides instructions and data to the processor 501. A portion of the memory 502 may also include non-volatile random access memory. For example, the memory 502 may also store device type information.
In a specific implementation, the terminal device may execute the implementation manners provided in the steps in fig. 1 to fig. 3 through the built-in functional modules, which may specifically refer to the implementation manners provided in the steps, and are not described herein again.
In the embodiment of the application, the semantic relevance of the to-be-understood question and the to-be-understood article can be enhanced in the dimension of the question type by labeling the question type to which the to-be-understood question belongs in the to-be-understood text and the question type answered by each to-be-understood article fragment; and performing feature labeling and position labeling on each character in the text to be understood after the question type is determined, and inputting the character labeled and position labeled and input into a semantic matching layer, so that the semantic matching layer can perform character-level reading understanding on the text to be understood, and obtain the initial character position and the terminal character position of the answer text of the question to be understood in the article to be understood, thereby obtaining the answer text of the question to be understood and improving the accuracy of reading understanding.
An embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, where the computer program includes program instructions, and the program instructions, when executed by a processor, implement the methods provided in each step in fig. 1 to fig. 3, which may specifically refer to the implementation manners provided in each step, and are not described herein again.
The computer-readable storage medium may be the user behavior recognition apparatus based on the prediction model provided in any of the foregoing embodiments, or an internal storage unit of the terminal device, such as a hard disk or a memory of an electronic device. The computer readable storage medium may also be an external storage device of the electronic device, such as a plug-in hard disk, a Smart Memory Card (SMC), a Secure Digital (SD) card, a flash card (flash card), and the like, which are provided on the electronic device. Further, the computer readable storage medium may also include both an internal storage unit and an external storage device of the electronic device. The computer-readable storage medium is used for storing the computer program and other programs and data required by the electronic device. The computer readable storage medium may also be used to temporarily store data that has been output or is to be output.
The terms "first", "second", "third", "fourth", and the like in the claims and in the description and drawings of the present application are used for distinguishing between different objects and not for describing a particular order. Furthermore, the terms "include" and "have," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus. Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments. The term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the examples described in connection with the embodiments disclosed herein may be embodied in electronic hardware, computer software, or combinations of both, and that the components and steps of the examples have been described in a functional general in the foregoing description for the purpose of illustrating clearly the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The method and the related apparatus provided by the embodiments of the present application are described with reference to the flowchart and/or the structural diagram of the method provided by the embodiments of the present application, and each flow and/or block of the flowchart and/or the structural diagram of the method, and the combination of the flow and/or block in the flowchart and/or the block diagram can be specifically implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block or blocks of the block diagram. These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block or blocks of the block diagram. These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block or blocks.

Claims (10)

1. A method of text processing, the method comprising:
acquiring a text to be understood, wherein the text to be understood comprises a question to be understood and a plurality of article fragments to be understood;
inputting the text to be understood into a reading understanding model, and determining question type labels to which the questions to be understood belong and question type labels of questions answered by the article fragments to be understood through a semantic analysis layer of the reading understanding model;
determining the feature labels of the characters in the text to be understood and the position labels of the characters through a semantic analysis layer of the reading understanding model;
determining a starting character position and an ending character position of an answer text of the question to be understood based on a question type label to which the question to be understood belongs, a question type label of a question answered by each article segment to be understood, a feature label of each character in the text to be understood and a position label of each character through a semantic matching layer of the reading understanding model;
and determining an answer text of the question to be understood from the text to be understood according to the starting character position and the ending character position.
2. The method of claim 1, wherein before entering the text to be understood into the reading understanding model, the method further comprises:
collecting a plurality of sample fragments of reading understanding texts, wherein the sample fragments comprise question fragments and answer fragments corresponding to the question fragments;
determining question type labels of the question fragments in the sample fragments and question type labels of the questions answered by the answer fragments;
determining the feature labels of the characters in the sample fragments and the position labels of the characters;
training a semantic analysis layer and a semantic matching layer of the reading understanding model based on the question type label of each question segment, the question type label of the question answered by each answer segment, the feature label of each character in the sample segment and the position label of each character.
3. The method according to claim 2, wherein the training of the semantic analysis layer and the semantic matching layer of the reading understanding model based on the question type label of the question fragment, the question type label of the question answered by the answer fragment, the feature label of each character in the sample fragment, and the position label of each character comprises:
obtaining a question type label of a question fragment included in any sample fragment, a question type label of a question answered by an answer fragment corresponding to the question fragment, a feature label of each character in any sample fragment and a position label of each character, and training a semantic matching layer of the reading understanding model to obtain a first semantic matching layer network parameter;
determining a score for the first semantic matching layer network parameters by a gated loop layer of the reading understanding model;
when the score of the first semantic matching layer network parameter is larger than or equal to a threshold value, determining the network parameter of the semantic matching layer as the first semantic matching layer network parameter through the gating circulating layer;
when the score of the first semantic matching layer network parameter is smaller than a threshold value, determining the network parameter of the semantic matching layer as a second semantic matching layer network parameter through the gating circulating layer;
the second semantic matching layer network parameters are semantic matching layer network parameters obtained after the semantic matching layer of the reading understanding model is trained based on question type labels to which question fragments included by previous sample fragments belong, question type labels to questions answered by answer fragments corresponding to the question fragments, feature labels of characters in the previous sample fragments and position labels of the characters, and the previous sample fragments are input before any sample fragment of the reading understanding model.
4. The method according to any one of claims 1 to 3, wherein the determining, by the semantic matching layer of the reading understanding model, the starting character position and the ending character position of the answer text of the question to be understood based on the question type label to which the question to be understood belongs, the question type label of the question answered by each article segment to be understood, the feature label of each character in the text to be understood, and the position label of each character comprises:
determining a plurality of preselected initial character positions and a plurality of preselected end character positions from the article text to be understood through a semantic matching layer of the reading understanding model based on the question type labels to which the questions to be understood belong, the question type labels of the questions answered by the article fragments to be understood, the feature labels of the characters in the text to be understood and the position labels of the characters so as to obtain a plurality of preselected answer texts;
determining scores of all the preselected answer texts for answering the questions to be understood based on the matching degree of all the preselected answer texts and the questions to be understood through the semantic matching layer;
and taking the preselected start character position and the preselected end character position of the preselected answer text with the highest score in the preselected answer texts as the start character position and the end character position of the answer text of the question to be understood.
5. The method according to claim 4, wherein the determining the answer text of the question to be understood from the text to be understood according to the starting character position and the ending character position comprises:
if the character distance between the initial character position and the terminal character position of the answer text of the question to be understood is within a threshold interval, determining the text between the initial character position and the terminal character position from the text to be understood as the answer text of the question to be understood, and outputting the answer text of the question to be understood.
6. The method of claim 2, wherein collecting a plurality of sample fragments of reading comprehension text comprises:
collecting a plurality of sample fragments of reading and understanding texts from the Internet; and/or
Collecting a plurality of sample fragments of reading understanding texts from a target domain database, wherein the target domain database at least comprises a medical domain database generated based on diagnosis and treatment data and pathological data of a medical domain;
wherein, each sample segment of the reading comprehension text comprises a question segment and an answer segment corresponding to the question segment.
7. A text processing apparatus, characterized in that the apparatus comprises:
the text acquisition module is used for acquiring a text to be understood, wherein the text to be understood comprises a question to be understood and a plurality of article fragments to be understood;
the classification marking module is used for inputting the text to be understood into a reading understanding model, and determining question type marks to which the questions to be understood belong and question type marks of questions answered by the article fragments to be understood through a semantic analysis layer of the reading understanding model;
the semantic annotation module is used for determining the feature annotation of each character in the text to be understood and the position annotation of each character through a semantic analysis layer of the reading understanding model;
and the semantic matching module is used for determining the initial character position and the final character position of the answer text of the question to be understood on the basis of the question type label to which the question to be understood belongs, the question type label of the question answered by each article segment to be understood, the feature label of each character in the text to be understood and the position label of each character through a semantic matching layer of the reading understanding model, and determining the answer text of the question to be understood from the text to be understood according to the initial character position and the final character position.
8. The apparatus of claim 7, wherein the semantic matching module comprises:
a text confirmation unit, configured to determine, through a semantic matching layer of the reading understanding model, a plurality of preselected start character positions and a plurality of preselected end character positions from the article text to be understood based on a question type label to which the question to be understood belongs, a question type label to which the question to be understood is answered by each article segment to be understood, a feature label of each character in the text to be understood, and a position label of each character, so as to obtain a plurality of preselected answer texts;
the answer scoring unit is used for determining scores of all the preselected answer texts for answering the questions to be understood based on the matching degree of all the preselected answer texts and the questions to be understood through the semantic matching layer;
and the answer confirmation unit is used for taking the preselected starting character position and the preselected ending character position of the preselected answer text with the highest score in the preselected answer texts as the starting character position and the ending character position of the answer text of the question to be understood.
9. A terminal device, characterized in that it comprises a processor and a memory, said processor and memory being interconnected, wherein said memory is adapted to store a computer program comprising program instructions, said processor being configured to invoke said program instructions to perform the method according to any one of claims 1-6.
10. A computer-readable storage medium, characterized in that the computer storage medium stores a computer program comprising program instructions that, when executed by a processor, cause the processor to perform the method according to any of claims 1-6.
CN202011501996.6A 2020-12-17 2020-12-17 Text processing method, device, equipment and storage medium Active CN112613322B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202011501996.6A CN112613322B (en) 2020-12-17 2020-12-17 Text processing method, device, equipment and storage medium
PCT/CN2021/097086 WO2022127040A1 (en) 2020-12-17 2021-05-31 Text processing method and apparatus, and device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011501996.6A CN112613322B (en) 2020-12-17 2020-12-17 Text processing method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112613322A true CN112613322A (en) 2021-04-06
CN112613322B CN112613322B (en) 2023-10-24

Family

ID=75241022

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011501996.6A Active CN112613322B (en) 2020-12-17 2020-12-17 Text processing method, device, equipment and storage medium

Country Status (2)

Country Link
CN (1) CN112613322B (en)
WO (1) WO2022127040A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113139033A (en) * 2021-05-13 2021-07-20 平安国际智慧城市科技股份有限公司 Text processing method, device, equipment and storage medium
WO2022127040A1 (en) * 2020-12-17 2022-06-23 平安科技(深圳)有限公司 Text processing method and apparatus, and device and storage medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6615172B1 (en) * 1999-11-12 2003-09-02 Phoenix Solutions, Inc. Intelligent query engine for processing voice based queries
US20090287678A1 (en) * 2008-05-14 2009-11-19 International Business Machines Corporation System and method for providing answers to questions
US20180286383A1 (en) * 2017-03-31 2018-10-04 Wipro Limited System and method for rendering textual messages using customized natural voice
CN110309305A (en) * 2019-06-14 2019-10-08 中国电子科技集团公司第二十八研究所 Machine based on multitask joint training reads understanding method and computer storage medium
CN110609886A (en) * 2019-09-18 2019-12-24 北京金山数字娱乐科技有限公司 Text analysis method and device
CN111027327A (en) * 2019-10-29 2020-04-17 平安科技(深圳)有限公司 Machine reading understanding method, device, storage medium and device
CN111046674A (en) * 2019-12-20 2020-04-21 科大讯飞股份有限公司 Semantic understanding method and device, electronic equipment and storage medium
CN111046158A (en) * 2019-12-13 2020-04-21 腾讯科技(深圳)有限公司 Question-answer matching method, model training method, device, equipment and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109992665A (en) * 2019-03-14 2019-07-09 广州智语信息科技有限公司 A kind of classification method based on the extension of problem target signature
CN112613322B (en) * 2020-12-17 2023-10-24 平安科技(深圳)有限公司 Text processing method, device, equipment and storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6615172B1 (en) * 1999-11-12 2003-09-02 Phoenix Solutions, Inc. Intelligent query engine for processing voice based queries
US20090287678A1 (en) * 2008-05-14 2009-11-19 International Business Machines Corporation System and method for providing answers to questions
US20180286383A1 (en) * 2017-03-31 2018-10-04 Wipro Limited System and method for rendering textual messages using customized natural voice
CN110309305A (en) * 2019-06-14 2019-10-08 中国电子科技集团公司第二十八研究所 Machine based on multitask joint training reads understanding method and computer storage medium
CN110609886A (en) * 2019-09-18 2019-12-24 北京金山数字娱乐科技有限公司 Text analysis method and device
CN111027327A (en) * 2019-10-29 2020-04-17 平安科技(深圳)有限公司 Machine reading understanding method, device, storage medium and device
CN111046158A (en) * 2019-12-13 2020-04-21 腾讯科技(深圳)有限公司 Question-answer matching method, model training method, device, equipment and storage medium
CN111046674A (en) * 2019-12-20 2020-04-21 科大讯飞股份有限公司 Semantic understanding method and device, electronic equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022127040A1 (en) * 2020-12-17 2022-06-23 平安科技(深圳)有限公司 Text processing method and apparatus, and device and storage medium
CN113139033A (en) * 2021-05-13 2021-07-20 平安国际智慧城市科技股份有限公司 Text processing method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN112613322B (en) 2023-10-24
WO2022127040A1 (en) 2022-06-23

Similar Documents

Publication Publication Date Title
CN111027327B (en) Machine reading understanding method, device, storage medium and device
CN109918560B (en) Question and answer method and device based on search engine
WO2021072852A1 (en) Sequence labeling method and system, and computer device
KR102271361B1 (en) Device for automatic question answering
CN110096572B (en) Sample generation method, device and computer readable medium
CN115599901B (en) Machine question-answering method, device, equipment and storage medium based on semantic prompt
CN112613322B (en) Text processing method, device, equipment and storage medium
CN116127056A (en) Medical dialogue abstracting method with multi-level characteristic enhancement
CN112132238A (en) Method, device, equipment and readable medium for identifying private data
CN112614559A (en) Medical record text processing method and device, computer equipment and storage medium
CN110633456B (en) Language identification method, language identification device, server and storage medium
CN115238026A (en) Medical text subject segmentation method and device based on deep learning
CN111145914A (en) Method and device for determining lung cancer clinical disease library text entity
CN113705207A (en) Grammar error recognition method and device
CN116595994A (en) Contradictory information prediction method, device, equipment and medium based on prompt learning
CN117113937A (en) Electric power field reading and understanding method and system based on large-scale language model
CN111400340A (en) Natural language processing method and device, computer equipment and storage medium
CN111949769B (en) Method and device for enhancing robustness of reading and understanding system
CN114676237A (en) Sentence similarity determining method and device, computer equipment and storage medium
CN113590786A (en) Data prediction method, device, equipment and storage medium
CN114220505A (en) Information extraction method of medical record data, terminal equipment and readable storage medium
CN113836297A (en) Training method and device for text emotion analysis model
CN110866390B (en) Method and device for recognizing Chinese grammar error, computer equipment and storage medium
US20230077874A1 (en) Methods and systems for determining missing slots associated with a voice command for an advanced voice interaction
Monson et al. Simulating morphological analyzers with stochastic taggers for confidence estimation

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
GR01 Patent grant
GR01 Patent grant