A sample screening method and device

By screening text fragments of the sample corpus to determine positive and negative samples, the problem in the existing technology of subjectivity of sample labeling and poor-quality samples affecting model training is solved, and the training accuracy of the machine learning model is improved.

CN113407685BActive Publication Date: 2024-09-06BEIJING KINGSOFT DIGITAL ENTERTAINMENT CO LTD
View PDF 14 Cites 0 Cited by

Patent Information

Application Number
CN202110527983.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-14
Publication Date
2024-09-06
Estimated Expiration
2041-05-14

AI Technical Summary

Technical Problem

In the existing technology, during the training process of machine learning models, due to human subjective factors in sample annotation and the failure to effectively screen poor-quality samples, the accuracy of model training is low.

Method used

By obtaining sample corpus of sample questions and corresponding answers, extract text fragments and filter them. Text fragments containing complete answers are used as positive samples, and text fragments that do not contain answers are used as negative samples. Question text pairs are constructed and the answer extraction model is trained.

Benefits of technology

It improves the sample quality of model training, reduces the interference of low-quality samples on training results, and improves the accuracy of model training.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113407685B
    Figure CN113407685B
Patent Text Reader

Abstract

The present application provides a sample screening method and device, wherein the sample screening method comprises: obtaining a sample question and a sample corpus containing an answer corresponding to the sample question, extracting text fragments from the corpus text of the sample corpus as a text fragment set of the corpus text, wherein the size of the text fragment is determined according to the answer corresponding to the sample question, screening the text fragments in the text fragment set, and using the text fragment containing the complete answer as the positive sample text of the sample question, and using the text fragment not containing the answer as the negative sample text of the sample question.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a sample screening method and apparatus, a computing device, and a computer-readable storage medium. Background Art

[0002] For machine learning, especially deep learning, the operation of most algorithms requires a large amount of sample data. The richness and accuracy of sample data are of great significance to machine learning.

[0003] In the current model training process, due to the subjective factors of manual labeling and the large number of training samples, it is impossible to manually screen out some low-quality samples one by one, which affects the model training effect. Or some scenarios require the construction of positive and negative samples for model training, but due to the failure to effectively screen positive and negative samples, the accuracy of the trained model is not high. Summary of the invention

[0004] In view of this, the embodiments of the present application provide a sample screening method and apparatus, a computing device, and a computer-readable storage medium to address the technical deficiencies in the prior art.

[0005] According to a first aspect of an embodiment of the present application, a sample screening method is provided, comprising:

[0006] Obtaining sample questions and sample corpora containing answers corresponding to the sample questions;

[0007] Extracting text segments from the corpus text of the sample corpus as a text segment set of the corpus text, wherein the size of the text segment is determined according to the answer corresponding to the sample question;

[0008] The text fragments in the text fragment set are screened, and the text fragments containing the complete answer are used as positive sample texts of the sample question, and the text fragments not containing the answer are used as negative sample texts of the sample question.

[0009] Optionally, extracting text segments from the corpus text of the sample corpus as a text segment set of the corpus text includes:

[0010] Determining a starting sliding position of the corpus text of the sample corpus;

[0011] The feature extraction window starts from the starting sliding position and slides in the corpus text according to a preset sliding step length, and the text segments extracted by the feature extraction window during the sliding process are used as the text segment set of the corpus text.

[0012] Optionally, extracting text segments from the corpus text of the sample corpus as a text segment set of the corpus text includes:

[0013] Determining a starting sliding position of the corpus text of the sample corpus;

[0014] The feature extraction window with varying size starts from the starting sliding position and slides in the corpus text according to a preset sliding step length, and the text segments extracted by the feature extraction window during the sliding process are used as the text segment set of the corpus text.

[0015] Optionally, extracting text segments from the corpus text of the sample corpus as a text segment set of the corpus text includes:

[0016] Determining a starting sliding position of the corpus text of the sample corpus;

[0017] A fixed-size feature extraction window starts from the starting sliding position and slides in the corpus text according to a preset sliding step length, and the text segments extracted by the feature extraction window during the sliding process are used as the text segment set of the corpus text.

[0018] Optionally, screening the text fragments in the text fragment set includes:

[0019] The text fragments in the text fragment set are screened using a preset text fragment screening algorithm.

[0020] Optionally, screening the text fragments in the text fragment set includes:

[0021] Determine a starting position identifier and an ending position identifier of an answer corresponding to the sample question in the sample corpus;

[0022] The text segments in the text segment set are screened according to the start position identifier and the end position identifier.

[0023] Optionally, the filtering of the text segments in the text segment set according to the start position identifier and the end position identifier includes:

[0024] The text segments in the text segment set that contain the start position identifier and the end position identifier are used as the positive sample texts; and the text segments that do not contain the start position identifier and the end position identifier are used as the negative sample texts.

[0025] Optionally, the sample screening method further includes:

[0026] Constructing a question text pair based on the sample question, the positive sample text, and the negative sample text;

[0027] The question text is input into an answer extraction model to be trained to obtain the answer extraction model, wherein the answer extraction model associates the sample question with the positive sample text and / or the negative sample text.

[0028] According to a second aspect of an embodiment of the present application, a sample screening device is provided, comprising:

[0029] An acquisition module is configured to acquire sample questions and sample corpora containing answers corresponding to the sample questions;

[0030] A sliding module is configured to extract text segments from the corpus text of the sample corpus as a text segment set of the corpus text, wherein the size of the text segment is determined according to the answer corresponding to the sample question;

[0031] The screening module is configured to screen the text fragments in the text fragment set, and use the text fragment containing the complete answer as the positive sample text of the sample question, and use the text fragment not containing the answer as the negative sample text of the sample question.

[0032] According to a third aspect of an embodiment of the present application, a computing device is provided, comprising a memory, a processor, and computer instructions stored in the memory and executable on the processor, wherein the processor implements the steps of the sample screening method when executing the instructions.

[0033] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, which stores computer instructions, and when the instructions are executed by a processor, the steps of the sample screening method are implemented.

[0034] According to a fifth aspect of an embodiment of the present application, a chip is provided, which stores computer instructions, and the instructions implement the steps of the sample screening method when executed by the chip.

[0035] In an embodiment of the present application, a sample question and a sample corpus containing answers corresponding to the sample question are obtained, text fragments are extracted from the corpus text of the sample corpus as a text fragment set of the corpus text, wherein the size of the text fragment is determined according to the answer corresponding to the sample question, the text fragments in the text fragment set are screened, and the text fragment containing the complete answer is used as the positive sample text of the sample question, and the text fragment not containing the answer is used as the negative sample text of the sample question.

[0036] The embodiment of the present application divides a long corpus text into text segments to obtain a plurality of short corpus texts, and determines positive and negative samples for model training by screening the plurality of short corpus texts, wherein the positive sample contains a complete answer to a sample question, and the negative sample does not contain any text information in the text segment corresponding to the answer to the sample question; the positive and negative samples are determined by screening the plurality of short corpus texts, thereby ensuring the accuracy of the training results obtained by using the positive and negative samples for model training. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 is a structural block diagram of a computing device provided in an embodiment of the present application;

[0038] Figure 2 is a flow chart of a sample screening method provided in an embodiment of the present application;

[0039] FIG3( a ) is a schematic diagram of truncating a long text by means of a sliding window provided in an embodiment of the present application;

[0040] FIG3( b ) is a schematic diagram of another method of truncating a long text provided in an embodiment of the present application;

[0041] Figure 4 is a schematic diagram of the model training process provided in the embodiment of the present application;

[0042] Figure 5 is a flow chart of the processing process of the sample screening method provided in the embodiment of the present application;

[0043] Figure 6 It is a schematic diagram of the structure of a sample screening device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0044] Many specific details are described in the following description to facilitate a full understanding of the present application. However, the present application can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present application, so the present application is not limited by the specific implementation disclosed below.

[0045] The terms used in one or more embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of the present application. The singular forms of "a", "said" and "the" used in one or more embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of the present application refers to and includes any or all possible combinations of one or more associated listed items.

[0046] It should be understood that, although the terms first, second, etc. may be used to describe various information in one or more embodiments of the present application, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of the present application, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "in response to determination".

[0047] First, the terms involved in one or more embodiments of the present invention are explained.

[0048] EQA: Extractive Question Answering.

[0049] Positive sample: a sample with the same label as the real sample, or a sample belonging to a certain category.

[0050] Negative samples: samples whose labels are inconsistent with the true sample labels, or samples that do not belong to a certain category.

[0051] In classification problems, such as face recognition problems, if it is necessary to perform face recognition on the user to be identified in the image, then the positive sample is the area (rectangular box) where the face is located in the image, and the negative sample is the area (rectangular box) where other objects are located in the image except the face area; or, in detection problems, such as answer detection problems, if it is necessary to extract the answer to a question from a text, then the text containing the complete answer to the question is the positive sample, and the text that does not contain any content corresponding to the answer to the question is the negative sample.

[0052] Sliding window: When processing corpus text, the sliding window can be one or more windows. The size of the window can be specified, and the window slides from the beginning of the text to the end of the text.

[0053] Feature extraction: Given a corpus text, feature extraction is the process of extracting feature sequences, specifically, extracting the content (i.e., string) in the window while the window is sliding.

[0054] In the present application, a sample screening method and apparatus, a computing device and a computer-readable storage medium are provided, which are described in detail one by one in the following embodiments.

[0055] Figure 1 The structure block diagram of a computing device 100 according to an embodiment of the present application is shown. The components of the computing device 100 include but are not limited to a memory 110 and a processor 120. The processor 120 is connected to the memory 110 via a bus 130, and the database 150 is used to store data.

[0056] The computing device 100 also includes an access device 140 that enables the computing device 100 to communicate via one or more networks 160. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 140 may include one or more of any type of network interface (e.g., a network interface card (NIC)) whether wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a World Wide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.

[0057] In one embodiment of the present application, the above components of the computing device 100 and Figure 1 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 1 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of the present application. Those skilled in the art may add or replace other components as needed.

[0058] The computing device 100 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or PC. The computing device 100 may also be a mobile or stationary server.

[0059] The processor 120 may execute Figure 2 Steps in the sample screening method shown. Figure 2 A flow chart of a sample screening method according to an embodiment of the present application is shown, including steps 202 to 206.

[0060] Step 202: Obtain a sample question and a sample corpus containing answers corresponding to the sample question.

[0061] At present, machine reading comprehension is an important research topic in the field of natural language processing. Common tasks include cloze, multiple choice, answer extraction, free answer, etc. Among them, answer extraction (Extractive Text Question Answering EQA) is to organize the question query and the text fragment para into a question text pair and input it into the answer extraction model, so that the answer extraction model can extract the answer to the question from the text fragment.

[0062] In the traditional answer extraction model training process, the sample sampling method of training data is mainly to use all samples for training, that is, without filtering the samples; or, randomly select some negative samples in a certain proportion to participate in the training. The answer extraction models obtained by these two training methods are not accurate enough.

[0063] When the sample corpus is divided into text segments, a batch of samples that interfere with the model training results will be obtained. We classify these samples as negative samples, but these negative samples contain part of the text of the correct answer. Therefore, these negative samples will interfere with the model training results to a certain extent during model training.

[0064] Based on this, the sample screening method provided in the embodiment of the present application is, for a question query, given a text, the text contains the answer corresponding to the question query, if the text is a long text (the number of characters contained in the text is greater than a preset threshold), then a sliding window method is selected to truncate the long text into multiple short texts, wherein, among these multiple short texts, there are some short texts that contain the complete content of the answer corresponding to the question query, some short texts contain partial content of the answer corresponding to the question query, and some short texts do not contain any content of the answer corresponding to the question query. The embodiment of the present application filters the short texts to filter out the short texts containing partial content of the answer corresponding to the question query, thereby improving the quality of samples used for model training, reducing the interference of low-quality samples on model training, and facilitating the improvement of model training results.

[0065] Specifically, the sample corpus is a written text containing certain information content, which can be a sentence, a paragraph, multiple paragraphs, an article or multiple articles, etc., and can also be a text in various languages ​​such as Chinese text, English text, Russian text, etc. This application does not impose any restrictions on this.

[0066] The sample questions are questions that require answers or explanations, and may be questions related to the information content in the sample corpus or questions unrelated to the information content in the sample corpus, and this application does not impose any restrictions on this.

[0067] Step 204: extract text segments from the corpus text of the sample corpus as a text segment set of the corpus text.

[0068] The size of the text segment is determined according to the answer corresponding to the sample question.

[0069] In a specific implementation, extracting text segments from the corpus text of the sample corpus as the text segment set of the corpus text can be implemented in the following ways:

[0070] Determining a starting sliding position of the corpus text of the sample corpus;

[0071] The feature extraction window starts from the starting sliding position and slides in the corpus text according to a preset sliding step length, and the text segments extracted by the feature extraction window during the sliding process are used as the text segment set of the corpus text.

[0072] Specifically, the starting sliding position may be the position of the starting character of the sample corpus, the position of the ending character of the sample corpus, or the position of other characters of the sample corpus.

[0073] The feature extraction window starts from the starting sliding position and slides according to the arrangement order of each character in the sample corpus and the preset sliding step length; wherein the arrangement order is the arrangement order of each character between the starting character and the ending character of the sample corpus. Usually, characters can form a text expressing a certain meaning after being arranged in a certain order.

[0074] In practical applications, for a sample question, given a text (sample corpus) containing the answer corresponding to the sample question, when the answer extraction model is trained using the sample question and the text, since the text contains a large number of word units and the input length of the answer extraction model is fixed at 512 word units, for long texts, it is generally chosen to truncate the long text into multiple short texts through a sliding window.

[0075] A schematic diagram of truncating a long text by means of a sliding window provided in an embodiment of the present application is shown in FIG3( a ).

[0076] Given a sample question and a long text containing the answer corresponding to the sample question, the position of the answer corresponding to the sample question in the text is shown in the annotation result of Figure 3(a).

[0077] For a complete long text, the long text is segmented into multiple text segments by using a sliding window method, wherein the width of the window (i.e., the length of the text segment) is generally greater than or equal to the length of the string of the answer. The segmentation result is shown in FIG3(a), which specifically divides the long text into six text segments, namely, para1, para2, ..., para6.

[0078] In the embodiment of the present application, when the width of the feature extraction window satisfies the condition that the width is greater than or equal to the length of the string of the answer, the specific size of the feature extraction window is not further limited. In actual applications, when using the feature extraction window to extract text fragments, the size of the feature extraction window can be a fixed value or can change continuously during the sliding of the feature extraction window.

[0079] If the text segments are extracted using a feature extraction window with a varying size, the text segments are extracted from the corpus text of the sample corpus as a text segment set of the corpus text, which can be achieved in the following manner:

[0080] Determining a starting sliding position of the corpus text of the sample corpus;

[0081] The feature extraction window with varying size starts from the starting sliding position and slides in the corpus text according to a preset sliding step length, and the text segments extracted by the feature extraction window during the sliding process are used as the text segment set of the corpus text.

[0082] Specifically, except that the size of the feature extraction window changes during the sliding process, the specific text segment extraction process is similar to the text segment extraction process of the aforementioned embodiment. The specific implementation process can be found in the contents of the aforementioned embodiment, which will not be repeated here.

[0083] Among them, the width of the feature extraction window can change randomly during the sliding process, or be set to change according to a certain rule (for example, gradually increasing, first gradually increasing and then gradually decreasing, etc.), when the condition of being greater than or equal to the length of the string of the answer is satisfied. The specific width can be determined according to actual needs and is not limited here. In addition, in order to ensure that the embodiment of the present application can extract complete text information through the feature extraction window, the height of the feature extraction window can be determined according to the height of the characters in the corpus text. Specifically, the height of the feature extraction window can be set to be greater than the height of the characters in the corpus text. When this condition is met, the specific feature extraction height can be determined according to actual needs and is not limited here.

[0084] Taking the case where the size of the feature extraction window changes gradually during the sliding process, first decreasing and then increasing, as an example, the schematic diagram of truncating a long text is shown in FIG3( b ).

[0085] Given a sample question and a long text containing the answer corresponding to the sample question, the position of the answer corresponding to the sample question in the text is shown in the annotation result of Figure 3(b).

[0086] For a complete long text, the long text is segmented into multiple text segments by a sliding window method, wherein the width of the window (i.e., the length of the text segment) is generally greater than or equal to the length of the answer string. Under the premise of satisfying this condition, the width of the window can change in the sliding process according to the rule of gradually decreasing first and then gradually increasing, and the long text is segmented according to the size of each window during the change process. The segmentation result is shown in FIG3(b), specifically, the long text is divided into seven text segments, namely, para1, para2, ..., para6, and para7. Among them, the text segment para4 contains the complete content of the answer corresponding to the sample question, and compared with para3 in FIG3(a), para4 contains relatively less other content unrelated to the sample question while containing the complete content of the answer corresponding to the sample question. In this case, if the text segment para4 is used as a positive sample text, then the sample question, the positive sample text containing the text segment para4, and other negative sample texts are used to train the answer extraction model, which is beneficial to improving the model training efficiency and ensuring the accuracy of the model training results.

[0087] Alternatively, if a fixed-size feature extraction window is used to extract text segments, then the text segments are extracted from the corpus text of the sample corpus as the text segment set of the corpus text, which can also be achieved in the following manner:

[0088] Determining a starting sliding position of the corpus text of the sample corpus;

[0089] A fixed-size feature extraction window starts from the starting sliding position and slides in the corpus text according to a preset sliding step length, and the text segments extracted by the feature extraction window during the sliding process are used as the text segment set of the corpus text.

[0090] Specifically, except that the size of the feature extraction window is limited to not change during the sliding process, the specific text segment extraction process is similar to the text segment extraction process of the aforementioned embodiment. The specific implementation process can be found in the contents of the aforementioned embodiment, which will not be repeated here.

[0091] A schematic diagram of the segmentation results generated by segmenting text using a fixed-size feature extraction window is shown in FIG3(a). In FIG3(a), the text segments 1 (para1) to 6 (para6) generated by segmentation contain the same number of text units.

[0092] In practical applications, if the size of the feature extraction window is fixed, the size of the feature extraction window must be larger than the length of the answer corresponding to the query question contained in the sample corpus. On the basis of meeting this condition, the actual size of the feature extraction window can be determined according to actual needs and is not limited here.

[0093] The embodiment of the present application divides the corpus text into text segments through a feature extraction window of fixed size, which simplifies the text feature extraction process and is beneficial to improving the efficiency of text feature extraction; in addition, dividing the corpus text into text segments through a feature extraction window of varying size is beneficial to ensuring the diversity of the text segmentation results, thereby facilitating improving the accuracy of the training results obtained by using the positive and negative samples for model training.

[0094] Step 206 , screening the text segments in the text segment set, and taking the text segments containing the complete answer as the positive sample text of the sample question, and taking the text segments not containing the answer as the negative sample text of the sample question.

[0095] The positive sample text includes the complete corpus text of the answer, and the negative sample text does not include any corpus text of the answer.

[0096] Specifically, after using the feature extraction window to segment the corpus text to obtain multiple text fragments, the multiple text fragments can be filtered to filter out text fragments containing incomplete answers (i.e., containing partial content of the answer), and the remaining text fragments and sample questions can be used to train the answer extraction model to be trained. This sample screening method is conducive to ensuring the effectiveness of the training samples, thereby ensuring the accuracy of the model training results.

[0097] In specific implementation, the text fragments in the text fragment set are screened, which can also be achieved in the following ways:

[0098] Determine a starting position identifier and an ending position identifier of an answer corresponding to the sample question in the sample corpus;

[0099] The text segments in the text segment set are screened according to the start position identifier and the end position identifier.

[0100] Further, screening the text segments in the text segment set according to the start position identifier and the end position identifier includes:

[0101] The text segments in the text segment set that contain the start position identifier and the end position identifier are used as the positive sample texts; and the text segments that do not contain the start position identifier and the end position identifier are used as the negative sample texts.

[0102] Specifically, after the feature extraction window is used to segment the corpus text to obtain multiple text segments, the multiple text segments are filtered. Specifically, the starting position identifier and the ending position identifier of the answer to the query question in the sample corpus can be determined based on the association relationship between the word unit in the sample corpus and the identifier of the answer to the query question. After obtaining the sample question and the sample corpus, the answer corresponding to the sample question in the sample corpus can be determined based on the sample question, and corresponding identifiers can be added to these answers. Specifically, an association relationship between the answer and the identifier can be established to determine which word unit in the sample corpus is the starting position of the answer or the ending position of the answer (that is, which word units in the sample corpus constitute the answer corresponding to the sample question) based on the association relationship.

[0103] Then determine whether each text segment contains the starting position marker and the ending position marker. If so, the text segment can be used as the positive sample text, the text segment that does not contain the starting position marker and the ending position marker can be used as the negative sample text, and the text segment that contains the starting position marker or the ending position marker can be removed.

[0104] As shown in Figure 3(a), after the long text is divided into text segments, the following situations may occur: 1) the text segment contains a complete answer; 2) the text segment contains an incomplete answer, that is, it only contains part of the answer; 3) the text segment does not contain the answer at all.

[0105] Moreover, as can be seen from Figure 3(a), text fragments para1 and para4 contain part of the answer, para2 and para3 contain the complete answer, and para5 and para6 do not contain the answer at all. Therefore, para2 and para3 can be used as positive sample texts, para5 and para6 as negative sample texts, and para1 and para4 can be eliminated.

[0106] In specific implementation, after screening and obtaining the positive sample text and the negative sample text of the sample question, a sample pair can be constructed based on the sample question, the positive sample text and the negative sample text, and the model training can be performed using the sample pair, which can be implemented in the following ways:

[0107] Constructing a question text pair based on the sample question, the positive sample text, and the negative sample text;

[0108] The question text is input into an answer extraction model to be trained to obtain the answer extraction model, wherein the answer extraction model associates the sample question with the positive sample text and / or the negative sample text.

[0109] Specifically, after dividing the corpus text of the sample corpus to generate multiple text fragments and screening the multiple text fragments to obtain multiple positive sample texts and negative sample texts, a question text pair can be constructed based on the sample question, the positive sample text and the negative sample text, and the question text pair can be input into the answer extraction model to be trained for training to obtain the answer extraction model.

[0110] In order to describe the segmentation process of the corpus text more intuitively, the embodiment of the present application takes the sample question (query) as "How to do rural epidemic prevention work?" and the answers corresponding to the sample question contained in the sample corpus as "First, it is required to set up a rural epidemic prevention and control team; second, it is required to give full play to the role of grassroots medical and health institutions; third, it is required to strengthen the health management of migrant population." as an example for explanation.

[0111] The text segment 1 (para1) generated by segmenting the corpus text in the above sample corpus is "... First, it is required to set up a special team for rural epidemic prevention and control." Since text segment 1 only contains part of the answer, we believe that para1 is not the correct answer.

[0112] The segmented text fragment 2 (para2) is "First, it is required to set up a special team for rural epidemic prevention and control; second, it is required to give full play to the role of grassroots medical and health institutions; third, it is required to strengthen the health management of migrant population....", para2 contains the complete answer, so para2 is the correct answer.

[0113] The implementation process of determining whether other text fragments are correct answers is similar to the implementation process of the aforementioned text fragments 1 and 2, and will not be repeated here.

[0114] Among the current sample selection schemes, one is to use all samples for model training without screening the samples, that is, all the six text segments divided in Figure 3(a) participate in model training. Another scheme is to use a simple negative sample sampling method, that is, to randomly select negative samples according to a certain ratio. Taking the six text segments in Figure 3(a) as an example, para1, para4, para5, and para6 are used as negative samples (not containing the complete answer), and para2 and para3 are positive samples; all positive samples participate in training, and all negative samples can participate in training, or only a part of them can be randomly selected to participate in training.

[0115] However, since para1 and para4 in FIG3(a) contain some answer fragments, using them as negative samples for model training will interfere with the model training results. Therefore, the sample screening scheme of the embodiment of the present application is to filter out samples similar to para1 and para4, and only use para2 and para3 as positive samples, and use para5 and para6 as negative samples for model training.

[0116] Furthermore, the schematic diagram of the model training process provided in the embodiment of the present application is as follows Figure 4 shown.

[0117] The long text is segmented to obtain a text fragment set, and the text fragments in the text fragment set are filtered and screened to obtain a new text fragment set, wherein the text fragment set includes positive sample texts and negative sample texts, and then the sample questions are respectively spliced ​​with the positive sample texts and the negative sample texts to generate question text pairs, and the question texts are input into the answer extraction model to be trained for training.

[0118] Currently, in the application of machine reading comprehension, there are mainly the following methods for sampling EQA model training data:

[0119] (1) Use all samples for training, that is, do not filter the samples.

[0120] (2) Use a simple negative sample sampling method, that is, randomly select negative samples in a certain proportion.

[0121] Compared with the current sample sampling method, the embodiment of the present application uses a more reasonable sample screening strategy to filter out samples that interfere with model training.

[0122] In an embodiment of the present application, a sample question and a sample corpus containing an answer corresponding to the sample question are obtained, a feature extraction window is slid in the corpus text of the sample corpus based on a preset sliding step size, and the text fragments extracted by the feature extraction window during the sliding process are used as a text fragment set of the corpus text, the text fragments in the text fragment set are screened, and the first text fragment obtained by screening is used as a positive sample text of the sample question, and the second text fragment obtained by screening is used as a negative sample text of the sample question, wherein the first text fragment contains the complete corpus text of the answer, and the second text fragment does not contain any corpus text of the answer.

[0123] The embodiment of the present application divides a long corpus text into text segments to obtain a plurality of short corpus texts, and determines positive and negative samples for model training by screening the plurality of short corpus texts, wherein the positive sample contains a complete answer to a sample question, and the negative sample does not contain any text information in the text segment corresponding to the answer to the sample question; the positive and negative samples are determined by screening the plurality of short corpus texts, thereby ensuring the accuracy of the training results obtained by using the positive and negative samples for model training.

[0124] The following combination Figure 5 , taking the sample screening method provided in this application as an example of using the screened samples to train the answer extraction model, the sample screening method is further described. Among them, Figure 5 A processing flow chart of a sample screening method provided by an embodiment of the present application is shown, specifically steps 502 to 518.

[0125] Step 502: Obtain a sample question and a sample corpus containing answers corresponding to the sample question.

[0126] Step 504: determine the starting sliding position of the corpus text of the sample corpus.

[0127] Step 506: Slide the feature extraction window in the corpus text starting from the starting sliding position according to a preset sliding step length.

[0128] Step 508: Use the text segments extracted by the feature extraction window during the sliding process as the text segment set of the corpus text.

[0129] The size of the feature extraction window is determined according to the answer corresponding to the sample question.

[0130] Step 510: Determine the start position identifier and the end position identifier of the answer corresponding to the sample question in the sample corpus.

[0131] Step 512: Filter the text segments in the text segment set according to the start position identifier and the end position identifier.

[0132] Step 514: taking the text segments in the text segment set that contain the start position identifier and the end position identifier as the positive sample text; and taking the text segments that do not contain the start position identifier and the end position identifier as the negative sample text.

[0133] Step 516: construct a question text pair based on the sample question, the positive sample text, and the negative sample text.

[0134] Step 518, training the answer extraction model to be trained by inputting the question text to obtain the answer extraction model, wherein the answer extraction model associates the sample question with the positive sample text and / or the negative sample text.

[0135] The embodiment of the present application divides a long corpus text into text segments to obtain a plurality of short corpus texts, and determines positive and negative samples for model training by screening the plurality of short corpus texts, wherein the positive sample contains a complete answer to a sample question, and the negative sample does not contain any text information in the text segment corresponding to the answer to the sample question; the positive and negative samples are determined by screening the plurality of short corpus texts, thereby ensuring the accuracy of the training results obtained by using the positive and negative samples for model training.

[0136] Corresponding to the above method embodiment, the present application also provides a sample screening device embodiment, Figure 6 FIG. 1 is a schematic diagram showing the structure of a sample screening device according to an embodiment of the present application. Figure 6 As shown, the device 600 includes:

[0137] An acquisition module 602 is configured to acquire a sample question and a sample corpus containing answers corresponding to the sample question;

[0138] A sliding module 604 is configured to extract text segments from the corpus text of the sample corpus as a text segment set of the corpus text, wherein the size of the text segment is determined according to the answer corresponding to the sample question;

[0139] The screening module 606 is configured to screen the text segments in the text segment set, and use the text segments containing the complete answers as the positive sample texts of the sample questions, and use the text segments not containing the answers as the negative sample texts of the sample questions.

[0140] Optionally, the sliding module 604 includes:

[0141] A first determination submodule is configured to determine a starting sliding position of the corpus text of the sample corpus;

[0142] The first sliding submodule is configured to slide the feature extraction window from the starting sliding position in the corpus text according to a preset sliding step length, and use the text fragments extracted by the feature extraction window during the sliding process as the text fragment set of the corpus text.

[0143] Optionally, the sliding module 604 is further configured to:

[0144] A second determination submodule is configured to determine a starting sliding position of the corpus text of the sample corpus;

[0145] The second sliding submodule is configured to start the feature extraction window with a changing size from the starting sliding position and slide it in the corpus text according to a preset sliding step length, and use the text fragments extracted by the feature extraction window during the sliding process as the text fragment set of the corpus text.

[0146] Optionally, the sliding module 604 is further configured to:

[0147] A third determination submodule is configured to determine a starting sliding position of the corpus text of the sample corpus;

[0148] The third sliding submodule is configured to start the fixed-size feature extraction window from the starting sliding position and slide it in the corpus text according to a preset sliding step, and use the text fragments extracted by the feature extraction window during the sliding process as the text fragment set of the corpus text.

[0149] Optionally, the screening module 606 is further configured to:

[0150] The first screening submodule is configured to screen the text segments in the text segment set using a preset text segment screening algorithm.

[0151] Optionally, the screening module 606 is further configured to:

[0152] An identifier determination submodule, configured to determine a start position identifier and an end position identifier of an answer corresponding to the sample question in the sample corpus;

[0153] The second screening submodule is configured to screen the text segments in the text segment set according to the start position identifier and the end position identifier.

[0154] Optionally, the second screening submodule includes:

[0155] The sample determination unit is configured to use the text segment containing the start position identifier and the end position identifier in the text segment set as the positive sample text; and use the text segment not containing the start position identifier and the end position identifier as the negative sample text.

[0156] Optionally, the sample screening device further comprises:

[0157] A construction module, configured to construct a question text pair based on the sample question, the positive sample text and the negative sample text;

[0158] The training module is configured to train the answer extraction model to be trained by inputting the question text to obtain the answer extraction model, wherein the answer extraction model associates the sample question with the positive sample text and / or the negative sample text.

[0159] The embodiment of the present application divides a long corpus text into text segments to obtain a plurality of short corpus texts, and determines positive and negative samples for model training by screening the plurality of short corpus texts, wherein the positive sample contains a complete answer to a sample question, and the negative sample does not contain any text information in the text segment corresponding to the answer to the sample question; the positive and negative samples are determined by screening the plurality of short corpus texts, thereby ensuring the accuracy of the training results obtained by using the positive and negative samples for model training.

[0160] The above is a schematic scheme of a sample screening device of this embodiment. It should be noted that the technical scheme of the sample screening device and the technical scheme of the sample screening method described above are of the same concept, and the details of the technical scheme of the sample screening device that are not described in detail can be found in the description of the technical scheme of the sample screening method described above.

[0161] It should be noted that the components in the device claim should be understood as the functional modules that must be established to implement the steps of the program flow or the steps of the method, and the functional modules are not actually divided or separated. The device claim defined by such a group of functional modules should be understood as the functional module architecture of the solution mainly implemented by the computer program recorded in the specification, and should not be understood as the physical device that mainly implements the solution by hardware.

[0162] In one embodiment of the present application, a computing device is also provided, including a memory, a processor, and computer instructions stored in the memory and executable on the processor, wherein the processor implements the steps of the sample screening method when executing the instructions.

[0163] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the above-mentioned sample screening method belong to the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the technical scheme of the above-mentioned sample screening method.

[0164] An embodiment of the present application further provides a computer-readable storage medium storing computer instructions, which, when executed by a processor, implement the steps of the sample screening method as described above.

[0165] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the above-mentioned sample screening method belong to the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the technical scheme of the above-mentioned sample screening method.

[0166] An embodiment of the present application discloses a chip storing computer instructions, which implement the steps of the sample screening method as described above when executed by a processor.

[0167] The above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0168] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.

[0169] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described action sequence, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0170] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0171] The preferred embodiments of the present application disclosed above are only used to help explain the present application. The optional embodiments do not describe all the details in detail, nor do they limit the invention to the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the present application. The present application selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present application, so that those skilled in the art can understand and use the present application well. The present application is only limited by the claims and their full scope and equivalents.

Claims

1. A sample screening method, characterized in that: include: Obtaining sample questions and sample corpora containing answers corresponding to the sample questions; Extracting text segments from the corpus text of the sample corpus as a text segment set of the corpus text, wherein the text segments are determined according to the answers corresponding to the sample questions; The text fragments in the text fragment set are screened, and the text fragments containing the complete answers are used as positive sample texts of the sample questions, the text fragments containing incomplete answers are filtered out, and the text fragments not containing the answers are used as negative sample texts of the sample questions.

2. The sample screening method according to claim 1, characterized in that: The step of extracting text segments from the corpus text of the sample corpus as a text segment set of the corpus text includes: Determining a starting sliding position of the corpus text of the sample corpus; The feature extraction window starts from the starting sliding position and slides in the corpus text according to a preset sliding step length, and the text segments extracted by the feature extraction window during the sliding process are used as the text segment set of the corpus text.

3. The sample screening method according to claim 1 or 2, characterized in that: The step of extracting text segments from the corpus text of the sample corpus as a text segment set of the corpus text includes: Determining a starting sliding position of the corpus text of the sample corpus; The feature extraction window with varying size starts from the starting sliding position and slides in the corpus text according to a preset sliding step length, and the text segments extracted by the feature extraction window during the sliding process are used as the text segment set of the corpus text.

4. The sample screening method according to claim 1 or 2, characterized in that: The step of extracting text segments from the corpus text of the sample corpus as a text segment set of the corpus text includes: Determining a starting sliding position of the corpus text of the sample corpus; A fixed-size feature extraction window starts from the starting sliding position and slides in the corpus text according to a preset sliding step length, and the text segments extracted by the feature extraction window during the sliding process are used as the text segment set of the corpus text.

5. The sample screening method according to claim 1, characterized in that: The screening of the text fragments in the text fragment set includes: The text fragments in the text fragment set are screened using a preset text fragment screening algorithm.

6. The sample screening method according to claim 1 or 5, characterized in that: The screening of the text fragments in the text fragment set includes: Determine a starting position identifier and an ending position identifier of an answer corresponding to the sample question in the sample corpus; The text segments in the text segment set are screened according to the start position identifier and the end position identifier.

7. The sample screening method according to claim 6, characterized in that: The screening of the text segments in the text segment set according to the start position identifier and the end position identifier includes: The text segments in the text segment set that contain the start position identifier and the end position identifier are used as the positive sample texts; and the text segments that do not contain the start position identifier and the end position identifier are used as the negative sample texts.

8. The sample screening method according to claim 1, characterized in that: Also includes: Constructing a question text pair based on the sample question, the positive sample text, and the negative sample text; The question text is input into an answer extraction model to be trained to obtain the answer extraction model, wherein the answer extraction model associates the sample question with the positive sample text and / or the negative sample text.

9. A sample screening device, characterized in that: include: An acquisition module is configured to acquire sample questions and sample corpora containing answers corresponding to the sample questions; A sliding module is configured to extract text segments from the corpus text of the sample corpus as a text segment set of the corpus text, wherein the size of the text segment is determined according to the answer corresponding to the sample question; The screening module is configured to screen the text fragments in the text fragment set, and use the text fragment containing the complete answer as the positive sample text of the sample question, filter out the text fragment containing the incomplete answer, and use the text fragment not containing the answer as the negative sample text of the sample question.

10. A computing device comprising a memory, a processor, and computer instructions stored in the memory and executable on the processor, characterized in that: When the processor executes the instructions, the steps of the method according to any one of claims 1 to 8 are implemented.

11. A computer-readable storage medium storing computer instructions, characterized in that: When the instruction is executed by a processor, the steps of the method described in any one of claims 1 to 8 are implemented.

Citation Information

Patent Citations

  • Comment text entity recognition method and device based on character-based model

    CN106776555A

  • Global normalized reader systems and methods

    CN108733742A

  • Method of detecting and identifying lesions of gastrointestinal endoscope, based on sliding window

    CN108765392A

  • Text segmentation method and device, computer equipment and readable storage medium

    CN109710759A

  • Implementation method and device for machine reading understanding, storage medium and electronic equipment

    CN110543631A