Text processing method and device and electronic equipment
The text quality model is used to extract and predict the candidate answers semantic feature and quality of quality, combined with customization and correlation evaluation, and solve the quality problems of candidate answers, improving user satisfaction and search experience.
Patent Information
- Application Number
- CN202410866155.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2024-11-05
AI Technical Summary
In the prior art, text quality issues of candidate answers, such as semantic duplication and content that are not related to the title, lead to a decline in user search experience and may cause user churn.
The text quality model is used for semantic feature extraction and quality prediction, and the quality of candidate answers is determined through the classification prediction module, and whether to display them to the user. The quality of the answers is further evaluated in combination with the custom features and correlation prediction models.
It effectively improves user satisfaction, avoids the reveal of low-quality answers, and improves the search experience.
Smart Images

Figure CN118897874A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a text processing method, device and electronic device. Background Art
[0002] In daily life, people can obtain information through search engines. For example, they can enter a question such as "Can I drink coffee on an empty stomach?" in the text input box provided by the search engine to obtain the corresponding answer.
[0003] However, for a specific question, there may be a variety of different candidate answers, such as candidate answers generated based on artificial intelligence technology, candidate answers edited by different users, etc. Limited by the capabilities of existing large models, the knowledge reserves and writing skills of real users, candidate answers may have certain text quality problems, such as semantic repetition, irrelevant content and title, and other low-quality text problems. If the proportion of low-quality answers presented to users is too high, it is easy to affect the user's search experience and even cause user loss. Summary of the invention
[0004] In view of this, embodiments of the present application provide a text processing method, device, and electronic device to at least partially solve the above-mentioned problems.
[0005] According to a first aspect of an embodiment of the present application, a text processing method is provided, comprising:
[0006] Get question text and candidate answer text;
[0007] Using the semantic feature extraction module in the text quality model, extracting semantic features from the question text and the candidate answer file to obtain overall semantic features;
[0008] Through the classification prediction module in the text quality model, quality classification prediction is performed based on the overall semantic features to obtain a quality prediction result, so as to determine whether to display the candidate answer text as the answer corresponding to the question text based on the quality prediction result.
[0009] According to a second aspect of an embodiment of the present application, a text processing method is provided, comprising:
[0010] In response to a preset input operation on the display page, obtaining a question text;
[0011] Obtaining candidate answer texts corresponding to the question texts, and quality prediction results of the candidate answer texts; the quality prediction results are obtained by performing quality classification prediction based on the overall semantic features obtained by performing semantic feature extraction on the question texts and the candidate answer files;
[0012] If the quality prediction result meets the preset quality requirement, the candidate answer text is displayed in the display interface as the answer to the question text.
[0013] According to a third aspect of an embodiment of the present application, there is provided a text processing device, including:
[0014] A text acquisition unit, used to acquire question text and candidate answer text;
[0015] A semantic feature extraction unit, configured to extract semantic features from the question text and the candidate answer file using a semantic feature extraction module in a text quality model to obtain overall semantic features;
[0016] The quality prediction unit is used to perform quality classification prediction based on the overall semantic features through the classification prediction module in the text quality model to obtain a quality prediction result, so as to determine whether to display the candidate answer text as the answer corresponding to the question text based on the quality prediction result.
[0017] According to a fourth aspect of an embodiment of the present application, an electronic device is provided, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other through the communication bus; the memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform an operation corresponding to the method described in the first aspect or the second aspect.
[0018] According to a fifth aspect of an embodiment of the present application, a computer storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the method described in the first aspect or the second aspect is implemented.
[0019] The text processing solution provided in the embodiment of the present application, after obtaining the candidate answer text, uses the text quality model to extract semantic features of the candidate answer text and the question text at the overall level, and predicts the text quality based on the extracted overall semantic features, thereby determining whether to display the candidate answer text as the answer corresponding to the question text based on the quality prediction result. In the embodiment of the present application, the quality of the candidate answer text is predicted by the text quality model, and then it is determined whether to display the candidate answer text as the answer based on the prediction result. The embodiment of the present application can avoid user loss caused by the low-quality candidate answer text being transmitted to the user, and can effectively improve user satisfaction. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0021] Figure 1 A flowchart of a text processing method according to Embodiment 1 of the present application;
[0022] Figure 2 for Figure 1 A schematic diagram of the flow of text processing performed by the text quality model in the illustrated embodiment;
[0023] Figure 3 A schematic diagram of the process of correlation prediction for the correlation prediction model;
[0024] Figure 4 A schematic diagram of the process of repeatability prediction for the repeatability prediction model;
[0025] Figure 5 A schematic diagram of a text processing scenario according to an embodiment of the present application;
[0026] Figure 6 A flowchart of a text processing method according to Embodiment 2 of the present application;
[0027] Figure 7 is a structural block diagram of a text processing device according to Embodiment 3 of the present application;
[0028] Figure 8 This is a schematic diagram of the structure of an electronic device according to the fourth embodiment of the present application. DETAILED DESCRIPTION
[0029] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the embodiments of the present application should fall within the scope of protection of the embodiments of the present application.
[0030] The specific implementation of the embodiment of the present application is further explained below in conjunction with the accompanying drawings of the embodiment of the present application.
[0031] Embodiment 1
[0032] Reference Figure 1 , Figure 1The following is a flowchart of a text processing method according to Embodiment 1 of the present application. Specifically, the text processing method provided in this embodiment may include the following steps:
[0033] Step 102, obtaining the question text and the candidate answer text.
[0034] Specifically, in the embodiments of the present application, there is no limitation on the specific content of the question text and the amount of text data, and the question text may be any text to be answered or confirmed. In addition, in the embodiments of the present application, there is no limitation on the sentence type of the question text, and the question text may be in the form of a question, a statement, an exclamation, etc. For example, the question text may be a question input by a user into a search engine.
[0035] The candidate answer text may be a candidate answer obtained for the question text. In the embodiment of the present application, there is no limitation on the method of obtaining the candidate question and answer text. For example, it may be a text obtained by matching and searching in a preset database according to the question text; it may also be content generated by artificial intelligence technology for the question text; it may also be the answer made by other users to the question text, etc. In the embodiment of the present application, there is no limitation on the amount of text data of the candidate answer text and the internal layout of the text.
[0036] Step 104, using the semantic feature extraction module in the text quality model, extracting semantic features from the question text and the candidate answer file to obtain overall semantic features.
[0037] Specifically, in the embodiment of the present application, the semantic feature extraction module in the text quality model can be any language model that can perform complete semantic feature extraction, for example: BERT, Bigbird and other pre-trained language models.
[0038] Step 106, using the classification prediction module in the text quality model, performs quality classification prediction based on the overall semantic features to obtain a quality prediction result, and determines whether to display the candidate answer text as the answer corresponding to the question text based on the quality prediction result.
[0039] Specifically, in the example of the present application, there is no limitation on the specific implementation method of the classification prediction model, and it can be any neural network model that can perform quality classification prediction based on the overall semantic features obtained in step 104 to obtain quality prediction results.
[0040] The text quality model in the embodiment of the present application can be obtained after model training is performed in advance based on question samples, candidate answer samples and corresponding sample quality labels.
[0041] Specifically, before executing model training, multiple quality categories and corresponding classification standards can be pre-set, and the candidate answer samples corresponding to the question samples can be labeled according to the set classification standards to obtain sample quality labels. For example, two quality categories can be set: high-quality category and low-quality category; or, 6 quality categories can be set: level 0, level 1, level 2, level 3, level 4 and level 5, where the higher the quality level, the better the quality of the candidate answer text; or, the above 6 quality categories can be distinguished by setting scores: 0 points, 1 point, 2 points, 3 points, 4 points and 5 points, where the larger the score, the better the quality.
[0042] During the training phase, question samples and candidate answer samples can be input into the text quality model to be trained, and the sample prediction scores can be output by the text quality model; the classification loss value is calculated based on the sample prediction scores and the sample quality labels; and the regression loss value is calculated based on the sample prediction scores and the sample quality labels; the parameters of the text quality model are adjusted based on the regression loss values to obtain a trained text quality model.
[0043] After obtaining the quality prediction result, it can be decided whether to display the candidate answer text as the answer corresponding to the question text based on the quality prediction result. The embodiment of the present application does not limit the specific determination method. For example, different quality requirements can be set according to different classification standards. When the quality prediction result shows that the candidate answer text meets the above quality requirements, the candidate answer text is determined as the answer corresponding to the question text and displayed to the user; conversely, when the quality prediction result shows that the candidate answer text cannot meet the above quality requirements, the candidate answer text is truncated, that is, the candidate answer text is not displayed to the user.
[0044] The text processing method provided in the embodiment of the present application, after obtaining the candidate answer text, extracts semantic features of the candidate answer text and the question text at the overall level through a text quality model, and predicts the text quality based on the extracted overall semantic features, thereby determining whether to display the candidate answer text as the answer corresponding to the question text based on the quality prediction result. In the embodiment of the present application, the quality of the candidate answer text is predicted through a text quality model, and then it is determined whether to display the candidate answer text as the answer based on the prediction result. The embodiment of the present application can avoid user loss caused by revealing low-quality candidate answer text to users, and can effectively improve user satisfaction.
[0045] Optionally, in some of these embodiments, the text quality model further includes: a custom feature extraction module;
[0046] Before obtaining the quality prediction result by performing quality classification prediction based on the overall semantic features through the classification prediction module in the text quality model, the method further includes:
[0047] Extract custom quality features from the candidate answer texts through a custom feature extraction module in the text quality model; the custom quality features represent the quality attribute information of the candidate question and answer texts;
[0048] Concatenate the custom quality features and the overall semantic features to obtain concatenated features;
[0049] Through the classification prediction module in the text quality model, quality classification prediction is performed based on the overall semantic features to obtain quality prediction results, including:
[0050] Through the classification prediction module in the text quality model, quality classification prediction is performed based on the spliced features to obtain the quality prediction results.
[0051] Specifically, when predicting the quality of candidate answer texts, in addition to considering the semantic features within the text, the embodiments of the present application also perform feature expansion from other aspects, extract custom quality features from the candidate answer texts that can better characterize the quality attribute information, and apply the extracted custom quality features to quality classification predictions. This allows the text quality module to evaluate the candidate answer texts from a variety of different angles, thereby obtaining more accurate quality prediction results.
[0052] In the embodiments of the present application, the specific content of the quality attribute information represented by the custom quality feature is not limited, and can be customized according to actual conditions or historical experience. Optionally, in some embodiments, the quality attribute information includes at least one of the following: whether the candidate answer text contains the answer content corresponding to the question text, the location information of the answer content in the candidate answer text, the degree of content repetition of the candidate answer text, and the degree of content completeness of the candidate answer text.
[0053] Optionally, in some of the embodiments, the quality category corresponding to the text quality model is presented in the form of a score; different quality categories correspond to different scores, and the scores corresponding to each quality category are set in a preset order of magnitude; the training process of the text quality model includes:
[0054] Obtain question samples, candidate answer samples, and corresponding sample quality labels; input the question samples and candidate answer samples into the text quality model to be trained, and output the sample prediction score through the text quality model;
[0055] Calculate the classification loss value based on the sample prediction score and sample quality label;
[0056] Based on the scores corresponding to each quality category, the sample prediction score is corrected to obtain a corrected prediction score; and based on the corrected prediction score and the sample quality label, the regression loss value is calculated;
[0057] The classification loss value and the regression loss value are fused to obtain a fusion loss value, and the parameters of the text quality model are adjusted based on the fusion loss value to obtain a trained text quality model.
[0058] Specifically, in the above embodiments of the present application, the quality categories are characterized by scores, and the scores corresponding to different quality categories are set in a preset order of size, that is, there is a predetermined partial order between the scores corresponding to different quality categories. For example, the quality categories are divided into 6 categories according to 0-5 points, and the specific categories are: 0 point, 1 point, 2 points, 3 points, 4 points and 5 points, wherein the scores of the above categories increase in order, and the larger the score, the better the quality.
[0059] Correspondingly, when training the text quality model, the loss value calculation process was improved: after the sample prediction score is output by the text quality model, on the one hand, the classification loss value is calculated based on the sample prediction score and the sample quality label; on the other hand, according to the scores corresponding to each quality category, the sample prediction score output by the model is corrected, that is, the sample prediction score is aligned to obtain the regression score: the prediction score is corrected, and the regression loss value is calculated based on the corrected prediction score and the sample quality label; then the above classification loss value and regression loss value are fused to adjust the parameters of the text quality model according to the fused loss value.
[0060] The above improvements make the scores of quality categories correlated, that is, the text quality model finally trained can perceive the established size partial order between the scores corresponding to different quality categories, thereby improving the accuracy of the model's quality prediction for candidate answer texts at the boundary between two different quality categories.
[0061] Optionally, in some of the embodiments, the modified prediction score is presented in the form of a vector, and based on the scores corresponding to each quality category, the sample prediction score is modified to obtain the modified prediction score, including:
[0062] Construct a score vector based on the scores corresponding to each quality category;
[0063] Calculate the inner product of the sample prediction score and the score vector, and use the result as the corrected prediction score.
[0064] For ease of understanding, the above training process is explained below by way of example:
[0065] Assume that the quality category is divided into 6 categories according to 0-5 points, and the specific categories are: 0 point, 1 point, 2 points, 3 points, 4 points and 5 points, among which the scores of the above categories increase in sequence, and the larger the score, the better the quality. For a candidate answer sample, label l abe l = [0,0,0,1,0,0], that is, the label of the candidate answer sample is 3 points; the sample prediction score logit = [0,0,0.4,1.47,4.41,0.0] output by the text quality model, that is, the label with the largest prediction score is 4 points (score 4.41), 3 points (score 1.47), and 2 points (score 0.4). It is unreasonable to classify it as l abe l = 4 according to the maximum value, because: the actual l abe l = 3, the predicted l abe l = 4, then the accuracy is 0. Although the score of l abe l = 3 predicted by the model is also relatively high, this content cannot be reflected in the output result; and the model cannot perceive the partial order between l abe l, which will also lead to inaccurate prediction results. Therefore, in the above embodiment of the present application, while calculating the classification loss value based on logit=[0,0,0.4,1.47,4.41,0.0] and labell=[0,0,0,1,0,0], the sample prediction score logit=[0,0,0.4,1.47,4.41,0.0] is corrected by the scores [1,2,3,4,5,6] corresponding to each quality category to obtain a corrected prediction score: [0,0,0.4,1.47,4.41,0.0])*[0,1,2,3,4,5]=3.7, and then the regression loss value is calculated based on the corrected prediction score 3.7 and the sample quality label 3; thereafter, the calculated classification loss value and regression loss value are fused, and the parameters of the text quality model are adjusted based on the fused loss value to obtain a trained text quality model.
[0066] Furthermore, in terms of calculating the classification loss value, the idea of metric learning can be used to modify the classification loss function, so that the prediction scores of candidate answer texts with the same label are closer, and at the same time, the gap between the prediction scores of candidate answer texts with different labels is widened, thereby further improving the prediction accuracy of the text quality model. Specifically, for example, when calculating the classification loss value, loss functions such as L-Softmax, A-Softmax, AM-Softmax and ArcFace can be used instead of the basic Softmax loss function.
[0067] Furthermore, the idea of the sorting task can be combined. On the basis of the original loss value (the above-mentioned classification loss value, or the fusion loss value), the candidate answer texts with different labels in a batch are combined into a text pair, and for each text pair (pa i rwi se), the sum of the prediction scores corresponding to each candidate answer text in the text pair is calculated to obtain the prediction score of the text pair; the prediction scores of each text pair are fused to obtain the text pair loss value; then, the original loss value and the above-mentioned text pair loss value are combined to adjust the parameters of the text quality model. The above-mentioned training method fully considers the partial order relationship that the prediction scores corresponding to text pairs of different categories should satisfy. Therefore, the discrimination of predictions of different quality categories can be improved, thereby improving the accuracy of model predictions.
[0068] See also Figure 2 , Figure 2 for Figure 1 The flowchart of the text quality model in the embodiment shown is as follows. Figure 2 Explain the process of text quality model processing text:
[0069] After obtaining the question text and the candidate answer text, on the one hand, the question text and the candidate answer text can be input into the text quality model, thereby generating input data through the input layer of the text quality model: [CLS][question text][SEP][candidate answer text], where [CLS] represents the semantic features of the question text and the candidate answer text, and [SEP] represents the segmentation symbol between the question text and the candidate answer text; the input data is input into the semantic feature extraction module ( Figure 2 The Bigb i rd model in the text quality model is used to obtain the [CLS] output vector after the [CLS] symbol passes through the semantic feature extraction module, and the vector is determined as the overall semantic feature; on the other hand, the custom quality features are extracted from the candidate answer text through the custom feature extraction module in the text quality model, and the custom quality features and the overall semantic features are spliced to obtain the spliced features; the classification prediction module in the text quality model performs quality classification prediction based on the spliced features to obtain the prediction score as shown in the figure. Figure 2 As shown; after the prediction score is processed by the activation layer, the quality prediction result can be output: Figure 2 In: high-quality classification, or, low-quality classification.
[0070] Furthermore, in order to improve the prediction accuracy of the text quality model, a classification-to-regression operation can be performed in the model training stage, that is, the sample prediction score is output through the text quality model; the classification loss value is calculated based on the sample prediction score and the sample quality label; the sample prediction score is corrected based on the score corresponding to each quality category to obtain a corrected prediction score (such as Figure 2 As shown in the figure: the inner product of the prediction score and the score vector is calculated, and the calculation result is used as the corrected prediction score); and based on the corrected prediction score and the label, the regression loss value is calculated; the classification loss value and the regression loss value are fused to obtain the fusion loss value, and the parameters of the text quality model are adjusted based on the fusion loss value to obtain the trained text quality model.
[0071] Furthermore, in order to improve the prediction accuracy of the text quality model, in-batch text pair processing can also be performed in the model training stage, that is: based on the above-mentioned fusion loss value, the candidate answer texts with different labels in a batch are combined into a text pair, and for each text pair (pa i rwi se), the sum of the prediction scores corresponding to the candidate answer texts in the text pair is calculated to obtain the prediction score of the text pair; and the prediction scores of each text pair are fused to obtain the text pair loss value; then, the above-mentioned fusion loss value and the above-mentioned text pair loss value are combined to adjust the parameters of the text quality model.
[0072] Optionally, in some of the embodiments, the candidate answer text includes: a title part, and a paragraph part corresponding to the title part;
[0073] Before determining whether to display the candidate answer text as the answer corresponding to the question text based on the quality prediction result, the method further includes:
[0074] The semantic feature extraction module in the correlation prediction model is used to extract semantic features from the title part and the corresponding paragraph part to obtain the semantic features of the title paragraph;
[0075] Inputting the semantic features of the title paragraph into the relevance classification module in the relevance prediction model, and obtaining the relevance prediction result through the relevance classification module;
[0076] Determining whether to display the candidate answer text as the answer corresponding to the question text based on the quality prediction result includes:
[0077] Based on the quality prediction results and the relevance prediction results, determine whether to display the candidate answer text as the answer corresponding to the question text.
[0078] Specifically, when the candidate answer text contains a title part and a paragraph part corresponding to the title part, there may be a situation where the title and the paragraph are irrelevant in terms of content. For example, for the question text "Is it okay to drink coffee in the morning?", a candidate answer text contains multiple titles, one of which is "Adverse Reactions". However, the paragraph part corresponding to the title does not describe the adverse reactions after drinking coffee, but describes the most appropriate time to drink coffee.
[0079] Based on the above situation, in addition to quality classification prediction through the text quality model, the above embodiment of the present application can also introduce a relevance prediction model, through which the relevance between the title part and the paragraph part corresponding to the title part in the candidate answer text is predicted, thereby performing a quality assessment on the candidate answer text from the perspective of the relevance between the title and the paragraph. Afterwards, it can be determined whether to display the candidate answer text as the answer corresponding to the question text based on a comprehensive consideration of the relevance prediction result output by the relevance prediction model and the quality prediction result output by the text quality model. The above method can more effectively avoid user loss caused by the low-quality candidate answer text being transmitted to users, that is, it can further effectively improve user satisfaction.
[0080] The semantic feature extraction module of the above correlation prediction model can be any network model capable of semantic feature extraction, such as pre-trained language models BERT, RoBERTa, XLNet, StructBERT, etc. The correlation classification module of the above correlation prediction model can also be any classification model, for example, in order to reduce the training difficulty in the model training stage, a highway network model can be selected, etc.
[0081] In addition, the embodiments of the present application do not limit the specific categories of correlation classification. For example, it can be a binary classification containing two categories (e.g., the categories can be: relevant, or irrelevant), or it can be a multi-classification (e.g., divided into levels according to the degree of relevance: primary, secondary, ...).
[0082] See also Figure 3 , Figure 3 The following is a flowchart of the correlation prediction model process correlation prediction. Figure 3 Explain the process of correlation prediction by the correlation prediction model:
[0083] See also Figure 3, assuming that the question text is: "Who are the Eight Great Masters of Tang and Song Dynasties?", the corresponding candidate answer text includes a title part and a paragraph part, where the title part is: "The Eight Great Masters of Tang and Song Dynasties" and the paragraph part is "Han Yu of the Tang Dynasty...Ouyang Xiu", then the above question text and candidate answer text can be input into the semantic feature extraction module in the correlation prediction model (such as Figure 3 BERT in, or, RoBERTa / XLNet, or, StructBERT), extract semantic features from the title part and the corresponding paragraph part to obtain the title paragraph semantic feature x; input the title paragraph semantic feature x into the relevance classification module in the relevance prediction model (such as Figure 3 The highway network model in is used to output the prediction vector y through the correlation classification module, and the correlation prediction result is obtained based on y.
[0084] Optionally, in some of the embodiments, before determining whether to display the candidate answer text as the answer corresponding to the question text based on the quality prediction result, the method further includes:
[0085] Extracting a first text portion and a second text portion from the candidate answer text;
[0086] Inputting the first text part and the second text part into a repetitive prediction model, extracting a first semantic feature from the first text part by a first feature extraction module in the repetitive prediction model, and extracting a second semantic feature from the second text part by a second feature extraction module in the repetitive prediction model;
[0087] Inputting the first semantic feature and the second semantic feature into a repetitive classification module in the repetitive prediction model to obtain a repetitive prediction result;
[0088] Determining whether to display the candidate answer text as the answer corresponding to the question text based on the quality prediction result includes:
[0089] Based on the quality prediction results and the repeatability prediction results, determine whether to display the candidate answer text as the answer corresponding to the question text.
[0090] Specifically, when the candidate answer text contains a lot of content, there may be repeated content, such as repeated text characters or repeated semantics. If the candidate answer text with repeated content is displayed to the user, the user's satisfaction will also be reduced.
[0091] Based on the above situation, in addition to quality classification prediction through the text quality model, the above embodiment of the present application can also introduce a repeatability prediction model, through which the content repeatability between any two text parts in the candidate answer text: the first text part and the second text part is predicted, thereby performing a quality assessment on the candidate answer text from the perspective of content repeatability, and then, based on the repeatability prediction result output by the repeatability prediction model and the quality prediction result output by the text quality model, it can be determined whether to display the candidate answer text as the answer corresponding to the question text. The above method can more effectively avoid user loss caused by the low-quality candidate answer text being transmitted to users, that is, it can further effectively improve user satisfaction.
[0092] Furthermore, it is also possible to comprehensively consider the relevance prediction results output by the above-mentioned relevance prediction model, the repeatability prediction results output by the repeatability prediction model, and the quality prediction results output by the text quality model to determine whether to display the candidate answer text as the answer corresponding to the question text, so as to further improve user satisfaction.
[0093] In the above embodiments of the present application, the first feature extraction module and the second feature extraction module can be any network model capable of extracting semantic features, such as: pre-trained language models BERT, RoBERTa, XLNet, StructBERT, etc. The repetitive classification module of the above repetitive classification module can also be any classification model, which is not limited in the embodiments of the present application.
[0094] In addition, the embodiments of the present application do not limit the specific categories of repetitive classification. For example, it can be a binary classification containing two categories (e.g., the categories can be: repeated, or non-repeated), or it can be a multi-classification (e.g., divided into levels according to the degree of repetition: primary, secondary, ...).
[0095] Optionally, in some of the embodiments, the first text portion and the second text portion are from different paragraphs in the candidate answer text.
[0096] See also Figure 4 , Figure 4 The following is a flow chart of the repeatability prediction model process repeatability prediction. Figure 4 Explain the process of making repeatable predictions for the repeatable prediction model:
[0097] See also Figure 4 , assuming that the first text part in the candidate answer is "A1...A m ", the first text part is "B1...B m”, the first text part and the second text part can be respectively input into the first feature extraction module and the second feature extraction module, so as to obtain: the semantic features of each text in the first text part and the overall semantic features of the first text part: the first semantic feature, and the semantic features of each text in the second text part and the overall semantic features of the second text part: the second semantic feature; and then the first semantic feature and the second semantic feature are input into the repetitive classification module in the repetitive prediction model to obtain the repetitive prediction score, and then the repetitive prediction result is obtained based on the repetitive prediction score.
[0098] See also Figure 5 , Figure 5 Schematic diagram of a text processing scenario according to an embodiment of the present application. Figure 5 The application scenarios and specific processing procedures of the text processing solution provided in the embodiment of the present application are explained:
[0099] The user enters the question text "Can I drink coffee in the evening?" in the input box of the search engine page, and then clicks the "search" icon on the page; the search engine can generate the following results based on artificial intelligence technology: Figure 5 The candidate answer text shown in the figure; thereafter, any text processing method provided in the embodiment of the present application can be executed to determine whether to display the obtained candidate answer text; when it is determined to display the candidate answer text according to the method provided in the embodiment of the present application, the candidate answer text generated based on artificial intelligence technology can be displayed in the search page of the search engine for user reference.
[0100] Embodiment 2
[0101] Reference Figure 6 , Figure 6 The following is a flowchart of a text processing method according to Embodiment 2 of the present application. The method can be applied to a client device in a text processing system, and the text processing system can also include a server device. Specifically, the text processing method provided in this embodiment can include the following steps:
[0102] Step 602: Obtain question text in response to a preset input operation on the display page.
[0103] For example: an application client (such as a browser client, etc.) that can perform question search is installed in the client device, and the display page can be an interface provided by the application client for obtaining user questions. When the user wants to search for the answer to a question, the question text can be entered in the above display page through a preset input operation. The embodiment of the present application does not limit the specific content of the preset input operation. For example: the question text can be entered in the display page through the keyboard, or voice information can be entered through a microphone device, and the voice information can be converted into question text through a preset voice-to-text conversion tool in the client, and so on.
[0104] Step 604, obtain the candidate answer text corresponding to the question text, and the quality prediction result of the candidate answer text; wherein the quality prediction result is obtained by quality classification prediction based on the overall semantic features, and the above-mentioned overall semantic features are obtained by semantic feature extraction of the question text and the candidate answer file.
[0105] Optionally, in some embodiments, the above step 604 may include:
[0106] Send the question text to the server device so that the server device obtains the candidate answer text; use the text quality model to extract semantic features of the question text and the candidate answer file to obtain the overall semantic features; perform quality classification prediction based on the overall semantic features to obtain the quality prediction result;
[0107] Receive the quality prediction results and candidate answer texts returned by the server device.
[0108] Specifically, after obtaining the question text input by the user, the client device forwards the text to the server device, performs the candidate answer acquisition operation through the server device, and performs the quality classification prediction based on the overall semantic features to obtain the quality prediction result, and receives the quality prediction result and candidate answer text returned by the server device. In the above embodiment, the server device replaces the client device to perform the more complex calculation operations of obtaining the candidate answer text and the quality prediction result, which can effectively reduce the resource requirements such as the computing power of the client device, so that the method of the above embodiment can be flexibly deployed on client devices with different computing power conditions, expanding the scope of application of the embodiments of the present application.
[0109] Optionally, in some other embodiments, the above step 604 may also be performed locally on the client device, specifically:
[0110] The process of obtaining the quality prediction result of the candidate answer text in the above step 604 may include:
[0111] The semantic feature extraction module in the text quality model deployed locally is used to extract semantic features from the question text and candidate answer files to obtain overall semantic features. The classification prediction module in the text quality model is used to perform quality classification prediction based on the overall semantic features to obtain quality prediction results.
[0112] Specifically, after obtaining the question text input by the user, the client device performs the overall semantic feature extraction operation and the quality classification prediction operation based on the overall semantic feature through the text quality model deployed locally, thereby obtaining the quality prediction result. In the embodiment of the present application, after obtaining the question text, the client device performs the candidate answer text and quality prediction result acquisition operation, thereby obtaining the candidate answer text and the quality prediction result. The above processes are all operations performed within the client device, without the need for network communication or the like to transmit data between different computing devices, and therefore have high operational reliability.
[0113] Further, in some of these embodiments, the text quality model may also include: a custom feature extraction module;
[0114] Before obtaining the quality prediction result by performing quality classification prediction based on the overall semantic features through the classification prediction module in the text quality model, the method may further include:
[0115] Extract custom quality features from the candidate answer texts through a custom feature extraction module in the text quality model; the custom quality features represent the quality attribute information of the candidate question and answer texts;
[0116] Concatenate the custom quality features and the overall semantic features to obtain concatenated features;
[0117] Correspondingly, the process of performing quality classification prediction based on the overall semantic features through the classification prediction module in the text quality model to obtain the quality prediction result may include:
[0118] Through the classification prediction module in the text quality model, quality classification prediction is performed based on the spliced features to obtain the quality prediction result.
[0119] Regarding the above step 604, no matter it is executed by the client device or the server device, the specific implementation method of this step can refer to the relevant content in the above embodiment 1, which will not be repeated here.
[0120] Step 606: If the quality prediction result meets the preset quality requirement, the candidate answer text is displayed in the display interface as the answer to the question text.
[0121] The embodiment of the present application does not limit the judgment principle of whether the quality preset result meets the preset quality requirements, and can be customized according to actual conditions. For example, different quality requirements can be set according to different classification standards. When the quality prediction results show that the candidate answer text meets the above quality requirements, the candidate answer text is determined as the answer corresponding to the question text and displayed to the user. On the contrary, when the quality prediction results show that the candidate answer text cannot meet the above quality requirements, the candidate answer text is truncated, that is, the candidate answer text is not displayed to the user.
[0122] In the text processing method provided in the embodiment of the present application, after the client device obtains the question text to be answered and the corresponding candidate answer text, it also obtains the quality prediction result obtained by predicting the text quality based on the overall semantic features; based on the quality prediction result, the quality of the candidate text is judged, and then when the quality of the candidate answer text meets the requirements, the candidate answer text is displayed as the answer to the question text in the display interface. The embodiment of the present application can avoid user loss caused by revealing low-quality candidate answer text to users, and can effectively improve user satisfaction.
[0123] Embodiment 3
[0124] See also Figure 7 , Figure 7 1 is a structural block diagram of a text processing device according to Embodiment 3 of the present application. The text processing device provided in the embodiment of the present application includes:
[0125] A text acquisition unit 702, used to acquire question text and candidate answer text;
[0126] The semantic feature extraction unit 704 is used to extract semantic features from the question text and the candidate answer file using the semantic feature extraction module in the text quality model to obtain overall semantic features;
[0127] The quality prediction unit 706 is used to perform quality classification prediction based on the overall semantic features through the classification prediction module in the text quality model to obtain a quality prediction result, so as to determine whether to display the candidate answer text as the answer corresponding to the question text based on the quality prediction result.
[0128] Optionally, in some of these embodiments, the text quality model further includes: a custom feature extraction module;
[0129] The text processing device further comprises:
[0130] A custom feature extraction unit is used to extract custom quality features from the candidate answer texts through a custom feature extraction module in the text quality model; the custom quality features represent quality attribute information of the candidate question and answer texts;
[0131] A splicing unit is used to splice the custom quality features and the overall semantic features to obtain the spliced features;
[0132] The quality prediction unit 706 is specifically used to: perform quality classification prediction based on the spliced features through the classification prediction module in the text quality model to obtain a quality prediction result.
[0133] Optionally, in some of the embodiments, the quality attribute information includes at least one of the following: whether the candidate answer text contains answer content corresponding to the question text, location information of the answer content in the candidate answer text, the degree of content repetition of the candidate answer text, and the degree of content completeness of the candidate answer text.
[0134] Optionally, in some of the embodiments, the quality category corresponding to the text quality model is presented in the form of a score; different quality categories correspond to different scores, and the scores corresponding to each quality category are set in a preset order of magnitude;
[0135] The text processing device further comprises:
[0136] The model training unit is used to obtain question samples, candidate answer samples and corresponding sample quality labels; and input the question samples and candidate answer samples into the text quality model to be trained, and output the sample prediction score through the text quality model;
[0137] Calculate the classification loss value based on the sample prediction score and sample quality label;
[0138] Based on the scores corresponding to each quality category, the sample prediction score is corrected to obtain a corrected prediction score; and based on the corrected prediction score and the sample quality label, the regression loss value is calculated;
[0139] The classification loss value and the regression loss value are fused to obtain a fusion loss value, and the parameters of the text quality model are adjusted based on the fusion loss value to obtain a trained text quality model.
[0140] Optionally, in some of the embodiments, the corrected prediction score is presented in the form of a vector, and when the model training unit performs the step of correcting the sample prediction score based on the score corresponding to each quality category to obtain the corrected prediction score, it is specifically used to:
[0141] Construct a score vector based on the scores corresponding to each quality category;
[0142] Calculate the inner product of the sample prediction score and the score vector, and use the result as the corrected prediction score.
[0143] Optionally, in some of the embodiments, the candidate answer text includes: a title part, and a paragraph part corresponding to the title part;
[0144] The text processing device further comprises:
[0145] The relevance prediction unit is used to extract semantic features from the title part and the corresponding paragraph part using the semantic feature extraction module in the relevance prediction model to obtain semantic features of the title paragraph; input the semantic features of the title paragraph into the relevance classification module in the relevance prediction model to obtain the relevance prediction result through the relevance classification module;
[0146] Determining whether to display the candidate answer text as the answer corresponding to the question text based on the quality prediction result includes:
[0147] Based on the quality prediction results and the relevance prediction results, determine whether to display the candidate answer text as the answer corresponding to the question text.
[0148] Optionally, in some of the embodiments, the text processing apparatus further includes:
[0149] A repetitive prediction unit is used to extract a first text portion and a second text portion from a candidate answer text; input the first text portion and the second text portion into a repetitive prediction model, extract a first semantic feature from the first text portion through a first feature extraction module in the repetitive prediction model, and extract a second semantic feature from the second text portion through a second feature extraction module in the repetitive prediction model; input the first semantic feature and the second semantic feature into a repetitive classification module in the repetitive prediction model to obtain a repetitive prediction result;
[0150] Determining whether to display the candidate answer text as the answer corresponding to the question text based on the quality prediction result includes:
[0151] Based on the quality prediction results and the repeatability prediction results, determine whether to display the candidate answer text as the answer corresponding to the question text.
[0152] Optionally, in some of the embodiments, the first text portion and the second text portion are from different paragraphs in the candidate answer text.
[0153] The text processing device of the embodiment of the present application is used to implement any of the methods in the aforementioned method embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be described in detail here. In addition, the functional implementation of each module in the text processing device of the embodiment of the present application can refer to the description of the corresponding parts in the aforementioned method embodiments, which will not be described in detail here.
[0154] Embodiment 4
[0155] Reference Figure 8, shows a schematic diagram of the structure of an electronic device according to the fourth embodiment of the present application. The specific embodiment of the present application does not limit the specific implementation of the electronic device.
[0156] like Figure 8 As shown, the electronic device may include: a processor (processor) 802, a communication interface (Communications Interface) 804, a memory (memory) 806, and a communication bus 808.
[0157] in:
[0158] The processor 802 , the communication interface 804 , and the memory 806 communicate with each other via a communication bus 808 .
[0159] The communication interface 804 is used to communicate with other electronic devices or servers.
[0160] The processor 802 is used to execute the program 810, and specifically can execute the relevant steps in the above method embodiment.
[0161] Specifically, the program 810 may include program codes, which include computer operation instructions.
[0162] The processor 802 may be a CPU, or an Application Specific Integrated Circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application. The one or more processors included in the smart device may be processors of the same type, such as one or more CPUs; or may be processors of different types, such as one or more CPUs and one or more ASICs.
[0163] The memory 806 is used to store the program 810. The memory 806 may include a high-speed RAM memory, and may also include a non-volatile memory, such as at least one disk memory.
[0164] The program 810 may be specifically used to enable the processor 802 to execute the relevant steps in the above method embodiment.
[0165] The specific implementation of each step in program 810 can refer to the corresponding description of the corresponding step in the above method embodiment, which will not be repeated here. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described devices and modules can refer to the corresponding process description in the above method embodiment, which will not be repeated here.
[0166] The present application also provides a computer storage medium on which a computer program is stored, and when the program is executed by a processor, the method described in any of the above-mentioned multiple method embodiments is implemented. The computer storage medium includes but is not limited to: a compact disk (CD-ROM), a random access memory (RAM), a floppy disk, a hard disk or a magneto-optical disk, etc.
[0167] An embodiment of the present application also provides a computer program product, including computer instructions, which instruct a computing device to execute operations corresponding to any one of the above-mentioned multiple method embodiments.
[0168] In addition, it should be noted that the user-related information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to sample data used to train the model, data used for analysis, stored data, displayed data, etc.) involved in the embodiments of the present application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data need to comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0169] It should be pointed out that, according to the needs of implementation, the various components / steps described in the embodiments of the present application can be split into more components / steps, or two or more components / steps or partial operations of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of the present application.
[0170] The above-mentioned method according to the embodiment of the present application can be implemented in hardware, firmware, or implemented as software or computer code that can be stored in a recording medium (such as a CD ROM, RAM, floppy disk, hard disk or magneto-optical disk), or implemented as a computer code originally stored in a remote recording medium or a non-temporary machine-readable medium downloaded through a network and to be stored in a local recording medium, so that the method described herein can be stored in such software processing on a recording medium using a general-purpose computer, a dedicated processor or programmable or dedicated hardware (such as an AS IC or FPGA). It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component (e.g., RAM, ROM, flash memory, etc.) that can store or receive software or computer code, and when the software or computer code is accessed and executed by a computer, a processor or hardware, the method described herein is implemented. In addition, when a general-purpose computer accesses a code for implementing the method or method shown here, the execution of the code converts the general-purpose computer into a dedicated computer for executing the method shown here.
[0171] Those of ordinary skill in the art will appreciate that the units and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present application.
[0172] The above implementation methods are only used to illustrate the embodiments of the present application, and are not limitations on the embodiments of the present application. Ordinary technicians in the relevant technical field can make various changes and modifications without departing from the spirit and scope of the embodiments of the present application. Therefore, all equivalent technical solutions also belong to the scope of the embodiments of the present application. The scope of patent protection of the embodiments of the present application should be limited by the claims.
Claims
1. A text processing method, comprising: Get question text and candidate answer text; Using the semantic feature extraction module in the text quality model, extracting semantic features from the question text and the candidate answer file to obtain overall semantic features; Through the classification prediction module in the text quality model, quality classification prediction is performed based on the overall semantic features to obtain a quality prediction result, so as to determine whether to display the candidate answer text as the answer corresponding to the question text based on the quality prediction result.
2. The method according to claim 1, wherein: The text quality model also includes: a custom feature extraction module; Before performing quality classification prediction based on the overall semantic features through the classification prediction module in the text quality model to obtain a quality prediction result, the method further includes: Extracting custom quality features from the candidate answer texts through a custom feature extraction module in the text quality model; the custom quality features represent quality attribute information of the candidate question and answer texts; Splicing the custom quality feature and the overall semantic feature to obtain a spliced feature; The method of performing quality classification prediction based on the overall semantic features through the classification prediction module in the text quality model to obtain a quality prediction result includes: Through the classification prediction module in the text quality model, quality classification prediction is performed based on the spliced features to obtain a quality prediction result.
3. The method according to claim 2, wherein: The quality attribute information includes at least one of the following: whether the candidate answer text contains the answer content corresponding to the question text, the location information of the answer content in the candidate answer text, the degree of content repetition of the candidate answer text, and the degree of content completeness of the candidate answer text.
4. The method according to claim 1, wherein: The quality categories corresponding to the text quality model are presented in the form of scores; different quality categories correspond to different scores, and the scores corresponding to each quality category are set in a preset order of magnitude; The training process of the text quality model includes: Obtaining question samples, candidate answer samples, and corresponding sample quality labels; inputting the question samples and candidate answer samples into a text quality model to be trained, and outputting sample prediction scores through the text quality model; Calculating a classification loss value based on the sample prediction score and the sample quality label; Based on the scores corresponding to each quality category, the sample prediction score is corrected to obtain a corrected prediction score; and based on the corrected prediction score and the sample quality label, a regression loss value is calculated; The classification loss value and the regression loss value are fused to obtain a fusion loss value, and parameters of the text quality model are adjusted based on the fusion loss value to obtain a trained text quality model.
5. The method according to claim 4, wherein: The modified prediction score is presented in a vector form. The sample prediction score is modified based on the score corresponding to each quality category to obtain the modified prediction score, including: Construct a score vector based on the scores corresponding to each quality category; The inner product of the sample prediction score and the score vector is calculated, and the calculation result is used as the modified prediction score.
6. The method according to claim 1, wherein: The candidate answer text includes: a title part, and a paragraph part corresponding to the title part; Before determining whether to display the candidate answer text as the answer corresponding to the question text based on the quality prediction result, the method further includes: Using the semantic feature extraction module in the correlation prediction model, the semantic features of the title part and the corresponding paragraph part are extracted to obtain the semantic features of the title paragraph; Inputting the semantic features of the title paragraph into a relevance classification module in the relevance prediction model, and obtaining a relevance prediction result through the relevance classification module; The determining, based on the quality prediction result, whether to display the candidate answer text as the answer corresponding to the question text includes: Based on the quality prediction result and the relevance prediction result, it is determined whether to display the candidate answer text as the answer corresponding to the question text.
7. The method according to claim 1, wherein: Before determining whether to display the candidate answer text as the answer corresponding to the question text based on the quality prediction result, the method further includes: Extracting a first text portion and a second text portion from the candidate answer text; Inputting the first text part and the second text part into a repetitive prediction model, extracting a first semantic feature from the first text part through a first feature extraction module in the repetitive prediction model, and extracting a second semantic feature from the second text part through a second feature extraction module in the repetitive prediction model; Inputting the first semantic feature and the second semantic feature into a repetitive classification module in the repetitive prediction model to obtain a repetitive prediction result; The determining, based on the quality prediction result, whether to display the candidate answer text as the answer corresponding to the question text includes: Based on the quality prediction result and the repeatability prediction result, it is determined whether to display the candidate answer text as the answer corresponding to the question text.
8. The method according to claim 7, wherein: The first text portion and the second text portion are from different paragraphs in the candidate answer text.
9. A text processing method, comprising: In response to a preset input operation on the display interface, obtaining a question text; Obtaining candidate answer texts corresponding to the question texts, and quality prediction results of the candidate answer texts; the quality prediction results are obtained by performing quality classification prediction based on the overall semantic features obtained by performing semantic feature extraction on the question texts and the candidate answer files; If the quality prediction result meets the preset quality requirement, the candidate answer text is displayed in the display interface as the answer to the question text.
10. The method according to claim 9, wherein: The obtaining of the candidate answer text corresponding to the question text and the quality prediction result of the candidate answer text includes: The question text is sent to a server device so that the server device obtains candidate answer texts; a text quality model is used to extract semantic features from the question text and the candidate answer file to obtain overall semantic features; quality classification prediction is performed based on the overall semantic features to obtain quality prediction results; Receive the quality prediction result and the candidate answer text returned by the server device.
11. The method according to claim 9, wherein: Get the quality prediction results of the candidate answer text, including: Using a semantic feature extraction module in a text quality model deployed locally, extracting semantic features from the question text and the candidate answer file to obtain overall semantic features; Through the classification prediction module in the text quality model, quality classification prediction is performed based on the overall semantic features to obtain a quality prediction result.
12. The method according to claim 11, wherein: The text quality model also includes: a custom feature extraction module; Before performing quality classification prediction based on the overall semantic features through the classification prediction module in the text quality model to obtain a quality prediction result, the method further includes: Extracting custom quality features from the candidate answer texts through a custom feature extraction module in the text quality model; the custom quality features represent quality attribute information of the candidate question and answer texts; Splicing the custom quality feature and the overall semantic feature to obtain a spliced feature; The method of performing quality classification prediction based on the overall semantic features through the classification prediction module in the text quality model to obtain a quality prediction result includes: Through the classification prediction module in the text quality model, quality classification prediction is performed based on the spliced features to obtain a quality prediction result.
13. A text processing device, comprising: A text acquisition unit, used to acquire question text and candidate answer text; A semantic feature extraction unit, configured to extract semantic features from the question text and the candidate answer file using a semantic feature extraction module in a text quality model to obtain overall semantic features; The quality prediction unit is used to perform quality classification prediction based on the overall semantic features through the classification prediction module in the text quality model to obtain a quality prediction result, so as to determine whether to display the candidate answer text as the answer corresponding to the question text based on the quality prediction result.
14. An electronic device comprising: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform an operation corresponding to the method according to any one of claims 1 to 12.
