Text keyword association method and device, equipment and storage medium
By adding a semantic feature layer to the basic vector transformation network and training the model using business text data, and combining word frequency and point mutual information values to perform text keyword association, the problem of low accuracy in existing technologies is solved, and more accurate word association is achieved.
Patent Information
- Application Number
- CN202211149555.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-21
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2042-09-21
AI Technical Summary
In existing technologies, the accuracy of text keyword association through methods such as word frequency screening, hot word analysis, and word cloud is not high, especially in large-scale text analysis where it is prone to noise and excessive associated words.
Multiple semantic feature layers are added to the basic vector transformation network. The model is trained using a business text dataset. A candidate set of related words is extracted through word frequency and point mutual information values. Vector transformation is performed using a standard vector transformation model. A related vocabulary graph is constructed based on vector similarity.
It improves the accuracy of text keyword association, reduces noisy data, and can more accurately reflect the relationships between words.
Smart Images

Figure CN115510188B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of artificial intelligence, and in particular to a text keyword association method and device, electronic equipment and readable storage medium. BACKGROUND
[0002] With the development of artificial intelligence, text analysis is becoming more and more important. In large-scale text analysis, it is often necessary to know what the text is mainly about. Usually, the keywords in the text are extracted, and then the keyword association vocabulary analysis is performed, so that the general meaning of the text can be understood more intuitively.
[0003] In the prior art, the common keyword association vocabulary method mainly determines the association vocabulary by screening word frequency (hot word analysis, word cloud diagram, etc.), part-of-speech, pmi (point mutual information) and other parameters. However, the vocabulary association effect of these rules parameters is not ideal, there are many noises, and the more the text, the more the association vocabulary, which cannot accurately associate the keywords. SUMMARY
[0004] The present application provides a text keyword association method, device, electronic equipment and readable storage medium, which can improve the accuracy of text keyword association.
[0005] To achieve the above purpose, the present application provides a text keyword association method, comprising:
[0006] A plurality of semantic feature layers are added to a pre-constructed basic vector conversion network to obtain an original vector conversion model;
[0007] A business text data set is obtained, and the original vector conversion model is trained using the business text data set to obtain a standard vector conversion model;
[0008] A text to be associated is obtained, and a candidate association word set is extracted from the text to be associated based on the word frequency and point mutual information value of the vocabulary in the text to be associated;
[0009] The candidate association word set is converted into a vector set using the standard vector conversion model, and the target keyword in the candidate association word set is associated with the association word based on the similarity of each vector in the association word vector set to obtain an association vocabulary graph.
[0010] Optionally, the plurality of semantic feature layers are added to the pre-constructed basic vector conversion network to obtain the original vector conversion model, comprising:
[0011] An entity recognition layer and a filtering layer are added after the input layer of the basic vector conversion network;
[0012] adding a dependency syntax analysis layer and a part-of-speech tagging layer between the mapping layer and the output layer of the base vector conversion network, wherein the dependency syntax analysis layer and the part-of-speech tagging layer are connected in series;
[0013] The model added with the entity recognition layer, the filtering layer, the dependency syntax analysis layer and the part-of-speech tagging layer is used as an original vector conversion model.
[0014] Optionally, the model training of the original vector conversion model by using the set of business text data comprises the following steps.
[0015] A sliding window of a preset size is used to slide and select texts in the set of business text data, to obtain a first set of training texts and input the first set of training texts into an input layer of the original vector conversion model;
[0016] An entity recognition layer of the original vector conversion model is used to perform entity recognition and marking on the texts in the first set of training texts, and a preset marked entity is deleted to obtain a second set of training texts;
[0017] A filtering layer of the original vector conversion model is used to delete texts of a preset type in the second set of training texts to obtain a third set of training texts;
[0018] The texts in the third set of training texts are one-hot encoded to obtain a set of encoded vectors;
[0019] A mapping layer of the original vector conversion model is used to perform weighted averaging on the vectors in the set of encoded vectors to obtain a weighted vector;
[0020] A dependency syntax analysis layer and a part-of-speech tagging layer of the original vector conversion model are used to perform semantic splicing on the weighted vector to obtain a spliced vector;
[0021] An output layer of the original vector conversion model is used to output a prediction probability of the spliced vector, and when the prediction probability is less than a pre-constructed prediction threshold, the model parameters of the original vector conversion model are adjusted, and the step of performing weighted averaging on the vectors in the set of encoded vectors by using the mapping layer of the original vector conversion model is returned until the original vector conversion model converges, the training is stopped, and the standard vector conversion model is obtained.
[0022] Optionally, the semantic splicing of the weighted vector by using the dependency syntax analysis layer and the part-of-speech tagging layer of the original vector conversion model to obtain a spliced vector comprises the following steps.
[0023] The dependency syntax analysis layer is used to mark the syntactic relationship between words in the weighted vector to obtain a syntactic relationship vector;
[0024] labeling the part-of-speech relationship between words in the weighted vector by using the part-of-speech labeling layer to obtain a part-of-speech labeled vector;
[0025] splicing the syntax relationship vector and the labeled vector to obtain a spliced vector.
[0026] Optionally, the candidate association word set is extracted from the text to be associated based on the word frequency and the point mutual information value of the words in the text to be associated, comprising:
[0027] performing word segmentation processing on the text to be associated, and counting the word frequency of each word, and taking the word segmentation whose word frequency is greater than or equal to a preset word frequency threshold as a high-frequency word;
[0028] calculating the point mutual information between each high-frequency word, and taking the high-frequency word whose point mutual information is greater than or equal to a preset information threshold as a candidate association word, and collecting all candidate association words to obtain a candidate association word set.
[0029] Optionally, the candidate association word set is converted into a vector set by using the standard vector conversion model, and a target keyword in the candidate association word set is associated with an association word based on the similarity of each vector in the association word vector set, to obtain an association word graph, comprising:
[0030] selecting a target keyword from the candidate association word set based on a user instruction;
[0031] converting the target keyword and the non-target keyword in the candidate association word set into a vector set by using the standard vector conversion model, to obtain an association word vector set containing a target vector and a non-target vector;
[0032] calculating the similarity between the non-target vector and the target vector, and taking the non-target vector whose similarity is greater than or equal to a preset similarity threshold as a first association vector;
[0033] calculating the similarity between the non-target vector and the first association vector, and taking the non-target vector whose similarity is greater than or equal to a preset similarity threshold as a second association vector;
[0034] taking the target keyword corresponding to the target vector as a root node, taking the candidate association word corresponding to the first association vector as a first association node, and taking the candidate association word corresponding to the second association vector as a second association node;
[0035] connecting the root node with the first association node, and connecting the first association node with the second association node, to obtain an association word graph.
[0036] Optionally, the weighted vector is calculated by the following formula:
[0037]
[0038] wherein V(t) represents a weight vector, E k represents the kth text vector, W1 k represents the first weight matrix corresponding to the kth text vector, and n represents the number of texts in the third training text set.
[0039] To solve the above problems, the application further provides a text keyword association device, which comprises:
[0040] a model construction module, configured to add a plurality of semantic feature layers in a pre-constructed basic vector conversion network to obtain an original vector conversion model;
[0041] a model training module, configured to obtain a business text data set, and perform model training on the original vector conversion model by using the business text data set to obtain a standard vector conversion model;
[0042] a candidate association word extraction module, configured to obtain a text to be associated, and extract a candidate association word set from the text to be associated based on the word frequency and point mutual information value of the words in the text to be associated;
[0043] a text keyword association module, configured to perform vector conversion on the candidate association word set by using the standard vector conversion model to obtain an association word vector set, and perform association of association words on a target keyword in the candidate association word set based on the similarity of each vector in the association word vector set to obtain an association word graph.
[0044] To solve the above problems, the application further provides an electronic device, which comprises:
[0045] a memory, configured to store at least one computer program; and
[0046] a processor, configured to execute the computer program stored in the memory to implement the above-mentioned text keyword association method.
[0047] To solve the above problems, the application further provides a computer readable storage medium, which stores at least one computer program, and the at least one computer program is executed by a processor in an electronic device to implement the above-mentioned text keyword association method.
[0048] The application can reduce noise data, learn the correlation between semantics, and improve the accuracy of word correlation by adding a plurality of semantic feature layers in a pre-constructed basis vector conversion network and training the original vector conversion model using a real service text data set. Meanwhile, the candidate correlation word set is extracted by word frequency and point mutual information value, and the candidate correlation words are converted into vectors using a standard vector conversion model. The closeness of each candidate correlation word is determined by the similarity between the vectors, and the correlation word graph is obtained, which can accurately and intuitively reflect the correlation between words. Therefore, the text keyword correlation method, device, electronic equipment and computer readable storage medium provided by the application can improve the accuracy of text keyword correlation. BRIEF DESCRIPTION OF DRAWINGS
[0049] Figure 1 A flowchart of a text keyword correlation method provided by an embodiment of the application is shown.
[0050] Figure 2 A function module diagram of a text keyword correlation device provided by an embodiment of the application is shown.
[0051] Figure 3 A structural diagram of an electronic device for implementing the text keyword correlation method provided by an embodiment of the application is shown.
[0052] The implementation, functional features and advantages of the application will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION
[0053] It should be understood that the specific embodiments described herein are only used to explain the application and not to limit the application.
[0054] The embodiment of the application provides a text keyword correlation method. The execution subject of the text keyword correlation method includes but is not limited to at least one of the electronic devices capable of being configured to execute the method provided by the embodiment of the application, such as a server and a terminal. In other words, the text keyword correlation method can be executed by software or hardware installed in a terminal device or a server device, and the software can be a blockchain platform. The server includes but is not limited to a single server, a server cluster, a cloud server or a cloud server cluster, etc. The server can be a stand-alone server, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content distribution networks (CDN), and big data and artificial intelligence platforms, etc. basic cloud computing services.
[0055] REFERENCE Figure 1As shown, a flowchart of a text keyword association method provided by an embodiment of the present application is shown. In this embodiment, the text keyword association method comprises the following steps S1-S4:
[0056] S1, adding a plurality of semantic feature layers in a pre-constructed basic vector conversion network to obtain an original vector conversion model.
[0057] In the embodiment of the present application, the pre-constructed basic vector conversion network can be a CBOW (Continous Bag of Words Model) model, and the central idea is to combine context information to predict the middle word, so as to train the word vector of each word.
[0058] In an optional embodiment of the present application, the pre-constructed basic vector conversion network comprises an input layer, a mapping layer and an output layer.
[0059] The basic vector conversion network mainly comprises an INPUT (input) layer, a PROJECTION (mapping) layer and an OUTPUT (output) layer, wherein the input layer obtains the word vector of each word, the mapping layer is used for vector superposition, and the output layer obtains the predicted keyword through word vector regression analysis operation.
[0060] In the embodiment of the present application, the adding of a plurality of semantic feature layers in the pre-constructed basic vector conversion network to obtain the original vector conversion model comprises:
[0061] An entity recognition layer and a filtering layer are added after the input layer of the basic vector conversion network;
[0062] A dependency syntax analysis layer and a part-of-speech tagging layer are added between the mapping layer and the output layer of the basic vector conversion network, wherein the dependency syntax analysis layer and the part-of-speech tagging layer are connected in series.
[0063] The model added with the entity recognition layer, the filtering layer, the dependency syntax analysis layer and the part-of-speech tagging layer is used as the original vector conversion model.
[0064] In an optional embodiment of the present application, the plurality of semantic feature layers comprises an entity recognition layer, a filtering layer, a dependency parsing layer and a part-of-speech tagging layer. The entity recognition (NER) layer is used to mark or filter some entities in the text, such as time, number, amount, etc. The filtering (FILTERING) layer is used to filter some words without actual meaning, such as punctuation marks, stop words, virtual words, etc. The dependency parsing (DEP) layer is used to analyze the syntactic relationship between words in a sentence and represent it as a tree structure, i.e., to obtain the dependency relationship of the context. The part-of-speech tagging (POS) layer is used to mark the part-of-speech of each word in the sentence (also known as word class, grammatical category, etc.). For example, using the hanlp natural language processing toolkit, the main methods include HMM part-of-speech tagging, perceptron part-of-speech tagging, CRF part-of-speech tagging, etc.
[0065] In the embodiment of the present application, by adding a plurality of semantic feature layers, the model output can pay more attention to the context information of the word vector of the text, thereby improving the accuracy of keyword association.
[0066] S2, obtain a business text data set, and use the business text data set to perform model training on the original vector conversion model to obtain a standard vector conversion model.
[0067] In the embodiment of the present application, the business text data set can be business texts in different fields. For example, in the financial field, the business text data set can be product texts, transaction texts, user texts, etc. of insurance, fund and other products.
[0068] In detail, the use of the business text data set to perform model training on the original vector conversion model to obtain a standard vector conversion model comprises:
[0069] A sliding window of a preset size is used to slide and select the texts in the business text data set to obtain a first training text set and input into the input layer of the original vector conversion model;
[0070] An entity recognition layer of the original vector conversion model is used to perform entity recognition and marking on the texts in the first training text set, and a preset marked entity is deleted to obtain a second training text set;
[0071] A filtering layer of the original vector conversion model is used to delete a preset type of text in the second training text set to obtain a third training text set;
[0072] perform one-hot encoding on the texts in the third training text set to obtain a set of encoded vectors;
[0073] perform weighted averaging on the vectors in the set of encoded vectors by using a mapping layer of the original vector conversion model to obtain a weighted vector;
[0074] perform semantic splicing on the weighted vector by using a dependency syntax analysis layer and a part-of-speech tagging layer of the original vector conversion model to obtain a spliced vector;
[0075] output a prediction probability of the spliced vector by using an output layer of the original vector conversion model, adjust model parameters of the original vector conversion model when the prediction probability is less than a pre-constructed prediction threshold, and return to the step of performing weighted averaging on the vectors in the set of encoded vectors by using the mapping layer of the original vector conversion model until the original vector conversion model converges, stop training, and obtain the standard vector conversion model.
[0076] In an optional embodiment of the present application, the size of the sliding window is n, and n words before and after the center word are selected as training texts. For example, when the business text is "XX is a currency fund", n = 2, and the middle word is "currency", the input layer inputs the texts "is", "currency", "fund", and "money". The preset mark can be a digital mark, and time, numbers, and money can be filtered by deleting the digital mark entity; and the text of the preset type can be a preset stop word or a virtual word.
[0077] In an optional embodiment of the present application, the weighted vector is calculated by the following formula:
[0078]
[0079] wherein V(t) represents the weighted vector, E k represents the kth text vector, W1 k represents the first weight matrix corresponding to the kth text vector, and n represents the number of texts in the third training text set.
[0080] In detail, the performing semantic splicing on the weighted vector by using the dependency syntax analysis layer and the part-of-speech tagging layer to obtain a spliced vector comprises:
[0081] labeling the syntactic relationship between words in the weighted vector by using the dependency syntax analysis layer to obtain a syntactic relationship vector;
[0082] labeling the part-of-speech relationship between words in the weighted vector by using the part-of-speech tagging layer to obtain a part-of-speech tagging vector;
[0083] splicing the syntactic relationship vector and the part-of-speech tagging vector to obtain a spliced vector.
[0084] In an optional embodiment of the present application, the dependency syntax analysis layer and the part-of-speech tagging layer can be constructed by using the hanlp natural language processing toolkit.
[0085] In an optional embodiment of the present application, for the service text in the input layer, after filtering by the NER layer and the FILTERING layer, the text is one-hot encoded, the encoded vectors are multiplied by the first weight matrix W1 in the SUM layer, the average of each vector is taken to obtain a weighted vector, the weighted vector is input into the DEP and POS layers, the spliced vector is obtained after splicing, and then multiplied by the second weight matrix W2, output to the subsequent OUTPUT layer, and the softmax is used to predict the prediction probability of the intermediate word, and the iteration is repeated to obtain a standard vector conversion model. Since the traditional CBOW model is improved, various linguistic knowledge (ner, dep, pos, etc.) is fully utilized, the model learns the correlation information between key words more accurately, and the word vector is obtained by training on large-scale financial texts, which is more suitable for the knowledge in the financial field.
[0086] S3, obtaining a to-be-associated text, and extracting a candidate associated word set from the to-be-associated text based on the word frequency and the point mutual information value of the words in the to-be-associated text.
[0087] In the embodiment of the present application, the to-be-associated text can be a text in the financial field to be associated with words. The point mutual information value (Pointwise Mutual Information, PMI) is used to measure the correlation between two words.
[0088] In detail, the candidate associated word set is extracted from the to-be-associated text based on the word frequency and the point mutual information value of the words in the to-be-associated text, including:
[0089] The to-be-associated text is subjected to word segmentation processing, and the word frequency of each word segmentation is counted, and the word segmentation with a word frequency greater than or equal to a preset word frequency threshold is taken as a high-frequency word;
[0090] The point mutual information between each high-frequency word is calculated, the high-frequency word with a point mutual information greater than or equal to a preset information threshold is taken as a candidate associated word, and all candidate associated words are collected to obtain a candidate associated word set.
[0091] In an optional embodiment of the present application, the point mutual information between high-frequency words is calculated by the following formula:
[0092]
[0093] Wherein, PMI(x, y) represents the point mutual information between high-frequency words x and high-frequency words y, p(x, y) represents the probability of the simultaneous occurrence of high-frequency words x and high-frequency words y, p(x) represents the probability of the occurrence of high-frequency words x, and p(y) represents the probability of the occurrence of high-frequency words y.
[0094] S4, vector conversion of the candidate association word set is performed by using the standard vector conversion model to obtain an association word vector set, and association words in the candidate association word set are associated based on the similarity of each vector in the association word vector set to obtain an association word graph.
[0095] In detail, the vector conversion of the candidate association word set by using the standard vector conversion model to obtain an association word vector set, and the association of the target keyword in the candidate association word set based on the similarity of each vector in the association word vector set to obtain an association word graph, comprises:
[0096] Selecting a target keyword from the candidate association word set based on a user instruction;
[0097] Vector conversion of the target keyword and the non-target keyword in the candidate association word set by using the standard vector conversion model to obtain an association word vector set containing a target vector and a non-target vector;
[0098] Calculating the similarity between the non-target vector and the target vector, and taking the non-target vector with a similarity greater than or equal to a preset similarity threshold as a first association vector;
[0099] Calculating the similarity between the non-target vector and the first association vector, and taking the non-target vector with a similarity greater than or equal to a preset similarity threshold as a second association vector;
[0100] Taking the target keyword corresponding to the target vector as a root node, taking the candidate association word corresponding to the first association vector as a first association node, and taking the candidate association word corresponding to the second association vector as a second association node;
[0101] Connecting the root node and the first association node, and connecting the first association node and the second association node to obtain an association word graph.
[0102] In the embodiment of the application, the vector conversion by the standard vector conversion model can add semantic features in the vector, and the accuracy of semantic association is improved.
[0103] In an optional embodiment of the application, the similarity between vectors can be calculated by a cosine similarity algorithm
[0104] The application can reduce noise data, learn the correlation between semantics, and improve the accuracy of vocabulary correlation by adding multiple semantic feature layers in a pre-constructed basic vector conversion network and training the original vector conversion model using a real business text data set. Meanwhile, the candidate correlation word set is extracted by word frequency and point mutual information value, and the candidate correlation words are vector converted using the standard vector conversion model. The closeness of each candidate correlation word is determined by the similarity between vectors, and the correlation word graph is obtained, which can accurately and intuitively reflect the correlation between words. Therefore, the text keyword correlation method provided by the application can improve the accuracy of text keyword correlation.
[0105] As Figure 2 shown, it is a functional module diagram of a text keyword correlation device provided by an embodiment of the application.
[0106] The text keyword correlation device 100 can be installed in an electronic device. According to the implemented functions, the text keyword correlation device 100 can include a model construction module 101, a model training module 102, a candidate correlation word extraction module 103, and a text keyword correlation module 104. The modules of the application can also be referred to as units, which refer to a series of computer program segments that can be executed by an electronic device processor and can complete fixed functions, which are stored in the memory of the electronic device.
[0107] In this embodiment, the functions of each module / unit are as follows:
[0108] The model construction module 101 is configured to add multiple semantic feature layers in a pre-constructed basic vector conversion network to obtain an original vector conversion model.
[0109] The model training module 102 is configured to obtain a business text data set and train the original vector conversion model using the business text data set to obtain a standard vector conversion model.
[0110] The candidate correlation word extraction module 103 is configured to obtain a text to be associated and extract a candidate correlation word set from the text to be associated based on the word frequency and point mutual information value of the words in the text to be associated.
[0111] The text keyword correlation module 104 is configured to vector convert the candidate correlation word set using the standard vector conversion model to obtain a correlation word vector set, correlate target keywords in the candidate correlation word set based on the similarity of each vector in the correlation word vector set, and obtain a correlation word graph.
[0112] In detail, the specific implementation of each module of the text keyword correlation device 100 is as follows:
[0113] Step one, add multiple semantic feature layers in the pre-constructed basic vector conversion network to obtain an original vector conversion model.
[0114] In the embodiment of the application, the pre-constructed basic vector conversion network can be a CBOW (Continous Bag of Words Model) model, and the central idea is to combine context information to predict the middle word, so as to train the word vector of each word.
[0115] In an optional embodiment of the application, the pre-constructed basic vector conversion network comprises an input layer, a mapping layer and an output layer.
[0116] The basic vector conversion network mainly comprises an INPUT (input) layer, a PROJECTION (mapping) layer and an OUTPUT (output) layer, wherein the input layer obtains the word vector of each word, the mapping layer is used for vector superposition, and the output layer obtains the predicted key word through word vector regression analysis operation.
[0117] In the embodiment of the application, the multiple semantic feature layers are added in the pre-constructed basic vector conversion network to obtain the original vector conversion model, comprising:
[0118] An entity recognition layer and a filtering layer are added after the input layer of the basic vector conversion network;
[0119] A dependency syntax analysis layer and a part-of-speech tagging layer are added between the mapping layer and the output layer of the basic vector conversion network, wherein the dependency syntax analysis layer and the part-of-speech tagging layer are connected in series.
[0120] The model with the added entity recognition layer, filtering layer, dependency syntax analysis layer and part-of-speech tagging layer is used as the original vector conversion model.
[0121] In an optional embodiment of the present application, the plurality of semantic feature layers comprises an entity recognition layer, a filtering layer, a dependency parsing layer and a part-of-speech tagging layer. The entity recognition (NER) layer is used to mark or filter some entities in the text, such as time, number, amount, etc. The filtering (FILTERING) layer is used to filter some words without actual meaning, such as punctuation marks, stop words, virtual words, etc. The dependency parsing (DEP) layer is used to analyze the syntactic relationship between words in a sentence and represent it as a tree structure, i.e., to obtain the dependency relationship of the context. The part-of-speech tagging (POS) layer is used to mark the part-of-speech of each word in the sentence (also known as word class, grammatical category, etc.). For example, using the hanlp natural language processing toolkit, the main methods include HMM part-of-speech tagging, perceptron part-of-speech tagging, CRF part-of-speech tagging, etc.
[0122] In the embodiment of the present application, by adding a plurality of semantic feature layers, the model output can pay more attention to the context information of the word vector of the text, thereby improving the accuracy of keyword association.
[0123] Step two, obtaining a business text data set, using the business text data set to train the original vector conversion model to obtain a standard vector conversion model.
[0124] In the embodiment of the present application, the business text data set can be business text in different fields, for example, in the financial field, the business text data set can be product text, transaction text, user text, etc. of insurance, fund and other products.
[0125] In detail, the use of the business text data set to train the original vector conversion model to obtain a standard vector conversion model comprises:
[0126] Using a sliding window of a predetermined size to slide and select the text in the business text data set to obtain a first training text set and input into the input layer of the original vector conversion model;
[0127] Using the entity recognition layer of the original vector conversion model to perform entity recognition and marking on the text in the first training text set, and deleting the entities with the preset marking to obtain a second training text set;
[0128] Using the filtering layer of the original vector conversion model to delete the text of a predetermined type in the second training text set to obtain a third training text set;
[0129] perform one-hot encoding on the texts in the third training text set to obtain a set of encoded vectors;
[0130] perform weighted averaging on the vectors in the set of encoded vectors by using a mapping layer of the original vector conversion model to obtain a weighted vector;
[0131] perform semantic splicing on the weighted vector by using a dependency syntax analysis layer and a part-of-speech tagging layer of the original vector conversion model to obtain a spliced vector;
[0132] output a prediction probability of the spliced vector by using an output layer of the original vector conversion model, adjust model parameters of the original vector conversion model when the prediction probability is less than a pre-constructed prediction threshold, and return to the step of performing weighted averaging on the vectors in the set of encoded vectors by using the mapping layer of the original vector conversion model until the original vector conversion model converges, stop training, and obtain the standard vector conversion model.
[0133] In an optional embodiment of the present application, the size of the sliding window is n, and n words before and after the center word are selected as training texts. For example, when the business text is "XX is a currency fund", n = 2, and the middle word is "currency", the input layer inputs the texts "is", "currency", "fund", and "money". The preset mark can be a digital mark, and time, numbers, and money can be filtered by deleting the digital mark entity; and the text of the preset type can be a preset stop word or a virtual word.
[0134] In an optional embodiment of the present application, the weighted vector is calculated by the following formula:
[0135]
[0136] wherein V(t) represents the weighted vector, E k represents the kth text vector, W1 k represents the first weight matrix corresponding to the kth text vector, and n represents the number of texts in the third training text set.
[0137] In detail, the performing semantic splicing on the weighted vector by using the dependency syntax analysis layer and the part-of-speech tagging layer to obtain a spliced vector comprises:
[0138] labeling the syntactic relationship between words in the weighted vector by using the dependency syntax analysis layer to obtain a syntactic relationship vector;
[0139] labeling the part-of-speech relationship between words in the weighted vector by using the part-of-speech tagging layer to obtain a part-of-speech tagging vector;
[0140] splicing the syntactic relationship vector and the part-of-speech tagging vector to obtain a spliced vector.
[0141] In an optional embodiment of the present application, the dependency syntax analysis layer and the part-of-speech tagging layer can be constructed by using the hanlp natural language processing toolkit.
[0142] In an optional embodiment of the present application, for the service text in the input layer, after filtering by the NER layer and the FILTERING layer, the text is one-hot encoded, the encoded vectors are multiplied by the first weight matrix W1 in the SUM layer, the average of each vector is taken to obtain a weighted vector, the weighted vector is input into the DEP and POS layers, a spliced vector is obtained after splicing, the spliced vector is multiplied by the second weight matrix W2, and is output to the subsequent OUTPUT layer, and the softmax is used to predict the prediction probability of the intermediate word, and iteration is repeatedly performed to obtain a standard vector conversion model. Since the traditional CBOW model is improved, various linguistic knowledge (ner, dep, pos, etc.) is fully utilized, the model learns the correlation information between key words more accurately, and the word vector is obtained by training on large-scale financial texts, which is more suitable for the knowledge in the financial field.
[0143] Step three, obtaining a to-be-associated text, and extracting a candidate associated word set from the to-be-associated text based on the word frequency and the point mutual information value of the words in the to-be-associated text.
[0144] In the embodiment of the present application, the to-be-associated text can be a text to be associated with words in the financial field. The point mutual information value (Pointwise Mutual Information, PMI) is used to measure the correlation between two words.
[0145] In detail, the candidate associated word set is extracted from the to-be-associated text based on the word frequency and the point mutual information value of the words in the to-be-associated text, including:
[0146] The to-be-associated text is subjected to a word segmentation processing, and the word frequency of each segmented word is counted, and the segmented word with a word frequency greater than or equal to a preset word frequency threshold is taken as a high-frequency word;
[0147] The point mutual information between each high-frequency word is calculated, and the high-frequency word with a point mutual information greater than or equal to a preset information threshold is taken as a candidate associated word, and all candidate associated words are collected to obtain a candidate associated word set.
[0148] In an optional embodiment of the present application, the point mutual information between high-frequency words is calculated by the following formula:
[0149]
[0150] Wherein, PMI(x, y) represents the point mutual information between high-frequency words x and high-frequency words y, p(x, y) represents the probability of the simultaneous occurrence of high-frequency words x and high-frequency words y, p(x) represents the probability of the occurrence of high-frequency words x, and p(y) represents the probability of the occurrence of high-frequency words y.
[0151] Step four, vector conversion of the candidate association word set is carried out by using the standard vector conversion model to obtain an association word vector set, and based on the similarity of each vector in the association word vector set, association word association of a target keyword in the candidate association word set is carried out to obtain an association word graph.
[0152] In detail, the vector conversion of the candidate association word set is carried out by using the standard vector conversion model to obtain an association word vector set, and based on the similarity of each vector in the association word vector set, association word association of a target keyword in the candidate association word set is carried out to obtain an association word graph, including:
[0153] Based on a user instruction, a target keyword is selected from the candidate association word set;
[0154] The target keyword and non-target keywords in the candidate association word set are subjected to vector conversion by using the standard vector conversion model to obtain an association word vector set containing target vectors and non-target vectors;
[0155] The similarity between the non-target vectors and the target vectors is calculated, and the non-target vectors with a similarity greater than or equal to a preset similarity threshold value are taken as first association vectors;
[0156] The similarity between the non-target vectors and the first association vectors is calculated, and the non-target vectors with a similarity greater than or equal to a preset similarity threshold value are taken as second association vectors;
[0157] The target keyword corresponding to the target vector is taken as a root node, the candidate association word corresponding to the first association vector is taken as a first association node, and the candidate association word corresponding to the second association vector is taken as a second association node
[0158] The root node and the first association node are connected, and the first association node and the second association node are connected to obtain an association word graph.
[0159] In the embodiment of the application, vector conversion is carried out by using the standard vector conversion model, semantic features can be added in the vectors, and the accuracy of semantic association is improved.
[0160] In an optional embodiment of the application, the similarity between vectors can be calculated by using a cosine similarity algorithm
[0161] The application can reduce noise data, learn the correlation between semantics and improve the accuracy of vocabulary correlation by adding a plurality of semantic feature layers in a pre-constructed basis vector conversion network and training the original vector conversion model using a real service text data set. Meanwhile, the candidate correlation word set is extracted by word frequency and point mutual information value, and the candidate correlation words are converted into vectors using a standard vector conversion model, the closeness of each candidate correlation word is determined by the similarity between vectors, and the correlation word graph is obtained, which can accurately and intuitively reflect the correlation between words. Therefore, the text keyword correlation device provided by the application can improve the accuracy of text keyword correlation.
[0162] As Figure 3 shown is a structural schematic diagram of an electronic device for implementing the text keyword correlation method according to an embodiment of the application.
[0163] The electronic device can include a processor 10, a memory 11, a communication interface 12 and a bus 13, and can further include a computer program stored in the memory 11 and executable on the processor 10, such as a text keyword correlation program.
[0164] The memory 11 includes at least one type of readable storage medium, including a flash memory, a mobile hard disk, a multimedia card, a card-type memory (such as an SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 11 can be an internal storage unit of the electronic device, such as a mobile hard disk of the electronic device. In other embodiments, the memory 11 can also be an external storage device of the electronic device, such as a plug-in mobile hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. Further, the memory 11 can include both an internal storage unit and an external storage device of the electronic device. The memory 11 can be used not only to store application software and various data installed in the electronic device, such as the code of the text keyword correlation program, but also to temporarily store data that has been output or will be output.
[0165] The processor 10 can be composed of integrated circuits in some embodiments, for example, can be composed of a single packaged integrated circuit, or can be composed of multiple packaged integrated circuits with the same function or different functions, including one or more central processing units (CPU), microprocessors, digital processing chips, graphics processors, combinations of various control chips, etc. The processor 10 is the control unit of the electronic device, connects various components of the entire electronic device through various interfaces and lines, executes programs or modules stored in the memory 11 (such as text keyword association programs, etc.), and calls data stored in the memory 11 to perform various functions of the electronic device and process data.
[0166] The communication interface 12 is used for communication between the above-mentioned electronic device and other devices, including network interfaces and user interfaces. Optionally, the network interface can include wired interfaces and / or wireless interfaces (such as WI-FI interfaces, Bluetooth interfaces, etc.), which are usually used to establish communication connections between the electronic device and other electronic devices. The user interface can be a display (Display), an input unit (such as a keyboard (Keyboard)), and optionally, the user interface can also be a standard wired interface, a wireless interface. Optionally, in some embodiments, the display can be an LED display, a liquid crystal display, a touch liquid crystal display, and an OLED (Organic Light-Emitting Diode) touch screen, etc. The display can also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device and to display a visualized user interface.
[0167] The bus 13 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus 13 can be divided into an address bus, a data bus, a control bus, etc. The bus 13 is configured to realize the connection and communication between the memory 11 and at least one processor 10, etc.
[0168] Figure 3 Only an electronic device with components is shown, and those skilled in the art can understand that, Figure 3 The structure shown does not constitute a limitation on the electronic device, and can include fewer or more components than shown, or combine certain components, or different component arrangements.
[0169] For example, although not shown, the electronic device can also include a power source (such as a battery) to power the various components, and preferably the power source can be logically connected to the at least one processor 10 through a power management device, so that the power management device can implement functions such as charge management, discharge management, and power consumption management. The power source can also include one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, and any other components. The electronic device can also include various sensors, Bluetooth modules, Wi-Fi modules, and the like, which are not described here.
[0170] Further, the electronic device can also include a network interface, which can optionally include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), and is typically used to establish a communication connection between the electronic device and other electronic devices.
[0171] Optionally, the electronic device can also include a user interface, which can be a display (Display), an input unit (such as a keyboard (Keyboard)), and optionally the user interface can also be a standard wired interface, a wireless interface. Optionally, in some embodiments, the display can be an LED display, a liquid crystal display, a touch liquid crystal display, and an OLED (Organic Light-Emitting Diode) touch, etc. The display can also be appropriately referred to as a display screen or a display unit, and is used to display information processed in the electronic device and to display a visualized user interface.
[0172] It should be understood that the embodiments are only for illustration and are not limited in the scope of the patent application by this structure.
[0173] The text keyword association program stored in the memory 11 in the electronic device is a combination of a plurality of instructions, which, when executed in the processor 10, can implement:
[0174] A plurality of semantic feature layers are added to the pre-constructed basis vector conversion network to obtain an original vector conversion model;
[0175] A service text data set is obtained, and the original vector conversion model is trained using the service text data set to obtain a standard vector conversion model;
[0176] A to-be-associated text is obtained, and a candidate association word set is extracted from the to-be-associated text based on the term frequency and point mutual information value of the terms in the to-be-associated text;
[0177] The candidate association word set is converted into vectors by using the standard vector conversion model to obtain an association word vector set, and a target keyword in the candidate association word set is associated with an association word based on the similarity of each vector in the association word vector set to obtain an association word graph.
[0178] Specifically, the processor 10 can refer to the description of the related steps in the corresponding embodiment of the accompanying drawings for the specific implementation method of the above instructions, and details are not described here.
[0179] Further, the modules / units integrated in the electronic device, if realized in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. The computer readable storage medium can be volatile or non-volatile. For example, the computer readable medium can include any entity or device capable of carrying the computer program code, a recording medium, a U disk, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM).
[0180] The application also provides a computer readable storage medium, the readable storage medium stores a computer program, the computer program can realize the following when being executed by a processor of an electronic device:
[0181] A plurality of semantic feature layers are added in a pre-constructed basic vector conversion network to obtain an original vector conversion model;
[0182] A service text data set is obtained, and the original vector conversion model is trained by using the service text data set to obtain a standard vector conversion model;
[0183] A text to be associated is obtained, and a candidate association word set is extracted from the text to be associated based on the word frequency and point mutual information value of the words in the text to be associated;
[0184] The candidate association word set is converted into vectors by using the standard vector conversion model to obtain an association word vector set, and a target keyword in the candidate association word set is associated with an association word based on the similarity of each vector in the association word vector set to obtain an association word graph.
[0185] In several embodiments provided in the application, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the apparatus embodiment described above is only schematic, for example, the division of the modules is only a logical function division, and another division mode can be used in actual implementation.
[0186] The modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical units, i.e., may be located in one place, or may be distributed on multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiment.
[0187] In addition, each functional module in various embodiments of the application can be integrated in one processing unit, or each unit can exist physically independently, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of hardware plus software functional modules.
[0188] It is obvious for those skilled in the art that the present application is not limited to the details of the above exemplary embodiments, and the present application can be implemented in other specific forms without departing from the spirit or essential characteristics of the present application.
[0189] Therefore, from any point of view, the embodiments should be regarded as exemplary and non-limiting, and the scope of the present application is defined by the appended claims rather than the above description, and therefore all changes falling within the meaning and scope of the equivalent elements of the claims are intended to be included in the present application. Any additional reference signs in the claims should not be considered as limiting the claims involved.
[0190] The embodiments of the present application can acquire and process related data based on artificial intelligence technology. Among them, artificial intelligence (AI) is to use digital computers or digital computer controlled machines to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0191] The basic technology of artificial intelligence generally includes technologies such as sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction system, mechatronics, etc. The software technology of artificial intelligence mainly includes computer vision technology, robot technology, biometric technology, speech processing technology, natural language processing technology, and machine learning / deep learning, etc.
[0192] The blockchain referred to in the present application is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism and encryption algorithm. The blockchain is essentially a decentralized database, and is a series of data blocks associated using cryptographic methods, each data block containing information of a batch of network transactions, for verifying the validity (anti-fake) of the information and generating the next block. The blockchain can include a blockchain underlying platform, a platform product service layer and an application service layer and the like.
[0193] Furthermore, the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. Multiple units or devices referred to in a system claim can also be implemented by one unit or device by software or hardware. The word "coupled" shall not be construed as being necessarily bound together.
[0194] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application and are not limiting. Although the present application has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that the technical solutions of the present application can be modified or replaced equivalently without departing from the spirit and scope of the technical solutions of the present application.
Claims
1. A text keyword association method, characterized in that, The method includes: Multiple semantic feature layers are added to a pre-constructed basic vector transformation network to obtain the original vector transformation model, including: adding an entity recognition layer and a filtering layer after the input layer of the basic vector transformation network; adding a dependency parsing layer and a part-of-speech tagging layer between the mapping layer and the output layer of the basic vector transformation network; and using the model with the entity recognition layer, filtering layer, dependency parsing layer and part-of-speech tagging layer added as the original vector transformation model, wherein the dependency parsing layer and the part-of-speech tagging layer are connected in series. The process involves acquiring a business text data set, training the original vector conversion model using the business text data set to obtain a standard vector conversion model, and including: using a sliding window of a preset size to select text in the business text data set to obtain a first training text set, which is then input into the input layer of the original vector conversion model; using the entity recognition layer of the original vector conversion model to perform entity recognition and labeling on the text in the first training text set; deleting preset labeled entities to obtain a second training text set; using the filtering layer of the original vector conversion model to delete text of a preset type in the second training text set to obtain a third training text set; and then processing the text in the third training text set... The text is one-hot encoded to obtain a set of encoded vectors. The vectors in the set of encoded vectors are weighted and averaged using the mapping layer of the original vector conversion model to obtain a weighted vector. The weighted vectors are semantically concatenated using the dependency parsing layer and part-of-speech tagging layer of the original vector conversion model to obtain a concatenated vector. The predicted probability of the concatenated vector is output using the output layer of the original vector conversion model. When the predicted probability is less than a pre-built prediction threshold, the model parameters of the original vector conversion model are adjusted, and the step of weighting and averaging the vectors in the set of encoded vectors using the mapping layer of the original vector conversion model is returned until the original vector conversion model converges, and training is stopped to obtain the standard vector conversion model. Obtain the text to be associated, and extract a set of candidate associated words from the text based on the word frequency and point mutual information values of the words in the text to be associated; The process involves: using the standard vector transformation model to transform the candidate related word set into a related word vector set; and then associating the target keywords in the candidate related word set with related words based on the similarity of each vector in the related word vector set to obtain a related word lexicon. This includes: selecting target keywords from the candidate related word set based on user instructions; using the standard vector transformation model to transform the target keywords and non-target keywords in the candidate related word set into vectors to obtain a related word vector set containing target and non-target vectors; calculating the similarity between the non-target vectors and the target vectors; using non-target vectors with a similarity greater than or equal to a preset similarity threshold as first related vectors; calculating the similarity between the non-target vectors and the first related vectors; using non-target vectors with a similarity greater than or equal to a preset similarity threshold as second related vectors; using the target keyword corresponding to the target vector as the root node; using the candidate related words corresponding to the first related vector as first related nodes; using the candidate related words corresponding to the second related vector as second related nodes; connecting the root node to the first related node; and connecting the first related node to the second related node to obtain a related word lexicon.
2. The text keyword association method as described in claim 1, characterized in that, The semantic concatenation of the weighted vectors using the dependency parsing layer and part-of-speech tagging layer of the original vector transformation model to obtain the concatenated vector includes: The dependency parsing layer is used to label the grammatical relations between words in the weighted vector to obtain a grammatical relation vector. The part-of-speech tagging layer is used to mark the part-of-speech relationships between words in the weighted vector to obtain the part-of-speech tagging vector; The concatenated vector is obtained by concatenating the grammatical relation vector and the annotation vector.
3. The text keyword association method as described in claim 1, characterized in that, The step of extracting a set of candidate related words from the text to be associated based on the word frequency and point mutual information values of the words in the text to be associated includes: The text to be associated is segmented into words, and the word frequency of each segment is counted. Segments with a word frequency greater than or equal to a preset word frequency threshold are considered high-frequency words. Calculate the point mutual information between each high-frequency word, and select high-frequency words with point mutual information greater than or equal to a preset information threshold as candidate related words. Summarize all candidate related words to obtain a candidate related word set.
4. The text keyword association method as described in claim 2, characterized in that, The weighted vector is calculated using the following formula: in, Represents a weighted vector. Indicates the first A text vector, Indicates the first The first weight matrix corresponding to each text vector. This indicates the number of texts in the third training text set.
5. A text keyword association device, characterized in that, The device includes: The model building module is used to add multiple semantic feature layers to a pre-built basic vector transformation network to obtain an original vector transformation model. The module includes: adding an entity recognition layer and a filtering layer after the input layer of the basic vector transformation network; adding a dependency parsing layer and a part-of-speech tagging layer between the mapping layer and the output layer of the basic vector transformation network; and using the model with the entity recognition layer, filtering layer, dependency parsing layer and part-of-speech tagging layer added as the original vector transformation model. The dependency parsing layer and the part-of-speech tagging layer are connected in series. The model training module is used to acquire a business text data set and train the original vector conversion model using the business text data set to obtain a standard vector conversion model. The training includes: using a sliding window of a preset size to select text from the business text data set to obtain a first training text set, which is then input into the input layer of the original vector conversion model; using the entity recognition layer of the original vector conversion model to perform entity recognition and labeling on the text in the first training text set; deleting preset labeled entities to obtain a second training text set; using the filtering layer of the original vector conversion model to delete text of a preset type from the second training text set to obtain a third training text set; and then training the third training text set... The text in this set is one-hot encoded to obtain a set of encoded vectors. The vectors in the set of encoded vectors are weighted and averaged using the mapping layer of the original vector conversion model to obtain a weighted vector. The weighted vectors are semantically concatenated using the dependency parsing layer and part-of-speech tagging layer of the original vector conversion model to obtain a concatenated vector. The predicted probability of the concatenated vector is output using the output layer of the original vector conversion model. When the predicted probability is less than a pre-built prediction threshold, the model parameters of the original vector conversion model are adjusted, and the step of weighting and averaging the vectors in the set of encoded vectors using the mapping layer of the original vector conversion model is returned until the original vector conversion model converges, training stops, and the standard vector conversion model is obtained. The candidate related word extraction module is used to obtain the text to be associated and extract a set of candidate related words from the text to be associated based on the word frequency and point mutual information value of the words in the text to be associated. The text keyword association module is used to perform vector transformation on the candidate related word set using the standard vector transformation model to obtain a related word vector set, and to associate the target keywords in the candidate related word set with related words based on the similarity of each vector in the related word vector set to obtain an associated word lexicon. The module includes: selecting target keywords from the candidate related word set based on user instructions; performing vector transformation on the target keywords and non-target keywords in the candidate related word set using the standard vector transformation model to obtain a related word vector set containing target vectors and non-target vectors; calculating the similarity between the non-target vectors and the target vectors; using non-target vectors with a similarity greater than or equal to a preset similarity threshold as first associated vectors; calculating the similarity between the non-target vectors and the first associated vectors; using non-target vectors with a similarity greater than or equal to a preset similarity threshold as second associated vectors; using the target keyword corresponding to the target vector as the root node; using the candidate related words corresponding to the first associated vector as first associated nodes; using the candidate related words corresponding to the second associated vector as second associated nodes; connecting the root node to the first associated node; and connecting the first associated node to the second associated node to obtain an associated word lexicon.
6. An electronic device, characterized in that, The electronic device includes: At least one processor; and, A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the text keyword association method as described in any one of claims 1 to 4.
7. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the text keyword association method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Entity and semantic relationship recognition method and device, electronic equipment and storage medium
CN111539211A
Similar text pushing method and device, electronic equipment and computer storage medium
CN113033198A