Core sentence extraction method, system, device and storage medium for classification tags

Using deep learning technology to extract the core sentence model of the Internet tourism industry solves the problem of redundant data in the corpus, improves model accuracy and efficiency, reduces computational costs, and achieves results close to those in the academic field.

CN113987174BActive Publication Date: 2024-08-23SHANGHAI TRAVEL INFORMATION TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202111234433.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-22
Publication Date
2024-08-23
Estimated Expiration
2041-10-22

AI Technical Summary

Technical Problem

In the existing technology, there is a large amount of redundant and erroneous data in the corpus of the Internet tourism industry, which results in limited model accuracy and a large amount of calculation, making it difficult to achieve results in the academic field.

Method used

Extract the core sentence model through deep learning, remove some redundant data, improve the accuracy of the neural network classification model, and reduce computing costs. Specific steps include providing sentence training text, performing Chinese word segmentation and digital processing, inputting the neural network model for pre-training, calculating cross-entropy and KL divergence loss, iterative training to obtain the model with the smallest total loss, and extracting the sentence with the highest similarity as the core sentence. .

Benefits of technology

It significantly improves the accuracy of core statements in the neural network classification model, significantly reduces the computational cost of the model, and improves processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113987174B
    Figure CN113987174B
Patent Text Reader

Abstract

The present invention provides a method, system, device and storage medium for extracting core sentences of classification labels, the method comprising: providing sentence training text with text preset labels, converting the sentence training text into a digital sequence and copying and expanding it once, then converting it into a word vector matrix, and obtaining a sentence encoding vector through the word vector matrix; obtaining a total loss according to the text preset label and the model prediction label obtained by the neural network, obtaining a neural network classification model and a sentence encoding vector corresponding to the training sentence when the total loss is minimized through iterative training; obtaining a central vector according to the average value of the sentence encoding vector corresponding to the label; and selecting a core sentence according to the similarity ranking of the central vector and the sentence encoding vector. The present invention can remove some redundant data through deep learning, greatly improve the accuracy of selecting core sentences in the neural network classification model, and greatly reduce the model calculation cost.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] China's Internet tourism industry has grown rapidly in recent years, and big data and artificial intelligence technologies have developed rapidly in recent years. Big data and artificial intelligence technologies have been successfully used in the Internet tourism industry. At the same time, for the massive data in the tourism field, traditional manual methods have become outdated, and artificial intelligence is needed to replace manual work and improve processing efficiency. Nowadays, with the rise of deep learning, natural language processing has ushered in a booming development. The tasks of natural language processing can basically be divided into three small modules: text data collection and preprocessing, encoding and representing text, and designing models to solve specific tasks. Of course, in some problems, the boundary between encoding and representing text and designing models to solve specific tasks is not particularly clear.

[0003] At present, there has been great progress in encoding and representing text, from N-Gram, word2vec, to Transformer, bert, etc. The technology for encoding and representing text has made great progress, not limited to just counting word frequency, and has begun to dig deeper into the meaning of text such as semantics and logic. However, there is a difference between the corpus currently used by companies and the corpus compared in academia. The corpus used by companies contains a large amount of redundant data and even erroneous data. These redundant or bad data restrict the accuracy of existing models to a certain extent. The effect of the model we use often cannot achieve the effect of the corpus used in the academic field. Of course, in the current deep learning, we have been exploring models that can resist high noise and high redundancy.

[0004] There is a certain amount of redundant data in the corpus currently used. The redundant data greatly increases the computational complexity of the model. The core sentence extraction model proposed in this paper removes some redundant data through deep learning, which significantly reduces the computational complexity of the model while ensuring the effect.

[0005] Therefore, the present invention provides a method, system, device and storage medium for extracting core sentences of classification tags. Summary of the invention

[0006] In response to the problems in the prior art, the purpose of the present invention is to provide a method, system, device and storage medium for extracting core sentences from classification labels, which overcomes the difficulties of the prior art, can remove some redundant data through deep learning, greatly improve the accuracy of selecting core sentences in the neural network classification model, and significantly reduce the model calculation cost.

[0007] An embodiment of the present invention provides a method for extracting core sentences of classification labels, comprising the following steps:

[0008] S110, providing sentence training text, wherein each training sentence in the sentence training text has at least one text preset label;

[0009] S120, performing Chinese word segmentation on the sentence training text to obtain words, converting the text of the words in the training sentence into corresponding numbers in sequence according to a preset index dictionary, obtaining a digital sequence of the training sentence and copying and expanding it once;

[0010] S130, converting the digital sequence into a corresponding word vector matrix, and inputting the vector matrix into a neural network classification model for pre-training to obtain a sentence encoding vector of the training sentence;

[0011] S140, obtaining the model prediction label of the training sentence through the neural network classification model, obtaining the cross entropy loss value and the KL divergence calculation loss value of two identical sentences according to the label category probability distribution of the text preset label and the model prediction label, and obtaining the total loss value according to the cross entropy loss value and the KL divergence calculation loss value;

[0012] S150, obtaining a neural network classification model with the minimum total loss through iterative training as the trained neural network classification model;

[0013] S170, inputting the sentence training text into a feature extractor in a trained neural network classification model to obtain a sentence encoding vector corresponding to the training sentence;

[0014] S180, obtaining a central vector corresponding to each of the labels according to the average value of all the sentence encoding vectors corresponding to each of the labels; and

[0015] S190, respectively normalize the center vector of the same label and each of the sentence encoding vectors to obtain the similarity between the two, and for each of the labels, extract the training sentences corresponding to the W sentence encoding vectors with the highest similarity as core sentences.

[0016] Preferably, after step S150 and before step S170, the following steps are further included:

[0017] S160, removing the classifier in the neural network classification model, and using the remaining modules of the neural network classification model as feature extractors.

[0018] Preferably, in step S110, the preset text preset tags include: intention category tags and / or emotion category tags.

[0019] Preferably, the step S120 includes the following steps:

[0020] S121, performing Chinese word segmentation on the sentence training text to obtain words;

[0021] S122, establishing the word-to-number index dictionary according to the result of the Chinese word segmentation;

[0022] S123, converting the text sequence of the word into a corresponding original digital sequence according to the index dictionary;

[0023] S124, copy the original digital sequence of each sentence once to obtain an expanded digital sequence.

[0024] Preferably, in step S130, the neural network classification model is a Bert text classification neural network.

[0025] Preferably, the step S140 includes the following steps:

[0026] S141, use the Bert text classification neural network pre-training, directly pass it into the two fully connected layers, and calculate the cross entropy loss value loss1 of each type of label according to the preset text label and the label category probability distribution predicted by the model:

[0027]

[0028] Wherein, N is the total number of training sentences with each type of the text preset label, and M is the total number of types of the text preset labels;

[0029] y ij is a first matrix of which text preset label the model predicted label of the i-th training sentence label under the j-th category label belongs to, wherein the element value corresponding to the text preset label that is the same as the model predicted label in the first matrix is ​​1, and the element value corresponding to the other text preset labels is 0;

[0030] p ij is a second matrix with the probability that the model predicted label of the i-th training sentence label under the j-th category label belongs to each category of text preset label as element values, and the sum of all the element values ​​in the second matrix is ​​1;

[0031] S142, calculating the loss value loss2 of the label of this category according to the KL divergence of the original digital sequence and the expanded digital sequence:

[0032]

[0033] Among them, y1 is the sentence encoding vector corresponding to the original digital sequence, and y2 is the sentence encoding vector corresponding to the original digital sequence;

[0034] S143. Obtain the total loss value loss of the label of this class:

[0035] loss = loss1 + α × loss2;

[0036] The value range of α is (0, 5].

[0037] Preferably, in step S150, the Adam optimization algorithm is used to perform iterative training to obtain a neural network classification model with the minimum total loss as the trained neural network classification model.

[0038] Preferably, the step S190 includes the following steps:

[0039] S191, obtaining the cosine value similarity of the angle between the center vector and the sentence encoding vector having the same label:

[0040]

[0041] Among them, A i is the sentence encoding vector with the same label, B i is the center vector of the same label, and n is the total number of elements in the sentence encoding vector;

[0042] S192, sorting the similarities from large to small;

[0043] S193, extracting the training sentences corresponding to the top f(x) sentence encoding vectors as the core sentences of the label.

[0044] Preferably, in step S190, as the total number of training sentences corresponding to the label increases, the ratio of the number of core sentences corresponding to the label to the total number of training sentences decreases, and the ratio f(x)=W / x, and

[0045]

[0046] An embodiment of the present invention further provides a core sentence extraction system for a classification tag, which is used to implement the core sentence extraction method for a classification tag. The core sentence extraction system for a classification tag includes:

[0047] A sample providing module provides sentence training texts, wherein each training sentence in the sentence training texts has at least one text preset label;

[0048] A digital sequence module performs Chinese word segmentation on the sentence training text to obtain words, converts the text of the words in the training sentence into corresponding numbers in sequence according to a preset index dictionary, obtains the digital sequence of the training sentence and copies and expands it once;

[0049] A network pre-training module converts the digital sequence into a corresponding word vector matrix, and the vector matrix is ​​respectively input into a neural network classification model for pre-training to obtain a sentence encoding vector of the training sentence;

[0050] A total loss calculation module, which obtains the model prediction label of the training sentence through the neural network classification model, obtains the cross entropy loss and the KL divergence calculation loss of two identical sentences according to the label category probability distribution of the text preset label and the model prediction label, and obtains the total loss according to the cross entropy loss and the KL divergence calculation loss;

[0051] Iterative training module, which obtains the neural network classification model with the minimum total loss through iterative training as the trained neural network classification model;

[0052] A sentence encoding module, inputting the sentence training text into a feature extractor in a trained neural network classification model to obtain a sentence encoding vector corresponding to the training sentence;

[0053] A central vector module, which obtains a central vector corresponding to each of the labels according to an average value of all the sentence encoding vectors corresponding to each of the labels; and

[0054] The core sentence module normalizes the central vector of the same label and each sentence encoding vector and then obtains the similarity between the two. For each label, the training sentences corresponding to the f(x) sentence encoding vectors with the highest similarity are extracted as core sentences.

[0055] An embodiment of the present invention further provides a core sentence extraction device for a classification label, comprising:

[0056] processor;

[0057] a memory storing executable instructions of the processor;

[0058] Wherein, the processor is configured to execute the steps of the above-mentioned core sentence extraction method of classification tags by executing the executable instructions.

[0059] An embodiment of the present invention further provides a computer-readable storage medium for storing a program, which, when executed, implements the steps of the above-mentioned method for extracting core sentences of classification labels.

[0060] The purpose of the present invention is to provide a method, system, device and storage medium for extracting core sentences of classification labels, which can remove some redundant data through deep learning, greatly improve the accuracy of selecting core sentences in the neural network classification model, and greatly reduce the model calculation cost. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] Other features, objectives and advantages of the present invention will become more apparent from a reading of the detailed description of non-limiting embodiments made with reference to the following accompanying drawings.

[0062] Figure 1 It is a flow chart of the core sentence extraction method of the classification label of the present invention.

[0063] Figure 2 It is a module schematic diagram of the core sentence extraction system of the classification label of the present invention.

[0064] Figure 3 It is a structural diagram of the core sentence extraction device of the classification label of the present invention.

[0065] Figure 4 It is a schematic diagram of the structure of a computer-readable storage medium according to an embodiment of the present invention. DETAILED DESCRIPTION

[0066] The following describes the implementation methods of the present application through specific examples, and those skilled in the art can easily understand other advantages and effects of the present application from the content disclosed in the present application. The present application can also be implemented or applied through other different specific implementation methods, and the details in the present application can also be modified or changed in various ways according to different viewpoints and application systems without departing from the spirit of the present application. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.

[0067] The following is a detailed description of the embodiments of the present application with reference to the accompanying drawings so that those skilled in the art can easily implement the present application. The present application can be embodied in a variety of different forms and is not limited to the embodiments described herein.

[0068] In the representations of the present application, the representations with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" etc. mean that the specific features, structures, materials or characteristics represented in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. Moreover, the represented specific features, structures, materials or characteristics may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples represented in the present application and the features of the different embodiments or examples, unless they contradict each other.

[0069] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the representation of this application, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0070] In order to clearly describe the present application, components irrelevant to the description are omitted, and the same reference symbols are given to the same or similar components throughout the specification.

[0071] Throughout the specification, when a device is said to be "connected" to another device, this includes not only the case of "direct connection" but also the case of "indirect connection" by placing other elements therebetween. In addition, when a device is said to "include" a certain component, unless otherwise stated, it does not exclude other components, but means that other components may be included.

[0072] When a device is said to be "on" another device, it may be directly on the other device, but there may also be other devices between it. In contrast, when a device is said to be "directly" on another device, there are no other devices between it.

[0073] Although the terms first, second, etc. are used to represent various elements in some examples, these elements should not be limited by these terms. These terms are only used to distinguish one element from another element. For example, the first interface and the second interface, etc. are represented. Moreover, as used in this article, the singular forms "one", "one" and "the" are intended to also include plural forms, unless there is an opposite indication in the context. It should be further understood that the terms "comprising" and "including" indicate the existence of features, steps, operations, elements, components, projects, kinds, and / or groups, but do not exclude the existence, occurrence or addition of one or more other features, steps, operations, elements, components, projects, kinds, and / or groups. The terms "or" and "and / or" used herein are interpreted as inclusive, or mean any one or any combination. Therefore, "A, B or C" or "A, B and / or C" means "any of the following: A; B; C; A and B; A and C; B and C; A, B and C". Only when the combination of elements, functions, steps or operations is inherently mutually exclusive in some way, will there be an exception to this definition.

[0074] The technical terms used herein are only used to refer to specific embodiments and are not intended to limit the present application. The singular form used herein also includes the plural form unless the sentence clearly indicates the contrary meaning. The meaning of "including" used in the specification is to specify specific characteristics, regions, integers, steps, operations, elements and / or components, and does not exclude the existence or addition of other characteristics, regions, integers, steps, operations, elements and / or components.

[0075] Although not defined differently, all terms, including technical and scientific terms used herein, have the same meaning as those generally understood by those skilled in the art to which this application belongs. Terms defined in commonly used dictionaries are additionally interpreted as having meanings consistent with the relevant technical literature and the contents of the current disclosure, and unless defined, shall not be overly interpreted as ideal or very formal meanings.

[0076] Figure 1 Flowchart of the core sentence extraction method of the classification label of the present invention. Figure 1 As shown, an embodiment of the present invention provides a method for extracting core sentences of classification labels, comprising the following steps:

[0077] S110, providing sentence training text, wherein each training sentence in the sentence training text has at least one text preset label;

[0078] S120, performing Chinese word segmentation on the sentence training text to obtain words, converting the text of the words in the training sentence into corresponding numbers in sequence according to a preset index dictionary, obtaining a digital sequence of the training sentence and copying and expanding it once;

[0079] S130, converting the digital sequence into a corresponding word vector matrix, and inputting the vector matrix into a neural network classification model for pre-training to obtain a sentence encoding vector of the training sentence;

[0080] S140, obtaining a model prediction label of a training sentence through a neural network classification model, obtaining a cross entropy loss value and a KL divergence calculation loss value of two identical sentences according to the label category probability distribution of the text preset label and the model prediction label, and obtaining a total loss value according to the cross entropy loss value and the KL divergence calculation loss value;

[0081] S150, obtaining a neural network classification model with the minimum total loss through iterative training as the trained neural network classification model;

[0082] S160, removing the classifier in the neural network classification model, and using the remaining modules of the neural network classification model as feature extractors;

[0083] S170, inputting the sentence training text into the feature extractor in the trained neural network classification model to obtain a sentence encoding vector corresponding to the training sentence;

[0084] S180, obtaining a central vector corresponding to each label according to the average value of all sentence encoding vectors corresponding to each label; and

[0085] S190, respectively normalize the central vector of the same label and each sentence encoding vector and then obtain the similarity between the two, and for each label, extract the training sentences corresponding to the W sentence encoding vectors with the highest similarity as the core sentences.

[0086] In a preferred embodiment, in step S110, the preset text preset tags include: intention category tags and / or emotion category tags.

[0087] In a preferred embodiment, step S120 includes the following steps:

[0088] S121, performing Chinese word segmentation on the sentence training text to obtain words;

[0089] S122, establishing a word-to-number index dictionary based on the result of Chinese word segmentation;

[0090] S123, converting the text sequence of words into a corresponding original digital sequence according to the index dictionary;

[0091] S124, copy the original digital sequence of each sentence once to obtain an expanded digital sequence.

[0092] In a preferred embodiment, in step S130, the neural network classification model is a Bert text classification neural network.

[0093] In a preferred embodiment, step S140 includes the following steps:

[0094] S141, use the Bert text classification neural network pre-training, directly pass it into the two fully connected layers, and calculate the cross entropy loss value loss1 of each type of label according to the preset text label and the label category probability distribution predicted by the model:

[0095]

[0096] Wherein, N is the total number of training sentences with each type of the text preset label, and M is the total number of types of the text preset labels;

[0097] y ijis a first matrix of which text preset label the model predicted label of the i-th training sentence label under the j-th category label belongs to, wherein the element value corresponding to the text preset label that is the same as the model predicted label in the first matrix is ​​1, and the element value corresponding to the other text preset labels is 0;

[0098] p ij is a second matrix with the probability that the model predicted label of the i-th training sentence label under the j-th category label belongs to each category of text preset label as element values, and the sum of all the element values ​​in the second matrix is ​​1;

[0099] S142. Calculate the loss value loss2 of this type of label based on the KL divergence of the original digital sequence and the expanded digital sequence:

[0100]

[0101] Among them, y1 is the sentence encoding vector corresponding to the original digital sequence, and y2 is the sentence encoding vector corresponding to the original digital sequence;

[0102] S143. Obtain the total loss value loss of this type of label:

[0103] loss = loss1 + α × loss2;

[0104] The value range of α is (0, 5].

[0105] In a preferred embodiment, in step S150, the Adam optimization algorithm is used to perform iterative training to obtain a neural network classification model with the minimum total loss as the trained neural network classification model.

[0106] In a preferred embodiment, step S190 includes the following steps:

[0107] S191. Obtain the cosine value similarity of the angle between the center vector and the sentence encoding vector with the same label:

[0108]

[0109] Among them, A i Encode vectors for sentences with the same label, B i is the center vector of the same label;

[0110] S192, sorting the similarities from large to small;

[0111] S193. Extract the training sentences corresponding to the top f(x) sentence encoding vectors as the core sentences of the label.

[0112] Preferably, in step S190, as the total number of training sentences corresponding to the label increases, the ratio of the number of core sentences corresponding to the label to the total number of training sentences decreases, and the ratio f(x)=W / x, and

[0113]

[0114] The operation of the core sentence extraction model of the present invention first receives the corpus data with labels, vectorizes the text, inputs it into the model, and then obtains the core sentences through calculation of the above model. The specific implementation of the present invention is as follows:

[0115] (1) Collect tens of thousands of user comments or chat records and manually label them. The labels can be the intent, emotion, or intention that needs to be identified. Use them as training data, and resample and undersample the training data by replication and random sampling.

[0116] (2) Perform preliminary processing on the sampled data, including word segmentation, generating a word-to-number index dictionary, converting the word text sequence into its corresponding number sequence according to the index dictionary, and copying and expanding the number sequence of each sentence once to implement R-drop. R-drop regards the results obtained through data amplification as positive sample pairs, and regards other samples in the same batch as negative sample pairs. R-drop (Regularized Dropout) applies the idea of ​​"Dropout twice" to supervised tasks, and almost every experimental result has achieved significant improvement.

[0117] (3) The digital sequence of the text is converted into the corresponding word vector matrix, and the vector matrix is ​​input into BERT for pre-training.

[0118] (4) Use the Bert text classification neural network pre-training, directly pass it into the two fully connected layers, and calculate the cross entropy loss value loss1 of each type of label based on the text preset label and the label category probability distribution predicted by the model:

[0119]

[0120] Where N is the number of training sentences with text preset labels, y i Preset labels for various types of text, The probability that the model-predicted label obtained for the training sentence with the preset label of this type of text is the same as the preset label of the text;

[0121] According to the KL divergence of the original digital sequence and the expanded digital sequence, the loss value loss2 of this type of label is calculated:

[0122]

[0123] Among them, y1 is the sentence encoding vector corresponding to the original digital sequence, y2 is the sentence encoding vector corresponding to the original digital sequence, and relative entropy, also known as Kullback-Leibler divergence or information divergence, is an asymmetric measure of the difference between two probability distributions. In information theory, relative entropy is equivalent to the difference between the information entropy (Shannon entropy) of two probability distributions. Since KL divergence is an existing algorithm, it will not be repeated here.

[0124] Get the total loss value loss of this type of label:

[0125] loss = loss1 + α × loss2;

[0126] The value range of α is (0, 5].

[0127] The model is pre-trained with labeled data to obtain the feature information of intent. Specifically, the feature representation is learned under the supervision of cross entropy loss, and loss2 (symmetric KL divergence) is used to reduce the distance between similar samples and increase the distance between negative samples. In other words, the similarity between almost identical sentences is higher and that between different sentences is lower, which is beneficial for sentence matching later.

[0128] (5) Use the Adam (Adaptive Moment Estimation) optimization algorithm to minimize the loss, and continuously iterate the training to obtain a classification model that can finally identify the intent well. Adam based on adaptive estimation of low-order moments is a stochastic objective function optimization algorithm based on first-order gradient.

[0129] (6) After pre-training, remove the classifier (softmax layer) and use the rest of the network as a feature extractor in the subsequent process.

[0130] (7) We then feed all the corpus into the feature extractor in (5) to obtain the encoding of each sentence.

[0131] (8) Determine the label center point based on the average value of the sentence encoding under each label.

[0132] (9) Calculate the similarity (dot product) between each sentence under the label and the center point and perform normalization, that is, calculate the cosine value of the angle:

[0133]

[0134] Among them, A i Encode vectors for sentences with the same label, B i is the center vector of the same label; since calculating the cosine value of the angle between two vectors is an existing algorithm, it will not be repeated here.

[0135] And sort by similarity with the center point, and extract different numbers of core sentences according to the number of sentences under the label x (the larger the number of sentences under the label, the smaller the proportion of core sentences to the sentences under the label). In actual use, the proportion of core sentences can be adjusted by yourself, and the calculation amount and model effect are considered before selecting the appropriate proportion. For example, the number of core sentences can be obtained by the following formula

[0136]

[0137] f(x) is the proportion of the label, x is the number of labels, and the proportion of the above different segments can be tuned for hyperparameters for different data sets. The comparison of the effect of using the above segmentation proportion strategy and the unified 10% proportion is shown in the following table. The similarity between all non-core sentences and the core sentences under each label is compared. If the sentence label is the same as the label with the highest similarity to the core sentence, it is considered correct, otherwise it is wrong, and its accuracy is calculated in this way. Under the same test environment, the accuracy of sentence matching for extracting core sentences using the unified proportion of the prior art is 92.31%, and the accuracy of the segmentation proportion of the present invention is 93.05%. It can be seen that after adopting the segmentation proportion, the effect of extracting core sentences is improved.

[0138] In a specific implementation scenario of extracting core sentences, the evaluation index is: compare the similarity between all non-core sentences and the core sentences under each label. If the sentence label is the same as the label with the highest similarity to the core sentence, it is considered correct, otherwise it is wrong. The accuracy is calculated in this way.

[0139] Data: In the product label dataset, there are 68,485 sentences with 237 different labels, and the sentences under the labels are unevenly distributed. In the question feedback dataset, there are 1,000 sentences with 32 different labels. The effect of extracting core sentences in the product label dataset is 93.05%, and the effect of extracting core sentences in the question feedback dataset is 99.88%.

[0140] Application scenario: Now compare the sentence matching effects before and after removing redundant data. The accuracy of sentence matching and the time consumed are used as evaluation indicators. The accuracy of sentence matching effect of core sentence matching is 94.89%, which takes 67.5s; the accuracy of sentence matching effect of all corpus matching is 95.54%, which takes 1675s. Among them, the number of core sentences is 2903 sentences, and the original data volume of the corpus is 68485 sentences. It can be seen that the sentence matching effect is not much different after extracting the core sentences through the present invention, but the time consumption is greatly shortened.

[0141] Figure 2 Schematic diagram of the module of the core sentence extraction system of the classification label of the present invention. Figure 2 As shown, the core sentence extraction system 5 of the classification label of the present invention includes:

[0142] The sample providing module 51 provides sentence training texts, wherein each training sentence in the sentence training texts has at least one text preset label;

[0143] The digital sequence module 52 performs Chinese word segmentation on the sentence training text to obtain words, converts the text of the words in the training sentence into corresponding numbers in turn according to a preset index dictionary, obtains the digital sequence of the training sentence and copies and expands it once;

[0144] The network pre-training module 53 converts the digital sequence into a corresponding word vector matrix, and the vector matrix is ​​respectively input into the neural network classification model for pre-training to obtain the sentence encoding vector of the training sentence;

[0145] A total loss calculation module 54 obtains the model prediction label of the training sentence through the neural network classification model, obtains the cross entropy loss and the KL divergence calculation loss of two identical sentences according to the label category probability distribution of the text preset label and the model prediction label, and obtains the total loss according to the cross entropy loss and the KL divergence calculation loss;

[0146] Iterative training module 55, which obtains the neural network classification model with the minimum total loss through iterative training as the trained neural network classification model;

[0147] A feature extraction module 56 removes the classifier in the neural network classification model and uses the remaining modules of the neural network classification model as feature extractors;

[0148] A sentence encoding module 57 inputs the sentence training text into a feature extractor in the trained neural network classification model to obtain a sentence encoding vector corresponding to the training sentence;

[0149] A central vector module 58 obtains a central vector corresponding to each label according to the average value of all sentence encoding vectors corresponding to each label; and

[0150] The core sentence module 59 normalizes the central vector of the same label and each sentence encoding vector and obtains the similarity between the two. For each label, the training sentences corresponding to the f(x) sentence encoding vectors with the highest similarity are extracted as core sentences.

[0151] The core sentence extraction system of the classification label of the present invention can remove some redundant data through deep learning, greatly improve the accuracy of selecting core sentences in the neural network classification model, and greatly reduce the model calculation cost.

[0152] The above embodiments are only preferred examples of the present invention and are not intended to limit the present invention. Any equivalent substitutions, modifications and changes made within the principles of the present invention are within the protection scope of the present invention.

[0153] The embodiment of the present invention also provides a core sentence extraction device for a classification label, comprising a processor and a memory in which executable instructions of the processor are stored, wherein the processor is configured to execute the steps of the core sentence extraction method of the classification label by executing the executable instructions.

[0154] As shown above, the core sentence extraction system of the classification label of this embodiment of the present invention can remove some redundant data through deep learning, greatly improve the accuracy of selecting core sentences in the neural network classification model, and greatly reduce the model calculation cost.

[0155] It will be appreciated by those skilled in the art that various aspects of the present invention may be implemented as systems, methods or program products. Therefore, various aspects of the present invention may be specifically implemented in the following forms, namely: complete hardware implementation, complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software implementations, which may be collectively referred to herein as "circuits", "modules" or "platforms".

[0156] Figure 3 This is a schematic diagram of the structure of the core sentence extraction device of the classification label of the present invention. Figure 3 The electronic device 600 according to this embodiment of the present invention is described. Figure 3 The electronic device 600 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0157] like Figure 3 As shown, the electronic device 600 is in the form of a general computing device. The components of the electronic device 600 may include, but are not limited to: at least one processing unit 610, at least one storage unit 620, a bus 630 connecting different platform components (including the storage unit 620 and the processing unit 610), a display unit 640, etc.

[0158] The storage unit stores program codes, which can be executed by the processing unit 610, so that the processing unit 610 executes the steps of various exemplary embodiments of the present invention described in the electronic prescription circulation processing method section of this specification. For example, the processing unit 610 can execute the following steps: Figure 1 Follow the steps shown in .

[0159] The storage unit 620 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 6201 and / or a cache memory unit 6202 , and may further include a read-only memory unit (ROM) 6203 .

[0160] The storage unit 620 may also include a program / utility 6204 having a set (at least one) of program modules 6205, such program modules 6205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0161] Bus 630 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0162] The electronic device 600 may also communicate with one or more external devices 700 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 600, and / or communicate with any device that enables the electronic device 600 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 650. Furthermore, the electronic device 600 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 660. The network adapter 660 may communicate with other modules of the electronic device 600 via a bus 630. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 600, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage platforms, etc.

[0163] The embodiment of the present invention also provides a computer-readable storage medium for storing a program, and the steps of the core sentence extraction method of the classification label are implemented when the program is executed. In some possible implementations, various aspects of the present invention can also be implemented in the form of a program product, which includes a program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps of various exemplary embodiments of the present invention described in the above-mentioned electronic prescription circulation processing method section of this specification.

[0164] As shown above, the core sentence extraction system of the classification label of this embodiment of the present invention can remove some redundant data through deep learning, greatly improve the accuracy of selecting core sentences in the neural network classification model, and greatly reduce the model calculation cost.

[0165] Figure 4 Schematic diagram of the structure of the computer-readable storage medium of the present invention. Figure 4 As shown, a program product 800 for implementing the above method according to an embodiment of the present invention is described, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.

[0166] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0167] Computer readable storage media may include data signals propagated in baseband or as part of a carrier wave, wherein readable program codes are carried. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The readable storage medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, device, or device. The program codes contained on the readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination thereof.

[0168] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).

[0169] In summary, the purpose of the present invention is to provide a method, system, device and storage medium for extracting core sentences of classification labels, which can remove some redundant data through deep learning, greatly improve the accuracy of selecting core sentences in the neural network classification model, and greatly reduce the model calculation cost.

[0170] The above contents are further detailed descriptions of the present invention in combination with specific preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as falling within the scope of protection of the present invention.

Claims

1. A method for extracting core sentences of classification labels, characterized in that: The following steps are involved: S110, providing sentence training text, wherein each training sentence in the sentence training text has at least one text preset label; S120, performing Chinese word segmentation on the sentence training text to obtain words; Establishing the word-to-number index dictionary according to the result of the Chinese word segmentation; Convert the text sequence of the words into a corresponding original digital sequence according to the index dictionary; copy the original digital sequence of each sentence once to obtain an expanded digital sequence; S130, converting the digital sequence into a corresponding word vector matrix, and inputting the vector matrix into a neural network classification model for pre-training to obtain a sentence encoding vector of the training sentence; S140, using the Bert text classification neural network pre-training, directly passing it into two fully connected layers, and calculating the cross entropy loss value loss1 of each type of label according to the preset text label and the label category probability distribution predicted by the model: Wherein, N is the total number of training sentences with each type of the text preset label, and M is the total number of types of the text preset label; y ij is a first matrix of which text preset label the model predicted label of the i-th training sentence label under the j-th category label belongs to, wherein the element value corresponding to the text preset label that is the same as the model predicted label in the first matrix is ​​1, and the element value corresponding to the other text preset labels is 0; ij It is a second matrix with the probability that the model predicted label of the i-th training sentence label under the j-th category label belongs to each category of text preset label as the element value, and the sum of all the element values ​​in the second matrix is ​​1; the loss value loss2 of the label of this category is calculated according to the KL divergence of the original digital sequence and the expanded digital sequence: Among them, y1 is the sentence encoding vector corresponding to the original digital sequence, and y2 is the sentence encoding vector corresponding to the expanded digital sequence; Get the total loss value loss of the label described in this class: loss = loss1 + α × loss2; Among them, the value range of α is (0,5]; S150, obtaining a neural network classification model with the minimum total loss through iterative training as the trained neural network classification model; S170, inputting the sentence training text into a feature extractor in a trained neural network classification model to obtain a sentence encoding vector corresponding to the training sentence; S180, obtaining a central vector corresponding to each of the labels according to the average value of all the sentence encoding vectors corresponding to each of the labels; and S190, respectively normalize the center vector of the same label and each of the sentence encoding vectors to obtain the similarity between the two, and for each of the labels, extract the training sentences corresponding to the W sentence encoding vectors with the highest similarity as core sentences.

2. The core sentence extraction method of the classification label according to claim 1 is characterized in that: After step S150 and before step S170, the following steps are further included: S160, removing the classifier in the neural network classification model, and using the remaining modules of the neural network classification model as feature extractors.

3. The core sentence extraction method of the classification label according to claim 1 is characterized in that: In the step S110, the preset text preset tags include: intention category tags and / or emotion category tags.

4. The core sentence extraction method of the classification label according to claim 1 is characterized in that: In step S130, the neural network classification model is a Bert text classification neural network.

5. The core sentence extraction method of the classification label according to claim 1 is characterized in that: In step S150, the Adam optimization algorithm is used to perform iterative training to obtain a neural network classification model with the minimum total loss as the trained neural network classification model.

6. A core sentence extraction system for classification tags, used to implement the core sentence extraction method for classification tags according to claim 1, characterized in that: include: A sample providing module provides sentence training texts, wherein each training sentence in the sentence training texts has at least one text preset label; A digital sequence module performs Chinese word segmentation on the sentence training text to obtain words, converts the text of the words in the training sentence into corresponding numbers in sequence according to a preset index dictionary, obtains the digital sequence of the training sentence and copies and expands it once; A network pre-training module converts the digital sequence into a corresponding word vector matrix, and the vector matrix is ​​respectively input into a neural network classification model for pre-training to obtain a sentence encoding vector of the training sentence; A total loss calculation module, which obtains the model prediction label of the training sentence through the neural network classification model, obtains the cross entropy loss and the KL divergence calculation loss of two identical sentences according to the label category probability distribution of the text preset label and the model prediction label, and obtains the total loss according to the cross entropy loss and the KL divergence calculation loss; Iterative training module, which obtains the neural network classification model with the minimum total loss through iterative training as the trained neural network classification model; A sentence encoding module, inputting the sentence training text into a feature extractor in a trained neural network classification model to obtain a sentence encoding vector corresponding to the training sentence; A central vector module, which obtains a central vector corresponding to each label according to an average value of all the sentence encoding vectors corresponding to each label; as well as The core sentence module normalizes the central vector of the same label and each sentence encoding vector and then obtains the similarity between the two. For each label, the training sentences corresponding to the W sentence encoding vectors with the highest similarity are extracted as core sentences.

7. A core sentence extraction device for classification labels, characterized in that: include: processor; a memory storing executable instructions of the processor; Wherein, the processor is configured to perform the steps of the core sentence extraction method of the classification label according to any one of claims 1 to 5 by executing the executable instructions.

8. A computer-readable storage medium for storing a program, characterized in that: When the program is executed by a processor, the steps of the core sentence extraction method of the classification label described in any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Neural network and tag library-based statement similarity algorithm

    CN101777042A

  • Method and device for recognizing sentence

    CN104516986A

  • Method and device for determining core statements of texts

    CN107797990A

  • Short text classification method based on semantic enhancement and multi-level label embedding

    CN110866117A

  • Article reading comprehension answer retrieval system and device based on machine learning

    CN111241848A