Text processing method and device, computer device and storage medium

By acquiring target subgraphs from knowledge graphs and encoding text features, and utilizing graph neural networks to process node relationship features, the problem of graph structure information loss in existing technologies is solved, thereby improving the accuracy of text semantic understanding.

CN114281956BActive Publication Date: 2025-12-12TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111162110.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-30
Publication Date
2025-12-12
Estimated Expiration
2041-12-12

AI Technical Summary

Technical Problem

Existing technologies fail to effectively preserve the graph structure information of knowledge graphs when processing the professional definitions of technical terms, resulting in low accuracy.

Method used

By extracting target subgraphs from the knowledge graph based on words in the input text, encoding text features and adding them to the target subgraph, and using graph neural networks to process node relationship features while preserving graph structure information.

Benefits of technology

It significantly improves the accuracy of text semantic information, enabling a better understanding of the professional interpretations of specialized terms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114281956B_ABST
    Figure CN114281956B_ABST
Patent Text Reader

Abstract

The application provides a text processing method and device, computer equipment and a storage medium, and belongs to the technical field of artificial intelligence and is applied to the natural language processing scene. The method comprises the following steps: obtaining a target subgraph from a knowledge graph based on a plurality of words in an input text; encoding the input text to obtain text coding features of the input text; adding the text coding features as a text node to the target subgraph, and adding edges in the target subgraph based on the corresponding relationship between the plurality of words and the plurality of nodes; and determining text semantic information of the input text based on entity relationship features of a plurality of nodes in the target subgraph and the text coding features. The above technical solution can retain information in the graph structure of the knowledge graph without converting the target subgraph into a serialized structure, thereby significantly improving the accuracy of determining the text semantic information.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of artificial intelligence, in particular to a text processing method and device, computer equipment and a storage medium. BACKGROUND

[0002] Chinese natural language understanding has a wide range of applications, such as search, question and answer, and semantic detection. However, when a professional term in a certain professional field is included in the text, how to accurately understand the professional interpretation of the professional term is a research direction.

[0003] At present, the way to understand the professional term in the sentence is to combine the professional knowledge graph of the professional field and the language model, enumerate the triple corresponding to each node in the professional knowledge graph, construct each triple into a sample sentence, and cover any entity or entity relationship in the sample sentence. Based on the sample sentence, training is carried out, and the language model is used to predict the covered content. Since the entity is a professional term, the language model can learn the relationship between the professional terms, and then understand the professional interpretation of the professional terms.

[0004] The above scheme does not take into account that the language model is suitable for processing sequence information, but not suitable for processing the graph structure of the professional knowledge graph, and the knowledge graph needs to be converted into a serialized structure for processing, resulting in the loss of information in the graph structure, and thus the accuracy is low. SUMMARY

[0005] The embodiments of the present application provide a text processing method, device, computer equipment and storage medium, which do not need to convert the target subgraph into a serialized structure, can retain the information in the graph structure of the knowledge graph, and significantly improve the accuracy of determining the semantic information of the text. The technical solution is as follows:

[0006] On the one hand, a text processing method is provided, which comprises:

[0007] Based on a plurality of terms in an input text, a target subgraph is obtained from a knowledge graph, the target subgraph comprising a plurality of nodes corresponding to the plurality of terms and a plurality of edges representing the association relationship between the plurality of nodes;

[0008] The input text is encoded to obtain text encoding features of the input text;

[0009] The text encoding features are added to the target subgraph as text nodes, and edges are added in the target subgraph based on the correspondence between the plurality of terms and the plurality of nodes;

[0010] determine text semantic information of the input text based on entity relation features of multiple nodes in the target subgraph and the text encoding features, the entity relation features being used to represent node features of a corresponding node, node features of neighbor nodes of the corresponding node in the target subgraph, and relation features between the corresponding node and the neighbor nodes in the target subgraph.

[0011] In some embodiments, the obtaining, based on multiple words in the input text, a target subgraph from a knowledge graph comprises:

[0012] constructing at least one text semantic graph based on the multiple words, multiple first nodes in the text semantic graph representing the multiple words, and edges in the text semantic graph representing association relations between the multiple words;

[0013] obtaining multiple second nodes from the knowledge graph, corresponding words of the multiple second nodes having a similarity not less than a similarity threshold with the multiple words;

[0014] for any second node, obtaining a node subgraph of the second node, the node subgraph including the second node and neighbor nodes of the second node;

[0015] obtaining, from the knowledge graph, a minimum graph including the node subgraph of the multiple second nodes as the target subgraph.

[0016] In another aspect, a text processing apparatus is provided, the apparatus comprising:

[0017] a subgraph obtaining module configured to obtain, based on multiple words in an input text, a target subgraph from a knowledge graph, the target subgraph including multiple nodes corresponding to the multiple words and multiple edges representing association relations between the multiple nodes;

[0018] an encoding module configured to encode the input text to obtain text encoding features of the input text;

[0019] a subgraph updating module configured to add the text encoding features as a text node to the target subgraph and add edges in the target subgraph based on a correspondence between the multiple words and the multiple nodes;

[0020] an information determining module configured to determine text semantic information of the input text based on entity relation features of multiple nodes in the target subgraph and the text encoding features, the entity relation features being used to represent node features of a corresponding node, node features of neighbor nodes of the corresponding node in the target subgraph, and relation features between the corresponding node and the neighbor nodes in the target subgraph.

[0021] In some embodiments, the information determination module is configured to: obtain text entity relation features corresponding to the text node from entity relation features of a plurality of nodes in the target subgraph; pool the entity relation features of the plurality of nodes to obtain a subgraph feature of the target subgraph, the subgraph feature being used to represent the entity relation features of the plurality of nodes; and concatenate the subgraph feature, the text entity relation features, and the text encoding features to obtain text semantic information of the input text.

[0022] In some embodiments, the apparatus further comprises:

[0023] a node determination module configured to determine, for any node in the target subgraph, at least one neighbor node of the node;

[0024] a feature determination module configured to determine at least one neighbor relation feature corresponding to the at least one neighbor node, the neighbor relation feature being used to indicate a relation feature between the corresponding neighbor node and the node and a node feature of the corresponding neighbor node, the relation feature being used to indicate an association between nodes;

[0025] a feature aggregation module configured to aggregate the at least one neighbor relation feature into the node feature of the node to obtain an entity relation feature of the node.

[0026] In some embodiments, the feature determination module is configured to, for any neighbor node in the at least one neighbor node, obtain a relation feature between the neighbor node and the node; and concatenate the node feature of the neighbor node and the relation feature to obtain the neighbor relation feature corresponding to the neighbor node.

[0027] In some embodiments, the apparatus further comprises:

[0028] a feature extraction module configured to perform feature extraction on a plurality of edges in the target subgraph to obtain a plurality of relation features, the plurality of relation features corresponding to the plurality of edges in a one-to-one manner.

[0029] In some embodiments, the feature aggregation module is configured to obtain a first relation matrix of the target subgraph, the first relation matrix being used to represent associations between nodes in the target subgraph; and aggregate the at least one neighbor relation feature and the node feature of the node based on the first relation matrix, a second relation matrix, and a third relation matrix to obtain the entity relation feature corresponding to the node, the second relation matrix being a self-loop of the first relation matrix, and the third relation matrix being a regularization term of the first relation matrix.

[0030] In some embodiments, the subgraph obtaining module is configured to: construct at least one text semantic graph based on the plurality of words, wherein each first node in the text semantic graph represents a word in the plurality of words, and an edge in the text semantic graph represents an association relationship between the words; obtain a plurality of second nodes from the knowledge graph, wherein a word corresponding to each second node has a similarity with a word in the plurality of words that is not less than a similarity threshold; for each second node, obtain a node subgraph of the second node, wherein the node subgraph includes the second node and neighbor nodes of the second node; and obtain a minimum graph including the node subgraphs of the plurality of second nodes from the knowledge graph as the target subgraph.

[0031] In another aspect, a computer device is provided, which includes a processor and a memory, the memory being configured to store at least one piece of computer program, the at least one piece of computer program being loaded and executed by the processor to implement operations performed by the text processing method in the embodiments of the present application.

[0032] In another aspect, a computer readable storage medium is provided, which stores at least one piece of computer program, the at least one piece of computer program being loaded and executed by a processor to implement operations performed by the text processing method in the embodiments of the present application.

[0033] In another aspect, a computer program product is provided, which includes computer program code stored in a computer readable storage medium, the computer program code being read by a processor of a computer device from the computer readable storage medium, and the processor executes the computer program code to cause the computer device to perform the text processing method provided in various optional implementations of each aspect.

[0034] The technical scheme provided by the embodiments of the present application has the following beneficial effects:

[0035] The embodiments of the present application provide a text processing technical scheme, which adds a feature of an input text after encoding as a text node into a target subgraph, adds an edge based on a corresponding relationship between a word in the input text and a node in the target subgraph, so that the target subgraph includes not only a relationship between words, but also a relationship between a word and a sentence, and finally determines text semantic information of the input text based on a feature of the target subgraph, a feature of the text node, and a feature after encoding of the text. Since the target subgraph does not need to be converted into a serialized structure, information in a graph structure of a knowledge graph can be preserved, and the accuracy of determining text semantic information is significantly improved. BRIEF DESCRIPTION OF DRAWINGS

[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort based on these drawings.

[0037] Figure 1 is a schematic diagram of an implementation environment of a text processing method according to an embodiment of the present application;

[0038] Figure 2 is a flowchart of a text processing method according to an embodiment of the present application;

[0039] Figure 3 is a flowchart of another text processing method according to an embodiment of the present application;

[0040] Figure 4 is a schematic diagram of determining a target subgraph according to an embodiment of the present application;

[0041] Figure 5 is a schematic diagram of adding a text node according to an embodiment of the present application;

[0042] Figure 6 is a schematic diagram of determining a neighbor relationship feature according to an embodiment of the present application;

[0043] Figure 7 is a flowchart of another text processing method according to an embodiment of the present application;

[0044] Figure 8 is a schematic diagram of an application scenario according to an embodiment of the present application;

[0045] Figure 9 is a block diagram of a text processing apparatus according to an embodiment of the present application;

[0046] Figure 10 is a block diagram of another text processing apparatus according to an embodiment of the present application;

[0047] Figure 11 is a structural block diagram of a terminal according to an embodiment of the present application;

[0048] Figure 12 is a structural schematic diagram of a server according to an embodiment of the present application. DETAILED DESCRIPTION

[0049] In order to make the purpose, technical solutions and advantages of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the drawings.

[0050] The terms "first", "second", and the like in the present application are used to distinguish the same or similar items with substantially the same function and action, and it should be understood that there is no logical or time sequence relationship between "first", "second", and "nth", and the number and execution order are not limited.

[0051] The term "at least one" in the present application means one or more, and the meaning of "a plurality of" is two or more.

[0052] In the following, the terms involved in the present application are explained.

[0053] Artificial intelligence (AI) is the use of digital computers or digital computer-controlled machines to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology of computer science, which tries to understand the essence of intelligence and produce a new intelligent machine that can react in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines, so that machines have the functions of perception, reasoning and decision-making.

[0054] Artificial intelligence technology is a comprehensive discipline, involving a wide range of fields, both hardware and software technologies. Artificial intelligence basic technologies generally include sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction system, mechatronics, etc. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning, etc.

[0055] Natural language processing (NLP) is an important direction in the field of computer science and artificial intelligence. It studies various theories and methods that can realize effective communication between people and computers using natural language. Natural language processing is a science that integrates linguistics, computer science and mathematics. Therefore, the research in this field will involve natural language, i.e. the language used in daily life, so it has a close relationship with the study of linguistics. Natural language processing technology usually includes text processing, semantic understanding, machine translation, robot question and answer, knowledge graph, etc.

[0056] Knowledge Graph is a theory that combines theories and methods of mathematics, graphics, information visualization technology, information science, and citation analysis and co-occurrence analysis methods, and uses a visual graph to display the core structure, development history, frontiers, and overall knowledge architecture of a discipline to achieve the purpose of multi-disciplinary integration. In the embodiments, different professional fields have different knowledge graphs, such as a knowledge graph of a sports field based on the association relationship between athletes and athletes, and a knowledge graph of a medical field based on the association relationship between drugs and symptoms.

[0057] A graph neural network (GNN) is a neural network model that obtains graph dependency relationships through message passing between graph nodes. Graph neural networks are divided into five categories, namely, graph convolution networks (GCN), graph attention networks (GAN), graph autoencoders, graph generative networks, and graph spatial-temporal networks.

[0058] Attention mechanism is a way of encoding sequences. An attention function can be described as mapping a Query (search term) and a set of Key-Value pairs to an output, where the Query, Key, Value, and output are all vectors. The output is computed as a weighted sum of the values, where the weight assigned to each value is computed by a compatibility function (Compatibility Function) of the Query and the corresponding Key.

[0059] A pre-trained language model (Pretrained Language Model) is a deep learning model in the field of natural language processing. The model is pre-trained on a large corpus, so that the model's parameters contain basic linguistic rules.

[0060] Semantic parsing is the conversion of natural language expressions into machine-understandable representations, so semantic parsing can be understood as extracting the exact meaning of a discourse.

[0061] Stanford CoreNLP is a natural language processing toolkit. It integrates many very practical functions, including word segmentation, part-of-speech tagging, and syntax analysis. Stanford CoreNLP is not a deep learning framework, but a trained model. In fact, it can be compared to a software.

[0062] AllenNLP is a PyTorch-based natural language processing research library for providing state-of-the-art deep learning models in various language tasks.

[0063] BERT is the acronym for Bidirectional Encoder Representations from Transformers, which is an autoencoder LM as a whole, and it is designed to pretrain the model for two tasks.

[0064] A triple consists of a head entity, a tail entity, and a relation, where the relation represents the association between the head entity and the tail entity.

[0065] The text processing method provided by the embodiments of the present application can be applied to a computer device. In some embodiments, the computer device is a terminal or a server. First, taking the computer device as a server as an example, the implementation environment of the text processing method provided by the embodiments of the present application is introduced as follows, Figure 1 is a schematic diagram of an implementation environment of a text processing method according to the embodiments of the present application. Referring to Figure 1 , the implementation environment includes a terminal 101 and a server 102.

[0066] The terminal 101 and the server 102 can be directly or indirectly connected through wired or wireless communication, which is not limited in the present application.

[0067] In some embodiments, the terminal 101 is a smartphone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, a smart voice interaction device, a smart home appliance, and a vehicle terminal, but is not limited thereto. The terminal 101 is installed and runs an application, which can be a search application, a question and answer application, a social application, or a shopping application, etc. Those skilled in the art can know that the number of the above-mentioned terminal 101 can be more or less. For example, the above-mentioned terminal 101 can be only one, or the above-mentioned terminal can be dozens or hundreds, or more. The number and type of the terminal are not limited in the embodiments of the present application.

[0068] In some embodiments, the server 102 is a stand-alone physical server, can also be a server cluster or distributed system composed of multiple physical servers, and can also be a cloud server providing basic cloud computing services such as cloud service, cloud database, cloud computing, cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, CDN (Content Delivery Network), and big data and artificial intelligence platform. The server 102 is used to provide background services for the application program installed and running on the terminal 101. In some embodiments, the server 102 undertakes the main computing work, and the terminal 101 undertakes the secondary computing work; or the server 102 undertakes the secondary computing work, and the terminal 101 undertakes the main computing work; or the server 102 and the terminal 101 adopt a distributed computing architecture for collaborative computing.

[0069] In this implementation environment, taking the application program as a question and answer type application program as an example, the terminal 101 displays a question and answer page of the question and answer type application program, obtains a question text input by a user based on the question and answer page, sends the question text as an input text to the server 102, and processes the input text based on the text processing method provided in the embodiments of the present application to obtain text semantic information of the input text. The server 102 can generate a reply text corresponding to the input text based on the text semantic information, and return the reply text to the terminal 101, and the terminal 101 displays the reply text on the question and answer page.

[0070] Figure 2 is a flowchart of a text processing method provided in the embodiments of the present application, as shown in Figure 2 The text processing method includes the following steps:

[0071] 201, based on a plurality of words in an input text, obtaining a target subgraph from a knowledge graph, the target subgraph including a plurality of nodes corresponding to the plurality of words and a plurality of edges representing the association relationship between the plurality of nodes.

[0072] In the embodiments of the present application, the input text includes at least one complete sentence, that is, the words in the input text have an association relationship. After the server obtains the input text, it can obtain a plurality of words from the input text, then determine a plurality of nodes corresponding to the plurality of words from the knowledge graph, and then obtain a target subgraph including the plurality of nodes. The target subgraph also includes a plurality of edges between the plurality of nodes, and the edges between the nodes represent that the nodes have an association relationship.

[0073] 202, encoding the input text to obtain text encoding features of the input text.

[0074] In the embodiment of the present application, the server can encode the input text, and the encoded text feature can represent the characteristics of the input text.

[0075] 203、add the text feature as a text node to the target subgraph, and add edges in the target subgraph based on the correspondence between the plurality of words and the plurality of nodes.

[0076] In the embodiment of the present application, the server can add the text feature as a new node to the target subgraph, and since there is a correspondence between the plurality of words in the input text and the plurality of nodes in the target subgraph, the server can add edges between the text node and the plurality of nodes in the target subgraph based on the correspondence, to obtain a new target subgraph.

[0077] 204、determine the text semantic information of the input text based on the entity relationship features of the plurality of nodes in the target subgraph and the text feature, wherein the entity relationship features are used to represent the node features of the corresponding nodes, the node features of the neighbor nodes of the corresponding nodes in the target subgraph, and the relationship features between the corresponding nodes and the neighbor nodes in the target subgraph.

[0078] In the embodiment of the present application, the server can obtain the entity relationship features of the plurality of entity nodes from the target subgraph, that is, obtain the node features of each node, the node features of the neighbor nodes of each node in the target subgraph, and the relationship features between each node and the neighbor nodes in the target subgraph, so that the entity relationship features of each node include not only the features of the node itself, but also the features of the neighbor nodes and the relationship features between the neighbor nodes. Based on the entity relationship features of the plurality of nodes and the text feature, the text semantic information representing the text semantic of the input text can be determined, which includes not only the semantic of the text itself, but also the information in the knowledge graph, thereby realizing the understanding of the sentence containing the professional field words.

[0079] The embodiment of the present application provides a novel text processing method, which adds the encoded features of the input text as text nodes to the target subgraph, adds edges based on the correspondence between the words in the input text and the nodes in the target subgraph, so that the target subgraph includes not only the relationship between the words and the words, but also the relationship between the words and the sentences. Finally, the text semantic information of the input text is determined based on the features of the target subgraph, the features of the text nodes, and the encoded features of the text. Since the target subgraph does not need to be converted into a serialized structure, the information in the graph structure of the knowledge graph can be preserved, the accuracy of determining the text semantic information is significantly improved, and the search results, problem answers, etc. can be displayed based on the text semantic information.

[0080] Figure 3 is a flowchart of another text processing method according to an embodiment of the present application, as shown in the embodiment of the present application, taking the execution by a server as an example for illustration. The text processing method comprises the following steps: Figure 3

[0081] 301. Based on a plurality of words in the input text, a target subgraph is acquired from a knowledge graph, the target subgraph comprising a plurality of nodes corresponding to the plurality of words and a plurality of edges representing the association relationship between the plurality of nodes.

[0082] In the embodiment of the present application, taking a complete sentence as an example, the plurality of words in the input text need to have an association relationship. For example, "Athlete A and Athlete B are teammates" and "Medicine C can relieve symptom D" are two complete sentences. However, it cannot be a plurality of words without any relationship, such as "Athlete A symptom D food E", which is not a complete sentence, but includes three words without any relationship, and cannot be used as input text.

[0083] In some embodiments, the input text is a text uploaded by a terminal based on an application program received by the server, or a text obtained after the server recognizes the voice uploaded by the terminal, and the embodiment of the present application does not limit this.

[0084] In the embodiment of the present application, after the server acquires the input text, the input text can be semantically analyzed based on a natural language processing toolkit to obtain a plurality of words in the input text. Then a plurality of nodes corresponding to the plurality of words are determined from the knowledge graph, and a target subgraph including the plurality of nodes is acquired from the knowledge graph. It should be noted that the target subgraph also includes neighbor nodes of the plurality of nodes in the knowledge graph, and edges between each node in the plurality of nodes and the neighbor nodes. The neighbor nodes of a node refer to the nodes adjacent to the node in the knowledge graph. The natural language processing toolkit can be Stanford CoreNLP toolkit, AllenNLP toolkit, etc., and the embodiment of the present application does not limit this.

[0085] ​In some embodiments, since the words represented by the nodes in the knowledge graph are not completely consistent with the words in the input text, for example, the word represented by a node in the knowledge graph is Thompson, and the word in the input text is Thompson, the server can determine the node from the knowledge graph based on the similarity between the words, and then determine the target subgraph. Correspondingly, the step of the server obtaining the target subgraph from the knowledge graph based on the plurality of words in the input text comprises: the server constructs at least one text semantic graph based on the plurality of words, wherein the plurality of first nodes in the text semantic graph represent the plurality of words, and the edges in the text semantic graph represent the association relationship between the plurality of words. The server obtains a plurality of second nodes from the knowledge graph, wherein the similarity between the words corresponding to the plurality of second nodes and the plurality of words is not less than a similarity threshold. For any second node, obtain the node subgraph of the second node, wherein the node subgraph includes the second node and the neighbor nodes of the second node, that is, the neighbor nodes that the second node can reach in one step in the knowledge graph, in other words, the neighbor nodes and the second node are directly connected by edges without passing through other nodes. Finally, the server obtains the minimum graph including the node subgraph of the plurality of second nodes from the knowledge graph as the target subgraph, wherein the target subgraph includes the second nodes, the neighbor nodes of the second nodes, and the edges between the nodes. By obtaining the nodes representing the similar words in the input text from the knowledge graph, the accuracy of determining the nodes in the knowledge graph can be improved. It should be noted that the lower the similarity threshold is, the more second nodes the server obtains, and the higher the similarity threshold is, the fewer second nodes the server obtains.

[0086] For example, referring to Figure 4 Figure 4 is a schematic diagram of determining a target subgraph according to an embodiment of the present application. The input text is a sentence: "How much is the budget of the movie directed by Paul Anderson?", the server performs semantic analysis on the sentence by using the Stanford CoreNLP tool package, and obtains the semantic relationship triplets included in the sentence: {budget, how much, movie}, {direct, movie, Paul Anderson}, and then constructs the semantic graph of the sentence. Referring to Figure 4 ​The semantic graph includes three nodes representing "Paul W. S. Anderson", "movie" and "how much", and two edges representing "direct" and "budget". The server then performs synonym expansion on the entities represented by the nodes in the knowledge graph. For example, the server queries the dictionary and finds that the entity "Paul W. S. Anderson" can also be represented as "Paul Anderson (actor)" and "Paul S. Anderson". The server then matches the words in the sentence with the expanded words to increase the accuracy of determining the nodes in the knowledge graph. Figure 4 As shown in step 2 of FIG. 1, X in <X, Y> represents the expanded word, and Y represents the similarity between the word in the sentence and the word X. For example, the similarity between "Paul Anderson" and "Paul Anderson (actor)" is 0.9, the similarity between "Paul Anderson" and "Paul S. Anderson" is 0.8, and the similarity between "Paul Anderson" and "Paul W. S. Anderson" is 0.6. The similarity between "direct" and "director" is 1.0, the similarity between "direct" and "writer" is 0.8, and the similarity between "direct" and "producer" is 0.6. The similarity between "movie" and "movie" is 1.0, and the similarity between "movie" and "film festival" is 0.9. The similarity between "budget" and "budget" is 1.0. "How much" has no similar words. Suppose the server determines the node set E = {e1, e2,..., en} in the knowledge graph, and the similarity between the node set E and the sentence is S = {s1, s2,..., sn}. The server then determines the similarity between the node set E and the sentence S as follows: n} and n is a positive integer, then the node set determined by the server in step 2 is {how much, budget, movie, film festival, director, writer, producer, Paul Anderson (actor), Paul S. Anderson, and Paul W. S. Anderson}. For each node in the above node set, the server constructs a node subgraph of the node based on the neighbor nodes reachable by the node in one step. n nodes correspond to n node subgraphs, as shown in step 3. The neighbor nodes reachable by the movie node in one step are movie name 1, the neighbor nodes reachable by the how much node in one step are movie name 1, the neighbor nodes reachable by the Paul W. S. Anderson node in one step are movie name 1, director, and movie name 2, the neighbor nodes reachable by the Paul Anderson (actor) node in one step are actor and movie name 3, the neighbor nodes reachable by the Paul S. Anderson node in one step are Priest Award and chemist, and the neighbor nodes reachable by the film festival node in one step are movie name 4 and festival. The node corresponding to how much is 1 billion yuan, which is connected to movie name 1. Based on the above node set, a total of 4 node subgraphs are obtained: {movie, movie name 1, 1 billion yuan, Paul W. S. Anderson, director, movie name 2}, {actor, Paul Anderson (actor), movie name 3}, {Priest Award, Paul S. Anderson, chemist}, and {movie name 4, film festival, festival}. The server finds a minimum graph G in the knowledge graph, such that the minimum graph G contains the above n node subgraphs. The minimum graph G is the target subgraph obtained by the search. It should be noted that, Figure 4 Exemplary shows that when the similarity threshold is 0.5, the words in the sentence that have a similarity not less than the similarity threshold are shown, and the words that have a similarity less than the similarity threshold are not shown.

[0087] 302, encode the input text to obtain text encoding features of the input text.

[0088] In the embodiment of the present application, the server can input the input text into the pre-trained language model, encode the input text by the pre-trained language model, and output text encoding features. The text encoding features are used to represent the features of the input text, and the text encoding features are in the form of feature vectors. The pre-trained language model can be a BERT model, and can also be an xlnet model (an improved BETR model), a robert model (an improved BERT model), a bert-wwm (bert-whole word masking) model, and an albert model (a simplified BERT model), etc. The embodiments of the present application do not limit this.

[0089] 303、add an edge in the target subgraph based on the correspondence between the plurality of words and the plurality of nodes.

[0090] In the embodiment of the present application, after obtaining the target subgraph and the text encoding feature, the server adds the text encoding feature as a new node to the target subgraph. For the convenience of description, the node representing the text encoding feature is referred to as a text node. Since the text node corresponds to the input text, the plurality of words in the input text correspond to the plurality of nodes in the target subgraph, and therefore the server can add an edge in the target subgraph based on the correspondence between the words in the input text and the nodes in the target subgraph.

[0091] For example, referring to FIG. 3, the text node 301 is added to the target subgraph 300. Figure 5 Figure 5 is a schematic diagram of adding a text node according to an embodiment of the present application.

[0092] 304、obtain entity relationship features of the plurality of nodes in the target subgraph, the entity relationship features being used to represent node features of corresponding nodes, node features of neighbor nodes of the corresponding nodes in the target subgraph, and relationship features between the corresponding nodes and the neighbor nodes in the target subgraph.

[0093] In the embodiment of the present application, the server can obtain information contained in the target subgraph based on a graph neural network algorithm. Since the graph neural network is generally applicable to an unrelation graph, directly processing the target subgraph will lose the relationship information between the nodes, and therefore the server first processes each node in the target subgraph respectively to determine the entity relationship features of each node, that is, to make each node include not only the node features of the node itself, but also the relationship features between the node and the neighbor nodes, and the node features of the neighbor nodes.

[0094] ​In some embodiments, taking any node in the target subgraph as an example, the server obtains the entity relationship feature of each node by aggregating the neighbor relationship features of the neighbor nodes of each node into the node. Correspondingly, this step includes: for any node in the target subgraph, the server determines at least one neighbor node of the node, that is, a node that can be reached in one step in the target subgraph. Then the server determines at least one neighbor relationship feature corresponding to the at least one neighbor node, the neighbor relationship feature being used to indicate the relationship feature between the corresponding neighbor node and the node and the node feature of the corresponding neighbor node, the relationship feature being used to indicate the association relationship between nodes. Finally, the server aggregates the at least one neighbor relationship feature into the node feature of the node to obtain the entity relationship feature of the node. Wherein, since the node represents an entity, the node feature can also be referred to as the entity feature. By aggregating the node features and relationship features of the neighbor nodes of each node into the node, the node can contain the relationship between nodes.

[0095] In some embodiments, the server first extracts features from the multiple edges in the target subgraph to obtain multiple relationship features, the multiple relationship features corresponding one-to-one to the multiple edges, that is, the target subgraph has how many edges, which means that the nodes have how many relationships, and then the server can extract how many relationship features.

[0096] For example, there are M edges in the target subgraph, and the server encodes the relationship represented by the M edges, then extracts M relationships, and the dimension of each relationship is 1*d, d is the dimension of the encoding vector, the relationship feature extracted in the target subgraph is represented as V, the dimension of V is M*d, each row corresponds to an edge, that is, a relationship, and M is a positive integer.

[0097] In some embodiments, taking a neighbor node as an example, the step of determining at least one neighbor relationship feature corresponding to the at least one neighbor node includes: for any neighbor node in the at least one neighbor node, the server obtains the relationship feature between the neighbor node and the node. Then the server splices the node feature of the neighbor node and the relationship feature to obtain the neighbor relationship feature corresponding to the neighbor node.

[0098] In some embodiments, the server can aggregate the neighbor relation features of the neighbor nodes into the node features of the node based on the plurality of relation matrices. Accordingly, the step of the server aggregating the at least one neighbor relation feature into the node features of the node to obtain the entity relation feature of the node includes: the server obtaining a first relation matrix of the target subgraph, the first relation matrix being used to represent the association between the nodes in the target subgraph. Then the server aggregates the at least one neighbor relation feature and the node features of the node based on the first relation matrix, a second relation matrix and a third relation matrix to obtain the entity relation feature corresponding to the node, the second relation matrix being a self-loop of the first relation matrix, and the third relation matrix being a regularization term of the first relation matrix. By aggregating the neighbor relation features of the neighbor nodes into the node features of the node, the entity relation feature containing the relation feature can be obtained, and thus the relation information in the target subgraph will not be lost.

[0099] In some embodiments, the number of nodes in the target subgraph is N, N is a positive integer, and the set of node features is represented as Nc={n1, n2,..., n N}, then the size of the matrix composed of the node features is N*d. n1 represents the first row of the matrix, representing the node features of a node. Referring to Figure 6 Figure 6 is a schematic diagram for determining neighbor relation features according to an embodiment of the present application. In each layer of the graph neural network, for any node 1, the neighbor nodes 2 and 3 of the node 1 are first determined, and then the relation feature v1 between the node 1 and the node 2 is spliced with the node feature n2 of the node 2, referring to formula (1) shown as follows:

[0100] n'2=w[v1, n2] (1);

[0101] wherein n'2 represents the neighbor relation feature of the node 2; w represents the parameter of the graph neural network, and the size is 2d*d; v1 represents the relation feature between the node 1 and the node 2; n2 represents the node feature of the node 2.

[0102] It should be noted that since the vector dimension of n2 is 1*d and the vector dimension of v1 is 1*d, the vector dimension after splicing is 2*d, and the size of w is 2d*d, the vector dimension of n'2 is 1*d, although the vector dimension does not change, but the n'2 has already included the relation feature v1 between the node 1 and the node 2.

[0103] Then, for any node, the server aggregates the neighbor node relation features of the neighbor nodes of the node in the target subgraph into the node by using the aggregation mode of the graph attention neural network GAN to obtain the entity relation feature of the node, referring to formula (2) shown as follows:

[0104]

[0105] Where, n (l+1) The first relation matrix represents the entity relationship features of the node in the next layer, i.e., the (l+1)th layer; the second relation matrix represents the target subgraph; the third relation matrix represents the target subgraph; and the third relation matrix represents the target subgraph. The fourth relation matrix represents the model parameters, which are of size d*d and are learned based on gradient updates. The first relation matrix represents the first relation matrix of the target subgraph; the second relation matrix represents the second relation matrix of the target subgraph; and the third relation matrix represents the third relation matrix of the target subgraph. The fifth relation matrix represents the model parameters, which are of size d*d and are learned based on gradient updates. The second relation matrix represents the first ...

[0106] 305. Based on the entity relationship features of multiple nodes in the target subgraph and the text encoding features, determine the text semantic information of the input text.

[0107] In this embodiment, after obtaining the entity relationship features of multiple nodes in the target subgraph, the server can determine the subgraph features of the target subgraph through pooling. These subgraph features represent the features contained in the target subgraph, that is, the entity relationship features of the multiple nodes; in other words, they represent the node features and the relationship features between nodes in the target subgraph. The aforementioned text semantic information is obtained by concatenating the subgraph features, the entity relationship features of the text nodes, and the text encoding features.

[0108] In some embodiments, the step of the server determining the textual semantic information of the input text based on the entity relationship features of multiple nodes in the target subgraph and the text encoding features includes: the server obtaining the textual entity relationship features corresponding to the text node from the entity relationship features of multiple nodes in the target subgraph; then, the server pooling the entity relationship features of the multiple nodes to obtain the subgraph features of the target subgraph, which represent the entity relationship features of the multiple nodes; finally, the server concatenating the subgraph features, the textual entity relationship features, and the text encoding features to obtain the textual semantic information of the input text. This textual semantic information includes the semantic information of the entire input text as well as information from the target subgraph.

[0109] For example, see Figure 7 As shown, Figure 7 This is a flowchart of another text processing method provided according to an embodiment of this application. Figure 7 An exemplary embodiment illustrates the steps of encoding input text based on a pre-trained language model, determining a target subgraph based on multiple words in the input text, adding text node Z to the target subgraph, and aggregating the node features in the target subgraph to obtain the entity relationship features of the nodes. Finally, the pooled subgraph features, text encoding features, and entity relationship features of the text nodes are concatenated.

[0110] It should be noted that the server can apply the text semantic information to downstream tasks in different scenarios after obtaining the text semantic information. The application scenarios include, but are not limited to, a shopping scenario, a question and answer scenario, a search scenario, a traffic scenario, and a medical scenario.

[0111] For example, Figure 8 is a schematic diagram of an application scenario provided by an embodiment of the present application. Taking the text semantic information used in a search scenario as an example, referring to (a) shown in Figure 8 , the terminal displays the search interface, and the user inputs the text “XXX symptom can take YYY medicine?” in the search interface. The terminal sends the text as an input text to the server. The server determines the text semantic information of the input text based on the text processing method provided by the embodiment of the present application. For example, three words of XXX symptom, taking, and YYY medicine are obtained from the input text, wherein XXX symptom and YYY medicine are professional words. The server retrieves a target subgraph from the medical knowledge graph that has been constructed, such as the target subgraph including the triplets related to XXX symptom and YYY medicine, such as <YYY medicine, belongs to, digestive internal medicine drug>, <YYY medicine, dosage, three times a day>, and <YYY medicine, used for treating, gastritis>. Based on the above triplets, a sentence is generated based on a template, such as “the dosage of YYY medicine is three times a day”. The sentence is input into a pre-trained language model, so that the information of the above professional words is combined into the text semantic information of the input sentence. Then, based on the text semantic information, a plurality of output texts associated with the input text are returned to the terminal, such as “what is the dosage of YYY medicine?”, “XXX symptom can eat ZZZ food?”, “XXX symptom can eat fruit?”, and “UUU symptom can take YYY medicine?” and the like. Other search texts related to the input text can provide search content associated with the input text for the user.

[0112] For another example, taking the text semantic information used in a question and answer scenario as an example, referring to (b) shown in Figure 8 , the terminal displays the question and answer interface, and the user inputs the text “XXX symptom taking YYY medicine effective?” in the question and answer interface. The terminal sends the text as an input text to the server. The server determines the text semantic information of the input text based on the text processing method provided by the embodiment of the present application. Then, based on the text semantic information, a reply text is determined. The reply text is displayed by the terminal, and an article link related to the input text can also be returned to the terminal and displayed by the terminal.

[0113] It should be noted that the above text processing method can be implemented based on a text processing model. The text processing model can dynamically combine knowledge graphs of different fields based on an existing pre-trained language model, and perform targeted training on a knowledge graph of a specified field, so that the trained text processing model can better understand professional vocabulary in the specified field. Moreover, the text processing model includes a graph attention neural network. The entity relationship features of nodes are determined based on the graph attention neural network. Since the graph attention neural network includes a graph attention mechanism, the output or decision of the text processing model can be explained by observing the size of the attention weight on the graph attention neural network during model running, so as to facilitate training of the text processing model to an expected state.

[0114] The embodiment of the present application provides a novel text processing method. A target subgraph is obtained from a knowledge graph based on a plurality of words in an input text, so that the target subgraph obtained includes not only the plurality of words in the text and the relationship between the plurality of words, but also similar words and relationships. The features of the input text after encoding are added to the target subgraph as text nodes, and edges are added based on the correspondence between the words in the input text and the nodes in the target subgraph, so that the target subgraph includes not only the relationship between words and words, but also the relationship between words and sentences. Then, the text semantic information of the input text is determined based on the features of the target subgraph, the features of the text nodes, and the features of the input text after encoding. Since the target subgraph does not need to be converted into a serialized structure when the features of the target subgraph are obtained, the information in the graph structure of the knowledge graph can be preserved, so that the text semantic information includes not only the semantic information of the words in the text, but also the semantic information of the professional vocabulary extended in the target subgraph, which significantly improves the accuracy of determining the text semantic information.

[0115] Figure 9 is a block diagram of a text processing device provided by the embodiment of the present application. The text processing device is used to execute the steps in the above text processing method, and the device includes a subgraph obtaining module 901, an encoding module 902, a subgraph updating module 903, and an information determining module 904. Figure 9 , the device includes a subgraph obtaining module 901, an encoding module 902, a subgraph updating module 903, and an information determining module 904.

[0116] The subgraph obtaining module 901 is configured to obtain a target subgraph from a knowledge graph based on a plurality of words in an input text. The target subgraph includes a plurality of nodes corresponding to the plurality of words and a plurality of edges representing the association relationship between the plurality of nodes.

[0117] The encoding module 902 is configured to encode the input text to obtain text encoding features of the input text.

[0118] The subgraph updating module 903 is configured to add the text node to the target subgraph by using the text coding feature, and add edges in the target subgraph based on the correspondence between the plurality of words and the plurality of nodes.

[0119] The information determining module 904 is configured to determine text semantic information of the input text based on the entity relationship features of the plurality of nodes in the target subgraph and the text coding feature, where the entity relationship features are used to represent the node features of the corresponding nodes, the node features of the neighbor nodes of the corresponding nodes in the target subgraph, and the relationship features between the corresponding nodes and the neighbor nodes in the target subgraph.

[0120] In some embodiments, the information determining module 904 is configured to obtain a text entity relationship feature corresponding to the text node from the entity relationship features of the plurality of nodes in the target subgraph, pool the entity relationship features of the plurality of nodes to obtain a subgraph feature of the target subgraph, where the subgraph feature is used to represent the entity relationship features of the plurality of nodes, and concatenate the subgraph feature, the text entity relationship feature, and the text coding feature to obtain the text semantic information of the input text.

[0121] In some embodiments, Figure 10 is a block diagram of another text processing apparatus provided by an embodiment of the present application, as shown in Figure 10 The apparatus further includes:

[0122] The node determining module 905 is configured to determine at least one neighbor node of any node in the target subgraph.

[0123] The feature determining module 906 is configured to determine at least one neighbor relationship feature corresponding to the at least one neighbor node, where the neighbor relationship feature is used to indicate the relationship feature between the corresponding neighbor node and the node and the node feature of the corresponding neighbor node, and the relationship feature is used to indicate the association relationship between the nodes.

[0124] The feature aggregation module 907 is configured to aggregate the at least one neighbor relationship feature into the node feature of the node to obtain an entity relationship feature of the node.

[0125] In some embodiments, the feature determining module 906 is configured to obtain the relationship feature between the neighbor node and the node for any neighbor node in the at least one neighbor node, and concatenate the node feature of the neighbor node and the relationship feature to obtain the neighbor relationship feature corresponding to the neighbor node.

[0126] In some embodiments, as shown in Figure 10 The apparatus further includes:

[0127] The feature extraction module 908 is configured to perform feature extraction on the multiple edges in the target subgraph to obtain multiple relationship features, the multiple relationship features corresponding to the multiple edges in a one-to-one manner.

[0128] In some embodiments, the feature aggregation module 907 is configured to obtain a first relationship matrix of the target subgraph, the first relationship matrix being used to represent the association relationship between the nodes in the target subgraph; and aggregate the at least one neighbor relationship feature and the node feature of the node based on the first relationship matrix, a second relationship matrix, and a third relationship matrix to obtain an entity relationship feature corresponding to the node, the second relationship matrix being a self-loop of the first relationship matrix, and the third relationship matrix being a regularization term of the first relationship matrix.

[0129] In some embodiments, the subgraph obtaining module 901 is configured to construct at least one text semantic graph based on the multiple terms, multiple first nodes in the text semantic graph representing the multiple terms, and an edge in the text semantic graph representing an association relationship between the multiple terms; obtain multiple second nodes from the knowledge graph, the terms corresponding to the multiple second nodes having a similarity not less than a similarity threshold with the multiple terms; for any second node, obtain a node subgraph of the second node, the node subgraph including the second node and neighbor nodes of the second node; and obtain a minimum graph including the node subgraphs of the multiple second nodes from the knowledge graph as the target subgraph.

[0130] The text processing apparatus provided in the embodiments of the present application obtains a target subgraph from a knowledge graph based on multiple terms in an input text, so that the obtained target subgraph includes not only the multiple terms and the relationship between the multiple terms in the text, but also similar terms and relationships. The features of the input text after encoding are added to the target subgraph as text nodes, and edges are added based on the correspondence between the terms in the input text and the nodes in the target subgraph, so that the target subgraph includes not only the relationship between the terms and the relationship between the terms and the sentence. Then, the text semantic information of the input text is determined based on the features of the target subgraph, the features of the text nodes, and the features of the input text after encoding. Since the features of the target subgraph do not need to be converted into a serialized structure, the information in the graph structure of the knowledge graph can be retained, so that the text semantic information includes not only the semantic information of the terms in the text, but also the semantic information of the professional terms extended in the target subgraph, and the accuracy of determining the text semantic information is significantly improved.

[0131] It should be noted that the text processing apparatus provided in the above embodiments is only used for example to illustrate the division of the above functional modules when performing text processing. In actual applications, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the apparatus is divided into different functional modules to complete all or part of the above described functions. In addition, the text processing apparatus and the text processing method provided in the above embodiments belong to the same concept, and the specific implementation process is described in the method embodiments, which will not be repeated here.

[0132] In the embodiments of the present application, the computer device can be configured as a terminal or a server. When the computer device is configured as a terminal, the technical solutions provided by the embodiments of the present application are implemented by the terminal as an execution subject. When the computer device is configured as a server, the technical solutions provided by the embodiments of the present application are implemented by the server as an execution subject. Or the technical solutions provided by the present application are implemented through the interaction between the terminal and the server, and the embodiments of the present application do not limit this.

[0133] Figure 11 is a structural block diagram of a terminal 1100 according to the embodiments of the present application. The terminal 1100 can be a portable mobile terminal, such as a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 player (Moving Picture Experts Group Audio Layer IV), a notebook computer or a desktop computer. The terminal 1100 can also be referred to as a user equipment, a portable terminal, a laptop terminal, a desktop terminal, and other names.

[0134] Generally, the terminal 1100 includes a processor 1101 and a memory 1102.

[0135] The processor 1101 can include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like. The processor 1101 can be implemented in at least one of a hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), a PLA (Programmable Logic Array). The processor 1101 can also include a main processor and a coprocessor, the main processor being a processor for processing data in an awake state, also known as a CPU (Central Processing Unit), and the coprocessor being a low-power processor for processing data in a standby state. In some embodiments, the processor 1101 can be integrated with a GPU (Graphics Processing Unit) for rendering and drawing content required to be displayed by the display screen. In some embodiments, the processor 1101 can further include an AI (Artificial Intelligence) processor for processing computing operations related to machine learning.

[0136] The memory 1102 can include one or more computer-readable storage media that can be non-transitory. The memory 1102 can also include a high-speed random access memory, and a nonvolatile memory such as one or more disk storage devices, flash storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 1102 is used to store at least one computer program for being executed by the processor 1101 to implement the text processing method provided by the method embodiments in the present application.

[0137] In some embodiments, the terminal 1100 can also optionally include a peripheral device interface 1103 and at least one peripheral device. The processor 1101, the memory 1102, and the peripheral device interface 1103 can be connected through a bus or a signal line. Each peripheral device can be connected to the peripheral device interface 1103 through a bus, a signal line, or a circuit board. Specifically, the peripheral device includes at least one of a radio frequency circuit 1104, a display screen 1105, a camera assembly 1106, an audio circuit 1107, a positioning assembly 1108, and a power supply 1109.

[0138] The peripheral interface 1103 can be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 1101 and the memory 1102. In some embodiments, the processor 1101, the memory 1102 and the peripheral interface 1103 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 1101, the memory 1102 and the peripheral interface 1103 can be implemented on a separate chip or circuit board, and the present embodiment is not limited in this regard.

[0139] The radio frequency circuit 1104 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 1104 communicates with a communication network and other communication devices through electromagnetic signals. The radio frequency circuit 1104 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. In some embodiments, the radio frequency circuit 1104 includes an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and the like. The radio frequency circuit 1104 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes but is 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 1104 can also include NFC (Near Field Communication) related circuitry, which is not limited by the present application.

[0140] The display screen 1105 is configured to display a UI (User Interface). The UI can include graphics, text, icons, video, and any combination thereof. When the display screen 1105 is a touch display screen, the display screen 1105 is further configured to capture touch signals on or above the surface of the display screen 1105. The touch signals can be input to the processor 1101 as control signals for processing. In this case, the display screen 1105 can also be configured to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, the display screen 1105 can be one, disposed on the front panel of the terminal 1100; in other embodiments, the display screen 1105 can be at least two, respectively disposed on different surfaces of the terminal 1100 or in a folding design; in other embodiments, the display screen 1105 can be a flexible display screen, disposed on a curved surface or a folding surface of the terminal 1100. Even, the display screen 1105 can also be disposed in an irregular shape, i.e., a special-shaped screen. The display screen 1105 can be made of materials such as LCD (Liquid Crystal Display) or OLED (Organic Light-Emitting Diode).

[0141] The camera assembly 1106 is configured to capture images or videos. In some embodiments, the camera assembly 1106 includes a front camera and a rear camera. Typically, the front camera is disposed on the front panel of the terminal, and the rear camera is disposed on the back of the terminal. In some embodiments, the rear camera is at least two, which is any one of a main camera, a depth-of-field camera, a wide-angle camera, and a telephoto camera, to realize the background blur function of the main camera and the depth-of-field camera, the panoramic shooting and VR (Virtual Reality) shooting function of the main camera and the wide-angle camera, or other fusion shooting functions. In some embodiments, the camera assembly 1106 can further include a flash. The flash can be a single-color temperature flash or a dual-color temperature flash. The dual-color temperature flash refers to the combination of a warm light flash and a cold light flash, which can be used for light compensation under different color temperatures.

[0142] The audio circuit 1107 can include a microphone and a speaker. The microphone is used to collect sound waves of a user and an environment, and convert the sound waves into an electrical signal input to the processor 1101 for processing, or input to the radio frequency circuit 1104 to realize voice communication. For the purpose of stereo sound collection or noise reduction, the microphone can be multiple, respectively arranged at different parts of the terminal 1100. The microphone can also be an array microphone or an omnidirectional collection type microphone. The speaker is used to convert the electrical signal from the processor 1101 or the radio frequency circuit 1104 into sound waves. The speaker can be a traditional diaphragm speaker, or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, not only can the electrical signal be converted into a sound wave audible to humans, but also can be converted into a sound wave inaudible to humans for ranging purposes. In some embodiments, the audio circuit 1107 can also include a headphone jack.

[0143] The positioning component 1108 is used to position the current geographic location of the terminal 1100 to realize navigation or LBS (Location Based Service). The positioning component 1108 can be a positioning component based on the GPS (Global Positioning System) of the United States, the Beidou system of China or the Galileo system of Russia.

[0144] The power supply 1109 is used to supply power to each component in the terminal 1100. The power supply 1109 can be an alternating current, a direct current, a disposable battery or a rechargeable battery. When the power supply 1109 includes a rechargeable battery, the rechargeable battery can be a wired charging battery or a wireless charging battery. The wired charging battery is a battery charged through a wired line, and the wireless charging battery is a battery charged through a wireless coil. The rechargeable battery can also be used to support fast charging technology.

[0145] In some embodiments, the terminal 1100 further includes one or more sensors 1110. The one or more sensors 1110 include but are not limited to an acceleration sensor 1111, a gyroscope sensor 1112, a pressure sensor 1113, a fingerprint sensor 1114, an optical sensor 1115 and a proximity sensor 1116.

[0146] The acceleration sensor 1111 can detect the acceleration magnitude in three coordinate axes of the coordinate system established by the terminal 1100. For example, the acceleration sensor 1111 can be used to detect the components of the gravitational acceleration in three coordinate axes. The processor 1101 can control the display screen 1105 to display the user interface in a landscape view or a portrait view according to the gravitational acceleration signal collected by the acceleration sensor 1111. The acceleration sensor 1111 can also be used for game or user motion data collection.

[0147] The gyroscope sensor 1112 can detect the body direction and rotation angle of the terminal 1100, and can collect 3D motions of the user on the terminal 1100 in cooperation with the acceleration sensor 1111. The processor 1101 can implement the following functions according to the data collected by the gyroscope sensor 1112: motion sensing (e.g., changing a UI according to a tilt operation of the user), image stabilization during shooting, game control, and inertial navigation.

[0148] The pressure sensor 1113 can be disposed on the side frame of the terminal 1100 and / or the lower layer of the display screen 1105. When the pressure sensor 1113 is disposed on the side frame of the terminal 1100, the grip signal of the user on the terminal 1100 can be detected, and the left-hand / right-hand recognition or shortcut operation can be performed by the processor 1101 according to the grip signal collected by the pressure sensor 1113. When the pressure sensor 1113 is disposed on the lower layer of the display screen 1105, the operable control on the UI interface can be controlled by the processor 1101 according to the pressure operation of the user on the display screen 1105. The operable control includes at least one of a button control, a scroll bar control, an icon control, and a menu control.

[0149] The fingerprint sensor 1114 is used to collect the fingerprint of the user, and the identity of the user can be recognized by the processor 1101 according to the fingerprint collected by the fingerprint sensor 1114, or by the fingerprint sensor 1114 according to the collected fingerprint. When the identity of the user is recognized as a trusted identity, the processor 1101 authorizes the user to perform a related sensitive operation, which includes unlocking the screen, viewing encrypted information, downloading software, payment, and changing settings, etc. The fingerprint sensor 1114 can be disposed on the front, back, or side of the terminal 1100. When the physical button or the manufacturer's logo is disposed on the terminal 1100, the fingerprint sensor 1114 can be integrated with the physical button or the manufacturer's logo.

[0150] The optical sensor 1115 is used to collect the ambient light intensity. In one embodiment, the processor 1101 can control the display brightness of the display screen 1105 according to the ambient light intensity collected by the optical sensor 1115. Specifically, when the ambient light intensity is high, the display brightness of the display screen 1105 is increased, and when the ambient light intensity is low, the display brightness of the display screen 1105 is decreased. In another embodiment, the processor 1101 can also dynamically adjust the shooting parameters of the camera assembly 1106 according to the ambient light intensity collected by the optical sensor 1115.

[0151] The proximity sensor 1116, also called a distance sensor, is usually arranged on the front panel of the terminal 1100. The proximity sensor 1116 is used to collect the distance between the user and the front of the terminal 1100. In one embodiment, when the proximity sensor 1116 detects that the distance between the user and the front of the terminal 1100 gradually decreases, the display screen 1105 is switched from the bright screen state to the screen-off state under the control of the processor 1101; when the proximity sensor 1116 detects that the distance between the user and the front of the terminal 1100 gradually increases, the display screen 1105 is switched from the screen-off state to the bright screen state under the control of the processor 1101.

[0152] Those skilled in the art can understand that the structure shown in the figure does not constitute a limitation on the terminal 1100, and can include more or fewer components than the figure, or combine certain components, or adopt a different component arrangement. Figure 11

[0153] Figure 12 FIG. 12 is a structural schematic diagram of a server according to an embodiment of the present application. The server 1200 can have a large difference due to different configurations or performances, and can include one or more processors (Central Processing Units, CPUs) 1201 and one or more memories 1202, wherein the memory 1202 stores at least one computer program, the at least one computer program is loaded and executed by the processor 1201 to implement the text processing method provided by each method embodiment. Of course, the server can also have a wired or wireless network interface, a keyboard, and an input and output interface, etc., so as to perform input and output, and the server can also include other components for realizing the functions of the device, which are not described here.

[0154] The computer readable storage medium stores at least one computer program, and the at least one computer program is loaded and executed by the processor of the computer device to implement the operations performed by the computer device in the method of the above embodiments. For example, the computer readable storage medium can be a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a compact disc read-only memory (Compact Disc Read-Only Memory, CD-ROM), a magnetic tape, a floppy disk, and an optical data storage device, etc.

[0155] ​In some embodiments, the computer program related to the embodiments of the present application can be deployed on one computer device to execute, or on multiple computer devices located in one place to execute, or on multiple computer devices distributed in multiple places and interconnected through a communication network to execute. The multiple computer devices distributed in multiple places and interconnected through a communication network can constitute a blockchain system.

[0156] The embodiments of the present application further provide a computer program product, which comprises 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 the processor executes the computer program code to enable the computer device to perform the text processing method provided in the various optional implementation manners described above.

[0157] It can be understood by those skilled in the art that all or part of the steps of the above-mentioned embodiments can be completed by hardware, or by program instructing relevant hardware to complete, and the program can be stored in a computer readable storage medium. The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disk, etc.

[0158] The above only describes optional embodiments of the present application and is not intended to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A text processing method characterized by, The method comprises: obtaining a target subgraph from a knowledge graph based on a plurality of words in an input text, the target subgraph comprising a plurality of nodes corresponding to the plurality of words and a plurality of edges representing the association relationship between the plurality of nodes; encoding the input text to obtain text encoding features of the input text; adding the text encoding features as a text node to the target subgraph and adding edges in the target subgraph based on the correspondence between the plurality of words and the plurality of nodes; determining text semantic information of the input text based on entity relationship features of a plurality of nodes in the target subgraph and the text encoding features, the entity relationship features being used to represent node features of corresponding nodes, node features of neighbor nodes of the corresponding nodes in the target subgraph, and relationship features between the corresponding nodes and the neighbor nodes in the target subgraph.

2. The method of claim 1, wherein, The method further comprises: obtaining text entity relationship features corresponding to the text node from the entity relationship features of the plurality of nodes in the target subgraph; pooling the entity relationship features of the plurality of nodes to obtain subgraph features of the target subgraph, the subgraph features being used to represent the entity relationship features of the plurality of nodes; concatenating the subgraph features, the text entity relationship features, and the text encoding features to obtain the text semantic information of the input text.

3. The method according to claim 1 or 2, characterized in that, The method further comprises: determining at least one neighbor node of any node in the target subgraph; determining at least one neighbor relationship feature corresponding to the at least one neighbor node, the neighbor relationship feature being used to indicate relationship features between the corresponding neighbor node and the node and node features of the corresponding neighbor node, the relationship features being used to indicate the association relationship between the nodes; aggregating the at least one neighbor relationship feature into the node features of the node to obtain the entity relationship features of the node.

4. The method of claim 3, wherein, The method further comprises: for any neighbor node in the at least one neighbor node, obtaining relationship features between the neighbor node and the node; concatenating the node features of the neighbor node and the relationship features to obtain the neighbor relationship feature corresponding to the neighbor node.

5. The method of claim 3, wherein, The method further comprises: extracting features from a plurality of edges in the target subgraph to obtain a plurality of relationship features, the plurality of relationship features corresponding one-to-one to the plurality of edges.

6. The method of claim 3, wherein, The method further comprises: obtaining a first relationship matrix of the target subgraph, the first relationship matrix being used to represent the association relationship between the nodes in the target subgraph; Based on the first relationship matrix, the second relationship matrix and the third relationship matrix, the at least one neighbor relationship feature and the node feature of the node are aggregated to obtain an entity relationship feature corresponding to the node, the second relationship matrix is a self-loop of the first relationship matrix, and the third relationship matrix is a regularization term of the first relationship matrix.

7. A text processing apparatus characterized by comprising: The apparatus comprises: A subgraph obtaining module is configured to obtain a target subgraph from a knowledge graph based on a plurality of words in an input text, the target subgraph comprising a plurality of nodes corresponding to the plurality of words and a plurality of edges representing the association relationship between the plurality of nodes; An encoding module is configured to encode the input text to obtain text encoding features of the input text; A subgraph updating module is configured to add the text encoding features as text nodes to the target subgraph and add edges in the target subgraph based on the correspondence between the plurality of words and the plurality of nodes; An information determining module is configured to determine text semantic information of the input text based on the entity relationship features of the plurality of nodes in the target subgraph and the text encoding features, the entity relationship features being used to represent the node features of the corresponding nodes, the node features of the neighbor nodes of the corresponding nodes in the target subgraph, and the relationship features between the corresponding nodes and the neighbor nodes in the target subgraph.

8. A computer device, comprising: The computer device comprises a processor and a memory, the memory being configured to store at least one piece of computer program, the at least one piece of computer program being loaded and executed by the processor to execute the text processing method of any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, The computer readable storage medium is configured to store at least one piece of computer program, the at least one piece of computer program being configured to execute the text processing method of any one of claims 1 to 6.

10. A computer program product, characterised in that, The computer program product comprises computer program code stored in a computer readable storage medium, the processor of the computer device reading the computer program code from the computer readable storage medium, and the processor executing the computer program code to make the computer device execute the text processing method of any one of claims 1 to 6.

Citation Information

Patent Citations

  • Text processing method and device, model training method and device, computer equipment and storage medium

    CN112084331A

  • End-to-end multi-modal question and answering method and system based on multi-interaction attention

    CN113297370A