A method and system for text enhancement based on word interpretation

By obtaining and preprocessing the target word interpretation sentences in the text and converting them into label vectors, the poor training effect of model caused by insufficient corpus related to new words in natural language processing is solved, and the accuracy of the model is improved.

CN113591469BActive Publication Date: 2024-12-31火石创造科技有限公司
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202110662528.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-15
Publication Date
2024-12-31
Estimated Expiration
2041-06-15

AI Technical Summary

Technical Problem

In natural language processing tasks, when there are insufficient related corpus such as new words in the text, the model training effect is poor and the accuracy is low, and the existing technology has failed to effectively solve this problem.

Method used

By obtaining the interpretive sentences of the target word in the text to be tested, preprocessing them, converting them into label vectors with the same dimension as the word vector, and adding the interpretive sentences to the text to train the natural language classification model.

Benefits of technology

The accuracy of the model is improved and the problem of poor model training results due to insufficient corpus related to new words is solved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113591469B_ABST
    Figure CN113591469B_ABST
Patent Text Reader

Abstract

The present application relates to a method and system for text enhancement based on word interpretation, wherein the method comprises: obtaining a text to be tested, and obtaining an interpretation sentence of a target word in the text to be tested; then preprocessing the text to be tested, setting the interpretation sentence of the target word as a label for a text classification task with the target word as a label, and adding the interpretation sentence of the target word to the text for a text classification task without the target word as a label; finally, training a natural language classification model through the preprocessed text, thereby solving the problem of poor model training effect and low accuracy when the text contains new words or other words with insufficient relevant corpus when classifying the text, and improving the accuracy of the model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computers, and in particular to a method and system for text enhancement based on word interpretation. Background Art

[0002] In the application scenarios of artificial intelligence, natural language processing tasks based on machine learning require a large amount of corpus to train the model. Therefore, the effectiveness of the natural language processing model depends to a large extent on the content of the corpus. When the corpus is insufficient, the accuracy and recall of the model will be unsatisfactory; or when the corpus data is unbalanced, such as when the amount of data of a few labels in text classification is much larger than that of other labels, the model will pay too much attention to the label data with a large amount of data, resulting in low accuracy and recall of labels with insufficient samples. Therefore, it is necessary to enhance the text, that is, to generate more corpus from the existing corpus and expand the corpus. The common existing text data enhancement methods include back translation, non-core word replacement, and text enhancement based on generative language models.

[0003] However, in the related technologies, it is required that the text should not contain new words or other words with insufficient relevant corpus, and a relatively accurate model can only be obtained through training with a large amount of corpus. In the case of insufficient relevant corpus for words, it is difficult for the model to achieve good results.

[0004] At present, in the related technology, when classifying text, there is a problem of poor model training effect and low accuracy due to the presence of new words and other words with insufficient relevant corpus in the text, and no effective solution has been proposed yet. Summary of the invention

[0005] The embodiments of the present application provide a method and system for text enhancement based on word interpretation, so as to at least solve the problem in the related art that when classifying text, the model training effect is poor and the accuracy is low when there are new words or other words with insufficient relevant corpus in the text.

[0006] In a first aspect, an embodiment of the present application provides a method for text enhancement based on word interpretation, the method comprising:

[0007] Obtaining a text to be tested, and obtaining an explanation sentence of a target word in the text to be tested;

[0008] Preprocessing the text to be tested, setting the explanation sentence of the target word as a label for a text classification task with the target word as a label, and adding the explanation sentence of the target word to the text for a text classification task without the target word as a label;

[0009] The natural language classification model is trained using the preprocessed text.

[0010] In some embodiments, for the text classification task with the target word as a label, setting the explanation sentence of the target word as a label includes:

[0011] The explanation sentence of the target word is set as a label through average pooling, and the explanation sentence of the target word is converted into a label vector with the same dimension as the word vector.

[0012] In some embodiments, converting the explanation sentence of the target word into a label vector of the same dimension as the word vector includes:

[0013] Perform word segmentation on the explanation sentence of the target word, and obtain the BERT pre-trained word vector corresponding to each word segmentation;

[0014] The average value of the word vector in the same dimension is calculated to obtain a label vector with the same dimension as the word vector.

[0015] In some embodiments, obtaining an explanation sentence of a target word in the test text includes:

[0016] Obtain explanation sentences for the target word from domain experts and language experts, or search a professional knowledge base to obtain explanation sentences for the target word.

[0017] In a second aspect, an embodiment of the present application provides a system for text enhancement based on word interpretation, the system comprising:

[0018] An acquisition module, used to acquire a text to be tested and to acquire an explanation sentence of a target word in the text to be tested;

[0019] A preprocessing module, used for preprocessing the text to be tested, setting the explanation sentence of the target word as a label for a text classification task with the target word as a label, and adding the explanation sentence of the target word to the text for a text classification task without the target word as a label;

[0020] The training module is used to train the natural language classification model through preprocessed text.

[0021] In some of the embodiments, the preprocessing module is further used to set the explanation sentence of the target word as a label through average pooling, and convert the explanation sentence of the target word into a label vector with the same dimension as the word vector.

[0022] In some embodiments, the preprocessing module is further used to perform word segmentation processing on the explanation sentence of the target word, and obtain the BERT pre-trained word vector corresponding to each word segmentation.

[0023] The average value of the word vector in the same dimension is calculated to obtain a label vector with the same dimension as the word vector.

[0024] In some embodiments, the acquisition module is further used to obtain explanation sentences of the target word from domain experts and language experts, or to search a professional knowledge base to obtain the explanation sentences of the target word.

[0025] In a third aspect, an embodiment of the present application provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for text enhancement based on word interpretation as described in the first aspect above is implemented.

[0026] In a fourth aspect, an embodiment of the present application provides a storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for text enhancement based on word interpretation as described in the first aspect above.

[0027] Compared with the related art, the method for text enhancement based on word interpretation provided in the embodiment of the present application obtains a text to be tested and obtains an interpretation sentence of a target word in the text to be tested; then the text to be tested is preprocessed, and for a text classification task with the target word as a label, the interpretation sentence of the target word is set as a label, and for a text classification task without the target word as a label, the interpretation sentence of the target word is added to the text; finally, a natural language classification model is trained with the preprocessed text, thereby solving the problem of poor model training effect and low accuracy when classifying text due to the presence of new words or other words with insufficient relevant corpus in the text, thereby improving the accuracy of the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0029] Figure 1 is a schematic diagram of an application environment of a method for text enhancement based on word interpretation according to an embodiment of the present application;

[0030] Figure 2 is a flowchart of a method for text enhancement based on word interpretation according to an embodiment of the present application;

[0031] Figure 3 is a structural block diagram of a system for text enhancement based on word interpretation according to an embodiment of the present application;

[0032] Figure 4 It is a schematic diagram of the internal structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0033] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application. In addition, it can also be understood that although the efforts made in this development process may be complex and lengthy, for ordinary technicians in the field related to the contents disclosed in the present application, some changes such as design, manufacturing or production based on the technical contents disclosed in the present application are only conventional technical means, and should not be understood as insufficient contents disclosed in the present application.

[0034] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.

[0035] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the" and the like involved in this application do not indicate a quantitative limitation, and may represent the singular or plural. The terms "include", "comprise", "have" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to greater than or equal to two. "And / or" describes the association relationship of associated objects, indicating that there can be three relationships, for example, "A and / or B" can represent: A exists alone, A and B exist at the same time, and B exists alone. The terms "first", "second", "third" and the like involved in the present application are merely used to distinguish similar objects and do not represent a specific ordering of the objects.

[0036] The text enhancement method based on word interpretation provided in this application can be applied to Figure 1 In the application environment shown, Figure 1 is a schematic diagram of an application environment of a method for text enhancement based on word interpretation according to an embodiment of the present application, such as Figure 1 As shown. The terminal device 11 communicates with the server 10 through a network. The server 10 obtains the text to be tested and obtains the explanation sentence of the target word in the text to be tested; then the text to be tested is preprocessed, and the explanation sentence of the target word is set as a label for the text classification task with the target word as a label, and the explanation sentence of the target word is added to the text for the text classification task without the target word as a label; finally, the natural language classification model is trained with the preprocessed text, and the text is classified and predicted with the trained classification model, and the prediction result is displayed on the terminal device 11. The terminal device 11 can be, but is not limited to, various personal computers, laptops, smart phones and tablet computers, and the server 10 can be implemented with an independent server or a server cluster consisting of multiple servers.

[0037] This embodiment provides a method for text enhancement based on word interpretation. Figure 2 is a flowchart of a method for text enhancement based on word interpretation according to an embodiment of the present application, such as Figure 2 As shown, the process includes the following steps:

[0038] Step S201, obtaining a text to be tested, and obtaining an explanation sentence of a target word in the text to be tested;

[0039] Optionally, in this embodiment, the explanatory sentence of the target word in the text to be tested is obtained from the sentence in which the target word is explained in natural language by an expert in the field or a language expert, or by searching a professional knowledge base to obtain the explanatory sentence of the target word from the professional knowledge base;

[0040] Step S202, preprocessing the test text, setting the target word's explanation sentence as a label for the text classification task with the target word as a label, and adding the target word's explanation sentence to the text for the text classification task without the target word as a label;

[0041] Preferably, in this embodiment, for the text classification task with the target word as the label, the explanation sentence of the target word is set as the label through average pooling, and the explanation sentence of the target word is converted into a label vector of the same dimension as the word vector. It should be noted that in this embodiment, the explanation sentence of the target word can also be set as the label through max pooling. Specifically, there is a text classification task, which requires training a model to classify a piece of news into three categories, namely "sports", "economy", and "geek", where "geek" is the target word of the text. Through the search of domain experts and language experts or professional knowledge bases, "geek" can be interpreted as "a person who is crazy about technology". First, the explanation sentence of the target word "geek" "a person who is fanatical about technology" is set as a label; then the explanation sentence of the target word "geek" "a person who is fanatical about technology" is segmented to obtain: ['for', 'technology', 'fanatic', 'of', 'person']; then, the BERT pre-trained word vector corresponding to each segmentation is obtained, that is, the word vectors corresponding to the segmentations ['for', 'technology', 'fanatic', 'of', 'person'] are obtained, namely v1, v2, v3, v4, v5 respectively; finally, the average value of the word vectors in the same dimension is calculated to obtain the label vector with the same dimension as the word vector, that is, v^=average(v1, v2, v3, v4, v5) is calculated, and the obtained v^ has the same dimension as the word vector;

[0042] Furthermore, for text classification tasks that do not use the target word as a label, the explanation sentence of the target word is added to the text. For example, if there is a text T, in which the target word is "geek", then the sentence "Geek means a person who is fanatical about technology" is added to the end of the text T. This ensures that the explanation sentence can link the target word with its explanation, which is beneficial to text classification;

[0043] This embodiment explains the target word, which can reduce the classification errors caused by semantic ambiguity and other problems, and can effectively improve the accuracy of text classification and improve the accuracy of the model;

[0044] Step S203, training the natural language classification model through the preprocessed text. Optional. In this embodiment, the natural language classification model can be trained through the preprocessed text. It should be noted that the natural language classification model is not specifically limited in this embodiment.

[0045] Through the above steps S201 to S203, this embodiment solves the problem of poor model training effect and low accuracy when classifying text due to the presence of new words and other words with insufficient relevant corpus in the text, by obtaining the text target word explanation sentence and setting labels for the explanation sentence, thereby improving the accuracy of the model.

[0046] It should be noted that the steps shown in the above process or the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0047] This embodiment also provides a system for text enhancement based on word interpretation, which is used to implement the above embodiments and preferred implementation modes, and will not be repeated hereafter. As used below, the terms "module", "unit", "subunit", etc. can implement a combination of software and / or hardware for a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0048] Figure 3 is a structural block diagram of a text enhancement system based on word interpretation according to an embodiment of the present application, such as Figure 3 As shown, the system includes an acquisition module 31, a preprocessing module 32 and a training module 33:

[0049] The acquisition module 31 is used to acquire the text to be tested and to acquire the explanation sentence of the target word in the text to be tested; the preprocessing module 32 is used to preprocess the text to be tested, and for the text classification task with the target word as the label, the explanation sentence of the target word is set as the label, and for the text classification task without the target word as the label, the explanation sentence of the target word is added to the text; the training module 33 is used to train the natural language classification model through the preprocessed text.

[0050] Through the above system, this embodiment obtains the explanation sentences of the text target words and sets labels for the explanation sentences, thereby solving the problem of poor model training effect and low accuracy when classifying text due to the presence of new words and other words with insufficient relevant corpus in the text, thereby improving the accuracy of the model.

[0051] It should be noted that the specific examples of some other embodiments in the present application can refer to the examples described in the above-mentioned embodiment of the method for text enhancement based on word interpretation and the examples described in the optional implementation mode, and this embodiment will not be repeated here.

[0052] In addition, it should be noted that the above modules can be functional modules or program modules, and can be implemented by software or hardware. For modules implemented by hardware, the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.

[0053] This embodiment further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0054] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0055] In addition, in combination with the text enhancement method based on word interpretation in the above embodiments, the present application embodiment can provide a storage medium for implementation. The storage medium stores a computer program; when the computer program is executed by a processor, any of the text enhancement methods based on word interpretation in the above embodiments is implemented.

[0056] In one embodiment, a computer device is provided, which may be a terminal. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer 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 the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a method for text enhancement based on word interpretation is implemented. The display screen of the computer device may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device may be a touch layer covered on the display screen, or a key, trackball, or touchpad provided on the housing of the computer device, or an external keyboard, touchpad, or mouse, etc.

[0057] In one embodiment, Figure 4 is a schematic diagram of the internal structure of an electronic device according to an embodiment of the present application, such as Figure 4 As shown, an electronic device is provided, which may be a server, and its internal structure diagram may be as shown in Figure 4 As shown. The electronic device includes a processor, a network interface, an internal memory and a non-volatile memory connected through an internal bus, wherein the non-volatile memory stores an operating system, a computer program and a database. The processor is used to provide computing and control capabilities, the network interface is used to communicate with an external terminal through a network connection, the internal memory is used to provide an environment for the operation of the operating system and the computer program, the computer program is executed by the processor to implement a method for text enhancement based on word interpretation, and the database is used to store data.

[0058] Those skilled in the art will understand that Figure 4 The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the electronic device to which the scheme of the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0059] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0060] Those skilled in the art should understand that the technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0061] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A method for text enhancement based on word interpretation, characterized in that: The method comprises: Obtaining a text to be tested, and obtaining an explanation sentence of a target word in the text to be tested; The text to be tested is preprocessed, and for a text classification task with the target word as a label, the explanation sentence of the target word is set as a label, and for a text classification task without the target word as a label, the explanation sentence of the target word is added to the text; wherein, for the text classification task with the target word as a label, setting the explanation sentence of the target word as a label comprises: setting the explanation sentence of the target word as a label by average pooling or max pooling, and converting the explanation sentence of the target word into a label vector of the same dimension as the word vector; converting the explanation sentence of the target word into a label vector of the same dimension as the word vector comprises: performing word segmentation processing on the explanation sentence of the target word, and obtaining the BERT pre-trained word vector corresponding to each word segmentation; calculating the average value of the word vector in the same dimension to obtain a label vector of the same dimension as the word vector; The natural language classification model is trained using the preprocessed text.

2. The method according to claim 1, characterized in that The step of obtaining an explanation sentence of a target word in the text to be tested includes: Obtain explanation sentences for the target word from domain experts and language experts, or search a professional knowledge base to obtain explanation sentences for the target word.

3. A text enhancement system based on word interpretation, characterized in that: The system comprises: An acquisition module, used to acquire a text to be tested and to acquire an explanation sentence of a target word in the text to be tested; A preprocessing module is used to preprocess the text to be tested, set the explanation sentence of the target word as the label for the text classification task with the target word as the label, and add the explanation sentence of the target word to the text for the text classification task without the target word as the label; wherein the preprocessing module is also used to set the explanation sentence of the target word as the label through average pooling or maxpooling, and convert the explanation sentence of the target word into a label vector of the same dimension as the word vector; the preprocessing module is also used to perform word segmentation processing on the explanation sentence of the target word, and obtain the BERT pre-trained word vector corresponding to each word segmentation; calculate the average value of the word vector in the same dimension to obtain the label vector of the same dimension as the word vector; The training module is used to train the natural language classification model through preprocessed text.

4. The system according to claim 3, characterized in that The acquisition module is also used to acquire the explanation sentences of the target word from domain experts and language experts, or to search the professional knowledge base to obtain the explanation sentences of the target word.

5. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to execute the method for text enhancement based on word interpretation according to any one of claims 1 to 2.

6. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method for text enhancement based on word interpretation according to any one of claims 1 to 2 when running.

Citation Information

Patent Citations

  • Word vector model generation method and device, equipment and storage medium

    CN109829149A

  • Corpus processing method

    CN110717017A

  • Text processing method and device, storage medium and electronic equipment

    CN111291549A

  • Text data classification model training method, classification method, device and equipment

    CN112417158A

  • Deep-learning-based automatic maintenance opinion classification method and system

    CN112507117A