Node adding method, device, equipment and storage medium based on directory tree

By identifying candidate positions in the directory tree and using explanatory text to determine matching information, the problem that existing technologies can only add leaf nodes is solved, thus achieving full expansion and enrichment of the directory tree.

CN114281919BActive Publication Date: 2025-10-28TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111095271.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-17
Publication Date
2025-10-28
Estimated Expiration
2041-09-17

AI Technical Summary

Technical Problem

In existing technologies, graph convolution-based methods can only add leaf nodes to the directory tree, but cannot add non-leaf nodes, resulting in insufficient expansion of the directory tree.

Method used

By determining candidate positions in the directory tree, the definition text of the target word is obtained. Based on the definition text, the definition text of the corresponding node, and the definition text of the child node, the matching information between the target word and the candidate position is determined. In response to the matching information meeting the conditions, the node corresponding to the target word is added to the candidate position.

Benefits of technology

This allows for the addition of both leaf nodes and non-leaf nodes to the directory tree, improving the expansion methods and information richness of the directory tree and expanding its applicability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114281919B_ABST
    Figure CN114281919B_ABST
Patent Text Reader

Abstract

This application discloses a method, apparatus, device, and storage medium for adding nodes based on a directory tree. The technical solutions provided in this application can be applied to fields such as artificial intelligence and cloud technology. Through the technical solutions provided in this application, when adding nodes to a directory tree, any position in the directory tree can be selected as a candidate position, which is also the possible location where a node may be added. During the node addition process, the definition text of the target word is obtained, and matching information is determined based on the definition text corresponding to each node. Finally, nodes are added to candidate positions based on the matching information. This allows not only leaf nodes to be added to the directory tree but also non-leaf nodes, making the expansion methods of the directory tree more diverse, increasing the richness of information in the directory tree, and expanding the applicability of the directory tree.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, device, and storage medium for adding nodes based on a directory tree. Background Technology

[0002] A directory tree is a hierarchical knowledge graph that represents hypernym / hypernym relationships. In a directory tree, each node corresponds to a word (e.g., "fruit," "apple," etc.). For each edge in the directory tree, if there exists an edge from A to B, then node A is the parent node of node B, indicating that A has a hypernym relationship with B. If A is "fruit" and B is "apple," it means "apple is a type of fruit" or "fruits include apples," etc. Over time, the child nodes under each parent node may need to be expanded. For example, if the directory tree is a medical directory, for a disease represented by a node in the medical directory, new treatments may emerge with advancements in medicine. The node corresponding to this new treatment needs to be added as a new child node under that node.

[0003] In related technologies, a directory tree is often viewed as a graph network, and graph convolution is used to add nodes to the directory tree to expand it. However, graph convolution can only add leaf nodes to the directory tree, not non-leaf nodes, and cannot fully expand the directory tree. Leaf nodes are nodes without children. Summary of the Invention

[0004] This application provides a method, apparatus, device, and storage medium for adding nodes based on a directory tree, which can fully expand the directory tree. The technical solution is as follows:

[0005] On the one hand, a method for adding nodes based on a directory tree is provided, the method including:

[0006] Determine candidate positions in a directory tree, the directory tree including multiple nodes, each node corresponding to multiple words, the candidate position being the position between a first node and a second node in the directory tree, the first word corresponding to the first node being the hypernym of the second word corresponding to the second node;

[0007] Obtain the definition text of the target word, which is used to explain the target word;

[0008] Based on the definition text of the target word, the definition text of the first word, the definition text of the second word, and the definition texts corresponding to multiple child nodes of the first node, the matching information between the target word and the candidate position is determined, and the matching information is used to indicate the degree of matching between the target word and the candidate position.

[0009] In response to the matching information meeting the target conditions, a node corresponding to the target word is added at the candidate position.

[0010] On the one hand, a node-adding device based on a directory tree is provided, the device comprising:

[0011] A candidate position determination module is used to determine candidate positions in a directory tree, the directory tree including multiple nodes, each node corresponding to multiple words, the candidate position being the position between a first node and a second node in the directory tree, and the first word corresponding to the first node being the hypernym of the second word corresponding to the second node;

[0012] The definition text acquisition module is used to acquire the definition text of the target word, and the definition text of the target word is used to explain the target word;

[0013] The matching information determination module is used to determine the matching information between the target word and the candidate position based on the definition text of the target word, the definition text of the first word, the definition text of the second word, and the definition text corresponding to multiple child nodes of the first node. The matching information is used to indicate the degree of matching between the target word and the candidate position.

[0014] The node adding module is used to add a node corresponding to the target word at the candidate position in response to the matching information meeting the target conditions.

[0015] In one possible implementation, the definition text acquisition module is used to query the definition text database using the target word to obtain the definition text of the target word. The definition text database stores multiple words and their respective definition texts.

[0016] In one possible implementation, the semantic text acquisition module is used to query the semantic text database using the target word. If multiple senses corresponding to the target word exist in the semantic text database, the module acquires the semantic similarity between the target word and the semantic texts corresponding to the multiple nodes. The module determines the semantic text of the first sense as the semantic text of the target word. The first sense is a sense whose semantic similarity with the semantic text corresponding to the reference node meets a first similarity condition. The reference node is a node whose corresponding semantic text meets a second similarity condition with the target word.

[0017] In one possible implementation, the matching information determination module is used to input the definition text of the target word, the definition text of the first word, the definition text of the second word, and the definition text corresponding to multiple child nodes of the first node into the matching information determination model, and output the matching information determination model to output the matching information between the target word and the candidate position.

[0018] In one possible implementation, the matching information determination module is configured to perform the following steps using the matching information determination model:

[0019] Based on the definition text of the target word and the definition text of the first word, a first relation feature is obtained, which is used to indicate whether the first word is a hypernym of the target word.

[0020] Based on the definition text of the target word and the definition text of the second word, a second relation feature is obtained, which is used to indicate whether the target word is a hypernym of the second word;

[0021] Based on the definition text of the target word and the definition texts corresponding to the plurality of child nodes, a first child node and a second child node are determined from the plurality of child nodes. The first child node is the child node with the highest semantic similarity between the corresponding definition text and the target word, and the second child node is the child node with the lowest semantic similarity between the corresponding definition text and the target word.

[0022] Based on the first relation feature, the second relation feature, the definition text of the target word, the definition text corresponding to the first child node, and the definition text corresponding to the second child node, the matching information between the target word and the candidate position is output.

[0023] In one possible implementation, the matching information determination module is configured to encode the definition text of the target word based on an attention mechanism to obtain a definition matrix of the target word, wherein the definition matrix of the target word is used to represent the definition text of the target word; encode the definition text of the first word based on an attention mechanism to obtain a definition matrix of the first word, wherein the definition matrix of the first word is used to represent the definition text of the first word; and obtain the first relation feature based on the definition matrix of the target word and the definition matrix of the first word.

[0024] In one possible implementation, the matching information determination module is used to encode the definition matrix of the target word using multiple encoding vectors to obtain the representation matrix of the target word, wherein the multiple encoding vectors are used to adjust the dimension of the matrix; to encode the definition matrix of the first word using the multiple encoding vectors to obtain the representation matrix of the first word, wherein the representation matrix of the target word has the same dimension as the representation matrix of the first word; and to encode the representation matrix of the target word and the representation matrix of the first word based on an attention mechanism to obtain the first relation feature.

[0025] In one possible implementation, the matching information determination module is configured to: obtain a third relation feature based on the definition text of the target word and the definition text corresponding to the first child node, wherein the third relation feature indicates whether the target word is a word of the same kind as the word corresponding to the first child node; obtain a fourth relation feature based on the definition text of the target word and the definition text corresponding to the second child node, wherein the fourth relation feature indicates whether the target word is a word of the same kind as the word corresponding to the second child node; and output matching information between the target word and the candidate position based on the first relation feature, the second relation feature, the third relation feature, and the fourth relation feature.

[0026] In one possible implementation, the matching information determination module is configured to encode the definition text of the target word based on an attention mechanism to obtain a definition matrix of the target word, wherein the definition matrix of the target word is used to represent the definition text of the target word; encode the definition text corresponding to the first child node based on an attention mechanism to obtain a definition matrix of the first child word, wherein the definition matrix of the first child word is used to represent the definition text corresponding to the first child node; and obtain the third relation feature based on the definition matrix of the target word and the definition matrix of the first child word.

[0027] In one possible implementation, the matching information determination module is used to encode the semantic matrix of the target word using multiple encoding vectors to obtain the representation matrix of the target word, wherein the multiple encoding vectors are used to adjust the dimension of the matrix; to encode the semantic matrix of the first sub-word using the multiple encoding vectors to obtain the representation matrix of the first sub-word, wherein the representation matrix of the target word and the representation matrix of the first sub-word have the same dimension; and to encode the representation matrix of the target word and the representation matrix of the first sub-word based on an attention mechanism to obtain the third relation feature.

[0028] In one possible implementation, the matching information determination module is used to concatenate the first relation feature, the second relation feature, the third relation feature, and the fourth relation feature into a feature matrix; perform full connection and normalization on the feature matrix, and output the matching information between the target word and the candidate position.

[0029] In one possible implementation, the device further includes:

[0030] An adjustment module is used to obtain sample nodes and multiple sample candidate positions from the directory tree, wherein the sample nodes are nodes in the directory tree other than the root node; input the sample nodes and multiple sample candidate positions into the matching information determination model, and output the predicted matching information of the sample nodes and multiple sample candidate positions from the matching information determination model; and adjust the model parameters of the matching information determination model based on the difference information between the predicted matching information and the target matching information, wherein the target matching information is the matching information between the sample node and the actual position of the sample node in the directory tree.

[0031] In one possible implementation, the semantic text acquisition module is further configured to, for the first child node of the first node, use the first sub-word corresponding to the first child node to query the semantic text database; if multiple senses corresponding to the first sub-word exist in the semantic text database, obtain the semantic similarity between the multiple senses and the semantic text of the first word; determine the semantic text of the second sense as the semantic text of the target word, wherein the second sense is a sense whose semantic similarity with the semantic text of the first word meets the third similarity condition.

[0032] On one hand, a computer device is provided, the computer device including one or more processors and one or more memories, the one or more memories storing at least one computer program, the computer program being loaded and executed by the one or more processors to implement the directory tree-based node addition method.

[0033] On the one hand, a computer-readable storage medium is provided, wherein at least one computer program is stored in the computer-readable storage medium, the computer program being loaded and executed by a processor to implement the directory tree-based node addition method.

[0034] On the one hand, a computer program product or computer program is provided, which includes program code stored in a computer-readable storage medium. A processor of a computer device reads the program code from the computer-readable storage medium and executes the program code, causing the computer device to perform the above-described node addition method based on a directory tree.

[0035] The technical solution provided in this application allows for the selection of any position within a directory tree as a candidate position when adding nodes. These candidate positions represent potential locations where nodes may be added. During the node addition process, the definition text of the target term is obtained. Matching information is determined based on the definition text corresponding to each node. Finally, nodes are added to candidate positions based on this matching information. This approach enables the addition of both leaf and non-leaf nodes to the directory tree, resulting in more diverse expansion methods, increased information richness, and expanded applicability. Attached Figure Description

[0036] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0037] Figure 1 This is a schematic diagram of the implementation environment of a node addition method based on a directory tree provided in an embodiment of this application;

[0038] Figure 2 This is a flowchart of a node addition method based on a directory tree provided in an embodiment of this application;

[0039] Figure 3 This is a flowchart of a node addition method based on a directory tree provided in an embodiment of this application;

[0040] Figure 4 This is a schematic diagram of a directory tree structure provided in an embodiment of this application;

[0041] Figure 5 This is a logical block diagram of obtaining explanatory text provided in an embodiment of this application;

[0042] Figure 6This is a schematic diagram of the structure of a matching information determination model provided in an embodiment of this application;

[0043] Figure 7 This is a flowchart of a training method for a matching information determination model provided in an embodiment of this application;

[0044] Figure 8 This is a schematic diagram of a node adding device based on a directory tree provided in an embodiment of this application;

[0045] Figure 9 This is a schematic diagram of the structure of a terminal provided in an embodiment of this application;

[0046] Figure 10 This is a schematic diagram of the structure of a server provided in an embodiment of this application. Detailed Implementation

[0047] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0048] In this application, the terms "first," "second," etc., are used to distinguish identical or similar items with essentially the same function. It should be understood that there is no logical or temporal dependency between "first," "second," and "nth," nor are there any restrictions on quantity or execution order.

[0049] In this application, the term "at least one" means one or more, and "multiple" means two or more. For example, multiple reference face images means two or more reference face images.

[0050] Artificial intelligence (AI) is the theory, methods, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.

[0051] Semantic features: Features used to represent the semantics expressed by text. Different texts can correspond to the same semantic features; for example, the text "How's the weather today?" and the text "How's the weather today?" can correspond to the same semantic feature. Computer devices can map characters in text into character vectors, and combine and operate on these character vectors according to the relationships between characters to obtain the semantic features of the text. For example, computer devices can use a bidirectional encoder representation from transformers (BERT).

[0052] Normalization: Mapping sequences of values ​​with different ranges to the interval (0, 1) to facilitate data processing. In some cases, normalized values ​​can be directly expressed as probabilities.

[0053] Attention weights represent the importance of a piece of data during training or prediction. Importance indicates the magnitude of the influence of input data on output data. Data with high importance corresponds to higher attention weights, while data with low importance corresponds to lower attention weights. The importance of data varies in different scenarios, and training the model to assign attention weights is essentially the process of determining data importance.

[0054] Hypernym: A term referring to a subject with a broader conceptual scope. For example, "fruit" is a hypernym of "apple," and "plant" is a hypernym of "flower." Conversely, hyponym: A term referring to a subject with a narrower conceptual scope.

[0055] Synonyms: A group of words that are related in some way in terms of pronunciation, semantics, structure, origin, or word-forming materials. For example, synonyms for colors include "red," "yellow," "orange," "cyan," and "green," while synonyms for writing systems include "pictographs," "ideographs," and "phonetic writing systems."

[0056] Figure 1 This is a schematic diagram illustrating the implementation environment of a node-adding method based on a directory tree provided in this application embodiment. See also... Figure 1 The implementation environment may include terminal 110 and server 140.

[0057] Terminal 110 is connected to server 140 via a wireless or wired network. Optionally, terminal 110 may be a smartphone, tablet, laptop, desktop computer, etc., but is not limited to these. Terminal 110 has an application installed and running that supports adding nodes to a directory tree.

[0058] Server 140 is a standalone physical server, 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, Content Delivery Network (CDN), and big data and artificial intelligence platforms. Server 140 provides background services for applications running on terminal 110.

[0059] Those skilled in the art will understand that the number of terminals described above can be more or less. For example, there may be only one terminal, or there may be dozens or hundreds of terminals, or even more, in which case other terminals may also be included in the above implementation environment. This application does not limit the number of terminals or the type of device in its embodiments.

[0060] After introducing the implementation environment of the embodiments of this application, the application scenarios of the node addition method based on the directory tree provided by the embodiments of this application will be described below. In the following description, the terminal is the terminal 110 in the above implementation environment, and the server is the server 140 in the above implementation environment.

[0061] The node addition method based on the directory tree provided in this application can be applied to scenarios of adding nodes to various directory trees, such as adding nodes to a medical directory tree, adding nodes to a news directory tree, adding nodes to a product directory tree, or adding nodes to a science directory tree.

[0062] In the scenario of adding nodes to a medical directory tree, the terms corresponding to these nodes are medical-related terms, such as disease names, drug names, treatment methods, or treatment equipment names. In a medical directory tree, the disease name is often the root node, and the child nodes under the root node indicate drug names or treatment methods related to the disease name corresponding to the root node. The medical directory tree stores different terms through this hierarchical relationship, facilitating the quick provision of relevant drug and treatment information when searching for a specific disease. As medical technology advances, drugs, treatment methods, and treatment equipment for diseases constantly emerge, necessitating frequent updates to the medical directory tree. Updating the medical directory tree involves adding new nodes. For example, a medical directory tree might have a root node A, whose corresponding term is "disease X". Root node A has a child node B, whose corresponding term is "medical device E" used to treat "disease X". With the development of medical technology, the method of using "medical device E" to treat "disease X" is called "treatment method M". Therefore, it's necessary to add the node corresponding to "treatment method M" to the medical directory tree so that related content can be found during subsequent searches. In this case, the terminal uploads the term "treatment method M" to the server, and the server adds the node corresponding to the term "treatment method M" to the medical directory tree using the directory tree-based node adding method provided in this application embodiment. When adding a node to the medical directory tree, the server can determine multiple candidate positions within the medical directory tree; these candidate positions are the locations where the node corresponding to the term "treatment method M" might be added. For example, a candidate position might be located between the first and second nodes in a medical directory tree. The first word corresponding to the first node is the superordinate word of the word corresponding to the second node. Continuing with the example above, if the first word is "disease X", the first node is the node corresponding to the first word "disease X"; if the second word is "medical equipment E", the second node is the node corresponding to the second word "medical equipment E". The server retrieves the definition text of the word "treatment method M". Based on the definition text of the word "treatment method M", the definition text of the first word "disease X", the definition text of the second word "medical equipment E", and the definition texts corresponding to multiple child nodes of the first node, it determines the matching information between the word "treatment method M" and the candidate position.If the matching information indicates a high degree of match between the term "treatment method M" and the candidate position, the server can add a node corresponding to the term "treatment method M" at that candidate position. This process involves adding a new node "N" corresponding to "treatment method M" in the medical directory tree. A directed edge is added between the first node and "node N," indicating that the first term corresponding to the first node is a hypernym of the term "treatment method M" corresponding to "node N." Similarly, a directed edge is added between the second node and "node N," indicating that the term "treatment method M" corresponding to "node N" is a hypernym of the term corresponding to the second node. After updating the medical directory tree using this method, the term "treatment method M" can be found in the medical directory tree. Similarly, searching for "disease X" will also find "treatment method M," thus completing the update of the medical directory tree.

[0063] In the scenario of adding nodes to a news directory tree, the words corresponding to those nodes are also words related to the news type. In a news directory tree, the news type is often the root node, and the child nodes under the root node indicate the subtypes of the news type corresponding to the root node. The news directory tree stores different words through this hierarchical relationship, making it easy to quickly find the corresponding news type when searching for a specific news report, or to retrieve news reports by type. Over time, news types become increasingly subdivided, and correspondingly, the news directory tree often needs to be updated. Updating the news directory tree is essentially adding new nodes. For example, in a news directory tree, there is a node C, whose corresponding word is "football." Node C has a child node D, whose corresponding word is a team name "Team T." If "Team T" joins a newly established "League K," then the node corresponding to "League K" needs to be added to the news directory tree so that subsequent searches can find content related to "League K." In this scenario, the terminal uploads the term "League K" to the server. The server then adds a node corresponding to the term "League K" in the news directory tree using the node-adding method based on the directory tree provided in this application embodiment. When adding a node in the news directory tree, the server can determine multiple candidate positions within the tree. These candidate positions are locations where a node corresponding to the term "League K" might be added. For example, a candidate position might be between the first and second nodes in the news directory tree. The first term corresponding to the first node is the superordinate term of the term corresponding to the second node. Continuing with the example above, if the first term is "football," then the first node is the node corresponding to the first term "football"; if the second term is "team T," then the second node is the node corresponding to the second term "team T." The server obtains the definition text of the term "League K" and, based on the definition text of "League K," the definition text of the first term "football," the definition text of the second term "team T," and the definition texts corresponding to multiple child nodes of the first node, determines the matching information between the term "League K" and the candidate position. If the matching information indicates a high degree of match between the term "League K" and the candidate position, the server can add a node corresponding to the term "League K" at that candidate position. This process involves adding a new node "N" corresponding to "League K" in the news directory tree. A directed edge is added between the first node and "Node N," indicating that the first term corresponding to the first node is a hypernym of the term "League K" corresponding to "Node N." Similarly, a directed edge is added between the second node and "Node N," indicating that the term "League K" corresponding to "Node N" is a hypernym of the term "League K" corresponding to the second node.After updating the news directory tree using the above method, the word "League K" can be found in the news directory tree. Of course, searching for "football" will also find "League K", thus completing the update of the news directory tree.

[0064] In the scenario of adding nodes to a product catalog tree, the words corresponding to those nodes are also words related to the product type. In a product catalog tree, the product type is often the root node, and the child nodes under the root node indicate the subtypes under the corresponding product type. The product catalog tree stores different words through this hierarchical relationship, making it easy to quickly find the corresponding product type when searching for a specific product, or to retrieve products by type. Over time, product types become increasingly subdivided, and correspondingly, the product catalog tree often needs to be updated. Updating the product catalog tree is essentially adding new nodes. For example, in the product catalog tree, there is a node E, whose corresponding word is "beverage." Node E has a child node F, whose corresponding word is the beverage name "latte." If the word "soft drink" is popular, and "latte" belongs to the "soft drink" category, then the node corresponding to "soft drink" needs to be added to the product catalog tree so that subsequent searches can find content related to "soft drink." In this scenario, the terminal uploads the term "soft drink" to the server. The server then adds a node corresponding to the term "soft drink" in the product catalog tree using the node-adding method based on the directory tree provided in this application embodiment. When adding a node in the product catalog tree, the server can determine multiple candidate positions within the catalog tree. These candidate positions are locations where a node corresponding to the term "soft drink" might be added. For example, a candidate position might be between the first node and the second node in the product catalog tree. The first term corresponding to the first node is the superordinate word of the term corresponding to the second node. Continuing with the example above, if the first term is "beverage," then the first node is the node corresponding to the first term "beverage"; if the second term is "latte," then the second node is the node corresponding to the second term "latte." The server obtains the definition text of the term "soft drink" and, based on the definition text of the term "soft drink," the definition text of the first term "beverage," the definition text of the second term "latte," and the definition texts corresponding to multiple child nodes of the first node, determines the matching information between the term "soft drink" and the candidate position. If the matching information indicates a high degree of match between the word "soft drink" and the candidate position, the server can add a node corresponding to the word "soft drink" at that candidate position. This process involves adding a new node "N" for "soft drink" in the product catalog tree. A directed edge is added between the first node and "node N," indicating that the first word corresponding to the first node is a hypernym of the word "soft drink" corresponding to "node N." Similarly, a directed edge is added between the second node and "node N," indicating that the word "soft drink" corresponding to "node N" is a hypernym of the word "soft drink" corresponding to the second node.After updating the product catalog tree using the above method, the term "soft drink" can be found in the product catalog tree. Of course, searching for "beverage" will also find "soft drink," thus completing the update of the product catalog tree.

[0065] It should be noted that in the above description, the node addition method based on the directory tree provided in the embodiments of this application is used as an example in the scenarios of adding nodes to a medical directory tree, adding nodes to a news directory tree, and adding nodes to a product directory tree. In other possible implementations, the node addition method based on the directory tree provided in the embodiments of this application can also be applied to other types of directory trees, and the embodiments of this application do not limit this.

[0066] In this embodiment, as described in the application scenario above, the terminal can upload the vocabulary to the server, and the server can add the corresponding node to the directory tree. Alternatively, the terminal can directly add the corresponding node to the directory tree, or the server can obtain the vocabulary and add the corresponding node to the directory tree based on the vocabulary. This embodiment does not limit the specific implementation of the application.

[0067] After introducing the implementation environment and application scenarios of the embodiments of this application, the node addition method based on the directory tree provided by the embodiments of this application will be described below.

[0068] Figure 2 This is a flowchart of a node-adding method based on a directory tree provided in an embodiment of this application. Taking the terminal as the execution subject as an example, see [link to flowchart]. Figure 2 The methods include:

[0069] 201. The terminal determines a candidate position in the directory tree, which includes multiple nodes, each corresponding to a multiple word. The candidate position is the position between the first node and the second node in the directory tree, and the first word corresponding to the first node is the superordinate word of the second word corresponding to the second node.

[0070] In this context, the candidate position refers to the location in the directory tree where a node may be added. The first node and the second node represent the candidate positions in the directory tree. Since the first word corresponding to the first node is the hypernym of the second word corresponding to the second node, the first node is also the parent node of the second node, or in other words, the first node and the second node have a parent-child relationship. In some embodiments, when the terminal adds a node to the directory tree, it can obtain multiple candidate positions. The terminal's processing method for multiple candidate positions belongs to the same inventive concept. In the following description, the terminal's processing based on a single candidate position will be used as an example.

[0071] 202. The terminal obtains the definition text of the target word, which is used to explain the target word.

[0072] The explanatory text, or glossary text, is used to explain the meaning of words. For some obscure words, the explanatory text can express the obscure word through a combination of simple words. For example, the explanatory text for the technical term "Fourier transform" is "a method of transforming a function that satisfies certain conditions into a linear combination of trigonometric functions (sine and / or cosine functions) or their integrals." In other words, it breaks down an obscure word into a combination of several simple words, making it easier to understand.

[0073] 203. The terminal determines the matching information between the target word and the candidate position based on the definition text of the target word, the definition text of the first word, the definition text of the second word, and the definition texts corresponding to the multiple child nodes of the first node. The matching information is used to indicate the degree of matching between the target word and the candidate position.

[0074] In this context, for the multiple child nodes of the first node, the first word corresponding to the first node is also the superordinate word of the child words corresponding to the multiple child nodes.

[0075] 204. In response to the matching information meeting the target conditions, the terminal adds the node corresponding to the target word at the candidate position.

[0076] The technical solution provided in this application allows for the selection of any position within a directory tree as a candidate position when adding nodes. These candidate positions represent potential locations where nodes may be added. During the node addition process, the definition text of the target term is obtained. Matching information is determined based on the definition text corresponding to each node. Finally, nodes are added to candidate positions based on this matching information. This approach enables the addition of both leaf and non-leaf nodes to the directory tree, resulting in more diverse expansion methods, increased information richness, and expanded applicability.

[0077] Steps 201-204 above are a simplified description of the node addition method based on a directory tree provided in this application embodiment. The following will provide a more detailed description of the node addition method based on a directory tree provided in this application embodiment, using some examples. It should be noted that when the terminal adds a node to the directory tree using the node addition method based on a directory tree provided in this application embodiment, multiple candidate positions are determined. Subsequently, matching information between multiple candidate positions and the target word is obtained, and the position of the node corresponding to the target word in the directory tree is determined based on the matching information between multiple candidate positions and the target word. Since the method by which the terminal determines the matching information between multiple candidate positions and the target word belongs to the same inventive concept, the following description will use the example of the terminal determining the matching information between one candidate position and the target word. Again, taking the terminal as the executing entity as an example, see... Figure 3 The methods include:

[0078] 301. The terminal determines a candidate position in a directory tree, which includes multiple nodes, each corresponding to a multiple word. The candidate position is the position between the first node and the second node in the directory tree, and the first word corresponding to the first node is the superordinate word of the second word corresponding to the second node.

[0079] Figure 4 A schematic diagram of a directory tree 400 is shown. (See attached diagram) Figure 4 The directory tree 400 includes multiple nodes, each corresponding to a word. These nodes are connected by directed edges, forming a parent-child relationship between the two nodes connected by the directed edge. The direction of the directed edge indicates the parent and child nodes of the two nodes. A parent-child relationship means that the words corresponding to the two nodes have a hierarchical relationship. A parent node may correspond to multiple child nodes, meaning a word may have multiple hyponyms. For example, the word "color" corresponds to hyponyms such as "red," "yellow," "blue," "green," and "white." If a node corresponding to the word "color" exists in the directory tree, then the nodes corresponding to "red," "yellow," "blue," "green," and "white" are also child nodes of the node corresponding to the word "color." In some embodiments, the directed edge points from the parent node to the child node. For example, node 401 in the directory tree 400 is a parent node, and node 402 is a child node of node 401. Nodes 401 and 402 are connected by a directed edge pointing from node 401 to node 402. Directed edges can be used to quickly identify nodes that form parent-child relationships in a directory tree. In some embodiments, the vocabulary corresponding to a node is also referred to as a "concept," in which case each node is used to represent a "concept."

[0080] For example, for a directory tree τ0 = (N0, ε0), a candidate position can be represented by (p, c), where N0 is the number of nodes in the directory tree, ε0 is the directed edge between nodes, o is any non-leaf node in the directory tree, which is the first node mentioned above, and c is a descendant node of p in the directory tree, such as a child node of p, which is also the second node mentioned above.

[0081] Furthermore, referring to the previous description of the application scenarios of the embodiments of this application, the directory tree is of different types in different scenarios. For example, in the scenario of adding nodes to a medical directory tree, the directory tree is also a medical directory tree; in the scenario of adding nodes to a news directory tree, the directory tree is also a news directory tree; and in the scenario of adding nodes to a product directory tree, the directory tree is also a product directory tree. In the following description, a medical directory tree will be used as an example.

[0082] In one possible implementation, the terminal determines a non-leaf node in the directory tree, which is also the first node. The terminal then determines a descendant node of the first node in the directory tree, which is also the second node. The candidate position is the position between the first and second nodes. Here, a non-leaf node is a node in the directory tree that has child nodes. For example, in this medical directory tree, there are three non-leaf nodes: "Disease X", "Disease Y", and "Disease Z". The "" represents the word corresponding to the node, or the concept represented by the node. The terminal determines the non-leaf node "Disease X" as the first node, if this non-leaf node "Disease X" includes three child nodes: "Medical Device E", "Drug W", and "Treatment Method M". If the terminal determines the child node "Drug W" as the second node, then a candidate position is the position between the first node "Disease X" and the second node "Drug W". The word corresponding to the node added at this candidate position is a hyponym of "Disease X" and a hypernym of "Drug W".

[0083] For example, when adding a node to a directory tree, the terminal traverses the directory tree, retrieves multiple candidate locations, and records these candidate locations in a candidate location list. The terminal then retrieves the candidate location from this list. In some embodiments, each candidate location stored in the candidate location list corresponds to a number, and the terminal retrieves the candidate location from the list in ascending order of these numbers.

[0084] 302. The terminal obtains the definition text of the target word, which is used to explain the target word.

[0085] In one possible implementation, the terminal queries a definition text database using the target word to obtain the definition text of the target word. This definition text database stores multiple words and their corresponding definition texts. In some embodiments, the definition text database is a real-time updated database, such as an encyclopedia database. This real-time updated database ensures that the latest word or its latest definition text is retrieved. Of course, the definition text database can be other types of databases besides encyclopedia databases; this application embodiment does not limit this. When querying the definition text database, the terminal simply inputs the word it wants to query. In some embodiments, this method of obtaining the definition text of a target word is called a dynamic programming algorithm. By using a real-time updated encyclopedia to obtain the definition text, the latest appearing words can be identified more promptly.

[0086] For example, the terminal uses the target word to query a definition text database and obtains a page corresponding to the target word. This page includes descriptive text for the target word, which consists of multiple sentences related to the target word. The terminal then extracts the first sentence from the descriptive text of the target word as the definition text for that target word.

[0087] If the definition text database is an encyclopedia database, and the target term is "treatment method M", the terminal searches the encyclopedia database using the target term "treatment method M" to obtain the encyclopedia page corresponding to "treatment method M". This encyclopedia page includes descriptive text related to "treatment method M". In some embodiments, this descriptive text describes the definition, origin, and details of "treatment method M". The terminal extracts the first sentence from the descriptive text displayed on the encyclopedia page as the definition text for "treatment method M".

[0088] In some embodiments, if the target word is polysemous, it may correspond to multiple senses in the semantic text database. A sense is the description of each different conceptual meaning under the same word name, or, in other words, the sense best represents the attributes and characteristics of the same word across different domains. For example, the word "apple" has multiple senses, including fruit tree, fruit, company, and movie. For the same target word, the descriptive texts under different senses are also different, and correspondingly, the semantic texts obtained from the descriptive texts under different senses are also different. The terminal selects the sense corresponding to the target word in the following way: The terminal queries the semantic text database using the target word. If multiple senses corresponding to the target word exist in the semantic text database, the semantic similarity between the target word and the semantic texts corresponding to these multiple senses is obtained. The definition text of the first sense is determined as the definition text of the target word. The first sense is the sense whose semantic similarity with the definition text corresponding to the reference node meets the first similarity condition. The reference node is the node whose corresponding definition text meets the second similarity condition with the target word.

[0089] In this implementation, the corresponding words for different nodes in the directory tree all belong to the same domain. For example, in a medical directory tree, the words corresponding to different nodes all belong to the medical field. Since different definitions are used to represent the target word in different domains, the terminal can compare the definition text of the target word with the definition text of multiple nodes in the directory tree, select nodes from the directory tree whose definition text and the target word have a semantic similarity that meets the second similarity condition, and then compare the definition text of the node with multiple definitions of the target word to select the first definition whose semantic similarity meets the first similarity condition. The terminal obtains the definition text of the first definition as the definition text of the target word, which improves the accuracy of definition selection.

[0090] The semantic similarity meeting the first similarity condition means that the semantic similarity is greater than or equal to the first similarity threshold, or that the semantic similarity is the highest among multiple semantic similarities. The semantic similarity meeting the second similarity condition means that the semantic similarity is greater than or equal to the second similarity threshold, or that the semantic similarity is the highest among multiple semantic similarities. Both the first and second similarity thresholds are set by those skilled in the art according to actual circumstances. The first and second similarity thresholds can be the same or different, and this application embodiment does not limit this.

[0091] For example, the terminal inputs the target word into a semantic feature extraction model, which extracts semantic features from the target word to obtain its first semantic feature. The terminal then inputs the definition texts corresponding to multiple nodes into the same semantic feature extraction model, which extracts semantic features from each definition text to obtain the second semantic feature for each node. Based on the first semantic feature and the multiple second semantic features, the terminal obtains the semantic similarity between the target word and the definition texts corresponding to the multiple nodes, and identifies the nodes corresponding to the definition texts whose semantic similarity meets the second similarity condition as reference nodes. The terminal then inputs multiple senses corresponding to the target word into the same semantic feature extraction model, which extracts features from each sense to obtain the third semantic feature for each sense. Based on the second semantic feature of the reference node and the third semantic feature of each sense, the terminal obtains the semantic similarity between the definition text corresponding to the reference node and the multiple senses, and identifies the senses whose semantic similarity meets the first similarity condition as the first sense. The terminal then extracts the first sentence from the description text under the first sense as the description text for the target word.

[0092] The semantic feature extraction model can be BERT, SpaCy (a Python and CPython natural language text processing library), or other types of semantic feature extraction models. This application does not limit the specific model used. It should be noted that the BERT model here includes the basic BERT model and various variants of BERT, such as RoBERTa or ALBERT. In some embodiments, the semantic feature extraction model is a pre-trained model. The terminal can either train the semantic feature extraction model in advance or directly obtain a pre-trained semantic feature extraction model from the internet. This application does not limit the specific model used. The high-performance pre-trained language model BERT can significantly improve the accuracy of model judgments.

[0093] For example, the semantic feature extraction model is the BERT model. The terminal inputs the target word into the semantic feature extraction model, which encodes the target word using an attention mechanism to obtain a first semantic vector, which represents the first semantic feature of the target word. The terminal inputs the definition texts corresponding to multiple nodes into the semantic feature extraction model, which encodes the definition texts corresponding to multiple nodes separately using an attention mechanism to obtain a second semantic vector for each node, which represents the second semantic feature of each node. The terminal obtains the cosine similarity between the first semantic vector and multiple second semantic vectors, which represents the semantic similarity between the target word and the definition texts corresponding to multiple nodes. The terminal determines the node corresponding to the definition text with the highest semantic similarity to the target word as the reference node. The terminal inputs multiple senses corresponding to the target word into the semantic feature extraction model, which encodes each sense using an attention mechanism to obtain a third semantic vector for each sense, which represents the third semantic feature of each node. The terminal obtains the cosine similarity between the second semantic vector of the reference node and the third semantic vector of each sense item. This cosine similarity is used to represent the semantic similarity between the definition text corresponding to the reference node and multiple sense items. The terminal determines the sense item with the highest semantic similarity to the definition text corresponding to the reference node as the first sense item. The terminal obtains the first sentence in the description text under the first sense item as the description text of the target word.

[0094] It should be noted that the above description is based on the example of the terminal extracting semantic features from the definition text corresponding to the nodes in the directory tree in real time using a semantic feature extraction model. In other possible implementations, the terminal can extract semantic features from the definition text corresponding to each node in the directory tree in advance to obtain the second semantic features of each node. In this way, when determining the meaning of the target word, it is only necessary to extract the first semantic feature of the target word and the third semantic feature of each meaning of the target word, without having to extract the second semantic features of multiple nodes again, thereby improving the efficiency of determining the meaning of the target word.

[0095] In one possible implementation, before querying the definition text database using the target word, the terminal can use a word segmentation tool (such as jieba segmentation) to segment the target word, obtaining multiple sub-words containing different numbers of characters, with some overlap between them. The terminal then queries the definition text database using these sub-words. Upon finding the definition text corresponding to any sub-word, the terminal retrieves the definition text for that sub-word and scores it based on the number of characters it contains. This score is positively correlated with the number of characters in the word; that is, the fewer the characters, the lower the score, and vice versa. The terminal then identifies the definition text with the highest score as the definition text for the target word. Of course, if the terminal only obtains the definition text corresponding to a sub-word of the target word, then the definition text corresponding to that sub-word is directly determined as the definition text of the target word. This approach can break down complex words (concepts) into simpler and more complete fragments, improving the model's ability to recognize complex words (concepts).

[0096] In this implementation, the terminal can segment the target word and use its sub-words for querying, thus increasing the probability of obtaining the definition text of the target word. Furthermore, for the same target word, if multiple sub-word definition texts are obtained, the definition texts can be scored based on the number of characters in each sub-word. The more characters a sub-word has, the closer it is to the target word. Therefore, the definition text corresponding to the sub-word with the higher score is used as the definition text of the target word, resulting in higher accuracy.

[0097] For example, for a target word "ABCD", the terminal uses a word segmentation tool to divide "ABCD" into "A", "AB", "ABC", and "ABCD", etc. The terminal then queries a definition text database for each of these sub-words to determine if the database stores definition texts corresponding to each sub-word of "ABCD". If the definition text database is an encyclopedia database, it determines if an encyclopedia page exists corresponding to each sub-word of "ABCD". In response to any encyclopedia page corresponding to any sub-word of "ABCD", the terminal extracts the first sentence from the descriptive text displayed on that encyclopedia page as the definition text for "ABCD".

[0098] If the terminal obtains the definition text corresponding to both the sub-word "A" and the sub-word "ABC", then the terminal scores the definition text corresponding to the sub-word "A" based on the number of characters it contains (1), for example, a score of 1. The terminal scores the definition text corresponding to the sub-word "ABC" based on the number of characters it contains (3), for example, a score of 3. Since 3 > 1, the terminal determines the definition text corresponding to the sub-word "ABC" as the definition text corresponding to the target word "ABCD".

[0099] The following will combine Figure 5 The following explains step 302 above.

[0100] See Figure 5 The terminal inputs the word *n* into a word segmentation tool, which then divides *n* into multiple sub-words *C*. The terminal determines if the number of characters in the first sub-word is greater than or equal to the length of the word. If so, the process ends. If the number of characters in the first sub-word is less than the length of the word, the terminal uses SpaCy to determine if the first sub-word is a noun. If it is not a noun, the definition text of the word is identified as that sub-word. If the first sub-word is a noun, it determines if it corresponds to multiple definitions on the encyclopedia page. If it corresponds to one definition, the first sentence of the description text under that definition is obtained as the definition text of the word. If it corresponds to multiple definitions, the terminal determines if the word is already in the directory tree. If it is not already in the directory tree, the terminal identifies the reference node with the highest similarity between the definition text and the word from the directory tree, and selects the first definition with the highest semantic similarity to the definition text corresponding to the reference node from among the multiple definitions. The terminal retrieves the first sentence of the descriptive text under the first definition as the definition text for the word. If the word is already in the directory tree, it determines whether the word corresponds to the root node of the directory tree. If the word does not correspond to the root node of the directory tree, the terminal selects from multiple definitions based on the parent node corresponding to the word. If the word corresponds to the root node of the directory tree, a technician manually selects the definition corresponding to the word.

[0101] 303. The terminal inputs the definition text of the target word, the definition text of the first word, the definition text of the second word, and the definition texts corresponding to multiple child nodes of the first node into the matching information determination model. The matching information determination model outputs the matching information between the target word and the candidate position. The matching information is used to indicate the degree of matching between the target word and the candidate position.

[0102] To provide a clearer explanation of step 303 above, step 303 will be divided into steps 3031-3037 below.

[0103] 3031. The terminal inputs the definition text of the target word, the definition text of the first word, the definition text of the second word, and the definition texts corresponding to multiple child nodes of the first node into the matching information to determine the model.

[0104] Among them, see Figure 6 The matching information determination model 600 includes a sequence encoding unit 601, a code attention unit 602, a parent cross attention unit 603, a sibling cross attention unit 604, and a score unit 605. The sequence encoding unit 601 encodes the definition text into a definition matrix, the code attention unit 602 encodes the definition matrix into a representation matrix, the parent cross attention unit 603 acquires first and second relation features, the sibling cross attention unit 604 acquires third and fourth relation features, and the score unit 605 acquires matching information. In some embodiments, the matching information determination model further includes a definition text acquisition unit, which performs step 302 as described above. Here, q represents the definition text of the target word, p represents the definition text of the first word, c represents the definition text of the second word, s represents the definition text of the first sub-word, and w represents the definition text of the second sub-word.

[0105] In one possible implementation, for the explanatory text corresponding to each node in the directory tree, the terminal can obtain the explanatory text corresponding to each node in real time, or obtain the explanatory text corresponding to each node in advance and store the explanatory text obtained in advance in the hard disk. Subsequently, the terminal can directly call the explanatory text corresponding to each node from the hard disk without real-time acquisition, thus improving the computational efficiency.

[0106] Taking the terminal obtaining the definition texts corresponding to multiple nodes in the directory tree in advance as an example, the terminal directly obtains the definition texts of the first word, the second word, and the multiple child nodes of the first node from the hard drive.

[0107] When a terminal is retrieving the definition text corresponding to multiple nodes in a directory tree, if a word corresponding to a certain node in the directory tree is a polysemous word, that is, the word corresponds to multiple meanings in the definition text database, the terminal can select the meaning corresponding to the word in the following way.

[0108] In one possible implementation, for the first child node of the first node, the terminal queries the semantic text database using the first sub-vocabulary corresponding to the first child node. If multiple meanings corresponding to the first sub-vocabulary exist in the semantic text database, the terminal obtains the semantic similarity between the multiple meanings and the semantic text of the first vocabulary. The terminal determines the semantic text of the second meaning as the semantic text of the target vocabulary, whereby the second meaning is the meaning whose semantic similarity with the semantic text of the first vocabulary meets the third similarity condition.

[0109] In this implementation, when a sub-word has multiple meanings, the semantic similarity calculation is not performed directly on the sub-word to select the meaning. Instead, the semantic similarity calculation is performed on the definition text corresponding to its parent node to select the meaning. This can improve the accuracy of meaning selection.

[0110] For example, the terminal queries the definition text database using the first sub-vocabulary corresponding to the first sub-node to obtain the page corresponding to the first sub-vocabulary, which includes multiple meanings of the first sub-vocabulary. The terminal inputs the first vocabulary into a semantic feature extraction model, which extracts semantic features from the first vocabulary to obtain the fourth semantic feature of the first vocabulary, which is also the semantic feature of the first node. The terminal inputs the multiple meanings corresponding to the first sub-vocabulary into the semantic feature extraction model, which extracts features from each meaning to obtain the fifth semantic feature of each meaning. Based on the fourth semantic feature of the first node and the fifth semantic features of each meaning, the terminal obtains the semantic similarity between the definition text corresponding to the first node and the multiple meanings, and determines the meanings whose semantic similarity meets the fourth similarity condition as the second meaning. The terminal extracts the first sentence in the description text under the second meaning as the description text of the first sub-vocabulary.

[0111] For example, the semantic feature extraction model is the BERT model. The terminal uses the first sub-word corresponding to the first sub-node to query the definition text database and retrieves the page corresponding to the first sub-word. This page includes multiple meanings of the first sub-word. The terminal inputs the first word into the semantic feature extraction model, which encodes the first word based on an attention mechanism to obtain the fourth semantic vector of the first word. This fourth semantic vector represents the fourth semantic feature of the first word. The terminal inputs the multiple meanings corresponding to the first sub-word into the semantic feature extraction model, which encodes each meaning separately based on an attention mechanism to obtain the fifth semantic vector of each meaning. The fifth semantic vector of each meaning represents the fifth semantic feature of each node. The terminal obtains the cosine similarity between the fourth semantic vector of the first node and the fifth semantic vectors of each meaning. This cosine similarity represents the semantic similarity between the definition text corresponding to the first node and the multiple meanings. The terminal determines the meaning with the highest semantic similarity to the definition text corresponding to the first node as the second meaning. The terminal extracts the first sentence from the description text under the second meaning item as the description text for that first sub-word.

[0112] The terminal determines the model through matching information and executes the following steps 3032-3037.

[0113] 3032. The terminal obtains a first relation feature based on the definition text of the target word and the definition text of the first word. The first relation feature is used to indicate whether the first word is a hypernym of the target word.

[0114] In one possible implementation, the terminal encodes the definition text of the target word based on an attention mechanism to obtain a definition matrix for the target word, which represents the definition text of the target word. The terminal also encodes the definition text of a first word based on an attention mechanism to obtain a definition matrix for the first word, which represents the definition text of the first word. Based on the definition matrices of the target word and the first word, the terminal obtains the first relation feature.

[0115] To provide a clearer explanation of the above embodiments, the following description will be divided into three parts.

[0116] The first part involves the terminal encoding the definition text of the target word based on an attention mechanism to obtain a definition matrix for the target word. This definition matrix is ​​used to represent the definition text of the target word. This part is implemented by the sequence encoding unit 601 of the matching information determination model 600.

[0117] In one possible implementation, the terminal segments the definition text of the target word into multiple first word groups, which together constitute the definition text of the target word. The terminal performs embedding encoding on each of the multiple first word groups to obtain the embedding vector of each first word group. The terminal employs an attention mechanism to encode based on the embedding vectors of each first word group to obtain the definition matrix of the target word.

[0118] For example, the terminal uses a word segmentation tool to segment the definition text of the target word into multiple first word groups. The terminal uses word-to-vector encoding to embed and encode the multiple first word groups, obtaining the embedding vectors of each first word group. The combination of the embedding vectors of multiple first word groups is the representation sequence of the definition text of the target word. The terminal inputs the representation sequence of the definition text of the target word, that is, the embedding vectors of each first word group, into a semantic feature extraction model, and obtains the query matrix, key matrix, and value matrix of each first word group through the semantic feature extraction model. Based on the query matrix, key matrix, and value matrix of each first word group, the terminal obtains the definition matrix of the target word. In some embodiments, the word segmentation tool is SpaCy or jieba, and the semantic feature extraction model is the BERT model. The above process can be represented by formula (1).

[0119]

[0120] Among them, D q X is the definition matrix of the target vocabulary, BERT() is the processing function of the BERT model, and X is the definition matrix of the target vocabulary. q For the representation sequence of the definition text of the target vocabulary, l q is the length of the representation sequence of the definition text for the target word, and k is the number of layers in the BERT model.

[0121] The following describes the method by which the terminal obtains the semantic matrix of the target word through a semantic feature extraction model.

[0122] Taking the BERT model as an example of semantic feature extraction model, the terminal inputs the embedding vectors of each first word group into the semantic feature extraction model. The semantic feature extraction model uses three linear transformation matrices to process the embedding vectors of each first word group, obtaining the query matrix, key matrix, and value matrix of each first word group. The three linear transformation matrices are the query transformation matrix WQ1, the key transformation matrix WK1, and the value transformation matrix WV1. The parameters in these three linear transformation matrices are determined during the training of the semantic feature extraction model. In some embodiments, the semantic feature extraction model is a pre-trained BERT model, in which case the terminal can directly use the semantic feature extraction model without additional training. For a first word group in the definition text of the target word, the terminal performs dot product of the query matrix of this first word group with the key matrices of other first word groups in the definition text of the target word, obtaining the attention weights between this first word group and other first word groups. The terminal then uses these attention weights to multiply the value matrices of the corresponding first word groups, obtaining the initial attention matrix of other first word groups for this first word group. The terminal fuses the initial attention matrices of other first word groups to obtain the attention matrix of the first word group. The terminal fuses the attention matrices of multiple first word groups to obtain the semantic matrix of the target word. The above process can be represented by formulas (2) to (4).

[0123]

[0124] Where x is the embedding vector of the first word group, Q is the query matrix of the first word group, K is the key matrix of the first word group, V is the value matrix of the first word group, WQ1 is the query transformation matrix, WK1 is the key transformation matrix, and WV1 is the value transformation matrix.

[0125]

[0126] Where A is the attention weight, Softmax is the normalization function, and K is the weight. 1 Let D be the value matrix of the other first phrases, where D is a constant.

[0127] S = A·V (4)

[0128] Where S is the semantic matrix of the target word.

[0129] The second part involves the terminal encoding the definition text of the first word based on an attention mechanism to obtain a definition matrix for the first word. This definition matrix is ​​used to represent the definition text of the first word. This part is implemented by the sequence encoding unit 601 of the matching information determination model 600.

[0130] In one possible implementation, the terminal segments the definition text of the first word into multiple second word groups, which together constitute the definition text of the first word. The terminal performs embedding encoding on each of the multiple second word groups to obtain the embedding vector of each second word group. The terminal employs an attention mechanism to encode based on the embedding vectors of each second word group to obtain the definition matrix of the first word.

[0131] For example, the terminal uses a word segmentation tool to divide the definition text of the first word into multiple second word groups. The terminal uses word-to-vector encoding to embed and encode the multiple second word groups, obtaining the embedding vectors of each second word group. The combination of the embedding vectors of multiple second word groups is the representation sequence of the definition text of the first word. The terminal inputs the representation sequence of the definition text of the first word, that is, the embedding vectors of each second word group, into a semantic feature extraction model, and obtains the query matrix, key matrix, and value matrix of each second word group through the semantic feature extraction model. Based on the query matrix, key matrix, and value matrix of each second word group, the terminal obtains the definition matrix of the first word. The above process can be represented by formula (5).

[0132]

[0133] Among them, D p X is the semantic matrix of the first word. p The sequence of representations of the explanatory text for the first word, l p The length of the sequence of text representing the definition of the first word.

[0134] The following describes the method by which the terminal obtains the semantic matrix of the first word through a semantic feature extraction model.

[0135] The terminal inputs the embedding vectors of each second word group into the semantic feature extraction model. The model then processes these vectors using three linear transformation matrices to obtain the query matrix, key matrix, and value matrix for each second word group. These three linear transformation matrices are the query transformation matrix WQ1, the key transformation matrix WK1, and the value transformation matrix WV1. For a second word group within the definition text of the first word, the terminal performs a dot product between the query matrix of this second word group and the key matrices of other second word groups in the definition text, obtaining the attention weights between this second word group and the other second word groups. The terminal then multiplies these attention weights with the corresponding value matrices of the second word groups, obtaining the initial attention matrices of the other second word groups for this second word group. Finally, the terminal fuses the attention matrices of multiple second word groups to obtain the definition matrix of the first word.

[0136] The third part involves the terminal obtaining the first relation feature based on the definition matrix of the target word and the definition matrix of the first word. This part is implemented by the parent-child cross-attention unit 603.

[0137] The first relation feature is used to indicate whether the first word is a hypernym of the target word, that is, whether the node corresponding to the target word and the first node can form a parent-child relationship, or whether the first node is the parent node of the node corresponding to the target word.

[0138] In one possible implementation, the terminal encodes the definition matrix of the target word using multiple encoding vectors to obtain a representation matrix of the target word. These multiple encoding vectors are used to adjust the dimension of the matrix. The terminal then encodes the definition matrix of the first word using the same multiple encoding vectors to obtain a representation matrix of the first word. The representation matrix of the target word has the same dimension as the representation matrix of the first word. The terminal encodes the representation matrices of the target word and the first word based on an attention mechanism to obtain the first relation feature. Since the definition texts of the target word and the first word are often of different lengths, the representation sequences of the definition texts of the target word and the first word obtained in the first and second parts of the above processing will also have different lengths, resulting in different dimensions of the final representation matrices. After processing using the above implementation method, definition matrices of different dimensions can be processed into representation matrices of the same dimension.

[0139] In this implementation, the terminal can encode the definition matrix of the target word and the definition matrix of the first word using multiple encoding vectors. This means that multiple encoding vectors are used to further extract useful information from the definition matrices of the target word and the first word. After encoding with multiple vectors, the resulting representation matrices of the target word and the first word have the same dimension, which improves subsequent computational efficiency and reduces the storage overhead of the model during offline computation.

[0140] Taking the example of a terminal using an encoding vector *u* to encode the definition matrix of a target word and the definition matrix of a first word, the terminal uses this encoding vector *u* to encode multiple row vectors in the definition matrix of the target word based on an attention mechanism, obtaining the attention weights of each row vector in the definition matrix of the target word. The terminal then uses the attention weights of each row vector in the definition matrix of the target word to perform a weighted summation of the corresponding row vectors, obtaining a representation vector for the target word. Multiple representation vectors form the representation matrix of the target word. Similarly, the terminal uses the same encoding vector *u* to encode multiple row vectors in the definition matrix of the first word based on an attention mechanism, obtaining the attention weights of each row vector in the definition matrix of the first word. The terminal then uses the attention weights of each row vector in the definition matrix of the first word to perform a weighted summation of the corresponding row vectors, obtaining a representation vector for the first word. Multiple representation vectors form the representation matrix of the first word. The terminal inputs the representation matrix of the target word and the representation matrix of the first word into the Transformer encoder. The Transformer encoder encodes the representation matrix of the target word and the representation matrix of the first word and outputs the first relation vector. The first relation vector is used to represent the first relation feature. In some embodiments, the number of layers of the Transformer encoder is 3.

[0141] For example, the terminal can use the following formula (6) to obtain the attention weights of each row vector in the definition matrix of the target word.

[0142]

[0143] in, For the attention weight of row vector numbered i, e j Let j be the encoding vector. Let D be the row vector numbered i. n This is the semantic matrix for the target term. Let l be the row vector numbered k. n D n number of rows.

[0144] In addition, the terminal can also obtain the attention weights of each row vector in the definition matrix of the first word through the above formula (6), and then use the definition matrix D of the target word in the formula. n Change to the semantic matrix G of the first word n That's all.

[0145] The terminal can obtain the representation vector of the target word using the following formula (7).

[0146]

[0147] in, Let j be the representation vector.

[0148] Multiple representation vectors This constitutes the representation matrix of the target vocabulary.

[0149] Of course, the terminal can also obtain the representation vector of the target word through the above formula (7), and use the definition matrix D of the target word in the formula. n Change to the semantic matrix G of the first word n That's all.

[0150] The terminal inputs the representation matrix of the target word and the representation matrix of the first word into the Transformer encoder. The Transformer encoder encodes the representation matrix of the target word and the representation matrix of the first word based on the following formula (8) and outputs the first relation vector, which is also a parent-child relation vector.

[0151]

[0152] in, As the first relation vector, Transformer h () represents the processing formula of the attention encoder. This is the representation matrix of the target vocabulary. Let be the representation matrix of the first word.

[0153] In some embodiments, the terminal concatenates the representation matrix of the target word, the representation matrix of the first word, the start matrix, and the two separator matrices to obtain the input matrix, wherein the start matrix and the separator matrices are obtained during model training. If using... The representation matrix of the target vocabulary is represented by... The representation matrix of the first word is represented by... To represent the starting matrix, using To represent the separation matrix, the terminal will use the representation matrix of the target words. The representation matrix of the first vocabulary Start Matrix And concatenating the two separator matrices Obtain the input matrix The terminal will input matrix Input a Transformer encoder, and process the input matrix through the Transformer encoder. Encode, The corresponding output is determined as the first relation vector.

[0154] 3033. The terminal obtains a second relation feature based on the definition text of the target word and the definition text of the second word. The second relation feature is used to indicate whether the target word is a hypernym of the second word.

[0155] In one possible implementation, the terminal encodes the definition text of the second word based on an attention mechanism to obtain a definition matrix for the second word, which is used to represent the definition text of the second word. The terminal then obtains the second relation feature based on the definition matrix of the target word and the definition matrix of the second word.

[0156] To provide a clearer explanation of the above embodiments, the following description will be divided into two parts.

[0157] The first part describes how the terminal encodes the definition text of the second word based on an attention mechanism to obtain a definition matrix for the second word. This definition matrix represents the definition text of the second word. Specifically, the terminal obtains the definition matrix of the second word through the sequence encoding unit 601 of the matching information determination model 600.

[0158] In one possible implementation, the terminal segments the definition text of the second word into multiple second word groups, which together constitute the definition text of the second word. The terminal performs embedding encoding on each of the multiple second word groups to obtain the embedding vector of each second word group. The terminal employs an attention mechanism to encode based on the embedding vectors of each second word group to obtain the definition matrix of the second word.

[0159] For example, the terminal uses a word segmentation tool to divide the definition text of the second word into multiple second word groups. The terminal uses word-to-vector encoding to embed and encode the multiple second word groups, obtaining the embedding vectors of each second word group. The combination of the embedding vectors of multiple second word groups is the representation sequence of the definition text of the second word. The terminal inputs the representation sequence of the definition text of the second word, that is, the embedding vectors of each second word group, into the semantic feature extraction model, and obtains the query matrix, key matrix, and value matrix of each second word group through the semantic feature extraction model. Based on the query matrix, key matrix, and value matrix of each second word group, the terminal obtains the definition matrix of the second word. The above process can also be represented by formula (9).

[0160]

[0161] Among them, D c X is the semantic matrix of the second word. c For the representation sequence of the explanatory text of the second word, l c The length of the sequence representing the definition text of the second word.

[0162] The following describes the method by which the terminal obtains the semantic matrix of the second word through a semantic feature extraction model.

[0163] The terminal inputs the embedding vectors of each second word group into the semantic feature extraction model. The model then processes these vectors using three linear transformation matrices to obtain the query matrix, key matrix, and value matrix for each second word group. These three linear transformation matrices are the query transformation matrix WQ1, the key transformation matrix WK1, and the value transformation matrix WV1. For a single second word group in the definition text of that second word, the terminal performs a dot product between the query matrix of that second word group and the key matrices of other second word groups in the definition text, obtaining the attention weights between that second word group and the other second word groups. The terminal then multiplies these attention weights with the corresponding value matrices of those second word groups, obtaining the initial attention matrices of those second word groups for that second word group. Finally, the terminal fuses the attention matrices of multiple second word groups to obtain the definition matrix of that second word.

[0164] The second part involves the terminal obtaining the second relation feature based on the definition matrix of the target word and the definition matrix of the second word. This acquisition of the second relation feature is achieved by the parent-child cross-attention unit 603 of the matching information determination model 600.

[0165] The second relation feature is used to indicate whether the second word is a hyponym of the target word, that is, whether the node corresponding to the target word and the second node can form a parent-child relationship, or whether the second node is a child node of the node corresponding to the target word.

[0166] In one possible implementation, the terminal encodes the semantic matrix of the second word using the multiple encoding vectors to obtain a representation matrix of the second word. The representation matrix of the target word has the same dimension as the representation matrix of the second word. The terminal encodes the representation matrix of the target word and the representation matrix of the second word based on an attention mechanism to obtain the second relation feature.

[0167] In this implementation, the terminal can encode the definition matrices of the target word and the second word using multiple encoding vectors. This means using multiple encoding vectors to further extract useful information from the definition matrices of the target word and the second word. After encoding with multiple vectors, the resulting representation matrices of the target word and the second word have the same dimension, which improves subsequent computational efficiency and reduces the storage overhead of the model during offline computation.

[0168] Taking the example of a terminal using an encoding vector *u* to encode the definition matrix of a target word and the definition matrix of a second word, the terminal uses this encoding vector *u* to encode multiple row vectors in the definition matrix of the target word based on an attention mechanism, obtaining the attention weights of each row vector in the definition matrix of the target word. The terminal then uses the attention weights of each row vector in the definition matrix of the target word to perform a weighted summation of the corresponding row vectors, obtaining a representation vector for the target word. Multiple representation vectors form the representation matrix of the target word. Similarly, the terminal uses the same encoding vector *u* to encode multiple row vectors in the definition matrix of the second word based on an attention mechanism, obtaining the attention weights of each row vector in the definition matrix of the second word. Finally, the terminal uses the attention weights of each row vector in the definition matrix of the second word to perform a weighted summation of the corresponding row vectors, obtaining a representation vector for the second word. Multiple representation vectors form the representation matrix of the second word. The terminal inputs the representation matrix of the target word and the representation matrix of the second word into the Transformer encoder. The Transformer encoder encodes the representation matrix of the target word and the representation matrix of the second word and outputs the second relation vector, which is used to represent the second relation feature.

[0169] For example, the terminal can use the above formula (6) to obtain the attention weights of each row vector in the definition matrix of the target word.

[0170] In addition, the terminal can also obtain the attention weights of each row vector in the definition matrix of the second word through the above formula (6), and then use the definition matrix D of the target word in the formula. n Change to the definition matrix T of the second word n That's all.

[0171] The terminal can obtain the representation vector of the target word through the above formula (7).

[0172] Of course, the terminal can also obtain the representation vector of the target word through the above formula (7), and use the definition matrix D of the target word in the formula. n Change to the definition matrix T of the second word n That's all.

[0173] The terminal inputs the representation matrix of the target word and the representation matrix of the second word into the Transformer encoder. The Transformer encoder encodes the representation matrix of the target word and the representation matrix of the second word based on the following formula (10) and outputs the second relation vector, which is also a parent-child relation vector.

[0174]

[0175] in, This is the second relation vector. Let be the representation matrix of the second word.

[0176] In some embodiments, the terminal concatenates the representation matrix of the target word, the representation matrix of the second word, the start matrix, and the two separator matrices to obtain the input matrix, wherein the start matrix and the separator matrix are obtained during model training. If using... The representation matrix of the target vocabulary is represented by... The representation matrix of the second word is represented by... To represent the starting matrix, using To represent the separation matrix, the terminal will use the representation matrix of the target words. The representation matrix of the second vocabulary Start Matrix And concatenating the two separator matrices Obtain the input matrix The terminal will input matrix Input a Transformer encoder, and process the input matrix through the Transformer encoder. Encode, The corresponding output is determined as the second relation vector.

[0177] It should be noted that if there is no second node, then after step 3032, the terminal can directly execute the following step 3034.

[0178] 3034. Based on the definition text of the target word and the definition texts corresponding to the multiple child nodes, the terminal determines the first child node and the second child node from the multiple child nodes. The first child node is the child node with the highest semantic similarity between the corresponding definition text and the target word, and the second child node is the child node with the lowest semantic similarity between the corresponding definition text and the target word.

[0179] In one possible implementation, the terminal inputs the definition text of the target word into a semantic feature extraction model. This model extracts features from the definition text to obtain the sixth semantic feature of the target word's definition text. The terminal then inputs the definition texts corresponding to the multiple child nodes into the same semantic feature extraction model. This model extracts features from the definition texts corresponding to the multiple child nodes to obtain the seventh semantic features of each child node of the first node. Based on the sixth and seventh semantic features, the terminal obtains the semantic similarity between the definition text of the node corresponding to the target word and the definition texts of each child node. The terminal determines the child node with the highest semantic similarity as the first child node and the child node with the lowest semantic similarity as the second child node.

[0180] For example, the terminal inputs the definition text of the target word into a semantic feature extraction model. This model encodes the definition text using an attention mechanism, obtaining a sixth semantic vector representing the sixth semantic feature of the target word's definition text. The terminal then inputs the definition texts corresponding to multiple child nodes into the same model. The model encodes each child node's definition text using an attention mechanism, obtaining a seventh semantic vector for each child node. This seventh semantic vector represents the seventh semantic feature of each child node. The terminal obtains the cosine similarity between the sixth semantic vector of the target word's definition text and the seventh semantic vectors of each child node. This cosine similarity represents the semantic similarity between the target word's definition text and the definition texts of the child nodes. The terminal identifies the child node with the highest semantic similarity to the target word's definition text as the first child node and the child node with the lowest semantic similarity as the second child node.

[0181] For example, the terminal obtains the first child node using the following formula (11) and the second child node using the following formula (12).

[0182]

[0183] Where s is the first child node, w is the second child node, and C p Let X be the set of child nodes of the first node. q X is the definition text for the target word. s X is the explanatory text corresponding to the first child node. w This is the explanatory text corresponding to the second child node.

[0184] It should be noted that the first node has no child nodes, that is... If so, then simply execute step 3037 below.

[0185] 3035. The terminal obtains a third relation feature based on the definition text of the target word and the definition text corresponding to the first child node. The third relation feature is used to indicate whether the target word is a word of the same kind as the word corresponding to the first child node.

[0186] In one possible implementation, the terminal encodes the semantic text corresponding to the first child node based on an attention mechanism to obtain a semantic matrix of the first sub-word. This semantic matrix of the first sub-word is used to represent the semantic text corresponding to the first child node. Based on the semantic matrix of the target word and the semantic matrix of the first sub-word, the terminal obtains the third relation feature.

[0187] To provide a clearer explanation of the above embodiments, the following description will be divided into two parts.

[0188] The first part involves the terminal encoding the explanatory text corresponding to the first child node based on an attention mechanism to obtain the explanatory matrix of the first child node. This explanatory matrix represents the explanatory text corresponding to the first child node. This part is implemented by the sequence encoding unit 601 of the matching information determination model 600.

[0189] In one possible implementation, the terminal segments the definition text corresponding to the first child node into multiple third word groups, and these multiple third word groups constitute the definition text corresponding to the first child node. The terminal performs embedding encoding on each of the multiple third word groups to obtain the embedding vector of each third word group. The terminal uses an attention mechanism to encode based on the embedding vectors of each third word group to obtain the definition matrix of the first child node.

[0190] For example, the terminal uses a word segmentation tool to divide the definition text corresponding to the first child node into multiple third word groups. The terminal then uses word-to-vector encoding to embed these third word groups, obtaining embedding vectors for each group. The combination of these embedding vectors represents the sequence of definition text for the first child node. The terminal inputs this sequence of definition text (i.e., the embedding vectors of each third word group) into a semantic feature extraction model, which then obtains the query matrix, key matrix, and value matrix for each third word group. Based on these matrixes, the terminal obtains the definition matrix for the first child node.

[0191] The above process can also be represented by formula (13).

[0192]

[0193] Among them, D s X is the interpretation matrix of the first child node. s The sequence of representations of the explanatory text corresponding to the first child node, l s The length of the sequence of explanatory text corresponding to the first child node.

[0194] The following describes the method by which the terminal obtains the paraphrase matrix of the first child node through a semantic feature extraction model.

[0195] The terminal inputs the embedding vectors of each third-word phrase into the semantic feature extraction model. The model then processes these vectors using three linear transformation matrices to obtain the query matrix, key matrix, and value matrix for each third-word phrase. These three linear transformation matrices are the query transformation matrix WQ2, the key transformation matrix WK2, and the value transformation matrix WV2. For a third-word phrase in the definition text corresponding to the first child node, the terminal performs a dot product between the query matrix of this third-word phrase and the key matrices of other third-word phrases in the definition text corresponding to the first child node, obtaining the attention weights between this third-word phrase and other third-word phrases. The terminal then multiplies these attention weights with the value matrices of the corresponding third-word phrases, obtaining the initial attention matrices of other third-word phrases for this third-word phrase. The terminal fuses these initial attention matrices to obtain the attention matrix for this third-word phrase. Finally, the terminal fuses the attention matrices of multiple third-word phrases to obtain the definition matrix for the first child node.

[0196] The second part involves the terminal obtaining the third relation feature based on the definition matrix of the target word and the definition matrix of the first child node. This part is implemented by the sibling cross-attention unit 604.

[0197] The third relation feature indicates whether the word corresponding to the first child node is a sibling word or appositive word of the target word. In other words, it refers to whether the node corresponding to the target word and the first child node can form a sibling relationship, or whether the first child node is a sibling node of the node corresponding to the target word. Let's illustrate what a sibling node is with an example. For the word "color," there are multiple hyponyms such as "red," "yellow," and "yellow." "Red," "yellow," and "yellow" are also called sibling words or appositive words, and the nodes corresponding to "red," "yellow," and "yellow" are sibling nodes.

[0198] In one possible implementation, the terminal encodes the semantic matrix of the first child node using the multiple encoding vectors to obtain the representation matrix of the first child node. The representation matrix of the target word has the same dimension as the representation matrix of the first child node. The terminal encodes the representation matrix of the target word and the representation matrix of the first child node based on an attention mechanism to obtain the third relationship feature. The judgment of sibling node relationships allows the model to more fully model the relationships between nodes in the directory tree, which helps improve the model's accuracy. The optimal potential sibling node s (the first child node) can assist in a comprehensive evaluation of candidate positions.

[0199] In this implementation, the terminal can encode the definition matrix of the target word and the definition matrix of the first child node using multiple encoding vectors. This means using multiple encoding vectors to further extract useful information from the definition matrices of the target word and the first child node. After encoding with multiple vectors, the resulting representation matrix of the target word and the representation matrix of the first child node have the same dimension, which improves subsequent computational efficiency and reduces the storage overhead of the model during offline computation.

[0200] Taking the example of a terminal using an encoding vector *u* to encode the definition matrix of a target word and the definition matrix of its first child node, the terminal uses this encoding vector *u* to encode multiple row vectors in the definition matrix of the target word based on an attention mechanism, obtaining the attention weights of each row vector in the definition matrix of the target word. The terminal then uses the attention weights of each row vector in the definition matrix of the target word to perform a weighted summation of the corresponding row vectors, obtaining a representation vector for the target word. Multiple representation vectors form the representation matrix of the target word. Similarly, the terminal uses the same encoding vector *u* to encode multiple row vectors in the definition matrix of its first child node based on an attention mechanism, obtaining the attention weights of each row vector in the definition matrix of the first child node. The terminal then uses the attention weights of each row vector in the definition matrix of the first child node to perform a weighted summation of the corresponding row vectors, obtaining a representation vector for the first child node. Multiple representation vectors form the representation matrix of the first child node. The terminal inputs the representation matrix of the target word and the representation matrix of the first child node into the Transformer encoder. The Transformer encoder encodes the representation matrix of the target word and the representation matrix of the first child node and outputs the third relation vector, which is used to represent the third relation feature.

[0201] For example, the terminal can use the above formula (6) to obtain the attention weights of each row vector in the definition matrix of the target word.

[0202] In addition, the terminal can also obtain the attention weights of each row vector in the paraphrase matrix of the first child node through the above formula (6), and the paraphrase matrix D of the target word in the formula. n Change to the interpretation matrix O of the first child node n That's all.

[0203] The terminal can obtain the representation vector of the target word through the above formula (7).

[0204] Of course, the terminal can also obtain the representation vector of the target word through the above formula (7), and use the definition matrix D of the target word in the formula. n Change to the interpretation matrix O of the first child node n That's all.

[0205] The terminal inputs the representation matrix of the target word and the representation matrix of the first child node into the Transformer encoder. The Transformer encoder encodes the representation matrix of the target word and the representation matrix of the first child node based on the following formula (14) and outputs the third relation vector, which is also a sibling relation vector.

[0206]

[0207] in, As the third relation vector, Transformer b () represents the processing formula of the attention encoder. Let be the representation matrix of the first sub-vocabulary.

[0208] In some embodiments, the terminal concatenates the representation matrix of the target word, the representation matrix of the first child node, the start matrix, and the two separator matrices to obtain the input matrix, wherein the start matrix and the separator matrix are obtained during model training. If using... The representation matrix of the target vocabulary is represented by... The representation matrix of the first child node is represented by... To represent the starting matrix, using To represent the separation matrix, the terminal will use the representation matrix of the target words. The representation matrix of the first child node Start Matrix And concatenating the two separator matrices Obtain the input matrix The terminal will input matrix Input a Transformer encoder, and process the input matrix through the Transformer encoder. Encode, The corresponding output is determined as the third relation vector.

[0209] 3036. The terminal obtains a fourth relation feature based on the definition text of the target word and the definition text corresponding to the second child node. The fourth relation feature is used to indicate whether the target word is a word of the same kind as the word corresponding to the second child node.

[0210] In one possible implementation, the terminal encodes the semantic text corresponding to the second child node based on an attention mechanism to obtain a semantic matrix of the first sub-word. This semantic matrix of the first sub-word is used to represent the semantic text corresponding to the second child node. The terminal then obtains the fourth relation feature based on the semantic matrix of the target word and the semantic matrix of the first sub-word.

[0211] To provide a clearer explanation of the above embodiments, the following description will be divided into two parts.

[0212] The first part involves the terminal encoding the explanatory text corresponding to the second child node based on an attention mechanism, resulting in an explanatory matrix for the second child node. This explanatory matrix represents the explanatory text corresponding to the second child node. This part is implemented by the sequence encoding unit 601 of the matching information determination model 600.

[0213] In one possible implementation, the terminal segments the definition text corresponding to the second child node into multiple fourth word groups, which together constitute the definition text for the second child node. The terminal performs embedding encoding on each of the multiple fourth word groups to obtain the embedding vector for each fourth word group. The terminal employs an attention mechanism to encode based on the embedding vectors of each fourth word group to obtain the definition matrix for the second child node.

[0214] For example, the terminal uses a word segmentation tool to divide the definition text corresponding to the second child node into multiple fourth word groups. The terminal then uses word-to-vector encoding to embed these fourth word groups, obtaining embedding vectors for each group. The combination of these embedding vectors represents the sequence of definition text for the second child node. The terminal inputs this sequence of definition text (i.e., the embedding vectors of each fourth word group) into a semantic feature extraction model, which then obtains the query matrix, key matrix, and value matrix for each fourth word group. Based on these matrixes, the terminal obtains the definition matrix for the second child node.

[0215] The above process can also be represented by formula (15).

[0216]

[0217] Among them, D w X is the interpretation matrix of the second child node. w For the representation sequence of the explanatory text corresponding to the second child node, l w This represents the length of the sequence of explanatory text corresponding to the second child node.

[0218] The following describes the method by which the terminal obtains the paraphrase matrix of the second child node through a semantic feature extraction model.

[0219] The terminal inputs the embedding vectors of each fourth word group into the semantic feature extraction model. The model then processes these vectors using three linear transformation matrices to obtain the query matrix, key matrix, and value matrix for each fourth word group. These three linear transformation matrices are the query transformation matrix WQ2, the key transformation matrix WK2, and the value transformation matrix WV2. For a fourth word group in the definition text corresponding to the second child node, the terminal performs a dot product between the query matrix of this fourth word group and the key matrices of other fourth word groups in the definition text, obtaining the attention weights between this fourth word group and the other fourth word groups. The terminal then multiplies these attention weights with the value matrices of the corresponding fourth word groups to obtain the initial attention matrices of the other fourth word groups for this fourth word group. The terminal fuses these initial attention matrices to obtain the attention matrix for this fourth word group. Finally, the terminal fuses the attention matrices of multiple fourth word groups to obtain the definition matrix for the second child node.

[0220] The second part involves the terminal obtaining the fourth relation feature based on the definition matrix of the target word and the definition matrix of the second child node. This part is implemented by the sibling cross-attention unit 604.

[0221] The fourth relation feature is used to indicate whether the word corresponding to the second child node is a word of the same kind or appositive of the target word. In other words, it refers to whether the node corresponding to the target word and the second child node can form a sibling relationship, or whether the second child node is a sibling node of the node corresponding to the target word.

[0222] In one possible implementation, the terminal encodes the paraphrase matrix of the second child node using the multiple encoding vectors to obtain the representation matrix of the second child node. The representation matrix of the target word has the same dimension as the representation matrix of the second child node. The terminal encodes the representation matrix of the target word and the representation matrix of the second child node based on an attention mechanism to obtain the fourth relation feature. The introduction of the worst potential sibling node w (the second child node) can provide a basis for identifying the node corresponding to the target word, avoiding meaningless relation judgments of pseudo-leaf nodes.

[0223] In this implementation, the terminal can encode the definition matrix of the target word and the definition matrix of the second child node using multiple encoding vectors. This means that multiple encoding vectors are used to further extract useful information from the definition matrices of the target word and the second child node. After encoding with multiple vectors, the resulting representation matrices of the target word and the second child node have the same dimension, which improves subsequent computational efficiency and reduces the storage overhead of the model during offline computation.

[0224] Taking the example of a terminal using an encoding vector *u* to encode the definition matrix of a target word and the definition matrix of a second child node, the terminal uses this encoding vector *u* to encode multiple row vectors in the definition matrix of the target word based on an attention mechanism, obtaining the attention weights of each row vector in the definition matrix of the target word. The terminal then uses the attention weights of each row vector in the definition matrix of the target word to perform a weighted summation of the corresponding row vectors, obtaining a representation vector for the target word. Multiple representation vectors form the representation matrix of the target word. Similarly, the terminal uses the same encoding vector *u* to encode multiple row vectors in the definition matrix of the second child node based on an attention mechanism, obtaining the attention weights of each row vector in the definition matrix of the second child node. The terminal then uses the attention weights of each row vector in the definition matrix of the second child node to perform a weighted summation of the corresponding row vectors, obtaining a representation vector for the second child node. Multiple representation vectors form the representation matrix of the second child node. The terminal inputs the representation matrix of the target word and the representation matrix of the second child node into the Transformer encoder. The Transformer encoder encodes the representation matrix of the target word and the representation matrix of the second child node and outputs the fourth relation vector, which is used to represent the fourth relation feature.

[0225] For example, the terminal can use the above formula (6) to obtain the attention weights of each row vector in the definition matrix of the target word.

[0226] In addition, the terminal can also obtain the attention weights of each row vector in the paraphrase matrix of the second child node through the above formula (6), and the paraphrase matrix D of the target word in the formula. n Change to the interpretation matrix O of the second child node n That's all.

[0227] The terminal can obtain the representation vector of the target word through the above formula (7).

[0228] Of course, the terminal can also obtain the representation vector of the target word through the above formula (7), and use the definition matrix D of the target word in the formula. n Change to the interpretation matrix O of the second child node n That's all.

[0229] The terminal inputs the representation matrix of the target word and the representation matrix of the second child node into the Transformer encoder. The Transformer encoder encodes the representation matrix of the target word and the representation matrix of the second child node based on the following formula (16) and outputs the fourth relation vector, which is also a sibling relation vector.

[0230]

[0231] in, This is the fourth relation vector. Let be the representation matrix of the first sub-vocabulary.

[0232] In some embodiments, the terminal concatenates the representation matrix of the target word, the representation matrix of the second child node, the start matrix, and the two separator matrices to obtain the input matrix, wherein the start matrix and the separator matrix are obtained during model training. If using... The representation matrix of the target vocabulary is represented by... The representation matrix of the second child node is represented by... To represent the starting matrix, using To represent the separation matrix, the terminal will use the representation matrix of the target words. The representation matrix of the second child node Start Matrix And concatenating the two separator matrices Obtain the input matrix The terminal will input matrix Input a Transformer encoder, and process the input matrix through the Transformer encoder. Encode, The corresponding output is determined to be the fourth relation vector.

[0233] 3037. Based on the first relation feature, the second relation feature, the third relation feature, and the fourth relation feature, the terminal outputs the matching information between the target word and the candidate position.

[0234] In one possible implementation, the terminal concatenates the first relation feature, the second relation feature, the third relation feature, and the fourth relation feature into a feature matrix. The terminal performs a fully connected and normalized operation on the feature matrix and outputs the matching information between the target word and the candidate position. This part is implemented by the scoring unit 605 of the matching information determination model 600.

[0235] For example, the terminal concatenates the first relation feature, the second relation feature, the third relation feature, and the fourth relation feature into a feature matrix, inputs the feature matrix into a multilayer perceptron (MLP), performs at least one full connection on the feature matrix through the MLP, and normalizes the fully connected feature matrix through a sigmoid (S-shaped growth curve) to obtain the matching score between the target word and the candidate position. This matching score is used to represent the matching information.

[0236] For example, the terminal can obtain the matching score between the target word and the candidate position using the following formula (17).

[0237]

[0238] Where q is the target word, p is the first node, c is the second node, (p, c) represents the candidate position, f(q, (p, c)) is the matching score, σ() is the Sigmoid function, and MLP() is the function of the multilayer perceptron. In some embodiments, MLP() includes two fully connected networks.

[0239] It should be noted that if any of the second node, the first child node, or the second child node does not exist, the terminal can use a placeholder 'e'. na to replace or The matching score can then be calculated; this placeholder is a trainable placeholder.

[0240] 304. In response to the matching information meeting the target conditions, the terminal adds the node corresponding to the target word at the candidate position.

[0241] In this context, "matching information meets the target condition" means that the matching information is greater than or equal to a matching information threshold, or that the matching information is one of the R highest-ranking matching information among multiple matching information entries, where R is a positive integer. These multiple matching information entries are those obtained by the terminal based on the target word and different candidate positions in the directory tree. In some embodiments, the node corresponding to the target word is also referred to as the request node.

[0242] In one possible implementation, in response to the matching information meeting the target conditions, the terminal adds a node corresponding to the target word in the directory tree, adds a directed edge between the first node at the candidate position and the current node, and adds a directed edge between the current node and the second node at the candidate position. If a directed edge exists between the first node and the second node at the candidate position, the directed edge is deleted.

[0243] In some embodiments, a target word may have multiple correct candidate positions. When multiple candidate positions exist, these candidate positions generally share the same p (first node) or the same c (second node).

[0244] All of the above-mentioned optional technical solutions can be combined in any way to form the optional embodiments of this application, and will not be described in detail here.

[0245] The technical solution provided in this application allows for the selection of any position within a directory tree as a candidate position when adding nodes. These candidate positions represent potential locations where nodes may be added. During the node addition process, the definition text of the target term is obtained. Matching information is determined based on the definition text corresponding to each node. Finally, nodes are added to candidate positions based on this matching information. This approach enables the addition of both leaf and non-leaf nodes to the directory tree, resulting in more diverse expansion methods, increased information richness, and expanded applicability.

[0246] The technical solution provided in this application can support natural language understanding based on paraphrased text for emerging new diseases and treatments, and can be used to accurately update the medical catalog tree to continuously enrich its content and improve its applicability.

[0247] In step 303 above, the terminal uses a matching information determination model to perform the corresponding steps. The training method of this matching information determination model is described below. See [link to relevant documentation]. Figure 7 The methods include:

[0248] 701. The terminal obtains sample nodes and multiple sample candidate positions from the directory tree. The sample node is a node in the directory tree other than the root node.

[0249] The multiple candidate sample positions include both positive candidate sample positions (positive examples) and negative candidate sample positions (negative examples) for the sample node. A positive candidate sample position refers to the actual position of the sample node in the directory tree, while a negative candidate sample position refers to the position in the directory tree where the sample node is not present. In some embodiments, 1 is used to represent a positive candidate sample position, and 0 is used to represent a negative candidate sample position.

[0250] In one possible implementation, the terminal adds pseudo-leaf nodes to the directory tree. These pseudo-leaf nodes connect to each node in the directory tree, acting as child nodes of each node. Each pseudo-leaf node corresponds to a meaningless blank word. Based on multiple nodes in the directory tree and the pseudo-leaf node, the terminal obtains multiple candidate sample positions, where the sample node is not the pseudo-leaf node. Since the training of the matching information determination model involves multiple epochs, and the processing of these epochs belongs to the same inventive concept, the following description will use one epoch as an example.

[0251] For example, if we denote the directory tree before adding pseudo-leaf nodes as τ0=(N0,ε0), then the directory tree after adding pseudo-leaf nodes as τ0=(N0,ε0). In some embodiments, τ0=(N0,ε0) is called the seed directory tree. For a sample node, K sample candidate positions are sampled from the directory tree after the terminal adds pseudo-leaf nodes. The K sample candidate positions include positive sample candidate positions and negative sample candidate positions. The K sample candidate positions form a Mini-Batch: {(p1, c1, y1), (p2, c2, y2), ..., (p k c k y k )}, where y i , i∈{1,2,...,k} represents whether multiple sample candidate positions are positive or negative sample candidate positions, and K is a positive integer.

[0252] Since both sample nodes and candidate positions are obtained from the directory tree, whether a candidate position is a positive or negative sample candidate position can also be determined based on the directory tree. This process is a self-supervised process, avoiding the additional overhead of labeled data.

[0253] 702. The terminal inputs the sample node and multiple sample candidate positions into the matching information to determine the model, and the matching information determines the model to output the predicted matching information of the sample node and multiple sample candidate positions.

[0254] The method by which the terminal determines the model through matching information and outputs the predicted matching information of the sample node and multiple sample candidate positions belongs to the same inventive concept as step 303 above. The implementation process is described in step 303 above and will not be repeated here.

[0255] 703. Based on the difference between the predicted matching information and the target matching information, the terminal adjusts the model parameters of the model determined by the matching information. The target matching information is the matching information between the sample node and the actual position of the sample node in the directory tree.

[0256] In one possible implementation, the terminal constructs a binary cross-entropy loss function based on the difference between the predicted matching information and the target matching information, and adjusts the model parameters of the matching information determination model based on the binary cross-entropy loss function. In some embodiments, the form of the binary cross-entropy loss function is shown in the following formula (18).

[0257]

[0258] in, Here, K is the binary cross-entropy loss function, and K is the number of candidate positions in the sample. These are the words corresponding to this sample node. For the candidate position of sample number i, yi The label for the i-th sample candidate position is used to indicate whether the i-th sample candidate position is a positive or negative sample candidate position.

[0259] In some embodiments, during training, to ensure that the parent-child / sibling cross-attention module behaves in accordance with the expected behavior, a regularization term for the parent-child / sibling cross-attention module is added to the loss function of the model training. For example, a two-layer multilayer perceptron (MLP) is added after the parent-child / sibling cross-attention module, and four scores for the regularization term are calculated using it. The calculation process is shown in the following formula (19).

[0260]

[0261] in, These are the words corresponding to this sample node. These are the words corresponding to the parent nodes in the candidate positions. These are the words corresponding to the child nodes in the candidate positions. parent node The first child node, Parent node The second child node, for and The first relation vector between them for and The second relation vector between them for and The third relation vector between them for and The fourth relation vector represents the parent-child relationship, while the first and second relation vectors represent sibling relationships. For The rating, For The rating, For The rating, For The rating.

[0262] If and only if and Calculate when it exists as well as This is then used to calculate the regularization loss. This loss also utilizes the binary cross-entropy loss function. For example, for a Mini-Batch, see Equation (20) below.

[0263]

[0264] in, The binary cross-entropy loss function is...

[0265] The matching information determines that the final loss function of the model is a weighted sum of the above 5 loss functions, see formula (21).

[0266]

[0267] in, Let λ be the final loss function, and λ be a hyperparameter, or weight.

[0268] In some embodiments, in addition to using the binary cross-entropy loss function to train the matching information determination model, the terminal can also use other types of loss functions, such as the InfoNCE (Noise Contrastive Estimation) loss function or the Margin Ranking loss function. This application embodiment does not limit this.

[0269] Training the matching information determination model through self-supervision avoids the additional overhead of labeled data and improves the training efficiency of the matching information determination model.

[0270] Figure 8 This is a schematic diagram of a node adding device based on a directory tree provided in an embodiment of this application. See also... Figure 8 The device includes: a candidate position determination module 801, a semantic text acquisition module 802, a matching information determination module 803, and a node addition module 804.

[0271] The candidate position determination module 801 is used to determine the candidate position in the directory tree, which includes multiple nodes, each node corresponding to a multiple word. The candidate position is the position between the first node and the second node in the directory tree, and the first word corresponding to the first node is the hypernym of the second word corresponding to the second node.

[0272] The definition text acquisition module 802 is used to acquire the definition text of the target word, which is used to explain the target word.

[0273] The matching information determination module 803 is used to determine the matching information between the target word and the candidate position based on the definition text of the target word, the definition text of the first word, the definition text of the second word, and the definition text corresponding to multiple child nodes of the first node. The matching information is used to indicate the degree of matching between the target word and the candidate position.

[0274] The node adding module 804 is used to add a node corresponding to the target word at the candidate position in response to the matching information meeting the target conditions.

[0275] In one possible implementation, the definition text acquisition module 802 is used to query the definition text database using the target word to obtain the definition text of the target word. The definition text database stores multiple words and their respective definition texts.

[0276] In one possible implementation, the semantic text acquisition module 802 is used to query the semantic text database using the target word. If multiple definitions of the target word exist in the database, the module acquires the semantic similarity between the target word and the semantic texts corresponding to the multiple nodes. The semantic text of the first definition is determined as the semantic text of the target word. The first definition is the definition whose semantic similarity with the semantic text corresponding to the reference node meets a first similarity condition. The reference node is the node whose corresponding semantic text meets a second similarity condition with the target word.

[0277] In one possible implementation, the matching information determination module 803 is used to input the definition text of the target word, the definition text of the first word, the definition text of the second word, and the definition text corresponding to multiple child nodes of the first node into the matching information determination model, and output the matching information determination model to output the matching information between the target word and the candidate position.

[0278] In one possible implementation, the matching information determination module 803 is used to perform the following steps based on the matching information to determine the model:

[0279] Based on the definition text of the target word and the definition text of the first word, a first relation feature is obtained, which is used to indicate whether the first word is a hypernym of the target word.

[0280] Based on the definition text of the target word and the definition text of the second word, a second relation feature is obtained, which is used to indicate whether the target word is a hypernym of the second word.

[0281] Based on the definition text of the target word and the definition texts corresponding to the multiple child nodes, the first child node and the second child node are determined from the multiple child nodes. The first child node is the child node with the highest semantic similarity between the corresponding definition text and the target word, and the second child node is the child node with the lowest semantic similarity between the corresponding definition text and the target word.

[0282] Based on the first relation feature, the second relation feature, the definition text of the target word, the definition text corresponding to the first child node, and the definition text corresponding to the second child node, the matching information between the target word and the candidate position is output.

[0283] In one possible implementation, the matching information determination module 803 is used to encode the definition text of the target word based on an attention mechanism to obtain a definition matrix of the target word, which represents the definition text of the target word. The definition text of the first word is also encoded based on an attention mechanism to obtain a definition matrix of the first word, which represents the definition text of the first word. Based on the definition matrix of the target word and the definition matrix of the first word, the first relation feature is obtained.

[0284] In one possible implementation, the matching information determination module 803 is used to encode the semantic matrix of the target word using multiple encoding vectors to obtain a representation matrix of the target word, wherein the multiple encoding vectors are used to adjust the dimension of the matrix. The semantic matrix of the first word is then encoded using the multiple encoding vectors to obtain a representation matrix of the first word, and the representation matrix of the target word has the same dimension as the representation matrix of the first word. The representation matrices of the target word and the first word are then encoded based on an attention mechanism to obtain the first relation feature.

[0285] In one possible implementation, the matching information determination module 803 is configured to obtain a third relation feature based on the definition text of the target word and the definition text corresponding to the first child node. This third relation feature indicates whether the target word is a word in the same category as the word corresponding to the first child node. Based on the definition text of the target word and the definition text corresponding to the second child node, a fourth relation feature is obtained. This fourth relation feature indicates whether the target word is a word in the same category as the word corresponding to the second child node. Based on the first, second, third, and fourth relation features, matching information between the target word and the candidate position is output.

[0286] In one possible implementation, the matching information determination module 803 is used to encode the definition text of the target word based on an attention mechanism to obtain a definition matrix of the target word, which represents the definition text of the target word. It also encodes the definition text corresponding to the first child node based on an attention mechanism to obtain a definition matrix of the first child word, which represents the definition text corresponding to the first child node. Finally, based on the definition matrix of the target word and the definition matrix of the first child word, the third relation feature is obtained.

[0287] In one possible implementation, the matching information determination module 803 is used to encode the semantic matrix of the target word using multiple encoding vectors to obtain a representation matrix of the target word, wherein the multiple encoding vectors are used to adjust the dimension of the matrix. The semantic matrix of the first sub-word is then encoded using the multiple encoding vectors to obtain a representation matrix of the first sub-word, wherein the representation matrix of the target word and the representation matrix of the first sub-word have the same dimension. The representation matrix of the target word and the representation matrix of the first sub-word are then encoded based on an attention mechanism to obtain the third relation feature.

[0288] In one possible implementation, the matching information determination module 803 is used to concatenate the first relation feature, the second relation feature, the third relation feature, and the fourth relation feature into a feature matrix. The feature matrix is ​​then fully connected and normalized to output the matching information between the target word and the candidate position.

[0289] In one possible implementation, the device further includes:

[0290] The adjustment module retrieves sample nodes and multiple candidate sample positions from the directory tree. A sample node is any node in the directory tree except the root node. These sample nodes and candidate positions are input into the matching information determination model, which outputs predicted matching information for the sample node and its candidate positions. Based on the difference between this predicted matching information and the target matching information (the matching information between the sample node and its actual position in the directory tree), the model parameters of the matching information determination model are adjusted.

[0291] In one possible implementation, the semantic text acquisition module 802 is further configured to, for the first child node of the first node, query the semantic text database using the first sub-word corresponding to the first child node; if multiple meanings corresponding to the first sub-word exist in the semantic text database, acquire the semantic similarity between the multiple meanings and the semantic text of the first word. The semantic text of the second meaning is determined as the semantic text of the target word, wherein the second meaning is the meaning whose semantic similarity with the semantic text of the first word meets the third similarity condition.

[0292] It should be noted that the above embodiments of the directory tree-based node adding device are only illustrated by the division of the above functional modules. In practical applications, the above 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 directory tree-based node adding device and the directory tree-based node adding method embodiments are based on the same concept, and their specific implementation process can be found in the method embodiments, which will not be repeated here.

[0293] The technical solution provided in this application allows for the selection of any position within a directory tree as a candidate position when adding nodes. These candidate positions represent potential locations where nodes may be added. During the node addition process, the definition text of the target term is obtained. Matching information is determined based on the definition text corresponding to each node. Finally, nodes are added to candidate positions based on this matching information. This approach enables the addition of both leaf and non-leaf nodes to the directory tree, resulting in more diverse expansion methods, increased information richness, and expanded applicability.

[0294] This application provides a computer device for performing the above-described method. This computer device can be implemented as a terminal or a server. The structure of the terminal will be described below:

[0295] Figure 9 This is a schematic diagram of the structure of a terminal provided in an embodiment of this application. The terminal 900 can be a smartphone, tablet computer, laptop computer, or desktop computer. The terminal 900 may also be referred to as user equipment, portable terminal, laptop terminal, desktop terminal, or other names.

[0296] Typically, terminal 900 includes one or more processors 901 and one or more memories 902.

[0297] Processor 901 may include one or more processing cores, such as a quad-core processor or an octa-core processor. Processor 901 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). Processor 901 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 901 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, processor 901 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.

[0298] The memory 902 may include one or more computer-readable storage media, which may be non-transitory. The memory 902 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in the memory 902 are used to store at least one computer program, which is executed by the processor 901 to implement the directory tree-based node addition method provided in the method embodiments of this application.

[0299] In some embodiments, the terminal 900 may also optionally include a peripheral device interface 903 and at least one peripheral device. The processor 901, memory 902, and peripheral device interface 903 can be connected via a bus or signal line. Each peripheral device can be connected to the peripheral device interface 903 via a bus, signal line, or circuit board. Specifically, the peripheral device includes at least one of the following: a radio frequency circuit 904, a display screen 905, a camera assembly 906, an audio circuit 907, a positioning assembly 908, and a power supply 909.

[0300] Peripheral device interface 903 can be used to connect at least one I / O (Input / Output) related peripheral device to processor 901 and memory 902. In some embodiments, processor 901, memory 902 and peripheral device interface 903 are integrated on the same chip or circuit board; in some other embodiments, any one or two of processor 901, memory 902 and peripheral device interface 903 can be implemented on separate chips or circuit boards, which is not limited in this embodiment.

[0301] The radio frequency (RF) circuit 904 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The RF circuit 904 communicates with communication networks and other communication devices via electromagnetic signals. The RF circuit 904 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals back into electrical signals. Optionally, the RF circuit 904 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.

[0302] Display screen 905 is used to display a user interface (UI). This UI may include graphics, text, icons, video, and any combination thereof. When display screen 905 is a touch display screen, it also has the ability to collect touch signals on or above its surface. These touch signals can be input as control signals to processor 901 for processing. In this case, display screen 905 can also be used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or a soft keyboard.

[0303] The camera assembly 906 is used to capture images or videos. Optionally, the camera assembly 906 includes a front-facing camera and a rear-facing camera. Typically, the front-facing camera is located on the front panel of the terminal, and the rear-facing camera is located on the back of the terminal.

[0304] The audio circuit 907 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 to the processor 901 for processing, or input to the radio frequency circuit 904 to realize voice communication.

[0305] The positioning component 908 is used to locate the current geographical location of the terminal 900 in order to enable navigation or LBS (Location Based Service).

[0306] The power supply 909 is used to supply power to the various components in the terminal 900. The power supply 909 can be AC ​​power, DC power, a disposable battery, or a rechargeable battery.

[0307] In some embodiments, the terminal 900 further includes one or more sensors 910. The one or more sensors 910 include, but are not limited to: an accelerometer 911, a gyroscope 912, a pressure sensor 913, a fingerprint sensor 914, an optical sensor 915, and a proximity sensor 916.

[0308] Accelerometer 911 can detect the magnitude of acceleration on the three coordinate axes of a coordinate system established with terminal 900.

[0309] The gyroscope sensor 912 can detect the orientation and rotation angle of the terminal 900. The gyroscope sensor 912 can work in conjunction with the accelerometer sensor 911 to collect the user's 3D movements on the terminal 900.

[0310] The pressure sensor 913 can be installed on the side bezel of the terminal 900 and / or on the lower layer of the display screen 905. When the pressure sensor 913 is installed on the side bezel of the terminal 900, it can detect the user's grip signal on the terminal 900, and the processor 901 can perform left / right hand recognition or quick operation based on the grip signal collected by the pressure sensor 913. When the pressure sensor 913 is installed on the lower layer of the display screen 905, the processor 901 can control the operable controls on the UI interface based on the user's pressure operation on the display screen 905.

[0311] The fingerprint sensor 914 is used to collect the user's fingerprint. The processor 901 identifies the user's identity based on the fingerprint collected by the fingerprint sensor 914, or the fingerprint sensor 914 identifies the user's identity based on the collected fingerprint.

[0312] An optical sensor 915 is used to collect ambient light intensity. In one embodiment, the processor 901 can control the display brightness of the display screen 905 based on the ambient light intensity collected by the optical sensor 915.

[0313] The proximity sensor 916 is used to detect the distance between the user and the front of the terminal 900.

[0314] Those skilled in the art will understand that Figure 9 The structure shown does not constitute a limitation on terminal 900, and may include more or fewer components than shown, or combine certain components, or use different component arrangements.

[0315] The aforementioned computer equipment can also be implemented as a server. The structure of a server is described below:

[0316] Figure 10This is a schematic diagram of a server structure provided in an embodiment of this application. The server 1000 can vary significantly due to different configurations or performance. It may include one or more Central Processing Units (CPUs) 1001 and one or more memories 1002. The one or more memories 1002 store at least one computer program, which is loaded and executed by the one or more processors 1001 to implement the methods provided in the above-described method embodiments. Of course, the server 1000 may also have wired or wireless network interfaces, a keyboard, and input / output interfaces for input and output. The server 1000 may also include other components for implementing device functions, which will not be elaborated upon here.

[0317] In an exemplary embodiment, a computer-readable storage medium is also provided, such as a memory including a computer program that can be executed by a processor to perform the directory tree-based node addition method in the above embodiments. For example, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), magnetic tape, floppy disk, and optical data storage device, etc.

[0318] In an exemplary embodiment, a computer program product or computer program is also provided, which includes program code stored in a computer-readable storage medium. A processor of a computer device reads the program code from the computer-readable storage medium and executes the program code, causing the computer device to perform the above-described directory tree-based node addition method.

[0319] In some embodiments, the computer program involved in the present application embodiments may be deployed and executed on a computer device, or executed on multiple computer devices located in one location, or executed on multiple computer devices distributed in multiple locations and interconnected through a communication network. Multiple computer devices distributed in multiple locations and interconnected through a communication network may constitute a blockchain system.

[0320] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.

[0321] The above are merely optional embodiments of this application and are not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A method for adding nodes based on a directory tree, characterized in that, The method includes: Determine candidate positions in a directory tree, the directory tree including multiple nodes, each node corresponding to multiple words, the candidate position being the position between a first node and a second node in the directory tree, the first word corresponding to the first node being the hypernym of the second word corresponding to the second node; Obtain the definition text of the target word, which is used to explain the target word; Based on the definition text of the target word, the definition text of the first word, the definition text of the second word, and the definition texts corresponding to multiple child nodes of the first node, the matching information between the target word and the candidate position is determined, and the matching information is used to indicate the degree of matching between the target word and the candidate position. In response to the matching information meeting the target conditions, a node corresponding to the target word is added at the candidate position.

2. The method according to claim 1, characterized in that, The definition text of the target vocabulary includes: The target word is queried in the definition text database to obtain the definition text of the target word. The definition text database stores multiple words and their corresponding definition texts.

3. The method according to claim 2, characterized in that, The step of querying the target vocabulary in the semantic text database to obtain the semantic text of the target vocabulary includes: The target word is used to query the semantic text database. If multiple meanings corresponding to the target word exist in the semantic text database, the semantic similarity between the target word and the semantic texts corresponding to the multiple nodes is obtained. The definition text of the first sense is determined as the definition text of the target word. The first sense is the sense whose semantic similarity with the definition text corresponding to the reference node meets the first similarity condition. The reference node is the node whose corresponding definition text and the target word have a semantic similarity that meets the second similarity condition.

4. The method according to claim 1, characterized in that, The determination of matching information between the target word and the candidate position based on the definition text of the target word, the definition text of the first word, the definition text of the second word, and the definition texts corresponding to multiple child nodes of the first node includes: The definition text of the target word, the definition text of the first word, the definition text of the second word, and the definition texts corresponding to multiple child nodes of the first node are input into the matching information determination model. The matching information determination model outputs the matching information between the target word and the candidate position.

5. The method according to claim 4, characterized in that, The step of determining the matching information between the target word and the candidate position by the model output through the matching information includes: Based on the matching information, the model is determined to perform the following steps: Based on the definition text of the target word and the definition text of the first word, a first relation feature is obtained, which is used to indicate whether the first word is a hypernym of the target word. Based on the definition text of the target word and the definition text of the second word, a second relation feature is obtained, which is used to indicate whether the target word is a hypernym of the second word; Based on the definition text of the target word and the definition texts corresponding to the plurality of child nodes, a first child node and a second child node are determined from the plurality of child nodes. The first child node is the child node with the highest semantic similarity between the corresponding definition text and the target word, and the second child node is the child node with the lowest semantic similarity between the corresponding definition text and the target word. Based on the first relation feature, the second relation feature, the definition text of the target word, the definition text corresponding to the first child node, and the definition text corresponding to the second child node, the matching information between the target word and the candidate position is output.

6. The method according to claim 5, characterized in that, The step of obtaining the first relation feature based on the definition text of the target word and the definition text of the first word includes: The semantic text of the target word is encoded based on an attention mechanism to obtain the semantic matrix of the target word, and the semantic matrix of the target word is used to represent the semantic text of the target word. The definition text of the first word is encoded based on an attention mechanism to obtain the definition matrix of the first word, which is used to represent the definition text of the first word. Based on the definition matrix of the target word and the definition matrix of the first word, the first relation feature is obtained.

7. The method according to claim 6, characterized in that, The step of obtaining the first relation feature based on the definition matrix of the target vocabulary and the definition matrix of the first vocabulary includes: The semantic matrix of the target word is encoded using multiple encoding vectors to obtain the representation matrix of the target word, and the multiple encoding vectors are used to adjust the dimension of the matrix; The semantic matrix of the first word is encoded using the multiple encoding vectors to obtain the representation matrix of the first word, and the representation matrix of the target word has the same dimension as the representation matrix of the first word. The representation matrix of the target word and the representation matrix of the first word are encoded based on the attention mechanism to obtain the first relation feature.

8. The method according to claim 5, characterized in that, The step of outputting matching information between the target word and the candidate position based on the first relation feature, the second relation feature, the definition text of the target word, the definition text corresponding to the first child node, and the definition text corresponding to the second child node includes: Based on the definition text of the target word and the definition text corresponding to the first child node, a third relation feature is obtained. The third relation feature is used to indicate whether the target word is a word of the same kind as the word corresponding to the first child node. Based on the definition text of the target word and the definition text corresponding to the second child node, a fourth relation feature is obtained. The fourth relation feature is used to indicate whether the target word is a word of the same kind as the word corresponding to the second child node. Based on the first relation feature, the second relation feature, the third relation feature, and the fourth relation feature, the matching information between the target word and the candidate position is output.

9. The method according to claim 8, characterized in that, The process of obtaining third relation features based on the definition text of the target vocabulary and the definition text corresponding to the first child node includes: The semantic text of the target word is encoded based on an attention mechanism to obtain the semantic matrix of the target word, and the semantic matrix of the target word is used to represent the semantic text of the target word. The semantic text corresponding to the first child node is encoded based on the attention mechanism to obtain the semantic matrix of the first sub-word. The semantic matrix of the first sub-word is used to represent the semantic text corresponding to the first child node. The third relation feature is obtained based on the definition matrix of the target word and the definition matrix of the first sub-word.

10. The method according to claim 9, characterized in that, The process of obtaining the third relation feature based on the definition matrix of the target vocabulary and the definition matrix of the first sub-vocabulary includes: The semantic matrix of the target word is encoded using multiple encoding vectors to obtain the representation matrix of the target word, and the multiple encoding vectors are used to adjust the dimension of the matrix; The semantic matrix of the first sub-word is encoded using the multiple encoding vectors to obtain the representation matrix of the first sub-word. The representation matrix of the target word has the same dimension as the representation matrix of the first sub-word. The representation matrix of the target word and the representation matrix of the first sub-word are encoded based on the attention mechanism to obtain the third relation feature.

11. The method according to claim 8, characterized in that, The step of outputting matching information between the target word and the candidate position based on the first relation feature, the second relation feature, the third relation feature, and the fourth relation feature includes: The first relation feature, the second relation feature, the third relation feature, and the fourth relation feature are concatenated into a feature matrix; The feature matrix is ​​fully connected and normalized to output the matching information between the target word and the candidate position.

12. The method according to claim 4, characterized in that, The method further includes: Obtain sample nodes and multiple sample candidate positions from the directory tree, wherein the sample nodes are nodes in the directory tree other than the root node; The sample node and multiple sample candidate positions are input into the matching information to determine the model, and the matching information determines the model to output the predicted matching information of the sample node and multiple sample candidate positions. Based on the difference between the predicted matching information and the target matching information, the model parameters of the matching information determination model are adjusted. The target matching information is the matching information between the sample node and the actual position of the sample node in the directory tree.

13. The method according to claim 1, characterized in that, The method further includes: For the first child node of the first node, the first sub-word corresponding to the first child node is used to query the semantic text database. If there are multiple meanings corresponding to the first sub-word in the semantic text database, the semantic similarity between the multiple meanings and the semantic text of the first word is obtained. The definition text of the second meaning is determined as the definition text of the target word, wherein the second meaning is the meaning whose semantic similarity with the definition text of the first word meets the third similarity condition.

14. A node adding device based on a directory tree, characterized in that, The device includes: A candidate position determination module is used to determine candidate positions in a directory tree, the directory tree including multiple nodes, each node corresponding to multiple words, the candidate position being the position between a first node and a second node in the directory tree, and the first word corresponding to the first node being the hypernym of the second word corresponding to the second node; The definition text acquisition module is used to acquire the definition text of the target word, and the definition text of the target word is used to explain the target word; The matching information determination module is used to determine the matching information between the target word and the candidate position based on the definition text of the target word, the definition text of the first word, the definition text of the second word, and the definition text corresponding to multiple child nodes of the first node. The matching information is used to indicate the degree of matching between the target word and the candidate position. The node adding module is used to add a node corresponding to the target word at the candidate position in response to the matching information meeting the target conditions.

15. A computer device, characterized in that, The computer device includes one or more processors and one or more memories, wherein at least one computer program is stored in the one or more memories, and the computer program is loaded and executed by the one or more processors to implement the node addition method based on a directory tree as described in any one of claims 1 to 13.

16. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one computer program, which is loaded and executed by a processor to implement the directory tree-based node addition method as described in any one of claims 1 to 13.

17. A computer program product, comprising a computer program, characterized in that, When executed by a processor, the computer program implements the node addition method based on a directory tree as described in any one of claims 1 to 13.

Citation Information

Patent Citations

  • Directory tree-based information acquisition method and device

    CN110619066A

  • Method for automatically modifying a tree structure

    US20060173882A1