Data expansion method, device, equipment and medium based on keyword recognition

By masking the keywords in the training text, similar word replacement and text permutation, the problem of low data expansion efficiency in the prior art is solved, and efficient training data is quickly generated.

CN114492390BActive Publication Date: 2025-03-21SHENZHEN BEIKE RUIXUN INFORMATION TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202111554619.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-17
Publication Date
2025-03-21
Estimated Expiration
2041-12-17

AI Technical Summary

Technical Problem

In the prior art, the efficiency of augmenting training data is low, and the reliance on manual annotation makes the data expansion process time-consuming and inefficient.

Method used

By masking and completing keywords in the training text, replacing similar words, and substituting words and punctuation marks for text other than keywords, multiple types of expanded texts are generated to achieve data expansion.

Benefits of technology

Training data for keyword extraction tasks can be quickly generated without manual annotation, which significantly improves the efficiency of data expansion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114492390B_ABST
    Figure CN114492390B_ABST
Patent Text Reader

Abstract

The present application relates to a data expansion method based on keyword recognition, including: obtaining a training text, performing word segmentation processing on the training text, and identifying keywords in the text segmentation; masking the keywords, and completing the masked training text to obtain a first expanded text; screening out similar words of the keywords from a preset word library, and using the similar words to replace the keywords in the training text to obtain a second expanded text; replacing the words and punctuation marks in the training text except the keywords in the training text to obtain a third expanded text; and collecting the training text, the first expanded text, the second expanded text, and the third expanded text as expanded training data. In addition, the present application also relates to a data expansion device, equipment, and medium based on keyword recognition. The present application can solve the problem of low efficiency in expanding training data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of text processing, and in particular to a data expansion method, device, electronic device and computer-readable storage medium based on keyword recognition. Background Art

[0002] With the development of the Internet era, the resulting information explosion requires people to spend a lot of time and energy browsing and analyzing the data they come into contact with, which in turn leads to people's fatigue and boredom in reading information. Therefore, using algorithm models to extract keywords from data and then efficiently display the core of information to people has become an increasingly common means. However, in order to obtain a more accurate keyword extraction algorithm model, a large amount of training data is required in the training process of the keyword extraction model. The existing training data is often small in number and must be manually accurately labeled before it can be used for training. However, relying on manual data labeling to expand the amount of training data is inefficient. Summary of the invention

[0003] The present application provides a data expansion method, device and storage medium based on keyword recognition to solve the problem of low efficiency in expanding training data.

[0004] In a first aspect, the present application provides a data expansion method based on keyword recognition, the method comprising:

[0005] Acquire a training text, perform word segmentation processing on the training text, and identify keywords in the training text after the word segmentation processing;

[0006] Masking the keywords in the training text, and completing the masked training text to obtain a first expanded text;

[0007] Filter similar words to the keyword from a preset word library, and use the similar words to replace the keyword in the training text to obtain a second expanded text;

[0008] Replacing words and punctuation marks in the training text except the keywords to obtain a third expanded text;

[0009] The training text, the first expanded text, the second expanded text and the third expanded text are collected as expanded training data.

[0010] In detail, the step of masking the keywords in the training text and completing the masked training text to obtain the first expanded text includes:

[0011] Selecting one keyword from the keywords one by one as a mask keyword, and masking the mask keyword in the training text;

[0012] intercepting the training text in a preset adjacent range of the masked keyword in the training text as adjacent text information;

[0013] Using a pre-trained word prediction model to identify the text semantics of the adjacent text information;

[0014] Calculating the matching degree between the text semantics and a plurality of preset filler words one by one;

[0015] The filler word with the greatest matching degree is selected, and the position of the masked keyword in the training text is filled with the filler word with the greatest matching degree to obtain a first expanded text.

[0016] In detail, the filtering of similar words of the keyword from the preset word library includes:

[0017] Counting the word position of each of the keywords in the training text;

[0018] Acquire context information within a preset range of the word position in the training text, and perform vector conversion on the context information to obtain a context vector;

[0019] Select one of the keywords as a target keyword one by one from the keywords, and calculate the similarity between the target keyword and each word in the preset vocabulary according to the word vector and context vector of the target keyword;

[0020] The words whose similarity is greater than a preset similarity threshold are collected as similar words of the target keyword.

[0021] Specifically, the replacing words and punctuation marks in the training text except the keywords in the training text to obtain the third expanded text includes:

[0022] Eliminating the keyword from the training text, and randomly selecting one of the text segmentations corresponding to the training text after the keyword is eliminated as the expansion word;

[0023] Copying the expanded word N times in the training text to obtain a word replacement text, where N is a positive integer;

[0024] Performing a random replacement operation or a random deletion operation on the punctuation marks in the training text to obtain a punctuation replacement text;

[0025] The punctuation replacement text and the word replacement text are collected into a third extended text.

[0026] In detail, the word segmentation processing of the training text includes:

[0027] Extracting the symbol position of each punctuation mark in the training text using a regular expression compiled with preset punctuation marks;

[0028] Splitting the training text into a plurality of text sentences according to the symbol positions;

[0029] Selecting one of the text sentences as the target sentence in sequence from the text sentences;

[0030] The target sentence is split into multiple text words according to preset word separators.

[0031] In detail, the training text after the word segmentation process contains a plurality of text segmentations, and the identifying keywords in the training text after the word segmentation process includes:

[0032] Convert each of the text segments into a word vector;

[0033] Obtain a pre-trained keyword analysis model, and use the keyword analysis model to perform a preset number of convolutions and pooling processes on each of the word vectors to obtain vector features;

[0034] Calculate the probability value of the text segmentation corresponding to each word vector being a keyword according to the vector feature;

[0035] The text segmentation corresponding to the word vector whose probability value is greater than the preset probability threshold is selected as the keyword.

[0036] In detail, the training text after the word segmentation process contains a plurality of text segmentations, and the identifying keywords in the training text after the word segmentation process includes:

[0037] Counting the frequency of occurrence of each text segmentation in the text segmentation;

[0038] The text segmentation words whose occurrence frequency is greater than a preset frequency threshold are selected as keywords.

[0039] In a second aspect, the present application provides a data expansion device based on keyword recognition, the device comprising:

[0040] A keyword extraction module is used to obtain a training text, perform word segmentation processing on the training text, and identify keywords in the training text after word segmentation processing;

[0041] A first expansion module, used for masking keywords in the training text and completing the masked training text to obtain a first expanded text;

[0042] A second expansion module, configured to select similar words to the keyword from a preset word library, and replace the keyword in the training text with the similar words to obtain a second expanded text;

[0043] A third expansion module, used for replacing words and punctuation marks in the training text except the keywords in the training text to obtain a third expanded text;

[0044] The text collection module is used to collect the training text, the first expanded text, the second expanded text and the third expanded text into expanded training data.

[0045] In a third aspect, an electronic device is provided, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;

[0046] Memory, used to store computer programs;

[0047] The processor is used to implement the steps of the data expansion method based on keyword recognition described in any embodiment of the first aspect when executing the program stored in the memory.

[0048] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the data expansion method based on keyword recognition as described in any embodiment of the first aspect are implemented.

[0049] The above technical solution provided by the embodiment of the present application has the following advantages compared with the prior art:

[0050] The method provided in the embodiment of the present application can generate various types of expanded texts by performing masked completion operations and similar word replacement operations on the keywords in the training text, and replacing the words and punctuation marks in the training text other than the keywords in the training text, without relying on manual annotation of massive data, and can quickly generate training data that can be used for keyword extraction tasks. The problem of low efficiency in expanding training data can be solved. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0052] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0053] Figure 1 A flowchart of a data expansion method based on keyword recognition provided in an embodiment of the present application;

[0054] Figure 2 A schematic diagram of a process for word segmentation processing provided in an embodiment of the present application;

[0055] Figure 3 A schematic diagram of a process for generating a first extended text provided in an embodiment of the present application;

[0056] Figure 4 A schematic diagram of a module of a data expansion device based on keyword recognition provided in an embodiment of the present application;

[0057] Figure 5 A schematic diagram of the structure of an electronic device for implementing a data expansion method based on keyword recognition provided in an embodiment of the present application. DETAILED DESCRIPTION

[0058] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments 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 this application.

[0059] Figure 1 A flowchart of a data expansion method based on keyword recognition provided in an embodiment of the present application. In this embodiment, the data expansion method based on keyword recognition includes:

[0060] S1. Obtain training text, perform word segmentation processing on the training text, and identify keywords in the training text after the word segmentation processing.

[0061] In an embodiment of the present application, the training text is pre-acquired data that can be used to train an established text processing model, wherein the training text includes but is not limited to the NLPCC (The Conference on Natural Language Processing and Chinese Computing) dataset and the LCSTS (large scale Chinese short text summarization dataset) dataset.

[0062] In detail, the training text may be uploaded in advance by the user, or the training text may be captured from a preset data storage by a python statement having a data capture function, wherein the data storage includes but is not limited to a database, a network cache, and the like.

[0063] In one of the practical application scenarios of the present application, since the training text is relatively long, in order to improve the efficiency of analyzing the training text, the training text may be segmented and keywords in the training text may be extracted.

[0064] In the present application examples, Figure 2 As shown, the word segmentation processing of the training text includes:

[0065] S21, extracting the symbol position of each punctuation mark in the training text by using a regular expression compiled with preset punctuation marks;

[0066] S22, splitting the training text into a plurality of text sentences according to the symbol positions;

[0067] S23, selecting one of the text sentences from the text sentences in turn as the target sentence;

[0068] S24: Split the target sentence into multiple text words according to preset word separators.

[0069] In detail, the regular expression compiled by the preset punctuation marks can be used to identify the symbol positions of the punctuation marks in the text data, and then the training text can be split according to the identified symbol positions to obtain a number of text sentences.

[0070] In other embodiments of the present application, the training text may be segmented by the sent_tokenize() method in the NLTK library in Python to obtain a number of text sentences corresponding to the training text.

[0071] For example, the following sent_tokenize() method can be used to split the training text into several text sentences:

[0072] from nltk.tokenize import sent_tokenize

[0073] data="x"

[0074] print(sent_tokenize(data))

[0075] Wherein, x is the training text.

[0076] Specifically, the preset word separator includes but is not limited to a space character, a placeholder, etc., and the position of the preset word separator in each text sentence can be traversed, and then each text sentence can be split into multiple text words according to the position of the preset word separator.

[0077] In other embodiments of the present invention, the target sentence can be split into several text segmentations using preset segmentation tools such as jieba, SnowNLP, PKUse, THULAC, etc.; or, the target sentence can be split into several text segmentations using the word_tokenize() method in the NLTK library in Python.

[0078] Exemplarily, the target sentence may be split into several text tokens using the following word_tokenize() method:

[0079] from nltk.tokenize import word_tokenize

[0080] data="y"

[0081] print(word_tokenize(data))

[0082] Wherein, y is the target sentence.

[0083] Furthermore, in order to achieve accurate data expansion of the training text, keywords of the training text may be extracted from the text segmentation, so that the training text can be subsequently expanded according to the keywords.

[0084] In one embodiment of the present application, the training text contains multiple text segmentations after the segmentation process, and the identifying keywords in the training text after the segmentation process includes:

[0085] Convert each of the text segments into a word vector;

[0086] Obtain a pre-trained keyword analysis model, and use the keyword analysis model to perform a preset number of convolutions and pooling processes on each of the word vectors to obtain vector features;

[0087] Calculate the probability value of the text segmentation corresponding to each word vector being a keyword according to the vector feature;

[0088] The text segmentation corresponding to the word vector whose probability value is greater than the preset probability threshold is selected as the keyword.

[0089] In detail, each of the text word segments can be encoded into a word vector using an encoder with a word encoding function, such as a BERT model, a Transformer encoder, a Word2Vec encoder, and an Autoencoder encoder.

[0090] Specifically, the keyword analysis model includes but is not limited to a Conditional Random Field (CRF) model and a Lstm (Long short-term memory) model with a keyword recognition function.

[0091] In an embodiment of the present application, after performing a preset number of convolution and pooling processes on each of the word vectors to obtain vector features, a preset activation function (such as a sigmoid activation function, a relu activation function, a softmax activation function) can be used to calculate the probability value of the text segmentation corresponding to each of the word vectors being a keyword based on the vector features, and then the text segmentation corresponding to the word vector whose probability value is greater than a preset probability threshold is selected as a keyword.

[0092] In this embodiment, the extraction of keywords from the text segmentation is achieved through a pre-trained keyword analysis model, which can improve the accuracy of extracting the keywords from the text segmentation.

[0093] In another embodiment of the present application, the training text after word segmentation processing contains multiple text segmentations, and the identifying keywords in the training text after word segmentation processing includes:

[0094] Counting the frequency of occurrence of each text segmentation in the text segmentation;

[0095] The text segmentation words whose occurrence frequency is greater than a preset frequency threshold are selected as keywords.

[0096] In detail, the occurrence frequency refers to the number of times each text segmentation appears in the training text. The more times a text segmentation appears in the training text, the more important the text segmentation is to the training text. Therefore, the text segmentations can be screened according to the occurrence frequency of each text segmentation, and the text segmentations with an occurrence frequency greater than a preset threshold are selected as keywords.

[0097] Specifically, by filtering out keywords from text segmentation by frequency of occurrence, the efficiency of extracting keywords from the text segmentation can be improved.

[0098] S2. Mask the keywords in the training text, and complete the masked training text to obtain a first expanded text.

[0099] In an embodiment of the present application, the keywords in the training text can be masked, and then the training text with the masked keywords can be input into a pre-trained word prediction model, and the masked keywords in the training text can be predicted using the word prediction model, so that the training text can be completed with the predicted words to obtain a first expanded text.

[0100] In detail, the word prediction model includes but is not limited to NLP (Natural Language Processing) model and HMM (Hidden Markov Model).

[0101] In the present application examples, Figure 3 As shown, the keyword in the training text is masked, and the masked training text is completed to obtain a first expanded text, including:

[0102] S31, selecting one keyword from the keywords one by one as a mask keyword, and masking the mask keyword in the training text;

[0103] S32, intercepting the training text in a preset adjacent range of the masked keyword in the training text as adjacent text information;

[0104] S33, using a pre-trained word prediction model to identify the text semantics of the adjacent text information;

[0105] S34, calculating the matching degree between the text semantics and a plurality of preset filler words one by one;

[0106] S35 , selecting the filler word with the greatest matching degree, and using the filler word with the greatest matching degree to fill the position of the masked keyword in the training text to obtain a first expanded text.

[0107] In detail, the word prediction model (NLP model, HMM model, etc.) can identify the text semantics corresponding to the adjacent text information through operations such as encoding and mapping, and then use the text semantics to screen multiple preset filler words.

[0108] In detail, the step of calculating the matching degree between the text semantics and a plurality of preset filler words one by one includes:

[0109] The matching degree between the text semantics and a plurality of preset filler words is calculated one by one using the following matching algorithm:

[0110]

[0111] Where P is the matching degree, A is the text semantics, and Bk is the kth preset filler word, and α and β are preset weight coefficients.

[0112] In the embodiment of the present application, the filler word with the greatest matching degree is used to fill the position of the mask keyword to obtain a first expanded text.

[0113] S3. Filter similar words to the keyword from a preset word library, and use the similar words to replace the keyword in the training text to obtain a second expanded text.

[0114] In the embodiment of the present application, the preset vocabulary library may be a database, a data table, etc. containing multiple words.

[0115] In detail, similar words with similar meanings to the keywords can be screened out from the preset word library, and the keywords in the training text can be replaced with the screened similar words to achieve data expansion of the training text and obtain a second expanded text.

[0116] In the embodiment of the present application, the filtering of similar words of the keyword from the preset word library includes:

[0117] Counting the word position of each of the keywords in the training text;

[0118] Acquire context information within a preset range of the word position in the training text, and perform vector conversion on the context information to obtain a context vector;

[0119] Select one of the keywords as a target keyword one by one from the keywords, and calculate the similarity between the target keyword and each word in the preset vocabulary according to the word vector and context vector of the target keyword;

[0120] The words whose similarity is greater than a preset similarity threshold are collected as similar words of the target keyword.

[0121] In one of the practical application scenarios of the present invention, since keywords may generate additional meanings based on the context, in an embodiment of the present invention, the word positions of the keywords in the training text are counted to obtain the context information of the keywords, and the obtained context information is converted into a vector form, which is conducive to improving the accuracy of subsequent data expansion.

[0122] In an embodiment of the present application, the training text may be traversed to confirm the word position of the keyword in the training text, and the training text within a preset range of the word position of the keyword may be intercepted to obtain context information of the keyword.

[0123] In detail, the step of converting the context information into a vector to obtain a context vector is consistent with the step of converting each of the text word segments into a word vector in S1, and will not be repeated here.

[0124] Further, the calculating the similarity between the target keyword and each word in the preset vocabulary according to the word vector and the context vector of the target keyword includes:

[0125] The similarity between the target keyword and each word in the preset vocabulary is calculated using the following similarity algorithm:

[0126]

[0127] Among them, Sim is the similarity, X is the word vector corresponding to the target keyword, and Y i is the word vector of the i-th word in the preset word library, and Z is the context information corresponding to the target keyword.

[0128] In detail, after calculating the similarity between the word vector corresponding to the target keyword and the word vectors of multiple words in a preset vocabulary, an embodiment of the present invention aggregates the word vectors of the words in the preset vocabulary whose similarity is greater than a preset similarity threshold to obtain a similar word vector of the keyword.

[0129] Specifically, each keyword may be replaced with a similar word corresponding to the keyword to obtain a second expanded text.

[0130] S4. Replace the words and punctuation marks in the training text except the keywords to obtain a third expanded text.

[0131] In an embodiment of the present application, the content in the training text other than the keywords can also be replaced, including random deletion and random copying of words in the training text other than the keywords, random insertion of punctuation marks in the training text, random change and random deletion of original punctuation marks in the training text, etc.

[0132] In the embodiment of the present application, the training text except the keywords in the training text is replaced with words and punctuation marks to obtain a third expanded text, including:

[0133] Eliminating the keyword from the training text, and randomly selecting one of the text segmentations corresponding to the training text after the keyword is eliminated as the expansion word;

[0134] Copying the expanded word N times in the training text to obtain a word replacement text, where N is a positive integer;

[0135] Performing a random replacement operation or a random deletion operation on the punctuation marks in the training text to obtain a punctuation replacement text;

[0136] The punctuation replacement text and the word replacement text are collected into a third extended text.

[0137] In detail, since the information contained in the non-keyword content part of the training text has a low correlation with the core meaning of the training text, the text segmentations in this part of the content can be copied to generate word replacement text without changing the core semantics of the training text. This eliminates the need for detailed semantic analysis of the training text, which is beneficial to improving the efficiency of generating word replacement text.

[0138] Specifically, the punctuation marks in the training text are used to divide each sentence in the training text. The punctuation marks usually have no practical meaning. Therefore, the punctuation marks in the training text can be randomly replaced. For example, a comma can be replaced with a period, or a semicolon can be replaced with an ellipsis, etc. Alternatively, the punctuation marks in the training text can be randomly deleted to expand the training text without changing the actual semantics of the training text.

[0139] S5. Collect the training text, the first expanded text, the second expanded text and the third expanded text into expanded training data.

[0140] In an embodiment of the present application, the training text, the first expanded text, the second expanded text and the third expanded text may be collected to obtain expanded training data.

[0141] In an embodiment of the present application, after obtaining the expanded training data, the expanded training data can be used to train a pre-constructed network model (such as a network model with a keyword extraction function, a network model with a summary analysis function, etc.) to ensure the sufficiency of the training data and improve the accuracy of the network model obtained after training.

[0142] The method provided in the embodiment of the present application can generate various types of expanded texts by performing masked completion operations and similar word replacement operations on the keywords in the training text, and replacing the words and punctuation marks in the training text other than the keywords in the training text, without relying on manual annotation of massive data, and can quickly generate training data that can be used for keyword extraction tasks. The problem of low efficiency in expanding training data can be solved.

[0143] like Figure 4As shown, an embodiment of the present application provides a module schematic diagram of a data expansion device 10 based on keyword recognition, and the data expansion device 10 based on keyword recognition includes: a keyword extraction module 11, a first expansion module 12, a second expansion module 13, a third expansion module 14 and a text collection module 15.

[0144] The keyword extraction module 11 is used to obtain a training text, perform word segmentation processing on the training text, and identify keywords in the training text after word segmentation processing;

[0145] The first expansion module 12 is used to mask the keywords in the training text and complete the masked training text to obtain a first expanded text;

[0146] The second expansion module 13 is used to select similar words of the keyword from a preset word library, and use the similar words to replace the keyword in the training text to obtain a second expanded text;

[0147] The third expansion module 14 is used to replace words and punctuation marks in the training text except the keywords in the training text to obtain a third expanded text;

[0148] The text collection module 15 is used to collect the training text, the first expanded text, the second expanded text and the third expanded text into expanded training data.

[0149] In detail, each module described in the data expansion device 10 based on keyword recognition in the embodiment of the present application is used in the same manner as described above. Figures 1 to 3 The data expansion method based on keyword recognition described in the present invention has the same technical means and can produce the same technical effects, so it will not be repeated here.

[0150] like Figure 5 As shown, an embodiment of the present application provides an electronic device, including a processor 111, a communication interface 112, a memory 113 and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 communicate with each other through the communication bus 114.

[0151] The memory 113 is used to store computer programs.

[0152] In one embodiment of the present application, the processor 111 is used to execute the program stored in the memory 113 to implement the data expansion method based on keyword recognition provided by any of the above method embodiments, including:

[0153] Acquire a training text, perform word segmentation processing on the training text, and identify keywords in the training text after the word segmentation processing;

[0154] Masking the keywords in the training text, and completing the masked training text to obtain a first expanded text;

[0155] Filter similar words to the keyword from a preset word library, and use the similar words to replace the keyword in the training text to obtain a second expanded text;

[0156] Replacing words and punctuation marks in the training text except the keywords to obtain a third expanded text;

[0157] The training text, the first expanded text, the second expanded text and the third expanded text are collected as expanded training data.

[0158] The communication bus 114 may be a peripheral component interconnect standard

[0159] (Peripheral Component Interconnect, referred to as PCI) bus or Extended Industry Standard Architecture (Extended Industry Standard Architecture, referred to as EISA) bus, etc. The communication bus 114 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0160] The communication interface 112 is used for communication between the above electronic device and other devices.

[0161] The memory 113 may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory 113 may also be at least one storage device located away from the processor 111 .

[0162] The above-mentioned processor 111 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.

[0163] An embodiment of the present application further 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 data expansion method based on keyword recognition provided in any of the aforementioned method embodiments are implemented.

[0164] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loading and executing computer program instructions on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, a data center, etc. that contains one or more available media integrated. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk SolidStateDisk (SSD)), etc.

[0165] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0166] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A data expansion method based on keyword recognition, characterized in that: The method comprises: Acquire a training text, perform word segmentation processing on the training text, and identify keywords in the training text after the word segmentation processing; The key words in the training text are masked, and the masked training text is completed to obtain a first extended text, including: selecting a key word from the key words one by one as a mask key word, and masking the mask key word in the training text; intercepting the training text in a preset adjacent range of the mask key word in the training text as adjacent text information; using a pre-trained word prediction model to identify the text semantics of the adjacent text information; using a matching algorithm to calculate the matching degree between the text semantics and a plurality of preset filler words one by one, and the calculation formula of the matching algorithm is: Where P is the matching degree, A is the text semantics, and B k is the kth preset filler word, α and β are preset weight coefficients; selecting the filler word with the greatest matching degree, and using the filler word with the greatest matching degree to fill the position of the mask keyword in the training text to obtain a first expanded text; Filter similar words to the keyword from a preset word library, and use the similar words to replace the keyword in the training text to obtain a second expanded text; Replacing words and punctuation marks in the training text except the keywords to obtain a third expanded text; The training text, the first expanded text, the second expanded text and the third expanded text are collected as expanded training data.

2. The data expansion method based on keyword recognition according to claim 1, characterized in that: The step of screening similar words to the keyword from a preset word library includes: Counting the word position of each of the keywords in the training text; Obtaining context information within a preset range of the word position in the training text, and performing vector conversion on the context information to obtain a context vector; Select one of the keywords as a target keyword one by one from the keywords, and calculate the similarity between the target keyword and each word in the preset vocabulary according to the word vector and context vector of the target keyword; The words whose similarity is greater than a preset similarity threshold are collected as similar words of the target keyword.

3. The data expansion method based on keyword recognition according to claim 1, characterized in that: The step of replacing words and punctuation marks in the training text except the keywords to obtain a third expanded text includes: Eliminating the keyword from the training text, and randomly selecting one of the text segmentations corresponding to the training text after the keyword is eliminated as the expansion word; Copying the expanded word N times in the training text to obtain a word replacement text, where N is a positive integer; Performing a random replacement operation or a random deletion operation on the punctuation marks in the training text to obtain a punctuation replacement text; The punctuation replacement text and the word replacement text are collected into a third extended text.

4. The data expansion method based on keyword recognition according to claim 1, characterized in that: The word segmentation processing of the training text includes: Extracting the symbol position of each punctuation mark in the training text using a regular expression compiled with preset punctuation marks; Splitting the training text into a plurality of text sentences according to the symbol positions; Selecting one of the text sentences as the target sentence in sequence from the text sentences; The target sentence is split according to preset word separators.

5. The data expansion method based on keyword recognition according to any one of claims 1 to 4, characterized in that: The training text after word segmentation processing contains multiple text segmentations, and the identifying keywords in the training text after word segmentation processing includes: Convert each of the text segments into a word vector; Obtain a pre-trained keyword analysis model, and use the keyword analysis model to perform a preset number of convolutions and pooling processes on each of the word vectors to obtain vector features; Calculate the probability value of the text segmentation corresponding to each word vector being a keyword according to the vector feature; The text segmentation corresponding to the word vector whose probability value is greater than the preset probability threshold is selected as the keyword.

6. The data expansion method based on keyword recognition according to any one of claims 1 to 4, characterized in that: The training text after word segmentation processing contains multiple text segmentations, and the identifying keywords in the training text after word segmentation processing includes: Counting the frequency of occurrence of each text segmentation in the text segmentation; The text segmentation words whose occurrence frequency is greater than a preset frequency threshold are selected as keywords.

7. A data expansion device based on keyword recognition, characterized in that: The device comprises: A keyword extraction module is used to obtain a training text, perform word segmentation processing on the training text, and identify keywords in the training text after word segmentation processing; The first expansion module is used to mask the keywords in the training text and complete the masked training text to obtain the first expanded text, including: selecting one keyword from the keywords one by one as a mask keyword, and masking the mask keyword in the training text; intercepting the training text in a preset adjacent range of the mask keyword in the training text as adjacent text information; using a pre-trained word prediction model to identify the text semantics of the adjacent text information; using a matching algorithm to calculate the matching degree between the text semantics and multiple preset filler words one by one, and the calculation formula of the matching algorithm is: Where P is the matching degree, A is the text semantics, and B k is the kth preset filler word, α and β are preset weight coefficients; selecting the filler word with the greatest matching degree, and using the filler word with the greatest matching degree to fill the position of the mask keyword in the training text to obtain a first expanded text; A second expansion module is used to select similar words of the keyword from a preset word library, and use the similar words to replace the keyword in the training text to obtain a second expanded text; A third expansion module, used for replacing words and punctuation marks in the training text except the keywords in the training text to obtain a third expanded text; The text collection module is used to collect the training text, the first expanded text, the second expanded text and the third expanded text into expanded training data.

8. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; Memory, used to store computer programs; The processor is used to implement the steps of the data expansion method based on keyword recognition described in any one of claims 1 to 6 when executing the program stored in the memory.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the data expansion method based on keyword recognition as described in any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Audio processing method and device, language model training method and device and computer equipment

    CN111933129A

  • English punctuation mark adding method, system and device based on data enhancement

    CN112016320A

  • Training corpus expansion method and device and intention recognition model training method and device

    CN112651238A

  • Text abstract and keyword extraction method and device, equipment and medium

    CN113723058A