Text semantic prediction method, device, computer equipment and storage medium

By fusing the feature vectors output by the BERT model and the bidirectional GRU model with the fuzzy neural network model, a feature fusion vector containing complete text information and sentence dependencies is generated, which solves the problem of information loss when the BERT model processes long texts, and improves Semantic prediction accuracy.

CN113158685BActive Publication Date: 2024-10-18PING AN TECH (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110444349.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-04-23
Publication Date
2024-10-18
Estimated Expiration
2041-04-23

AI Technical Summary

Technical Problem

The BERT model's maximum length restriction on long text results in the loss of text information and reduced semantic prediction accuracy.

Method used

Using the feature fusion model, the feature vectors output by the BERT model and the bidirectional GRU model are fused through the fuzzy neural network model to generate a feature fusion vector containing complete text information and sentence dependencies, which is input into the semantic prediction model for prediction.

Benefits of technology

It effectively makes up for the information loss caused by the maximum text length limit of the BERT model and improves the accuracy of semantic prediction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113158685B_ABST
    Figure CN113158685B_ABST
Patent Text Reader

Abstract

The present application relates to the field of artificial intelligence, and realizes the fusion of feature vectors output by the BERT model and the bidirectional GRU model by a fuzzy neural network model, thereby improving the accuracy of semantic prediction. It relates to a method, device, computer equipment and storage medium for semantic prediction of text, and the method comprises: obtaining a target text to be semantically predicted; inputting the target text into a feature fusion model for fusion processing, and obtaining a feature fusion vector corresponding to the target text, wherein the feature fusion model comprises a BERT model, a bidirectional GRU network model and a fuzzy neural network model, and the fuzzy neural network model is used to fuse the feature vectors output by the BERT model and the bidirectional GRU network model; inputting the feature fusion vector into the semantic prediction model for semantic prediction, and obtaining a semantic prediction result corresponding to the target text. In addition, the present application also relates to blockchain technology, and the target text can be stored in the blockchain.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence, and in particular to a text semantic prediction method, apparatus, computer equipment and storage medium. Background Art

[0002] In the task of semantic prediction of text, the BERT model is usually used to extract features from the text and perform semantic prediction on the obtained feature vector. However, for long texts, it is easy to exceed the maximum processing length of the BERT model, resulting in memory overflow and information loss. Existing methods for processing long texts usually include direct truncation, pooling, and compression, etc. However, these processing methods will cause the loss of sequence information of long texts, and the association between each part will also be lost, thereby reducing the accuracy of subsequent semantic predictions.

[0003] Therefore, how to solve the defect of BERT model that causes text information loss due to the limitation of maximum text length in order to improve the accuracy of semantic prediction has become an urgent problem to be solved. Summary of the invention

[0004] The present application provides a method, apparatus, computer device and storage medium for semantic prediction of text. By inputting the target text into a feature fusion model for fusion processing, a fuzzy neural network model is used to fuse the feature vectors output by the BERT model and the bidirectional GRU model. The obtained feature fusion vector contains the complete information of the text and the dependency relationship between sentences, which makes up for the defect of the BERT model that causes the loss of text information due to the limitation of the maximum length of the text, and improves the accuracy of semantic prediction.

[0005] In a first aspect, the present application provides a method for semantic prediction of text, the method comprising:

[0006] Obtaining the target text for semantic prediction;

[0007] Input the target text into a feature fusion model for fusion processing to obtain a feature fusion vector corresponding to the target text, wherein the feature fusion model includes a BERT model, a bidirectional GRU network model and a fuzzy neural network model, and the fuzzy neural network model is used to fuse the feature vectors output by the BERT model and the bidirectional GRU network model;

[0008] The feature fusion vector is input into a semantic prediction model for semantic prediction to obtain a semantic prediction result corresponding to the target text.

[0009] In a second aspect, the present application further provides a text semantic prediction device, the device comprising:

[0010] A target text acquisition module is used to acquire the target text to be semantically predicted;

[0011] A feature fusion processing module, used for inputting the target text into a feature fusion model for fusion processing, and obtaining a feature fusion vector corresponding to the target text, wherein the feature fusion model includes a BERT model, a bidirectional GRU network model and a fuzzy neural network model, and the fuzzy neural network model is used for fusion processing of the feature vectors output by the BERT model and the bidirectional GRU network model;

[0012] The semantic prediction module is used to input the feature fusion vector into the semantic prediction model for semantic prediction to obtain the semantic prediction result corresponding to the target text.

[0013] In a third aspect, the present application further provides a computer device, the computer device comprising a memory and a processor;

[0014] The memory is used to store computer programs;

[0015] The processor is used to execute the computer program and implement the above-mentioned text semantic prediction method when executing the computer program.

[0016] In a fourth aspect, the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the semantic prediction method of text as described above.

[0017] The present application discloses a method, apparatus, computer equipment and storage medium for semantic prediction of text. The method obtains a target text to be semantically predicted, inputs the target text into a feature fusion model for fusion processing, and realizes that a BERT model extracts a feature vector corresponding to key information in the target text. A bidirectional GRU model extracts feature vectors from the remaining text. A fuzzy neural network model fuses the feature vectors output by the BERT model and the bidirectional GRU model. The obtained feature fusion vector contains complete information of the text and dependencies between sentences, which can effectively make up for the defect of text information loss caused by the limitation of the maximum length of the text in the BERT model. The feature fusion vector output by the feature fusion model is input into the semantic prediction model for semantic prediction, thereby improving the accuracy of semantic prediction. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0019] Figure 1 is a schematic flow chart of a text semantic prediction method provided in an embodiment of the present application;

[0020] Figure 2 is a schematic diagram of performing semantic prediction on a target text provided by an embodiment of the present application;

[0021] Figure 3 is a schematic flow chart of sub-steps for training a feature fusion model provided in an embodiment of the present application;

[0022] Figure 4 is a schematic diagram of training a feature fusion model provided in an embodiment of the present application;

[0023] Figure 5 is a schematic block diagram of a text semantic prediction device provided in an embodiment of the present application;

[0024] Figure 6 It is a schematic block diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0025] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0026] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.

[0027] It should be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0028] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0029] The embodiments of the present application provide a method, device, computer equipment and storage medium for semantic prediction of text. The semantic prediction method of text can be applied to a server or terminal to implement fusion processing by inputting the target text into a feature fusion model, and the fuzzy neural network model fuses the feature vectors output by the BERT model and the bidirectional GRU model. The obtained feature fusion vector contains complete information of the text and the dependency relationship between sentences, which can make up for the defect of text information loss caused by the limitation of the maximum length of the text in the BERT model, and improve the accuracy of semantic prediction.

[0030] The server may be an independent server or a server cluster, and the terminal may be an electronic device such as a smart phone, a tablet computer, a notebook computer, or a desktop computer.

[0031] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0032] like Figure 1 As shown, the text semantic prediction method includes steps S10 to S30.

[0033] Step S10: Obtain the target text for semantic prediction.

[0034] Exemplarily, the target text to be semantically predicted may be text pre-stored in a local database or local disk, or may be text uploaded by a user in real time. For example, in a text semantic prediction task, the target text to be semantically predicted may be determined based on a user selection operation detected.

[0035] The target text may be a text of any length, for example, a text of a length greater than 512 characters.

[0036] Step S20, input the target text into the feature fusion model for fusion processing, and obtain the feature fusion vector corresponding to the target text, wherein the feature fusion model includes a BERT model, a bidirectional GRU network model and a fuzzy neural network model, and the fuzzy neural network model is used to fuse the feature vectors output by the BERT model and the bidirectional GRU network model.

[0037] See also Figure 2 , Figure 2 is a schematic diagram of a semantic prediction of a target text provided by an embodiment of the present application. Figure 2As shown, the target text can be input into the feature fusion model for fusion processing to obtain the feature fusion vector corresponding to the target text; then the feature fusion vector is input into the semantic prediction model for semantic prediction, so as to obtain the semantic prediction result corresponding to the target text.

[0038] It should be noted that since the feature fusion model includes the BERT (Bidirectional Encoder Representations from Transformer) model, the bidirectional GRU (Gate Recurrent Unit) network model and the fuzzy neural network model, the fuzzy neural network model is used to fuse the feature vectors output by the BERT model and the bidirectional GRU network model; therefore, the feature fusion vector output by the feature fusion model contains complete text information and the dependency relationship between sentences, which can effectively make up for the defect of text information loss caused by the limitation of the maximum length of the text in the BERT model, thereby improving the accuracy of subsequent semantic prediction.

[0039] In the embodiment of the present application, the feature fusion model is a pre-trained feature fusion model. Before the target text is input into the feature fusion model for fusion processing, the initial feature fusion model needs to be trained until convergence to obtain a trained feature fusion model. By training the feature fusion model, not only the accuracy of feature fusion by the feature fusion model can be improved, but also the generalization of the feature fusion model can be improved. The fused feature vector output by the feature fusion model can be applied to different semantic prediction tasks.

[0040] See also Figure 3 , Figure 3 It is a schematic flowchart of the sub-steps of training a feature fusion model provided in an embodiment of the present application, which may specifically include the following steps S201 to S203.

[0041] Step S201: Obtain a preset number of first training texts.

[0042] Exemplarily, the first training text may be a text stored in a local database or a local disk; the first training text may also be a text stored in a blockchain. It should be noted that, in order to further ensure the privacy and security of the training text, the training text may be stored in a node of a blockchain. During training, a preset number of texts may be extracted from the blockchain node as the first training text.

[0043] The first training text may be a relatively long text, for example, a text having a length greater than 512 characters.

[0044] Step S202: Based on the BERT model, determine a first feature vector corresponding to the first training text, and based on the bidirectional GRU network model, determine a second feature vector corresponding to the first training text.

[0045] See also Figure 4 , Figure 4 FIG. 1 is a schematic diagram of training a feature fusion model provided in an embodiment of the present application. Figure 4 As shown, first, the first training text is input into the BERT model for vectorization, the first feature vector is output, and the second training text is generated according to the first feature vector and the first training text; then, the second training text is input into the bidirectional GRU network model for feature extraction, and the second feature vector is output; finally, the first feature vector and the second feature vector are used as input, and the fuzzy neural network model is trained until convergence to obtain a trained feature fusion model.

[0046] In some embodiments, based on the BERT model, before determining the first feature vector corresponding to the first training text, the first training text may be split to obtain at least one sample sentence corresponding to the first training text.

[0047] It should be noted that the splitting process refers to splitting the first training text into sentences, so as to obtain at least one sample sentence corresponding to the first training text.

[0048] Exemplarily, the target symbol in the first training text may be identified, and the first training text may be segmented into sentences according to the target symbol to obtain sample sentences corresponding to the first training text. The target symbol may include but is not limited to a semicolon, a period, a colon, and a space character.

[0049] Exemplarily, after the first training text is split, each sample sentence can be input into the BERT model for vectorization.

[0050] In some embodiments, based on the BERT model, determining the first feature vector corresponding to the first training text may include: inputting each sample sentence into the BERT model for vectorization to obtain the feature vector corresponding to each sample sentence; and determining the first feature vector based on the feature vector corresponding to each sample sentence.

[0051] It should be noted that in the embodiments of the present application, the BERT model can be a trained model. Exemplarily, a large-scale text corpus that is unrelated to a specific NLP (Natural Language Processing) task can be used in advance to train the BERT model to obtain a trained BERT model. During training, the BERT model can use the Attention mechanism to take the semantic vector representation of the target word and each word in the context as input; then obtain the vector representation of the target word, the vector representation of each word in the context, and the original value representation of the target word and each word in the context through linear transformation; finally, calculate the similarity between the vector of the target word and the vector of each word in the context as a weight, and perform weighted fusion on the vector of the target word and the vector of each context word as the output of Attention, that is, the enhanced semantic vector representation of the target word.

[0052] Exemplarily, each sample sentence is input into a trained BERT model for vectorization to obtain a feature vector corresponding to each sample sentence. It should be noted that by inputting the sample sentence into the BERT model for vectorization, a semantically enhanced feature vector can be obtained.

[0053] In the example of this application, in order to avoid the loss of text information caused by the BERT model, it is necessary to determine the sample sentences containing key information through the BERT model, and input the remaining sample sentences as another data source into the bidirectional GRU network model for secondary feature extraction to obtain the second feature vector. Thus, not only the defect of the BERT model causing the loss of text information due to the limitation of the maximum length of the text is solved, but also the feature fusion vector containing the complete information of the text and the dependency relationship between sentences can be obtained through the first feature vector and the second feature vector.

[0054] Exemplarily, after the sample sentences are input into the BERT model for vectorization, the sample sentences containing key information can be determined according to the similarity between the feature vectors. It should be noted that the sample sentences containing key information refer to the sample sentences corresponding to the feature vectors with higher similarity.

[0055] In some embodiments, a first feature vector is determined based on the feature vector corresponding to each sample sentence, including: determining the similarity between every two feature vectors based on a preset similarity algorithm; determining a feature vector whose similarity is greater than a preset similarity threshold as a target feature vector; performing data cleaning on the target feature vector, and determining the first feature vector based on the cleaned target feature vector.

[0056] Exemplarily, the preset similarity algorithm may include but is not limited to algorithms such as Euclidean distance, cosine similarity, Jaccard similarity coefficient, and Pearson correlation coefficient.

[0057] For example, if there are three feature vectors A, B, and C, then based on the similarity algorithm, the similarity between feature vectors A and B, the similarity between feature vectors A and C, and the similarity between feature vectors B and C can be calculated respectively. Then, the feature vector whose similarity is greater than the preset similarity threshold is determined as the target feature vector.

[0058] The preset similarity threshold can be set according to actual conditions, and the specific value is not limited here.

[0059] In the embodiment of the present application, after determining the target feature vector, the target feature vector may be cleaned, and the first feature vector may be determined according to the cleaned target feature vector. Exemplarily, a sample sentence containing key information in the first training text may be determined according to the first feature vector.

[0060] It should be noted that data cleaning refers to removing duplicate feature vectors in the target feature vector. For example, if there are two identical feature vectors A in the target feature vector, one of the feature vectors A is retained.

[0061] By using a similarity algorithm to calculate the similarity between every two feature vectors, the feature vector with higher similarity can be used as the first feature vector, thereby extracting key information from the training text through the BERT model, effectively solving the defect of the BERT model causing text information loss due to the limitation of the maximum length of the text. By performing data cleaning on the target feature vector, data redundancy in the first feature vector can be avoided, thereby improving the accuracy of subsequent feature fusion.

[0062] In some embodiments, based on the bidirectional GRU network model, the second feature vector corresponding to the first training text is determined, and the sample sentences corresponding to the first feature vector in the first training text can be removed, and the second training text can be determined based on the remaining sample sentences in the first training text; the second training text is input into the bidirectional GRU network model for feature extraction to obtain the second feature vector.

[0063] It should be noted that the bidirectional GRU network model is a type of recurrent neural network (RNN). The bidirectional GRU network model may include one or more bidirectional GRU units, wherein the bidirectional GRU unit is composed of a state vector reset gate and an update gate. In addition, when processing long texts, the bidirectional GRU model has good efficiency and stability in automatic feature selection and time series dependencies, and can well obtain the dependencies between sentences.

[0064] Exemplarily, the bidirectional GRU network model may be a pre-trained network model, and the specific training process is not limited herein.

[0065] Exemplarily, the remaining sample sentences in the first training text may be determined as the second training text. Then, the sample sentences in the second training text are input into the trained bidirectional GRU network model for feature extraction to obtain a second feature vector corresponding to the second training text.

[0066] By inputting the second training text into the bidirectional GRU network model for secondary feature extraction, the second feature vector is obtained. This not only solves the defect of the BERT model that text information is lost due to the limitation of the maximum length of the text, but also obtains a feature fusion vector containing complete text information and the dependency relationship between sentences through the first feature vector and the second feature vector.

[0067] Step S203: input the first feature vector and the second feature vector into the fuzzy neural network model for iterative training until the fuzzy neural network model converges to obtain the trained feature fusion model.

[0068] In an embodiment of the present application, by inputting the first eigenvector and the second eigenvector into the fuzzy neural network model for iterative training until the fuzzy neural network model converges, not only can the trained feature fusion model have the ability to fuse feature vectors, but also the accuracy of feature fusion of the feature fusion model can be improved.

[0069] Exemplarily, the first feature vector and the second feature vector are simultaneously input into the fuzzy neural network model for iterative training until the fuzzy neural network model converges to obtain a trained feature fusion model. It can be understood that since the feature fusion model includes a BERT model, a bidirectional GRU network model, and a fuzzy neural network model, when the fuzzy neural network model converges, a trained feature fusion model can be obtained.

[0070] It should be noted that the fuzzy neural network model refers to the adaptive fuzzy neural inference system (Adaptive Neuro-Fuzzy Inference System), which is a combination of an adaptive network and a fuzzy inference system. The adaptive fuzzy neural inference system functionally inherits the interpretability of the fuzzy inference system and the learning ability of the adaptive network. It can adjust the model parameters according to prior knowledge to make the output of the model closer to the real output. Among them, the adaptive fuzzy neural inference system uses a hybrid algorithm of the back propagation algorithm and the least squares method to adjust the premise parameters and conclusion parameters, and can automatically generate If-Then rules.

[0071] In some embodiments, before the first feature vector and the second feature vector are input into the fuzzy neural network model for iterative training, it can also include: obtaining a preset synonym set; based on the attention mechanism, assigning weight values ​​to the first feature vector and the second feature vector according to the synonym set, to obtain the first feature vector and the second feature vector after the weight values ​​are assigned.

[0072] Exemplarily, the preset synonym set may be a synonym set in the WordNet knowledge base; wherein the WordNet knowledge base stores synonyms in the form of triples, and each synonym is a set of embeddable matrices.

[0073] In some embodiments, based on the attention mechanism, weight values ​​are assigned to the first eigenvector and the second eigenvector according to the synonym set to obtain the first eigenvector and the second eigenvector after the weight values ​​are assigned, which may include: determining the word similarity matrix corresponding to the first eigenvector and the second eigenvector based on the synonym set; calculating the first similarity between the first eigenvector and the word similarity matrix and calculating the second similarity between the second eigenvector and the word similarity matrix based on a preset similarity algorithm; normalizing the first similarity and the second similarity to obtain a first weight value corresponding to the first eigenvector and a second weight value corresponding to the second eigenvector.

[0074] Exemplarily, a matrix having the same or similar semantics as the sample sentence can be extracted from the synonym set according to the sample sentence corresponding to the first eigenvector and the sample sentence corresponding to the second eigenvector, and the matrix is ​​determined as the word similarity matrix corresponding to the first eigenvector and the second eigenvector. Then, the first similarity between the first eigenvector and the word similarity matrix and the second similarity between the second eigenvector and the word similarity matrix are calculated respectively. Among them, similarity algorithms such as Euclidean distance, cosine similarity, Jaccard similarity coefficient and Pearson correlation coefficient can be used for calculation.

[0075] Exemplarily, the first similarity and the second similarity are normalized to obtain a first weight value corresponding to the first feature vector and a second weight value corresponding to the second feature vector. For example, the first weight value is 0.7 and the second weight value is 0.3.

[0076] By adding synonym sets, not only can the problem of semantic ambiguity be reduced, but also the generalization of the trained feature fusion model can be improved; by allocating weight values ​​to the first eigenvector and the second eigenvector based on the synonym set based on the attention mechanism, the input of the fuzzy neural network model can be corrected, thereby improving the accuracy of the fusion features of the fuzzy neural network model.

[0077] In some embodiments, inputting the first feature vector and the second feature vector into the fuzzy neural network model for iterative training may include: inputting the first feature vector and the second feature vector after weight values ​​are assigned into the fuzzy neural network model for iterative training.

[0078] Exemplarily, the first feature vector is input into the fuzzy neural network model according to the first weight value, and the second feature vector is input into the fuzzy neural network model according to the second weight value for iterative training.

[0079] Exemplarily, the training process of the fuzzy neural network model is as follows: according to the first eigenvector and the second eigenvector after the weight values ​​are assigned, the training sample data for each round of training is determined; the current round of training sample data is input into the fuzzy neural network model for feature fusion training to obtain the feature fusion prediction vector corresponding to the current round of training sample data; based on the least squares estimation algorithm, the loss function value corresponding to the feature fusion prediction vector is determined; if the loss function value is greater than a preset loss value threshold, the parameters of the fuzzy neural network model are adjusted based on the error back propagation algorithm, and the next round of training is performed until the loss function value obtained is less than or equal to the loss value threshold, the training is terminated, and the trained fuzzy neural network model is obtained.

[0080] Exemplarily, the preset loss value threshold can be set according to actual conditions, and the specific value is not limited here.

[0081] It should be noted that the Error Back Propagation (BP) algorithm is a multi-layer feedforward neural network trained according to the Error Back Propagation algorithm.

[0082] By using a hybrid learning algorithm that combines the least squares estimation algorithm and the error back propagation algorithm to adjust the parameters of the fuzzy neural network model, not only can the dimension of the search space of the BP method alone be reduced, but also the time required for the fuzzy neural network model to converge can be reduced and the training speed can be improved.

[0083] To further ensure the privacy and security of the trained feature fusion model, the trained feature fusion model can also be stored in a node of a blockchain. When the trained feature fusion model needs to be used, it can be called from the node of the blockchain.

[0084] In an embodiment of the present application, after the feature fusion model is trained, the target text may be input into the trained feature fusion model for fusion processing, so that a feature fusion vector corresponding to the target text may be obtained.

[0085] Exemplarily, the target text is input into a feature fusion model for fusion processing to obtain a feature fusion vector corresponding to the target text, including: splitting the target text to obtain at least one target sentence corresponding to the target text; inputting each target sentence into a BERT model for vectorization to obtain a feature vector corresponding to each target sentence; determining a third feature vector based on the feature vector corresponding to each target sentence; determining a fourth feature vector based on the third feature vector and the target text based on a bidirectional GRU network model; inputting the third feature vector and the fourth feature vector into a fuzzy neural network model for fusion processing to obtain a feature fusion vector.

[0086] Among them, when determining the fourth feature vector based on the third feature vector and the target text, the target sentence corresponding to the third feature vector in the target text can be removed, and the second target text can be determined based on the remaining target sentences in the target text; the second target text is input into the bidirectional GRU network model for feature extraction to obtain the fourth feature vector.

[0087] By inputting the target text into the feature fusion model for fusion processing, the fuzzy neural network model can be used to fuse the feature vectors output by the BERT model and the bidirectional GRU model. The obtained feature fusion vector contains the complete information of the text and the dependency relationship between sentences, which can effectively make up for the defect of text information loss caused by the maximum length of the text in the BERT model.

[0088] Step S30: input the feature fusion vector into a semantic prediction model to perform semantic prediction, and obtain a semantic prediction result corresponding to the target text.

[0089] In the embodiment of the present application, the semantic prediction model can be set according to different semantic prediction tasks. Exemplarily, the semantic prediction model can include a bidirectional GRU network model and a fully connected layer, or other classification models, such as a convolutional neural network, a restricted Boltzmann machine, and the like.

[0090] Exemplarily, the feature fusion vector may be input into a semantic prediction model to perform semantic prediction, and obtain a semantic prediction result corresponding to the target text, wherein the semantic prediction result may include a semantic category.

[0091] It should be noted that semantic categories refer to the categories of language expressions divided according to semantic relationships. Exemplarily, semantic categories may include but are not limited to synonymy, antonymy, class inclusion, part-whole, and event, etc.

[0092] Exemplarily, a normalization layer may be added to the semantic prediction model, so that the semantic prediction result output by the semantic prediction model includes the probability of semantic categories corresponding to the semantic categories.

[0093] The accuracy of semantic prediction is improved by inputting the feature fusion vector output by the feature fusion model into the semantic prediction model for semantic prediction.

[0094] The semantic prediction method of the text provided in the above embodiment can improve the accuracy of feature fusion performed by the feature fusion model and the generalization of the feature fusion model by training the feature fusion model. The fused feature vector output by the feature fusion model can be applied to different semantic prediction tasks. By inputting the sample sentence into the BERT model for vectorization, a semantically enhanced feature vector can be obtained. The similarity between every two feature vectors is calculated by a similarity algorithm, and the feature vector with higher similarity can be used as the first feature vector, thereby realizing the key information extracted from the training text by the BERT model, and effectively solving the defect of the BERT model causing the loss of text information due to the limitation of the maximum length of the text. By performing data cleaning on the target feature vector, data redundancy in the first feature vector can be avoided, thereby improving the accuracy of subsequent feature fusion. By inputting the second training text into the bidirectional GRU network model for secondary feature extraction to obtain the second feature vector, not only the defect of the BERT model causing the loss of text information due to the limitation of the maximum length of the text is solved, but also the first feature vector and the second feature vector can be used to obtain the complete information of the text and the dependencies between sentences. By adding a synonym set, not only can the problem of semantic ambiguity be reduced, but also the generalization of the trained feature fusion model can be improved; by allocating weight values ​​to the first feature vector and the second feature vector based on the attention mechanism according to the synonym set, the input of the fuzzy neural network model can be corrected, thereby improving the accuracy of the fusion features of the fuzzy neural network model; by using a hybrid learning algorithm that combines the least squares estimation algorithm and the error back propagation algorithm to adjust the parameters of the fuzzy neural network model, not only can the dimension of the search space using the BP method alone be reduced, but also the time required for the fuzzy neural network model to converge can be reduced, thereby improving the training speed; by inputting the target text into the feature fusion model for fusion processing, the fuzzy neural network model can fuse the feature vectors output by the BERT model and the bidirectional GRU model, and the obtained feature fusion vector contains the complete information of the text and the dependency relationship between sentences, which can effectively make up for the defect of the BERT model in losing text information due to the limitation of the maximum length of the text; by inputting the feature fusion vector output by the feature fusion model into the semantic prediction model for semantic prediction, the accuracy of semantic prediction is improved.

[0095] See also Figure 5 , Figure 5The embodiment of the present application further provides a schematic block diagram of a text semantic prediction device 1000, which is used to execute the aforementioned text semantic prediction method. The text semantic prediction device can be configured in a server or a terminal.

[0096] like Figure 5 As shown, the text semantic prediction device 1000 includes: a target text acquisition module 1001, a feature fusion processing module 1002 and a semantic prediction module 1003.

[0097] The target text acquisition module 1001 is used to acquire the target text to be semantically predicted.

[0098] The feature fusion processing module 1002 is used to input the target text into the feature fusion model for fusion processing to obtain the feature fusion vector corresponding to the target text, wherein the feature fusion model includes a BERT model, a bidirectional GRU network model and a fuzzy neural network model, and the fuzzy neural network model is used to fuse the feature vectors output by the BERT model and the bidirectional GRU network model.

[0099] The semantic prediction module 1003 is used to input the feature fusion vector into a semantic prediction model to perform semantic prediction and obtain a semantic prediction result corresponding to the target text.

[0100] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described device and each module can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0101] The above-mentioned device can be implemented in the form of a computer program. Figure 6 Runs on the computer device shown.

[0102] See also Figure 6 , Figure 6 1 is a schematic block diagram of a computer device provided in an embodiment of the present application. The computer device may be a server or a terminal.

[0103] See also Figure 6 The computer device includes a processor and a memory connected via a system bus, wherein the memory may include a non-volatile storage medium and an internal memory.

[0104] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.

[0105] The internal memory provides an environment for the operation of the computer program in the non-volatile storage medium. When the computer program is executed by the processor, the processor can execute any semantic prediction method of the text.

[0106] It should be understood that the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0107] In one embodiment, the processor is used to run a computer program stored in the memory to implement the following steps:

[0108] Obtain a target text to be semantically predicted; input the target text into a feature fusion model for fusion processing to obtain a feature fusion vector corresponding to the target text, wherein the feature fusion model includes a BERT model, a bidirectional GRU network model and a fuzzy neural network model, and the fuzzy neural network model is used to fuse the feature vectors output by the BERT model and the bidirectional GRU network model; input the feature fusion vector into a semantic prediction model for semantic prediction to obtain a semantic prediction result corresponding to the target text.

[0109] In one embodiment, before implementing the inputting of the target text into the feature fusion model for fusion processing, the processor is further configured to implement:

[0110] Obtain a preset number of first training texts; determine a first feature vector corresponding to the first training text based on the BERT model, and determine a second feature vector corresponding to the first training text based on the bidirectional GRU network model; input the first feature vector and the second feature vector into the fuzzy neural network model for iterative training until the fuzzy neural network model converges to obtain the trained feature fusion model.

[0111] In one embodiment, before determining the first feature vector corresponding to the first training text based on the BERT model, the processor is further configured to implement:

[0112] The first training text is split to obtain at least one sample sentence corresponding to the first training text.

[0113] In one embodiment, when determining the first feature vector corresponding to the first training text based on the BERT model, the processor is used to implement:

[0114] Each of the sample sentences is input into the BERT model for vectorization to obtain a feature vector corresponding to each of the sample sentences; and the first feature vector is determined according to the feature vector corresponding to each of the sample sentences.

[0115] In one embodiment, when determining the first feature vector according to the feature vector corresponding to each of the sample sentences, the processor is configured to implement:

[0116] Based on a preset similarity algorithm, the similarity between every two feature vectors is determined; a feature vector whose similarity is greater than a preset similarity threshold is determined as a target feature vector; data cleaning is performed on the target feature vector, and the first feature vector is determined according to the cleaned target feature vector.

[0117] In one embodiment, the processor determines the second feature vector corresponding to the first training text based on the bidirectional GRU network model to implement:

[0118] The sample sentences corresponding to the first feature vector in the first training text are removed, and the second training text is determined according to the remaining sample sentences in the first training text; the second training text is input into the bidirectional GRU network model for feature extraction to obtain the second feature vector.

[0119] In one embodiment, before inputting the first feature vector and the second feature vector into the fuzzy neural network model for iterative training, the processor is further configured to implement:

[0120] Obtain a preset synonym set; based on an attention mechanism, assign weight values ​​to the first feature vector and the second feature vector according to the synonym set to obtain the first feature vector and the second feature vector after the weight values ​​are assigned.

[0121] In one embodiment, when the processor implements inputting the first feature vector and the second feature vector into the fuzzy neural network model for iterative training, the processor is used to implement:

[0122] The first feature vector and the second feature vector after weight values ​​are assigned are input into the fuzzy neural network model for iterative training.

[0123] In one embodiment, when the processor inputs the target text into a feature fusion model for fusion processing to obtain a feature fusion vector corresponding to the target text, it is used to implement:

[0124] The target text is split to obtain at least one target sentence corresponding to the target text; each of the target sentences is input into the BERT model for vectorization to obtain a feature vector corresponding to each of the target sentences; a third feature vector is determined according to the feature vector corresponding to each of the target sentences; a fourth feature vector is determined according to the third feature vector and the target text based on the bidirectional GRU network model; the third feature vector and the fourth feature vector are input into the fuzzy neural network model for fusion processing to obtain the feature fusion vector.

[0125] A computer-readable storage medium is also provided in an embodiment of the present application, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and the processor executes the program instructions to implement any text semantic prediction method provided in the embodiment of the present application.

[0126] The computer-readable storage medium may be an internal storage unit of the computer device described in the above embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital card (Secure Digital Card, SD Card), a flash card (Flash Card), etc. equipped on the computer device.

[0127] Furthermore, the computer-readable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the blockchain node, etc.

[0128] The blockchain referred to in this application is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.

[0129] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.

Claims

1. A text semantic prediction method, It is characterized in that include: Obtaining the target text for semantic prediction; Input the target text into a feature fusion model for fusion processing to obtain a feature fusion vector corresponding to the target text, wherein the feature fusion model includes a BERT model, a bidirectional GRU network model and a fuzzy neural network model, and the fuzzy neural network model is used to fuse the feature vectors output by the BERT model and the bidirectional GRU network model; Inputting the feature fusion vector into a semantic prediction model for semantic prediction to obtain a semantic prediction result corresponding to the target text; Before the target text is input into the feature fusion model for fusion processing, the method further includes: obtaining a preset number of first training texts; determining a first feature vector corresponding to the first training text based on the BERT model, and determining a second feature vector corresponding to the first training text based on the bidirectional GRU network model; inputting the first feature vector and the second feature vector into the fuzzy neural network model for iterative training until the fuzzy neural network model converges to obtain the trained feature fusion model; The method of determining the second feature vector corresponding to the first training text based on the bidirectional GRU network model includes: removing sample sentences corresponding to the first feature vector in the first training text, and determining the second training text based on the remaining sample sentences in the first training text; inputting the second training text into the bidirectional GRU network model for feature extraction to obtain the second feature vector, wherein the sample sentences corresponding to the first feature vector are sample sentences containing key information in the first training text.

2. The text semantic prediction method according to claim 1, It is characterized in that Before determining the first feature vector corresponding to the first training text based on the BERT model, the method further includes: Splitting the first training text to obtain at least one sample sentence corresponding to the first training text; The determining, based on the BERT model, a first feature vector corresponding to the first training text includes: Input each of the sample sentences into the BERT model for vectorization to obtain a feature vector corresponding to each of the sample sentences; The first feature vector is determined according to the feature vector corresponding to each of the sample sentences.

3. The text semantic prediction method according to claim 2, It is characterized in that The determining the first feature vector according to the feature vector corresponding to each of the sample sentences includes: Based on a preset similarity algorithm, determining the similarity between every two of the feature vectors; Determine a feature vector whose similarity is greater than a preset similarity threshold as a target feature vector; The target feature vector is cleaned, and the first feature vector is determined according to the cleaned target feature vector.

4. The text semantic prediction method according to claim 1, It is characterized in that Before inputting the first feature vector and the second feature vector into the fuzzy neural network model for iterative training, the method further includes: Get the preset synonym set; Based on the attention mechanism, weight values ​​are assigned to the first feature vector and the second feature vector according to the synonym set to obtain the first feature vector and the second feature vector after weight value assignment; The step of inputting the first feature vector and the second feature vector into the fuzzy neural network model for iterative training includes: The first feature vector and the second feature vector after weight values ​​are assigned are input into the fuzzy neural network model for iterative training.

5. The text semantic prediction method according to any one of claims 1 to 4, It is characterized in that The step of inputting the target text into the feature fusion model for fusion processing to obtain the feature fusion vector corresponding to the target text comprises: Splitting the target text to obtain at least one target sentence corresponding to the target text; Input each of the target sentences into the BERT model for vectorization to obtain a feature vector corresponding to each of the target sentences; Determine a third feature vector according to the feature vector corresponding to each of the target sentences; Based on the bidirectional GRU network model, determining a fourth feature vector according to the third feature vector and the target text; The third eigenvector and the fourth eigenvector are input into the fuzzy neural network model for fusion processing to obtain the feature fusion vector.

6. A semantic prediction device for text, It is characterized in that The method for semantic prediction of a text according to any one of claims 1 to 5 is used, wherein the semantic prediction device comprises: A target text acquisition module is used to acquire the target text to be semantically predicted; A feature fusion processing module, used for inputting the target text into a feature fusion model for fusion processing, and obtaining a feature fusion vector corresponding to the target text, wherein the feature fusion model includes a BERT model, a bidirectional GRU network model and a fuzzy neural network model, and the fuzzy neural network model is used for fusion processing of the feature vectors output by the BERT model and the bidirectional GRU network model; The semantic prediction module is used to input the feature fusion vector into the semantic prediction model for semantic prediction to obtain the semantic prediction result corresponding to the target text.

7. A computer device, It is characterized in that The computer device includes a memory and a processor; The memory is used to store computer programs; The processor is used to execute the computer program and implement the text semantic prediction method according to any one of claims 1 to 5 when executing the computer program.

8. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the text semantic prediction method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Fuzzy neural network based sentence matching degree calculation method and fuzzy neural network based sentence alignment method

    CN103617227A

  • Text similarity measurement method based on semantic document expression

    CN111444700A