WO2022127040A1 - 文本处理方法、装置、设备及存储介质 - Google Patents

文本处理方法、装置、设备及存储介质 Download PDF

Info

Publication number
WO2022127040A1
WO2022127040A1 PCT/CN2021/097086 CN2021097086W WO2022127040A1 WO 2022127040 A1 WO2022127040 A1 WO 2022127040A1 CN 2021097086 W CN2021097086 W CN 2021097086W WO 2022127040 A1 WO2022127040 A1 WO 2022127040A1
Authority
WO
WIPO (PCT)
Prior art keywords
question
understood
text
character
segment
Prior art date
Application number
PCT/CN2021/097086
Other languages
English (en)
French (fr)
Inventor
吴天博
王健宗
程宁
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2022127040A1 publication Critical patent/WO2022127040A1/zh

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

Definitions

  • the present application relates to the field of natural language processing, and in particular, to a text processing method, apparatus, device and storage medium.
  • the reading comprehension model centered on natural language processing technology can help people to read comprehension and answer questions.
  • Fragment extraction-like reading comprehension is a task in natural language processing. It can extract target information from a large number of text materials well, and can ensure that the output results are sentences in the text materials.
  • the inventor realized that, at present, the construction of the fragment extraction class reading comprehension model is mainly based on the bidirectional encoding representation translation (Bidirectional Encoder Representations from Transformers, Bert) technology.
  • Bert model can show a good result in most language training tasks.
  • questions and articles are semantically encoded in the Bert model based on vocabulary.
  • the Bert model cannot reasonably analyze the meaning of the question through the vocabulary encoding. And because the question length is limited, it is difficult for the Bert model to find the relationship between the various questions through lexical coding, so that the answers given by the reading comprehension model are poorly targeted and the efficiency of reading comprehension is low.
  • the embodiments of the present application provide a text processing method, device, device, and storage medium, which can be marked based on the question type of the text to be understood, so as to obtain the association between the question to be understood and the article to be understood in the question type, which can improve the efficiency of reading comprehension and accuracy, high applicability.
  • the embodiments of the present application provide a text processing method, the method comprising:
  • the semantic matching layer of the above-mentioned reading comprehension model is based on the question type labeling of the above-mentioned question to be understood, the question type labeling of the question answered by each of the above-mentioned to-be-understood article segments, the characteristic labeling of each character in the above-mentioned to-be-understood text, and the position of each of the above-mentioned characters Labeling, to determine the starting character position and ending character position of the answer text of the above-mentioned question to be understood;
  • the answer text for the above-mentioned question to be understood is determined from the above-mentioned to-be-understood text according to the above-mentioned starting character position and the above-mentioned ending character position.
  • an embodiment of the present application provides a text processing device, the device comprising:
  • a text acquisition module used to acquire text to be understood, where the text to be understood includes questions to be understood and a plurality of fragments of articles to be understood;
  • a semantic labeling module configured to determine, through the semantic analysis layer of the above-mentioned reading comprehension model, the characteristic labeling of each character in the above-mentioned to-be-understood text and the position labeling of each of the above-mentioned characters;
  • the semantic matching module is used for labeling the question type to which the above-mentioned question to be understood belongs, the question type labeling of the question answered by each of the above-mentioned article segments to be understood, and the characteristic labeling of each character in the above-mentioned to-be-understood text through the semantic matching layer of the above-mentioned reading comprehension model. And the position label of each above-mentioned character, determine the starting character position and the ending character position of the answer text of the above-mentioned question to be understood, and determine the above-mentioned question to be understood from the above-mentioned text to be understood according to the above-mentioned starting character position and the above-mentioned ending character position 's answer text.
  • 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 used to store a computer program that supports the terminal device to execute the method provided by the first aspect and/or any possible implementation manner of the first aspect, the computer program includes program instructions, and the processor is configured to call the above-mentioned method Program instructions that execute the following methods:
  • the semantic matching layer of the above-mentioned reading comprehension model is based on the question type labeling of the above-mentioned question to be understood, the question type labeling of the question answered by each of the above-mentioned to-be-understood article segments, the characteristic labeling of each character in the above-mentioned to-be-understood text, and the position of each of the above-mentioned characters Labeling, to determine the starting character position and ending character position of the answer text of the above-mentioned question to be understood;
  • the answer text for the above-mentioned question to be understood is determined from the above-mentioned to-be-understood text according to the above-mentioned starting character position and the above-mentioned ending character position.
  • an embodiment of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, the computer program includes program instructions, and the program instructions, when executed by a processor, cause the processor to execute The following methods:
  • the semantic matching layer of the above-mentioned reading comprehension model is based on the question type labeling of the above-mentioned question to be understood, the question type labeling of the question answered by each of the above-mentioned to-be-understood article segments, the characteristic labeling of each character in the above-mentioned to-be-understood text, and the position of each of the above-mentioned characters Labeling, to determine the starting character position and ending character position of the answer text of the above-mentioned question to be understood;
  • FIG. 2 is a schematic flowchart of training a reading comprehension model provided by an embodiment of the present application
  • FIG. 3 is another schematic flowchart of a text processing method provided by an embodiment of the present application.
  • FIG. 4 is a schematic structural diagram of a text processing apparatus provided by an embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of a terminal device provided by an embodiment of the present application.
  • the technical solutions of the present application may relate to the technical field of artificial intelligence and/or big data, for example, may specifically relate to natural language processing technology.
  • the present application can be applied to scenarios such as text processing, such as text annotation, to improve reading comprehension efficiency and accuracy, thereby promoting the construction of smart cities.
  • the data involved in this application such as various texts and/or annotation information, may be stored in a database, or may be stored in a blockchain, which is not limited in this application.
  • Natural language processing is an important direction in the field of computer science and artificial intelligence. Natural language processing mainly studies various theories and methods that can realize effective communication between humans and computers using natural language. However, it is very difficult to implement natural language processing, and the root cause of the difficulty is the wide variety of ambiguities or ambiguities at various levels of natural language texts and dialogues. Therefore, natural language processing must disambiguate, that is, it needs to convert the natural language input with potential ambiguity into some unambiguous internal representation of the computer. Many machine learning algorithms have been applied to perform natural language processing tasks, but these algorithms usually rely on blunt rule-like matching. Therefore, more and more researches focus on natural language processing models, which give different weights to each reasoning element and make decisions based on the final calculated probabilities.
  • the Bert model as the current mainstream natural language processing model, can show a good result in most language training tasks (for example, machine reading comprehension (MRC) tasks). Therefore, the Bert model can be used as a reading comprehension model to answer questions according to a given context, and test the understanding of the reading comprehension model to natural language texts.
  • MRC tasks can be divided into four types: cloze, multiple choice, fragment extraction, and free answer.
  • the fragment extraction class reading comprehension model can well extract the target information that the user wants to pay attention to from a large number of text materials, and can ensure that the output results are the original sentences of the material, which is greatly reduced compared with methods that require manual maintenance of regular expressions.
  • the cost of running a reading comprehension model Generally, a reading comprehension model consists of the following parts: Embedding, Feature Extraction, Context-Question Interaction, and Answer Prediction.
  • the methods provided by the embodiments of the present application can be executed by a system or a terminal device loaded with a text processing function based on a reading comprehension model. For convenience of expression, the text processing methods provided by the embodiments of the present application will be described below with the terminal device as the execution subject. .
  • the terminal device can improve or reconstruct the commonly used reading comprehension model (such as the Bert model).
  • the application scenario is determined, and there is no restriction here.
  • the reading comprehension model includes but is not limited to the semantic analysis layer and the semantic matching layer
  • the categories of medical problems include but are not limited to "pneumonia”, “bronchitis”, “upper respiratory tract infection”, “pulmonary tuberculosis”, “asthma” ” and other diseases
  • the specific categories of medical problems include but are not limited to location problems, time problems, people problems, event problems, cause problems, and method problems.
  • the terminal device annotating the question category of each sample segment includes annotating the question type to which the question segment in each sample segment belongs, and annotating the question type to which a question segment belongs as the question type answered by the answer segment corresponding to the question segment.
  • the terminal device marks the question type of question segment 1 (for example, how to treat a cold?) as "upper respiratory tract infection” and "method question”, and the answer segment 1 corresponding to question segment 1 (for example, advise the patient to rest in bed, light Diet) question types are labeled "Upper Respiratory Tract Infection" and "Method Questions”.
  • the terminal device semantically labels the question segment 1 (how to treat a cold?) as: Sense (gan, 13, [1]) Mao (mao, 9, [2]) such as (ru, 6, [3]) He (he , 7, [4]) treatment (zhi, 8, [5]) treatment (liao, 7, [6])? (##, #, [7]).
  • the terminal device adds a separator between the question segment 1 and the answer segment 1 (located at [8]), and at the same time marks the answer segment 1 corresponding to the question segment 1 (the patient is advised to rest in bed and have a light diet) semantically as follows: Jian (jian, 8, [9]) discuss (yi, 5, [10]) suffer from (huan, 11, [11]) (zhe, 8, [12]) lie on (wo, 8, [13]) bed (chuang, 7, [14]) rest (xiu, 6, [15]) rest (xi, 10, [16]), clear (qing, 11, [17]) light (dan, 12, [18]) drink (yin) , 7, [19]) eat (shi, 9, [20]).
  • the terminal device acquires the text to be understood, and uses the trained reading comprehension model to perform question type annotation and semantic annotation on the text to be understood.
  • the question types of question 1 to be understood (how to treat a cold?) are marked as "upper respiratory tract infection” and "method question”, and the reading comprehension model is used to label fragment 1 of the article to be understood (cold is a common acute upper respiratory tract virus) sexually Infectious Diseases), the question types for the questions answered are labeled "Upper Respiratory Tract Infections" and "Other Questions”.
  • the semantically annotated to-be-understood article fragment 1 can be obtained: Sense (gan, 13, [9]) Mao (mao, 9, [10]) Yes (shi, 9, [11]) One (yi, 1, [12]) species (zhong, 9, [13]) often (chang, 11, [14]) see (jian, 4, [15]) of (de, 8, [16]) Urgent (ji, 9, [17]) sex (xing, 8, [18]) up (shang, 3, [19]) exhale (hu, 8, [20]) inhale (xi, 6, [21]) Dao (dao, 11, [22]) disease (bing, 9, [23]) poison (du, 9, [24]) sex (xing, 8, [25]) sense (gan, 13, [26]) Dyeing (ran, 9, [27]) sexual (xing, 8, [28]) disease (ji, 10, [29]) disease
  • a separator (position [31]) is added between the to-be-understood article segment 1 and the to-be-understood article segment 2 to distinguish the to-be-understood article segment 1 from the to-be-understood article segment 2.
  • the semantically annotated to-be-understood article fragment 2 can be obtained: Jian (jian, 8, [32]) and suggestion (yi, 5, [33]) Suffering (huan, 11, [34]) Person (zhe, 8, [35]) lying (wo, 8, [36]) bed (chuang, 7, [37]) resting (xiu, 6, [38]) resting (xi, 10, [39]) , Qing (qing, 11, [40]) light (dan, 12, [41]) drink (yin, 7, [42]) food (shi, 9, [43]).
  • the terminal device acquires the text to be understood, and the text to be understood includes the question to be understood (for example, question 1 to be understood, etc.) and a plurality of fragments of the article to be understood (for example, the fragment of the article to be understood 1, to be understood) Article Fragment 2, etc.).
  • the terminal device can acquire the to-be-understood text including the to-be-understood question 1 (for example, how to treat a cold?), the to-be-understood article segment 1 (for example, the cold is a common acute upper respiratory tract viral infection) and the to-be-understood article Fragment 2 (recommend patient bed rest and light diet).
  • the terminal device may input the text to be understood into the trained reading comprehension model, and perform question type annotation and semantic annotation on the text to be understood through the semantic analysis layer of the reading comprehension model.
  • the question types of the questions answered by question 1 to be understood (how to treat a cold?) can be marked as "upper respiratory tract infection” and “method question”, and the segment 1 of the article to be understood (cold is a A common acute upper respiratory tract viral infectious disease), the question types are marked as "upper respiratory tract infection” and “other questions”, and the question types of the questions answered in fragment 2 of the article to be understood (recommended bed rest, light diet) Labeled as "Upper Respiratory Infection” and "Methodological Questions”.
  • S103 Determine, through the semantic analysis layer of the reading comprehension model, the feature labels of the characters in the text to be understood and the position labels of the characters.
  • the semantic analysis layer of the reading comprehension model can simultaneously perform feature annotation on each character in the text to be understood and annotate the position of each character, so as to obtain the annotated questions to be understood and each to-be-understood article segment .
  • the above-mentioned semantic labeling includes, but is not limited to, feature labeling of each character in the sample segment, and labeling of the position of each character.
  • the semantically labeled question to be understood 1 sense ( gan, 13, [1]) take (mao, 9, [2]) such as (ru, 6, [3]) and He (he, 7, [4]) to treat (zhi, 8, [5]) to treat ( liao, 7, [6])? (##, #, [7]).
  • sense gan, 13, [1]
  • take mao, 9, [2]
  • He He
  • he, 7, [4] He
  • zhi, 8, [5] to treat
  • liao, 7, [6] liao, 7, [6]
  • Add a separator between the question 1 to be understood and the article segment 1 to be understood located in [8]).
  • the semantically annotated to-be-understood article fragment 1 can be obtained: Sense (gan, 13, [9]) Mao (mao, 9, [10]) Yes (shi, 9, [11]) One (yi, 1, [12]) species (zhong, 9, [13]) often (chang, 11, [14]) see (jian, 4, [15]) of (de, 8, [16]) Urgent (ji, 9, [17]) sex (xing, 8, [18]) up (shang, 3, [19]) exhale (hu, 8, [20]) inhale (xi, 6, [21]) Dao (dao, 11, [22]) disease (bing, 9, [23]) poison (du, 9, [24]) sex (xing, 8, [25]) sense (gan, 13, [26]) Dyeing (ran, 9, [27]) sexual (xing, 8, [28]) disease (ji, 10, [29]) disease
  • a separator (position [31]) is added between the to-be-understood article segment 1 and the to-be-understood article segment 2 to distinguish the to-be-understood article segment 1 from the to-be-understood article segment 2.
  • the semantically annotated to-be-understood article fragment 2 can be obtained: Jian (jian, 8, [32]) and suggestion (yi, 5, [33]) Suffering (huan, 11, [34]) person (zhe, 8, [35]) lying (wo, 8, [36]) bed (chuang, 7, [37]) resting (xiu, 6, [38]) resting (xi, 10, [39]) , Qing (qing, 11, [40]) light (dan, 12, [41]) drink (yin, 7, [42]) food (shi, 9, [43]).
  • FIG. 2 is a schematic flowchart of training a reading comprehension model provided by an embodiment of the present application.
  • the above-mentioned method for training a reading comprehension model may include the implementations provided by each of the following steps S201 to S208.
  • the terminal device collects a plurality of sample segments of the reading comprehension text.
  • the method for the terminal device to collect multiple sample segments of reading comprehension text may include, but is not limited to, the terminal device collecting multiple sample segments of reading comprehension text from the Internet, and the sample segments include question segments (for example, question segments). Fragment 1, Question Fragment 2, etc.), and the corresponding answer fragment (eg, Answer Fragment 1, Answer Fragment 2, etc.) of the question fragment in the Article Fragment.
  • question segments for example, question segments.
  • the corresponding answer fragment eg, Answer Fragment 1, Answer Fragment 2, etc.
  • S202 The terminal device determines the question type label to which each question segment in each sample segment belongs, and the question type label of the question answered by each answer segment.
  • the terminal device may annotate each sample segment with a problem category, so as to obtain a classified and annotated sample segment.
  • the terminal device may label each sample segment with the question category, including labeling the question type to which the question segment in each sample segment belongs, and labeling the question type to which a question segment belongs as the question type answered by the answer segment corresponding to the question segment. . Mark the question types of question fragment 1 (how to treat a cold?) as "upper respiratory tract infection” and "method question”, and mark the question type of answer fragment 1 (recommended bed rest and light diet) corresponding to question fragment 1 as " Upper Respiratory Tract Infections" and "Methodological Issues”.
  • the terminal device can mark the question type of question segment 2 (what causes lung inflammation?) as “pneumonia” and “cause problem”, and label the answer segment 2 corresponding to question segment 2 (acute and chronic respiratory tract infection, bronchial infection) as “pneumonia” and “cause problem”. pneumonia, colds, and even other bacterial infections or infectious diseases can cause inflammation of the lungs.)
  • the problem types are marked as “pneumonia” and "cause problems”.
  • S203 The terminal device determines the feature labeling of each character in each of the sample segments and the location labeling of each of the above-mentioned characters.
  • a separator is added between the question segment 1 and the answer segment 1 (located at [8]), and the answer segment 1 corresponding to the question segment 1 (recommended bed rest, light diet) is semantically marked as: Jian (jian, 8, [9]) It is suggested that (yi, 5, [10]) suffer from (huan, 11, [11]) (zhe, 8, [12]) lying on (wo, 8, [13]) bed (chuang, 7, [14]) rest (xiu, 6, [15]) breath (xi, 10, [16]), clear (qing, 11, [17]) light (dan, 12, [18]) drink (yin, 7 , [19]) eat (shi, 9, [20]).
  • the terminal device annotates the question type to which each of the above-mentioned question segments belongs, the question type of the question answered by each of the above-mentioned answer segments, the characteristic annotation of each character in the above-mentioned sample segment, and the location of each of the above-mentioned characters, into the semantic analysis layer and the semantic matching layer.
  • the gated loop layer obtains the network parameters of the first semantic matching layer obtained by training the semantic matching layer of the above-mentioned reading comprehension model based on any sample segment.
  • the gated recurrent layer determines the score of the network parameter of the first semantic matching layer.
  • the gated loop layer can obtain the semantic matching layer network parameters of the semantic matching layer (assuming the first Semantic matching layer network parameters).
  • the scores of the network parameters of the semantic matching layer are determined through the gated recurrent layer, and the scores of the network parameters of the semantic matching layer are judged.
  • the gated loop layer determines the network parameter of the semantic matching layer as the network parameter of the first semantic matching layer through its update gate.
  • the gated loop layer determines the network parameter of the semantic matching layer as the second semantic matching layer network parameter by resetting the gate.
  • the network parameters of the second semantic matching layer are based on the question type label of the question segment included in the previous sample segment, the question type label of the question answered by the answer segment corresponding to the above question segment, and the character in the previous sample segment.
  • the feature labeling and the location labeling of the above characters are the semantic matching layer network parameters obtained after training the semantic matching layer of the above reading comprehension model.
  • the preceding sample segment is a sample segment that is input to the above-mentioned reading comprehension model before any of the above-mentioned sample segments, and is used for training the above-mentioned semantic matching layer.
  • the gated loop layer can acquire the semantic matching layer network parameters of the semantic matching layer (assuming the network parameters of the first semantic matching layer) and store them in the gate
  • the network parameters of the semantic matching layer after the n sample segments stored in the gated loop layer are input into the semantic matching layer to comprehensively score, and The comprehensive score of the above semantic matching layer network parameters is judged.
  • the gated loop layer determines the network parameters of the semantic matching layer as the network parameters of the first semantic matching layer through the update gate.
  • the gated loop layer determines the network parameters of the semantic matching layer as the network parameters of the second semantic matching layer by resetting the gate.
  • the network parameters of the second semantic matching layer are based on the question type label of the question segment included in the previous sample segment, the question type label of the question answered by the answer segment corresponding to the above question segment, and the character in the previous sample segment.
  • Feature annotations and the position annotations of the above characters, the semantic matching layer network parameters obtained after training the semantic matching layer of the above reading comprehension model, the above-mentioned previous sample fragments are the samples input to the above-mentioned reading comprehension model before the above n sample fragments Fragment.
  • S104 Determine the starting character position and the ending character position of the answer text for the question to be understood based on the marked text to be understood through the semantic matching layer of the reading comprehension model, and determine the answer text for the question to be understood.
  • the marked question to be understood and each segment of the article to be understood are input into the reading comprehension model for semantic matching, and the starting character position of the answer text of the question to be understood is determined in the article to be understood by the reading comprehension model. ([32]) and termination character positions ([43]) to get the answer text for the question to be understood (the patient is advised to rest in bed and eat lightly).
  • the semantics of the question to be understood and the article to be understood can be enhanced in the dimension of question type.
  • the relevance of each character in the to-be-understood text after the question type is determined, and input the feature label and position label to the semantic matching layer, so that the semantic matching layer can perform character-level reading comprehension on the to-be-understood text.
  • the starting character position and the ending character position of the answer text of the question to be understood are obtained, so as to obtain the answer text of the above question to be understood, and the accuracy of reading comprehension is improved.
  • S301 The terminal device obtains the text to be understood.
  • the terminal device acquires the text to be understood, and the text to be understood includes the question to be understood (for example, question 1 to be understood, etc.) and a plurality of fragments of the article to be understood (for example, the fragment of the article to be understood 1, to be understood) Article Fragment 2, etc.).
  • the terminal device can obtain the to-be-understood text including the to-be-understood question 1 (how to treat a cold?), the to-be-understood article segment 1 (a common cold is a common acute upper respiratory tract viral infection), and the to-be-understood article segment 2 (suggestion The patient is on bed rest and has a light diet).
  • the length of the article to be understood may be relatively long, which is greater than the length range limited by the reading comprehension model, then the article to be understood can be divided into multiple fragments of the article to be understood, and each fragment of the article to be understood is associated with the question to be understood. Combination, and then input the reading comprehension model for reading comprehension. Specifically, it can be determined according to the actual application scenario, and is not limited here.
  • the terminal device may input the text to be understood into the trained reading comprehension model, and perform question type annotation and semantic annotation on the text to be understood through the semantic analysis layer of the reading comprehension model.
  • the question types of the to-be-understood question 1 (how to treat a cold?) can be marked as "upper respiratory tract infection” and "method question”
  • the to-be-understood article fragment 1 (cold is a common acute upper respiratory tract viral infectious disease)
  • the question types of the questions answered are marked as “upper respiratory tract infection” and “other questions”
  • the question types of the questions answered in fragment 2 of the article to be understood (recommended bed rest, light diet) Labeled as "Upper Respiratory Infection” and "Methodological Questions”.
  • the semantically annotated to-be-understood article fragment 1 can be obtained: Sense (gan, 13, [9]) Mao (mao, 9, [10]) Yes (shi, 9, [11]) One (yi, 1, [12]) species (zhong, 9, [13]) often (chang, 11, [14]) see (jian, 4, [15]) of (de, 8, [16]) Urgent (ji, 9, [17]) sex (xing, 8, [18]) up (shang, 3, [19]) exhale (hu, 8, [20]) inhale (xi, 6, [21]) Dao (dao, 11, [22]) disease (bing, 9, [23]) poison (du, 9, [24]) sex (xing, 8, [25]) sense (gan, 13, [26]) Dyeing (ran, 9, [27]) sexual (xing, 8, [28]) disease (ji, 10, [29]) disease
  • the semantically annotated to-be-understood article fragment 2 can be obtained: Jian (jian, 8, [32]) and suggestion (yi, 5, [33]) Suffering (huan, 11, [34]) Person (zhe, 8, [35]) lying (wo, 8, [36]) bed (chuang, 7, [37]) resting (xiu, 6, [38]) resting (xi, 10, [39]) , Qing (qing, 11, [40]) light (dan, 12, [41]) drink (yin, 7, [42]) food (shi, 9, [43]).
  • S304 Use the semantic matching layer of the reading comprehension model based on the question type annotation to which the above-mentioned question to be understood belongs, the question type annotation of the question answered by each to-be-understood article segment, the feature annotation of each character in the above-mentioned to-be-understood text, and the above-mentioned character annotation of each character.
  • Position marking determining a plurality of pre-selected starting character positions and a plurality of pre-selected ending character positions from the above-mentioned to-be-understood article text, so as to obtain a plurality of pre-selected answer texts.
  • S305 Determine the score of each preselected answer text for answering the above to be understood question based on the matching degree of each preselected answer text and the above to-be-understood question through the above-mentioned semantic matching layer.
  • the preselected answer text and the question to be understood can be vectorized into a matrix, and the similarity between the two matrices can be calculated as the matching degree between the preselected answer text and the question to be understood.
  • the preselected answer text and the question to be understood can be vectorize the preselected answer text and the question to be understood, and calculate the feature matrix of the question to be understood.
  • the meaning represented by the feature matrix can be the keywords in the question to be understood.
  • the similarity of the feature matrix of the understanding question is used as the matching degree between the pre-selected answer text and the question to be understood.
  • S306 Use the pre-selected starting character position and the pre-selected ending character position of the pre-selected answer text with the highest score among the above-mentioned pre-selected answer texts as the starting character position and the ending character position of the above-mentioned answer text of the question to be understood, so as to obtain the above-mentioned question to be understood 's answer text.
  • the character distance between the starting character position and the ending character position of the answer text of the above-mentioned question to be understood is within a threshold range, and if so, then according to the above-mentioned starting character position and the above-mentioned ending character position from
  • the answer text of the question to be understood is determined from the text to be understood, and the answer text of the question to be understood is output; if not, the output answer text does not exist.
  • the length of the answer text can be further limited, and the information irrelevant to the question to be understood in the answer text can be eliminated, thereby reducing the redundancy of the answer text and further improving the efficiency of reading comprehension.
  • the semantics of the question to be understood and the article to be understood can be enhanced in the dimension of question type.
  • the relevance of each character in the to-be-understood text after the question type is determined, and input the feature label and position label to the semantic matching layer, so that the semantic matching layer can perform character-level reading comprehension on the to-be-understood text.
  • the starting character position and the ending character position of the answer text of the question to be understood are obtained, so as to obtain the answer text of the above question to be understood, and the accuracy of reading comprehension is improved.
  • FIG. 4 is a schematic structural diagram of a text processing apparatus provided by an embodiment of the present application.
  • the text acquisition module 401 is configured to acquire the text to be understood, and the text to be understood includes the question to be understood and a plurality of article segments to be understood.
  • the text to be understood is obtained through the text obtaining module 401 , and the above-mentioned text to be understood includes the question to be understood and a plurality of article segments to be understood.
  • the text acquisition module 401 acquires the to-be-understood text including the to-be-understood question 1 (how to treat a cold?), the to-be-understood article segment 1 (a common cold is a common acute upper respiratory tract viral infection), and the to-be-understood article segment 2 ( Patients are advised to stay in bed and eat a light diet).
  • the length of the article to be understood may be relatively long, which is greater than the length range limited by the reading comprehension model, then the article to be understood can be divided into multiple fragments of the article to be understood, and each fragment of the article to be understood is associated with the question to be understood. Combination, and then input the reading comprehension model for reading comprehension. Specifically, it can be determined according to the actual application scenario, and is not limited here.
  • question type annotation and semantic annotation can be performed on the text to be understood through the classification and annotation module 402 .
  • Mark the question types of question 1 to be understood (how to treat a cold?) as “upper respiratory tract infection” and “method question”
  • mark the question type of question to be understood 1 (cold is a common acute upper respiratory tract viral infection)
  • the question types for answering the questions are marked as “upper respiratory tract infection” and “other questions”
  • the question types of the questions answered in fragment 2 of the article to be understood are marked as “upper respiratory tract infection” and “method questions”.
  • the semantic labeling module 403 is configured to determine, through the semantic analysis layer of the reading comprehension model, the feature labeling of each character in the text to be understood and the location labeling of each character.
  • the semantic labeling module 403 can simultaneously perform feature labeling of each character in the text to be understood and label the position of each character to obtain the labelled question to be understood and each segment of the article to be understood.
  • the above-mentioned semantic annotation includes, but is not limited to, feature annotation of each character in the sample segment, and annotation of the position of each character.
  • the question to be understood after semantic labeling can be obtained 1: Sense (gan, 13, [1]) take (mao, 9, [2]) as (ru, 6, [3]) and He (he, 7, [4]) treat (zhi, 8, [5]) (liao, 7, [6])? (##, #, [7]). Add a separator between the question 1 to be understood and the article segment 1 to be understood (located in [8]).
  • the semantically annotated to-be-understood article fragment 2 can be obtained: Jian (jian, 8, [32]) and suggestion (yi, 5, [33]) Suffering (huan, 11, [34]) Person (zhe, 8, [35]) lying (wo, 8, [36]) bed (chuang, 7, [37]) resting (xiu, 6, [38]) resting (xi, 10, [39]) , Qing (qing, 11, [40]) light (dan, 12, [41]) drink (yin, 7, [42]) food (shi, 9, [43]).
  • the semantic matching module 404 is configured to use the semantic matching layer of the above-mentioned reading comprehension model based on the question type annotation to which the above-mentioned question to be understood belongs, the question type annotation of the question answered by each of the above-mentioned to-be-understood article fragments, and the characteristics of each character in the above-mentioned to-be-understood text Labeling and the position labeling of the above-mentioned characters, determine the starting character position and the ending character position of the answer text of the above-mentioned question to be understood, and determine the above-mentioned to-be-understood text from the above-mentioned to-be-understood text according to the above-mentioned starting character position and the above-mentioned ending character position The answer text for the question.
  • the semantic matching module 404 may perform matrix vectorization on the preselected answer text and the question to be understood, and calculate the similarity of the two matrices as the matching degree between the preselected answer text and the question to be understood.
  • the above-mentioned semantic matching module 404 includes:
  • a text confirmation unit used for labeling the question type to which the above-mentioned question to be understood belongs, the question type labeling of the question answered by each piece of the article to be understood, the characteristic labeling of each character in the above-mentioned to-be-understood text through the semantic matching layer of the above-mentioned reading comprehension model, and For the position labeling of the above-mentioned characters, a plurality of pre-selected starting character positions and a plurality of pre-selected ending character positions are determined from the above-mentioned text of the article to be understood, so as to obtain a plurality of pre-selected answer texts.
  • the answer scoring unit is configured to determine the score of each preselected answer text for answering the above to be understood question based on the matching degree of each preselected answer text and the above to-be-understood question through the above-mentioned semantic matching layer.
  • the answer confirmation unit is used to use the pre-selected starting character position and the pre-selected ending character position of the pre-selected answer text with the highest score in the above-mentioned pre-selected answer texts as the starting character position and the ending character position of the answer text of the above-mentioned question to be understood, to obtain The text of the answer to the question to be understood above.
  • the above-mentioned semantic matching module 404 further includes:
  • the answer output unit is used to determine the above-mentioned starting character position and the above-mentioned ending character position from the above-mentioned to-be-understood text if the character distance between the starting character position and the ending character position of the answer text of the above-mentioned question to be understood is within the threshold interval
  • the text in between is used as the answer text of the above-mentioned question to be understood, and the answer text of the above-mentioned question to be understood is output.
  • the semantics of the question to be understood and the article to be understood can be enhanced in the dimension of question type.
  • the relevance of each character in the to-be-understood text after the question type is determined, and input the feature label and position label to the semantic matching layer, so that the semantic matching layer can perform character-level reading comprehension on the to-be-understood text.
  • the starting character position and the ending character position of the answer text of the question to be understood are obtained, so as to obtain the answer text of the above question to be understood, and the accuracy of reading comprehension is improved.
  • FIG. 5 is a schematic structural diagram of a terminal device provided by an embodiment of the present application.
  • the terminal device in this embodiment may include: one or more processors 501 and a memory 502 .
  • the above-mentioned processor 501 and memory 502 are connected through a bus 503 .
  • the memory 502 is used to store a computer program
  • the computer program includes program instructions
  • the processor 501 is used to execute the program instructions stored in the memory 502, and perform the following operations:
  • the semantic matching layer of the above-mentioned reading comprehension model is based on the question type labeling of the above-mentioned question to be understood, the question type labeling of the question answered by each of the above-mentioned to-be-understood article segments, the characteristic labeling of each character in the above-mentioned to-be-understood text, and the position of each of the above-mentioned characters Labeling, to determine the starting character position and ending character position of the answer text of the above-mentioned question to be understood;
  • the answer text for the above-mentioned question to be understood is determined from the above-mentioned to-be-understood text according to the above-mentioned starting character position and the above-mentioned ending character position.
  • the above-mentioned processor 501 is also used for:
  • the semantic analysis layer of the above-mentioned reading comprehension model and The semantic matching layer is trained.
  • the semantic matching layer can perform character-level reading comprehension on the text to be understood, and obtain the starting characters of the answer text for the question to be understood in the text to be understood position and terminal character position, so as to obtain the answer text of the above-mentioned question to be understood, and further improve the accuracy of reading comprehension.
  • the above-mentioned processor 501 is used for:
  • the network parameter of the semantic matching layer is determined as the network parameter of the first semantic matching layer through the gated loop layer;
  • the network parameter of the semantic matching layer is determined as the network parameter of the second semantic matching layer through the gated loop layer;
  • the network parameters of the second semantic matching layer are based on the question type label of the question segment included in the previous sample segment, the question type label of the question answered by the answer segment corresponding to the above question segment, and the character in the previous sample segment.
  • Feature annotations and the position annotations of the above characters, the semantic matching layer network parameters obtained after training the semantic matching layer of the above reading comprehension model, the above-mentioned previous sample fragment is the sample input into the above-mentioned reading comprehension model before any of the above-mentioned sample fragments Fragment.
  • the sample segments with low quality can be eliminated, and the sample segments that do not contribute much to the training of the semantic matching layer can be eliminated, so that the semantic The network parameters of the matching layer are more accurate, thereby improving the training efficiency of the semantic matching layer and further improving the accuracy of reading comprehension.
  • the above-mentioned processor 501 is used for:
  • the semantic matching layer of the above-mentioned reading comprehension model is based on the question type labeling of the above-mentioned question to be understood, the question type labeling of the question answered by each to-be-understood article segment, the feature labeling of each character in the above-mentioned to-be-understood text, and the position labeling of the above-mentioned characters , determine a plurality of pre-selected starting character positions and a plurality of pre-selected ending character positions from the above-mentioned to-be-understood article text, so as to obtain a plurality of pre-selected answer texts;
  • the pre-selected starting character position and the pre-selected ending character position of the pre-selected answer text with the highest score in the above-mentioned pre-selected answer texts are used as the starting character position and ending character position of the above-mentioned answer text of the question to be understood, so as to obtain the answer to the above-mentioned question to be understood text.
  • the above-mentioned processor 501 is used for:
  • the text between the above-mentioned starting character position and the above-mentioned ending character position is determined from the above-mentioned to-be-understood text as the above-mentioned text.
  • the answer text of the question to be understood, and the answer text of the above question to be understood is output.
  • the above-mentioned processor 501 is used for:
  • the target domain database at least includes a medical domain database generated based on diagnosis and treatment data and pathological data in the medical domain;
  • the sample segments of each reading comprehension text include question segments and answer segments corresponding to the question segments.
  • the above-mentioned processor 501 may be a central processing unit (central processing unit, CPU), and the processor may also be other general-purpose processors, digital signal processors (digital signal processors, DSP), dedicated integrated Circuit (application specific integrated circuit, ASIC), off-the-shelf programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
  • a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
  • the memory 502 may include read only memory and random access memory, and provides instructions and data to the processor 501 .
  • a portion of memory 502 may also include non-volatile random access memory.
  • memory 502 may also store device type information.
  • the above-mentioned terminal device can execute the implementation manners provided by the respective steps in the above-mentioned FIG. 1 to FIG. 3 through various built-in function modules.
  • the implementation manners provided by the above-mentioned respective steps please refer to the implementation manners provided by the above-mentioned respective steps, which will not be repeated here.
  • the semantics of the question to be understood and the article to be understood can be enhanced in the dimension of question type.
  • the relevance of each character in the to-be-understood text after the question type is determined, and input the feature label and position label to the semantic matching layer, so that the semantic matching layer can perform character-level reading comprehension on the to-be-understood text.
  • the starting character position and the ending character position of the answer text of the question to be understood are obtained, so as to obtain the answer text of the above question to be understood, and the accuracy of reading comprehension is improved.
  • Embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and the computer program includes program instructions.
  • the program instructions are executed by a processor, each step in FIG. 1 to FIG. 3 is implemented.
  • the storage medium involved in this application such as a computer-readable storage medium, may be non-volatile or volatile.
  • 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 device to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing device produce a function
  • These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory result in an article of manufacture comprising instruction means, the instructions
  • the apparatus implements the functions specified in one or more of the flowcharts and/or one or more blocks of the structural diagram.
  • These computer program instructions can also be loaded on a computer or other programmable data processing device to cause a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process such that The instructions provide steps for implementing the functions specified in the block or blocks of the flowchart and/or structural representation.

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

一种文本处理方法、装置、设备及存储介质,包括:获取待理解文本,待理解文本包括待理解问题和多个待理解文章片段;将所述待理解文本输入阅读理解模型,通过所述阅读理解模型的语义分析层确定出所述待理解问题所属的问题类型标注,各待理解文章片段所回答问题的问题类型标注,所述待理解文本中各字符的特征标注以及所述各字符的位置标注;通过所述阅读理解模型的语义匹配层确定所述待理解问题的回答文本的起始字符位置和终止字符位置,并确定出所述待理解问题的回答文本。该文本处理方法可提高机器阅读理解效率和正确率。

Description

文本处理方法、装置、设备及存储介质
本申请要求于2020年12月17日提交中国专利局、申请号为202011501996.6,发明名称为“文本处理方法、装置、设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及自然语言处理领域,尤其涉及一种文本处理方法、装置、设备及存储介质。
背景技术
目前,随着人工智能技术的发展,越来越多的推理模型被用于进行自然语言处理。以自然语言处理技术为核心的阅读理解模型可以帮助人们进行阅读理解、回答问题。片段抽取类式阅读理解是自然语言处理中的一个任务,它可以很好地从大量文本材料中抽取目标信息,而且可以保证输出结果为文本材料中的语句。发明人意识到,目前,片段抽取类阅读理解模型的构建主要基于双向编码表示翻译(Bidirectional Encoder Representations from Transformers,Bert)类技术。Bert模型作为目前主流的训练语言模型,可以在大多数语言训练任务中表现出一个较好的结果。但在阅读理解任务中,问题和文章在Bert模型中基于词汇进行语义编码,由于问题和文章信息量不匹配,Bert模型并不能通过词汇编码合理地分析出问题的含义。且因为问题长度有限,Bert模型难以通过词汇编码找到各个问题间的关联,使得阅读理解模型做出的回答针对性差,阅读理解的效率低。
发明内容
本申请实施例提供一种文本处理方法、装置、设备及存储介质,可基于对待理解文本的问题类型进行标注,以得到待理解问题与待理解文章在问题类型中的关联,可提高阅读理解效率和正确率,适用性高。
第一方面,本申请实施例供了一种文本处理方法,该方法包括:
获取待理解文本,上述待理解文本包括待理解问题和多个待理解文章片段;
将上述待理解文本输入阅读理解模型,通过上述阅读理解模型的语义分析层确定出上述待理解问题所属的问题类型标注,以及各待理解文章片段所回答问题的问题类型标注;
通过上述阅读理解模型的语义分析层确定出上述待理解文本中各字符的特征标注以及上述各字符的位置标注;
通过上述阅读理解模型的语义匹配层基于上述待理解问题所属的问题类型标注、上述各待理解文章片段所回答问题的问题类型标注、上述待理解文本中各字符的特征标注以及上述各字符的位置标注,确定上述待理解问题的回答文本的起始字符位置和终止字符位置;
根据上述起始字符位置和上述终止字符位置从上述待理解文本中确定出上述待理解问题的回答文本。
第二方面,本申请实施例提供了一种文本处理装置,该装置包括:
文本获取模块,用于获取待理解文本,上述待理解文本包括待理解问题和多个待理解文章片段;
分类标注模块,用于将上述待理解文本输入阅读理解模型,通过上述阅读理解模型的语义分析层确定出上述待理解问题所属的问题类型标注,以及各待理解文章片段所回答问题的问题类型标注;
语义标注模块,用于通过上述阅读理解模型的语义分析层确定出上述待理解文本中各字符的特征标注以及上述各字符的位置标注;
语义匹配模块,用于通过上述阅读理解模型的语义匹配层基于上述待理解问题所属的问题类型标注、上述各待理解文章片段所回答问题的问题类型标注、上述待理解文本中各字符的特征标注以及上述各字符的位置标注,确定上述待理解问题的回答文本的起始字符位置和终止字符位置,并根据上述起始字符位置和上述终止字符位置从上述待理解文本中 确定出上述待理解问题的回答文本。
第三方面,本申请实施例提供了一种终端设备,该终端设备包括处理器和存储器,该处理器和存储器相互连接。该存储器用于存储支持该终端设备执行上述第一方面和/或第一方面任一种可能的实现方式提供的方法的计算机程序,该计算机程序包括程序指令,该处理器被配置用于调用上述程序指令,执行以下方法:
获取待理解文本,上述待理解文本包括待理解问题和多个待理解文章片段;
将上述待理解文本输入阅读理解模型,通过上述阅读理解模型的语义分析层确定出上述待理解问题所属的问题类型标注,以及各待理解文章片段所回答问题的问题类型标注;
通过上述阅读理解模型的语义分析层确定出上述待理解文本中各字符的特征标注以及上述各字符的位置标注;
通过上述阅读理解模型的语义匹配层基于上述待理解问题所属的问题类型标注、上述各待理解文章片段所回答问题的问题类型标注、上述待理解文本中各字符的特征标注以及上述各字符的位置标注,确定上述待理解问题的回答文本的起始字符位置和终止字符位置;
根据上述起始字符位置和上述终止字符位置从上述待理解文本中确定出上述待理解问题的回答文本。
第四方面,本申请实施例提供了一种计算机可读存储介质,该计算机可读存储介质存储有计算机程序,该计算机程序包括程序指令,该程序指令当被处理器执行时使该处理器执行以下方法:
获取待理解文本,上述待理解文本包括待理解问题和多个待理解文章片段;
将上述待理解文本输入阅读理解模型,通过上述阅读理解模型的语义分析层确定出上述待理解问题所属的问题类型标注,以及各待理解文章片段所回答问题的问题类型标注;
通过上述阅读理解模型的语义分析层确定出上述待理解文本中各字符的特征标注以及上述各字符的位置标注;
通过上述阅读理解模型的语义匹配层基于上述待理解问题所属的问题类型标注、上述各待理解文章片段所回答问题的问题类型标注、上述待理解文本中各字符的特征标注以及上述各字符的位置标注,确定上述待理解问题的回答文本的起始字符位置和终止字符位置;
根据上述起始字符位置和上述终止字符位置从上述待理解文本中确定出上述待理解问题的回答文本。
在本申请实施例中,通过对待理解文本中待理解问题所属的问题类型以及各待理解文章片段所回答的问题类型进行标注,可以在问题类型维度上增强待理解问题和待理解文章在语义上的关联性;对确定了问题类型后的待理解文本中的各字符进行特征标注以及位置标注并输入语义匹配层,使得语义匹配层可以对待理解文本进行字符级别的阅读理解,在待理解文章中得到待理解问题的回答文本的起始字符位置和终止字符位置,从而得到上述待理解问题的回答文本,提高阅读理解的准确率。
附图说明
图1是本申请实施例提供的文本处理方法的一流程示意图;
图2是本申请实施例提供的对阅读理解模型进行训练的流程示意图;
图3是本申请实施例提供的文本处理方法的另一流程示意图;
图4是本申请实施例提供的文本处理装置的结构示意图;
图5是本申请实施例提供的终端设备的结构示意图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述。
本申请的技术方案可涉及人工智能和/或大数据技术领域,如可具体涉及自然语言处理技术。本申请可应用于文本处理如文本标注等场景中,以提高阅读理解效率和正确率,从 而推送智慧城市的建设。可选的,本申请涉及的数据如各种文本和/或标注信息等可存储于数据库中,或者可以存储于区块链中,本申请不做限定。
自然语言处理是计算机科学领域与人工智能领域中的一个重要方向,自然语言处理主要研究能实现人与计算机之间用自然语言进行有效通信的各种理论和方法。然而,实现自然语言处理是十分困难的,造成困难的根本原因是自然语言文本和对话的各个层次上广泛存在着各种各样的歧义性或多义性。因此,进行自然语言处理必须消除歧义,也即需要把带有潜在歧义的自然语言输入转换成某种无歧义的计算机内部表示。许多的机器学习算法已经被应用于执行自然语言处理任务,但这些算法通常依靠生硬的规则类匹配实现。因此,越来越多的研究集中于自然语言处理模型,自然语言处理模型给予各个推理要素不同的权重,根据最后计算得到的概率进行决策。此类模型能够得到许多可能的答案,而不是只有一个相对的确定性,从而产生更可靠的结果,提高自然语言处理模型的适用性与兼容性。其中,Bert模型作为目前主流的自然语言处理模型,可以在大多数语言训练任务(例如,机器阅读理解(Machine Reading Comprehension,MRC)任务)中表现出一个较好的结果。从而可以利用Bert模型作为阅读理解模型根据给定的上下文回答问题,测试阅读理解模型对自然语言文本的理解程度。常见的MRC任务可以分为四种类型:完形填空、多项选择、片段抽取、自由回答。其中,片段抽取类阅读理解模型可以很好地从大量文本材料中抽取用户想要关注的目标信息,而且可以保证输出结果为材料原语句,与需要人工维护正则表达式的方法相比,大大降低了阅读理解模型的运行成本。通常,阅读理解模型由以下几个部分组成:嵌入(Embedding)、特征提取(Feature Extraction)、上下文交互(Context-Question Interaction)、答案预测(Answer Prediction)。其中,嵌入用于将单词映射为对应的词向量;特征提取用于抽取问题和文章的上下文信息;上下文交互用于提取文章和问题之间的相关性,通常引入注意力机制,以便于充分提取文章和问题之间的相关性;答案预测用于基于上述几个部分获得的信息输出最终答案(在执行片段抽取式任务的阅读理解模型中,最终答案即是回答文本)。本申请实施例提供的方法可由装载有基于阅读理解模型实现文本处理功能的系统或终端设备执行,为表述方便,下面将以终端设备为执行主体,对本申请实施例提供的文本处理的方法进行描述。
以在医疗领域构建阅读理解模型(即阅读理解模型)对医疗问题进行片段抽取式阅读理解为例,终端设备可以对常用的阅读理解模型(例如Bert模型)进行改进或重新构建,具体可根据实际应用场景确定,在此不做限制。在本申请中,阅读理解模型包括但不限于语义分析层和语义匹配层,医疗问题的所属类别包括但不限于“肺炎”、“支气管炎”、“上呼吸道感染”、“肺结核”、“哮喘”等多个病种,医疗问题的具体类别包括但不限于地点问题、时间问题、人物问题、事件问题、原因问题以及方法问题等多种类别。终端设备对阅读理解模型进行构建,包括但不限于从互联网或者目标领域数据库中采集多个阅读理解文本的样本片段,并利用上述多个样本片段构建阅读理解模型。其中,目标领域数据库可以包括:基于医疗领域的诊疗数据以及病理数据生成的医疗领域数据库,或者基于医疗机构的现有设备数据以及地理位置数据生成的医疗设备领域数据库。上述样本片段中可包括问题片段(例如,问题片段1,问题片段2等)、以及问题片段在文章片段中对应的答案片段(例如,答案片段1,答案片段2等)。终端设备将各样本片段进行问题类别标注,以得到分类标注后的样本片段。终端设备将各样本片段进行问题类别标注包括对各样本片段中的问题片段所属的问题类型进行标注,并将一个问题片段所属的问题类型标注为该问题片段对应的答案片段所回答的问题类型。例如,终端设备将问题片段1(比如,感冒如何治疗?)的问题类型标注为“上呼吸道感染”和“方法问题”,将问题片段1对应的答案片段1(比如,建议患者卧床休息,清淡饮食)的问题类型标注为“上呼吸道感染”和“方法问题”。终端设备将问题片段2(比如,肺部发炎是什么原因引起的?)的问题类型标注为“肺炎”和“原因问题”, 将问题片段2对应的答案片段2(比如,急性慢性的呼吸道的感染,支气管炎以及着凉感冒,甚至其他的细菌感染或者传染病等都会造成肺部的炎症)的问题类型标注为“肺炎”和“原因问题”。终端设备将分类标注后的样本片段进行语义标注,以得到样本片段,包括但不限于将样本片段中的各字符进行特征标注,以及对各字符的位置进行标注。例如,终端设备对样本片段中的各字符进行拼音标注,笔画数标注,以及字符位置标注。终端设备将问题片段1(感冒如何治疗?)进行语义标注为:感(gan,13,【1】)冒(mao,9,【2】)如(ru,6,【3】)何(he,7,【4】)治(zhi,8,【5】)疗(liao,7,【6】)?(##,#,【7】)。终端设备在问题片段1与答案片段1中间加入分隔符(位置在【8】),同时将问题片段1对应的答案片段1(建议患者卧床休息,清淡饮食)进行语义标注为:建(jian,8,【9】)议(yi,5,【10】)患(huan,11,【11】)者(zhe,8,【12】)卧(wo,8,【13】)床(chuang,7,【14】)休(xiu,6,【15】)息(xi,10,【16】),清(qing,11,【17】)淡(dan,12,【18】)饮(yin,7,【19】)食(shi,9,【20】)。进一步地,终端设备可利用分类标注后的样本片段对阅读理解模型的语义分析层以及语义匹配层进行训练,使得训练后的阅读理解模型可基于输入的任一文本输出该文本中包括的待理解问题的问题类型标注以及该文本中包括的待理解文章片段所回答问题的问题类型标注。
在一些可行的实施方式中,终端设备获取待理解文本,通过训练好的阅读理解模型对待理解文本进行问题类型标注和语义标注。例如,将待理解问题1(感冒如何治疗?)的问题类型标注为“上呼吸道感染”和“方法问题”,通过阅读理解模型将待理解文章片段1(感冒是一种常见的急性上呼吸道病毒性感染性疾病)所回答问题的问题类型标注为“上呼吸道感染”和“其他问题”。通过阅读理解模型可将待理解文章片段2(建议患者卧床休息,清淡饮食)所回答问题的问题类型标注为“上呼吸道感染”和“方法问题”。通过阅读理解模型还可对待理解文本中的各字符进行特征标注以及对各字符的位置进行标注。比如通过阅读理解模型对待理解文本中的待理解问题的各字符进行特征标注并对各字符的位置(在待理解文本中的位置)进行标注,可得到待理解问题1:感(gan,13,【1】)冒(mao,9,【2】)如(ru,6,【3】)何(he,7,【4】)治(zhi,8,【5】)疗(liao,7,【6】)?(##,#,【7】)。在待理解问题1与待理解文章片段1中间加入分隔符(位置在【8】)。通过阅读理解模型的语义分析层可得到语义标注后的待理解文章片段1:感(gan,13,【9】)冒(mao,9,【10】)是(shi,9,【11】)一(yi,1,【12】)种(zhong,9,【13】)常(chang,11,【14】)见(jian,4,【15】)的(de,8,【16】)急(ji,9,【17】)性(xing,8,【18】)上(shang,3,【19】)呼(hu,8,【20】)吸(xi,6,【21】)道(dao,11,【22】)病(bing,9,【23】)毒(du,9,【24】)性(xing,8,【25】)感(gan,13,【26】)染(ran,9,【27】)性(xing,8,【28】)疾(ji,10,【29】)病(bing,10,【30】)。在待理解文章片段1与待理解文章片段2中间加入分隔符(位置在【31】),用于区分待理解文章片段1和待理解文章片段2。通过阅读理解模型的语义分析层可得到语义标注后的待理解文章片段2:建(jian,8,【32】)议(yi,5,【33】)患(huan,11,【34】)者(zhe,8,【35】)卧(wo,8,【36】)床(chuang,7,【37】)休(xiu,6,【38】)息(xi,10,【39】),清(qing,11,【40】)淡(dan,12,【41】)饮(yin,7,【42】)食(shi,9,【43】)。将标注后的待理解问题和各待理解文章片段输入阅读理解模型进行语义匹配,通过阅读理解模型在待理解文章中确定待理解问题的回答文本的起始字符位置(【32】)和终止字符位置(【43】),以得到待理解问题的回答文本(建议患者卧床休息,清淡饮食)。
具体请参阅图1,图1是本申请实施例提供的文本处理方法的一流程示意图。本申请实施例提供的方法可包括获取待理解文本,待理解文本包括待理解问题(例如,待理解问题1等)和多个待理解文章片段(例如,待理解文章片段1,待理解文章片段2等)。终端设备将待理解文本输入阅读理解模型的语义分析层,通过上述语义分析层对待理解文本进 行问题类型标注和语义标注,以得到标注后的待理解问题和各待理解文章片段。终端设备将标注后的待理解问题和各待理解文章片段输入语义匹配层进行语义匹配,通过语义匹配层在待理解文章中确定待理解问题的回答文本的起始字符位置和终止字符位置,以得到待理解问题的回答文本。为方便描述,下面将以在医疗领域构建阅读理解模型对医疗问题进行片段抽取式阅读理解为例,对本申请实施例提供的方法进行说明。本申请实施例提供的方法可包括如下步骤:
S101:终端设备获取待理解文本。
在一些可行的实施方式中,终端设备获取待理解文本,上述待理解文本包括待理解问题(例如,待理解问题1等)和多个待理解文章片段(例如,待理解文章片段1,待理解文章片段2等)。例如,终端设备可以获取待理解文本包括待理解问题1(比如,感冒如何治疗?),待理解文章片段1(比如,感冒是一种常见的急性上呼吸道病毒性感染性疾病)以及待理解文章片段2(建议患者卧床休息,清淡饮食)。在一些应用场景中,待理解文章的长度可能比较长,大于阅读理解模型限制的长度范围,终端设备则可以将待理解文章分割为多个待理解文章片段,将每个待理解文章片段与待理解问题组合,依次输入阅读理解模型进行阅读理解。具体可根据实际应用场景确定,在此不做限制。
S102:终端设备将上述待理解文本输入阅读理解模型,通过上述阅读理解模型的语义分析层确定出上述待理解问题所属的问题类型标注,以及各待理解文章片段所回答问题的问题类型标注。
在一些可行的实施方式中,终端设备可以将待理解文本输入训练好的阅读理解模型,通过阅读理解模型的语义分析层对待理解文本进行问题类型标注和语义标注。例如,通过阅读理解模型的语义分析层可将待理解问题1(感冒如何治疗?)所回答问题的问题类型标注为“上呼吸道感染”和“方法问题”,将待理解文章片段1(感冒是一种常见的急性上呼吸道病毒性感染性疾病)的问题类型标注为“上呼吸道感染”和“其他问题”,将待理解文章片段2(建议患者卧床休息,清淡饮食)所回答问题的问题类型标注为“上呼吸道感染”和“方法问题”。
S103:通过阅读理解模型的语义分析层确定出上述待理解文本中各字符的特征标注以及上述各字符的位置标注。
在一些可行的实施方式中,通过阅读理解模型的语义分析层可以同时对待理解文本中的各字符进行特征标注以及对各字符的位置进行标注,得到标注后的待理解问题和各待理解文章片段。上述语义标注包括但不限于将样本片段中的各字符进行特征标注,以及对各字符的位置进行标注。比如通过阅读理解模型对待理解文本中的待理解问题的各字符进行特征标注并对各字符的位置(在待理解文本中的位置)进行标注,可得到语义标注后的待理解问题1:感(gan,13,【1】)冒(mao,9,【2】)如(ru,6,【3】)何(he,7,【4】)治(zhi,8,【5】)疗(liao,7,【6】)?(##,#,【7】)。在待理解问题1与待理解文章片段1中间加入分隔符(位置在【8】)。通过阅读理解模型的语义分析层可得到语义标注后的待理解文章片段1:感(gan,13,【9】)冒(mao,9,【10】)是(shi,9,【11】)一(yi,1,【12】)种(zhong,9,【13】)常(chang,11,【14】)见(jian,4,【15】)的(de,8,【16】)急(ji,9,【17】)性(xing,8,【18】)上(shang,3,【19】)呼(hu,8,【20】)吸(xi,6,【21】)道(dao,11,【22】)病(bing,9,【23】)毒(du,9,【24】)性(xing,8,【25】)感(gan,13,【26】)染(ran,9,【27】)性(xing,8,【28】)疾(ji,10,【29】)病(bing,10,【30】)。在待理解文章片段1与待理解文章片段2中间加入分隔符(位置在【31】),用于区分待理解文章片段1和待理解文章片段2。通过阅读理解模型的语义分析层可得到语义标注后的待理解文章片段2:建(jian,8,【32】)议(yi,5,【33】)患(huan,11,【34】)者(zhe,8,【35】)卧(wo,8,【36】)床(chuang,7,【37】)休(xiu,6,【38】) 息(xi,10,【39】),清(qing,11,【40】)淡(dan,12,【41】)饮(yin,7,【42】)食(shi,9,【43】)。
在一些可行的实施方式中,请一并参阅图2,图2是本申请实施例提供的对阅读理解模型进行训练的流程示意图。上述对阅读理解模型进行训练的方法可包括如下步骤S201至S208中各个步骤所提供的实现方式。
S201:终端设备采集多个阅读理解文本的样本片段。
在一些可行的实施方式中,终端设备采集多个阅读理解文本的样本片段的方法可以包括但不限于终端设备从互联网中采集多个阅读理解文本的样本片段,样本片段包括问题片段(例如,问题片段1,问题片段2等)、以及问题片段在文章片段中对应的答案片段(例如,答案片段1,答案片段2等)。
S202:终端设备确定各样本片段中各问题片段所属的问题类型标注,以及各答案片段所回答问题的问题类型标注。
在一些可行的实施方式中,终端设备可以将各样本片段进行问题类别标注,以得到分类标注后的样本片段。终端设备可以将各样本片段进行问题类别标注包括对各样本片段中的问题片段所属的问题类型进行标注,并将一个问题片段所属的问题类型标注为该问题片段对应的答案片段所回答的问题类型。将问题片段1(感冒如何治疗?)的问题类型标注为“上呼吸道感染”和“方法问题”,将问题片段1对应的答案片段1(建议患者卧床休息,清淡饮食)的问题类型标注为“上呼吸道感染”和“方法问题”。终端设备可以将问题片段2(肺部发炎是什么原因引起的?)的问题类型标注为“肺炎”和“原因问题”,将问题片段2对应的答案片段2(急性慢性的呼吸道的感染,支气管炎以及着凉感冒,甚至其他的细菌感染或者传染病等都会造成肺部的炎症。)的问题类型标注为“肺炎”和“原因问题”。
S203:终端设备确定上述各样本片段中各字符的特征标注以及上述各字符的位置标注。
在一些可行的实施方式中,终端设备可以将分类标注后的样本片段进行语义标注,以得到语义标注后的样本片段。终端设备可以将分类标注后的各样本片段中的各字符进行特征标注,以及对各字符的位置进行标注。例如,通过对分类标注后的样本片段中的各字符进行拼音标注,笔画数标注,以及字符位置标注,可将问题片段1(感冒如何治疗?)进行语义标注为:感(gan,13,【1】)冒(mao,9,【2】)如(ru,6,【3】)何(he,7,【4】)治(zhi,8,【5】)疗(liao,7,【6】)?(##,#,【7】)。在问题片段1与答案片段1中间加入分隔符(位置在【8】),同时将问题片段1对应的答案片段1(建议患者卧床休息,清淡饮食)进行语义标注为:建(jian,8,【9】)议(yi,5,【10】)患(huan,11,【11】)者(zhe,8,【12】)卧(wo,8,【13】)床(chuang,7,【14】)休(xiu,6,【15】)息(xi,10,【16】),清(qing,11,【17】)淡(dan,12,【18】)饮(yin,7,【19】)食(shi,9,【20】)。
S204:终端设备将上述各问题片段所属的问题类型标注、上述各答案片段所回答问题的问题类型标注、上述样本片段中各字符的特征标注以及上述各字符的位置标注,输入语义分析层以及语义匹配层。
S205:门控循环层获取基于任一样本片段对上述阅读理解模型的语义匹配层进行训练后得到的第一语义匹配层网络参数。
S206:门控循环层确定上述第一语义匹配层网络参数的评分。
S207:当上述第一语义匹配层网络参数的评分大于或等于阈值时,门控循环层将上述语义匹配层的网络参数确定为上述第一语义匹配层网络参数。
S208:当上述第一语义匹配层网络参数的评分小于阈值时,门控循环层将上述语义匹配层的网络参数确定为第二语义匹配层网络参数。
在一些可行的实施方式中,在一个样本片段输入上述语义匹配层,通过该样本片段对 语义匹配进行训练之后,门控循环层可以获取上述语义匹配层的语义匹配层网络参数(假设为第一语义匹配层网络参数)。通过门控循环层确定上述语义匹配层网络参数的评分,并对上述语义匹配层网络参数的评分进行判断。当上述语义匹配层网络参数的评分大于或等于阈值时,门控循环层通过其更新门将上述语义匹配层的网络参数确定为上述第一语义匹配层网络参数。当上述语义匹配层网络参数的评分小于阈值时,门控循环层通过重置门将上述语义匹配层的网络参数确定为第二语义匹配层网络参数。其中,上述第二语义匹配层网络参数为基于在先样本片段包括的问题片段所属的问题类型标注、上述问题片段对应的答案片段所回答问题的问题类型标注、上述在先样本片段中各字符的特征标注以及上述各字符的位置标注,对上述阅读理解模型的语义匹配层进行训练后得到的语义匹配层网络参数。这里,上述在先样本片段为在上述任一样本片段之前输入上述阅读理解模型,用于对上述语义匹配层进行训练的样本片段。
在一些可行的实施方式中,在一个样本片段输入上述语义匹配层之后,门控循环层可以获取上述语义匹配层的语义匹配层网络参数(假设为第一语义匹配层网络参数)并存储在门控循环层中,对存储在门控循环层中的n个(n为大于1的正整数,可以由用户自由设定)样本片段输入语义匹配层后的语义匹配层网络参数进行综合评分,并对上述语义匹配层网络参数的综合评分进行判断。当上述语义匹配层网络参数的综合评分大于或等于阈值时,门控循环层通过更新门将上述语义匹配层的网络参数确定为上述第一语义匹配层网络参数。当上述语义匹配层网络参数的综合评分小于阈值时,门控循环层通过重置门将上述语义匹配层的网络参数确定为第二语义匹配层网络参数。其中,上述第二语义匹配层网络参数为基于在先样本片段包括的问题片段所属的问题类型标注、上述问题片段对应的答案片段所回答问题的问题类型标注、上述在先样本片段中各字符的特征标注以及上述各字符的位置标注,对上述阅读理解模型的语义匹配层进行训练后得到的语义匹配层网络参数,上述在先样本片段为在上述n个样本片段之前输入上述阅读理解模型的样本片段。
具体地,获取上述语义匹配层在第i个(i为正整数)样本片段输入之后的语义匹配层网络参数,门控循环层确定语义匹配层网络参数的评分,并对语义匹配层网络参数进行还原或者更新,得到第i组语义匹配层网络参数。当将第i+1个样本片段输入语义匹配层时,利用第i组语义匹配层网络参数对上述语义匹配层进行训练,从而确保第i时刻通过门控循环层控制的语义匹配层网络参数可以在第i+1时刻被应用到对语义匹配层的训练中。
S104:通过上述阅读理解模型的语义匹配层基于标注后的上述待理解文本,确定上述待理解问题的回答文本的起始字符位置和终止字符位置,并确定出上述待理解问题的回答文本。
在一些可行的实施方式中,将标注后的待理解问题和各待理解文章片段输入阅读理解模型进行语义匹配,通过阅读理解模型在待理解文章中确定待理解问题的回答文本的起始字符位置(【32】)和终止字符位置(【43】),以得到待理解问题的回答文本(建议患者卧床休息,清淡饮食)。
在本申请实施例中,通过对待理解文本中待理解问题所属的问题类型以及各待理解文章片段所回答的问题类型进行标注,可以在问题类型维度上增强待理解问题和待理解文章在语义上的关联性;对确定了问题类型后的待理解文本中的各字符进行特征标注以及位置标注并输入语义匹配层,使得语义匹配层可以对待理解文本进行字符级别的阅读理解,在待理解文章中得到待理解问题的回答文本的起始字符位置和终止字符位置,从而得到上述待理解问题的回答文本,提高阅读理解的准确率。
请参阅图3,图3是本申请实施例提供的文本处理方法的另一流程示意图。
S301:终端设备获取待理解文本。
在一些可行的实施方式中,终端设备获取待理解文本,上述待理解文本包括待理解问 题(例如,待理解问题1等)和多个待理解文章片段(例如,待理解文章片段1,待理解文章片段2等)。例如,终端设备可以获取待理解文本包括待理解问题1(感冒如何治疗?),待理解文章片段1(感冒是一种常见的急性上呼吸道病毒性感染性疾病)以及待理解文章片段2(建议患者卧床休息,清淡饮食)。在一些应用场景中,待理解文章的长度可能比较长,大于阅读理解模型限制的长度范围,则可以将待理解文章分割为多个待理解文章片段,将每个待理解文章片段与待理解问题组合,依次输入阅读理解模型进行阅读理解。具体可根据实际应用场景确定,在此不做限制。
S302:终端设备将上述待理解文本输入阅读理解模型,通过上述阅读理解模型的语义分析层确定出上述待理解问题所属的问题类型标注,以及各待理解文章片段所回答问题的问题类型标注。
在一些可行的实施方式中,终端设备可以将待理解文本输入训练好的阅读理解模型,通过阅读理解模型的语义分析层对待理解文本进行问题类型标注和语义标注。例如,通过阅读理解模型的语义分析层可将待理解问题1(感冒如何治疗?)的问题类型标注为“上呼吸道感染”和“方法问题”,将待理解文章片段1(感冒是一种常见的急性上呼吸道病毒性感染性疾病)所回答问题的问题类型标注为“上呼吸道感染”和“其他问题”,将待理解文章片段2(建议患者卧床休息,清淡饮食)所回答问题的问题类型标注为“上呼吸道感染”和“方法问题”。
S303:通过阅读理解模型的语义分析层确定出上述待理解文本中各字符的特征标注以及上述各字符的位置标注。
在一些可行的实施方式中,通过阅读理解模型的语义分析层可以同时对待理解文本中的各字符进行特征标注以及对各字符的位置进行标注,得到标注后的待理解问题和各待理解文章片段。上述语义标注包括但不限于将样本片段中的各字符进行特征标注,以及对各字符的位置进行标注。比如通过阅读理解模型对待理解文本中的待理解问题的各字符进行特征标注并对各字符的位置(在待理解文本中的位置)进行标注,可得到语义标注后的待理解问题1:感(gan,13,【1】)冒(mao,9,【2】)如(ru,6,【3】)何(he,7,【4】)治(zhi,8,【5】)疗(liao,7,【6】)?(##,#,【7】)。在待理解问题1与待理解文章片段1中间加入分隔符(位置在【8】)。通过阅读理解模型的语义分析层可得到语义标注后的待理解文章片段1:感(gan,13,【9】)冒(mao,9,【10】)是(shi,9,【11】)一(yi,1,【12】)种(zhong,9,【13】)常(chang,11,【14】)见(jian,4,【15】)的(de,8,【16】)急(ji,9,【17】)性(xing,8,【18】)上(shang,3,【19】)呼(hu,8,【20】)吸(xi,6,【21】)道(dao,11,【22】)病(bing,9,【23】)毒(du,9,【24】)性(xing,8,【25】)感(gan,13,【26】)染(ran,9,【27】)性(xing,8,【28】)疾(ji,10,【29】)病(bing,10,【30】)。在待理解文章片段1与待理解文章片段2中间加入分隔符(位置在【31】),用于区分待理解文章片段1和待理解文章片段2。通过阅读理解模型的语义分析层可得到语义标注后的待理解文章片段2:建(jian,8,【32】)议(yi,5,【33】)患(huan,11,【34】)者(zhe,8,【35】)卧(wo,8,【36】)床(chuang,7,【37】)休(xiu,6,【38】)息(xi,10,【39】),清(qing,11,【40】)淡(dan,12,【41】)饮(yin,7,【42】)食(shi,9,【43】)。
S304:通过上述阅读理解模型的语义匹配层基于上述待理解问题所属的问题类型标注、各待理解文章片段所回答问题的问题类型标注、上述待理解文本中各字符的特征标注以及上述各字符的位置标注,从上述待理解文章文本中确定出多个预选起始字符位置和多个预选终止字符位置,以得到多个预选回答文本。
S305:通过上述语义匹配层基于各预选回答文本与上述待理解问题的匹配度,确定出上述各预选回答文本用于回答上述待理解问题的评分。
在一些可行的实施方式中,可以将预选回答文本和待理解问题进行矩阵向量化,并计算两个矩阵的相似度,作为预选回答文本与待理解问题的匹配度。
特别地,也可以将预选回答文本和待理解问题进行矩阵向量化,并计算出待理解问题的特征矩阵,特征矩阵代表的含义可以为待理解问题中的关键词,计算预选回答文本矩阵与待理解问题的特征矩阵的相似度,作为预选回答文本与待理解问题的匹配度。
S306:将上述各预选回答文本中评分最高的预选回答文本的预选起始字符位置和预选终止字符位置作为上述待理解问题的回答文本的起始字符位置和终止字符位置,以得到上述待理解问题的回答文本。
在一些可行的实施方式中,可以判断上述待理解问题的回答文本的起始字符位置与终止字符位置的字符距离是否在阈值区间内,若是,则根据上述起始字符位置和上述终止字符位置从上述待理解文本中确定出上述待理解问题的回答文本,并输出上述待理解问题的回答文本;若否,则输出回答文本不存在。可以进一步地限定回答文本的长度,剔除回答文本中与待理解问题无关的信息,从而减少回答文本的冗余,进一步提高阅读理解的效率。
在本申请实施例中,通过对待理解文本中待理解问题所属的问题类型以及各待理解文章片段所回答的问题类型进行标注,可以在问题类型维度上增强待理解问题和待理解文章在语义上的关联性;对确定了问题类型后的待理解文本中的各字符进行特征标注以及位置标注并输入语义匹配层,使得语义匹配层可以对待理解文本进行字符级别的阅读理解,在待理解文章中得到待理解问题的回答文本的起始字符位置和终止字符位置,从而得到上述待理解问题的回答文本,提高阅读理解的准确率。
请参阅图4,图4是本申请实施例提供的文本处理装置的结构示意图。
文本获取模块401,用于获取待理解文本,待理解文本包括待理解问题和多个待理解文章片段。
在一些可行的实施方式中,通过文本获取模块401获取待理解文本,上述待理解文本包括待理解问题和多个待理解文章片段。例如,文本获取模块401获取待理解文本包括待理解问题1(感冒如何治疗?),待理解文章片段1(感冒是一种常见的急性上呼吸道病毒性感染性疾病)以及待理解文章片段2(建议患者卧床休息,清淡饮食)。在一些应用场景中,待理解文章的长度可能比较长,大于阅读理解模型限制的长度范围,则可以将待理解文章分割为多个待理解文章片段,将每个待理解文章片段与待理解问题组合,依次输入阅读理解模型进行阅读理解。具体可根据实际应用场景确定,在此不做限制。
分类标注模块402,用于将待理解文本输入语义分析层,对待理解文本进行问题类型标注和语义标注,以得到标注后的待理解问题和各待理解文章片段,其中,问题类型标注包括对待理解问题所属的问题类型进行标注,以及对各待理解文章片段所回答的问题类型进行标注,语义标注包括对待理解文本中的各字符进行特征标注以及对各字符的位置进行标注。
在一些可行的实施方式中,可以通过分类标注模块402对待理解文本进行问题类型标注和语义标注。将待理解问题1(感冒如何治疗?)的问题类型标注为“上呼吸道感染”和“方法问题”,将待理解文章片段1(感冒是一种常见的急性上呼吸道病毒性感染性疾病)所回答问题的问题类型标注为“上呼吸道感染”和“其他问题”,将待理解文章片段2(建议患者卧床休息,清淡饮食)所回答问题的问题类型标注为“上呼吸道感染”和“方法问题”。
语义标注模块403,用于通过上述阅读理解模型的语义分析层确定出上述待理解文本中各字符的特征标注以及上述各字符的位置标注。
在一些可行的实施方式中,语义标注模块403可以同时对待理解文本中的各字符进行特征标注以及对各字符的位置进行标注,得到标注后的待理解问题和各待理解文章片段。上述语义标注包括但不限于将样本片段中的各字符进行特征标注,以及对各字符的位置进 行标注。比如通过语义标注模块403对待理解文本中的待理解问题的各字符进行特征标注并对各字符的位置(在待理解文本中的位置)进行标注,可得到语义标注后的待理解问题1:感(gan,13,【1】)冒(mao,9,【2】)如(ru,6,【3】)何(he,7,【4】)治(zhi,8,【5】)疗(liao,7,【6】)?(##,#,【7】)。在待理解问题1与待理解文章片段1中间加入分隔符(位置在【8】)。得到语义标注后的待理解文章片段1:感(gan,13,【9】)冒(mao,9,【10】)是(shi,9,【11】)一(yi,1,【12】)种(zhong,9,【13】)常(chang,11,【14】)见(jian,4,【15】)的(de,8,【16】)急(ji,9,【17】)性(xing,8,【18】)上(shang,3,【19】)呼(hu,8,【20】)吸(xi,6,【21】)道(dao,11,【22】)病(bing,9,【23】)毒(du,9,【24】)性(xing,8,【25】)感(gan,13,【26】)染(ran,9,【27】)性(xing,8,【28】)疾(ji,10,【29】)病(bing,10,【30】)。在待理解文章片段1与待理解文章片段2中间加入分隔符(位置在【31】),用于区分待理解文章片段1和待理解文章片段2。通过阅读理解模型的语义分析层可得到语义标注后的待理解文章片段2:建(jian,8,【32】)议(yi,5,【33】)患(huan,11,【34】)者(zhe,8,【35】)卧(wo,8,【36】)床(chuang,7,【37】)休(xiu,6,【38】)息(xi,10,【39】),清(qing,11,【40】)淡(dan,12,【41】)饮(yin,7,【42】)食(shi,9,【43】)。
语义匹配模块404,用于通过上述阅读理解模型的语义匹配层基于上述待理解问题所属的问题类型标注、上述各待理解文章片段所回答问题的问题类型标注、上述待理解文本中各字符的特征标注以及上述各字符的位置标注,确定上述待理解问题的回答文本的起始字符位置和终止字符位置,并根据上述起始字符位置和上述终止字符位置从上述待理解文本中确定出上述待理解问题的回答文本。
在一些可行的实施方式中,语义匹配模块404可以将预选回答文本和待理解问题进行矩阵向量化,并计算两个矩阵的相似度,作为预选回答文本与待理解问题的匹配度。
特别地,语义匹配模块404也可以将预选回答文本和待理解问题进行矩阵向量化,并计算出待理解问题的特征矩阵,特征矩阵代表的含义可以为待理解问题中的关键词,计算预选回答文本矩阵与待理解问题的特征矩阵的相似度,作为预选回答文本与待理解问题的匹配度。进而可以将评分最高的预选回答文本的预选起始字符位置和预选终止字符位置,作为待理解问题的回答文本的起始字符位置和终止字符位置,以得到待理解问题的回答文本,此时,回答文本与待理解问题匹配度最高。
在一些可行的实施方式中,上述语义匹配模块404包括:
文本确认单元,用于通过上述阅读理解模型的语义匹配层基于上述待理解问题所属的问题类型标注、各待理解文章片段所回答问题的问题类型标注、上述待理解文本中各字符的特征标注以及上述各字符的位置标注,从上述待理解文章文本中确定出多个预选起始字符位置和多个预选终止字符位置,以得到多个预选回答文本。
回答评分单元,用于通过上述语义匹配层基于各预选回答文本与上述待理解问题的匹配度,确定出上述各预选回答文本用于回答上述待理解问题的评分。
回答确认单元,用于将上述各预选回答文本中评分最高的预选回答文本的预选起始字符位置和预选终止字符位置作为上述待理解问题的回答文本的起始字符位置和终止字符位置,以得到上述待理解问题的回答文本。
在一些可行的实施方式中,上述语义匹配模块404还包括:
回答输出单元,用于若上述待理解问题的回答文本的起始字符位置与终止字符位置的字符距离在阈值区间内,则从上述待理解文本中确定出上述起始字符位置和上述终止字符位置之间的文本作为上述待理解问题的回答文本,并输出上述待理解问题的回答文本。
在本申请实施例中,通过对待理解文本中待理解问题所属的问题类型以及各待理解文章片段所回答的问题类型进行标注,可以在问题类型维度上增强待理解问题和待理解文章 在语义上的关联性;对确定了问题类型后的待理解文本中的各字符进行特征标注以及位置标注并输入语义匹配层,使得语义匹配层可以对待理解文本进行字符级别的阅读理解,在待理解文章中得到待理解问题的回答文本的起始字符位置和终止字符位置,从而得到上述待理解问题的回答文本,提高阅读理解的准确率。
参见图5,图5是本申请实施例提供的终端设备的结构示意图。如图5所示,本实施例中的终端设备可以包括:一个或多个处理器501和存储器502。上述处理器501和存储器502通过总线503连接。存储器502用于存储计算机程序,该计算机程序包括程序指令,处理器501用于执行存储器502存储的程序指令,执行如下操作:
获取待理解文本,上述待理解文本包括待理解问题和多个待理解文章片段;
将上述待理解文本输入阅读理解模型,通过上述阅读理解模型的语义分析层确定出上述待理解问题所属的问题类型标注,以及各待理解文章片段所回答问题的问题类型标注;
通过上述阅读理解模型的语义分析层确定出上述待理解文本中各字符的特征标注以及上述各字符的位置标注;
通过上述阅读理解模型的语义匹配层基于上述待理解问题所属的问题类型标注、上述各待理解文章片段所回答问题的问题类型标注、上述待理解文本中各字符的特征标注以及上述各字符的位置标注,确定上述待理解问题的回答文本的起始字符位置和终止字符位置;
根据上述起始字符位置和上述终止字符位置从上述待理解文本中确定出上述待理解问题的回答文本。
在一些可行的实施方式中,上述处理器501还用于:
采集多个阅读理解文本的样本片段,上述样本片段包括问题片段以及上述问题片段对应的答案片段;
确定各样本片段中各问题片段所属的问题类型标注,以及各答案片段所回答问题的问题类型标注;
确定上述各样本片段中各字符的特征标注以及上述各字符的位置标注;
基于上述各问题片段所属的问题类型标注、上述各答案片段所回答问题的问题类型标注、上述样本片段中各字符的特征标注以及上述各字符的位置标注,对上述阅读理解模型的语义分析层以及语义匹配层进行训练。
通过对样本片段中问题片段所属的问题类型以及答案片段所回答的问题类型进行标注,并对语义分析层进行训练,可以增强问题片段和答案片段在语义分析层中的问题类型维度上的关联性。通过对分类标注后的样本片段进行语义标注,并对语义匹配层进行训练,可以使得语义匹配层对待理解文本进行字符级别的阅读理解在待理解文章中得到待理解问题的回答文本的起始字符位置和终止字符位置,从而得到上述待理解问题的回答文本,进一步提高阅读理解的准确率。
在一些可行的实施方式中,上述处理器501用于:
获取基于任一样本片段包括的问题片段所属的问题类型标注、上述问题片段对应的答案片段所回答问题的问题类型标注、上述任一样本片段中各字符的特征标注以及上述各字符的位置标注,对上述阅读理解模型的语义匹配层进行训练后得到的第一语义匹配层网络参数;
通过上述阅读理解模型的门控循环层确定上述第一语义匹配层网络参数的评分;
当上述第一语义匹配层网络参数的评分大于或等于阈值时,通过上述门控循环层将上述语义匹配层的网络参数确定为上述第一语义匹配层网络参数;
当上述第一语义匹配层网络参数的评分小于阈值时,通过上述门控循环层将上述语义匹配层的网络参数确定为第二语义匹配层网络参数;
其中,上述第二语义匹配层网络参数为基于在先样本片段包括的问题片段所属的问题 类型标注、上述问题片段对应的答案片段所回答问题的问题类型标注、上述在先样本片段中各字符的特征标注以及上述各字符的位置标注,对上述阅读理解模型的语义匹配层进行训练后得到的语义匹配层网络参数,上述在先样本片段为在上述任一样本片段之前输入上述阅读理解模型的样本片段。
通过阅读理解模型的门控循环层确定第一语义匹配层网络参数的评分,可以剔除质量较低的样本片段,将对语义匹配层训练贡献度不高的样本片段剔除,使得语义匹配层的语义匹配层网络参数更为精确,从而提高语义匹配层的训练效率,进一步提高阅读理解的准确率。
在一些可行的实施方式中,上述处理器501用于:
通过上述阅读理解模型的语义匹配层基于上述待理解问题所属的问题类型标注、各待理解文章片段所回答问题的问题类型标注、上述待理解文本中各字符的特征标注以及上述各字符的位置标注,从上述待理解文章文本中确定出多个预选起始字符位置和多个预选终止字符位置,以得到多个预选回答文本;
通过上述语义匹配层基于各预选回答文本与上述待理解问题的匹配度,确定出上述各预选回答文本用于回答上述待理解问题的评分;
将上述各预选回答文本中评分最高的预选回答文本的预选起始字符位置和预选终止字符位置作为上述待理解问题的回答文本的起始字符位置和终止字符位置,以得到上述待理解问题的回答文本。
在一些可行的实施方式中,上述处理器501用于:
若上述待理解问题的回答文本的起始字符位置与终止字符位置的字符距离在阈值区间内,则从上述待理解文本中确定出上述起始字符位置和上述终止字符位置之间的文本作为上述待理解问题的回答文本,并输出上述待理解问题的回答文本。
基于待理解问题的回答文本的起始字符位置和终止字符位置之间字符的长度可以对回答文本做出进一步筛选,可以进一步地限定回答文本的长度,剔除回答文本中与待理解问题无关的信息,从而减少回答文本的冗余,提高阅读理解的效率。
在一些可行的实施方式中,上述处理器501用于:
从互联网中采集多个阅读理解文本的样本片段;和/或
从目标领域数据库中采集多个阅读理解文本的样本片段,上述目标领域数据库至少包括基于医疗领域的诊疗数据以及病理数据生成的医疗领域数据库;
其中,各阅读理解文本的样本片段包括问题片段以及上述问题片段对应的答案片段。
在一些可行的实施方式中,上述处理器501可以是中央处理单元(central processing unit,CPU),该处理器还可以是其他通用处理器、数字信号处理器(digital signal processor,DSP)、专用集成电路(application specific integrated circuit,ASIC)、现成可编程门阵列(field-programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。
该存储器502可以包括只读存储器和随机存取存储器,并向处理器501提供指令和数据。存储器502的一部分还可以包括非易失性随机存取存储器。例如,存储器502还可以存储设备类型的信息。
具体实现中,上述终端设备可通过其内置的各个功能模块执行如上述图1至图3中各个步骤所提供的实现方式,具体可参见上述各个步骤所提供的实现方式,在此不再赘述。
在本申请实施例中,通过对待理解文本中待理解问题所属的问题类型以及各待理解文章片段所回答的问题类型进行标注,可以在问题类型维度上增强待理解问题和待理解文章在语义上的关联性;对确定了问题类型后的待理解文本中的各字符进行特征标注以及位置 标注并输入语义匹配层,使得语义匹配层可以对待理解文本进行字符级别的阅读理解,在待理解文章中得到待理解问题的回答文本的起始字符位置和终止字符位置,从而得到上述待理解问题的回答文本,提高阅读理解的准确率。
本申请实施例还提供一种计算机可读存储介质,该计算机可读存储介质存储有计算机程序,该计算机程序包括程序指令,该程序指令被处理器执行时实现图1至图3中各个步骤所提供的方法,具体可参见上述各个步骤所提供的实现方式,在此不再赘述。
可选的,本申请涉及的存储介质如计算机可读存储介质可以是非易失性的,也可以是易失性的。
上述计算机可读存储介质可以是前述任一实施例提供的基于预测模型的用户行为识别装置或者上述终端设备的内部存储单元,例如电子设备的硬盘或内存。该计算机可读存储介质也可以是该电子设备的外部存储设备,例如该电子设备上配备的插接式硬盘,智能存储卡(smart media card,SMC),安全数字(secure digital,SD)卡,闪存卡(flash card)等。进一步地,该计算机可读存储介质还可以既包括该电子设备的内部存储单元也包括外部存储设备。该计算机可读存储介质用于存储该计算机程序以及该电子设备所需的其他程序和数据。该计算机可读存储介质还可以用于暂时地存储已经输出或者将要输出的数据。
本申请的权利要求书和说明书及附图中的术语“第一”、“第二”、“第三”、“第四”等是用于区别不同对象,而不是用于描述特定顺序。此外,术语“包括”和“具有”以及它们任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可选地还包括没有列出的步骤或单元,或可选地还包括对于这些过程、方法、产品或设备固有的其它步骤或单元。在本文中提及“实施例”意味着,结合实施例描述的特定特征、结构或特性可包含在本申请的至少一个实施例中。在说明书中的各个位置展示该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的实施例。本领域技术人员显式地和隐式地理解的是,本文所描述的实施例可与其它实施例相结合。在本申请说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
本申请实施例提供的方法及相关装置是参照本申请实施例提供的方法流程图和/或结构示意图来描述的,具体可由计算机程序指令实现方法流程图和/或结构示意图的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。这些计算机程序指令可提供到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或结构示意图一个方框或多个方框中指定的功能的装置。这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或结构示意图一个方框或多个方框中指定的功能。这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或结构示意一个方框或多个方框中指定的功能的步骤。

Claims (20)

  1. 一种文本处理方法,其中,所述方法包括:
    获取待理解文本,所述待理解文本包括待理解问题和多个待理解文章片段;
    将所述待理解文本输入阅读理解模型,通过所述阅读理解模型的语义分析层确定出所述待理解问题所属的问题类型标注,以及各待理解文章片段所回答问题的问题类型标注;
    通过所述阅读理解模型的语义分析层确定出所述待理解文本中各字符的特征标注以及所述各字符的位置标注;
    通过所述阅读理解模型的语义匹配层基于所述待理解问题所属的问题类型标注、所述各待理解文章片段所回答问题的问题类型标注、所述待理解文本中各字符的特征标注以及所述各字符的位置标注,确定所述待理解问题的回答文本的起始字符位置和终止字符位置;
    根据所述起始字符位置和所述终止字符位置从所述待理解文本中确定出所述待理解问题的回答文本。
  2. 根据权利要求1所述的方法,其中,所述将所述待理解文本输入阅读理解模型之前,所述方法还包括:
    采集多个阅读理解文本的样本片段,所述样本片段包括问题片段以及所述问题片段对应的答案片段;
    确定各样本片段中各问题片段所属的问题类型标注,以及各答案片段所回答问题的问题类型标注;
    确定所述各样本片段中各字符的特征标注以及所述各字符的位置标注;
    基于所述各问题片段所属的问题类型标注、所述各答案片段所回答问题的问题类型标注、所述样本片段中各字符的特征标注以及所述各字符的位置标注,对所述阅读理解模型的语义分析层以及语义匹配层进行训练。
  3. 根据权利要求2所述的方法,其中,所述基于所述各问题片段所属的问题类型标注、所述各答案片段所回答问题的问题类型标注、所述样本片段中各字符的特征标注以及所述各字符的位置标注,对所述阅读理解模型的语义分析层以及语义匹配层进行训练包括:
    获取基于任一样本片段包括的问题片段所属的问题类型标注、所述问题片段对应的答案片段所回答问题的问题类型标注、所述任一样本片段中各字符的特征标注以及所述各字符的位置标注,对所述阅读理解模型的语义匹配层进行训练后得到的第一语义匹配层网络参数;
    通过所述阅读理解模型的门控循环层确定所述第一语义匹配层网络参数的评分;
    当所述第一语义匹配层网络参数的评分大于或等于阈值时,通过所述门控循环层将所述语义匹配层的网络参数确定为所述第一语义匹配层网络参数;
    当所述第一语义匹配层网络参数的评分小于阈值时,通过所述门控循环层将所述语义匹配层的网络参数确定为第二语义匹配层网络参数;
    其中,所述第二语义匹配层网络参数为基于在先样本片段包括的问题片段所属的问题类型标注、所述问题片段对应的答案片段所回答问题的问题类型标注、所述在先样本片段中各字符的特征标注以及所述各字符的位置标注,对所述阅读理解模型的语义匹配层进行训练后得到的语义匹配层网络参数,所述在先样本片段为在所述任一样本片段之前输入所述阅读理解模型的样本片段。
  4. 根据权利要求1-3任一项所述的方法,其中,所述通过所述阅读理解模型的语义匹配层基于所述待理解问题所属的问题类型标注、所述各待理解文章片段所回答问题的问题类型标注、所述待理解文本中各字符的特征标注以及所述各字符的位置标注,确定所述待理解问题的回答文本的起始字符位置和终止字符位置包括:
    通过所述阅读理解模型的语义匹配层基于所述待理解问题所属的问题类型标注、各待 理解文章片段所回答问题的问题类型标注、所述待理解文本中各字符的特征标注以及所述各字符的位置标注,从所述待理解文章文本中确定出多个预选起始字符位置和多个预选终止字符位置,以得到多个预选回答文本;
    通过所述语义匹配层基于各预选回答文本与所述待理解问题的匹配度,确定出所述各预选回答文本用于回答所述待理解问题的评分;
    将所述各预选回答文本中评分最高的预选回答文本的预选起始字符位置和预选终止字符位置作为所述待理解问题的回答文本的起始字符位置和终止字符位置。
  5. 根据权利要求4所述的方法,其中,所述根据所述起始字符位置和所述终止字符位置从所述待理解文本中确定出所述待理解问题的回答文本包括:
    若所述待理解问题的回答文本的起始字符位置与终止字符位置的字符距离在阈值区间内,则从所述待理解文本中确定出所述起始字符位置和所述终止字符位置之间的文本作为所述待理解问题的回答文本,并输出所述待理解问题的回答文本。
  6. 根据权利要求2所述的方法,其中,所述采集多个阅读理解文本的样本片段包括:
    从互联网中采集多个阅读理解文本的样本片段;和/或
    从目标领域数据库中采集多个阅读理解文本的样本片段,所述目标领域数据库至少包括基于医疗领域的诊疗数据以及病理数据生成的医疗领域数据库;
    其中,各阅读理解文本的样本片段包括问题片段以及所述问题片段对应的答案片段。
  7. 一种文本处理装置,其中,所述装置包括:
    文本获取模块,用于获取待理解文本,所述待理解文本包括待理解问题和多个待理解文章片段;
    分类标注模块,用于将所述待理解文本输入阅读理解模型,通过所述阅读理解模型的语义分析层确定出所述待理解问题所属的问题类型标注,以及各待理解文章片段所回答问题的问题类型标注;
    语义标注模块,用于通过所述阅读理解模型的语义分析层确定出所述待理解文本中各字符的特征标注以及所述各字符的位置标注;
    语义匹配模块,用于通过所述阅读理解模型的语义匹配层基于所述待理解问题所属的问题类型标注、所述各待理解文章片段所回答问题的问题类型标注、所述待理解文本中各字符的特征标注以及所述各字符的位置标注,确定所述待理解问题的回答文本的起始字符位置和终止字符位置,并根据所述起始字符位置和所述终止字符位置从所述待理解文本中确定出所述待理解问题的回答文本。
  8. 根据权利要求7所述的装置,其中,所述语义匹配模块包括:
    文本确认单元,用于通过所述阅读理解模型的语义匹配层基于所述待理解问题所属的问题类型标注、各待理解文章片段所回答问题的问题类型标注、所述待理解文本中各字符的特征标注以及所述各字符的位置标注,从所述待理解文章文本中确定出多个预选起始字符位置和多个预选终止字符位置,以得到多个预选回答文本;
    回答评分单元,用于通过所述语义匹配层基于各预选回答文本与所述待理解问题的匹配度,确定出所述各预选回答文本用于回答所述待理解问题的评分;
    回答确认单元,用于将所述各预选回答文本中评分最高的预选回答文本的预选起始字符位置和预选终止字符位置作为所述待理解问题的回答文本的起始字符位置和终止字符位置。
  9. 一种终端设备,其中,包括处理器和存储器,所述处理器和存储器相互连接,其中,所述存储器用于存储计算机程序,所述计算机程序包括程序指令,所述处理器被配置用于调用所述程序指令,执行以下方法:
    获取待理解文本,所述待理解文本包括待理解问题和多个待理解文章片段;
    将所述待理解文本输入阅读理解模型,通过所述阅读理解模型的语义分析层确定出所述待理解问题所属的问题类型标注,以及各待理解文章片段所回答问题的问题类型标注;
    通过所述阅读理解模型的语义分析层确定出所述待理解文本中各字符的特征标注以及所述各字符的位置标注;
    通过所述阅读理解模型的语义匹配层基于所述待理解问题所属的问题类型标注、所述各待理解文章片段所回答问题的问题类型标注、所述待理解文本中各字符的特征标注以及所述各字符的位置标注,确定所述待理解问题的回答文本的起始字符位置和终止字符位置;
    根据所述起始字符位置和所述终止字符位置从所述待理解文本中确定出所述待理解问题的回答文本。
  10. 根据权利要求9所述的终端设备,其中,所述将所述待理解文本输入阅读理解模型之前,所述处理器还用于执行:
    采集多个阅读理解文本的样本片段,所述样本片段包括问题片段以及所述问题片段对应的答案片段;
    确定各样本片段中各问题片段所属的问题类型标注,以及各答案片段所回答问题的问题类型标注;
    确定所述各样本片段中各字符的特征标注以及所述各字符的位置标注;
    基于所述各问题片段所属的问题类型标注、所述各答案片段所回答问题的问题类型标注、所述样本片段中各字符的特征标注以及所述各字符的位置标注,对所述阅读理解模型的语义分析层以及语义匹配层进行训练。
  11. 根据权利要求10所述的终端设备,其中,执行所述基于所述各问题片段所属的问题类型标注、所述各答案片段所回答问题的问题类型标注、所述样本片段中各字符的特征标注以及所述各字符的位置标注,对所述阅读理解模型的语义分析层以及语义匹配层进行训练包括:
    获取基于任一样本片段包括的问题片段所属的问题类型标注、所述问题片段对应的答案片段所回答问题的问题类型标注、所述任一样本片段中各字符的特征标注以及所述各字符的位置标注,对所述阅读理解模型的语义匹配层进行训练后得到的第一语义匹配层网络参数;
    通过所述阅读理解模型的门控循环层确定所述第一语义匹配层网络参数的评分;
    当所述第一语义匹配层网络参数的评分大于或等于阈值时,通过所述门控循环层将所述语义匹配层的网络参数确定为所述第一语义匹配层网络参数;
    当所述第一语义匹配层网络参数的评分小于阈值时,通过所述门控循环层将所述语义匹配层的网络参数确定为第二语义匹配层网络参数;
    其中,所述第二语义匹配层网络参数为基于在先样本片段包括的问题片段所属的问题类型标注、所述问题片段对应的答案片段所回答问题的问题类型标注、所述在先样本片段中各字符的特征标注以及所述各字符的位置标注,对所述阅读理解模型的语义匹配层进行训练后得到的语义匹配层网络参数,所述在先样本片段为在所述任一样本片段之前输入所述阅读理解模型的样本片段。
  12. 根据权利要求9-11任一项所述的终端设备,其中,执行所述通过所述阅读理解模型的语义匹配层基于所述待理解问题所属的问题类型标注、所述各待理解文章片段所回答问题的问题类型标注、所述待理解文本中各字符的特征标注以及所述各字符的位置标注,确定所述待理解问题的回答文本的起始字符位置和终止字符位置包括:
    通过所述阅读理解模型的语义匹配层基于所述待理解问题所属的问题类型标注、各待理解文章片段所回答问题的问题类型标注、所述待理解文本中各字符的特征标注以及所述各字符的位置标注,从所述待理解文章文本中确定出多个预选起始字符位置和多个预选终 止字符位置,以得到多个预选回答文本;
    通过所述语义匹配层基于各预选回答文本与所述待理解问题的匹配度,确定出所述各预选回答文本用于回答所述待理解问题的评分;
    将所述各预选回答文本中评分最高的预选回答文本的预选起始字符位置和预选终止字符位置作为所述待理解问题的回答文本的起始字符位置和终止字符位置。
  13. 根据权利要求12所述的终端设备,其中,执行所述根据所述起始字符位置和所述终止字符位置从所述待理解文本中确定出所述待理解问题的回答文本包括:
    若所述待理解问题的回答文本的起始字符位置与终止字符位置的字符距离在阈值区间内,则从所述待理解文本中确定出所述起始字符位置和所述终止字符位置之间的文本作为所述待理解问题的回答文本,并输出所述待理解问题的回答文本。
  14. 根据权利要求10所述的终端设备,其中,执行所述采集多个阅读理解文本的样本片段包括:
    从互联网中采集多个阅读理解文本的样本片段;和/或
    从目标领域数据库中采集多个阅读理解文本的样本片段,所述目标领域数据库至少包括基于医疗领域的诊疗数据以及病理数据生成的医疗领域数据库;
    其中,各阅读理解文本的样本片段包括问题片段以及所述问题片段对应的答案片段。
  15. 一种计算机可读存储介质,其中,所述计算机可读存储介质存储有计算机程序,所述计算机程序包括程序指令,所述程序指令当被处理器执行时使所述处理器执行以下方法:
    获取待理解文本,所述待理解文本包括待理解问题和多个待理解文章片段;
    将所述待理解文本输入阅读理解模型,通过所述阅读理解模型的语义分析层确定出所述待理解问题所属的问题类型标注,以及各待理解文章片段所回答问题的问题类型标注;
    通过所述阅读理解模型的语义分析层确定出所述待理解文本中各字符的特征标注以及所述各字符的位置标注;
    通过所述阅读理解模型的语义匹配层基于所述待理解问题所属的问题类型标注、所述各待理解文章片段所回答问题的问题类型标注、所述待理解文本中各字符的特征标注以及所述各字符的位置标注,确定所述待理解问题的回答文本的起始字符位置和终止字符位置;
    根据所述起始字符位置和所述终止字符位置从所述待理解文本中确定出所述待理解问题的回答文本。
  16. 根据权利要求15所述的计算机可读存储介质,其中,所述将所述待理解文本输入阅读理解模型之前,所述程序指令当被处理器执行时还使所述处理器执行:
    采集多个阅读理解文本的样本片段,所述样本片段包括问题片段以及所述问题片段对应的答案片段;
    确定各样本片段中各问题片段所属的问题类型标注,以及各答案片段所回答问题的问题类型标注;
    确定所述各样本片段中各字符的特征标注以及所述各字符的位置标注;
    基于所述各问题片段所属的问题类型标注、所述各答案片段所回答问题的问题类型标注、所述样本片段中各字符的特征标注以及所述各字符的位置标注,对所述阅读理解模型的语义分析层以及语义匹配层进行训练。
  17. 根据权利要求16所述的计算机可读存储介质,其中,执行所述基于所述各问题片段所属的问题类型标注、所述各答案片段所回答问题的问题类型标注、所述样本片段中各字符的特征标注以及所述各字符的位置标注,对所述阅读理解模型的语义分析层以及语义匹配层进行训练包括:
    获取基于任一样本片段包括的问题片段所属的问题类型标注、所述问题片段对应的答 案片段所回答问题的问题类型标注、所述任一样本片段中各字符的特征标注以及所述各字符的位置标注,对所述阅读理解模型的语义匹配层进行训练后得到的第一语义匹配层网络参数;
    通过所述阅读理解模型的门控循环层确定所述第一语义匹配层网络参数的评分;
    当所述第一语义匹配层网络参数的评分大于或等于阈值时,通过所述门控循环层将所述语义匹配层的网络参数确定为所述第一语义匹配层网络参数;
    当所述第一语义匹配层网络参数的评分小于阈值时,通过所述门控循环层将所述语义匹配层的网络参数确定为第二语义匹配层网络参数;
    其中,所述第二语义匹配层网络参数为基于在先样本片段包括的问题片段所属的问题类型标注、所述问题片段对应的答案片段所回答问题的问题类型标注、所述在先样本片段中各字符的特征标注以及所述各字符的位置标注,对所述阅读理解模型的语义匹配层进行训练后得到的语义匹配层网络参数,所述在先样本片段为在所述任一样本片段之前输入所述阅读理解模型的样本片段。
  18. 根据权利要求15-17任一项所述的计算机可读存储介质,其中,执行所述通过所述阅读理解模型的语义匹配层基于所述待理解问题所属的问题类型标注、所述各待理解文章片段所回答问题的问题类型标注、所述待理解文本中各字符的特征标注以及所述各字符的位置标注,确定所述待理解问题的回答文本的起始字符位置和终止字符位置包括:
    通过所述阅读理解模型的语义匹配层基于所述待理解问题所属的问题类型标注、各待理解文章片段所回答问题的问题类型标注、所述待理解文本中各字符的特征标注以及所述各字符的位置标注,从所述待理解文章文本中确定出多个预选起始字符位置和多个预选终止字符位置,以得到多个预选回答文本;
    通过所述语义匹配层基于各预选回答文本与所述待理解问题的匹配度,确定出所述各预选回答文本用于回答所述待理解问题的评分;
    将所述各预选回答文本中评分最高的预选回答文本的预选起始字符位置和预选终止字符位置作为所述待理解问题的回答文本的起始字符位置和终止字符位置。
  19. 根据权利要求18所述的计算机可读存储介质,其中,执行所述根据所述起始字符位置和所述终止字符位置从所述待理解文本中确定出所述待理解问题的回答文本包括:
    若所述待理解问题的回答文本的起始字符位置与终止字符位置的字符距离在阈值区间内,则从所述待理解文本中确定出所述起始字符位置和所述终止字符位置之间的文本作为所述待理解问题的回答文本,并输出所述待理解问题的回答文本。
  20. 根据权利要求16所述的计算机可读存储介质,其中,执行所述采集多个阅读理解文本的样本片段包括:
    从互联网中采集多个阅读理解文本的样本片段;和/或
    从目标领域数据库中采集多个阅读理解文本的样本片段,所述目标领域数据库至少包括基于医疗领域的诊疗数据以及病理数据生成的医疗领域数据库;
    其中,各阅读理解文本的样本片段包括问题片段以及所述问题片段对应的答案片段。
PCT/CN2021/097086 2020-12-17 2021-05-31 文本处理方法、装置、设备及存储介质 WO2022127040A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011501996.6A CN112613322B (zh) 2020-12-17 2020-12-17 文本处理方法、装置、设备及存储介质
CN202011501996.6 2020-12-17

Publications (1)

Publication Number Publication Date
WO2022127040A1 true WO2022127040A1 (zh) 2022-06-23

Family

ID=75241022

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/097086 WO2022127040A1 (zh) 2020-12-17 2021-05-31 文本处理方法、装置、设备及存储介质

Country Status (2)

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

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112613322B (zh) * 2020-12-17 2023-10-24 平安科技(深圳)有限公司 文本处理方法、装置、设备及存储介质
CN113139033A (zh) * 2021-05-13 2021-07-20 平安国际智慧城市科技股份有限公司 文本处理方法、装置、设备及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180286383A1 (en) * 2017-03-31 2018-10-04 Wipro Limited System and method for rendering textual messages using customized natural voice
CN109992665A (zh) * 2019-03-14 2019-07-09 广州智语信息科技有限公司 一种基于问题目标特征扩展的分类方法
CN110309305A (zh) * 2019-06-14 2019-10-08 中国电子科技集团公司第二十八研究所 基于多任务联合训练的机器阅读理解方法及计算机存储介质
CN112613322A (zh) * 2020-12-17 2021-04-06 平安科技(深圳)有限公司 文本处理方法、装置、设备及存储介质

Family Cites Families (5)

* 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
US8275803B2 (en) * 2008-05-14 2012-09-25 International Business Machines Corporation System and method for providing answers to questions
CN110609886A (zh) * 2019-09-18 2019-12-24 北京金山数字娱乐科技有限公司 一种文本分析方法及装置
CN111027327B (zh) * 2019-10-29 2022-09-06 平安科技(深圳)有限公司 机器阅读理解方法、设备、存储介质及装置
CN111046158B (zh) * 2019-12-13 2020-12-15 腾讯科技(深圳)有限公司 问答匹配方法及模型训练方法、装置、设备、存储介质

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180286383A1 (en) * 2017-03-31 2018-10-04 Wipro Limited System and method for rendering textual messages using customized natural voice
CN109992665A (zh) * 2019-03-14 2019-07-09 广州智语信息科技有限公司 一种基于问题目标特征扩展的分类方法
CN110309305A (zh) * 2019-06-14 2019-10-08 中国电子科技集团公司第二十八研究所 基于多任务联合训练的机器阅读理解方法及计算机存储介质
CN112613322A (zh) * 2020-12-17 2021-04-06 平安科技(深圳)有限公司 文本处理方法、装置、设备及存储介质

Also Published As

Publication number Publication date
CN112613322B (zh) 2023-10-24
CN112613322A (zh) 2021-04-06

Similar Documents

Publication Publication Date Title
CN104516942B (zh) 概念驱动的自动分节标识
WO2021189971A1 (zh) 基于知识图谱表征学习的医疗方案推荐系统及方法
WO2021139232A1 (zh) 基于医疗知识图谱的分诊方法、装置、设备及存储介质
US20090299977A1 (en) Method for Automatic Labeling of Unstructured Data Fragments From Electronic Medical Records
WO2022127040A1 (zh) 文本处理方法、装置、设备及存储介质
CN110069779B (zh) 医疗文本的症状实体识别方法及相关装置
CN110032649B (zh) 一种中医文献的实体间关系抽取方法及装置
CN106874643A (zh) 基于词向量自动构建知识库实现辅助诊疗的方法和系统
WO2018201772A1 (zh) 医疗文本的潜在疾病推断方法、系统及可读存储介质
KR102424085B1 (ko) 기계-보조 대화 시스템 및 의학적 상태 문의 장치 및 방법
US10599776B2 (en) Predicate parses using semantic knowledge
US11869501B2 (en) Processing multi-party conversations
Shen et al. On the generation of medical question-answer pairs
Liu et al. Augmented LSTM framework to construct medical self-diagnosis android
CN115472252A (zh) 基于对话的电子病历生成方法、装置、设备和存储介质
Liu et al. MedDG: an entity-centric medical consultation dataset for entity-aware medical dialogue generation
CN116313120A (zh) 模型预训练方法、医学应用任务处理方法及其相关装置
CN111177309A (zh) 病历数据的处理方法及装置
Galitsky et al. Multi-case-based reasoning by syntactic-semantic alignment and discourse analysis
Zhu et al. Knowledge-based question answering by jointly generating, copying and paraphrasing
Shi et al. Understanding patient query with weak supervision from doctor response
Mucheng et al. TCM-SD: A Benchmark for Probing Syndrome Differentiation via Natural Language Processing
Ren et al. Extraction of transitional relations in healthcare processes from Chinese medical text based on deep learning
Sun et al. Multi-strategy fusion for medical named entity recognition
Gu et al. Design of Intelligent QA for Self-learning of College Students Based on BERT

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21904975

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21904975

Country of ref document: EP

Kind code of ref document: A1