Text enhancement method, language processing model training method and electronic device
The target enhanced text generated through the text enhancement method solves the problem of poor data set quality of natural language processing models in specific business fields, simplifies the data set collection and screening process, improves the robustness and training efficiency of the model, and is suitable for Used for model training in specific business areas.
Patent Information
- Application Number
- PCT/CN2023/116243
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-03-29
- Filing Date
- 2023-08-31
- Publication Date
- 2024-10-03
AI Technical Summary
It is difficult for existing natural language processing models to directly apply open source data sets in specific business fields, resulting in poor quality of model training data, and the generalized text semantics are quite different from the original text, requiring manual screening and consuming a lot of resources.
This paper proposes a text enhancement method that obtains original text and similar initial enhanced text, performs generalization processing and similarity filtering, and generates target enhanced text to meet the training data needs of specific business fields. The method includes obtaining original text, generating intermediate enhanced text, filtering based on similarity, and determining target enhanced text for training a language processing model.
It simplifies the collection and screening process of text data sets in specific business fields, reduces the amount of manual review, and improves the robustness and training efficiency of the model. The generated target enhanced text semantics are similar to the original text, making it suitable for use in models in specific business fields. train.
Smart Images

Figure CN2023116243_03102024_PF_FP_ABST
Abstract
Description
Text enhancement, language processing model training method and electronic device
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This disclosure claims priority to Chinese patent application number 202310351625.1, filed on March 29, 2023, entitled “Text enhancement, model training method, device, electronic device and storage medium,” the entire contents of which are incorporated by reference into this disclosure. Technical Field
[0003] The present disclosure relates to the field of natural language processing technology, and in particular to a text enhancement, language processing model training method and electronic device. Background Art
[0004] Natural language processing (NLP) models have been widely used in fields such as sentiment analysis, question-answering systems, automatic summarization, machine translation, speech recognition, chatbots, market forecasting, text classification, and spell checking. The quality of the training dataset has a certain impact on the accuracy, recall, and robustness of the NLP model.
[0005] In related technologies, due to the diversity of model application areas, it is difficult to directly apply open source datasets to specific business areas, such as those related to vehicles. Therefore, it is necessary to provide a text enhancement method to meet the training text data requirements of specific business areas.
[0006] Public content
[0007] The present disclosure aims to solve, at least to some extent, one of the technical problems in the related art. To this end, the present disclosure proposes a text enhancement and language processing model training method and an electronic device.
[0008] The present disclosure provides a text enhancement method, the method comprising:
[0009] Obtaining an original text and a plurality of initial enhanced texts similar to the original text;
[0010] Performing generalization processing on the initial enhanced text and the original text to obtain multiple intermediate enhanced texts;
[0011] filtering the plurality of intermediate enhanced texts according to a first similarity between the intermediate enhanced texts and the original texts to obtain a plurality of first filtered texts similar to the original texts;
[0012] A target enhanced text of the original text is determined based on the plurality of first filtered texts.
[0013] In one embodiment, the generalization process is performed on the initial enhanced text and the original text to obtain multiple intermediate enhanced texts, including:
[0014] filtering the plurality of initial enhanced texts according to a second similarity between the initial enhanced text and the original text to obtain a plurality of second filtered texts similar to the original text;
[0015] The second filtered text is generalized to obtain the plurality of intermediate enhanced texts similar to the second filtered text.
[0016] In one embodiment, filtering the plurality of initial enhanced texts according to the second similarity between the initial enhanced text and the original text to obtain a plurality of second filtered texts similar to the original text includes:
[0017] comparing the second similarity with a first similarity threshold;
[0018] The initial enhanced text corresponding to the second similarity greater than the first similarity threshold is retained as the second filtered text.
[0019] In one embodiment, the original text and the initial enhanced text are respectively in a first language; and the initial enhanced text is generated by:
[0020] Using a second language as a target language, the original text is converted into a first intermediate text in the second language; wherein the first language is different from the second language;
[0021] Language conversion is performed based on the first intermediate text to obtain the initial enhanced text.
[0022] In one embodiment, performing language conversion based on the first intermediate text to obtain the initial enhanced text includes:
[0023] performing language conversion on the first intermediate text using a third language as a target language to obtain a second intermediate text in the third language; wherein the second language is different from the third language;
[0024] The first language is used as the target language, and the second intermediate text is language-converted to obtain the initial enhanced text.
[0025] In one embodiment, the method for generating the initial enhanced text includes:
[0026] Performing word segmentation processing on the original text to obtain a plurality of key words included in the original text;
[0027] Swapping the order of the multiple key words to obtain a swapped text;
[0028] Obtaining prefix terms and / or suffix terms from a prediction dictionary;
[0029] The prefix words and / or the suffix words are used to recompose the replaced text to obtain the initial enhanced text.
[0030] In one embodiment, the multiple key words include nouns and verbs; and the step of swapping the multiple key words in order to obtain a swapped text includes:
[0031] The order of the noun words and the verb words is swapped to obtain the swapped text.
[0032] In one embodiment, filtering the plurality of intermediate enhanced texts according to the first similarity between the intermediate enhanced texts and the original text to obtain a plurality of first filtered texts similar to the original texts includes:
[0033] comparing the first similarity with a second similarity threshold;
[0034] The intermediate enhanced text corresponding to the first similarity greater than the second similarity threshold is retained as the first filtered text.
[0035] In one embodiment, determining the target enhanced text of the original text based on the plurality of first filtered texts includes:
[0036] Among the plurality of first filtered texts, retaining a plurality of target filtered texts that match the target sentence structure of the original text;
[0037] The target enhanced text is generated based on the multiple target filtered texts.
[0038] In one embodiment, generating the target enhanced text based on the multiple target filtered texts includes at least one of the following methods:
[0039] Randomly replacing the key words in the target filtered text with synonyms to obtain a target enhanced text corresponding to the target filtered text;
[0040] adding a prefix to the target filtered text using a prefix word obtained from a prediction dictionary to obtain a target enhanced text corresponding to the target filtered text;
[0041] The target filtered text is added with a suffix using a suffix word obtained from a prediction dictionary to obtain a target enhanced text corresponding to the target filtered text.
[0042] In one embodiment, randomly replacing the key words in the target filtered text with synonyms to obtain the target enhanced text corresponding to the target filtered text includes:
[0043] Determining key words in the target filtered text;
[0044] In response to the synonym configuration operation, obtaining synonyms of key words in the target filtered text;
[0045] The key words in the target filtered text are replaced with the synonyms to obtain a target enhanced text corresponding to the target filtered text.
[0046] The present disclosure provides a language processing model training method, the method comprising:
[0047] Obtaining an original text and a target enhanced text of the original text; wherein the target enhanced text is obtained by the text enhancement method described in any one of the above embodiments;
[0048] The language processing model is trained using the original text and the target enhanced text.
[0049] The present disclosure provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the method described in any one of the above embodiments are implemented.
[0050] The present disclosure provides a computer program product, which includes instructions. When the instructions are executed by a processor of a computer device, the computer device is enabled to perform the steps of the method described in any one of the above embodiments.
[0051] The present disclosure provides an electronic device, which includes: a memory, and one or more processors communicatively connected to the memory; the memory stores instructions that can be executed by the one or more processors, and the instructions are executed by the one or more processors to enable the one or more processors to implement the steps of the method described in any of the above embodiments.
[0052] The present disclosure provides a text enhancement device, the device comprising:
[0053] A text acquisition module, configured to acquire an original text and a plurality of initial enhanced texts similar to the original text;
[0054] a text generalization processing module, configured to perform generalization processing based on the initial enhanced text and the original text to obtain a plurality of intermediate enhanced texts;
[0055] a first text filtering module, configured to filter the plurality of intermediate enhanced texts according to a first similarity between the intermediate enhanced texts and the original texts, to obtain a plurality of first filtered texts similar to the original texts;
[0056] The enhanced text determination module is configured to determine a target enhanced text of the original text based on the plurality of first filtered texts.
[0057] The present disclosure provides a language processing model training device, the device comprising:
[0058] A text acquisition module, configured to acquire an original text and a target enhanced text of the original text; wherein the target enhanced text is obtained by the text enhancement method described in any one of the above embodiments;
[0059] A model training module is used to train the language processing model using the original text and the target enhanced text.
[0060] According to the text enhancement method provided by the present disclosure, first, the original text and multiple initial enhanced texts similar to the original text are obtained; then, generalization processing is performed based on the initial enhanced text and the original text to obtain multiple intermediate enhanced texts; then, the multiple intermediate enhanced texts are filtered according to the first similarity between the intermediate enhanced text and the original text to obtain multiple first filtered texts similar to the original text; finally, the target enhanced text of the original text is determined based on the multiple first filtered texts. The original text is enhanced by the above method to obtain a target enhanced text that is semantically similar or identical to the original text. If the original text corresponds to a specific business field, the original text and the target enhanced text can constitute training text data for the specific business field to meet the training text data requirements of the specific business field.
[0061] Additional aspects and advantages of the present disclosure will be given in part in the description that follows and, in part, will be obvious from the description that follows, or will be learned through practice of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] The above and / or additional aspects and advantages of the present disclosure will become apparent and readily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0063] FIG1a is a schematic diagram of an application scenario provided according to an embodiment of this specification;
[0064] FIG1b is a schematic diagram of a flow chart of a text enhancement method provided according to an embodiment of the present specification;
[0065] FIG1c is a schematic diagram of an interface for implementing a text enhancement method according to an embodiment of this specification;
[0066] FIG2 is a schematic diagram of a process for obtaining intermediate enhanced text according to an embodiment of the present specification;
[0067] FIG3 is a schematic diagram of a process for obtaining a second filtered text according to an embodiment of the present specification;
[0068] FIG4 is a schematic diagram of a process for obtaining initial enhanced text according to an embodiment of the present specification;
[0069] FIG5 is a schematic diagram of a process for obtaining initial enhanced text according to an embodiment of the present specification;
[0070] FIG6 is a schematic diagram of a process for obtaining initial enhanced text according to an embodiment of the present specification;
[0071] FIG7 is a schematic diagram of a process for obtaining a first filtered text according to an embodiment of the present specification;
[0072] FIG8 is a schematic diagram of a process for obtaining target enhanced text according to an embodiment of the present specification;
[0073] FIG9 is a schematic diagram of a process for obtaining target enhanced text according to an embodiment of the present specification;
[0074] FIG10 is a flow chart of a language processing model training method according to an embodiment of the present specification;
[0075] FIG11 is a flow chart of a text enhancement method according to an embodiment of the present disclosure;
[0076] FIG12 is a diagram showing the internal structure of an electronic device according to an embodiment of the present disclosure;
[0077] FIG13 is a schematic diagram of a text enhancement device provided according to an embodiment of this specification;
[0078] FIG14 is a schematic diagram of a language processing model training device provided according to an embodiment of this specification. DETAILED DESCRIPTION
[0079] The following describes in detail embodiments of the present disclosure, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended only to explain the present disclosure and are not to be construed as limiting the present disclosure.
[0080] With the continuous development of machine learning and deep learning in recent years, artificial intelligence has permeated nearly every industry. Natural language processing (NLP) models are one of the core areas of artificial intelligence and are widely used in sentiment analysis, question-answering systems, automatic summarization, machine translation, speech recognition, chatbots, market forecasting, text classification, spell checking, and other fields. In addition to the algorithm structure itself, the training dataset used to train the NLP model also plays a role in ensuring good accuracy, recall, and robustness.
[0081] There are many open source datasets on the market now, but due to the differences in model application fields, it is difficult to directly apply open source datasets to specific business fields. If data sets that meet the needs of specific business fields are collected and produced manually, it will consume a lot of manpower and may not achieve the desired results. For example, in the vehicle-related business field, because there are many skill points involved, when predicting the model, in order to accurately classify the data into specific skill points, it is necessary to ensure that each skill point has a high-quality dataset to prevent the model from overfitting or underfitting. Moreover, the data collected online may be very messy, and much of the collected data cannot be directly applied to the model training process. The seq2seq (Sequence to Sequence) model based on SimBERT directly generalizes the original text. The resulting generalized text will also be relatively messy and contain various sentence structures. The semantics of the generalized text may be quite different from the original text.
[0082] Especially for text in specific business domains, the generalized text typically requires a labor-intensive re-screening process. Furthermore, after removing punctuation from the generalized text, a large amount of duplicate text appears, requiring deduplication of the generalized text without punctuation. However, the number of qualified texts obtained after deduplication is relatively small. Therefore, a text enhancement method is needed to meet the training text data requirements of specific business domains.
[0083] Based on this, the embodiment of this specification provides a text enhancement method. Specifically, first, the original text and multiple initial enhanced texts similar to the original text are obtained; then, generalization processing is performed based on the initial enhanced text and the original text to obtain multiple intermediate enhanced texts; then, the multiple intermediate enhanced texts are filtered according to the first similarity between the intermediate enhanced text and the original text to obtain multiple first filtered texts similar to the original text; finally, the target enhanced text of the original text is determined based on the multiple first filtered texts. The original text is enhanced by the above method to obtain a target enhanced text that is semantically similar or identical to the original text. If the original text corresponds to a specific business field, the original text and the target enhanced text can constitute training text data for the specific business field to meet the training text data requirements of the specific business field.
[0084] Furthermore, by enhancing the original text, large quantities of high-quality text suitable for specific business domains can be generated from the concise original text at once. This text's semantics more closely matches the original text and exhibits diversity, eliminating the need for multiple manual reviews and screening. This reduces manual workload, achieves intelligent integration, and improves the efficiency of collecting and producing sample datasets for specific business domains. Furthermore, using the target enhanced text obtained by this method to train a model can enhance its robustness.
[0085] The text enhancement method provided in the embodiments of this specification can be applied to the application scenario of Figure 1a, which includes a terminal 110 and a server 120. The terminal 110 and the server 120 are in communication connection. The terminal 110 can be used to execute the text enhancement method. For example, the original text that needs to be enhanced is input on the interface of the terminal 110, and the terminal 110 uses the original text and multiple initial enhanced texts similar to the original text to obtain a target enhanced text of the original text. The server 120 is used to build an initial language processing model, and the server 120 uses the original text and the target enhanced text to train the initial language processing model until the model training stop condition is met, thereby obtaining the target language processing model.
[0086] Among them, the terminal 110 can be an electronic device with network access capabilities. Specifically, for example, the terminal 110 can be a desktop computer, a tablet computer, a laptop computer, a smart phone, a digital assistant, a smart wearable device, a shopping guide terminal, a television, a smart speaker, a microphone, etc. Among them, smart wearable devices include but are not limited to smart bracelets, smart watches, smart glasses, smart helmets, smart necklaces, etc. The server 120 can be an electronic device with certain computing and processing capabilities. It can have a network communication module, a processor, and a memory, etc. The server can be a distributed server, which can be a system with multiple processors, memories, network communication modules, etc. operating in collaboration. Alternatively, the server can also be a server cluster formed by several servers. Alternatively, with the development of science and technology, the server can also be a new technical means that can realize the corresponding functions of the implementation methods of the specification. For example, it can be a new form of "server" based on quantum computing.
[0087] This specification provides a text enhancement method, as shown in FIG1b . The method may include the following steps:
[0088] S110: Acquire an original text and a plurality of initial enhanced texts similar to the original text.
[0089] Among them, the original text is the text that needs to be enhanced. The original text can be a text for a certain skill point in a specific business field. For example: for the business field related to vehicles, the original text can be the skill point "open the window" for the business field related to vehicles. The initial enhanced text is the text obtained after generalizing the original text. The generalization method may include but is not limited to the expansion of keywords, the switching of keywords, the filling of prefixes and suffixes, etc. The original text and the initial enhanced text are texts with different expressions of the same semantics or similar semantics. For example: the original text can be "open the sunroof", and the initial enhanced text can be "open the sunroof for me", "please open the sunroof", etc.
[0090] In some cases, by performing text enhancement on the original text, an initial enhanced text that matches the original text is obtained to enrich the text sample. Specifically, a number of original texts are stored in a storage unit in advance, and the original text is obtained from the storage unit. In order to increase the number of sample texts used for model training, a preliminary enhancement operation can be performed on the original text to obtain multiple initial enhanced texts similar to the original text. In some other embodiments, the original text can be obtained in response to the user's text input operation, and the initial enhanced text corresponding to the original text can be obtained by performing cross-language translation and back translation operations on the original text. The initial enhanced text corresponding to the original text can be obtained by performing synonym replacement on the key words in the original text.
[0091] For example, referring to FIG1c , the original text to be enhanced can be input in the text input box 110 of the terminal device interface, and then generalization processing is performed based on the input original text. By clicking the generalization button 160 in FIG1c , multiple initial enhanced texts similar to the original text can be obtained.
[0092] S120 , performing generalization processing based on the initial enhanced text and the original text to obtain multiple intermediate enhanced texts.
[0093] Generalization involves expanding a specific sentence into a class of sentences with the same meaning. Grouping sentences with different expressions but the same meaning into a single dataset facilitates subsequent model training and improves model robustness. Intermediate augmented text is the text obtained by generalizing the initial augmented text and the original text.
[0094] In some cases, by generalizing the initial enhanced text and the original text, an intermediate enhanced text with greater diversity, higher quality, and closer semantics to the original text can be obtained.
[0095] Specifically, generalization processing is performed on the original text to obtain several intermediate enhanced texts corresponding to the original text. Generalization processing is performed based on the initial enhanced text to obtain several intermediate enhanced texts corresponding to the initial enhanced text. Based on the several intermediate enhanced texts corresponding to the original text and the several intermediate enhanced texts corresponding to the initial enhanced text, multiple intermediate enhanced texts can be obtained.
[0096] In this embodiment, the initial enhanced text and the original text can be directly generalized separately, and all intermediate enhanced texts corresponding to the original text and all intermediate enhanced texts corresponding to the initial enhanced text are retained to obtain multiple intermediate enhanced texts; subsequently, the multiple intermediate enhanced texts can be filtered to filter out some intermediate enhanced texts that are not semantically similar or do not match the sentence structure of the original text.
[0097] In this embodiment, the original text can be directly generalized. However, since the initial enhanced text is obtained through generalization, before the initial enhanced text is generalized again, the initial enhanced text can be filtered, and the filtered initial enhanced text can be generalized. All intermediate enhanced texts corresponding to the original text and all intermediate enhanced texts corresponding to the filtered initial enhanced text are retained to obtain multiple intermediate enhanced texts.
[0098] S130: Filter the plurality of intermediate enhanced texts according to a first similarity between the intermediate enhanced texts and the original texts to obtain a plurality of first filtered texts similar to the original texts.
[0099] The first similarity may be the semantic similarity between the intermediate enhanced text and the original text, and each intermediate enhanced text has a corresponding first similarity with the original text. The first filtered text may be the intermediate enhanced text that achieves the expected similarity.
[0100] In some cases, by performing similarity filtering on the intermediate enhanced text, text with high similarity to the original text can be retained, thereby improving the accuracy of the text.
[0101] Specifically, for each intermediate enhanced text, a first similarity between each intermediate enhanced text and the original text is calculated. Based on the first similarity, it is determined whether each intermediate enhanced text should be retained or filtered out, thereby filtering the plurality of intermediate enhanced texts. Each retained intermediate enhanced text is used as a first filtered text similar to the original text, thereby obtaining a plurality of first filtered texts similar to the original text.
[0102] In this embodiment, the intermediate enhanced text can be input into a semantic similarity model. Within the semantic similarity model, each intermediate enhanced text and the original text can form a sentence pair. A similarity comparison is then performed between the intermediate enhanced text and the original text in each sentence pair to obtain a first similarity between each intermediate enhanced text and the original text. Based on the first similarity, intermediate enhanced text with low similarity can be filtered out, and the remaining intermediate enhanced text becomes the first filtered text that is similar to the original text.
[0103] For example, multiple intermediate enhanced texts can be represented as A, B, C, D, and E, and the original text can be represented as F. Intermediate enhanced text A and original text F constitute sentence pair text A', intermediate enhanced text B and original text F constitute sentence pair text B', intermediate enhanced text C and original text F constitute sentence pair text C', intermediate enhanced text D and original text F constitute sentence pair text D', and intermediate enhanced text E and original text F constitute sentence pair text E'. Using the semantic similarity model, a first similarity A1 of sentence pair text A', a first similarity B1 of sentence pair text B', a first similarity C1 of sentence pair text C', a first similarity D1 of sentence pair text D', and a first similarity E1 of sentence pair text E' can be calculated. By filtering the intermediate enhanced texts A, B, C, D, and E based on the first similarities A1, B1, C1, D1, and E1, an intermediate enhanced text similar to the original text, namely the first filtered text, can be obtained.
[0104] In some embodiments, the semantic similarity model can be a model based on a Bert model (Bidirectional Encoder Representation from Transformers), a Dense layer (fully connected layer), and a softmax (normalized exponential function, Soft Version of Max) function. The intermediate enhanced text and the original text can be used as inputs to the semantic similarity model, and the similarity between the intermediate enhanced text and the original text can be calculated using the softmax function.
[0105] S140: Determine a target enhanced text of the original text based on the plurality of first filtered texts.
[0106] The target enhanced text may be a text that is ultimately obtained and is similar to the original text. Specifically, multiple first filtered texts may be determined as target enhanced texts; multiple first filtered texts may be further generalized to obtain the target enhanced text; or multiple first filtered texts may be further screened to obtain the target enhanced text.
[0107] In this embodiment, in order to further expand the number of samples for model training, a data augmentation operation may be performed on each first filtered text to obtain a target enhanced text.
[0108] In this embodiment, in order to improve the quality of samples used for model training, multiple first filtered texts may be screened based on sentence structure to obtain target enhanced texts.
[0109] In the above text enhancement method, first, the original text and multiple initial enhanced texts similar to the original text are obtained; then, generalization processing is performed based on the initial enhanced text and the original text to obtain multiple intermediate enhanced texts; then, the multiple intermediate enhanced texts are filtered according to the first similarity between the intermediate enhanced text and the original text to obtain multiple first filtered texts similar to the original text; finally, the target enhanced text of the original text is determined based on the multiple first filtered texts. The original text is enhanced by the above method to obtain a target enhanced text that is semantically similar or identical to the original text. If the original text corresponds to a specific business field, the original text and the target enhanced text can constitute training text data for the specific business field to meet the training text data requirements of the specific business field.
[0110] In some embodiments, referring to FIG. 2 , generalization processing is performed based on the initial enhanced text and the original text to obtain multiple intermediate enhanced texts, which may include the following steps:
[0111] S210: Filter the multiple initial enhanced texts according to the second similarity between the initial enhanced texts and the original texts to obtain multiple second filtered texts similar to the original texts.
[0112] The second similarity may be a semantic similarity between the initial enhanced text and the original text, and each initial enhanced text has a corresponding second similarity with the original text. The second filtered text may be the initial enhanced text that achieves the expected similarity.
[0113] Specifically, for each initial enhanced text, a second similarity between each initial enhanced text and the original text is calculated. Based on the second similarity, it is determined whether each initial enhanced text should be retained or filtered out, thereby filtering the multiple initial enhanced texts. Each retained initial enhanced text is used as a second filtered text similar to the original text, thereby obtaining multiple second filtered texts similar to the original text.
[0114] In this embodiment, the initial enhanced text can be input into a semantic similarity model. Within the semantic similarity model, each initial enhanced text and the original text can form a sentence pair. A similarity comparison is then performed between the initial enhanced text and the original text in each sentence pair to obtain a second similarity between each initial enhanced text and the original text. Based on the second similarity, initial enhanced texts with low similarity can be filtered out, and the remaining initial enhanced texts are considered second filtered texts that are similar to the original text.
[0115] In some embodiments, multiple initial enhanced texts can be represented as G, H, and I, and the original text can be represented as F. The initial enhanced text G and the original text F constitute a sentence pair text G', the initial enhanced text H and the original text F constitute a sentence pair text H', and the initial enhanced text I and the original text F constitute a sentence pair text I'. A semantic similarity model can be used to calculate a second similarity G1 for the sentence pair text G', a second similarity H1 for the sentence pair text H', and a second similarity I1 for the sentence pair text I'. The initial enhanced texts G, H, and I are filtered based on the second similarities G1, H1, and I1 to obtain an initial enhanced text similar to the original text, i.e., a second filtered text.
[0116] S220 : Perform generalization processing on the second filtered text to obtain a plurality of intermediate enhanced texts similar to the second filtered text.
[0117] Specifically, the second filtered text is generalized to obtain a plurality of intermediate enhanced texts corresponding to the second filtered text, thereby obtaining a plurality of intermediate enhanced texts similar to the second filtered text.
[0118] In this embodiment, the second filtered text can be input into a generative algorithm model, and the second filtered text can be generalized to generate a large amount of text, where the generated text is an intermediate enhanced text similar to the second filtered text. For example, the generative algorithm model can be a SimBERT-based model.
[0119] In the above-mentioned text enhancement method, multiple initial enhanced texts are filtered based on the second similarity between the initial enhanced text and the original text to obtain multiple second filtered texts similar to the original text. The second filtered texts are then generalized to obtain multiple intermediate enhanced texts similar to the second filtered texts. By filtering the initial enhanced texts based on similarity, texts with high similarity to the original text can be retained, improving the accuracy of the text, eliminating the need for multiple manual reviews and screening, reducing manual workload, and improving the efficiency of collecting and producing sample data sets. By generalizing the initial enhanced texts with the original text, intermediate enhanced texts with greater diversity, higher quality, and more semantically consistent with the original text can be obtained.
[0120] In some embodiments, referring to FIG. 3 , filtering the plurality of initial enhanced texts according to the second similarity between the initial enhanced texts and the original texts to obtain a plurality of second filtered texts similar to the original texts may include the following steps:
[0121] S310: Compare the second similarity with the first similarity threshold.
[0122] S320: Retain the initial enhanced text corresponding to the second similarity greater than the first similarity threshold as the second filtered text.
[0123] The first similarity threshold may be set based on actual conditions, and is used to screen initial enhanced texts that are similar to the original texts.
[0124] Specifically, the second similarity between the initial enhanced text and the original text can be compared with the first similarity threshold. When the second similarity is greater than the first similarity threshold, the initial enhanced text corresponding to the second similarity greater than the first similarity threshold is retained, and the initial enhanced text corresponding to the second similarity greater than the first similarity threshold is determined as the second filtered text. It is understood that when the second similarity is less than or equal to the first similarity threshold, the initial enhanced text corresponding to the second similarity less than or equal to the first similarity threshold can be filtered out.
[0125] For example, the first similarity threshold can be set to 0.9, and the second similarities G1, H1, and I1 obtained above can be 0.7, 0.92, and 0.84. The second similarity G1 is compared with the first similarity threshold 0.9. Since the second similarity 0.7 is less than the first similarity threshold 0.9, the initial enhanced text G corresponding to the second similarity G1 can be filtered out. The second similarity H1 is compared with the first similarity threshold 0.9. Since the second similarity 0.92 is greater than the first similarity threshold 0.9, the initial enhanced text H corresponding to the second similarity H1 greater than the first similarity threshold 0.9 is retained, and the initial enhanced text H corresponding to the second similarity H1 greater than the first similarity threshold 0.9 is determined as the second filtered text. The second similarity I1 is compared with the first similarity threshold 0.9. Since the second similarity 0.84 is less than the first similarity threshold 0.9, the initial enhanced text I corresponding to the second similarity I1 can be filtered out.
[0126] In the above text enhancement method, the second similarity is compared with the first similarity threshold; the initial enhanced text corresponding to the second similarity greater than the first similarity threshold is retained as the second filtered text. By filtering the initial enhanced text based on similarity, text with a high similarity to the original text is retained, improving the accuracy of the text. Furthermore, multiple manual reviews and screening are eliminated, reducing manual workload and improving the efficiency of sample dataset creation and collection.
[0127] In some embodiments, referring to FIG. 4 , the original text and the initial enhanced text are respectively in the first language; the method for generating the initial enhanced text may include the following steps:
[0128] S410: Using the second language as the target language, perform language conversion on the original text to obtain a first intermediate text in the second language.
[0129] S420: Perform language conversion based on the first intermediate text to obtain an initial enhanced text.
[0130] The first language is different from the second language. For example, the first language may be any one of Chinese, English, German, etc., and the second language may be any one of Japanese, Korean, etc. that is different from the first language. The first intermediate text may be a text obtained by language conversion of the original text with the second language as the target language. The initial enhanced text may be a text obtained by language conversion of the first intermediate text with the first language as the target language. The original text in the first language and the first intermediate text in the second language are used to express the same semantics, and the initial enhanced text in the first language and the first intermediate text in the second language are used to express the same semantics. Therefore, it can be concluded that the original text in the first language, the initial enhanced text in the first language, and the first intermediate text in the second language all express the same semantics.
[0131] In some cases, by performing language conversion on an original text in a first language into multiple languages and then converting the converted text into a text in the first language, the text in the first language obtained by the language conversion is different from the original text, thereby increasing the diversity of the text.
[0132] Specifically, the original text is in a first language. Using a second language different from the first language as the target language, the original text is subjected to language conversion to obtain a first intermediate text in the second language. Language conversion of the first intermediate text can produce an initial enhanced text in the first language. It should be noted that language conversion can be understood as translating the original text in the first language into the second language to obtain the first intermediate text in the second language. Language conversion can also be understood as back-translating the first intermediate text in the second language into the first language to obtain the initial enhanced text in the first language.
[0133] For example, the first language may be Chinese and the second language may be Japanese. A designated translation API may be called, passing in the original text in Chinese to be translated and specifying Japanese as the target language. This allows the original text in Chinese to be translated into a first intermediate text in Japanese. A further designated translation API may be called, passing in the first intermediate text in Japanese to be translated and specifying Chinese as the target language. This allows the first intermediate text in Japanese to be back-translated into the initial enhanced text in Chinese.
[0134] In this text enhancement method, a second language, different from the first language, is used as the target language. The original text is converted into a first intermediate text in the second language. This initial enhanced text is then converted back into the first intermediate text. This enriches the text, increases its diversity, and provides a rich data foundation for subsequent generalization processing.
[0135] In some implementations, referring to FIG. 5 , performing language conversion based on the first intermediate text to obtain the initial enhanced text may include the following steps:
[0136] S510: Using the third language as the target language, perform language conversion on the first intermediate text to obtain a second intermediate text in the third language.
[0137] S520: Using the first language as the target language, perform language conversion on the second intermediate text to obtain an initial enhanced text.
[0138] The second language is different from the third language, and the third language is also different from the first language. The second intermediate text may be a text obtained by language conversion of the first intermediate text with the third language as the target language. The initial enhanced text may be a text obtained by language conversion of the second intermediate text with the first language as the target language. The first intermediate text in the second language and the second intermediate text in the third language are used to express the same semantics, and the second intermediate text in the third language and the initial enhanced text in the first language are used to express the same semantics. Therefore, it can be concluded that the first intermediate text in the second language, the initial enhanced text in the first language, and the second intermediate text in the third language all express the same semantics.
[0139] In some cases, by performing language conversion on a first intermediate text in a second language into multiple languages and then converting the converted text into a text in the first language, the text in the first language obtained by the language conversion is different from the original text, thereby increasing the diversity of the text.
[0140] Specifically, the first intermediate text is in the second language. Using a third language, different from the second language, as the target language, the first intermediate text undergoes language conversion to produce a second intermediate text in the third language. Language conversion of the second intermediate text produces a text in the first language, i.e., the initial enhanced text. It should be noted that language conversion can be understood as translating the first intermediate text in the second language into the third language to produce the second intermediate text in the third language. Language conversion can also be understood as back-translating the second intermediate text in the third language into the first language to produce the initial enhanced text in the first language.
[0141] For example, the third language can be English. A designated translation API can be called, passing in a first intermediate text in Japanese to be translated and specifying English as the target language. This can translate the first intermediate text in Japanese into a second intermediate text in English. Then, a designated translation API can be called again, passing in a second intermediate text in English to be translated and specifying Chinese as the target language. This can back-translate the second intermediate text in English into the initial enhanced text in Chinese.
[0142] In the above text enhancement method, a first intermediate text is converted into a third language (different from the first and second languages) as the target language to produce a second intermediate text in the third language. Then, the second intermediate text is converted into the initial enhanced text using the first language as the target language. These two rounds of language conversion can avoid semantic distortion and enrich the text.
[0143] In some implementations, referring to FIG6 , the method for generating the initial enhanced text may include the following steps:
[0144] S610: Perform word segmentation processing on the original text to obtain multiple key words included in the original text.
[0145] S620: Replace the order of multiple key words to obtain a replaced text.
[0146] The word segmentation process may be performed by using word segmentation tools such as Jieba and SEO. The key words may be part of the words included in the original text.
[0147] Specifically, the original text is segmented and part-of-speech analyzed to obtain multiple key words included in the original text. The order of the obtained key words is then swapped to obtain a new combined text, which is the swapped text. Part-of-speech analysis can be implemented using Jieba, LTP, or LAC.
[0148] In some implementations, a professional terminology dictionary may be configured for a specific business field. By segmenting the original text using the configured professional terminology dictionary, multiple key words that are more suitable for the specific business field may be obtained.
[0149] For example, the word segmentation and part-of-speech tagging results for "open skylight" are: open / v, skylight / n, where n is the tag for noun and v is the tag for verb. The meanings of each part of speech are shown in Table 1.
[0150] Table 1: Part-of-speech tagging collection.
[0151] S630: Obtain prefix words and / or suffix words from the prediction dictionary.
[0152] S640: Recompose the replaced text with the prefix words and / or suffix words to obtain an initial enhanced text.
[0153] Among them, the prediction dictionary can be a dictionary collected and compiled manually based on the speaking habits of the public. The prediction dictionary can be a prefix dictionary, which contains prefix words commonly used in sentences. The prediction dictionary can be a suffix dictionary, which contains suffix words commonly used in sentences. The prediction dictionary can contain prefix words and suffix words commonly used in sentences.
[0154] Specifically, a prefix word is obtained from a prediction dictionary. The prefix word obtained from the prediction dictionary is used to add a prefix to the swapped text and rearrange the sentence to obtain the initial enhanced text. Alternatively, a suffix word is obtained from the prediction dictionary. The suffix word obtained from the prediction dictionary is used to add a suffix to the swapped text and rearrange the sentence to obtain the initial enhanced text. Alternatively, a prefix word and a suffix word are obtained from a prediction dictionary. The prefix word obtained from the prediction dictionary is used to add a prefix to the swapped text and rearrange the sentence to obtain the initial enhanced text.
[0155] Exemplarily, "open the skylight" is the swapped text. The prefix words "put", "put it to me", and "please put it" can be obtained from the prediction dictionary. The prefix words obtained from the prediction dictionary are added to the swapped text to rearrange the sentences, and the initial enhanced text "open the skylight", "open the skylight for me", and "please open the skylight" can be obtained. Or the suffix words "is it okay" can be obtained from the prediction dictionary. The suffix words obtained from the prediction dictionary are added to the swapped text to rearrange the sentences, and the initial enhanced text "is it okay to open the skylight" can be obtained. Or the prefix word "put" can be obtained from the prediction dictionary, and the suffix words "is it okay" can be obtained from the prediction dictionary. The prefix words obtained from the prediction dictionary are added to the swapped text to rearrange the sentences, and the suffix words obtained from the prediction dictionary are added to the swapped text to rearrange the sentences, and the initial enhanced text "is it okay to open the skylight" can be obtained.
[0156] In some embodiments, prefix words and suffix words may belong to the same prediction dictionary. In the prediction dictionary, each word included in the prediction dictionary may be annotated with prefix words and suffix words to facilitate subsequent search for prefix words and suffix words. The searched prefix words and / or suffix words are then combined with the swapped text to form an initial enhanced text.
[0157] In other embodiments, prefix words may be included in a prefix word prediction dictionary, and suffix words may be included in a suffix word prediction dictionary. Prefix words may be directly obtained from the prefix word prediction dictionary, and suffix words may be directly obtained from the suffix word prediction dictionary. The obtained prefix words and / or suffix words are then reassembled with the swapped text to obtain the initial enhanced text.
[0158] In the above text enhancement method, the original text is segmented to obtain multiple key words included in the original text; the order of the multiple key words is permuted to obtain the permuted text; prefix words and / or suffix words are obtained from the prediction dictionary; and the prefix words and / or suffix words are used to recompose the permuted text to obtain the initial enhanced text. This can enrich the diversity of the text.
[0159] In some embodiments, the multiple key words include noun words and verb words; swapping the order of the multiple key words to obtain a swapped text may include: swapping the order of the noun words and verb words to obtain a swapped text.
[0160] Specifically, based on word segmentation and part-of-speech analysis, part-of-speech information of key words can be obtained. The order of key words with noun parts of speech contained in the original text and key words with verb parts of speech contained in the original text are swapped to obtain a swapped text.
[0161] For example, by swapping the order of the noun part-of-speech keyword "skylight" and the verb part-of-speech keyword "open" included in the original text "open the skylight", a new combined text "skylight opens" can be obtained, and "skylight opens" is the swapped text.
[0162] In the above text enhancement method, the order of noun words and verb words is swapped to obtain the swapped text, which can enrich the diversity of the text.
[0163] In some embodiments, referring to FIG. 7 , filtering the plurality of intermediate enhanced texts based on the first similarity between the intermediate enhanced texts and the original text to obtain a plurality of first filtered texts similar to the original text may include the following steps:
[0164] S710: Compare the first similarity with a second similarity threshold.
[0165] S720: Retain the intermediate enhanced text corresponding to the first similarity greater than the second similarity threshold as the first filtered text.
[0166] Among them, the second similarity threshold can be set based on actual conditions, and the second similarity threshold is used to filter intermediate enhanced texts that are similar to the original text. Specifically, the first similarity between the intermediate enhanced text and the original text can be compared with the second similarity threshold. When the first similarity is greater than the second similarity threshold, the intermediate enhanced text corresponding to the first similarity greater than the second similarity threshold is retained, and the intermediate enhanced text corresponding to the first similarity greater than the second similarity threshold is determined as the first filtered text. It is understandable that when the first similarity is less than or equal to the second similarity threshold, the intermediate enhanced text corresponding to the first similarity less than or equal to the second similarity threshold can be filtered out.
[0167] For example, the second similarity threshold can be set to 0.9, and the first similarities A1, B1, C1, D1, and E1 obtained above can be 0.88, 0.9, 0.96, 0.72, and 0.95. The first similarity A1 is compared with the second similarity threshold of 0.9. Since the first similarity 0.88 is less than the second similarity threshold of 0.9, the intermediate enhanced text A corresponding to the first similarity A1 can be filtered out. The first similarity B1 is compared with the second similarity threshold of 0.9. Since the first similarity 0.9 is equal to the second similarity threshold of 0.9, the intermediate enhanced text B corresponding to the first similarity B1 can be filtered out. The first similarity C1 is compared with the second similarity threshold of 0.9. Since the first similarity 0.96 is greater than the second similarity threshold of 0.9, the intermediate enhanced text C corresponding to the first similarity C1 greater than the second similarity threshold of 0.9 is retained, and the intermediate enhanced text C corresponding to the first similarity C1 greater than the second similarity threshold of 0.9 is determined as the first filtered text. The first similarity D1 is compared with the second similarity threshold of 0.9. Since the first similarity 0.72 is less than the second similarity threshold of 0.9, the intermediate enhanced text D corresponding to the first similarity D1 can be filtered out. The first similarity E1 is compared with the second similarity threshold of 0.9. Since the first similarity 0.95 is greater than the second similarity threshold of 0.9, the intermediate enhanced text E corresponding to the first similarity E1 greater than the second similarity threshold of 0.9 is retained and determined as the first filtered text.
[0168] In the above text enhancement method, the first similarity is compared with the second similarity threshold; the intermediate enhanced text corresponding to the first similarity greater than the second similarity threshold is retained as the first filtered text. By performing similarity filtering on the intermediate enhanced text, text with a high similarity to the original text can be retained, thereby improving the accuracy of the text.
[0169] In some implementations, referring to FIG8 , determining the target enhanced text of the original text based on the plurality of first filtered texts may include the following steps:
[0170] S810: Among the multiple first filtered texts, retain multiple target filtered texts that match the target sentence structure of the original text.
[0171] S820: Generate target enhanced text based on multiple target filtered texts.
[0172] The target sentence structure is the sentence structure of the original text. For example, the sentence structure of "open the skylight" is an imperative sentence, and the sentence structure of "how to open the skylight" is an interrogative sentence.
[0173] In some cases, multiple first filtered texts may include a first filtered text that is semantically similar to the original text but does not match the sentence structure of the original text. Therefore, it is necessary to match the sentence structure of the first filtered text with the target sentence structure of the original text to obtain the first filtered text that meets the sentence requirements. Specifically, the target sentence structure of the original text is obtained. The target sentence structure of the original text is represented by a regular expression, and then the first filtered text is matched with the regular expression representing the target sentence structure of the original text. When the first filtered text matches the regular expression of the target sentence structure of the original text, the first filtered text that matches the target sentence structure of the original text is retained, and the first filtered text that matches the target sentence structure of the original text is determined as the target filtered text. Then, a target enhanced text can be generated based on the target filtered text. It can be understood that when the first filtered text does not match the regular expression of the target sentence structure of the original text, the first filtered text that does not match the target sentence structure of the original text can be filtered out.
[0174] For example, the original text is "Open the skylight.", and the first filtered text can be "How to open the skylight?" or "Please open the skylight." The target sentence structure of the original text "Open the skylight." is obtained as an imperative sentence, and the target sentence structure of the original text "Open the skylight." is represented by the regular expression ".*[\\。]$". Then, the first filtered text "Please open the skylight." is matched with the regular expression ".*[\\。]$" representing the target sentence structure of the original text "Open the skylight." When the first filtered text "Please open the skylight." matches the regular expression ".*[\\。]$" of the target sentence structure of the original text "Open the skylight.", the first filtered text "Please open the skylight." that matches the target sentence structure of the original text "Open the skylight." is retained and determined as the target filtered text. If the first filtered text "How do I open the skylight?" doesn't match the regular expression ".*[\\。]$" for the target sentence structure of the original text "Open the skylight.", the first filtered text "How do I open the skylight?" can be filtered out. "How do I open the skylight?" and "Open the skylight." have similar semantics, but "How do I open the skylight?" expresses a query, not the action-oriented intent of "Open the skylight." Therefore, it doesn't meet the sentence structure requirements. Therefore, "How do I open the skylight?" is discarded. Then, based on the target filtered text "Please open the skylight.", the target enhanced text can be generated.
[0175] In the above text enhancement method, among the multiple first filtered texts, multiple target filtered texts that match the target sentence structure of the original text are retained; and the target enhanced text is generated based on the multiple target filtered texts. By filtering out the first filtered texts that do not match the target sentence structure of the original text, the accuracy of the text can be improved.
[0176] In some implementations, generating a target enhanced text based on a plurality of target filtered texts includes at least one of the following methods:
[0177] Randomly replace the key words in the target filtered text with synonyms to obtain the target enhanced text corresponding to the target filtered text;
[0178] Using the prefix words obtained from the prediction dictionary to add prefixes to the target filtered text, the target enhanced text corresponding to the target filtered text is obtained;
[0179] The suffix words obtained from the prediction dictionary are used to add suffixes to the target filtered text to obtain the target enhanced text corresponding to the target filtered text.
[0180] Specifically, the target filtered text is subjected to word segmentation and part-of-speech analysis to obtain a plurality of key words included in the target filtered text. The plurality of key words included in the target filtered text are matched with a pre-set synonym dictionary of key words. If the key words included in the target filtered text can be matched in the pre-set synonym dictionary of key words, the matched key words are randomly replaced with synonyms to obtain the target enhanced text corresponding to the target filtered text. Alternatively, prefix words can be obtained from a prediction dictionary, and then the obtained prefix words are used to add prefixes to the target filtered text to obtain the target enhanced text corresponding to the target filtered text. Alternatively, suffix words can be obtained from a prediction dictionary, and then the obtained suffix words are used to add suffixes to the target filtered text to obtain the target enhanced text corresponding to the target filtered text.
[0181] Exemplarily, the target filtered text is "Please open the skylight". The result of the word segmentation processing for "Please open the skylight" is: trouble, put, skylight, open. Among them, the pre-set synonym dictionary of key words may include the key word "open" and the synonyms of the key word "open" "open", "open for a while", and "enable". The multiple key words included in the target filtered text are matched with the pre-set synonym dictionary of key words, and the key word "open" in the target filtered text is matched with the key word "open" in the pre-set synonym dictionary of key words. The matched key word "open" is randomly replaced with synonyms to obtain the target enhanced text corresponding to the target filtered text "Please open the skylight". The target enhanced text corresponding to "Please open the skylight", "Please open the skylight for a while", and "Please enable the skylight" can be obtained. In some embodiments, synonyms of key words can be summarized in advance based on manual experience, and the obtained synonyms of key words can be stored in a server, and the synonyms of key words can be read from the server later.
[0182] In the above text enhancement method, keywords in the target filtered text are randomly replaced with synonyms to obtain the target enhanced text corresponding to the target filtered text; prefixes obtained from the prediction dictionary are added to the target filtered text to obtain the target enhanced text corresponding to the target filtered text; or suffixes obtained from the prediction dictionary are added to the target filtered text to obtain the target enhanced text corresponding to the target filtered text. This ensures that the diversity of the text is enriched while maintaining the semantics.
[0183] In some embodiments, referring to FIG. 9 , performing random synonym replacement on key words in the target filtered text to obtain a target enhanced text corresponding to the target filtered text may include the following steps:
[0184] S910: Determine key words in the target filtered text.
[0185] S920: In response to the synonym configuration operation, obtain synonyms of the key words in the target filtered text.
[0186] The synonym configuration operation can be performed manually based on individual needs. The synonym configuration operation can be performed on a specified page.
[0187] In some cases, referring to FIG. 1c , by clicking button 120 in FIG. 1c , a text input box configured for the key words included in the original text can be added. Key words included in the original text can be entered into text input box 130 in FIG. Synonyms of the key words that the user has thought of can be entered into text input box 140 in FIG. Text input box 130 in FIG. 1c can be used to enter not only the key words included in the original text but also the original text itself. The synonym query button 150 in FIG. 1c can retrieve synonyms of the key words from a pre-set synonym dictionary for the key words. The retrieved synonyms of the key words can provide a reference for the user, allowing the user to think of more synonyms for the key words.
[0188] Particularly, after target is filtered, text is carried out word segmentation process, can obtain the multiple key words that target filter rear text comprises.In response to synonym configuration operation, the key words that target filter rear text comprises are matched with the key words in the synonym configuration operation, if the key words that target filter rear text comprises are matched to the key words in the synonym configuration operation, can obtain the synonym of the key words in target filter rear text. Exemplarily, original text is "opening skylight", and after target is filtered, text can comprise "trouble opening skylight". The result that original text "opening skylight" is carried out word segmentation process and obtains is: open, skylight. Original text is carried out synonym configuration operation, the synonym of the key words "skylight" that can configure original text "opening skylight" to comprise is "roof window". The result that target filter rear text "trouble opening skylight" is carried out analysis and process and obtains is: trouble, open, skylight. By matching the keywords included in the target filtered text with the keywords configured with synonyms, it can be found that the keyword "sunroof" included in the target filtered text matches the keyword "sunroof" configured with synonyms, and the synonym "roof window" of the keyword "sunroof" in the target filtered text can be obtained.
[0189] S930: Replace key words in the target filtered text with synonyms to obtain a target enhanced text corresponding to the target filtered text.
[0190] Specifically, the target enhanced text corresponding to the target filtered text is obtained by replacing the keyword with a synonym of the keyword in the target filtered text. For example, the target enhanced text corresponding to the target filtered text is obtained by replacing the keyword "sunroof" with a synonym of "roof window" in the target filtered text.
[0191] In the above text enhancement method, key words in the target filtered text are determined; in response to a synonym configuration operation, synonyms for the key words in the target filtered text are obtained; and the key words in the target filtered text are replaced with the synonyms to obtain the target enhanced text corresponding to the target filtered text. This ensures that the text is enriched in diversity while maintaining semantic meaning.
[0192] This specification provides a method for training a language processing model. Referring to FIG10 , the method may include the following steps:
[0193] S1010: Obtain the original text and the target enhanced text of the original text.
[0194] S1020. Train a language processing model using the original text and the target enhanced text.
[0195] The target enhanced text is obtained by the text enhancement method of any of the above embodiments. The language processing model can be a model for a specific business field.
[0196] Specifically, the original text is obtained, and the target enhanced text corresponding to the original text can be obtained by using the text enhancement method of any of the above embodiments. The original text and the target enhanced text are used as sample sets for training the language processing model, and the language processing model is trained using the original text and the target enhanced text.
[0197] In the above-mentioned language processing model training method, the original text and the target enhanced text of the original text are obtained, and then the language processing model is trained using the original text and the target enhanced text, which can improve the robustness of the language processing model.
[0198] The embodiments of this specification also provide a text enhancement method. For example, referring to FIG11 , the text enhancement method may include the following steps:
[0199] S1102: Obtain original text.
[0200] Among them, the original text is in the first language.
[0201] S1104: Using the second language as the target language, perform language conversion on the original text to obtain a first intermediate text in the second language.
[0202] Among them, the first language is different from the second language.
[0203] S1106: Using the third language as the target language, perform language conversion on the first intermediate text to obtain a second intermediate text in the third language.
[0204] Among them, the second language is different from the third language.
[0205] S1108 : Using the first language as the target language, perform language conversion on the second intermediate text to obtain an initial enhanced text of the first part.
[0206] The first initial enhanced text is in the first language.
[0207] S1110 , performing word segmentation processing on the original text to obtain multiple key words included in the original text.
[0208] Among them, multiple key words include noun words and verb words.
[0209] S1112. Swap the order of the noun words and the verb words to obtain a swapped text.
[0210] S1114 . Obtain prefix words and / or suffix words from the prediction dictionary.
[0211] S1116. Recompose the sentences with the swapped text using the prefix words and / or suffix words to obtain the initial enhanced text of the second part.
[0212] The first part of the initial enhanced text and the second part of the initial enhanced text form an initial enhanced text. The initial enhanced text has a second similarity with the original text.
[0213] S1118: Compare the second similarity with the first similarity threshold.
[0214] S1120: Retain the initial enhanced text corresponding to the second similarity greater than the first similarity threshold as the second filtered text.
[0215] S1122: Perform generalization processing on the second filtered text to obtain multiple intermediate enhanced texts similar to the second filtered text.
[0216] There is a first similarity between the intermediate enhanced text and the original text.
[0217] S1124: Compare the first similarity with a second similarity threshold.
[0218] S1126: Retain the intermediate enhanced text corresponding to the first similarity greater than the second similarity threshold as the first filtered text.
[0219] S1128. Among the multiple first filtered texts, retain multiple target filtered texts that match the target sentence structure of the original text.
[0220] S1130: Generate target enhanced text based on multiple target filtered texts.
[0221] Specifically, key words in the target filtered text are determined. In response to a synonym configuration operation, synonyms for the key words in the target filtered text are obtained. The key words in the target filtered text are replaced with the synonyms to obtain a target enhanced text corresponding to the target filtered text. Alternatively, a prefix word obtained from a prediction dictionary is added to the target filtered text to obtain a target enhanced text corresponding to the target filtered text; or a suffix word obtained from a prediction dictionary is added to the target filtered text to obtain a target enhanced text corresponding to the target filtered text.
[0222] An embodiment of this specification provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the method in any of the above embodiments are implemented.
[0223] One embodiment of the present specification provides a computer program product, which includes instructions. When the instructions are executed by a processor of a computer device, the computer device is enabled to perform the steps of the method of any of the above embodiments.
[0224] In some embodiments, an electronic device is provided, which may be a terminal, and its internal structure diagram may be as shown in Figure 12. The electronic device includes a processor, a memory, a communication interface, a display screen, and an input device connected via a system bus. The processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The communication interface of the electronic device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner may be implemented through WIFI, an operator network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a text enhancement method is implemented. The display screen of the electronic device may be a liquid crystal display screen or an electronic ink display screen, and the input device of the electronic device may be a touch layer covering the display screen, or a button, trackball or touchpad provided on the electronic device housing, or an external keyboard, touchpad or mouse.
[0225] Those skilled in the art will understand that the structure shown in Figure 12 is merely a block diagram of a portion of the structure related to the solution disclosed in this specification, and does not constitute a limitation on the electronic device to which the solution disclosed in this specification is applied. Specifically, the electronic device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0226] In some embodiments, an electronic device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the method steps in the above embodiments when executing the computer program.
[0227] The embodiment of this specification provides a text enhancement device 1300 . Please refer to FIG. 13 . The text enhancement device 1300 includes: a text acquisition module 1310 , a text generalization processing module 1320 , a first text filtering module 1330 , and an enhanced text determination module 1340 .
[0228] A text acquisition module 1310 is configured to acquire an original text and a plurality of initial enhanced texts similar to the original text;
[0229] A text generalization processing module 1320 is configured to perform generalization processing based on the initial enhanced text and the original text to obtain multiple intermediate enhanced texts;
[0230] A first text filtering module 1330 is configured to filter the plurality of intermediate enhanced texts according to a first similarity between the intermediate enhanced texts and the original texts to obtain a plurality of first filtered texts similar to the original texts;
[0231] The enhanced text determining module 1340 is configured to determine a target enhanced text of the original text based on the plurality of first filtered texts.
[0232] The embodiment of this specification provides a language processing model training device 1400 , please refer to FIG14 . The language processing model training device 1400 includes: a text acquisition module 1410 and a model training module 1420 .
[0233] A text acquisition module 1410 is configured to acquire an original text and a target enhanced text of the original text; wherein the target enhanced text is obtained by using the text enhancement method of any of the above embodiments;
[0234] The model training module 1420 is used to train a language processing model using the original text and the target enhanced text.
[0235] For the specific description of the text enhancement device and the language processing model training device, please refer to the description of the text enhancement method and the language processing model training method above, which will not be repeated here.
[0236] It should be noted that the logic and / or steps represented in the flowcharts or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing the logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (e.g., a computer-based system, a system including a processor, or other system that can fetch and execute instructions from an instruction execution system, apparatus, or device). For purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transport a program for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (non-exhaustive list) of computer-readable media include the following: an electrical connection with one or more wires (electronic device), a portable computer disk cartridge (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and programmable read-only memory (EPROM or flash memory), fiber optic devices, and portable compact disc read-only memory (CDROM). Furthermore, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or otherwise processing it in a suitable manner if necessary, and then storing it in a computer memory.
Claims
1. A text enhancement method, the method comprising: Obtaining an original text and a plurality of initial enhanced texts similar to the original text; Performing generalization processing based on the initial enhanced text and the original text to obtain multiple intermediate enhanced texts; Filtering the plurality of intermediate enhanced texts according to a first similarity between the intermediate enhanced text and the original text to obtain a plurality of first filtered texts similar to the original text; A target enhanced text of the original text is determined based on the plurality of first filtered texts.
2. The method according to claim 1, wherein: The generalization process is performed based on the initial enhanced text and the original text to obtain a plurality of intermediate enhanced texts, including: Filtering the plurality of initial enhanced texts according to a second similarity between the initial enhanced text and the original text to obtain a plurality of second filtered texts similar to the original text; The second filtered text is generalized to obtain the plurality of intermediate enhanced texts similar to the second filtered text.
3. The method according to claim 2, wherein: The filtering the plurality of initial enhanced texts according to the second similarity between the initial enhanced text and the original text to obtain a plurality of second filtered texts similar to the original text comprises: comparing the second similarity with a first similarity threshold; The initial enhanced text corresponding to the second similarity greater than the first similarity threshold is retained as the second filtered text.
4. The method according to any one of claims 1 to 3, wherein: The original text and the initial enhanced text are respectively in a first language; The method for generating the initial enhanced text includes: Taking a second language as a target language, performing language conversion on the original text to obtain a first intermediate text in the second language; wherein the first language is different from the second language; The initial enhanced text is obtained by performing language conversion based on the first intermediate text.
5. The method according to claim 4, wherein: The performing language conversion based on the first intermediate text to obtain the initial enhanced text includes: Taking a third language as a target language, performing language conversion on the first intermediate text to obtain a second intermediate text in the third language; wherein the second language is different from the third language; The first language is used as the target language, and the second intermediate text is converted into the initial enhanced text.
6. The method according to any one of claims 1 to 3, wherein: The method for generating the initial enhanced text includes: Performing word segmentation processing on the original text to obtain a plurality of key words included in the original text; The plurality of key words are sequentially swapped to obtain a swapped text; Obtaining prefix terms and / or suffix terms from a prediction dictionary; The prefix words and / or the suffix words are used to re-compose the replaced text to obtain the initial enhanced text.
7. The method according to claim 6, wherein: The multiple key words include noun words and verb words; the multiple key words are sequentially swapped to obtain a swapped text, including: The order of the noun words and the verb words is swapped to obtain the swapped text.
8. The method according to any one of claims 1 to 3, wherein: The filtering the plurality of intermediate enhanced texts according to the first similarity between the intermediate enhanced text and the original text to obtain a plurality of first filtered texts similar to the original text includes: comparing the first similarity with a second similarity threshold; The intermediate enhanced text corresponding to the first similarity greater than the second similarity threshold is retained as the first filtered text.
9. The method according to any one of claims 1 to 8, wherein: The step of determining a target enhanced text of the original text based on the plurality of first filtered texts comprises: Among the plurality of first filtered texts, retaining a plurality of target filtered texts matching the target sentence structure of the original text; The target enhanced text is generated based on the multiple target filtered texts.
10. The method according to claim 9, wherein: The generating the target enhanced text based on the multiple target filtered texts includes at least one of the following methods: Randomly replace the key words in the target filtered text with synonyms to obtain the target enhanced text corresponding to the target filtered text; Adding a prefix to the target filtered text using a prefix word obtained from a prediction dictionary to obtain a target enhanced text corresponding to the target filtered text; The suffix words obtained from the prediction dictionary are used to add suffixes to the target filtered text to obtain the target enhanced text corresponding to the target filtered text.
11. The method according to claim 10, wherein: The step of randomly replacing the key words in the target filtered text with synonyms to obtain the target enhanced text corresponding to the target filtered text includes: Determining key words in the target filtered text; In response to the synonym configuration operation, obtaining synonyms of key words in the target filtered text; The key words in the target filtered text are replaced with the synonyms to obtain the target enhanced text corresponding to the target filtered text.
12. A language processing model training method, the method comprising: Acquire an original text and a target enhanced text of the original text; wherein the target enhanced text is obtained by the text enhancement method described in any one of claims 1 to 11; The language processing model is trained using the original text and the target enhanced text.
13. An electronic device comprising: processor; A memory for storing executable instructions of the processor; wherein the processor is configured to perform the method of any one of claims 1 to 12 by executing the executable instructions.
Citation Information
Patent Citations
Text data enhancement method and device and electronic equipment
CN110222707A
Text data enhancement method
CN113297842A
Text data enhancement method and device, electronic equipment and storage medium
CN114298024A
Text processing method and device, storage medium and electronic equipment
CN114443815A
Data enhancement method and device, storage medium and electronic equipment
CN114970516A
Cited By
Data processing method and equipment for enhancing semantic robustness of AI model
CN121144341A
