Subject information extraction method and device

Through the fusion calculation of the semantic information extraction model and the multi-head attention model, the problem of low correlation in the theme extraction of long text is solved, the accuracy and objectivity of theme information is improved, and more accurate long text understanding is achieved.

CN114936565BActive Publication Date: 2024-12-20BEIJING KINGSOFT DIGITAL ENTERTAINMENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210790551.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-06
Publication Date
2024-12-20
Estimated Expiration
2042-07-06

AI Technical Summary

Technical Problem

In the prior art, the long text theme extraction method has low correlation between short text paragraphs, resulting in low accuracy of the theme information extraction and cannot effectively reflect the overall content of the long text.

Method used

The pre-trained semantic information extraction model and the multi-head attention model are used to obtain the fusion calculation of the semantic information feature vector and the word type feature vector to determine the main information of the to be processed text, and comprehensively consider the context semantics and part-of-speech characteristics.

Benefits of technology

It improves the accuracy of the extraction of topic information, ensures the accurate extraction and reflection of long text themes, and enhances the objectivity of text understanding.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114936565B_ABST
    Figure CN114936565B_ABST
Patent Text Reader

Abstract

The present application provides a method and device for extracting subject information, wherein the method for extracting subject information includes: obtaining a text to be processed, inputting the text to be processed into a pre-trained semantic information extraction model, obtaining a semantic information feature vector, inputting the semantic information feature vector into a pre-trained multi-head attention model, obtaining a word type feature vector in the text to be processed, performing a fusion calculation on the semantic information feature vector and the word type feature vector, obtaining a fusion result, and determining the subject information of the text to be processed based on the fusion result. The input text to be processed is semantically analyzed by the semantic information extraction model to obtain the contextual semantics of the text to be processed, that is, the semantic information feature vector, and then the semantic information feature vector is processed by the multi-head attention model to obtain the word type feature vector, which comprehensively considers the text to be processed, effectively ensures that the subject information of the text to be processed is extracted, and thus improves the accuracy of subject information extraction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a subject information extraction method. The present application also relates to a subject information extraction device, a computing device, and a computer-readable storage medium. Background Art

[0002] With the development of Internet technology, in the reading comprehension task of natural language processing (NLP), due to the large amount of content and length of long texts, in order to facilitate users to simply and quickly understand the main content of the long text before reading it and determine whether to continue reading the long text, automatic extraction of the main content of the long text has gradually become a research focus in the reading comprehension task.

[0003] The current method for extracting the main idea of ​​a long text is generally to cut the long text into short texts, use the keyword extraction method to obtain each main idea in the short text paragraph, calculate the probability of each main idea in the short text paragraph, and then splice and sort each main idea to obtain the main idea of ​​the long text. However, using this method, the main idea probability of each short text is calculated independently, and the correlation between short texts is low. The result of splicing and sorting based on the main idea calculated independently for each short text is not objective, which greatly affects the accuracy of extracting the main idea information of the text. Summary of the invention

[0004] In view of this, the embodiment of the present application provides a subject information extraction method to solve the technical defects existing in the prior art. The embodiment of the present application also provides a subject information extraction device, a computing device, and a computer-readable storage medium.

[0005] According to a first aspect of an embodiment of the present application, a subject information extraction method is provided, comprising:

[0006] Get the text to be processed;

[0007] Input the text to be processed into a pre-trained semantic information extraction model to obtain a semantic information feature vector;

[0008] Input the semantic information feature vector into the pre-trained multi-head attention model to obtain the word type feature vector in the text to be processed;

[0009] Perform fusion calculation on the semantic information feature vector and the word type feature vector to obtain a fusion result;

[0010] According to the fusion results, the main information of the text to be processed is determined.

[0011] Optionally, the step of inputting the text to be processed into a pre-trained semantic information extraction model to obtain a semantic information feature vector includes:

[0012] The text to be processed is input into a pre-trained semantic information extraction model, and the hidden layer output of the semantic information extraction model is obtained as a semantic information feature vector.

[0013] Optionally, before the step of inputting the to-be-processed text into a pre-trained semantic information extraction model to obtain a semantic information feature vector, the method further includes:

[0014] Perform vectorization processing on the text to be processed to obtain the vectorized text to be processed;

[0015] The step of inputting the text to be processed into a pre-trained semantic information extraction model to obtain a semantic information feature vector includes:

[0016] The vectorized text to be processed is input into a pre-trained semantic information extraction model to obtain a semantic information feature vector.

[0017] Optionally, before the step of vectorizing the text to be processed to obtain the vectorized text to be processed, the method further includes:

[0018] Perform word segmentation on the text to be processed to obtain the word segmentation result;

[0019] The steps of vectorizing the text to be processed to obtain the vectorized text to be processed include:

[0020] The word segmentation results are vectorized to obtain word segmentation vectorization information of the text to be processed, wherein the word segmentation vectorization information includes each word segmentation vector.

[0021] Optionally, the step of inputting the vectorized text to be processed into a pre-trained semantic information extraction model to obtain a semantic information feature vector includes:

[0022] Bundle each word segmentation vector to obtain multiple bundled vectors of the text to be processed;

[0023] Input each bundling vector into a pre-trained semantic information extraction model in sequence to obtain a semantic information feature vector corresponding to each bundling vector;

[0024] The steps of inputting the semantic information feature vector into the pre-trained multi-head attention model to obtain the word type feature vector in the text to be processed include:

[0025] For each bundling vector, input the semantic information feature vector corresponding to the bundling vector into the pre-trained multi-head attention model to obtain the word type feature vector corresponding to the bundling vector;

[0026] The steps of fusing the semantic information feature vector and the word type feature vector to obtain a fusion result include:

[0027] For each bundling vector, a fusion calculation is performed on the semantic information feature vector and the word type feature vector corresponding to the bundling vector to obtain a fusion result corresponding to the bundling vector;

[0028] The steps of determining the main information of the text to be processed according to the fusion result include:

[0029] Analyze the fusion results corresponding to each bundled vector to determine the main information of the text to be processed.

[0030] Optionally, the word segmentation vectorization information also includes position information of each word segmentation vector;

[0031] The steps of inputting the semantic information feature vector into the pre-trained multi-head attention model to obtain the word type feature vector in the text to be processed include:

[0032] For each word segmentation vector, the semantic feature vector corresponding to the word segmentation vector and the position information of the word segmentation vector are input into the pre-trained multi-head attention model to obtain the query vector, key vector and value vector corresponding to the word segmentation vector;

[0033] Based on the query vector, the key vector and the value vector, the word score of the word segmentation vector is calculated, and the word score is normalized to obtain a normalized word score;

[0034] The normalized word scores are used to weight each word segmentation vector to obtain the word type feature vector in the text to be processed.

[0035] Optionally, the step of performing fusion calculation on the semantic information feature vector and the word type feature vector to obtain a fusion result includes:

[0036] Perform dot product operation on the semantic information feature vector and the word type feature vector to obtain the fusion result.

[0037] Optionally, the step of determining the subject information of the text to be processed according to the fusion result includes:

[0038] The fusion result is input into the decoder to obtain the main information of the text to be processed.

[0039] According to a second aspect of an embodiment of the present application, there is provided a subject information extraction device, comprising:

[0040] An acquisition module, configured to acquire text to be processed;

[0041] A semantic information feature vector generation module is configured to input the text to be processed into a pre-trained semantic information extraction model to obtain a semantic information feature vector;

[0042] A word type feature vector generation module is configured to input the semantic information feature vector into a pre-trained multi-head attention model to obtain a word type feature vector in a to-be-processed text;

[0043] A fusion result generating module is configured to perform fusion calculation on the semantic information feature vector and the word type feature vector to obtain a fusion result;

[0044] The subject information determination module is configured to determine the subject information of the text to be processed according to the fusion result.

[0045] Optionally, the semantic information feature vector generation module is further configured to input the text to be processed into a pre-trained semantic information extraction model, and obtain the hidden layer output of the semantic information extraction model as the semantic information feature vector.

[0046] Optionally, the device further comprises:

[0047] A vectorization processing module is configured to perform vectorization processing on the text to be processed to obtain the vectorized text to be processed;

[0048] The semantic information feature vector generation module is further configured to input the vectorized text to be processed into a pre-trained semantic information extraction model to obtain a semantic information feature vector.

[0049] Optionally, the device further comprises:

[0050] A word segmentation processing module is configured to perform word segmentation processing on the text to be processed to obtain a word segmentation result;

[0051] The vectorization processing module is further configured to perform vectorization processing on the word segmentation results to obtain word segmentation vectorization information of the text to be processed, wherein the word segmentation vectorization information includes each word segmentation vector.

[0052] Optionally, the semantic information feature vector generation module is further configured to perform bundling processing on each word segmentation vector to obtain multiple bundling vectors of the text to be processed; input each bundling vector into a pre-trained semantic information extraction model in sequence to obtain a semantic information feature vector corresponding to each bundling vector;

[0053] The word type feature vector generation module is further configured to input, for each bundling vector, a semantic information feature vector corresponding to the bundling vector into a pre-trained multi-head attention model to obtain a word type feature vector corresponding to the bundling vector;

[0054] The fusion result generating module is further configured to perform fusion calculation on the semantic information feature vector and the word type feature vector corresponding to each bundling vector to obtain a fusion result corresponding to the bundling vector;

[0055] The subject information determination module is further configured to analyze the fusion results corresponding to each bundling vector to determine the subject information of the text to be processed.

[0056] Optionally, the word segmentation vectorization information also includes position information of each word segmentation vector;

[0057] The word type feature vector generation module is further configured to input the semantic feature vector corresponding to each word segmentation vector and the position information of the word segmentation vector into a pre-trained multi-head attention model to obtain the query vector, key vector and value vector corresponding to the word segmentation vector; based on the query vector, key vector and value vector, calculate the word score of the word segmentation vector, normalize the word score, and obtain the normalized word score; use the normalized word score to weight each word segmentation vector to obtain the word type feature vector in the text to be processed.

[0058] Optionally, the fusion result generating module is further configured to perform a dot product operation on the semantic information feature vector and the word type feature vector to obtain a fusion result.

[0059] Optionally, the subject information determination module is further configured to input the fusion result into a decoder to obtain the subject information of the text to be processed.

[0060] According to a third aspect of an embodiment of the present application, a computing device is provided, including:

[0061] Memory and processor;

[0062] The memory is used to store computer-executable instructions, and the processor implements the steps of the subject information extraction method when executing the computer-executable instructions.

[0063] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, which stores computer-executable instructions, and when the instructions are executed by a processor, the steps of the subject information extraction method are implemented.

[0064] According to a fifth aspect of an embodiment of the present application, a chip is provided, which stores a computer program, and the computer program implements the steps of the subject information extraction method when executed by the chip.

[0065] The main information extraction method provided by the present application obtains the text to be processed, inputs the text to be processed into a pre-trained semantic information extraction model, obtains the semantic information feature vector, inputs the semantic information feature vector into a pre-trained multi-head attention model, obtains the word type feature vector in the text to be processed, and fuses the semantic information feature vector and the word type feature vector to obtain the fusion result, and determines the main information of the text to be processed according to the fusion result. The input text to be processed is semantically analyzed by the semantic information extraction model to obtain the contextual semantics of the text to be processed, that is, the semantic information feature vector, and then the semantic information feature vector is processed by the multi-head attention model to obtain the part-of-speech type of the word, that is, the word type feature vector, and the semantic information feature vector and the word type feature vector are fused. According to the fusion result, the main information of the text to be processed is determined, and the contextual semantics of the text to be processed and the part-of-speech of the word are comprehensively considered, which effectively ensures that the main information of the text to be processed is extracted, thereby improving the accuracy of the main information extraction. BRIEF DESCRIPTION OF THE DRAWINGS

[0066] Figure 1a It is a processing flow diagram of a subject information extraction method in a subject information extraction system provided in one embodiment of the present application;

[0067] Figure 1b It is a processing flow diagram of another subject information extraction method in a subject information extraction system provided in an embodiment of the present application;

[0068] Figure 2 is a flow chart of a first subject information extraction method provided by an embodiment of the present application;

[0069] Figure 3 is a flow chart of a second subject information extraction method provided by an embodiment of the present application;

[0070] Figure 4 is a flowchart of a third subject information extraction method provided by an embodiment of the present application;

[0071] Figure 5 is a flowchart of a fourth subject information extraction method provided by an embodiment of the present application;

[0072] Figure 6 is a flowchart of a fifth subject information extraction method provided by an embodiment of the present application;

[0073] Figure 7 is a flowchart of a sixth subject information extraction method provided by an embodiment of the present application;

[0074] Figure 8 is a flowchart of a seventh subject information extraction method provided by an embodiment of the present application;

[0075] Fig. 9 is a flowchart of an eighth subject information extraction method provided by an embodiment of the present application;

[0076] Fig.10 is a flowchart of a ninth subject information extraction method provided by an embodiment of the present application;

[0077] Fig.11 It is a structural schematic diagram of a subject information extraction device provided by an embodiment of the present application;

[0078] Fig.12 It is a structural block diagram of a computing device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0079] Many specific details are described in the following description to facilitate a full understanding of the present application. However, the present application can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present application, so the present application is not limited by the specific implementation disclosed below.

[0080] The terms used in one or more embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of the present application. The singular forms of "a", "said" and "the" used in one or more embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of the present application refers to and includes any or all possible combinations of one or more associated listed items.

[0081] It should be understood that, although the terms first, second, etc. may be used to describe various information in one or more embodiments of the present application, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of the present application, the first may also be referred to as the second, and similarly, the second may also be referred to as the first.

[0082] First, the terms involved in one or more embodiments of the present invention are explained.

[0083] Term frequency (TF): refers to the number of times a given word appears in the document.

[0084] Inverse document frequency (IDF): is a measure of the general importance of a word. The inverse document frequency of a particular word can be calculated by dividing the total number of documents by the number of documents containing the word and taking the base 10 logarithm of the quotient.

[0085] Stop words: In information retrieval, in order to save storage space and improve search efficiency, certain characters or words are automatically filtered out before or after processing natural language data (or text). These characters or words are called Stop Words.

[0086] Optical Character Recognition (OCR) refers to the process of obtaining text and layout information by analyzing and processing image files after scanning text materials. The main indicators for measuring the performance of OCR systems include rejection rate, false recognition rate, recognition speed, user interface friendliness, product stability, ease of use and feasibility, etc.

[0087] One-Hot encoding: also known as one-bit effective encoding, mainly uses an N-bit state register to encode N states. Each state has its own independent register bit, and only one bit is valid at any time.

[0088] Encoder: A device that can compile and convert signals (such as bit streams) or data into a signal form that can be used for communication, transmission and storage.

[0089] Decoder: A hardware / software device that can decode digital audio and video data streams and restore them into analog audio and video signals.

[0090] In the present application, a subject information extraction method is provided. The present application also relates to a subject information extraction device, a computing device, and a computer-readable storage medium, which are described in detail one by one in the following embodiments.

[0091] Figure 1a A schematic diagram of a processing flow of a subject information extraction method in a subject information extraction system provided according to an embodiment of the present application is shown. The subject information extraction system includes a server and an application terminal:

[0092] The server obtains the sample set sent by the application terminal, trains a preset semantic information extraction model and a preset multi-head attention model based on the sample set, and sends the trained semantic information extraction model and the trained multi-head attention model to the application terminal.

[0093] The application terminal receives the trained semantic information extraction model and the trained multi-head attention model, inputs the text to be processed into the pre-trained semantic information extraction model to obtain the semantic information feature vector, inputs the semantic information feature vector into the pre-trained multi-head attention model to obtain the word type feature vector in the text to be processed, performs fusion calculation on the semantic information feature vector and the word type feature vector to obtain the fusion result, and determines the main information of the text to be processed based on the fusion result.

[0094] The scheme of the embodiment of the present application is applied, by obtaining the text to be processed, inputting the text to be processed into a pre-trained semantic information extraction model, obtaining a semantic information feature vector, inputting the semantic information feature vector into a pre-trained multi-head attention model, obtaining a word type feature vector in the text to be processed, and performing fusion calculation on the semantic information feature vector and the word type feature vector to obtain a fusion result, and determining the main information of the text to be processed according to the fusion result. The input text to be processed is semantically analyzed by the semantic information extraction model to obtain the contextual semantics of the text to be processed, that is, the semantic information feature vector, and then the semantic information feature vector is processed by the multi-head attention model to obtain the part-of-speech type of the word, that is, the word type feature vector, and the semantic information feature vector and the word type feature vector are fused, and according to the fusion result, the main information of the text to be processed is determined, which comprehensively considers the contextual semantics of the text to be processed and the part-of-speech of the word, effectively ensuring that the main information of the text to be processed is extracted, thereby improving the accuracy of the extraction of the main information.

[0095] Figure 1b A schematic diagram of a processing flow of a subject information extraction method in another subject information extraction system provided according to an embodiment of the present application is shown. The subject information extraction system includes a server and an application terminal:

[0096] The server obtains the text to be processed sent by the application terminal, inputs the text to be processed into a pre-trained semantic information extraction model, obtains a semantic information feature vector, inputs the semantic information feature vector into a pre-trained multi-head attention model, obtains a word type feature vector in the text to be processed, performs a fusion calculation on the semantic information feature vector and the word type feature vector to obtain a fusion result, determines the main information of the text to be processed according to the fusion result, and sends the main information to the application terminal.

[0097] The application terminal sends the text to be processed to the server; and receives the subject information of the text to be processed sent by the server.

[0098] The scheme of the embodiment of the present application is applied, by obtaining the text to be processed, inputting the text to be processed into a pre-trained semantic information extraction model, obtaining a semantic information feature vector, inputting the semantic information feature vector into a pre-trained multi-head attention model, obtaining a word type feature vector in the text to be processed, and performing fusion calculation on the semantic information feature vector and the word type feature vector to obtain a fusion result, and determining the main information of the text to be processed according to the fusion result. The input text to be processed is semantically analyzed by the semantic information extraction model to obtain the contextual semantics of the text to be processed, that is, the semantic information feature vector, and then the semantic information feature vector is processed by the multi-head attention model to obtain the part-of-speech type of the word, that is, the word type feature vector, and the semantic information feature vector and the word type feature vector are fused, and according to the fusion result, the main information of the text to be processed is determined, which comprehensively considers the contextual semantics of the text to be processed and the part-of-speech of the word, effectively ensuring that the main information of the text to be processed is extracted, thereby improving the accuracy of the extraction of the main information.

[0099] It is worth noting that the server can not only feed back the subject information corresponding to the text to be processed sent by the application terminal to the application terminal, but also send the subject information to other application terminals connected to the server. The embodiment of the present application does not impose any limitation on this.

[0100] Figure 2 A flowchart of a first subject information extraction method provided according to an embodiment of the present application is shown, which specifically includes the following steps:

[0101] Step S202: Obtain the text to be processed.

[0102] In an embodiment of the present application, the text to be processed may be text waiting to be processed, which is generally a long text, and its text type includes but is not limited to a text file format type and a picture file format type. The text to be processed may be text in various languages, such as Chinese text, English text, etc. The embodiment of the present application does not impose any limitation on this.

[0103] In practical applications, since the text to be processed includes multiple text types, when the text to be processed is subsequently processed, different text types need to be converted into the same text type to adapt to the semantic information extraction model. Therefore, if the text to be processed is a picture file format type, and the recognition type of the semantic information extraction model is a text file type, then the text to be processed can be OCR recognized to obtain a text file of the text to be processed. Of course, other image recognition methods can also be used to obtain a text file of the text to be processed, and the embodiments of the present application do not impose any restrictions on this.

[0104] Step S204: input the text to be processed into a pre-trained semantic information extraction model to obtain a semantic information feature vector.

[0105] In an embodiment of the present application, after obtaining the text to be processed, in order to extract the semantic relationship of the context of the text to be processed, the text to be processed can be input into a pre-trained semantic information extraction model, wherein the semantic information extraction model can be a bidirectional long short-term memory network model (BI-LSTM, Bi-directional Long Short-Term Memory), or other models that can extract text semantic information, such as a Transformer model, and the embodiment of the present application does not impose any restrictions on this. By inputting the text to be processed into the pre-trained semantic information extraction model, a semantic information feature vector can be obtained, and the semantic information feature vector can characterize the semantic relationship of the context of the text to be processed, and effectively ensure that the main information of the text to be processed is extracted.

[0106] It should be noted that the semantic information extraction model includes at least a hidden layer and a first output layer, wherein the hidden layer can also be understood as a hidden layer. The hidden layer can abstract the features of the input data into another dimensional space to show more abstract features of the input data. These more abstract features can be better linearly divided. The semantic information extraction model can be trained by the following method: obtaining a first sample text set, wherein the first sample text set includes multiple sample texts, each sample text carries a text label, and the text label is a main word in the corresponding sample text; after obtaining the first sample text set, extracting the first sample text in the first sample text set, wherein the first sample text is any sample text in the first sample text set; performing word segmentation processing on the first sample text to obtain a first sample word segmentation result, performing vectorization processing on the first sample word segmentation result to obtain first sample word segmentation vectorization information, wherein the first sample word segmentation vectorization information includes each word segmentation vector in the first sample and the position information of each word segmentation vector; performing bundling processing on each word segmentation vector in the first sample to obtain multiple sample bundling vectors of the first sample text, respectively inputting each sample bundling vector into a preset semantic information extraction model in sequence, and the first output layer of the preset semantic information extraction model outputs a first predicted word of the first sample text; calculating a first loss value based on the first predicted word and the first text label, and comparing the first loss value with a first preset threshold. Wherein, the first text label is the text label of the first sample text.

[0107] Specifically, the bundling process can also be understood as batch processing of each word segmentation vector. For example, if there are 2000 word segmentation vectors, and a bundling process is performed on every 500 word segmentation vectors, 4 bundled vectors can be obtained.

[0108] In practical applications, the first sample text set can be obtained by manually inputting a large number of sample texts to form the first sample text set, or by reading a large number of sample texts from other data acquisition devices or databases to form the first sample text set. Generally, the text labels of each sample text in the first sample text set can be obtained by manual annotation.

[0109] It should be noted that the first loss value can be calculated based on the first predicted word and the first text label. The first text label refers to the result output by the preset semantic information extraction model, that is, the subject words included in the first text label are the real results, and the first sample text is input into the preset semantic information extraction model. The output first predicted word is the prediction result of the model. When the difference between the predicted result and the real result is small enough, it means that the predicted result is close enough to the real result. At this time, the training of the preset semantic information extraction model is completed, and a trained semantic information extraction model is obtained. In the embodiment of the present application, the difference between the predicted result and the real result of the model can be intuitively shown by calculating the first loss value. Subsequently, the preset semantic information extraction model can be targetedly trained based on the difference, and the parameters can be adjusted to effectively improve the rate of model training and the effect of model training.

[0110] In a possible implementation, whether to stop training can be determined based only on the relationship between the first loss value and the first preset threshold. Specifically, if the first loss value is greater than the first preset threshold, it means that the difference between the first predicted word and the first text label is large, and the ability of the preset semantic information extraction model to extract semantic information is poor. At this time, the model parameters of the preset semantic information extraction model can be adjusted, and the steps of extracting the first sample text in the first sample text set, performing word segmentation processing on the first sample text, and obtaining the first sample word segmentation result can be returned to continue training the preset semantic information extraction model until the first loss value is less than or equal to the first preset threshold, indicating that the difference between the first predicted word and the first text label is small, and the training is stopped to obtain the trained semantic information extraction model.

[0111] Among them, the first preset threshold is the critical value of the first loss value. When the first loss value is greater than or equal to the first preset threshold, it means that there is still a certain deviation between the prediction result of the preset semantic information extraction model and the actual result, and it is still necessary to adjust the parameters of the preset semantic information extraction model, and obtain the sample text in the first sample text set to continue training the preset semantic information extraction model; when the first loss value is less than the first preset threshold, it means that the prediction result of the preset semantic information extraction model is close enough to the actual result, and the training can be stopped. The value of the first preset threshold can be determined according to the actual situation, and the embodiment of the present application does not limit this.

[0112] In the embodiment of the present application, the specific training situation of the preset semantic information extraction model can be judged according to the first loss value, and if the training fails, the parameters of the preset semantic information extraction model can be reversely adjusted according to the first loss value to improve the analysis ability of the model. The training rate is high and the training effect is good.

[0113] In another possible implementation, in addition to comparing the relationship between the first loss value and the first preset threshold, the number of iterations can also be combined to determine whether the current semantic information extraction model has been trained. Specifically, if the first loss value is greater than the first preset threshold, it means that the difference between the first predicted word and the first text label is large, and the ability of the preset semantic information extraction model to extract semantic information is poor. At this time, the model parameters of the preset semantic information extraction model can be adjusted, and the steps of extracting the first sample text in the first sample text set, performing word segmentation processing on the first sample text, and obtaining the first sample word segmentation result are returned, and the preset semantic information extraction model is continued to be trained until the first preset number of iterations is reached, and the iteration is stopped to obtain the trained semantic information extraction model.

[0114] Among them, the first preset number of iterations is set according to actual conditions, and the embodiment of the present application does not impose any limitation on this. When the number of training times reaches the first preset number of iterations, it means that the number of training times of the preset semantic information extraction model is sufficient. At this time, the predicted result of the preset semantic information extraction model is close enough to the actual result, and the training can be stopped.

[0115] In practical applications, there are many functions for calculating the first loss value, such as cross entropy loss function, L1 norm loss function, maximum loss function, mean square error loss function, logarithmic loss function, etc. In this application, there is no limitation on the choice of function for calculating the first loss value.

[0116] Preferably, the first loss value can be calculated using a cross entropy loss function, and the cross entropy loss function is:

[0117]

[0118] Among them, C represents the number of categories, p i For truth, q i For prediction.

[0119] By using the cross entropy loss function and calculating the cross entropy between the first predicted text and the first text label as the loss value, the efficiency and accuracy of calculating the loss value are improved, making the trained semantic information extraction model more accurate.

[0120] Step S206: Input the semantic information feature vector into the pre-trained multi-head attention model to obtain the word type feature vector in the text to be processed.

[0121] In an embodiment of the present application, after obtaining the semantic information feature vector, the semantic information feature vector can be input into a pre-trained multi-head attention model (Multi-headAttention), and the attention encoder (attention-encoder) in the multi-head attention model can be used to classify the semantic information feature vector to obtain the word type feature vector in the text to be processed.

[0122] It should be noted that the multi-head attention model includes at least a feature extraction layer and a second output layer, which can be fine-tuned according to a preset attention model and trained by the following method: obtaining a second sample text set, wherein the second sample text set includes multiple sample texts and text labels corresponding to each sample text, each sample text has corresponding position information, wherein the sample text is a collection of subject words in a long text, and the text label refers to the part of speech of each subject word; after obtaining the second sample text set, extracting a second sample text from the second sample text set, wherein the second sample text is any one of the subject words in the second sample text set This text; the word vectors of each subject word in the second sample text and the position information of the word vectors of each subject word in the second sample text are input into the preset attention model, and the query vector, key vector and value vector corresponding to each word vector are obtained through the preset attention model. Based on the query vector, key vector and value vector, the word score of each word vector is calculated, and the word score is normalized to obtain the normalized word score. The normalized word score is used to weight each word vector, and the feature extraction layer of the preset attention model outputs the predicted second word type feature vector of the second sample text. Finally, the second output layer of the preset attention model outputs the predicted part of speech of the second sample text. According to the predicted part of speech and the second text label, the second loss value is calculated, and the second loss value is compared with the second preset threshold. Among them, the second text label is the text label corresponding to the second sample text.

[0123] In practical applications, the second sample text set can be obtained by manually inputting a large number of sample texts to form the second sample text set, or by reading a large number of sample texts from other data acquisition devices or databases to form the second sample text set. Generally, the second sample text can be obtained by manually searching for the main words in the long text and annotating the main words to obtain the second text label, or by manually annotating the part of speech of the second sample text from the first output layer of the above-mentioned semantic information extraction model.

[0124] It should be noted that the second loss value can be calculated based on the predicted part of speech and the second text label. The second text label refers to the result that the preset attention model actually wants to output, that is, the part of speech of each subject word included in the second text label is the real result, and the second sample text is input into the preset attention model, and the output predicted part of speech is the predicted result of the model. When the difference between the predicted result and the real result is small enough, it means that the predicted result is close enough to the real result. At this time, the training of the preset attention model is completed, and a trained multi-head attention model is obtained. In the embodiment of the present application, the difference between the predicted result and the real result of the model can be intuitively shown by calculating the second loss value. Subsequently, the preset attention model can be targetedly trained based on the difference, and the parameters can be adjusted, which can effectively improve the rate of model training and the effect of model training.

[0125] It is worth noting that since the trained multi-head attention model is accurate enough, the outputs of the feature extraction layer, output layer and other layers included in the trained multi-head attention model are also accurate enough. Therefore, by using the attention encoder in the multi-head attention model to classify the semantic information feature vector, the word type feature vector in the text to be processed can be accurately obtained.

[0126] In one possible implementation, whether to stop training can be determined based only on the relationship between the second loss value and the second preset threshold. Specifically, if the second loss value is greater than the second preset threshold, it means that the difference between the predicted part of speech and the second text label is large, and the classification ability of the preset attention model is poor. At this time, the model parameters of the preset attention model can be adjusted, and the steps of extracting the second sample text in the second sample set, inputting the position information of the second sample text and the second sample text into the preset attention model, and obtaining the query vector, key vector and value vector corresponding to the second sample text are returned to the preset attention model, and the preset attention model is continued to be trained until the second loss value is less than or equal to the second preset threshold, indicating that the difference between the predicted part of speech and the second text label is small, and the training is stopped to obtain the trained multi-head attention model.

[0127] In another possible implementation, in addition to comparing the relationship between the second loss value and the second preset threshold, the number of iterations can also be combined to determine whether the current attention model has been trained. Specifically, if the second loss value is greater than the second preset threshold, it means that the difference between the predicted part of speech and the second text label is large, and the classification ability of the preset attention model is poor. At this time, the model parameters of the preset attention model can be adjusted, and the steps of extracting the second sample text in the second sample set, inputting the position information of the second sample text and the second sample text into the preset attention model, and obtaining the query vector, key vector and value vector corresponding to the second sample text are returned to train the preset attention model until the second preset number of iterations is reached, and then the iteration is stopped to obtain the trained multi-head attention model.

[0128] Among them, the second preset number of iterations is set according to actual conditions, and the embodiment of the present application does not impose any limitation on this.

[0129] In practical applications, there are many functions for calculating the second loss value, such as cross entropy loss function, L1 norm loss function, maximum loss function, mean square error loss function, logarithmic loss function, etc. In this application, there is no limitation on the choice of function for calculating the second loss value.

[0130] Step S208: performing fusion calculation on the semantic information feature vector and the word type feature vector to obtain a fusion result.

[0131] In an embodiment of the present application, after obtaining the semantic information feature vector and the word type feature vector, the semantic information feature vector and the word type feature vector can be fused and calculated. It should be noted that the fusion calculation includes but is not limited to the dot product operation, and can also utilize pruning algorithm, dimensionality increase algorithm, sin / cos fusion algorithm, etc., which is selected according to the actual situation. The embodiment of the present application does not impose any limitation on this. The fusion result refers to the calculation result of the semantic information feature vector and the word type feature vector. Taking the dot product operation as an example, the fusion result refers to the dot product result of the semantic information feature vector and the word type feature vector, so that the results of the semantic information extraction model and the multi-head attention model are more reasonable in terms of syntax and semantics.

[0132] Step S210: Determine the main information of the text to be processed according to the fusion result.

[0133] In the embodiment of the present application, after obtaining the fusion result of the semantic information feature vector and the word type feature vector, since the fusion result is in the form of a vector, it is necessary to process the fusion result to obtain the main information of the final text to be processed, and the main information of the text to be processed is the main sentence of the text to be processed. It should be noted that the processing method of the fusion result includes but is not limited to processing the fusion result using an attention decoder (attention-decoder), and the fusion result can also be processed using a conditional random field (CRF, conditional random field), which is specifically selected according to the actual situation, and the embodiment of the present application does not impose any limitation on this.

[0134] The scheme of the embodiment of the present application is applied, by obtaining the text to be processed, inputting the text to be processed into a pre-trained semantic information extraction model, obtaining a semantic information feature vector, inputting the semantic information feature vector into a pre-trained multi-head attention model, obtaining a word type feature vector in the text to be processed, and performing fusion calculation on the semantic information feature vector and the word type feature vector to obtain a fusion result, and determining the main information of the text to be processed according to the fusion result. The input text to be processed is semantically analyzed by the semantic information extraction model to obtain the contextual semantics of the text to be processed, that is, the semantic information feature vector, and then the semantic information feature vector is processed by the multi-head attention model to obtain the part-of-speech type of the word, that is, the word type feature vector, and the semantic information feature vector and the word type feature vector are fused, and according to the fusion result, the main information of the text to be processed is determined, which comprehensively considers the contextual semantics of the text to be processed and the part-of-speech of the word, effectively ensuring that the main information of the text to be processed is extracted, thereby improving the accuracy of the extraction of the main information.

[0135] Figure 3 A flowchart of a second subject information extraction method provided according to an embodiment of the present application is shown, which specifically includes the following steps:

[0136] Step S302: Obtain the text to be processed.

[0137] Among them, step S302 is the same as step S202, and will not be described in detail in this embodiment.

[0138] Step S304: input the text to be processed into a pre-trained semantic information extraction model, and obtain the hidden layer output of the semantic information extraction model as a semantic information feature vector.

[0139] It should be noted that in a possible implementation method of the present application, the text to be processed is input into a pre-trained semantic information extraction model, the hidden layer output of the semantic information extraction model is obtained as the semantic information feature vector, and the hidden layer output of the semantic information extraction model is directly grafted onto the multi-head attention model without the need for processing by layers such as Softmax in the semantic information extraction model, thereby improving the efficiency of extracting the main information of the text.

[0140] Step S306: Input the semantic information feature vector into the pre-trained multi-head attention model, and obtain the feature extraction layer output of the multi-head attention model as the word type feature vector.

[0141] Step S308: performing fusion calculation on the semantic information feature vector and the word type feature vector to obtain a fusion result.

[0142] Step S310: Determine the main information of the text to be processed according to the fusion result.

[0143] Among them, step S306, step S308, step S310 are the same as step S206, step S208, step S210, and will not be described in detail in this embodiment.

[0144] The scheme of the embodiment of the present application is applied, by obtaining the text to be processed, inputting the text to be processed into a pre-trained semantic information extraction model, obtaining the hidden layer output of the semantic information extraction model as a semantic information feature vector, inputting the semantic information feature vector into a pre-trained multi-head attention model, obtaining the word type feature vector in the text to be processed, performing a fusion calculation on the semantic information feature vector and the word type feature vector to obtain a fusion result, and determining the main information of the text to be processed based on the fusion result. The input text to be processed is semantically analyzed through the semantic information extraction model to obtain the contextual semantics of the text to be processed, that is, the semantic information feature vector, and then the semantic information feature vector is processed by the multi-head attention model to obtain the part-of-speech type of the word, that is, the word type feature vector, and the semantic information feature vector and the word type feature vector are fused. According to the fusion result, the main information of the text to be processed is determined, and the contextual semantics of the text to be processed and the part-of-speech of the words are comprehensively considered to effectively ensure that the main information of the text to be processed is extracted, thereby improving the accuracy of the main information extraction, and directly grafting the hidden layer output of the semantic information extraction model as the semantic information feature vector to the multi-head attention model, without the need to be processed by the Softmax layer in the semantic information extraction model, thereby improving the efficiency of text main information extraction.

[0145] Figure 4 A flowchart of a third subject information extraction method provided according to an embodiment of the present application is shown, which specifically includes the following steps:

[0146] Step S402: Obtain the text to be processed.

[0147] Among them, step S402 is the same as step S202, and will not be described in detail in this embodiment.

[0148] Step S404: vectorize the text to be processed to obtain the vectorized text to be processed.

[0149] In the embodiment of the present application, after obtaining the text to be processed, since the input of the semantic information extraction model is in vector form, it is necessary to vectorize the text to be processed. It should be noted that there are many ways to vectorize the text to be processed in this application, including but not limited to One-Hot encoding vectorized text, term frequency-inverse document frequency (TF-IDF) vectorized text, hash vectorized text, etc., which are selected according to the actual situation, and the embodiment of the present application does not make any limitation on this.

[0150] In one possible implementation method, the term frequency-inverse document frequency (TF-IDF) method can be used to vectorize text. Specifically, it is assumed that each word is a dimension of the text vector, and a text is regarded as a bag of words. The order in which the words appear in the text is ignored, meaningless stop words are removed, and the number of times a word appears and its importance, that is, the term frequency-inverse document frequency (TF-IDF), can be used to calculate the term frequency feature of each word using the number of times each word appears in the text to be processed and the total number of words. The total number of texts is divided by the number of texts containing each word, and the base 10 logarithm of the quotient is taken to obtain the inverse document frequency feature of each word. Then, the importance of each word is calculated to construct a vector space.

[0151] Step S406: input the vectorized text to be processed into a pre-trained semantic information extraction model to obtain a semantic information feature vector.

[0152] In an embodiment of the present application, after obtaining the vectorized text to be processed, in order to extract the high-order semantic information of the text to be processed, the vectorized text to be processed can be input into a pre-trained semantic information extraction model. By inputting the vectorized text to be processed into the pre-trained semantic information extraction model, a semantic information feature vector can be obtained. The semantic information feature vector can characterize the semantic relationship of the context of the text to be processed, and effectively ensure that the main information of the text to be processed is extracted. The training process of the semantic information extraction model is described in step S204, and this embodiment will not be repeated.

[0153] Step S408: Input the semantic information feature vector into the pre-trained multi-head attention model to obtain the word type feature vector in the text to be processed.

[0154] Step S410: Perform fusion calculation on the semantic information feature vector and the word type feature vector to obtain a fusion result.

[0155] Step S412: Determine the main idea information of the text to be processed according to the fusion result.

[0156] Among them, Step S408, Step S410, and Step S412 are the same as Step S206, Step S208, and Step S210, and will not be elaborated in this embodiment.

[0157] Applying the solution of the embodiment of the present application, by obtaining the text to be processed, performing vectorization processing on the text to be processed, obtaining the vectorized text to be processed, inputting the vectorized text to be processed into a pre-trained semantic information extraction model, obtaining a semantic information feature vector, performing fusion calculation on the semantic information feature vector and the word type feature vector to obtain a fusion result, and determining the main idea information of the text to be processed according to the fusion result. Through the semantic information extraction model, semantic analysis is performed on the input text to be processed to obtain the context semantics of the text to be processed, that is, the semantic information feature vector, and then the multi-head attention model is used to process the semantic information feature vector to obtain the part-of-speech type of the word, that is, the word type feature vector. The semantic information feature vector and the word type feature vector are fused, and according to the fusion result, the main idea information of the text to be processed is determined, comprehensively considering the context semantics of the text to be processed and the part-of-speech of the word, effectively ensuring that the main idea information of the text to be processed is extracted, and thus improving the accuracy of main idea information extraction.

[0158] Figure 5 The flowchart showing the fourth main idea information extraction method provided by an embodiment of the present application specifically includes the following steps:

[0159] Step S502: Obtain the text to be processed.

[0160] Among them, Step S502 is the same as Step S202, and will not be elaborated in this embodiment.

[0161] Step S504: Perform word segmentation on the text to be processed to obtain a word segmentation result.

[0162] It should be noted that in the process of semantic analysis and extraction, a word is the complete unit of meaning. For example, in the word "discover", the character "fa" may have multiple meanings such as emit, develop, and get rich. Only when the two characters "discover" appear together can it be determined to be the meaning of "discover". Processing the text to be processed in units of words, the semantic information extraction model can avoid the above thinking process. Taking words as units can shorten the distance between two meaningful words in a sentence, making the processed text more adaptable to the model.

[0163] In a possible implementation, since the text to be processed contains a large number of stop words, these stop words generally refer to words that have a low impact on the main theme of the text, such as auxiliary words, modal particles, etc., a pre-set stop word list can be used to segment the text to be processed. For example: the part of the content of the text to be processed "the apple is big and red" is segmented to obtain the segmentation results "apple", "again", "big", "again", "red", and the segmentation results are matched with the pre-set stop word list. The pre-set stop word list includes the stop word "again", then the stop word "again" in the segmentation result is deleted, and the segmentation results of the part of the content of the text to be processed are "apple", "big", "red". The above-mentioned segmentation processing process can also call a preset segmentation component to perform segmentation processing on the text to be processed, wherein the preset segmentation component includes but is not limited to the Simple Chinese Words Segmentation System (SCWS), the stammering segmentation tool, etc., which is selected according to the actual situation, and the embodiment of the present application does not make any limitation to this.

[0164] In another possible implementation, in order to obtain the word segmentation result of the text to be processed, the word segmentation rules can be pre-set, and the word segmentation processing can be performed according to the pre-set word segmentation rules, so that the text to be processed can be segmented without using the preset word segmentation components. For example, a common word library is pre-set, and the part of the content in the text to be processed "Apple is big and red" is matched with the pre-set common word library, and the pre-set common word library includes "apple", "big", and "red", so the word segmentation result of the part of the content in the text to be processed can be obtained as "apple", "big", and "red".

[0165] In another possible implementation method, the forward maximum matching method, the reverse maximum matching method, the minimum segmentation method, and the bidirectional maximum matching method can also be used to segment the text to be processed. The specific selection is made according to the actual situation, and the embodiment of the present application does not impose any limitation on this.

[0166] Step S506: perform vectorization processing on the word segmentation result to obtain word segmentation vectorization information of the text to be processed, wherein the word segmentation vectorization information includes each word segmentation vector.

[0167] In the embodiment of the present application, after word segmentation is performed on the text to be processed and the word segmentation result is obtained, since the input of the semantic information extraction model is in the form of vectors, it is necessary to vectorize the word segmentation result of the text to be processed to obtain word segmentation vectorization information including each word segmentation vector. It should be noted that there are many ways to vectorize the word segmentation result of the text to be processed in this application, including but not limited to using One-Hot encoding, term frequency-inverse document frequency (TF-IDF), hash processing, etc., which are selected according to the actual situation, and the embodiment of the present application does not impose any limitation on this.

[0168] Step S508: Input each word segmentation vector into a pre-trained semantic information extraction model to obtain a semantic information feature vector.

[0169] Among them, each word segmentation vector can be understood as the vectorized text to be processed.

[0170] Step S510: Input the semantic information feature vector into a pre-trained multi-head attention model to obtain a word type feature vector in the text to be processed.

[0171] Step S512: performing fusion calculation on the semantic information feature vector and the word type feature vector to obtain a fusion result.

[0172] Step S514: Determine the main information of the text to be processed according to the fusion result.

[0173] Among them, step S508, step S510, step S512, and step S514 are the same as step S406, step S408, step S410, and step S412, and will not be described in detail in this embodiment.

[0174] The scheme of the embodiment of the present application is applied, by obtaining the text to be processed, performing word segmentation processing on the text to be processed, obtaining the word segmentation result, performing vectorization processing on the word segmentation result, obtaining the word segmentation vectorization information of the text to be processed, inputting each word segmentation vector into the pre-trained semantic information extraction model, obtaining the semantic information feature vector, fusing the semantic information feature vector and the word type feature vector, obtaining the fusion result, and determining the main information of the text to be processed according to the fusion result. The input text to be processed is semantically analyzed by the semantic information extraction model to obtain the contextual semantics of the text to be processed, that is, the semantic information feature vector, and then the semantic information feature vector is processed by the multi-head attention model to obtain the part-of-speech type of the word, that is, the word type feature vector, and the semantic information feature vector and the word type feature vector are fused, and the main information of the text to be processed is determined according to the fusion result, which comprehensively considers the contextual semantics of the text to be processed and the part-of-speech of the word, effectively ensuring that the main information of the text to be processed is extracted, thereby improving the accuracy of the extraction of the main information, and the text to be processed is segmented to obtain the word segmentation result, which can improve the efficiency and accuracy of the extraction of the main information of the text.

[0175] Figure 6 A flowchart of a fifth subject information extraction method provided according to an embodiment of the present application is shown, which specifically includes the following steps:

[0176] Step S602: Obtain the text to be processed.

[0177] Step S604: Perform word segmentation processing on the text to be processed to obtain a word segmentation result.

[0178] Step S606: perform vectorization processing on the word segmentation result to obtain word segmentation vectorization information of the text to be processed, wherein the word segmentation vectorization information includes each word segmentation vector.

[0179] Among them, step S602, step S604, step S606 are the same as step S502, step S504, step S506, and will not be described in detail in this embodiment.

[0180] Step S608: bundling the word segmentation vectors to obtain multiple bundling vectors of the text to be processed.

[0181] In an embodiment of the present application, because the text input into the semantic information extraction model needs to be cut into a fixed size, after obtaining the word segmentation vectorization information of the text to be processed, it is necessary to bundle (batch) each word segmentation vector to obtain multiple bundled vectors of the text to be processed.

[0182] It should be noted that in order to retain the relevant information of the cross positions between multiple batches, the bundle vector to be obtained can be composed of the content of the previous bundle vector and the new word segmentation vector. This method of obtaining the bundle vector is called the "sliding window method".

[0183] Specifically, assuming that 1024 words are bundled into a batch, using a "128-length sliding window" means that the first 128 words of the new batch come from the 128 words at the end of the previous batch, and the remaining 896 words are new, that is, the text length of the next batch is 128 words at the end of the previous text length + 896 new text length.

[0184] Step S610: input each bundling vector into a pre-trained semantic information extraction model in sequence to obtain a semantic information feature vector corresponding to each bundling vector.

[0185] In an embodiment of the present application, after obtaining multiple bundling vectors of the text to be processed, in order to extract the high-order semantic information of the text to be processed, each bundling vector can be sequentially input into a pre-trained semantic information extraction model for processing to obtain a semantic information feature vector corresponding to each bundling vector. Among them, the semantic information extraction model can be a bidirectional long short-term memory network model (BI-LSTM, Bi-directional Long Short-Term Memory), or it can be other models that can extract text semantic information, and the embodiment of the present application does not make any limitation to this. Among them, the semantic information feature vector can characterize the semantic relationship of the context of the text to be processed, and effectively ensure that the main information of the text to be processed is extracted. The training process of the semantic information extraction model refers to the description of step S204, and this embodiment will not be repeated.

[0186] Step S612: For each bundling vector, the semantic information feature vector corresponding to the bundling vector is input into a pre-trained multi-head attention model to obtain the word type feature vector corresponding to the bundling vector.

[0187] In an embodiment of the present application, after obtaining the semantic information feature vector corresponding to each bundling vector, the semantic information feature vector corresponding to the bundling vector can be input into a pre-trained multi-head attention model (Multi-head Attention) for each bundling vector, and the attention encoder (attention-encoder) in the multi-head attention model is used to classify the semantic information feature vector to obtain the word type feature vector corresponding to the bundling vector. The training process of the multi-head attention model is described in step S206, and will not be repeated in this embodiment.

[0188] Step S614: For each bundling vector, a fusion calculation is performed on the semantic information feature vector and the word type feature vector corresponding to the bundling vector to obtain a fusion result corresponding to the bundling vector.

[0189] Step S616: Analyze the fusion results corresponding to each bundling vector to determine the main information of the text to be processed.

[0190] Among them, step S614 and step S616 are the same as step S208 and step S210, and will not be described in detail in this embodiment.

[0191] For example, the text to be processed is obtained as "white silk thread twisted into a thin rope", and the text to be processed is segmented to obtain the segmentation results of the text to be processed as "white", "silk thread", "twisted", and "rope";

[0192] The word segmentation results are vectorized to obtain the word segmentation vector and position information of “white”, the word segmentation vector and position information of “silk thread”, the word segmentation vector and position information of “twisted”, and the word segmentation vector and position information of “rope”;

[0193] The word segmentation vector of "white" and the word segmentation vector of "silk thread" are bundled to obtain a first bundled vector, and the word segmentation vector of "twisted into" and the word segmentation vector of "rope" are bundled to obtain a second bundled vector; for example, the first bundled vector may be a vector corresponding to "white silk thread", and the second bundled vector may be a vector corresponding to "twisted into a rope", and the second bundled vector includes the content at the end of the first bundled vector, and can retain relevant information about the cross position between the two bundled vectors.

[0194] Inputting the first bundling vector and the second bundling vector into a pre-trained semantic information extraction model in sequence respectively, to obtain a first semantic information feature vector corresponding to the first bundling vector and a second semantic information feature vector corresponding to the second bundling vector;

[0195] Inputting the first semantic information feature vector and the corresponding first position information into a pre-trained multi-head attention model to obtain a first word type feature vector, and inputting the second semantic information feature vector and the corresponding second position information into the pre-trained multi-head attention model to obtain a second word type feature vector;

[0196] Performing a dot product operation on the first semantic information feature vector and the first word type feature vector to obtain a first fusion result, and performing a dot product operation on the second semantic information feature vector and the second word type feature vector to obtain a second fusion result;

[0197] The first fusion result and the second fusion result are input into the decoder to determine that the main sentence of the text to be processed "white silk threads are twisted into thin ropes" is "silk threads are twisted into ropes".

[0198] By applying the solution of the embodiment of the present application, multiple bundling vectors of the text to be processed are obtained by bundling each word segmentation vector, so that the processed text is more suitable for the semantic information extraction model, and each bundling vector is input into the pre-trained semantic information extraction model in turn to obtain the semantic information feature vector corresponding to each bundling vector. For each bundling vector, the semantic information feature vector corresponding to the bundling vector is input into the pre-trained multi-head attention model to obtain the word type feature vector corresponding to the bundling vector. For each bundling vector, the semantic information feature vector and the word type feature vector corresponding to the bundling vector are fused to obtain the fusion result corresponding to the bundling vector. The fusion results corresponding to each bundling vector are analyzed to determine the main information of the text to be processed, comprehensively consider the text to be processed, effectively ensure that the main information of the text to be processed is extracted, and then improve the accuracy of the main information extraction.

[0199] Figure 7 A flowchart of a sixth subject information extraction method provided according to an embodiment of the present application is shown, which specifically includes the following steps:

[0200] Step S702: Obtain the text to be processed.

[0201] Step S704: Perform word segmentation processing on the text to be processed to obtain a word segmentation result.

[0202] Step S706: perform vectorization processing on the word segmentation results to obtain word segmentation vectorization information of the text to be processed, wherein the word segmentation vectorization information includes each word segmentation vector and position information of each word segmentation vector.

[0203] Step S708: Input each word segmentation vector into a pre-trained semantic information extraction model to obtain a semantic information feature vector.

[0204] Among them, step S702, step S704, step S706, step S708 are the same as step S502, step S504, step S506, step S508, and will not be described in detail in this embodiment.

[0205] Step S710: For each word segmentation vector, the semantic feature vector corresponding to the word segmentation vector and the position information of the word segmentation vector are input into a pre-trained multi-head attention model to obtain the query vector, key vector and value vector corresponding to the word segmentation vector.

[0206] Step S712: Based on the query vector, the key vector and the value vector, the word score of the word segmentation vector is calculated, and the word score is normalized to obtain a normalized word score.

[0207] Step S714: using the normalized word scores, weighting each word segmentation vector to obtain a word type feature vector in the text to be processed.

[0208] In the embodiment of the present application, when the semantic feature vector corresponding to each word segmentation vector is input into the pre-trained multi-head attention model, since all the semantic feature vectors are simultaneously input into the multi-head attention model and processed, if the position information is not added, then all the semantic feature vectors will not have semantic differences for the multi-head attention model, and will produce the same output. Therefore, for each word segmentation vector, it is necessary to input the semantic feature vector corresponding to the word segmentation vector and the position information of the word segmentation vector into the pre-trained multi-head attention model to obtain the query vector, key vector and value vector corresponding to the word segmentation vector, and calculate using the following formula:

[0209]

[0210] Among them, Q is the query vector, K is the key vector, V is the value vector, T is the expansion ratio, and d is the compression ratio.

[0211] It should be noted that the method for normalizing word scores in the present application includes but is not limited to linear normalization, standard deviation normalization and nonlinear normalization, which is selected according to actual conditions, and the embodiments of the present application do not impose any limitations on this.

[0212] Step S716: performing fusion calculation on the semantic information feature vector and the word type feature vector to obtain a fusion result.

[0213] Step S718: Determine the main information of the text to be processed based on the fusion result.

[0214] Among them, step S716 and step S718 are the same as step S512 and step S514, and will not be described in detail in this embodiment.

[0215] The scheme of the embodiment of the present application is applied. By inputting the semantic feature vector corresponding to each word segmentation vector and the position information of the word segmentation vector into a pre-trained multi-head attention model for each word segmentation vector, the query vector, key vector and value vector corresponding to the word segmentation vector are obtained. Based on the query vector, key vector and value vector, the word score of the word segmentation vector is calculated, the word score is normalized to obtain the normalized word score, and each word segmentation vector is weighted using the normalized word score to obtain the word type feature vector in the text to be processed. The text to be processed is comprehensively considered to effectively ensure that the main information of the text to be processed is extracted, thereby improving the accuracy of the main information extraction.

[0216] Figure 8 A flowchart of a seventh subject information extraction method provided according to an embodiment of the present application is shown, which specifically includes the following steps:

[0217] Step S802: Obtain the text to be processed.

[0218] Step S804: input the text to be processed into a pre-trained semantic information extraction model to obtain a semantic information feature vector.

[0219] Step S806: Input the semantic information feature vector into the pre-trained multi-head attention model to obtain the word type feature vector in the text to be processed.

[0220] Among them, step S802, step S804, step S806 are the same as step S202, step S204, step S206, and will not be described in detail in this embodiment.

[0221] Step S808: performing a dot product operation on the semantic information feature vector and the word type feature vector to obtain a fusion result.

[0222] It should be noted that the dot product operation is to multiply the elements corresponding to the semantic information feature vector and the word type feature vector, such as vector a = [a1, a2, ..., a n ] and vector b = [b1, b2, …, b n ] is defined as: a·b=a1*b1+a 2* b2+……+a n *b n According to the result of the dot product, the result of the dot product is passed through the ReLu activation function and the Softmax layer, and the weight information of each word segmentation result is calculated as follows:

[0223] d=softmax(V'*ReLu(V*U'+b)+b') (3)

[0224] Among them, V is the weight corresponding to a linear layer in the multi-head attention mechanism model, b is the residual corresponding to a linear layer in the multi-head attention mechanism model, V' is the weight corresponding to the second linear layer after the activation function in the multi-head attention mechanism model, b' is the residual corresponding to the second linear layer after the activation function in the multi-head attention mechanism model, and U' is the fusion result. After passing through the activation function and two linear layers, the originally linear data becomes nonlinear, making the output of the model more diversified.

[0225] Step S810: Determine the main information of the text to be processed based on the fusion result.

[0226] Among them, step S808 and step S810 are the same as step S208 and step S210, and will not be described in detail in this embodiment.

[0227] By applying the solution of the embodiment of the present application, a fusion result is obtained by performing a dot product operation on the semantic information feature vector and the word type feature vector, thereby improving the accuracy of extracting the main content information of the text.

[0228] Fig. 9 A flowchart of an eighth subject information extraction method provided according to an embodiment of the present application is shown, which specifically includes the following steps:

[0229] Step S902: Obtain the text to be processed.

[0230] Step S904: input the text to be processed into a pre-trained semantic information extraction model to obtain a semantic information feature vector.

[0231] Step S906: Input the semantic information feature vector into the pre-trained multi-head attention model to obtain the word type feature vector in the text to be processed.

[0232] Step S908: performing fusion calculation on the semantic information feature vector and the word type feature vector to obtain a fusion result.

[0233] Among them, step S902, step S904, step S906, step S908 are the same as step S202, step S204, step S206, step S208, and will not be described in detail in this embodiment.

[0234] Step S910: Input the fusion result into the decoder to obtain the main information of the text to be processed.

[0235] In an embodiment of the present application, after calculating the fusion result of the semantic information feature vector and the word type feature vector, the fusion result can be input into a decoder to decode the fusion result to generate a coherent main sentence of the text to be processed, thereby improving the coherence of the main information extraction result and further improving the user experience.

[0236] Fig.10 A flowchart of a ninth subject information extraction method provided according to an embodiment of the present application is shown, which specifically includes:

[0237] Data preprocessing: Use the word segmentation tool to segment the text to be processed and obtain the word segmentation results; vectorize the word segmentation results to obtain word segmentation vector information; bundle each word segmentation vector to obtain multiple bundled vectors;

[0238] The word segmentation vectorization information includes each word segmentation vector and the position information of each word segmentation vector;

[0239] Semantic information extraction model processing: input each bundle vector into the pre-trained semantic information extraction model in sequence to obtain the semantic information feature vector corresponding to each bundle vector;

[0240] Multi-head attention model processing: For each word segmentation vector, the semantic feature vector corresponding to the word segmentation vector and the position information of the word segmentation vector are input into the pre-trained multi-head attention model to obtain the word type feature vector in the text to be processed;

[0241] Data fusion: perform dot product operation on the semantic information feature vector and the word type feature vector to obtain the fusion result;

[0242] Generate main information: Input the fusion result into the decoder to obtain the main information of the text to be processed.

[0243] in, Fig.10 For details, please refer to Figure 2-Figure 9 , this embodiment will not be described in detail.

[0244] The scheme of the embodiment of the present application is applied, by obtaining the text to be processed, inputting the text to be processed into a pre-trained semantic information extraction model, obtaining a semantic information feature vector, inputting the semantic information feature vector into a pre-trained multi-head attention model, obtaining a word type feature vector in the text to be processed, and performing fusion calculation on the semantic information feature vector and the word type feature vector to obtain a fusion result, and determining the main information of the text to be processed according to the fusion result. The input text to be processed is semantically analyzed by the semantic information extraction model to obtain the contextual semantics of the text to be processed, that is, the semantic information feature vector, and then the semantic information feature vector is processed by the multi-head attention model to obtain the part-of-speech type of the word, that is, the word type feature vector, and the semantic information feature vector and the word type feature vector are fused, and according to the fusion result, the main information of the text to be processed is determined, which comprehensively considers the contextual semantics of the text to be processed and the part-of-speech of the word, effectively ensuring that the main information of the text to be processed is extracted, thereby improving the accuracy of the extraction of the main information.

[0245] Corresponding to the above method embodiment, the present application also provides a subject information extraction device embodiment, Fig.11 FIG. 1 is a schematic diagram showing a structure of a subject information extraction device provided by an embodiment of the present application. Fig.11 As shown, the device comprises:

[0246] An acquisition module 102 is configured to acquire a text to be processed;

[0247] The semantic information feature vector generation module 104 is configured to input the text to be processed into a pre-trained semantic information extraction model to obtain a semantic information feature vector;

[0248] A word type feature vector generation module 106 is configured to input the semantic information feature vector into a pre-trained multi-head attention model to obtain a word type feature vector in the text to be processed;

[0249] A fusion result generating module 108 is configured to perform fusion calculation on the semantic information feature vector and the word type feature vector to obtain a fusion result;

[0250] The subject information determination module 110 is configured to determine the subject information of the text to be processed according to the fusion result.

[0251] Optionally, the semantic information feature vector generation module 104 is further configured to input the text to be processed into a pre-trained semantic information extraction model, and obtain the hidden layer output of the semantic information extraction model as the semantic information feature vector.

[0252] Optionally, the device also includes: a vectorization processing module, configured to perform vectorization processing on the text to be processed to obtain the vectorized text to be processed; a semantic information feature vector generation module 104, further configured to input the vectorized text to be processed into a pre-trained semantic information extraction model to obtain a semantic information feature vector.

[0253] Optionally, the device also includes: a word segmentation processing module, configured to perform word segmentation processing on the text to be processed to obtain a word segmentation result; a vectorization processing module, further configured to perform vectorization processing on the word segmentation result to obtain word segmentation vectorization information of the text to be processed, wherein the word segmentation vectorization information includes each word segmentation vector.

[0254] Optionally, the semantic information feature vector generation module 104 is further configured to perform bundling processing on each word segmentation vector to obtain multiple bundling vectors of the text to be processed; input each bundling vector into a pre-trained semantic information extraction model in turn to obtain a semantic information feature vector corresponding to each bundling vector; the word type feature vector generation module 106 is further configured to input the semantic information feature vector corresponding to each bundling vector into a pre-trained multi-head attention model to obtain a word type feature vector corresponding to the bundling vector; the fusion result generation module 108 is further configured to perform fusion calculation on the semantic information feature vector and the word type feature vector corresponding to each bundling vector to obtain a fusion result corresponding to the bundling vector; the main information determination module 110 is further configured to analyze the fusion results corresponding to each bundling vector to determine the main information of the text to be processed.

[0255] Optionally, the word segmentation vectorization information also includes the position information of each word segmentation vector; the word type feature vector generation module 106 is further configured to input the semantic feature vector corresponding to each word segmentation vector and the position information of the word segmentation vector into a pre-trained multi-head attention model to obtain the query vector, key vector and value vector corresponding to the word segmentation vector; based on the query vector, key vector and value vector, calculate the word score of the word segmentation vector, normalize the word score, and obtain the normalized word score; use the normalized word score to weight each word segmentation vector to obtain the word type feature vector in the text to be processed.

[0256] Optionally, the fusion result generating module 108 is further configured to perform a dot product operation on the semantic information feature vector and the word type feature vector to obtain a fusion result.

[0257] Optionally, the subject information determination module 110 is further configured to input the fusion result into a decoder to obtain the subject information of the text to be processed.

[0258] The scheme of the embodiment of the present application is applied, by obtaining the text to be processed, inputting the text to be processed into a pre-trained semantic information extraction model, obtaining a semantic information feature vector, inputting the semantic information feature vector into a pre-trained multi-head attention model, obtaining a word type feature vector in the text to be processed, and performing fusion calculation on the semantic information feature vector and the word type feature vector to obtain a fusion result, and determining the main information of the text to be processed according to the fusion result. The input text to be processed is semantically analyzed by the semantic information extraction model to obtain the contextual semantics of the text to be processed, that is, the semantic information feature vector, and then the semantic information feature vector is processed by the multi-head attention model to obtain the part-of-speech type of the word, that is, the word type feature vector, and the semantic information feature vector and the word type feature vector are fused, and according to the fusion result, the main information of the text to be processed is determined, which comprehensively considers the contextual semantics of the text to be processed and the part-of-speech of the word, effectively ensuring that the main information of the text to be processed is extracted, thereby improving the accuracy of the extraction of the main information.

[0259] The above is a schematic scheme of a subject information extraction device of the present embodiment. It should be noted that the technical scheme of the subject information extraction device and the technical scheme of the subject information extraction method mentioned above belong to the same concept. For the details not described in detail in the technical scheme of the subject information extraction device, please refer to the description of the technical scheme of the subject information extraction method mentioned above. In addition, each component in the device embodiment should be understood as a functional module that must be established to implement each step of the program flow or each step of the method, and each functional module is not an actual functional division or separation definition. The device claim defined by such a group of functional modules should be understood as a functional module architecture that mainly implements the solution through the computer program recorded in the specification, and should not be understood as a physical device that mainly implements the solution through hardware.

[0260] Fig.12 The block diagram of a computing device according to an embodiment of the present application is shown. The components of the computing device 200 include but are not limited to a memory 300 and a processor 400. The processor 400 is connected to the memory 300 via a bus 500, and the database 800 is used to store data.

[0261] The computing device 200 also includes an access device 600, which enables the computing device 200 to communicate via one or more networks 700. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 600 may include one or more of any type of network interface (e.g., a network interface card (NIC)) of wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a world microwave interconnection access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.

[0262] In one embodiment of the present application, the above components of the computing device 200 and Fig.12 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Fig.12 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of the present application. Those skilled in the art may add or replace other components as needed.

[0263] The computing device 200 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or PC. The computing device 200 may also be a mobile or stationary server.

[0264] The processor 400 is used to execute computer executable instructions of the subject information extraction method.

[0265] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the subject information extraction method described above are of the same concept, and the details not described in detail in the technical scheme of the computing device can be found in the description of the technical scheme of the subject information extraction method described above.

[0266] An embodiment of the present application also provides a computer-readable storage medium storing computer instructions, which are used in a subject information extraction method when executed by a processor.

[0267] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the subject information extraction method described above are of the same concept, and the details not described in detail in the technical scheme of the storage medium can be found in the description of the technical scheme of the subject information extraction method described above.

[0268] An embodiment of the present application further provides a chip storing a computer program, which implements the steps of the subject information extraction method when executed by the chip.

[0269] The above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0270] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.

[0271] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described action sequence, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0272] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0273] The preferred embodiments of the present application disclosed above are only used to help explain the present application. The optional embodiments do not describe all the details in detail, nor do they limit the invention to the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the present application. The present application selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present application, so that those skilled in the art can understand and use the present application well. The present application is only limited by the claims and their full scope and equivalents.

Claims

1. A subject information extraction method, characterized in that: include: Obtaining the text to be processed, wherein after obtaining the text to be processed, the method includes: performing word segmentation processing on the text to be processed to obtain a word segmentation result; performing vectorization processing on the word segmentation result to obtain word segmentation vectorization information of the text to be processed, wherein the word segmentation vectorization information includes each word segmentation vector and position information of each word segmentation vector; Inputting the text to be processed into a pre-trained semantic information extraction model to obtain a semantic information feature vector, wherein the step of inputting the text to be processed into a pre-trained semantic information extraction model to obtain a semantic information feature vector comprises: inputting each word segmentation vector into the pre-trained semantic information extraction model to obtain the semantic information feature vector; Input the semantic information feature vector into a pre-trained multi-head attention model to obtain a word type feature vector in the text to be processed, wherein the inputting the semantic information feature vector into the pre-trained multi-head attention model to obtain the word type feature vector in the text to be processed includes: for each word segmentation vector, inputting the semantic feature vector corresponding to the word segmentation vector and the position information of the word segmentation vector into the pre-trained multi-head attention model to obtain the query vector, key vector and value vector corresponding to the word segmentation vector; based on the query vector, the key vector and the value vector, calculating the word score of the word segmentation vector, normalizing the word score to obtain the normalized word score; using the normalized word score, weighting each word segmentation vector to obtain the word type feature vector in the text to be processed; Performing fusion calculation on the semantic information feature vector and the word type feature vector to obtain a fusion result; According to the fusion result, the main information of the text to be processed is determined.

2. The method according to claim 1, characterized in that The step of inputting the text to be processed into a pre-trained semantic information extraction model to obtain a semantic information feature vector comprises: The text to be processed is input into a pre-trained semantic information extraction model, and the hidden layer output of the semantic information extraction model is obtained as a semantic information feature vector.

3. The method according to claim 1, characterized in that: The step of inputting each word segmentation vector into the pre-trained semantic information extraction model to obtain the semantic information feature vector comprises: Bundling the word segmentation vectors to obtain multiple bundled vectors of the text to be processed; Input each bundling vector into a pre-trained semantic information extraction model in sequence to obtain a semantic information feature vector corresponding to each bundling vector; The step of inputting the semantic information feature vector into a pre-trained multi-head attention model to obtain a word type feature vector in the text to be processed includes: For each bundling vector, input the semantic information feature vector corresponding to the bundling vector into the pre-trained multi-head attention model to obtain the word type feature vector corresponding to the bundling vector; The step of fusing the semantic information feature vector and the word type feature vector to obtain a fusion result includes: For each bundling vector, a fusion calculation is performed on the semantic information feature vector and the word type feature vector corresponding to the bundling vector to obtain a fusion result corresponding to the bundling vector; The step of determining the subject information of the text to be processed according to the fusion result includes: The fusion results corresponding to each bundled vector are analyzed to determine the main information of the text to be processed.

4. The method according to claim 1, characterized in that: The step of fusing the semantic information feature vector and the word type feature vector to obtain a fusion result includes: A dot product operation is performed on the semantic information feature vector and the word type feature vector to obtain the fusion result.

5. The method according to claim 1, characterized in that The step of determining the subject information of the text to be processed according to the fusion result includes: The fusion result is input into the decoder to obtain the main information of the text to be processed.

6. A subject information extraction device, characterized in that: include: The acquisition module is configured to acquire the text to be processed, wherein the device further includes: a word segmentation processing module, configured to perform word segmentation processing on the text to be processed to obtain a word segmentation result; a vectorization processing module, further configured to perform vectorization processing on the word segmentation result to obtain word segmentation vectorization information of the text to be processed, wherein the word segmentation vectorization information includes each word segmentation vector and position information of each word segmentation vector; A semantic information feature vector generation module is configured to input the to-be-processed text into a pre-trained semantic information extraction model to obtain a semantic information feature vector, wherein the semantic information feature vector generation module is further configured to: input each word segmentation vector into the pre-trained semantic information extraction model to obtain the semantic information feature vector; A word type feature vector generation module is configured to input the semantic information feature vector into a pre-trained multi-head attention model to obtain the word type feature vector in the text to be processed, wherein the word type feature vector generation module is further configured to: for each word segmentation vector, input the semantic feature vector corresponding to the word segmentation vector and the position information of the word segmentation vector into the pre-trained multi-head attention model to obtain the query vector, key vector and value vector corresponding to the word segmentation vector; based on the query vector, the key vector and the value vector, calculate the word score of the word segmentation vector, normalize the word score, and obtain the normalized word score; use the normalized word score to weight each word segmentation vector to obtain the word type feature vector in the text to be processed; A fusion result generating module is configured to perform fusion calculation on the semantic information feature vector and the word type feature vector to obtain a fusion result; The subject information determination module is configured to determine the subject information of the text to be processed according to the fusion result.

7. A computing device, characterized in that include: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the steps of the subject information extraction method described in any one of claims 1 to claim 5.

8. A computer-readable storage medium storing computer instructions, characterized in that: When the instruction is executed by the processor, the steps of the subject information extraction method described in any one of claims 1 to 5 are implemented.