Text information classification method, device, computer equipment and storage medium
By constructing a text graph and integrating knowledge feature vectors, the problem of poor text information classification accuracy in the existing technology is solved, and higher classification accuracy and content understanding are achieved.
Patent Information
- Application Number
- CN202110103221.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-26
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2041-01-26
AI Technical Summary
In the prior art, classification is performed only based on the text information itself, resulting in poor classification accuracy.
By constructing a text graph, obtaining word nodes and feature vectors in text information, querying the word set in the knowledge database, fusing the word vector set to obtain the knowledge feature vector, adding knowledge nodes to the text graph, and using the multi-head attention model for weighted fusion to determine the category to which the text information belongs.
The accuracy of text information classification is improved, and the understanding of text information content and the accuracy of classification results are enhanced.
Smart Images

Figure CN113569042B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a text information classification method, apparatus, computer equipment, and storage medium. Background Art
[0002] With the development of computer technology, natural language processing (NLP) has become increasingly widely used and can be applied in a variety of scenarios. When NLP is applied in medical scenarios, it often involves the classification of medical-related text information.
[0003] A related art method for classifying text information provides a method that calls a trained classification model to classify text information and obtain the category to which the text information belongs. However, classification based solely on the text information itself results in poor classification accuracy. Summary of the Invention
[0004] The embodiments of the present application provide a text information classification method, apparatus, computer device, and storage medium, which can improve the accuracy of classification. The technical solution is as follows:
[0005] In one aspect, a text information classification method is provided, the method comprising:
[0006] Obtaining a text graph corresponding to the text information, the text graph including a plurality of word nodes corresponding to a plurality of words in the text information and a feature vector corresponding to each word node, wherein the word nodes corresponding to any two words having an associated relationship are connected;
[0007] Querying a knowledge database for a word set associated with the plurality of words;
[0008] Fusing the word vector set corresponding to the queried word set to obtain a knowledge feature vector, wherein the word vector set includes the word vector of each word in the word set;
[0009] Adding a knowledge node corresponding to the knowledge feature vector in the text graph, and connecting the knowledge node to the multiple word nodes respectively;
[0010] The category to which the text information belongs is determined according to the feature vector of each node in the text graph and the connection relationship between each node.
[0011] In one possible implementation, fusing the feature vectors of the multiple word nodes to obtain the first feature vector of the text graph includes:
[0012] Determining a weight of the feature vector of each word node according to a similarity between feature vectors of any two word nodes among the plurality of word nodes;
[0013] According to the weight of the feature vector of each word node, the feature vectors of the multiple word nodes are weightedly fused to obtain the first feature vector of the text graph.
[0014] In another possible implementation, the knowledge database includes a plurality of keywords and a word set associated with each keyword; and querying the knowledge database for the word set associated with the plurality of keywords includes:
[0015] Determine the sum of the similarities between each keyword and the multiple words as the total similarity corresponding to each keyword;
[0016] The keyword corresponding to the maximum total similarity is determined as the target keyword;
[0017] The word set corresponding to the target keyword is determined as the word set associated with the multiple words.
[0018] In another possible implementation, before determining the sum of the similarities between each keyword and the multiple words as the total similarity corresponding to each keyword, the method further includes:
[0019] The similarity between the keyword and the word corresponding to each word node is determined based on the word vector of any keyword and the feature vectors of the multiple word nodes.
[0020] In another possible implementation, determining the co-occurrence frequency between any two of the multiple words based on positions of the multiple words in the text information includes:
[0021] Extracting a plurality of word combinations from the text information, each word combination including a reference number of adjacent words;
[0022] The number of word combinations including any two words among the multiple words is determined as the co-occurrence frequency of the two words.
[0023] In another aspect, a text information classification device is provided, the device comprising:
[0024] an acquisition module, configured to acquire a text graph corresponding to the text information, wherein the text graph includes a plurality of word nodes corresponding to a plurality of words in the text information and a feature vector corresponding to each word node, and the word nodes corresponding to any two words having an associated relationship are connected;
[0025] A query module, configured to query a knowledge database for a word set associated with the plurality of words;
[0026] A fusion module is used to fuse the word vector set corresponding to the queried word set to obtain a knowledge feature vector, wherein the word vector set includes the word vector of each word in the word set;
[0027] A connection module, configured to add a knowledge node corresponding to the knowledge feature vector in the text graph, and connect the knowledge node with the plurality of word nodes respectively;
[0028] The determination module is used to determine the category to which the text information belongs based on the feature vector of each node in the text graph and the connection relationship between each node.
[0029] In one possible implementation, the fusion module includes:
[0030] a fusion unit, configured to fuse the feature vectors of the plurality of word nodes to obtain a first feature vector of the text graph;
[0031] The fusion unit is further configured to fuse the word vector set corresponding to the queried word set based on the first feature vector to obtain the knowledge feature vector.
[0032] In another possible implementation, the fusion unit is used to determine the similarity between each word vector in the word vector set and the first feature vector as the weight of each word vector; and based on the weight of each word vector, perform weighted fusion on multiple word vectors in the word vector set to obtain the knowledge feature vector.
[0033] In another possible implementation, the fusion unit is used to determine the weight of the feature vector of each word node based on the similarity between the feature vectors of any two word nodes among the multiple word nodes; and perform weighted fusion on the feature vectors of the multiple word nodes based on the weight of the feature vector of each word node to obtain the first feature vector of the text graph.
[0034] In another possible implementation, the fusion unit is used to call a multi-head attention model to fuse the word vector set corresponding to the queried word set according to the first feature vector to obtain the knowledge feature vector.
[0035] In another possible implementation, the multi-head attention model includes multiple attention sub-models;
[0036] The fusion unit is used to call each attention sub-model and perform weighted fusion on multiple word vectors in the word vector set according to the first feature vector to obtain the knowledge feature vector.
[0037] In another possible implementation, the knowledge database includes a plurality of keywords and a word set associated with each keyword; the query module includes:
[0038] a determining unit, configured to determine the sum of the similarities between each keyword and the plurality of words as the total similarity corresponding to each keyword;
[0039] The determining unit is further configured to determine the keyword corresponding to the maximum total similarity as the target keyword;
[0040] The determining unit is further configured to determine the word set corresponding to the target keyword as the word set associated with the multiple words.
[0041] In another possible implementation, the determination module is further configured to determine the similarity between the keyword and the word corresponding to each word node based on the word vector of any keyword and the feature vectors of the multiple word nodes.
[0042] In another possible implementation, the acquisition module includes:
[0043] A word segmentation unit, configured to perform word segmentation processing on the text information to obtain the plurality of words;
[0044] An extraction unit, configured to extract features from each word to obtain a word vector for each word;
[0045] An adding unit, configured to add a word node corresponding to each word vector in the text graph;
[0046] The connecting unit is used to connect the word nodes corresponding to any two words with an associated relationship according to the positions of the multiple words in the text information.
[0047] In another possible implementation, the connection unit is used to determine the co-occurrence frequency between any two of the multiple words based on the positions of the multiple words in the text information; in response to the co-occurrence frequency between any two words being greater than a reference threshold, the word nodes corresponding to the two words are connected.
[0048] In another possible implementation, the connection unit is used to extract multiple word combinations from the text information, each word combination includes a reference number of adjacent words; and the number of word combinations including any two words from the multiple words is determined as the co-occurrence frequency of the two words.
[0049] In another possible implementation, the acquisition module includes:
[0050] a construction unit, configured to construct a text graph based on the text information, wherein the text graph includes a plurality of word nodes corresponding to a plurality of words in the text information and a feature vector corresponding to each word node, wherein the feature vector of each word node is a word vector of the word corresponding to each word node;
[0051] An updating unit is used to update the feature vectors of the multiple word nodes according to the feature vector of each word node and the connection relationship between each word node to obtain an updated text graph.
[0052] In another possible implementation, the updating unit is used to update the feature vector of each word node according to the feature vector of the word node and the feature vectors of the adjacent word nodes of the word node, where the adjacent word nodes are other word nodes connected to the word node.
[0053] In another possible implementation, the updating unit is used to perform weighted processing on the feature vectors of the adjacent word nodes of the word node to obtain a neighbor feature vector; reset the feature vector of the word node according to a reset parameter to obtain a reset feature vector corresponding to the word node; transform the feature vector obtained by weighted fusion of the reset feature vector and the neighbor feature vector to obtain a newly added feature vector; and fuse the newly added feature vector and the feature vector of the word node according to an update parameter to obtain an updated feature vector of the word node, wherein the update parameter represents the update weight of the newly added feature vector.
[0054] In another possible implementation, the determination module is used to update the feature vector of each node based on the feature vector of each node and the connection relationship between each node; fuse the updated feature vector of each node to obtain a second feature vector of the text graph; and classify the second feature vector to obtain the category to which the text information belongs.
[0055] In another possible implementation, the text information includes medical consultation information, and the determination module is used to determine the department to which the medical consultation information belongs based on the feature vector of each node in the text graph corresponding to the medical consultation information and the connection relationship between each node.
[0056] On the other hand, a computer device is provided, comprising a processor and a memory, wherein the memory stores at least one computer program, and the at least one computer program is loaded and executed by the processor to implement the operations performed in the text information classification method as described in the above aspects.
[0057] On the other hand, a computer-readable storage medium is provided, in which at least one computer program is stored. The at least one computer program is loaded and executed by a processor to implement the operations performed in the text information classification method as described in the above aspects.
[0058] In another aspect, a computer program product or computer program is provided, comprising computer program code stored in a computer-readable storage medium. A processor of a computer device reads the computer program code from the computer-readable storage medium and executes the computer program code, causing the computer device to implement the operations performed in the text information classification method described in the above aspects.
[0059] The beneficial effects of the technical solutions provided in the embodiments of the present application include at least:
[0060] The method, apparatus, computer device, and storage medium provided in the embodiments of the present application use a text graph to represent text information to be classified. By querying a word set associated with multiple words, knowledge nodes corresponding to knowledge feature vectors are expanded in the text graph to enrich the information contained in the text graph, thereby improving the accuracy of the text graph. Subsequently, the text information is classified according to the updated text graph, thereby improving the classification accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0062] Figure 1 This is a schematic diagram of the structure of an implementation environment provided by an embodiment of the present application;
[0063] Figure 2 This is a flowchart of a text information classification method provided by an embodiment of the present application;
[0064] Figure 3 This is a flowchart of a text information classification method provided by an embodiment of the present application;
[0065] Figure 4 This is a flow chart of updating a feature vector of a word node provided by an embodiment of the present application;
[0066] Figure 5 This is a flowchart of obtaining a second eigenvector of a text graph provided by an embodiment of the present application;
[0067] Figure 6 This is a structural diagram of a text information classification device provided in an embodiment of the present application;
[0068] Figure 7 This is a structural diagram of a text information classification device provided in an embodiment of the present application;
[0069] Figure 8 This is a schematic diagram of the structure of a terminal provided in an embodiment of the present application;
[0070] Figure 9 This is a structural diagram of a server provided in an embodiment of the present application. DETAILED DESCRIPTION
[0071] In order to make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0072] As used herein, the terms "first," "second," and the like may be used to describe various concepts, but unless otherwise specified, these concepts are not limited by these terms. These terms are used solely to distinguish one concept from another. For example, a first eigenvector may be referred to as a second eigenvector, and similarly, a second eigenvector may be referred to as a first eigenvector, without departing from the scope of this application.
[0073] The terms "at least one", "a plurality", "each", and "any" used in this application include one, two, or more than two, a plurality includes two or more than two, each refers to each of the corresponding plurality, and any refers to any one of the plurality. For example, a plurality of word nodes includes three word nodes, and each refers to each of the three word nodes, and any refers to any one of the three word nodes, which can be the first word node, the second word node, or the third word node.
[0074] Artificial Intelligence (AI) refers to the theories, methods, techniques, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, to perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that seeks to understand the essence of intelligence and produce new intelligent machines that can respond in a manner similar to human intelligence. AI also involves studying the design principles and implementation methods of various intelligent machines, enabling them to possess the capabilities of perception, reasoning, and decision-making.
[0075] Artificial intelligence (AI) technology is a comprehensive discipline encompassing a wide range of fields, encompassing both hardware and software technologies. Foundational AI technologies generally include sensors, specialized AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, speech processing, natural language processing, and machine learning / deep learning.
[0076] Machine learning (ML) is a multidisciplinary field that encompasses probability theory, statistics, approximation theory, convex analysis, and algorithmic complexity theory. It specifically studies how computers can simulate or implement human learning behaviors to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is at the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications span all areas of AI. Machine learning and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and learning through demonstration.
[0077] Natural language processing (NLP) is a key area of research in computer science and artificial intelligence. It studies the theories and methods that enable effective communication between humans and computers using natural language. Natural language processing (NLP) integrates linguistics, computer science, and mathematics. Therefore, research in this field involves natural language—the language we use in everyday life—and is closely linked to the study of linguistics. Natural language processing technologies typically include text processing, semantic understanding, machine translation, robotic question answering, and knowledge graphs.
[0078] The solution provided in the embodiment of the present application is based on artificial intelligence machine learning technology, which can train a gated neural network model and a multi-head attention model, and then call the trained gated neural network model and multi-head attention model to classify text information.
[0079] The text information classification method provided in the embodiment of the present application can be used in a computer device, optionally, the computer device is a terminal or a server. Optionally, the server is an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. Optionally, the terminal is a smart phone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, etc., but is not limited to this. The terminal and the server can be directly or indirectly connected via wired or wireless communication, and this application does not limit this.
[0080] Figure 1 This is a schematic diagram of an implementation environment provided by an embodiment of the present application. Figure 1 , the implementation environment includes a terminal 101 and a server 102. The terminal 101 and the server 102 are connected via a wireless or wired network.
[0081] Optionally, a target application provided by server 102 is installed on terminal 101, and terminal 101 can implement functions such as data transmission and message exchange through this target application. Optionally, the target application is a target application in the operating system of terminal 101, or a target application provided by a third party. For example, the target application is a guidance application, which has a guidance function. Of course, the guidance application can also have other functions, such as shopping, navigation, chat, etc. Optionally, server 102 is the background server of the target application or a cloud server that provides cloud computing and cloud storage services.
[0082] The terminal 101 logs in to the target application based on the user identification, and sends the text information to be classified to the server through the target application. The server 102 is used to receive the text information sent by the terminal and determine the category to which the text information belongs.
[0083] Figure 2 This is a flowchart of a text information classification method provided by an embodiment of the present application, which is applied to a computer device, such as Figure 2 As shown, the method includes:
[0084] 201. The computer device obtains a text graph corresponding to the text information.
[0085] The text graph includes a plurality of word nodes corresponding to a plurality of words in the text information and a feature vector corresponding to each word node, and the word nodes corresponding to any two words having an associated relationship are connected.
[0086] By representing text information in the form of a text graph, the relationship between multiple words included in the text information is highlighted, the understanding of the content of the text information is enhanced, and the text graph can accurately describe the text information, thereby improving the accuracy of the text graph.
[0087] 202. The computer device queries a knowledge database for a word set associated with the multiple words.
[0088] The knowledge database stores a plurality of word sets, and the knowledge database is searched for a word set associated with the plurality of words so that the information contained in the text graph can be subsequently expanded according to the word set.
[0089] 203. The computer device fuses the word vector set corresponding to the queried word set to obtain a knowledge feature vector.
[0090] The word vector set includes the word vector of each word in the word set. The knowledge feature vector is a feature vector associated with the feature vectors of multiple word nodes in the text graph. By obtaining the knowledge feature vector, the information contained in the text graph can be subsequently expanded through the knowledge feature vector.
[0091] 204. The computer device adds a knowledge node corresponding to the knowledge feature vector in the text graph, and connects the knowledge node to multiple word nodes respectively.
[0092] After obtaining at least one knowledge feature vector that matches the text graph, knowledge nodes corresponding to the knowledge feature vector are added to the text graph to enrich the information contained in the text graph, and the knowledge nodes are connected to each word node, that is, a full connection method is adopted to associate the obtained knowledge nodes with each word node, thereby improving the accuracy of the updated text graph.
[0093] 205. The computer device determines the category to which the text information belongs based on the feature vector of each node in the text graph and the connection relationship between each node.
[0094] After expanding the knowledge nodes and knowledge feature vectors of the knowledge nodes in the text graph, the category to which the text information belongs can be determined based on the feature vectors of the word nodes, the feature vectors of the knowledge nodes and the connection relationship between each node in the text graph to ensure the accuracy of the determined category.
[0095] The method provided in the embodiment of the present application uses a text graph to represent the text information to be classified. By querying a word set associated with multiple words, the knowledge nodes corresponding to the knowledge feature vector are expanded in the text graph to enrich the information contained in the text graph, thereby improving the accuracy of the text graph. The text information is then classified according to the updated text graph, thereby improving the classification accuracy.
[0096] Figure 3 This is a flowchart of a text information classification method provided by an embodiment of the present application, which is applied to a computer device, such as Figure 3 As shown, the method includes:
[0097] 301. The computer device constructs a text graph based on the text information.
[0098] The text information is arbitrary text information, for example, the text information is text information in which a user asks a question, i.e., the text information includes a query statement; or the text information is text information describing the user's physical condition, or the text information is other text information. The text information includes multiple words, and accordingly, the text graph includes multiple word nodes corresponding to the multiple words in the text information and a feature vector corresponding to each word node, and the word nodes corresponding to any two words with a correlation relationship are connected.
[0099] Based on the multiple words included in the text information, multiple word nodes are constructed, and the word nodes corresponding to any two words with a correlation relationship are connected to obtain the text graph. In the initial text graph constructed based on the text information, the feature vector of each word node is the word vector of the word corresponding to each word node. By representing the text information in the form of a text graph, the relationship between the multiple words included in the text information is highlighted, which enhances the understanding of the content of the text information. The text graph can accurately describe the text information, improving the accuracy of the text graph, and facilitating the subsequent classification of the text information based on the text graph, thereby improving the classification accuracy.
[0100] In one possible implementation, step 301 includes the following steps 3101-3104:
[0101] 3101. The computer device performs word segmentation processing on the text information to obtain multiple words.
[0102] The multiple words are words contained in the text information. When performing word segmentation on the text information, the Jieba word segmentation model or other word segmentation models can be used for processing. Using word segmentation can ensure the accuracy of the words extracted from the text information, so that when a text graph corresponding to the text information is subsequently constructed based on the extracted multiple words, the accuracy of the text graph can be guaranteed.
[0103] 3102. The computer device extracts features from each word to obtain a word vector for each word.
[0104] The word vector is used to represent the corresponding word, and the word vector can be a vector of any dimension, for example, the word vector is a 16-dimensional vector, or an 18-dimensional vector.
[0105] In one possible implementation, step 3102 includes calling a feature extraction model to extract features from each word to obtain a word vector for each word. The feature extraction model is used to obtain the word vector for each word. For example, the feature extraction model is word2vec (a word embedding model), BERT (Bidirectional Encoder Representations from Transformers), XLNET (autoregressive pre-training method), or other models.
[0106] 3103. The computer device adds a word node corresponding to each word vector in the text graph.
[0107] After obtaining the word vectors of multiple words in the text information, the word node corresponding to each word vector is added to the text graph to obtain multiple word nodes, and each word vector is used as the feature vector of each word node, that is, the text graph includes multiple word nodes, and each word node has a feature vector.
[0108] 3104. Connect the word nodes corresponding to two words with an associated relationship based on the positions of the multiple words in the text information.
[0109] Different words have different positions in the text, and words in different positions may have associated relationships. For example, adjacent words may have an associated relationship, or words in close positions may have an associated relationship. Therefore, based on the positions of multiple words in the text, the associated words among the multiple words can be determined. The word nodes corresponding to any two associated words are connected to obtain the text graph. By connecting the word nodes corresponding to two associated words, the understanding of the text information is enhanced, ensuring the accuracy of the text graph.
[0110] In one possible implementation, step 3104 includes: determining the co-occurrence frequency between any two words among the multiple words based on the positions of the multiple words in the text information, and in response to the co-occurrence frequency between any two words being greater than a reference threshold, connecting the word nodes corresponding to the two words.
[0111] The reference threshold is an arbitrary value, for example, 0 or 2. The co-occurrence frequency between any two words indicates the number of times the two words co-appear in the text. A higher co-occurrence frequency indicates a more significant association between the two words, while a lower co-occurrence frequency indicates a less significant association between the two words. Therefore, if the co-occurrence frequency between any two words is greater than the reference threshold, it indicates that the two words are associated, and therefore, the word nodes corresponding to the two words are connected.
[0112] For example, the reference threshold is 0. If the co-occurrence frequency between any two words is 0, it means that there is no association relationship between the two words. If the co-occurrence frequency between any two words is not 0, it means that there is an association relationship between the two words. In the text graph, only two word nodes with a co-occurrence frequency greater than 0 are connected to obtain the text graph.
[0113] Optionally, the process of determining the co-occurrence frequency between two words includes: extracting multiple word combinations from text information, and determining the number of word combinations including any two words from the multiple words as the co-occurrence frequency of the two words.
[0114] Each word combination includes a reference number of adjacent words, where the reference number is an arbitrary value, for example, 3 or 2. Based on the reference number and the order of the words included in the text information, multiple word combinations can be extracted. Subsequently, for any two words from the multiple words obtained through word segmentation, if the two words appear together once in a word combination, the co-occurrence frequency of the two words is increased by 1. The number of word combinations that include the two words in the multiple word combinations is the co-occurrence frequency of the two words.
[0115] For example, the arrangement order of multiple words included in the text information is "word 1, word 2, word 3 and word 4", and the reference number is 3. Then, two word combinations are extracted from the text information, and the two word combinations are "word 1, word 2, word 3" and "word 2, word 3, word 4" respectively. Based on the two word combinations, it can be determined that the co-occurrence frequency between "word 1" and "word 2" is 1, the co-occurrence frequency between "word 2" and "word 3" is 2, and the co-occurrence frequency between "word 1" and "word 4" is 0.
[0116] Optionally, the process of extracting multiple word combinations from text information includes: setting the length of the sliding window to be equal to the reference number, setting the moving step of the sliding window to one word, controlling the sliding window to start from the first word in the text information and move backward according to the moving step, that is, moving backward one word each time, and after each movement, taking the reference number of words in the sliding window as a word combination until the sliding window moves to include the last word in the text information, thereby obtaining multiple word combinations.
[0117] In addition, in the process of constructing a text graph corresponding to text information, when the co-occurrence frequency between any two words is greater than a reference threshold, the word nodes corresponding to the two words are connected, and the co-occurrence frequency between the two word nodes is normalized to obtain the weight between the two word nodes. The obtained weight is used as the weight of the connection between the two word nodes in the text graph, that is, the obtained text graph includes multiple word nodes and the feature vector of each word node, and the connection between two word nodes with an associated relationship has a corresponding weight.
[0118] In one possible implementation, multiple groups of words whose co-occurrence frequencies are greater than a reference threshold and the co-occurrence frequencies corresponding to each group of words are obtained, the multiple co-occurrence frequencies obtained are normalized to obtain the weight corresponding to each group of words, and the weight corresponding to each group of words is determined as the weight of the connection between the corresponding two word nodes.
[0119] Each group of words includes two words, and the two words are any two of the multiple words extracted from the text information. The co-occurrence frequency corresponding to each group of words is the co-occurrence frequency between the two words included in the group of words. The greater the co-occurrence frequency corresponding to any group of words, the greater the weight corresponding to the group of words, and the smaller the co-occurrence frequency corresponding to any group of words, the smaller the weight corresponding to the group of words. By adding the weight between two word nodes with a connection relationship in the constructed text graph to indicate the importance of the association relationship between the words corresponding to the two word nodes, the understanding of the content in the text information is enhanced and the accuracy of the text graph is improved.
[0120] 302. The computer device updates the feature vectors of multiple word nodes according to the feature vector of each word node and the connection relationship between each word node to obtain an updated text graph.
[0121] In an embodiment of the present application, in a text graph constructed based on text information, the feature vector of each word node is the word vector of the corresponding word. The two connected word nodes indicate that the corresponding words have an association relationship, and the word vectors of any two words with an association relationship have a correlation. Based on the feature vector of each word node and the connection relationship between each word node, the feature vectors of multiple word nodes are updated, so that the feature vector of each word node incorporates the feature vectors of adjacent word nodes, thereby improving the accuracy of the feature vector of each word node and thus improving the accuracy of the text graph.
[0122] In one possible implementation, step 302 includes: for each word node, updating the feature vector of the word node according to the feature vector of the word node and the feature vectors of the word node's adjacent word nodes.
[0123] Among them, adjacent word nodes are other word nodes connected to the word node, and there is an association relationship between the adjacent word nodes and the words corresponding to the word node. When updating the feature vector of the word node, the feature vectors of the adjacent word nodes are integrated into the feature vector of the word node to highlight the association relationship between the word node and the adjacent word nodes, thereby improving the accuracy of the feature vector of the word node.
[0124] Optionally, the process of updating the feature vector of the word node includes the following steps 3021-3024:
[0125] 3021. Perform weighted processing on the feature vectors of the word node's adjacent word nodes to obtain a neighbor feature vector.
[0126] In an embodiment of the present application, the word node has one or more adjacent word nodes, each of which has a corresponding weight. The weight is used to represent the degree of influence of the adjacent word node on the word node, and different adjacent word nodes have different corresponding weights. According to the degree of influence of the adjacent word node on the word node, the feature vector of the adjacent word node is weighted to obtain a neighbor feature vector corresponding to the word node, so that the neighbor feature vector can be subsequently integrated into the feature vector of the word node.
[0127] In one possible implementation, the line between each two nodes in the text graph represents the weight between the two words. If the word node has multiple adjacent word nodes, the feature vectors of the multiple adjacent word nodes are weightedly fused to obtain the neighbor feature vector.
[0128] In one possible implementation, the neighbor feature vector The following relationship is satisfied:
[0129]
[0130] Among them, A is the adjacency matrix of the text graph, which includes the weights between each word node in the text graph, and H l-1 Represents the feature vector set of multiple word nodes in the text graph, W a is the weight coefficient.
[0131] 3022. Reset the feature vector of the word node according to the reset parameters to obtain a reset feature vector corresponding to the word node.
[0132] The reset parameter is used to reset the feature vector of the word node, and optionally, the reset parameter is expressed in the form of a vector. The feature vector of the word node is reset so that a new feature vector of the word node can be obtained based on the reset feature vector.
[0133] In one possible implementation, the process of obtaining the reset parameter includes: performing weighted fusion on the feature vector of the word node and the neighbor feature vector to obtain a first fused feature vector, and normalizing the first fused feature vector to obtain the reset parameter.
[0134] Optionally, the feature vector of the word node The neighbor feature vector And the reset parameters The following relationship is satisfied:
[0135]
[0136] Among them, W r is the neighbor feature vector The weight of U r is the feature vector of the word node The weight of b r is the bias parameter, and σ(·) is the Sigmoid function (a normalization function).
[0137] 3023. Transform the feature vector obtained by weighted fusion of the reset feature vector and the neighbor feature vector to obtain a new feature vector.
[0138] The newly added feature vector is a feature vector to be integrated into the feature vector of the word node, that is, a feature vector newly added to the updated feature vector of the word node.
[0139] In one possible implementation, the reset feature vector, the neighbor feature vector And the new feature vector The following relationship is satisfied:
[0140]
[0141] Among them, W h is the neighbor feature vector The weight of U h is the weight of the reset feature vector, To reset the parameters, is the feature vector of the word node, ⊙ represents the Hadamard product, This is the reset feature vector, b h is the bias parameter, and tanh(·) is the hyperbolic tangent function.
[0142] 3024. According to the update parameters, the newly added feature vector and the feature vector of the word node are merged to obtain the updated feature vector of the word node.
[0143] The update parameter represents the update weight of the newly added feature vector. The update parameter is used to adjust the proportion of the newly added feature vector incorporated into the updated feature vector of the word node, thereby adjusting the degree of change of the updated feature vector of the word node.
[0144] In one possible implementation, the update parameter New feature vector And the updated feature vector of the word node The following relationship is satisfied:
[0145]
[0146] in, is the updated feature vector of the word node, To add a new feature vector, To update the parameters, is the feature vector of the word node before updating, and ⊙ represents the Hadamard product.
[0147] In one possible implementation, the process of obtaining the updated parameter includes: performing weighted fusion on the feature vector of the word node and the neighbor feature vector to obtain a second fused feature vector, and normalizing the second fused feature vector to obtain the reset parameter.
[0148] Optionally, the feature vector of the word node The neighbor feature vector And the update parameters The following relationship is satisfied:
[0149]
[0150] Among them, W z is the neighbor feature vector The weight of U z is the feature vector of the word node The weight of b z is the bias parameter, and σ(·) is the Sigmoid function (a normalization function).
[0151] It should be noted that the embodiment of the present application is only to illustrate the update of the feature vector of the word node in the text graph, and in another embodiment, the above steps 3021-3024 can be repeatedly performed, and the feature vectors of multiple word nodes in the text graph are updated multiple times, and then the following steps are performed based on the updated feature vectors of multiple word nodes. Since each time the feature vectors of multiple word nodes are updated, the feature vectors of the word nodes incorporate the feature information of the adjacent word nodes, and then the feature vectors of the multiple word nodes are updated again, the feature vectors of the word nodes not only incorporate the feature information of the adjacent word nodes, but also incorporate the feature information of the adjacent word nodes of the adjacent word nodes. By updating the feature vectors of multiple word nodes multiple times, the updated feature vectors of the word nodes include the feature information of multi-hop neighbor nodes, thereby realizing the high-order feature interaction between multiple word nodes in the text graph and improving the accuracy of the feature vectors of the word nodes in the text graph.
[0152] In addition, when updating the feature vectors of word nodes in the text graph, a gated graph neural network model can be called to update the feature vector of each word node according to steps 3021-3024. The gated graph neural network model is a GGNN (Gated Graph Neural Network).
[0153] Optionally, when the feature vectors of the word nodes in the text graph are updated multiple times, the gated graph neural network model includes multiple gated recurrent units (GRUs), and each gated recurrent unit is called to update the feature vector of each word node once according to the above steps 3021-3024. When multiple gated recurrent units update the feature vectors of the word nodes in the text graph, the feature vectors of the multiple word nodes output by any gated recurrent unit are used as the input of the next gated recurrent unit, and the next gated recurrent unit updates the feature vectors of the multiple word nodes in the current text graph according to the above steps 3021-3024.
[0154] It should be noted that the embodiment of the present application is described by first constructing a text graph and then updating the feature vectors of the word nodes in the text graph. In another embodiment, there is no need to execute the above step 302, and the subsequent steps can be directly executed based on the constructed text graph.
[0155] It should be noted that the embodiment of the present application is described by first constructing a text graph and then updating the feature vectors of the word nodes in the text graph. In another embodiment, there is no need to execute steps 301-302, and other methods can be adopted to obtain the text graph corresponding to the text information.
[0156] 303. The computer device determines the sum of similarities between each keyword and multiple words corresponding to multiple word nodes in the knowledge database as the total similarity corresponding to each keyword.
[0157] In the embodiment of the present application, the knowledge database includes multiple keywords and a set of words associated with each keyword. Each word set includes at least one word, and the words included in different word sets are not completely the same. Each keyword is associated with a word in the associated word set. For example, if the keyword is "apple", the word set corresponding to this keyword includes "banana", "apple system", etc.
[0158] The total similarity corresponding to a keyword is used to indicate the degree of match between the keyword and the multiple words corresponding to the multiple word nodes. A greater total similarity indicates a closer match between the keyword and the multiple words, while a smaller total similarity indicates a lesser match between the keyword and the multiple words. Since the knowledge database includes multiple keywords, for any keyword, the sum of the similarities between the keyword and the multiple words corresponding to the multiple word nodes is determined, and this sum of similarities is used as the total similarity corresponding to the keyword. The total similarity corresponding to each keyword can be obtained in this manner.
[0159] In one possible implementation, the process of determining the similarity between a keyword and a word corresponding to a word node includes: determining the similarity between the keyword and the word corresponding to each word node based on the word vector of any keyword and the feature vector of each word node.
[0160] Optionally, algorithms such as cosine similarity and Euclidean distance are used to process the word vector of the keyword and the feature vector of any word node to obtain the similarity between the keyword and the word corresponding to the word node.
[0161] 304. The computer device determines the keyword corresponding to the maximum total similarity as the target keyword.
[0162] After determining the total similarity corresponding to each keyword, the target keyword corresponding to the maximum total similarity is determined from multiple keywords to ensure that the determined target keyword is the best match for the multiple words corresponding to the multiple word nodes, thereby ensuring the accuracy of the subsequently determined word set.
[0163] 305. The computer device determines the word set corresponding to the target keyword as the word set associated with the multiple words.
[0164] Since the target keyword is the keyword that best matches the multiple words corresponding to the multiple word nodes in the knowledge database, the word set corresponding to the target keyword is the word set associated with the multiple words corresponding to the multiple word nodes. Based on the similarity between the keyword and the multiple words corresponding to the multiple word nodes, the word set associated with the multiple words is retrieved from the multiple word sets in the knowledge database to ensure the accuracy of the retrieved word set.
[0165] It should be noted that the embodiment of the present application determines the word set associated with multiple words based on the similarity between the keywords in the knowledge database and the multiple words corresponding to the multiple word nodes. In another embodiment, there is no need to execute steps 303-305, and other methods can be adopted to query the word set associated with multiple words corresponding to the multiple word nodes from the knowledge database.
[0166] 306. The computer device fuses the feature vectors of multiple word nodes to obtain a first feature vector of the text graph.
[0167] Since the text graph includes multiple word nodes, by fusing the feature vectors of the multiple word nodes included in the text graph, the fused first feature vector contains the feature vectors of the words corresponding to the multiple word nodes, thereby ensuring the accuracy of the first feature vector.
[0168] In one possible implementation, step 306 includes: determining the weight of the feature vector of each word node based on the similarity between the feature vectors of any two word nodes among the multiple word nodes, and performing weighted fusion on the feature vectors of the multiple word nodes based on the weight of the feature vector of each word node to obtain the first feature vector of the text graph.
[0169] Among them, the similarity between the feature vectors of any two word nodes can represent the degree of association between the words corresponding to the two word nodes. If the similarity between the feature vector of any word node and the feature vector of each other word node is large, it means that the word corresponding to the word node has a large degree of association with the words corresponding to each other word node. In this case, the weight determined for the feature vector of the word node is large, which indicates the importance of the word node among multiple word nodes. Optionally, the weight of the feature vector of the word node is expressed in the form of a vector, or in the form of a fixed value.
[0170] The larger the weight of a word node's feature vector, the more important the feature vector of the word node is, that is, the more the word corresponding to the word node is able to express the meaning of the text information. The smaller the weight of a word node's feature vector, the less important the feature vector of the word node is, that is, the less able the word corresponding to the word node is to express the meaning of the text information. Therefore, based on the weights of the feature vectors of multiple word nodes, the feature vectors of multiple word nodes are weighted and fused to enhance the important feature vectors among the multiple feature vectors and weaken other unimportant feature vectors, thereby ensuring the accuracy of the first feature vector.
[0171] Optionally, the feature vectors of multiple word nodes are spliced to obtain a spliced feature vector, the spliced feature vector and the transposed feature vector of the spliced feature vector are fused to obtain a fused feature matrix, the fused feature matrix is normalized to obtain a weight matrix of the feature vectors of multiple word nodes, the weight matrix is fused with the spliced feature vector to obtain the first feature vector of the text graph.
[0172] Among them, the splicing feature vector is obtained by splicing the feature vectors of multiple word nodes. Optionally, the splicing feature vector includes feature vectors of multiple dimensions, and the feature vector of each dimension is the feature vector of a word node. The transposed feature vector of the splicing feature vector is obtained by transposing the splicing feature vector. Since the splicing feature vector includes the feature vectors of multiple word nodes, the transposed feature vector includes the transposed feature vectors of the feature vectors of multiple word nodes. The fusion feature matrix includes the similarity between the feature vectors of any two word nodes. By normalizing the fusion feature matrix, a weight matrix composed of the weights of the feature vectors of multiple word nodes can be obtained. The weight matrix is fused with the splicing feature vector, that is, the feature vectors of multiple word nodes are weightedly fused to obtain the first feature vector of the text graph.
[0173] Optionally, the concatenated feature vector Q and the transposed feature vector Q T And the first eigenvector Attention satisfies the following relationship:
[0174]
[0175] Among them, Attention is the first feature vector, Q is the concatenated feature vector, and Q T is the transposed eigenvector, d k To adjust the parameters, T is the transpose of the feature vector, and softmax(·) is the logistic regression function.
[0176] Optionally, a feature fusion model is called to determine the weight of the feature vector of each word node based on the similarity between the feature vectors of any two word nodes among the multiple word nodes. Based on the weight of the feature vector of each word node, the feature vectors of the multiple word nodes are weightedly fused to obtain the first feature vector of the text graph.
[0177] The feature fusion model is used to weight and fuse multiple feature vectors into one feature vector. The first feature vector of the text graph is obtained through the feature fusion model, which ensures the accuracy of the first feature vector.
[0178] 307. The computer device fuses the word vector set corresponding to the queried word set based on the first feature vector to obtain a knowledge feature vector.
[0179] The word vector set includes the word vector for each word in the word set. Since the words in the word set are associated with the words corresponding to the word nodes in the text graph, the word vectors in the word vector set corresponding to the word set are associated with the feature vector of each word node in the text graph, that is, the word vectors in the word vector set are associated with the first feature vector of the text graph. Based on the first feature vector, the word vectors in the word set can be fused according to the degree of association to obtain a knowledge feature vector.
[0180] In one possible implementation, step 307 includes: determining the similarity between each word vector in the word vector set and the first feature vector as the weight of each word vector, and performing weighted fusion on multiple word vectors in the word vector set according to the weight of each word vector to obtain a knowledge feature vector.
[0181] The similarity between a word vector in the word vector set and the first feature vector can represent the degree of association between the word corresponding to the word vector and the words corresponding to multiple word nodes in the text graph. The weight of the word vector is determined based on the similarity between the word vector and the first feature vector to ensure that the determined weight matches the similarity. The greater the similarity between the word vector and the first feature vector, the greater the weight of the word vector, and the smaller the similarity between the word vector and the first feature vector, the smaller the weight of the word vector.
[0182] According to the weight of each word vector, each word vector is weightedly fused to enhance the proportion of word vectors similar to the first feature vector in the knowledge feature vector, and weaken the proportion of word vectors dissimilar to the first feature vector in the knowledge feature vector, thereby ensuring the accuracy of the knowledge feature vector.
[0183] In one possible implementation, step 307 includes: calling a multi-head attention model, and fusing the word vector set corresponding to the queried word set according to the first feature vector to obtain a knowledge feature vector.
[0184] The multi-head attention model is used to obtain the knowledge feature vector. The multi-head attention model is used to obtain the knowledge feature vector to ensure the accuracy of the knowledge feature vector.
[0185] Optionally, the process of obtaining the knowledge feature vector includes: calling each attention sub-model in the multi-head attention model, and performing weighted fusion on multiple word vectors in the word vector set according to the first feature vector to obtain a knowledge feature vector.
[0186] Among them, the multi-head attention model includes multiple attention sub-models. Different attention sub-models include different model parameters, so different attention sub-models obtain different knowledge feature vectors, and thus multiple knowledge feature vectors are obtained.
[0187] Optionally, the process of each attention sub-model obtaining the knowledge feature vector includes: calling each attention sub-model, determining the similarity between each word vector in the word vector set and the first feature vector as the weight of each word vector, and performing weighted fusion on multiple word vectors in the word vector set according to the weight of each word vector to obtain the knowledge feature vector.
[0188] In this embodiment of the present application, for any word vector in the word vector set, different attention sub-models have different similarities between the word vector and the first feature vector, and thus different attention sub-models determine different weights for the word vector. Therefore, different attention sub-models obtain knowledge feature vectors, thereby obtaining multiple knowledge feature vectors.
[0189] By obtaining multiple knowledge feature vectors, the multiple feature vectors can be used as expanded knowledge of text information in the future to enrich the information contained in the text graph and improve the accuracy of the text graph.
[0190] Optionally, the obtained multiple knowledge feature vectors satisfy the following relationship:
[0191] MuztiHead(D,E,D)=Concat(head0,...,head m )
[0192]
[0193]
[0194] Among them, MultiHead(D, E, D) represents the obtained multiple knowledge feature vector sets, D is used to represent the word vector set, E is used to represent the first feature vector, Concat(·) represents the splicing function, head0 is the knowledge feature vector output by the first attention sub-model, head m is the knowledge feature vector output by the mth attention sub-model, head i is the knowledge feature vector output by the i-th attention sub-model, is the weight in the i-th attention sub-model, d k To adjust the parameters, T is the transpose of the feature vector, and softmax(·) is the logistic regression function.
[0195] In addition, based on the first feature vector, the word vector set corresponding to the queried word set is fused to obtain the knowledge feature vector. Other models can also be used, such as a fully connected neural network model or a twin model.
[0196] It should be noted that the embodiment of the present application obtains the knowledge feature vector by fusing the word vector set corresponding to the queried word set through the first feature vector of the text graph. In another embodiment, there is no need to execute steps 306-307, and other methods can be adopted to fuse the word vector set corresponding to the queried word set to obtain the knowledge feature vector.
[0197] 308. The computer device adds a knowledge node corresponding to the knowledge feature vector in the text graph, and connects the knowledge node to multiple word nodes respectively.
[0198] Among them, the knowledge feature vector is obtained through the first feature vector of the text graph, and the knowledge feature vector is associated with the first feature vector. The first feature vector is obtained by fusing the feature vectors of multiple word nodes in the text graph. Therefore, the obtained knowledge feature vector is associated with the feature vector of each word node. Therefore, a full connection method is adopted to connect the knowledge node with each word node to enrich the information contained in the text graph.
[0199] In an embodiment of the present application, since text information may include very few words, if classification is performed only based on the text information itself, poor classification accuracy may result. Therefore, a knowledge feature vector is obtained by determining a set of words associated with multiple words corresponding to multiple word nodes in a text graph from a knowledge database. The obtained knowledge feature vector is used as expanded knowledge of the text information, and knowledge nodes corresponding to the knowledge feature vector are added to the text graph to enrich the information included in the text graph, thereby improving the accuracy of the text graph.
[0200] In a possible implementation, after obtaining multiple knowledge feature vectors, step 308 includes: adding a knowledge node corresponding to each knowledge feature vector in the text graph, and connecting each knowledge node to multiple word nodes respectively.
[0201] 309. The computer device updates the feature vector of each node according to the feature vector of each node and the connection relationship between each node.
[0202] Since new knowledge nodes corresponding to knowledge feature vectors and connection relationships between knowledge nodes and multiple word nodes are added to the text graph, the feature vector of each node in the text graph is updated through the feature vector of each node in the text graph and the connection relationship between each node, so that the feature vector of the updated node incorporates the feature vectors of the adjacent nodes, thereby improving the accuracy of the feature vector of the updated node to ensure the accuracy of subsequent determination of the category to which the text information belongs.
[0203] In one possible implementation, step 309 includes the following steps 3091-3094:
[0204] 3091. The feature vector of any node and the feature vectors of the node's neighboring nodes constitute a feature vector set, and the similarity between each feature vector in the feature vector set and the feature vector of the node is determined as the weight of each feature vector in the feature vector set. Based on the determined weights, multiple feature vectors in the feature vector set are weightedly fused to obtain the neighbor feature vector corresponding to the node.
[0205] Among them, the similarity between any feature vector in the feature vector set and the feature vector of the node can represent the degree of association between the words corresponding to the nodes corresponding to the two feature vectors. The weight of each feature vector in the feature vector set is determined according to the similarity between the feature vector in the feature vector set and the feature vector of the node to ensure that the weight of each feature vector matches the corresponding similarity. The greater the similarity corresponding to the feature vector, the greater the weight of the feature vector, and the smaller the similarity corresponding to the feature vector, the smaller the weight of the feature vector.
[0206] According to the weight of each eigenvector in the eigenvector set, multiple eigenvectors in the eigenvector set are weightedly fused to enhance important eigenvectors among the multiple eigenvectors and weaken other unimportant eigenvectors, thereby ensuring the accuracy of neighbor eigenvectors.
[0207] In one possible implementation, step 3091 includes: forming a feature vector set from the feature vector of any node and the feature vectors of the node's adjacent nodes, calling a multi-head attention model, and determining the similarity between each feature vector in the feature vector set and the feature vector of the node as the weight of each feature vector in the feature vector set, and performing weighted fusion on multiple feature vectors in the feature vector set according to the determined weights to obtain the neighbor feature vector corresponding to the node.
[0208] The multi-head attention model is used to obtain the neighbor feature vector corresponding to the node. The multi-head attention model is used to obtain the knowledge feature vector to ensure the accuracy of the neighbor feature vector.
[0209] Optionally, each attention sub-model in the multi-head attention model is called, and the similarity between each feature vector in the feature vector set and the feature vector of the node is determined as the weight of each feature vector in the feature vector set. According to the determined weight, multiple feature vectors in the feature vector set are weightedly fused to obtain a reference feature vector, and the obtained multiple reference feature vectors are fused to obtain a neighbor feature vector corresponding to the node.
[0210] Optionally, when fusing the obtained multiple reference feature vectors, the multiple reference feature vectors are averaged to obtain the neighbor feature vector corresponding to the node; or, the multiple reference feature vectors are connected to obtain the neighbor feature vector corresponding to the node.
[0211] 3092. Reset the feature vector of the node according to the reset parameters to obtain a reset feature vector corresponding to the node.
[0212] 3093. Transform the feature vector obtained by weighted fusion of the reset feature vector and the neighbor feature vector to obtain a new feature vector.
[0213] 3094. According to the updated parameters, the newly added feature vector and the feature vector of the node are fused to obtain the updated feature vector of the node.
[0214] Through the multi-head attention model, the feature vector of the node is updated and the attention mechanism is introduced, which not only enhances the interaction between nodes, but also reduces the noise brought by the added knowledge nodes and improves the accuracy of the feature vector after the node is updated.
[0215] The above steps 3092-3095 are similar to the above steps 3022-3024 and will not be repeated here.
[0216] It should be noted that the embodiment of the present application only describes an update of the feature vector of the node in the text graph once. In another embodiment, the above steps 3091-3094 can be repeatedly executed to update the feature vector of the node in the text graph multiple times, and then the following steps are executed.
[0217] In addition, when updating the feature vector of each node in the text graph, the attention gated graph neural network model can be called to update the feature vector of each node according to the above steps 3091-3094. The attention gated graph neural network model is AGGNN (Attention Gated Graph Neural Network).
[0218] Optionally, when the feature vectors of nodes in the text graph are updated multiple times, the attention gated graph neural network model includes multiple groups of units, each group of units includes an attention unit and a gated recurrent unit, and the attention unit in any group of units obtains the neighbor feature vector corresponding to the node according to the above step 3091, and then inputs the neighbor feature vector into the gated recurrent unit corresponding to the attention unit, and the gated recurrent unit updates the feature vector of each node once according to the above steps 3092-3094. When multiple groups of units update the feature vectors of word nodes in the text graph, the feature vectors of multiple word nodes output by the gated recurrent unit in any group of units are used as the input of the attention unit in the next group of units, and the attention unit obtains the neighbor feature vector corresponding to the node according to the above step 3021, and then inputs the neighbor feature vector into the gated recurrent unit corresponding to the attention unit. In the above manner, through multiple groups of units, it is possible to achieve multiple updates of the feature vectors of multiple word nodes.
[0219] like Figure 4 As shown, word node 4 is connected to word node 1, word node 2, word node 3, and word node 5. When updating the feature vector of word node 4, the two attention sub-models of the multi-head attention model are used to perform weighted fusion on the feature vectors of word node 1, word node 2, word node 3, word node 4, and word node 5, respectively, to obtain two reference feature vectors. The two reference feature vectors are averaged or concatenated to obtain the neighbor feature vector of word node 4. Through the gated recurrent unit, according to the above steps 3092-3094, the feature vector of word node 4 and its neighbor feature vectors are processed to obtain the updated feature vector of word node 4.
[0220] 310. The computer device fuses the updated feature vectors of each node to obtain a second feature vector of the text graph.
[0221] This step is similar to the above step 306 and will not be described again here.
[0222] In the embodiment of the present application, after the computer device obtains the text image, the process of obtaining the second feature vector of the text image is as follows: Figure 5 As shown, after obtaining the text graph corresponding to the text information, the gated neural network model is called to update the feature vector of each word node in the text graph and the connection relationship between each word node. After the update, the feature vectors of multiple word nodes in the text graph are fused based on the fusion layer to obtain the first feature vector of the text graph. A word set associated with multiple words is queried from the knowledge database, and the multi-head attention model is called to perform weighted fusion on the word vector set corresponding to the queried word set to obtain multiple knowledge feature vectors. Based on the connection layer, the multiple knowledge feature vectors are connected, and knowledge nodes matching each knowledge feature vector are added to the text graph to obtain an updated text graph. Then, the attention gated neural network model is called to update the feature vector of each node in the text graph. After that, the feature vector of each node in the text graph is fused through the fusion layer to obtain the second feature vector of the text graph.
[0223] 311. The computer device classifies the second feature vector to obtain the category to which the text information belongs.
[0224] The second feature vector is obtained by fusing feature vectors of multiple nodes in the text graph. The second feature vector can represent the meaning to be expressed by the text information. Therefore, by classifying the second feature vector, the category to which the text information belongs can be obtained.
[0225] Since the text graph not only includes word nodes corresponding to words in the text information, but also expands the knowledge nodes corresponding to the knowledge feature vector in the text graph, enriching the information contained in the text graph, thereby improving the accuracy of the second feature vector, the category to which the text information belongs is determined by the second feature vector, thereby ensuring the accuracy of the determined category.
[0226] In a possible implementation, step 311 includes: classifying the second feature vector to obtain the similarity between the text information and each category, and determining the category corresponding to the maximum similarity as the category to which the text information belongs.
[0227] In an embodiment of the present application, text information may correspond to multiple categories. By determining the similarity between the text information and each category, the category determined for the text information is matched with the text information, thereby ensuring the accuracy of the determined category.
[0228] Optionally, a classification model is called to process the second eigenvector to obtain the similarity between the second eigenvector and each category, and the category corresponding to the maximum similarity is determined as the category to which the text information belongs.
[0229] It should be noted that, in the embodiment of the present application, the feature vector of each node is first updated, and then the category to which the text information belongs is determined based on the second feature vector of the text graph. In another embodiment, after step 308, there is no need to update the feature vector of each node in the text graph. The category to which the text information belongs is determined directly based on the feature vector of each node in the text graph and the connection relationship between each node.
[0230] In one possible implementation, the text information includes medical consultation information. Then, after step 308, the method further includes: the computer device determines the department to which the medical consultation information belongs based on the feature vector of each node in the text graph corresponding to the medical consultation information and the connection relationship between each node.
[0231] The medical consultation information represents the information a user would like to consult when visiting a hospital. Optionally, the medical consultation information may include a description of the user's symptoms, for example, "Which doctor should I see for stomach pain?" By identifying the department to which the medical consultation information pertains, the user can then seek medical advice in that department. This provides intelligent guidance, improves the user's medical consultation efficiency, avoids mismatches between the user's medical department and the medical consultation information, and enhances the accuracy of medical consultations.
[0232] In one possible implementation, the text information includes physical status information. After step 308, the method further includes: determining the disease category to which the physical status information belongs based on the feature vector of each node in the text graph corresponding to the physical status information and the connection relationship between each node.
[0233] The physical condition information is used to describe the user's physical condition. Optionally, the physical condition information includes symptom description information, physical examination reports, past medical history information, etc. By determining that the user suffers from a certain type of disease, an automatic analysis of the user's condition is achieved, so that the user can understand his or her health status.
[0234] Optionally, after determining the disease category to which the physical status information belongs, the method further includes: querying the probability and precautions corresponding to the determined disease category.
[0235] The probability corresponding to a disease category indicates the likelihood that the user will contract a particular disease, and precautions indicate what the user should be aware of to avoid the disease. For example, these precautions include dietary precautions and exercise precautions. By determining the probability of contracting a particular disease and the precautions for the user, the user can adjust their body based on these probabilities and precautions to maintain good health, thus achieving a method of health management for the user.
[0236] In clinical medicine, the text information classification method provided in the embodiment of the present application can be used to process physical condition information to obtain the disease category to which the physical condition information belongs. Subsequently, the doctor will ultimately determine the disease category of the user's disease based on the obtained disease category and other relevant information of the user.
[0237] It should be noted that the disease category to which the physical condition information obtained in this application belongs cannot be used as the sole basis for determining that the user suffers from a certain type of disease. After obtaining the disease category to which the physical condition information belongs, the doctor still needs to combine other information to finally determine the disease category of the user's disease.
[0238] The method provided in the embodiment of the present application uses a text graph to represent the text information to be classified. By querying a word set associated with multiple words, the knowledge nodes corresponding to the knowledge feature vector are expanded in the text graph to enrich the information contained in the text graph, thereby improving the accuracy of the text graph. The text information is then classified according to the updated text graph, thereby improving the classification accuracy.
[0239] In an embodiment of the present application, a gated graph neural network model, a multi-head attention model and an attention gated graph neural network model are called to classify text information. As shown in Table 1, when other related technologies classify text information, the models used are CNN (Convolutional neural network, convolutional neural network model), Bi-LSM (Bi-directional Long Short-Term Memory, bidirectional long short-term memory model), FastText (fast text classifier), Text GCN (Text Graph Convolutional Networks, text graph convolutional network), STCKA (a classification model based on text atlas), TextING (a text classification model). On different data sets, such as MR (a machine learning data set), TagMyNews (a conventional text data set), SearchSnippets (search fragment data set) and StackOverflow (question and answer data set)
[0240] Compared with methods for classifying text information in other related technologies, the method provided in the embodiment of the present application has high accuracy and high F-Measure (F value).
[0241] Table 1
[0242]
[0243] Taking the medical consultation guidance scenario as an example, a process for providing intelligent guidance for users' medical consultation is provided. The process includes:
[0244] 1. The terminal is installed with a medical consultation application, which is logged into based on a user ID. In response to obtaining medical consultation information input by the user based on the medical consultation application, the terminal sends the medical consultation information to the server.
[0245] Among them, the server is used to provide services for the medical consultation guidance application.
[0246] 2. The server receives the medical consultation information, constructs a text graph based on the medical consultation information, and updates the feature vectors of multiple word nodes based on the feature vector of each word node in the text graph and the connection relationship between each word node to obtain an updated text graph.
[0247] 3. The server determines the sum of the similarities between each keyword and the words corresponding to multiple word nodes in the knowledge database as the total similarity corresponding to each keyword, determines the keyword corresponding to the maximum total similarity as the target keyword, and determines the word set corresponding to the target keyword as the word set associated with the multiple words.
[0248] 4. The server fuses the feature vectors of multiple word nodes to obtain the first feature vector of the text graph. Based on the first feature vector, the server fuses the word vector set corresponding to the queried word set to obtain a knowledge feature vector. The server adds a knowledge node corresponding to the knowledge feature vector to the text graph and connects the knowledge node to multiple word nodes respectively.
[0249] 5. The server updates the feature vector of each node according to the feature vector of each node and the connection relationship between each node, and fuses the updated feature vectors of each node to obtain the second feature vector of the text graph.
[0250] 6. The server classifies the second eigenvector, obtains the department to which the medical consultation information belongs, and returns the department to the medical consultation application, or queries the doctor belonging to the department and returns the queried doctor to the medical consultation application.
[0251] 7. The terminal displays the department to which the medical consultation information belongs or the doctor belonging to the department in the medical consultation guide application, so that the user can seek medical treatment according to the displayed department or doctor.
[0252] Taking the disease analysis scenario as an example, a process for automatically analyzing a user's condition is provided. The process includes:
[0253] 1. The terminal is installed with a disease analysis application, which is logged into based on a user ID. In response to obtaining the physical status information input by the user based on the disease analysis application, the terminal sends the physical status information to a server.
[0254] Among them, the server is used to provide services for disease analysis applications.
[0255] 2. The server receives the physical status information, constructs a text graph based on the physical status information, and updates the feature vectors of multiple word nodes based on the feature vector of each word node in the text graph and the connection relationship between each word node to obtain an updated text graph.
[0256] 3. The server determines the sum of the similarities between each keyword and the words corresponding to multiple word nodes in the knowledge database as the total similarity corresponding to each keyword, determines the keyword corresponding to the maximum total similarity as the target keyword, and determines the word set corresponding to the target keyword as the word set associated with the multiple words.
[0257] 4. The server fuses the feature vectors of multiple word nodes to obtain the first feature vector of the text graph. Based on the first feature vector, the server fuses the word vector set corresponding to the queried word set to obtain a knowledge feature vector. The server adds a knowledge node corresponding to the knowledge feature vector to the text graph and connects the knowledge node to multiple word nodes respectively.
[0258] 5. The server updates the feature vector of each node according to the feature vector of each node and the connection relationship between each node, and fuses the updated feature vectors of each node to obtain the second feature vector of the text graph.
[0259] 6. The server classifies the second eigenvector to obtain the disease category to which the physical condition information belongs, queries the probability and precautions corresponding to the disease category, and returns the queried probability and precautions corresponding to the disease category to the disease analysis application.
[0260] 7. The terminal displays the probability and precautions corresponding to the disease category in the disease analysis application, so that the user can know the possibility and precautions of suffering from a certain disease and manage his body according to the precautions in the future.
[0261] Figure 6This is a structural diagram of a text information classification device provided by an embodiment of the present application. Figure 6 As shown, the device includes:
[0262] An acquisition module 601 is configured to acquire a text graph corresponding to the text information, wherein the text graph includes a plurality of word nodes corresponding to a plurality of words in the text information and a feature vector corresponding to each word node, wherein the word nodes corresponding to any two words having an associated relationship are connected;
[0263] A query module 602 is used to query a word set associated with multiple words from a knowledge database;
[0264] A fusion module 603 is configured to fuse the word vector set corresponding to the queried word set to obtain a knowledge feature vector, where the word vector set includes the word vector of each word in the word set;
[0265] A connection module 604 is configured to add a knowledge node corresponding to the knowledge feature vector in the text graph and connect the knowledge node to the plurality of word nodes respectively;
[0266] The determination module 605 is used to determine the category to which the text information belongs based on the feature vector of each node in the text graph and the connection relationship between each node.
[0267] In one possible implementation, Figure 7 As shown, the fusion module 603 includes:
[0268] A fusion unit 6031 is used to fuse the feature vectors of multiple word nodes to obtain a first feature vector of the text graph;
[0269] The fusion unit 6031 is further configured to fuse the word vector set corresponding to the queried word set based on the first feature vector to obtain a knowledge feature vector.
[0270] In another possible implementation, the fusion unit 6031 is used to determine the similarity between each word vector in the word vector set and the first feature vector as the weight of each word vector; and based on the weight of each word vector, perform weighted fusion on multiple word vectors in the word vector set to obtain a knowledge feature vector.
[0271] In another possible implementation, the fusion unit 6031 is used to determine the weight of the feature vector of each word node based on the similarity between the feature vectors of any two word nodes among the multiple word nodes; and to perform weighted fusion on the feature vectors of the multiple word nodes based on the weight of the feature vector of each word node to obtain the first feature vector of the text graph.
[0272] In another possible implementation, the fusion unit 6031 is used to call the multi-head attention model to fuse the word vector set corresponding to the queried word set according to the first feature vector to obtain a knowledge feature vector.
[0273] In another possible implementation, the multi-head attention model includes multiple attention sub-models;
[0274] The fusion unit 6031 is used to call each attention sub-model and perform weighted fusion on multiple word vectors in the word vector set according to the first feature vector to obtain a knowledge feature vector.
[0275] In another possible implementation, the knowledge database includes multiple keywords and a set of words associated with each keyword; Figure 7 As shown, the query module 602 includes:
[0276] A determining unit 6021 is configured to determine the sum of similarities between each keyword and multiple words as a total similarity corresponding to each keyword;
[0277] The determining unit 6021 is further configured to determine the keyword corresponding to the maximum total similarity as the target keyword;
[0278] The determining unit 6021 is further configured to determine the word set corresponding to the target keyword as a word set associated with multiple words.
[0279] In another possible implementation, the determination module 605 is further configured to determine the similarity between the keyword and the word corresponding to each word node based on the word vector of any keyword and the feature vectors of multiple word nodes.
[0280] In another possible implementation, Figure 7 As shown, the acquisition module 601 includes:
[0281] The word segmentation unit 6011 is used to perform word segmentation processing on the text information to obtain multiple words;
[0282] Extraction unit 6012, used to extract features from each word to obtain a word vector for each word;
[0283] An adding unit 6013 is used to add a word node corresponding to each word vector in the text graph;
[0284] The connection unit 6014 is used to connect the word nodes corresponding to any two words with an associated relationship according to the positions of the multiple words in the text information.
[0285] In another possible implementation, the connection unit 6014 is used to determine the co-occurrence frequency between any two words among the multiple words based on the positions of the multiple words in the text information; in response to the co-occurrence frequency between any two words being greater than a reference threshold, the word nodes corresponding to the two words are connected.
[0286] In another possible implementation, the connection unit 6014 is used to extract multiple word combinations from the text information, each word combination includes a reference number of adjacent words; and the number of word combinations including any two words from the multiple words is determined as the co-occurrence frequency of the two words.
[0287] In another possible implementation, Figure 7 As shown, the acquisition module 601 includes:
[0288] A construction unit 6015 is configured to construct a text graph based on the text information, wherein the text graph includes a plurality of word nodes corresponding to a plurality of words in the text information and a feature vector corresponding to each word node, wherein the feature vector of each word node is a word vector of the word corresponding to each word node;
[0289] The updating unit 6016 is used to update the feature vectors of multiple word nodes according to the feature vector of each word node and the connection relationship between each word node to obtain an updated text graph.
[0290] In another possible implementation, the updating unit 6016 is used to update the feature vector of each word node based on the feature vector of the word node and the feature vectors of the adjacent word nodes of the word node, where the adjacent word nodes are other word nodes connected to the word node.
[0291] In another possible implementation, the update unit 6016 is used to weight the feature vectors of the adjacent word nodes of the word node to obtain a neighbor feature vector; reset the feature vector of the word node according to the reset parameter to obtain a reset feature vector corresponding to the word node; transform the feature vector after weighted fusion of the reset feature vector and the neighbor feature vector to obtain a newly added feature vector; and fuse the newly added feature vector and the feature vector of the word node according to the update parameter to obtain an updated feature vector of the word node, wherein the update parameter represents the update weight of the newly added feature vector.
[0292] In another possible implementation, the determination module 605 is used to update the feature vector of each node based on the feature vector of each node and the connection relationship between each node; fuse the updated feature vector of each node to obtain a second feature vector of the text graph; and classify the second feature vector to obtain the category to which the text information belongs.
[0293] In another possible implementation, the text information includes medical consultation information, and the determination module 605 is used to determine the department to which the medical consultation information belongs based on the feature vector of each node in the text graph corresponding to the medical consultation information and the connection relationship between each node.
[0294] It should be noted that the text information classification device provided in the above embodiment is merely an example of the division of the aforementioned functional modules. In actual applications, the aforementioned functions can be assigned to different functional modules as needed, that is, the internal structure of the computer device can be divided into different functional modules to complete all or part of the functions described above. Furthermore, the text information classification device provided in the above embodiment and the text information classification method embodiment are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0295] An embodiment of the present application further provides a computer device, which includes a processor and a memory, wherein the memory stores at least one computer program, which is loaded and executed by the processor to implement the operations performed in the text information classification method of the above embodiment.
[0296] Optionally, the computer device is provided as a terminal. Figure 8 The following is a block diagram of a terminal 800 according to an exemplary embodiment of the present application. Terminal 800 may be a portable mobile terminal, such as a smartphone, tablet computer, MP3 player (Moving Picture Experts Group Audio Layer III), MP4 player (Moving Picture Experts Group Audio Layer IV), laptop computer, or desktop computer. Terminal 800 may also be referred to as user equipment, portable terminal, laptop terminal, desktop terminal, or other similar names.
[0297] The terminal 800 includes a processor 801 and a memory 802 .
[0298] The processor 801 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 801 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), or PLA (Programmable Logic Array). The processor 801 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 801 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 801 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0299] The memory 802 may include one or more computer-readable storage media, which may be non-transitory. The memory 802 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices and flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 802 is used to store at least one computer program, which is executed by the processor 801 to implement the text information classification method provided in the method embodiment of the present application.
[0300] In some embodiments, terminal 800 may optionally include a peripheral device interface 803 and at least one peripheral device. The processor 801, memory 802, and peripheral device interface 803 may be connected via a bus or signal lines. Each peripheral device may be connected to peripheral device interface 803 via a bus, signal lines, or circuit boards. Specifically, the peripheral device may include at least one of a radio frequency circuit 804, a display screen 805, a camera assembly 806, an audio circuit 807, a positioning assembly 808, and a power supply 809.
[0301] The peripheral device interface 803 can be used to connect at least one I / O (Input / Output)-related peripheral device to the processor 801 and the memory 802. In some embodiments, the processor 801, the memory 802, and the peripheral device interface 803 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 801, the memory 802, and the peripheral device interface 803 can be implemented on separate chips or circuit boards, which is not limited in this embodiment.
[0302] The radio frequency circuit 804 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 804 communicates with communication networks and other communication devices via electromagnetic signals. The radio frequency circuit 804 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. Optionally, the radio frequency circuit 804 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, etc. The radio frequency circuit 804 can communicate with other terminals via at least one wireless communication protocol. Such wireless communication protocols include, but are not limited to, the World Wide Web, a metropolitan area network, an intranet, various generations of mobile communication networks (2G, 3G, 4G, and 5G), a wireless local area network, and / or a WiFi (Wireless Fidelity) network. In some embodiments, the radio frequency circuit 804 may also include circuits related to NFC (Near Field Communication), which is not limited in this application.
[0303] The display screen 805 is used to display a user interface (UI). This UI may include graphics, text, icons, videos, or any combination thereof. When the display screen 805 is a touch screen display, it is also capable of collecting touch signals on or above the surface of the display screen 805. These touch signals can be input as control signals to the processor 801 for processing. In this case, the display screen 805 can also be used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or a soft keyboard. In some embodiments, there can be one display screen 805, disposed on the front panel of the terminal 800; in other embodiments, there can be at least two display screens 805, disposed on different surfaces of the terminal 800 or in a foldable design; in still other embodiments, the display screen 805 can be a flexible display, disposed on a curved or foldable surface of the terminal 800. Furthermore, the display screen 805 can be configured as a non-rectangular irregular shape, i.e., a special-shaped screen. The display screen 805 can be made of materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).
[0304] The camera assembly 806 is used to capture images or videos. Optionally, the camera assembly 806 includes a front camera and a rear camera. The front camera is arranged on the front panel of the terminal, and the rear camera is arranged on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth of field camera, a wide-angle camera, and a telephoto camera, so as to realize the fusion of the main camera and the depth of field camera to realize the background blur function, the fusion of the main camera and the wide-angle camera to realize panoramic shooting and VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera assembly 806 may also include a flash. The flash can be a monochrome temperature flash or a dual-color temperature flash. The dual-color temperature flash refers to a combination of a warm light flash and a cold light flash, which can be used for light compensation at different color temperatures.
[0305] The audio circuit 807 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals that are input into the processor 801 for processing, or input into the radio frequency circuit 804 to achieve voice communication. For the purpose of stereo sound collection or noise reduction, there may be multiple microphones, each located in different parts of the terminal 800. The microphone may also be an array microphone or an omnidirectional collection microphone. The speaker is used to convert electrical signals from the processor 801 or the radio frequency circuit 804 into sound waves. The speaker may be a traditional thin film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert electrical signals into sound waves audible to humans, but also convert electrical signals into sound waves inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 807 may also include a headphone jack.
[0306] Positioning component 808 is used to locate the current geographic location of terminal 800 to implement navigation or LBS (Location Based Service). Positioning component 808 can be a positioning component based on the US GPS (Global Positioning System), China's Beidou system, or Russia's Galileo system.
[0307] Power supply 809 is used to power various components in terminal 800. Power supply 809 can be AC power, DC power, a disposable battery, or a rechargeable battery. When power supply 809 includes a rechargeable battery, the rechargeable battery can be a wired rechargeable battery or a wireless rechargeable battery. A wired rechargeable battery is a battery that is charged via a wired line, while a wireless rechargeable battery is a battery that is charged via a wireless coil. The rechargeable battery can also be used to support fast charging technology.
[0308] In some embodiments, the terminal 800 further includes one or more sensors 810 , including but not limited to: an acceleration sensor 811 , a gyroscope sensor 812 , a pressure sensor 813 , a fingerprint sensor 814 , an optical sensor 815 , and a proximity sensor 816 .
[0309] The accelerometer 811 can detect the magnitude of acceleration along the three coordinate axes of the coordinate system established by the terminal 800. For example, the accelerometer 811 can be used to detect the components of gravity acceleration along the three coordinate axes. The processor 801 can control the display screen 805 to display the user interface in a landscape or portrait view based on the gravity acceleration signal collected by the accelerometer 811. The accelerometer 811 can also be used to collect game or user motion data.
[0310] The gyroscope sensor 812 can detect the orientation and rotation angle of the terminal 800. It can work in conjunction with the accelerometer 811 to collect the user's 3D movements of the terminal 800. Based on the data collected by the gyroscope sensor 812, the processor 801 can implement the following functions: motion sensing (for example, changing the UI based on the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.
[0311] The pressure sensor 813 can be set on the side frame of the terminal 800 and / or the lower layer of the display screen 805. When the pressure sensor 813 is set on the side frame of the terminal 800, it can detect the user's grip signal of the terminal 800, and the processor 801 performs left and right hand recognition or shortcut operations based on the grip signal collected by the pressure sensor 813. When the pressure sensor 813 is set on the lower layer of the display screen 805, the processor 801 controls the operational controls on the UI interface based on the user's pressure operation on the display screen 805. The operational controls include at least one of a button control, a scroll bar control, an icon control, and a menu control.
[0312] The fingerprint sensor 814 is used to collect the user's fingerprint. The processor 801 identifies the user's identity based on the fingerprint collected by the fingerprint sensor 814, or the fingerprint sensor 814 identifies the user's identity based on the collected fingerprint. When the user's identity is recognized as a trusted identity, the processor 801 authorizes the user to perform relevant sensitive operations, such as unlocking the screen, viewing encrypted information, downloading software, making payments, and changing settings. The fingerprint sensor 814 can be set on the front, back, or side of the terminal 800. When a physical button or manufacturer logo is provided on the terminal 800, the fingerprint sensor 814 can be integrated with the physical button or manufacturer logo.
[0313] The optical sensor 815 is used to detect ambient light intensity. In one embodiment, the processor 801 can control the display brightness of the display screen 805 based on the ambient light intensity detected by the optical sensor 815. Specifically, when the ambient light intensity is high, the display brightness of the display screen 805 is increased; when the ambient light intensity is low, the display brightness of the display screen 805 is decreased. In another embodiment, the processor 801 can also dynamically adjust the shooting parameters of the camera assembly 806 based on the ambient light intensity detected by the optical sensor 815.
[0314] Proximity sensor 816, also known as a distance sensor, is disposed on the front panel of terminal 800. Proximity sensor 816 is used to detect the distance between the user and the front of terminal 800. In one embodiment, when proximity sensor 816 detects that the distance between the user and the front of terminal 800 is gradually decreasing, processor 801 controls display screen 805 to switch from the screen-on state to the screen-off state. When proximity sensor 816 detects that the distance between the user and the front of terminal 800 is gradually increasing, processor 801 controls display screen 805 to switch from the screen-off state to the screen-on state.
[0315] Those skilled in the art will understand that Figure 8 The structure shown in the figure does not constitute a limitation on the terminal 800, and the terminal 800 may include more or fewer components than shown in the figure, or combine certain components, or adopt a different component arrangement.
[0316] Optionally, the computer device is provided as a server. Figure 9 9 is a schematic diagram of the structure of a server provided in an embodiment of the present application. The server 900 may vary significantly due to different configurations or performances, and may include one or more processors (Central Processing Units, CPUs) 901 and one or more memories 902. The memories 902 store at least one computer program, which is loaded and executed by the processor 901 to implement the methods provided in the above-mentioned various method embodiments. Of course, the server may also have components such as a wired or wireless network interface, a keyboard, and input / output interfaces for input and output. The server may also include other components for implementing device functions, which will not be described in detail here.
[0317] An embodiment of the present application further provides a computer-readable storage medium, in which at least one computer program is stored. The at least one computer program is loaded and executed by a processor to implement the operations performed in the text information classification method of the above embodiment.
[0318] The present application also provides a computer program product or computer program, which includes computer program code stored in a computer-readable storage medium. A processor of a computer device reads the computer program code from the computer-readable storage medium and executes the computer program code, causing the computer device to implement the operations performed in the text information classification method of the above embodiment.
[0319] Those skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware, or may be accomplished by a program to instruct the relevant hardware, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0320] The above description is merely an optional embodiment of the embodiments of the present application and is not intended to limit the embodiments of the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the embodiments of the present application shall be included in the scope of protection of the present application.
Claims
1. A text information classification method, characterized in that: The method comprises: Obtaining a text graph corresponding to the text information, the text graph including a plurality of word nodes corresponding to a plurality of words in the text information and a feature vector corresponding to each word node, wherein the word nodes corresponding to any two words having an associated relationship are connected; Querying a knowledge database for a word set associated with the plurality of words; Fusing the word vector set corresponding to the queried word set to obtain a knowledge feature vector, wherein the word vector set includes the word vector of each word in the word set; Adding a knowledge node corresponding to the knowledge feature vector in the text graph, and connecting the knowledge node to the multiple word nodes respectively; The category to which the text information belongs is determined according to the feature vector of each node in the text graph and the connection relationship between each node.
2. The method according to claim 1, characterized in that The word vector set corresponding to the queried word set is fused to obtain a knowledge feature vector, including: Fusing the feature vectors of the multiple word nodes to obtain a first feature vector of the text graph; According to the first feature vector, the word vector set corresponding to the queried word set is fused to obtain the knowledge feature vector.
3. The method according to claim 2, characterized in that The step of fusing the word vector set corresponding to the queried word set according to the first feature vector to obtain the knowledge feature vector includes: Determine the similarity between each word vector in the word vector set and the first feature vector as the weight of each word vector; According to the weight of each word vector, multiple word vectors in the word vector set are weightedly fused to obtain the knowledge feature vector.
4. The method according to claim 2, characterized in that The step of fusing the word vector set corresponding to the queried word set according to the first feature vector to obtain the knowledge feature vector includes: The multi-head attention model is called to fuse the word vector set corresponding to the queried word set according to the first feature vector to obtain the knowledge feature vector.
5. The method according to claim 4, characterized in that The multi-head attention model includes multiple attention sub-models; The calling of the multi-head attention model to fuse the word vector set corresponding to the queried word set according to the first feature vector to obtain the knowledge feature vector includes: Each attention sub-model is called to perform weighted fusion on multiple word vectors in the word vector set according to the first feature vector to obtain the knowledge feature vector.
6. The method according to claim 1, characterized in that The obtaining of the text map corresponding to the text information includes: Performing word segmentation processing on the text information to obtain the multiple words; Perform feature extraction on each word to obtain a word vector for each word; Adding a word node corresponding to each word vector in the text graph; According to the positions of the multiple words in the text information, the word nodes corresponding to any two words having an associated relationship are connected.
7. The method according to claim 6, characterized in that The step of connecting the word nodes corresponding to any two words having an associated relationship according to positions of the multiple words in the text information includes: determining a co-occurrence frequency between any two of the plurality of words according to positions of the plurality of words in the text information; In response to the co-occurrence frequency between any two words being greater than a reference threshold, the word nodes corresponding to the two words are connected.
8. The method according to claim 1, characterized in that The obtaining of the text map corresponding to the text information includes: Constructing a text graph according to the text information, the text graph including a plurality of word nodes corresponding to a plurality of words in the text information and a feature vector corresponding to each word node, wherein the feature vector of each word node is a word vector of the word corresponding to each word node; According to the feature vector of each word node and the connection relationship between each word node, the feature vectors of the multiple word nodes are updated to obtain an updated text graph.
9. The method according to claim 8, characterized in that The updating of the feature vectors of the plurality of word nodes according to the feature vector of each word node and the connection relationship between the word nodes to obtain an updated text graph includes: For each word node, the feature vector of the word node is updated according to the feature vector of the word node and the feature vectors of adjacent word nodes of the word node, where the adjacent word nodes are other word nodes connected to the word node.
10. The method according to claim 9, characterized in that The updating of the feature vector of the word node according to the feature vector of the word node and the feature vectors of adjacent word nodes of the word node includes: Performing weighted processing on the feature vectors of adjacent word nodes of the word node to obtain a neighbor feature vector; Resetting the feature vector of the word node according to the reset parameter to obtain a reset feature vector corresponding to the word node; Transforming a feature vector obtained by weighted fusion of the reset feature vector and the neighbor feature vector to obtain a newly added feature vector; According to an update parameter, the newly added feature vector and the feature vector of the word node are fused to obtain an updated feature vector of the word node, wherein the update parameter represents an update weight of the newly added feature vector.
11. The method according to claim 1, wherein Determining the category to which the text information belongs based on the feature vector of each node in the text graph and the connection relationship between each node includes: updating the feature vector of each node according to the feature vector of each node and the connection relationship between each node; Fusing the updated feature vectors of each node to obtain a second feature vector of the text graph; The second feature vector is classified to obtain the category to which the text information belongs.
12. The method according to any one of claims 1 to 10, characterized in that: The text information includes medical consultation information, and determining the category to which the text information belongs based on the feature vector of each node in the text graph and the connection relationship between each node includes: The department to which the medical consultation information belongs is determined according to the feature vector of each node in the text graph corresponding to the medical consultation information and the connection relationship between each node.
13. A text information classification device, characterized in that: The device comprises: an acquisition module, configured to acquire a text graph corresponding to the text information, wherein the text graph includes a plurality of word nodes corresponding to a plurality of words in the text information and a feature vector corresponding to each word node, and the word nodes corresponding to any two words having an associated relationship are connected; A query module, configured to query a knowledge database for a word set associated with the plurality of words; A fusion module is used to fuse the word vector set corresponding to the queried word set to obtain a knowledge feature vector, wherein the word vector set includes the word vector of each word in the word set; A connection module, configured to add a knowledge node corresponding to the knowledge feature vector in the text graph, and connect the knowledge node with the plurality of word nodes respectively; The determination module is used to determine the category to which the text information belongs based on the feature vector of each node in the text graph and the connection relationship between each node.
14. A computer device, characterized in that: The computer device includes a processor and a memory, wherein the memory stores at least one computer program, and the at least one computer program is loaded and executed by the processor to implement the operations performed in the text information classification method according to any one of claims 1 to 12.
15. A computer-readable storage medium, characterized in that The computer-readable storage medium stores at least one computer program, and the at least one computer program is loaded and executed by a processor to implement the operations performed in the text information classification method according to any one of claims 1 to 12.
Citation Information
Patent Citations
Abnormal information text classification method based on knowledge graph
CN108595708A
Natural language processing method, natural language processing device and intelligent question-answering system
CN111026842A