Text enhancement method, electronic device, computer-readable storage medium
By combining a text enhancement module with a pre-trained language model, the problem of ensuring text data quality in existing technologies is solved, enabling the screening of high-quality text data in the fields of intelligent healthcare and financial transactions, and improving the model training effect.
Patent Information
- Application Number
- CN202310595282.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-24
- Publication Date
- 2026-02-13
- Estimated Expiration
- 2043-05-24
AI Technical Summary
In existing technologies, text enhancement methods struggle to objectively and accurately select high-quality text data from numerous target texts. This is especially true in the fields of intelligent healthcare and financial transactions, where specialized terminology is difficult to find in general knowledge, making it difficult to guarantee the quality of the dataset.
By acquiring the original text and inputting it into a preset text enhancement module, the text is enhanced and then predicted using a pre-trained test language model. Combined with semantic feature extraction and similarity comparison, high-quality text data is selected using the first and second evaluation metrics.
It enables the objective and accurate selection of high-quality text data in the fields of intelligent healthcare and financial transactions, thereby improving the training effect of natural language models.
Smart Images

Figure CN116860955B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of intelligent medical and financial transaction data processing, and particularly relates to a text enhancement method, an electronic device and a computer readable storage medium. BACKGROUND
[0002] Natural Language Processing (NLP) is an important direction in the field of computer science and artificial intelligence. It studies various theories and methods that can realize effective communication between people and computers using natural language. With the development of artificial intelligence technology, the field of natural language processing has produced multiple models with different structures. Text data enhancement (referred to as text enhancement) refers to a method of generating more category training samples through technical means in the process of text processing tasks (such as text classification tasks). In intelligent medical, financial transaction and other business scenarios, various natural language models are often used. It should be pointed out that various professional terms in intelligent medical and financial transactions are not easy to find in general fields, so general data sets cannot be directly used to train natural language models for intelligent medical and financial transactions. Therefore, text data enhancement is often used in these fields due to the lack of data sets in the field of intelligent medical and financial transactions.
[0003] In related technologies, there are many ways to perform text enhancement on original text, such as synonym replacement, random insertion, random exchange, random deletion, natural language model processing, etc. After data enhancement, a large number of target texts can be obtained, but the quality of the numerous target texts is difficult to guarantee. Therefore, how to objectively and accurately screen high-quality text data from numerous target texts is still a problem to be solved in the industry. SUMMARY
[0004] The present application aims to at least solve one of the technical problems existing in the prior art. To this end, the present application provides a text enhancement method, an electronic device and a computer readable storage medium, which can objectively and accurately screen high-quality text data from numerous target texts.
[0005] The text enhancement method according to the first aspect of the present application comprises:
[0006] obtaining an original text and inputting the original text into a preset text enhancement module;
[0007] performing text enhancement processing on the original text based on the text enhancement module to obtain a target text;
[0008] performing prediction processing on the target text based on a pre-trained test language model to obtain prediction result data;
[0009] The original text is compared with the prediction result data to obtain a first evaluation index corresponding to the target text;
[0010] Semantic feature extraction is performed on the original text to obtain original semantic features, and semantic feature extraction is performed on the target text to obtain target semantic features;
[0011] The original semantic features are compared with the target semantic features to obtain a second evaluation index corresponding to the target text;
[0012] The target text is screened based on the first evaluation index and the second evaluation index to obtain an enhanced text.
[0013] According to some embodiments of the present application, the screening of the target text based on the first evaluation index and the second evaluation index to obtain an enhanced text comprises:
[0014] The first evaluation index and the second evaluation index are fitted to obtain a comprehensive evaluation index;
[0015] The target text is screened based on the comprehensive evaluation index to obtain the enhanced text.
[0016] According to some embodiments of the present application, the screening of the target text based on the first evaluation index and the second evaluation index to obtain an enhanced text further comprises:
[0017] The target text is screened based on the first evaluation index to obtain a first target subtext;
[0018] The target text is screened based on the second evaluation index to obtain a second target subtext;
[0019] The first target subtext and the second target subtext are identified to obtain common text of the first target subtext and the second target subtext;
[0020] The common text is determined as the enhanced text.
[0021] According to some embodiments of the present application, the screening of the target text based on the first evaluation index and the second evaluation index to obtain an enhanced text comprises:
[0022] The target text is screened based on the first evaluation index and the second evaluation index to obtain a third target subtext;
[0023] The original text and the third target subtext are input into a preset semantic twin network;
[0024] extracting original text features of the original text through the semantic twin network and extracting target subtext features of the third target subtext through the semantic twin network;
[0025] performing semantic accuracy screening on the third target subtext based on the original text features and the target subtext features to obtain the enhanced text.
[0026] According to some embodiments of the present application, the text enhancement module includes a basic transformation unit, a back-translation processing unit, and a synonym processing unit. The text enhancement processing of the original text based on the text enhancement module to obtain the target text includes:
[0027] dividing the original text based on a preset condition to obtain a basic expansion text set, a back-translation processing text set, and a synonym processing text set;
[0028] performing basic data expansion on the basic expansion text set based on the basic transformation unit to obtain a first original subtext;
[0029] performing text back-translation processing on the back-translation processing text set based on the back-translation processing unit to obtain a second original subtext;
[0030] performing synonym conversion processing on the synonym processing text set based on the synonym processing unit to obtain a third original subtext;
[0031] integrating the first original subtext, the second original subtext, and the third original subtext to obtain the target text.
[0032] According to some embodiments of the present application, the semantic feature extraction of the original text to obtain original semantic features and the semantic feature extraction of the target text to obtain target semantic features include:
[0033] performing first word segmentation processing on the original text to obtain a plurality of first word groups;
[0034] performing second word segmentation processing on the target text to obtain a plurality of second word groups;
[0035] performing semantic feature extraction on each first word group and each second word group based on a pre-trained semantic recognition model to obtain the original semantic features of each first word group and the target semantic features of each second word group.
[0036] According to some embodiments of the present application, the similarity comparison of the original semantic features and the target semantic features to obtain a second evaluation index corresponding to the target text includes:
[0037] perform similarity calculation on the original semantic features of each of the first word groups and the target semantic features of each of the second word groups to obtain a similarity matrix;
[0038] based on the original semantic features, the target semantic features and the similarity matrix, obtain a target accuracy and a target recall rate corresponding to the target text;
[0039] obtain the second evaluation index according to the target accuracy and the target recall rate.
[0040] According to some embodiments of the present application, the obtaining of the target accuracy and the target recall rate corresponding to the target text based on the original semantic features, the target semantic features and the similarity matrix comprises:
[0041] extract a similarity matching score of each of the original semantic features and each of the target semantic features from the similarity matrix;
[0042] determine a maximum similarity score of each of the target semantic features according to a plurality of the similarity matching scores;
[0043] accumulate the maximum similarity scores of each of the target semantic features to obtain a similarity accumulation value;
[0044] obtain the target accuracy and the target recall rate according to the original semantic features, the target semantic features and the similarity accumulation value.
[0045] In a second aspect, embodiments of the present application provide an electronic device, comprising a memory and a processor, the memory stores a computer program, and the processor implements the text enhancement method according to any one of the embodiments of the first aspect of the present application when executing the computer program.
[0046] In a third aspect, embodiments of the present application provide a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the text enhancement method according to any one of the embodiments of the first aspect of the present application.
[0047] The text enhancement method, the electronic device and the computer readable storage medium according to the embodiments of the present application have at least the following beneficial effects:
[0048] The text enhancement method of this application requires first obtaining the original text and inputting it into a preset text enhancement module. Then, the original text is enhanced using the text enhancement module to obtain the target text. Further, a pre-trained test language model is used to predict the target text, yielding prediction results. The original text and prediction results are compared for overlap to obtain a first evaluation index corresponding to the target text. Next, semantic features are extracted from the original text to obtain original semantic features, and semantic features are extracted from the target text to obtain target semantic features. The original semantic features and target semantic features are compared for similarity to obtain a second evaluation index corresponding to the target text. Finally, the target text is filtered based on the first and second evaluation indices to obtain the enhanced text. Due to the filtering effect of the first and second evaluation indices, the text enhancement method of this application can objectively and accurately select high-quality text data from numerous target texts. In business scenarios such as intelligent healthcare and financial transactions, the text enhancement method of this application can also objectively and accurately obtain high-quality text data through the filtering effect of the first and second evaluation indices to expand the expression of professional terms.
[0049] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description
[0050] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which:
[0051] Figure 1 This is a schematic diagram of the text enhancement method provided in the embodiments of this application;
[0052] Figure 2 For this application Figure 1 A flowchart illustrating step S102 of the embodiment is shown;
[0053] Figure 3 For this application Figure 1 A flowchart illustrating step S105 of the embodiment is shown;
[0054] Figure 4 For this application Figure 1 A flowchart illustrating step S106 of the embodiment is shown;
[0055] Figure 5 For this application Figure 4 A flowchart illustrating step S402 of the embodiment is shown;
[0056] Figure 6 For this application Figure 1A flowchart illustrating an embodiment of step S107 is shown.
[0057] Figure 7 For the present application Figure 1 Another flowchart illustrating an embodiment of step S107 is shown.
[0058] Figure 8 For the present application Figure 1 Another flowchart illustrating an embodiment of step S107 is shown.
[0059] Figure 9 A hardware structure schematic diagram of an electronic device provided by an embodiment of the present application is shown. DETAILED DESCRIPTION
[0060] In the description of the present application, several meanings are one or more, the meaning of multiple is two or more, greater than, less than, more than, etc. are understood as not including the number, above, below, within, etc. are understood as including the number. If it is described to the first, the second is only used for the purpose of distinguishing technical features, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features or implicitly indicating the sequence of indicated technical features.
[0061] In the description of the present application, it should be understood that the description of the position, such as the position or location relationship indicated by up, down, left, right, front, back, etc. is based on the position or location relationship shown in the drawings, which is only for the convenience of describing the present application and simplifying the description, and therefore cannot be understood as indicating or implying that the device or element indicated must have a specific position, be constructed and operated in a specific position, and therefore cannot be understood as limiting the present application.
[0062] In the description of the present application, the description of the terms "one embodiment", "some embodiments", "illustrative embodiment", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In the present description, the illustrative description of the above terms does not necessarily mean the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0063] In the description of the present application, it should be noted that, unless otherwise explicitly limited, the words such as setting, installing, connecting, etc. should be broadly understood, and those skilled in the art can reasonably determine the specific meaning of the above words in the present application in conjunction with the specific content of the technical solution. In addition, the identification of the specific steps in the following does not represent the limitation of the order and execution logic of the steps, and the execution order and execution logic between the steps should be understood and inferred with reference to the content expressed in the embodiments.
[0064] Natural Language Processing (NLP) is an important direction in the field of computer science and artificial intelligence. It studies various theories and methods that can realize effective communication between people and computers using natural language. With the development of artificial intelligence technology, the field of natural language processing has produced multiple models with different structures. Text data enhancement (referred to as text enhancement) refers to a method of generating more training samples of a class through technical means during a text processing task (such as a text classification task).
[0065] In related technologies, there are many ways to perform text enhancement on original text, such as synonym replacement, random insertion, random exchange, random deletion, natural language model processing, etc. After data enhancement, a large number of target texts can be obtained, but the quality of the numerous target texts is difficult to guarantee. Therefore, how to objectively and accurately screen high-quality text data from numerous target texts is still a problem to be solved in the industry.
[0066] The present application aims to at least solve one of the technical problems existing in the prior art. To this end, the present application provides a text enhancement method, an electronic device, and a computer readable storage medium, which can objectively and accurately screen high-quality text data from numerous target texts.
[0067] Further specific description is made below with reference to the accompanying drawings.
[0068] Figure 1 is an optional flowchart of the text enhancement method provided by the present application. According to the text enhancement method of the embodiments of the present application, the text enhancement method can include but is not limited to the following steps S101 to S107.
[0069] Step S101, obtaining an original text and inputting the original text into a preset text enhancement module;
[0070] Step S102, performing text enhancement processing on the original text based on the text enhancement module to obtain a target text;
[0071] Step S103, performing prediction processing on the target text based on a pre-trained test language model to obtain prediction result data;
[0072] Step S104, comparing the original text with the prediction result data for coincidence degree to obtain a first evaluation index corresponding to the target text;
[0073] Step S105, performing semantic feature extraction on the original text to obtain original semantic features, and performing semantic feature extraction on the target text to obtain target semantic features;
[0074] Step S106, similarity comparison of the original semantic features and the target semantic features is performed to obtain a second evaluation index corresponding to the target text;
[0075] Step S107, the target text is screened based on the first evaluation index and the second evaluation index to obtain an enhanced text.
[0076] The text enhancement method of the present application needs to first obtain an original text and input the original text into a preset text enhancement module, then perform text enhancement processing on the original text based on the text enhancement module to obtain a target text, further, perform prediction processing on the target text based on a pre-trained test language model to obtain prediction result data, perform coincidence comparison of the original text and the prediction result data to obtain a first evaluation index corresponding to the target text, further, perform semantic feature extraction on the original text to obtain original semantic features and perform semantic feature extraction on the target text to obtain target semantic features, perform similarity comparison of the original semantic features and the target semantic features to obtain a second evaluation index corresponding to the target text, and finally screen the target text based on the first evaluation index and the second evaluation index to obtain an enhanced text. Due to the screening effect of the first evaluation index and the second evaluation index, the text enhancement method of the present application can objectively and accurately screen high-quality text data from numerous target texts.
[0077] In steps S101 to S102 of some embodiments of the present application, an original text is obtained and input into a preset text enhancement module, and then text enhancement processing is performed on the original text based on the text enhancement module to obtain a target text. It should be noted that the original text refers to the basic text for text enhancement processing, and the target text is obtained by text enhancement processing of the original text. It should be understood that text enhancement refers to a method of generating more types of training samples through technical means in a text processing task (such as a text classification task). The purpose of text enhancement is to improve the training effect on the target model by increasing the number of different types of training samples. In some embodiments, text enhancement processing requires a certain amount of labeled samples, and more similar samples are generated by technical means. For example, by replacing some words in the original sample or randomly deleting some words in the synonym table, new sample materials are obtained.
[0078] It needs to be clear that the purpose of text enhancement is to increase the type and quantity of text on the basis of the original text to obtain the target text, so as to facilitate the training of artificial intelligence model according to the target text, and to improve the training effect of the artificial intelligence model. In some embodiments of the present application, in order to obtain rich samples, the text enhancement module can perform text enhancement processing on the original text through various methods. For example, text enhancement can be realized through back translation, specifically, the original text can be first translated into other languages through a translation program, and then the training samples in other languages are further translated back into Chinese to achieve the addition of the type and quantity of training samples, obtain the target text, however, text data enhancement through back translation requires at least two translations of training samples to complete the entire back translation operation, the process is relatively cumbersome, and the requirement for computing power is also relatively high, which is prone to uneven quality of target text. For example, text enhancement can be realized through Easy Data Augmentation (EDA), specifically, the variation data of the original text is obtained through synonym replacement, random insertion, random exchange, random deletion, etc. to obtain the target text to achieve the addition of the type and quantity of training samples, however, text data enhancement through Easy Data Augmentation is difficult to control the number of samples, if too much expansion or operation is too frequent, the semantic of the training sample will be changed, resulting in low quality of the target text. It needs to be pointed out that the existing text enhancement processing methods are relatively difficult to directly obtain ideal target text from the original text, and for this reason, the present application proposes a text enhancement method, which can objectively and accurately select high-quality text data from numerous target texts based on the first evaluation index and the second evaluation index.
[0079] In the business scenarios of intelligent medical treatment, financial transactions, etc., various natural language models are often used. It needs to be pointed out that various professional terms in intelligent medical treatment and financial transactions are not easy to find in general fields, so general data sets are difficult to be directly used for training natural language models for intelligent medical treatment and financial transactions, and the data sets in the fields of intelligent medical treatment and financial transactions are less, so text data augmentation is often used in these fields. In the business scenarios of intelligent medical treatment, financial transactions, etc., the use of the text enhancement method of the present application to realize the expression expansion of professional terms can also objectively and accurately obtain high-quality text data under the screening of the first evaluation index and the second evaluation index. If this part of high-quality text data is used to train natural language models for intelligent medical treatment and financial transactions, it can further improve the training effect of the natural language models, so that the trained natural language models can have better performance in the business scenarios of intelligent medical treatment and financial transactions.
[0080] Referring toFigure 2 According to some embodiments of the present application, step S102 can include, but is not limited to, steps S201-S205.
[0081] In step S201, the original text is divided based on preset conditions to obtain a basic expansion text set, a back-translation processing text set, and a synonym processing text set.
[0082] In step S202, the basic expansion text set is subjected to basic data expansion based on a basic transformation unit to obtain a first original subtext.
[0083] In step S203, the back-translation processing text set is subjected to text back-translation processing based on a back-translation processing unit to obtain a second original subtext.
[0084] In step S204, the synonym processing text set is subjected to synonym conversion processing based on a synonym processing unit to obtain a third original subtext.
[0085] In step S205, the first original subtext, the second original subtext, and the third original subtext are integrated to obtain a target text.
[0086] In step S201 of some embodiments of the present application, the original text is divided based on preset conditions to obtain a basic expansion text set, a back-translation processing text set, and a synonym processing text set. It should be emphasized that the purpose of text enhancement is to increase the types and quantities of text based on the original text. Therefore, in some exemplary embodiments of the present application, in order to increase the types and quantities of text based on the original text, text enhancement processing of the original text can be achieved through various methods such as basic data expansion, text back-translation processing, and synonym conversion processing. Therefore, after obtaining the original text, the original text needs to be divided under preset conditions to obtain a basic expansion text set, a back-translation processing text set, and a synonym processing text set. The preset conditions refer to conditions set in advance for dividing the original text. The preset conditions can be flexibly set according to actual needs, for example, the original text is randomly divided into a basic expansion text set, a back-translation processing text set, and a synonym processing text set. For another example, the original text is divided into a basic expansion text set, a back-translation processing text set, and a synonym processing text set according to a preset proportion. It should be understood that the preset conditions for dividing the original text can include, but are not limited to, the specific embodiments mentioned above.
[0087] In step S202 of some embodiments of the present application, the first original subtext is obtained by performing basic data augmentation on the basic augmented text set based on a basic augmentation unit. It should be noted that the basic data augmentation (Easy Data Augmentation, EDA) refers to obtaining the variation data of the original text by means of random insertion, random exchange, random deletion, etc., to obtain the target text, so as to increase the type and quantity of training samples. Therefore, the first original subtext is the result data obtained after the basic data augmentation of the basic augmented text set.
[0088] In step S203, the second original subtext is obtained by performing text back translation processing on the back translation processing text set based on a back translation processing unit. The text back translation processing refers to converting the original text into other languages through a translation program, and further translating the training samples in other languages back into Chinese, so as to increase the type and quantity of training samples, obtain the target text, and increase the type and quantity of training samples. Therefore, the second original subtext is the result data obtained after the basic data augmentation of the back translation processing text set.
[0089] In step S204, the third original subtext is obtained by performing synonym conversion processing on the synonym processing text set based on a synonym processing unit. It should be noted that the synonym conversion processing refers to realizing the synonym conversion of the sentence by means of an artificial intelligence model, synonym replacement, etc., to obtain the target text, so as to increase the type and quantity of training samples. Therefore, the third original subtext is the result data obtained after the synonym conversion processing of the synonym processing text set.
[0090] In step S205, the first original subtext, the second original subtext, and the third original subtext are integrated to obtain the target text.
[0091] It should be noted that the first evaluation index determines whether the target text generated by the text enhancement processing is associated with the original text in the statistical dimension by comparing the coincidence degree of the prediction result data and the original text. Since the purpose of text enhancement is to increase the type and quantity of text based on the original text, the greater the association degree of the target text with the original text in the statistical dimension based on the growth of the type and quantity of text, the higher the quality of the target text. In addition, the second evaluation index is used to evaluate whether the target text obtained after the text enhancement processing is similar in meaning to the original text based on the growth of the type and quantity of text. The greater the association degree of the target text with the original text in the semantic dimension, the higher the quality of the target text. Based on the first evaluation index and the second evaluation index, the target text can be selected in two aspects of the statistical dimension and the semantic dimension, so that high-quality text data, that is, enhanced text, can be objectively and accurately selected from a large number of target texts.
[0092] It should be noted that in the related art, various methods such as basic data augmentation, text back translation processing, synonym conversion processing, etc. can increase the type and quantity of text on the basis of the original text to obtain the target text. However, due to the mixture of various text enhancement methods, the target text after increasing the type and quantity of text has various defects, for example, text data enhancement in the back translation manner needs to be translated twice at least to complete the entire back translation operation, the process is relatively cumbersome, and the requirement for computing power is also relatively high, which is prone to uneven quality of the target text, and for example, text data enhancement in the basic data augmentation manner is difficult to control the number of samples, and if too much augmentation or operation is performed too frequently, the semantic of the training sample will be changed, resulting in low quality of the target text. It should be clear that when the target text has various types of defects, if there is no way to filter high-quality data from the target text, merely increasing the type and quantity of text is difficult to achieve good results.
[0093] Therefore, the embodiments shown in steps S201 to S205 of the present application increase the type and quantity of text on the basis of the original text by various methods such as basic data augmentation, text back translation processing, synonym conversion processing, etc. to obtain the target text, and at the same time, the first evaluation index and the second evaluation index are combined to perform two aspects of quality filtering on the target text from the statistical dimension and the semantic dimension, so that high-quality enhanced text can be obtained, thereby further improving the effect of text enhancement.
[0094] In step S103 of some embodiments of the present application, the target text is processed based on the pre-trained test language model to obtain prediction result data. It should be noted that the test language model refers to a language model used to test the target text. The language model (LM) plays an important role in natural language processing, which can predict the probability of a word sequence forming a sentence. The language model originated from speech recognition (Speech Recognition). That is, when inputting an audio data, a speech recognition system usually generates multiple sentences as candidates. In order to determine which sentences are more reasonable, the language model is needed to sort the candidate sentences to predict the word sequence with higher probability of forming a sentence, so as to determine the most reasonable sentence. Specifically, the language model is a model that can calculate the probability of a word sequence being a sentence. For example, a good language model will predict a high probability of word sequence A "today|weather|is|not|good" forming a sentence, while a good language model will predict a low probability of word sequence B "today|sleep|apple|good|fast" forming a sentence. It should be noted that based on the ability of the language model to predict the probability of a word sequence forming a sentence, the next word can be predicted based on the first several words.
[0095] It should be noted that there are various optional schemes for the test language model, such as N-gram language model, feedforward neural network language model (FeedForward Neural Network Language Models), recurrent neural network language model (RNN Language Models), and various types of language models. It should be clear that the optional scheme of the language model can include, but is not limited to, the specific embodiments mentioned above.
[0096] It should be clear that the pre-training process experienced by the test language model is used to train the test language model to predict the probability of the next word based on the first several words. It should be noted that the prediction processing of the target text based on the pre-trained test language model can obtain prediction result data, and the prediction processing can specifically refer to using the prediction ability of the test language model to select a word sequence from the target text, and then predicting the probability of the next word based on the word sequence, thereby obtaining the prediction result data. It should be understood that the purpose of the prediction processing is to obtain the prediction result data from the target text, so that the prediction result data and the original text are compared for coincidence degree, so as to evaluate the quality of the target text.
[0097] In some example embodiments of the present application, the target text is processed by the test language model for prediction, which can be extracting a word sequence from the target text, and then predicting the perplexity corresponding to the word sequence according to the test language model, and the perplexity value obtained is equivalent to a virtual dictionary size, and the next candidate word needs to be selected from the virtual dictionary. It should be noted that if the candidate word in the virtual dictionary can form a sentence with the extracted word sequence in the target text, the candidate word can be selected, and the sentence formed by the candidate word and the word sequence is the prediction result data. It should be noted that when the value of the perplexity is larger, the virtual dictionary is larger, and the candidate word that can be selected is more, and the possibility of the prediction result data having a high degree of coincidence with the original text is smaller, indicating that the quality of the target text is relatively low. Similarly, the smaller the value of the perplexity, the smaller the virtual dictionary, and the fewer the candidate words that can be selected, and the possibility of the prediction result data having a high degree of coincidence with the original text is larger, indicating that the quality of the target text is relatively high.
[0098] In step S104 of some embodiments of the present application, the original text and the prediction result data are compared for coincidence degree to obtain a first evaluation index corresponding to the target text. It should be emphasized that after the target text is processed by the test language model for prediction, the part of the text with a larger probability of forming a sentence in the target text can be obtained, that is, the prediction result data, and therefore the prediction result data includes the part of the text with a larger probability of forming a sentence in the target text. In some example embodiments of the present application, the original text and the prediction result data are compared for coincidence degree, which can determine the coincidence degree between the part of the text with a larger probability of forming a sentence in the target text and the original text, that is, the first evaluation index, and the quality of the text generated by the text enhancement processing is evaluated by the first evaluation index. It should be understood that the first evaluation index is determined by comparing the coincidence degree between the prediction result data and the original text, so as to determine whether the target text generated by the text enhancement processing is associated with the original text in the statistical dimension. Since the purpose of the text enhancement is to increase the type and quantity of the text on the basis of the original text, the greater the association degree between the target text and the original text in the statistical dimension on the basis of the growth of the type and quantity of the text, the higher the quality of the target text.
[0099] In some specific embodiments, when the language model is an N-gram language model, the N-gram language model can perform a sliding window operation on the content of the target text in byte stream with a size of N to form a sequence of byte segments with a length of N, where each byte segment is referred to as a gram. The frequency of occurrence of all grams is counted and filtered according to a pre-set threshold to form a list of key grams, that is, a target feature vector space of the target text. Each gram is a feature vector dimension. The N-gram model can be used to predict the target text according to the target feature vector space of the target text to obtain prediction result data. After obtaining the prediction result data, the prediction result data can be further compared with the original text for coincidence degree to obtain the coincidence degree of the prediction result data and the original text in term frequency, that is, a first evaluation index, which is used to evaluate the correlation degree of the target text and the original text in the statistical dimension.
[0100] In steps S105 to S106 of some embodiments of the present application, the original text is subjected to semantic feature extraction to obtain original semantic features, and the target text is subjected to semantic feature extraction to obtain target semantic features. The original semantic features and the target semantic features are compared for similarity to obtain a second evaluation index corresponding to the target text. It should be noted that the original semantic features are feature vectors representing the meaning of the original text, and the target semantic features are feature vectors representing the meaning of the target text.
[0101] It should be noted that the main purpose of extracting semantic features is to reduce the number of words to be processed without damaging the core semantic information of the text, so as to reduce the dimension of the vector space, thereby simplifying the calculation and improving the speed and efficiency of text processing. In some embodiments, the semantic features can be calculated according to a certain feature evaluation function, and then sorted according to the score value, and a number of features with the highest score value are selected as the features. In other embodiments, the semantic features can also be extracted. In some embodiments, high-quality semantic features can include the following characteristics: first, the semantic features should be able to accurately indicate the content of the text; second, the semantic features should have the ability to distinguish the target text from other texts; third, the number of semantic features should not be too large; and fourth, the separation of semantic features should be relatively easy to achieve. The method of extracting semantic features can be to use a natural language model to extract the semantic features of the original text and the target text. The optional natural language model includes but is not limited to a BERT pre-training model, a Multi-Task Deep Neural Networks (MT-DNN) model, an XLNet model, etc.
[0102] It should be understood that after obtaining the original semantic features and the target semantic features, the original semantic features and the target semantic features are further compared in similarity, the purpose of which is to compare whether the sentence meanings of the target text and the original text are similar, so as to obtain a second evaluation index corresponding to the target text, so as to evaluate whether the target text obtained after the text enhancement processing is still similar to the sentence meaning of the original text on the basis of the increase of the type and quantity of the text. It should be pointed out that since the purpose of text enhancement is to increase the type and quantity of the text on the basis of the original text, therefore, on the basis of the increase of the type and quantity of the text, the greater the correlation degree of the target text and the original text in the semantic dimension, the higher the quality of the target text.
[0103] In some more specific embodiments, the BERTScore corresponding to the BERT pre-training model can be used as the second evaluation index, and the token-level encoding is performed on the target text and the original text, and then the token-level precision, recall and semantic evaluation index (F) are calculated according to the cosine similarity of the token encoding. Since the cosine similarity is used, the problem of rigidity caused by accurate matching is solved, and in addition, since the BERT encoding considers the context, the encoding of each token has already fused the context information. In addition, in order to consider the importance of different tokens, the BERTScore can also give different weights to different words based on the Term Frequency-Inverse Document Frequency (TF-IDF), so as to more accurately calculate the BERTScore value (Precision, Recall, F).
[0104] With reference to Figure 3 According to step S105 of some embodiments of the present application, the following steps S301 to S303 can be included but are not limited thereto.
[0105] Step S301: performing first word segmentation processing on the original text to obtain a plurality of first word groups;
[0106] Step S302: performing second word segmentation processing on the target text to obtain a plurality of second word groups;
[0107] Step S303: performing semantic feature extraction on each first word group and each second word group based on a pre-trained semantic recognition model to obtain original semantic features of each first word group and target semantic features of each second word group.
[0108] In steps S301-S302 of some embodiments of the present application, the original text is subjected to first word segmentation processing to obtain a plurality of first word groups, and the target text is subjected to second word segmentation processing to obtain a plurality of second word groups. It should be noted that the purpose of the first word segmentation processing of the original text is to facilitate the extraction of the original semantic features of the original text, and similarly, the purpose of the first word segmentation processing of the target text is to facilitate the extraction of the target semantic features of the target text. It should be noted that word segmentation processing is the basis of natural language processing, and the accuracy of word segmentation directly determines the quality of semantic features. In some embodiments, since English sentences use spaces to separate words, most of the time, except for some specific words (such as how many, New York, etc.), there is no need to consider word segmentation. However, Chinese is different, it naturally lacks a separator, and readers need to perform word segmentation and sentence segmentation themselves, so when doing Chinese natural language processing, we need to perform word segmentation first. For Chinese word segmentation, current word segmentation methods mainly fall into two categories: dictionary-based rule matching methods and statistical-based machine learning methods. Firstly, dictionary-based word segmentation algorithms are essentially string matching. The string to be matched is matched with a large enough dictionary based on a certain algorithm strategy, and if the match is hit, the word can be segmented. According to different matching strategies, it is divided into forward maximum matching method, reverse maximum matching method, bidirectional matching word segmentation, full segmentation path selection, etc.; secondly, statistical-based word segmentation algorithms are essentially a sequence labeling problem. We label the words in the sentence according to their positions in the word. The labeling mainly includes: B (the first word of the word), E (the last word of the word), M (the middle word of the word, which can be multiple), S (a word represents a word). For example, "today's weather is really very good", the labeled result is "BESBESBEBME", and the corresponding word segmentation result is "today / of / weather / is / really / very good". It should be understood that there are many methods for word segmentation processing, which can include, but are not limited to, the specific embodiments mentioned above.
[0109] In step S303 of some embodiments of the present application, the semantic feature of each first word group and each second word group is extracted based on the pre-trained semantic recognition model, to obtain the original semantic feature of each first word group and the target semantic feature of each second word group. It should be emphasized that the main purpose of extracting semantic features is to reduce the number of words to be processed without damaging the core semantic information of the text, so as to reduce the dimension of the vector space, thereby simplifying the calculation and improving the speed and efficiency of text processing. It should be pointed out that the semantic recognition model refers to a natural language model used to recognize semantic information in the text, and the pre-training of the semantic recognition model is used to train the semantic feature extraction capability of the semantic recognition model. It should be clear that the natural language model is used to extract the semantic features of the original text and the target text, and the optional natural language model includes but is not limited to: BERT pre-training model, Multi-Task Deep Neural Networks (MT-DNN) model, XLNet model, etc.
[0110] Through the above steps S301 to S303, the original text is first subjected to first word segmentation processing to obtain a plurality of first word groups, and the target text is subjected to second word segmentation processing to obtain a plurality of second word groups, and then the semantic feature of each first word group and each second word group is extracted based on the pre-trained semantic recognition model, to obtain the original semantic feature of each first word group and the target semantic feature of each second word group, which can facilitate the extraction of the semantic features of the original text and the target text, thereby further improving the quality evaluation efficiency of the target text.
[0111] Referring to Figure 4 According to step S106 of some embodiments of the present application, it can include but is not limited to steps S401 to S403.
[0112] In step S401, the original semantic feature of each first word group and the target semantic feature of each second word group are calculated for similarity one by one to obtain a similarity matrix.
[0113] In step S402, the target accuracy and the target recall rate corresponding to the target text are obtained based on the original semantic feature, the target semantic feature and the similarity matrix.
[0114] In step S403, the second evaluation index is obtained according to the target accuracy and the target recall rate.
[0115] In step S401 of some embodiments of the present application, the original semantic features of each first word group and the target semantic features of each second word group are one by one calculated for similarity, to obtain a similarity matrix. It should be noted that the original semantic features of each first word group and the target semantic features of each second word group are one by one calculated for similarity, which aims to compare the semantic similarity of the original text and the target text, and to establish a second evaluation index for evaluating the quality of the target text in the semantic dimension. It should be noted that the original semantic features of each first word group and the target semantic features of each second word group are one by one calculated for similarity to obtain a similarity matrix in various ways, which can be to calculate the cosine similarity of the original semantic features of each first word group and the target semantic features of each second word group one by one, thereby forming a similarity matrix based on cosine similarity, or to calculate the Euclidean distance of the original semantic features of each first word group and the target semantic features of each second word group one by one, thereby forming a similarity matrix based on Euclidean distance. It should be noted that the cosine similarity can be used to measure the vector angle size of the original semantic features and the target semantic features, and the smaller the angle, the greater the cosine similarity, indicating that the two types of semantic vectors are more similar. Euclidean distance, referred to as Euclidean distance, is a similarity calculation method based on Euclidean distance, which means that each original semantic feature and each target semantic feature are mapped in a two-dimensional coordinate system, and further based on the two types of semantic features, the smaller the Euclidean distance, the more similar the two types of semantic vectors. It should be understood that the method of calculating the similarity of the original semantic features of each first word group and the target semantic features of each second word group one by one is various, which can include, but is not limited to, the specific embodiments mentioned above.
[0116] In steps S402 to S403 of some embodiments of the present application, based on the original semantic features, the target semantic features and the similarity matrix, the target precision and the target recall corresponding to the target text are obtained, and then the second evaluation index is obtained according to the target precision and the target recall. It should be noted that after obtaining the similarity matrix, the target semantic vector and the original semantic vector can be respectively calculated for maximum similarity score accumulation and then normalized based on the similarity matrix, to obtain the target precision and the target recall corresponding to the target text. Further, according to the target precision (Precision) and the target recall (Recall), the semantic evaluation index (F) in the semantic dimension, that is, the second evaluation index, can be obtained.
[0117] By the steps S402 to S403, the similarity between each first semantic feature and each second semantic feature is calculated to obtain a similarity matrix, and then the second evaluation index is obtained based on the original semantic features, the target semantic features and the similarity matrix. The second evaluation index reflecting the semantic similarity between the target text and the original text is more accurate.
[0118] With reference to Figure 5 According to step S402 of some embodiments of the present application, the following steps S501 to S504 can be included but are not limited thereto.
[0119] Step S501: Extracting the similarity matching score of each original semantic feature and each target semantic feature from the similarity matrix;
[0120] Step S502: Determining the maximum similarity score of each target semantic feature according to the plurality of similarity matching scores;
[0121] Step S503: Accumulating the maximum similarity score of each target semantic feature to obtain a similarity accumulation value;
[0122] Step S504: Obtaining the target accuracy and target recall rate according to the original semantic features, the target semantic features and the similarity accumulation value.
[0123] The target accuracy and target recall rate are obtained by the steps S501 to S504, and based on the maximum similarity score, the most similar original semantic feature is matched to each target semantic feature, the maximum similarity score of each target semantic feature is further accumulated to obtain a similarity accumulation value, and then the target accuracy and target recall rate are further obtained according to the original semantic features, the target semantic features and the similarity accumulation value, so that the second evaluation index reflecting the semantic similarity between the target text and the original text is more accurate.
[0124] In some more specific embodiments, the calculation of the second evaluation index can be completed by the following steps:
[0125] First, the plurality of original semantic features of the first word group is represented as X={x1,x2,x3,…,x i}, and the plurality of target semantic features of the second word group is represented as Y={y1,y2,y3,…,y j}, wherein i represents the number of original semantic features, and j represents the number of target semantic features.
[0126] Further, according to the plurality of original semantic features X={x1,x2,x3,…,x i}, according to the plurality of target semantic features Y={y1,y2,y3,…,y j}, the cosine similarity calculation formula The similarity matrix is obtained by calculating the similarity between each original semantic feature and each target semantic feature:
[0127]
[0128] Further, the target precision (Precision) and target recall (Recall) are calculated based on the similarity matrix and the following analytical expression, and the semantic evaluation index (F) of the semantic dimension is obtained:
[0129]
[0130]
[0131]
[0132] It should be pointed out that the semantic evaluation index (F) in the above embodiment is the second evaluation index corresponding to the target text, which is used to evaluate whether the target text obtained after the text enhancement processing still has similar sentence meaning to the original text on the basis of the increase in the type and quantity of the text, and to evaluate the quality of the target text from the semantic dimension. It should be understood that there are various ways to compare the similarity between the original semantic features and the target semantic features to obtain the second evaluation index corresponding to the target text, which are not limited to the specific embodiments mentioned above.
[0133] In step S107 of some embodiments of the present application, the target text is filtered based on the first evaluation index and the second evaluation index to obtain the enhanced text. It should be noted that the first evaluation index determines whether the target text generated by the text enhancement processing is associated with the original text in the statistical dimension by comparing the coincidence degree of the prediction result data and the original text. Since the purpose of text enhancement is to increase the type and quantity of the text based on the original text, the greater the correlation degree between the target text and the original text in the statistical dimension on the basis of the increase in the type and quantity of the text, the higher the quality of the target text. In addition, the second evaluation index is used to evaluate whether the target text obtained after the text enhancement processing still has similar sentence meaning to the original text on the basis of the increase in the type and quantity of the text. The greater the correlation degree between the target text and the original text in the semantic dimension, the higher the quality of the target text. Based on the first evaluation index and the second evaluation index, the target text can be filtered in two aspects, i.e., in the statistical dimension and in the semantic dimension, so that high-quality text data, i.e., the enhanced text, can be objectively and accurately filtered from a large number of target texts.
[0134] Referring to Figure 6According to some embodiments of the present application, step S107 can include but is not limited to steps S601-S602.
[0135] In step S601, the first evaluation index is fitted with the second evaluation index to obtain a comprehensive evaluation index.
[0136] In step S602, the target text is filtered based on the comprehensive evaluation index to obtain an enhanced text.
[0137] In steps S601-S602, the first evaluation index is fitted with the second evaluation index to obtain a comprehensive evaluation index, and then the target text is filtered based on the comprehensive evaluation index to obtain an enhanced text. It should be noted that the comprehensive evaluation index combines the first evaluation index and the second evaluation index, and can simultaneously perform quality filtering of the target text from the statistical dimension and the semantic dimension, so that high-quality enhanced text can be obtained under multi-evaluation dimension quality filtering.
[0138] In some more specific embodiments, if the first evaluation index is the perplexity Perplexity in the above embodiments, and the second evaluation index is the semantic evaluation index (F) in the above embodiments, it should be noted that the smaller the Perplexity, the higher the quality of the target text in the statistical dimension evaluation, and the larger the F, the higher the quality of the target text in the semantic dimension evaluation. Therefore, in order to fit the first evaluation index with the second evaluation index and unify the evaluation methods of the two types of indexes, the comprehensive evaluation index can be set as Δ=F*1 / Perplexity. It should be noted that the target text is filtered by using the comprehensive evaluation index Δ, and the comprehensive evaluation mean Δ mean of the target text is calculated, and then the quality filtering is performed according to the comprehensive evaluation mean Δ mean . When the Δ of a certain sentence in the target text is Δ≥Δ mean , it indicates that the quality of the sentence meets the standard and can be retained, otherwise, when the Δ of a certain sentence in the target text is Δ<Δ mean , it indicates that the quality of the sentence does not meet the standard and needs to be filtered out. It should be noted that there are various ways to filter the target text by using the comprehensive evaluation index, which can include but is not limited to the specific embodiments mentioned above.
[0139] Referring to Figure 7 , according to some embodiments of the present application, step S107 can further include but is not limited to steps S701-S704.
[0140] In step S701, the target text is filtered based on the first evaluation index to obtain a first target subtext.
[0141] In step S702, the semantic feature of the target text is screened based on the second evaluation index, and a second target subtext is obtained.
[0142] In step S703, the first target subtext and the second target subtext are subjected to overlapping text recognition, and common text of the first target subtext and the second target subtext is obtained.
[0143] In step S704, the common text is determined as the enhanced text.
[0144] In some embodiments of the present application, in steps S701 to S704, the statistical feature of the target text is screened based on the first evaluation index, and the first target subtext is obtained, the semantic feature of the target text is screened based on the second evaluation index, and the second target subtext is obtained, further, the first target subtext and the second target subtext are subjected to overlapping text recognition, and the common text of the first target subtext and the second target subtext is obtained, and finally the common text is determined as the enhanced text. It should be noted that screening the statistical feature of the target text based on the first evaluation index means that the target text is screened in the statistical dimension based on the first evaluation index, so as to ensure that the enhanced text has greater relevance with the original text in the word frequency attribute. In addition, screening the semantic feature of the target text based on the second evaluation index means that the target text is screened in the semantic dimension based on the second evaluation index, so as to ensure that the enhanced text has greater relevance with the original text in the sentence meaning. It should be understood that the execution order of the statistical feature screening and the semantic feature screening is not strictly limited, and the statistical feature screening can be performed first and then the semantic feature screening, or the semantic feature screening can be performed first and then the statistical feature screening, or the two types of screening can be performed simultaneously. After the two types of screening, the first target subtext and the second target subtext are obtained, and after the common text is obtained from the first target subtext and the second target subtext, the common text is further determined as the enhanced text, so that the high-quality text data, that is, the enhanced text, can be objectively and accurately screened from the target text.
[0145] Referring to Figure 8 According to some embodiments of the present application, step S107 can further include but is not limited to steps S801 to S804.
[0146] In step S801, the first evaluation index and the second evaluation index are used to screen the target text for coherent sentences, and a third target subtext is obtained.
[0147] In step S802, the original text and the third target subtext are input into a preset semantic twin network.
[0148] In step S803, the original text feature of the original text is extracted by the semantic twin network, and the target subtext feature of the third target subtext is extracted by the semantic twin network.
[0149] Step S804, based on the original text features and target subtext features, the third target subtext is screened for semantic accuracy, and an enhanced text is obtained.
[0150] In step S801 of some embodiments of the present application, the target text is screened for coherent sentences based on the first evaluation index and the second evaluation index, and a third target subtext is obtained. It should be noted that the first evaluation index can screen the quality of the target text from a statistical dimension, and the second evaluation index can screen the quality of the target text from a semantic dimension. The combination of the two can better screen the relatively coherent sentences in the target text and obtain the third target subtext. However, if some sentences in the target text have defects such as logical errors and reversed semantic information, further correction is needed through a semantic twin network.
[0151] In steps S802 to S804 of some embodiments of the present application, the original text and the third target subtext are first input into a preset semantic twin network. Then, the original text features of the original text are extracted through the semantic twin network, and the target subtext features of the third target subtext are extracted through the semantic twin network. Further, the third target subtext is screened for semantic accuracy based on the original text features and the target subtext features, and an enhanced text is obtained. It should be clear that the semantic twin network includes two input ends. The function of the semantic twin network is to compare the data input from the two input ends, and to process the two data for clustering or semantic similarity calculation, so as to further correct the third target subtext. It should be clear that the original text features are used to represent the overall semantics of the original text, and the target subtext features are used to represent the overall semantics of the third target subtext. It should be understood that screening the third target subtext based on the original text features and the target subtext features can screen some sentences with defects such as logical errors and reversed semantic information from the overall semantic dimension of the text, so as to more objectively and accurately screen out high-quality enhanced texts from a large number of target texts.
[0152] In some more specific embodiments, the semantic twin network can be Sentence-BERT. It should be noted that Sentence-BERT is a twin network based on pre-trained BERT, which can obtain a paragraph vector with sufficient semantic meaning. Sentence-BERT is mainly proposed to solve the huge time overhead of BERT semantic similarity retrieval and the fact that the sentence representation is not suitable for unsupervised tasks such as clustering, sentence similarity calculation, etc. Sentence-BERT uses a twin network structure to obtain vector representations of sentence pairs, and then pre-trains a similarity model, which is Sentence-BERT.
[0153] Figure 9 An electronic device 900 provided by an embodiment of the present application is shown. The electronic device 900 includes a processor 901, a memory 902, and a computer program stored in the memory 902 and executable on the processor 901, and the computer program, when executed, is configured to perform the text enhancement method described above.
[0154] The processor 901 and the memory 902 can be connected by a bus or other means.
[0155] The memory 902, as a non-transitory computer readable storage medium, can be configured to store non-transitory software programs and non-transitory computer executable programs, such as the text enhancement method described in the embodiments of the present application. The processor 901, by executing the non-transitory software programs and instructions stored in the memory 902, implements the text enhancement method described above.
[0156] The memory 902 can include a program storage area and a data storage area, wherein the program storage area can store an operating system and at least one application required by a function. The data storage area can store the text enhancement method described above. In addition, the memory 902 can include a high-speed random access memory 902, and can also include a non-transitory memory 902, such as at least one storage device, a flash memory device, or other non-transitory solid-state memory device. In some embodiments, the memory 902 can optionally include a memory 902 remotely arranged with respect to the processor 901, and these remote memories 902 can be connected to the electronic device 900 through a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0157] The non-transitory software programs and instructions required to implement the text enhancement method described above are stored in the memory 902, and when executed by one or more processors 901, the text enhancement method described above is performed, for example, the method steps S101 to S107 in Figure 1 , the method steps S201 to S205 in Figure 2 , the method steps S301 to S303 in Figure 3 , the method steps S401 to S403 in Figure 4 , the method steps S501 to S504 in Figure 5 , the method steps S601 to S602 in Figure 6 , the method steps S701 to S704 in Figure 7 , and the method steps S801 to S804 in Figure 8 .
[0158] This application also provides a computer-readable storage medium storing computer-executable instructions for performing the above-described text enhancement method.
[0159] In one embodiment, the computer-readable storage medium stores computer-executable instructions that are executed by one or more control processors, for example, executing... Figure 1 Method steps S101 to S107 in the above method Figure 2 Method steps S201 to S205, Figure 3 Method steps S301 to S303, Figure 4 Method steps S401 to S403, Figure 5 Method steps S501 to S504 Figure 6 Method steps S601 to S602, Figure 7 Method steps S701 to S704 in the above method Figure 8 The method steps S801 to S804.
[0160] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0161] Those skilled in the art will understand that all or some of the steps and systems in the methods disclosed above can be implemented as software, firmware, hardware, and suitable combinations thereof. Some or all of the physical components can be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software can be distributed on a computer-readable medium, which can include computer storage media (or non-transitory media) and communication media (or transient media). As is known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, storage device storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, as is known to those skilled in the art, communication media typically include computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium. It should also be understood that the various implementation methods provided in this application can be arbitrarily combined to achieve different technical effects.
[0162] The above provides a detailed description of the preferred embodiments of this application. However, this application is not limited to the above-described embodiments. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of this application. All such equivalent modifications or substitutions are included within the scope defined by the claims of this application.
Claims
1. A text enhancement method characterized by, The method comprises the following steps: obtaining an original text and inputting the original text into a preset text enhancement module; performing text enhancement processing on the original text based on the text enhancement module to obtain a target text; performing prediction processing on the target text based on a pre-trained test language model to obtain prediction result data; comparing the original text with the prediction result data to obtain a first evaluation index corresponding to the target text; extracting semantic features of the original text to obtain original semantic features, and extracting semantic features of the target text to obtain target semantic features; comparing the original semantic features with the target semantic features to obtain a second evaluation index corresponding to the target text; screening the target text based on the first evaluation index and the second evaluation index to obtain an enhanced text; wherein, the screening the target text based on the first evaluation index and the second evaluation index to obtain an enhanced text specifically comprises: performing statistical feature screening on the target text based on the first evaluation index to obtain a first target subtext; performing semantic feature screening on the target text based on the second evaluation index to obtain a second target subtext; performing overlapping text recognition on the first target subtext and the second target subtext to obtain common text of the first target subtext and the second target subtext; determining the common text as the enhanced text.
2. The method of claim 1, wherein, The screening the target text based on the first evaluation index and the second evaluation index to obtain an enhanced text comprises: fitting the first evaluation index and the second evaluation index to obtain a comprehensive evaluation index; screening the target text based on the comprehensive evaluation index to obtain the enhanced text.
3. The method according to any one of claims 1 to 2, characterized in that, The screening the target text based on the first evaluation index and the second evaluation index to obtain an enhanced text comprises: performing coherent sentence screening on the target text based on the first evaluation index and the second evaluation index to obtain a third target subtext; inputting the original text and the third target subtext into a preset semantic twin network; extracting original text features of the original text through the semantic twin network, and extracting target subtext features of the third target subtext through the semantic twin network; performing semantic accuracy screening on the third target subtext based on the original text features and the target subtext features to obtain the enhanced text.
4. The method of claim 1, wherein, The text enhancement module comprises a basic transformation unit, a back-translation processing unit and a synonym processing unit, and the text enhancement processing on the original text based on the text enhancement module to obtain a target text comprises: dividing the original text based on a preset condition to obtain a basic expansion text set, a back-translation processing text set and a synonym processing text set; performing basic data expansion on the basic expansion text set based on the basic transformation unit to obtain a first original subtext; performing text back-translation processing on the back-translation processing text set based on the back-translation processing unit to obtain a second original subtext; The synonym processing text set is processed by the synonym processing unit to obtain a third original subtext; The first original subtext, the second original subtext, and the third original subtext are integrated to obtain the target text.
5. The method according to any of claims 1 to 2, 4, characterized in that, The semantic feature extraction on the original text obtains original semantic features, and the semantic feature extraction on the target text obtains target semantic features, including: The original text is subjected to first word segmentation processing to obtain a plurality of first word groups; The target text is subjected to second word segmentation processing to obtain a plurality of second word groups; The semantic feature extraction on each first word group and each second word group based on a pre-trained semantic recognition model obtains the original semantic features of each first word group and the target semantic features of each second word group.
6. The method of claim 5, wherein, The similarity comparison between the original semantic features and the target semantic features obtains a second evaluation index corresponding to the target text, including: The similarity calculation between the original semantic features of each first word group and the target semantic features of each second word group obtains a similarity matrix; The original semantic features, the target semantic features, and the similarity matrix obtain a target accuracy and a target recall rate corresponding to the target text; The second evaluation index is obtained according to the target accuracy and the target recall rate.
7. The method of claim 6, wherein, The original semantic features, the target semantic features, and the similarity matrix obtain a target accuracy and a target recall rate corresponding to the target text, including: The similarity degree matching scores of each original semantic feature and each target semantic feature are extracted from the similarity matrix; The maximum similarity score of each target semantic feature is determined according to a plurality of similarity matching scores; The maximum similarity scores of each target semantic feature are accumulated to obtain a similarity accumulation value; The target accuracy and the target recall rate are obtained according to the original semantic features, the target semantic features, and the similarity accumulation value.
8. An electronic device, comprising: including: A memory and a processor, the memory stores a computer program, and the processor implements the text enhancement method of any one of claims 1-7 when executing the computer program.
9. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the text enhancement method of any one of claims 1-7.
Citation Information
Patent Citations
Device and method for short text similarity calculation
CN106484678A
Data enhancement method and device, storage medium and electronic equipment
CN114970516A
Text enhancement method, electronic equipment and storage medium
CN115270736A