Knowledge graph-based retrieval method, device, electronic device, and storage medium
By obtaining the feature information of the content to be retrieved and the associated entities in the knowledge graph, the problem of low retrieval accuracy and reliability in deep learning is solved, and more accurate content retrieval is achieved.
Patent Information
- Application Number
- CN202110492303.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-06
- Publication Date
- 2025-09-02
- Estimated Expiration
- 2041-05-06
AI Technical Summary
In the prior art, content retrieval based on deep learning is low due to the high frequency of semantic updates and the small amount of information.
By obtaining the content to be retrieved and the knowledge graph, searching for related entities, and performing information encoding processing, obtaining the feature information of the content to be retrieved and the sub-map, and performing feature fusion to obtain the search results.
Improve the accuracy and reliability of content retrieval, and achieve more accurate semantic expression and search results by obtaining expanded context information in the knowledge graph.
Smart Images

Figure CN113761219B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of retrieval technology, and specifically to a retrieval method, device, electronic device and storage medium based on knowledge graph. Background Art
[0002] Content retrieval is the process of searching for content based on search terms or text. This process can be used in scenarios such as content recommendation and content search. Currently, there are solutions that use deep learning and other technologies to perform semantic learning on the content being searched.
[0003] However, when performing content retrieval based on technologies such as deep learning in related technologies, the semantics of the content to be retrieved are difficult to understand due to the high frequency of semantic updates and the small amount of information provided by the content to be retrieved, resulting in erroneous or low-end retrieval results. Therefore, the related technologies have the problem of low retrieval accuracy and reliability. Summary of the Invention
[0004] The embodiments of the present application provide a knowledge graph-based retrieval method and related devices, which can improve the retrieval accuracy and reliability during content retrieval.
[0005] To solve the above technical problems, the embodiments of the present application provide the following technical solutions:
[0006] According to one embodiment of the present application, a retrieval method based on a knowledge graph includes: obtaining content to be retrieved and a knowledge graph, wherein the knowledge graph includes a to-be-retrieved entity corresponding to the content to be retrieved and at least one associated entity having an associated relationship with the entity to be retrieved; searching the knowledge graph for associated entities having a target associated relationship with the entity to be retrieved to determine a sub-graph corresponding to the content to be retrieved from the knowledge graph; performing information encoding processing on the content to be retrieved to obtain first feature information of the content to be retrieved, and performing information encoding processing on the sub-graph to obtain second feature information of the sub-graph; performing feature fusion processing on the first feature information and the second feature information to obtain fused feature information; and obtaining a retrieval result corresponding to the content to be retrieved based on the fused feature information.
[0007] According to one embodiment of the present application, a retrieval device based on a knowledge graph includes: an acquisition module for acquiring content to be retrieved and a knowledge graph, wherein the knowledge graph includes a to-be-retrieved entity corresponding to the content to be retrieved and at least one associated entity having an associated relationship with the entity to be retrieved; an association module for searching the knowledge graph for associated entities having a target associated relationship with the entity to be retrieved, so as to determine the sub-graph corresponding to the content to be retrieved from the knowledge graph; an encoding module for performing information encoding processing on the content to be retrieved to obtain first feature information of the content to be retrieved, and performing information encoding processing on the sub-graph to obtain second feature information of the sub-graph; a fusion module for performing feature fusion processing on the first feature information and the second feature information to obtain fused feature information; and a retrieval module for obtaining a retrieval result corresponding to the content to be retrieved based on the fused feature information.
[0008] In some embodiments of the present application, the association module includes: an entity linking unit, which is used to perform entity linking on entities in the content to be retrieved in the knowledge graph, so as to determine the entity to be retrieved corresponding to the content to be retrieved in the knowledge graph; an entity association unit, which is used to determine, from at least one of the associated entities, a target associated entity whose association distance with the entity to be retrieved is less than a predetermined threshold, and the association distance corresponds to the length of the association relationship; a sub-graph acquisition unit, which is used to determine, from the knowledge graph, a sub-graph consisting of the entity to be retrieved, the target associated entity, and the association relationship between the entity to be retrieved and the target associated entity.
[0009] In some embodiments of the present application, the entity linking unit includes: an entity recognition subunit, which is used to perform named entity recognition on the words in the content to be retrieved to identify the entities in the content to be retrieved; a deformation and expansion subunit, which is used to perform deformation and expansion processing on the entities in the content to be retrieved to obtain synonymous and variant entities corresponding to the entities; and an entity matching subunit, which is used to determine, from the entities in the knowledge graph, a target entity that matches the entity in the content to be retrieved and the synonymous and variant entities, as the entity to be retrieved.
[0010] In some embodiments of the present application, the sub-graph acquisition unit includes: an environment information acquisition sub-unit, used to obtain retrieval environment information corresponding to the content to be retrieved, wherein the retrieval environment information represents relevant information in the generation environment of the content to be retrieved; a candidate entity screening sub-unit, used to screen out candidate associated entities that match the retrieval environment information from the target associated entities; and a graph acquisition sub-unit, used to obtain a sub-graph consisting of the entity to be retrieved, the candidate associated entities, and the association relationship between the entity to be retrieved and the candidate associated entities from the knowledge graph.
[0011] In some embodiments of the present application, the encoding module includes: a word segmentation unit, used to perform word segmentation processing on the content to be retrieved to obtain words in the content to be retrieved; a feature construction unit, used to construct word vectors of the words in the content to be retrieved to obtain a word vector set corresponding to the content to be retrieved; a first encoding unit, used to perform feature extraction processing on the word vector set to obtain first feature information of the content to be retrieved.
[0012] In some embodiments of the present application, the first encoding unit includes: a matrix construction subunit, used to use the word vector set to construct a feature vector matrix corresponding to the content to be retrieved; a convolution subunit, used to perform a convolution operation on the feature vector matrix based on a convolution window of a target size to obtain a convolution result matrix; and a generation subunit, used to generate first feature information of the content to be retrieved based on the convolution result matrix.
[0013] In some embodiments of the present application, the encoding module includes: a graph feature construction unit, used to construct an entity word vector corresponding to each entity in the sub-graph and a relationship word vector corresponding to each association relationship to obtain a graph feature set corresponding to the sub-graph; and a second encoding unit, used to perform feature extraction processing on the graph feature set to obtain second feature information of the sub-graph.
[0014] In some embodiments of the present application, the second encoding unit includes: a graph data generation unit, which is used to use the entity word vectors in the graph feature set as node features of nodes in the graph structure, and use the relationship word vectors as edge features of the connecting edges between the nodes to generate graph data; a state information extraction unit, which is used to extract the node features of the neighboring nodes corresponding to each of the nodes in the graph data and the edge features of the connecting edges connected to each of the nodes as the node surrounding state information of each of the nodes; and a fusion encoding unit, which is used to perform a fusion process on the node surrounding state information of each of the nodes to obtain the second feature information.
[0015] In some embodiments of the present application, the fusion module includes: a dot product processing unit, used to perform dot product processing on the first feature information and the second feature information to obtain product information of the first feature information and the second feature information; and a product information determination unit, used to use the product information as the fused feature information obtained by fusion.
[0016] In some embodiments of the present application, the fusion module includes: a splicing processing unit, used to splice the first feature information and the second feature information to obtain splicing information of the first feature information and the second feature information; and a splicing information determination unit, used to use the splicing information as the fused feature information obtained by fusion.
[0017] In some embodiments of the present application, the retrieval module includes: a fully connected operation unit, used to perform a fully connected operation on the fused feature information to obtain the probability distribution of the semantic category corresponding to the content to be retrieved; a first acquisition unit, used to perform content retrieval based on the probability distribution of the semantic category to obtain the retrieval results of the content to be retrieved.
[0018] In some embodiments of the present application, the retrieval module includes: a parsing table acquisition unit, used to obtain a semantic information parsing table, wherein the semantic information parsing table contains a fusion feature information sample and a semantic category information sample associated with the fusion feature information sample; a sample matching unit, used to query a fusion feature information sample that matches the fusion feature information from the semantic information parsing table; and a second acquisition unit, used to perform content retrieval based on the semantic category information sample associated with the matched fusion feature information sample to obtain a retrieval result for the content to be retrieved.
[0019] According to another embodiment of the present application, an electronic device may include: a memory storing computer-readable instructions; and a processor reading the computer-readable instructions stored in the memory to execute the method described in the embodiment of the present application.
[0020] According to another embodiment of the present application, a storage medium stores computer-readable instructions thereon. When the computer-readable instructions are executed by a processor of a computer, the computer executes the method described in the embodiment of the present application.
[0021] According to another embodiment of the present application, a computer program product or computer program includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in various optional implementations described in the embodiments of the present application.
[0022] In an embodiment of the present application, when performing content retrieval, the content to be retrieved and the knowledge graph are obtained, wherein the knowledge graph includes the entity to be retrieved corresponding to the content to be retrieved and at least one associated entity having an associated relationship with the entity to be retrieved; the associated entity having a target associated relationship with the entity to be retrieved is searched from the knowledge graph to determine the sub-graph corresponding to the content to be retrieved from the knowledge graph; then, information encoding processing is performed on the content to be retrieved to obtain first feature information of the content to be retrieved, and information encoding processing is performed on the sub-graph to obtain second feature information of the sub-graph; feature fusion processing is performed on the first feature information and the second feature information to obtain fused feature information; finally, the retrieval result corresponding to the content to be retrieved is determined based on the fused feature information.
[0023] In this way, by obtaining a sub-graph in the knowledge graph that effectively expands the contextual information of the content to be retrieved, the content to be retrieved and the sub-graph are subjected to information encoding processing in two ways, and then feature fusion processing is performed to obtain fused feature information that effectively reflects the initial retrieval information and the expanded contextual information, and a more accurate semantic expression of the content to be retrieved is obtained. Furthermore, based on the fused feature information, the retrieval results corresponding to the content to be retrieved can be accurately and reliably obtained, effectively improving the retrieval accuracy and reliability during content retrieval. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0025] Figure 1 A schematic diagram of a system to which embodiments of the present application can be applied is shown.
[0026] Figure 2 A schematic diagram showing another system to which the embodiments of the present application can be applied is shown.
[0027] Figure 3 A flowchart of a knowledge graph-based retrieval method according to an embodiment of the present application is shown.
[0028] Figure 4 A knowledge graph-based retrieval flowchart is shown in a scenario in which an embodiment of the present application is applied.
[0029] Figure 5 A schematic diagram of a sub-map according to an embodiment of the present application is shown.
[0030] Figure 6 A block diagram of a knowledge graph-based retrieval device according to an embodiment of the present application is shown.
[0031] Figure 7 A block diagram of an electronic device according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0032] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without making creative efforts are within the scope of protection of this application.
[0033] In the following description, the specific embodiments of the present application will be described with reference to steps and symbols performed by one or more computers, unless otherwise stated. Therefore, these steps and operations will be mentioned several times as being performed by a computer, and the computer execution referred to herein includes the operation of a computer processing unit by an electronic signal representing data in a structured form. This operation converts the data or maintains it at a location in the computer's memory system, which can be reconfigured or otherwise change the operation of the computer in a manner familiar to testers in the field. The data structure in which the data is maintained is a physical location in the memory, which has specific characteristics defined by the data format. However, the principles of the present application are described in the above text, which does not represent a limitation, and testers in the field will understand that the various steps and operations described below can also be implemented in hardware.
[0034] Figure 1 Schematic diagram of a system 100 to which embodiments of the present application can be applied is shown. Figure 1 As shown, the system 100 may include a server 101 and a terminal 102. In one example, the server 101 may store a knowledge graph, and the terminal 102 may run a client corresponding to the retrieval system. The user may input the content to be retrieved through the client, and the client may transmit the content to be retrieved to the server. After receiving the content to be retrieved, the server 101 may perform a search based on the knowledge graph. In one example, the terminal 102 may obtain the knowledge graph from the server 101, and after receiving the content to be retrieved, the terminal 102 may perform a search based on the knowledge graph.
[0035] The server 101 and the terminal 102 may be connected directly or indirectly via wireless communication, and this application does not impose any special restrictions thereon.
[0036] Data can be transmitted between the server 101 and the terminal 102 via a target protocol link, which may include a link based on a transport layer protocol, such as a Transmission Control Protocol (TCP) link or a User Datagram Protocol (UDP) link transmission and other transport layer protocols.
[0037] Server 101 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, as well as big data and artificial intelligence platforms.
[0038] In one embodiment, server 101 can provide artificial intelligence cloud services, such as artificial intelligence cloud services for massively multiplayer online role-playing games (MMORPGs). The so-called artificial intelligence cloud service is generally also referred to as AIaaS (AIas a Service, Chinese for "AI as a Service"). This is a mainstream service mode of artificial intelligence platforms. Specifically, the AIaaS platform will split several common AI services and provide independent or packaged services in the cloud. This service model is similar to opening an AI theme mall: all developers can access and use one or more artificial intelligence services provided by the platform through API interfaces. Some senior developers can also use the AI framework and AI infrastructure provided by the platform to deploy and operate their own exclusive cloud artificial intelligence services. For example, server 101 can provide artificial intelligence-based retrieval services.
[0039] The terminal 102 can be an edge device, such as a mobile phone, a computer, a VR / AR device, a computer, etc.
[0040] In one implementation of this example, the server 101 can obtain the content to be retrieved and the knowledge graph, wherein the knowledge graph includes the entity to be retrieved corresponding to the content to be retrieved and at least one associated entity having an associated relationship with the entity to be retrieved; the associated entity having a target associated relationship with the entity to be retrieved is searched in the knowledge graph to determine the sub-graph corresponding to the content to be retrieved from the knowledge graph; information encoding processing is performed on the content to be retrieved to obtain first feature information of the content to be retrieved, and information encoding processing is performed on the sub-graph to obtain second feature information of the sub-graph; feature fusion processing is performed on the first feature information and the second feature information to obtain fused feature information; and the retrieval result corresponding to the content to be retrieved is determined based on the fused feature information.
[0041] Figure 2 FIG. 2 shows a schematic diagram of another system 200 to which embodiments of the present application can be applied. Figure 2 As shown, the system 200 may be a distributed system formed by a client 201 and multiple nodes 202 connected via network communication.
[0042] Taking the distributed system as the blockchain system as an example, see Figure 2 , Figure 2This is an optional structural diagram of the distributed system 200 provided in the embodiment of the present application applied to the blockchain system, which is formed by multiple nodes 202 and clients 201. The nodes form a peer-to-peer (P2P) network. The P2P protocol is an application layer protocol running on the Transmission Control Protocol (TCP). In the distributed system, any machine such as a server or terminal can join and become a node 202 (each node 202 can be Figure 1 In the server 101), the node includes a hardware layer, an intermediate layer, an operating system layer and an application layer.
[0043] See also Figure 2 The functions of each node in the blockchain system shown include:
[0044] 1) Routing: A basic function of a node, used to support communication between nodes.
[0045] In addition to the routing function, nodes can also have the following functions:
[0046] 2) Applications, deployed in the blockchain, implement specific services based on actual business needs, record data related to the implementation of functions to form record data, carry digital signatures in the record data to indicate the source of the task data, and send the record data to other nodes in the blockchain system for other nodes to add the record data to a temporary block when they successfully verify the source and integrity of the record data.
[0047] For example, the services implemented by the application include:
[0048] 2.1) Wallet: This provides the functionality for conducting electronic currency transactions, including initiating transactions (i.e., sending the current transaction record to other nodes in the blockchain system. Upon successful verification by other nodes, the transaction record data is stored in a temporary block of the blockchain as a response to acknowledge the transaction's validity). The wallet also supports querying the remaining electronic currency in an electronic currency address.
[0049] 2.2) Shared ledgers are used to store, query, and modify account data. Records of operations on account data are sent to other nodes in the blockchain system. After verification, other nodes acknowledge the validity of the account data by storing the recorded data in a temporary block. They can also send a confirmation to the node that initiated the operation.
[0050] 2.3) Smart contracts are computerized protocols that can enforce the terms of a contract. They are implemented through code deployed on a shared ledger that is executed when certain conditions are met. Based on actual business needs, the code is used to complete automated transactions, such as querying the logistics status of a buyer's purchased goods and transferring the buyer's electronic currency to the merchant's address after the buyer signs for the goods. Of course, smart contracts are not limited to executing contracts for transactions, but can also execute contracts that process received information.
[0051] 3) Blockchain, including a series of blocks that are connected to each other in the order of their generation. Once a new block is added to the blockchain, it will not be removed. The block records the record data submitted by the nodes in the blockchain system.
[0052] In one example, multiple nodes 202 can organize a knowledge graph based on a consensus mechanism. All nodes can vote to decide the entities corresponding to the nodes in the knowledge graph that all nodes have consensus on, as well as the contextual association relationships between the entities corresponding to the nodes, thereby building a highly reliable knowledge graph in real time. The user can input the content to be retrieved through the client 201, and the client 201 broadcasts the content to be retrieved to any node 202. Then, after receiving the content to be retrieved, the node 202 can search based on the knowledge graph.
[0053] In one implementation of this example, each node 202 can obtain the content to be retrieved and the knowledge graph, wherein the knowledge graph includes the entity to be retrieved corresponding to the content to be retrieved and at least one associated entity having an associated relationship with the entity to be retrieved; the associated entity having a target associated relationship with the entity to be retrieved is searched in the knowledge graph to determine the sub-graph corresponding to the content to be retrieved from the knowledge graph; information encoding processing is performed on the content to be retrieved to obtain first feature information of the content to be retrieved, and information encoding processing is performed on the sub-graph to obtain second feature information of the sub-graph; feature fusion processing is performed on the first feature information and the second feature information to obtain fused feature information; and the retrieval result corresponding to the content to be retrieved is determined based on the fused feature information.
[0054] Figure 3 The flowchart of the knowledge graph-based retrieval method according to one embodiment of the present application is schematically shown. The execution subject of the knowledge graph-based retrieval method can be any device, such as Figure 1 The server 101 or terminal 102 shown or Figure 2 The client 201 and node 202 shown correspond to the devices.
[0055] like Figure 3 As shown, the knowledge graph-based retrieval method may include steps S310 to S350.
[0056] Step S310: Obtain the content to be retrieved and a knowledge graph, wherein the knowledge graph includes the entity to be retrieved corresponding to the content to be retrieved and at least one associated entity having an associated relationship with the entity to be retrieved;
[0057] Step S320: searching the knowledge graph for related entities that have a target association relationship with the entity to be retrieved, so as to determine the subgraph corresponding to the content to be retrieved from the knowledge graph;
[0058] Step S330: performing information encoding processing on the content to be searched to obtain first characteristic information of the content to be searched, and performing information encoding processing on the sub-graph to obtain second characteristic information of the sub-graph;
[0059] Step S340: performing feature fusion processing on the first feature information and the second feature information to obtain fused feature information;
[0060] Step S350: Obtain search results corresponding to the content to be searched based on the fused feature information.
[0061] The following describes the specific process of each step when performing knowledge graph-based retrieval.
[0062] In step S310, the content to be retrieved and the knowledge graph are obtained, where the knowledge graph includes the entity to be retrieved corresponding to the content to be retrieved and at least one associated entity having an associated relationship with the entity to be retrieved.
[0063] In the implementation of this example, the content to be retrieved is content used to provide relevant information of the retrieval target. The content to be retrieved can be the content to be retrieved in text form directly provided by the user, or the content to be retrieved in text form obtained through voice recognition after receiving voice retrieval information, or the content to be retrieved in text form obtained through image recognition after receiving image retrieval information, etc.
[0064] The content to be retrieved can be from Figure 1 The client on the terminal 102 shown or Figure 2 The search content input by the user is obtained in the client 201 shown, and the client on the terminal 102 or the client 201 is such as a video client, a browser, a map client, and a game client.
[0065] The retrieved content to be searched may include at least one entity. For example, the retrieved content "XXX Notes" or "What is XXX Notes" includes the entity "XXX Notes." The retrieved content "Does XXX Notes contain Zhang San?" includes two entities, "XXX Notes" and "Zhang San." The retrieved content to be searched may also include relationships between entities. For example, the retrieved content "Types of XXX Notes" includes the entity "XXX Notes" and the relationship "Type."
[0066] A knowledge graph (also called a knowledge base) is a graph that organizes knowledge information. Entities are used as nodes in a knowledge graph, and nodes are associated through the association relationships between entities. Triples corresponding to <entity, association relationship, entity> are constructed to organize knowledge information. Entities are words that can represent retrieval targets or objects (such as names of people, places, and institutions), and association relationships between entities are information that can represent the contextual relationship between entities (such as starring actors or types). In an example, a triple is such as <XX Records, starring actor, Zhang XX> or <Zhang XX, type, star>.
[0067] In one embodiment, the knowledge graph can be as follows Figure 1 The knowledge graph maintained by experts in real time in the server 101 shown in the figure can ensure that the acquired knowledge graph includes the latest knowledge information. In one embodiment, the knowledge graph can be as follows: Figure 2 The node 202 in the blockchain shown is organized and constructed in real time through a consensus mechanism. That is, the knowledge graph is organized based on the consensus mechanism. All nodes can decide by voting the entities corresponding to the nodes in the knowledge graph that all nodes have consensus on, as well as the contextual association relationship between the entities corresponding to the nodes, and then build a high-credibility knowledge graph in real time, which can ensure that the obtained knowledge graph includes the latest knowledge information while ensuring the reliability of the knowledge information.
[0068] The entity to be retrieved corresponding to the content to be retrieved included in the knowledge graph, that is, the entity included in the content to be retrieved and matched in the knowledge graph. For example, the content to be retrieved includes the entity "XXX", and the entity to be retrieved corresponding to the content to be retrieved in the knowledge graph is "XXX". The entity in the content to be retrieved can be identified first, and then the entity to be retrieved corresponding to the content to be retrieved can be determined through entity matching.
[0069] At least one associated entity in the knowledge graph that has an associated relationship with the entity to be retrieved, that is, an entity in the knowledge graph other than the entity to be retrieved that has a direct or indirect associated relationship with the entity to be retrieved. For example, the knowledge graph includes two triples <XXX Records, starring actor, Zhang XXX> or <Zhang XXX, type, star>. In this case, if the entity to be retrieved is "XXX Records", then "Zhang XXX" has a direct associated relationship with "XXX Records", and "star" has an indirect associated relationship with "XXX Records".
[0070] In step S320, the knowledge graph is searched for associated entities having a target association relationship with the entity to be retrieved, so as to determine the subgraph corresponding to the content to be retrieved from the knowledge graph.
[0071] In the implementation of this example, the sub-graph is a local graph in the knowledge graph, and the sub-graph corresponding to the content to be retrieved is determined by searching the knowledge graph for associated entities that have a target association relationship with the entity to be retrieved, that is, the sub-graph corresponding to the content to be retrieved is a local graph composed of the entity to be retrieved and the associated entities that have a target association relationship with the entity to be retrieved.
[0072] When searching for associated entities that have a target association relationship with the entity to be retrieved in the knowledge graph, the entity to be retrieved can be used as a starting point, and associated entities that have an association relationship with the entity to be retrieved can be searched for associated entities that have a target association relationship with the entity to be retrieved. The target association relationship can indicate a specific type of association relationship or a length range of the association relationship.
[0073] By searching for associated entities that have a target association relationship with the entity to be retrieved, the contextual information of the entities in the retrieved content can be further expanded. The sub-graph corresponding to the content to be retrieved effectively organizes this contextual information, which can effectively expand the semantics of the content to be retrieved.
[0074] In one embodiment, step S320, searching the knowledge graph for related entities having a target association relationship with the entity to be retrieved, so as to determine a subgraph corresponding to the content to be retrieved from the knowledge graph, includes:
[0075] Perform entity linking on entities in the content to be retrieved in the knowledge graph to determine the entity to be retrieved corresponding to the content to be retrieved in the knowledge graph; determine a target associated entity whose association distance with the entity to be retrieved is less than a predetermined threshold from at least one associated entity, where the association distance corresponds to the length of the association relationship; determine a subgraph consisting of the entity to be retrieved, the target associated entity, and the association relationship between the entity to be retrieved and the target associated entity from the knowledge graph.
[0076] Entity linking involves traversing the entities in the knowledge graph to determine entities that match the entities in the content to be retrieved. These matching entities are the entities to be retrieved corresponding to the content to be retrieved. Determining the entities that match the entities in the content to be retrieved can be done by converting the entities in the content to be retrieved into corresponding first vectors, and converting each entity in the knowledge graph into a second vector. Then, the similarity between the first vector and each second vector is calculated. Finally, the entity corresponding to the second vector in the knowledge graph whose similarity is greater than a predetermined similarity value is used as the entity that matches the corresponding entity in the content to be retrieved.
[0077] The association distance represents the length of the association relationship between entities. In an example, the association distance can be equal to the number of association relationships between entities. For example, the entity to be retrieved is A, and the associated entities include B, C, and D. B is directly associated with A, C is directly associated with B, and D is directly associated with C. Then, there is a direct association relationship between A and B, and an indirect association relationship between A and C or D. At this time, the association distance between the entities to be retrieved A and B is 1, the association distance between the entities to be retrieved A and C is 2, and the association distance between the entities to be retrieved A and D is 3.
[0078] Then, target related entities whose association distance with the entity to be retrieved is less than a predetermined threshold are determined. For example, if the predetermined threshold is 3, the target related entities whose association distance with the entity to be retrieved is less than the predetermined threshold are B and C. The length of the association relationship between entities (i.e., the association distance) can represent the closeness of the association between the entities.
[0079] From the knowledge graph, determining the subgraph consisting of the entity to be retrieved, the target related entity, and the relationship between the entity to be retrieved and the target related entity can further ensure the accuracy of the context information organized in the subgraph.
[0080] In one embodiment, for entities and association relationships included in the content to be retrieved, entity links can be first performed on the entities in the content to be retrieved in the knowledge graph to determine the entity to be retrieved in the knowledge graph; then, from at least one associated entity, a target associated entity is determined that has an association relationship with the entity to be retrieved included in the content to be retrieved and whose association distance is less than a predetermined threshold. This can further ensure the accuracy of the contextual information organized in the sub-graph based on the content to be retrieved itself.
[0081] In one embodiment, entity linking is performed on entities in the content to be retrieved in the knowledge graph to determine the entity to be retrieved corresponding to the content to be retrieved in the knowledge graph, including:
[0082] Perform named entity recognition on the words in the search content to identify the entities in the search content; perform deformation and expansion processing on the entities in the search content to obtain the corresponding synonymous and variant entities; from the entities in the knowledge graph, determine the target entity that matches the entity in the search content and the synonymous and variant entities as the entity to be searched.
[0083] Among them, named entity recognition is to identify whether each word contained in the search content is an entity. Identifying the entities can effectively reflect the core search semantics of the search content.
[0084] In one example, named entity recognition can be performed based on regular expressions (i.e., word expressions combined according to predetermined word combination rules). For example, a regular expression is "in + X + middle". If the content to be retrieved contains the content "in a certain record", then X = a certain record can be matched, and "a certain record" can be labeled as an entity. In one example, named entity recognition can be performed based on a machine learning entity recognition model. The content to be retrieved is input into the entity recognition model, and the entity recognition model can label the entities included in the content to be retrieved. Taking the entity recognition model as a supervised model as an example, the training method of the recognition model can be to collect a training data set, which includes samples of the content to be retrieved and the entities included in the calibrated content to be retrieved samples. Then, the samples of the content to be retrieved are used as the input data of the entity recognition model, and the entities included in the calibrated content to be retrieved samples are used as the expected output of the entity recognition model to train the entity recognition module until the accuracy of the entity recognition model reaches a predetermined target to obtain a trained entity recognition model. Among them, the entity recognition model can be an entity recognition model based on a CRF model or an HMM model, etc.
[0085] Deformation and expansion means expanding the synonyms and homographs (i.e., synonymous and heteromorphic entities) of an entity. Synonyms and homographs include, for example, synonyms, the full name of an abbreviation, the abbreviation of a full name, and aliases, etc.
[0086] In one example, the synonyms and homographs of the entities included in the content to be retrieved can be expanded based on a synonyms and homographs table. For example, the synonyms and homographs table includes the mapping relationship between the two synonyms and homographs of Lu Xun and Zhou Shuren. The entity "Lu Xun" included in the content to be retrieved can then be mapped to obtain the synonym and homograph "Zhou Shuren" of the entity "Lu Xun" included in the content to be retrieved based on the mapping relationship between the two entities of Lu Xun and Zhou Shuren.
[0087] Finally, by converting the entities and synonymous and heteromorphic entities included in the content to be retrieved into first vectors respectively, and converting each entity in the knowledge graph into a second vector, then calculating the similarity between each first vector and each second vector, and finally, taking the entity corresponding to the second vector in the knowledge graph with a similarity greater than a predetermined similarity value as the target entity (i.e., the entity to be retrieved) that matches the entities and synonymous and heteromorphic entities in the content to be retrieved.
[0088] In this way, by performing deformation and expansion on the recognized entities and determining the entity to be retrieved corresponding to the content to be retrieved in the knowledge graph, the accuracy and integrity of the determination of the entity to be retrieved can be further ensured, and the retrieval effect can be further improved.
[0089] In one embodiment, obtaining a sub-graph composed of the entity to be retrieved, the target associated entity, and the association relationship between the entity to be retrieved and the target associated entity from the knowledge graph includes:
[0090] Obtain the retrieval environment information corresponding to the content to be retrieved, which represents the relevant information in the generation environment of the content to be retrieved; filter out candidate related entities that match the retrieval environment information from the target related entities; obtain the sub-graph composed of the entity to be retrieved and the candidate related entities according to the contextual relationship from the knowledge graph.
[0091] The retrieval environment information represents the relevant information in the environment in which the content to be retrieved is generated. In one example, the retrieval environment information includes relevant information in the terminal or user account that submitted the content to be retrieved, such as historical clicks or historical retrieval information; in one example, the retrieval environment information includes relevant information in the target platform within the time period in which the content to be retrieved is generated, such as the retrieval information or click information of all users in the video playback platform within the time period.
[0092] A method for screening out candidate associated entities that match the retrieval environment information is to extract key entities in the retrieval environment information through named entity recognition (which can be all entities that appear in the retrieval environment information or entities whose appearance frequency in the retrieval environment information is higher than a predetermined frequency threshold), and then perform similarity matching between the associated entities included in the target associated entity and the key entities to obtain the similarity corresponding to each associated entity. Then, the associated entities in the target associated entity whose similarity is greater than the target threshold are obtained as candidate associated entities.
[0093] The target associated entity is the associated entity around the entity to be retrieved, which is searched through the target association relationship between entities. Furthermore, by screening out some associated entities that match the retrieval environment information as candidate associated entities, the effectiveness of the sub-graph in expanding the context information of the content to be retrieved can be further guaranteed, thereby ensuring the accuracy of the retrieval results.
[0094] In step S330, information encoding processing is performed on the content to be retrieved to obtain first feature information of the content to be retrieved, and information encoding processing is performed on the sub-graph to obtain second feature information of the sub-graph.
[0095] In the implementation of this example, the content to be retrieved and the sub-graph are encoded in two ways to obtain first feature information that accurately represents the initial semantic information corresponding to the content to be retrieved and second feature information that represents the semantic information corresponding to the context information expanded by the sub-graph.
[0096] In one example, the information encoding method for the content to be retrieved can be performed by querying the corresponding word vector of each word in the content to be retrieved in the word vector dictionary to obtain the word vector set corresponding to the content to be retrieved, and then performing feature extraction processing on the word vector set in series to obtain the first feature information; in another example, the information encoding method can be performed by converting each word in the content to be retrieved into the corresponding Chinese character internal code (i.e., binary) to obtain the first feature information.
[0097] In one example, the information encoding method for the sub-graph can be performed by querying the corresponding entity word vector and relationship word vector in the word vector dictionary for each entity and relationship in the sub-graph to obtain a graph feature set, and then performing feature extraction processing on the graph feature set to encode the information to obtain the second feature information; in another example, the information can be encoded by obtaining the unique number corresponding to each entity and relationship in the sub-graph from the knowledge graph, and then concatenating all the numbers corresponding to the sub-graph to obtain the second feature information.
[0098] In one embodiment, in step S330, information encoding processing is performed on the content to be retrieved to obtain first characteristic information of the content to be retrieved, including:
[0099] The content to be retrieved is segmented to obtain the words in the content to be retrieved; word vectors of the words in the content to be retrieved are constructed to obtain a word vector set corresponding to the content to be retrieved; feature extraction is performed on the word vector set to obtain the first feature information of the content to be retrieved.
[0100] The search content can be segmented using a word segmentation tool to obtain words in the search content. The segmented words may include words corresponding to entities and relationships. Word vectors for the words in the search content can be constructed by querying a word vector dictionary for each word.
[0101] Then, the word vector set is subjected to feature extraction processing. In one example, feature extraction can be performed on the word vector set through convolution processing to extract the first feature information that accurately represents the semantic information of the content to be retrieved. The applicant has found that this method can greatly improve the retrieval effect after feature fusion processing in subsequent steps; in one example, feature extraction can be performed on the word vector set based on basic encoder models such as long short-term memory network models. For example, memory information (such as the largest multiple vector elements) can be extracted from each word vector in the word vector set, and fused (such as addition or splicing, etc.) to adjacent subsequent word vectors according to the order of each word in the content to be classified, to obtain the fused word vector corresponding to each extracted word vector, and the fused word vectors are connected in series as the first feature information.
[0102] The following describes an embodiment of feature extraction that can greatly improve the retrieval effect after feature fusion processing in subsequent steps, namely, feature extraction of word vector sets through convolution processing.
[0103] In one embodiment, feature extraction processing is performed on the word vector set to obtain first feature information of the content to be retrieved, including:
[0104] A feature vector matrix corresponding to the content to be retrieved is constructed using a word vector set; a convolution operation is performed on the feature vector matrix based on a convolution window of a target size to obtain a convolution result matrix; and first feature information of the content to be retrieved is generated based on the convolution result matrix.
[0105] By using the word vectors of the word vector set as the elements of each row in the matrix, we can construct a feature vector matrix containing the word vectors of each word. Then, we perform a convolution operation on the feature vector matrix (i.e., perform a matrix inner product calculation on the convolution matrix and the local matrix where each element in the feature vector matrix is located) with a convolution window of the target size (i.e., a convolution kernel, a convolution matrix of the target size) to obtain the convolution result matrix.
[0106] Then, the first feature information of the content to be retrieved is generated based on the convolution result matrix. In one example, the convolution result matrix can be directly used as the extracted first feature information; in one example, the convolution result matrix can be further pooled (for example, the representative elements in the convolution result matrix can be extracted through maximum pooling calculation, and the pooling result matrix is composed of the representative elements) to obtain the pooling result matrix as the extracted first feature information.
[0107] In one embodiment, a convolution operation is performed on the eigenvector matrix using a convolution window of a target size, including: obtaining a first amount of information of the content to be retrieved and a second amount of information of the sub-graph; calculating the ratio of the first amount of information to the second amount of information, and determining a convolution window size that matches the ratio as the target size; and performing a convolution operation on the eigenvector matrix through a convolution window of the target size.
[0108] Obtaining the first amount of information about the content to be retrieved may be by calculating the first total number of words contained in the content to be retrieved; obtaining the second amount of information about the subgraph may be by obtaining the second total number of entities and contextual associations included in the subgraph. Then, the ratio of the first amount of information to the second amount of information is calculated, that is, the ratio of the first total number to the second total number is calculated. Based on the ratio, the convolution window size that matches the ratio can be queried from a preset window size query table. The preset window size query table can store the correspondence between convolution window sizes that match different ratios. Then, a convolution operation is performed based on this to further ensure the semantic fusion accuracy of the fused feature information obtained by the feature fusion processing in the subsequent steps.
[0109] In one embodiment, a first information encoding model based on a convolutional neural network performs feature extraction processing on a word vector set to obtain first feature information of the content to be retrieved, and the word vector set is input into the first information encoding model based on a convolutional neural network. The first information encoding model can use the word vector set to construct a feature vector matrix corresponding to the content to be retrieved at the input layer; at the convolution layer, a convolution operation is performed on the feature vector matrix based on a convolution window of a target size to obtain a convolution result matrix. Furthermore, the convolution result matrix can be further pooled at the pooling layer to obtain a pooling result matrix.
[0110] In one embodiment, in step S330, information encoding processing is performed on the sub-graph to obtain second feature information of the sub-graph, including:
[0111] Construct the entity word vector corresponding to each entity in the sub-graph and the relationship word vector corresponding to each association relationship to obtain the graph feature set corresponding to the sub-graph; perform feature extraction on the graph feature set to obtain the second feature information of the sub-graph.
[0112] To construct the entity word vector of each entity in the sub-graph, the word vector of the entity word corresponding to each entity can be obtained by querying the word vector dictionary, and the word vector of the entity word can be used as the entity word vector of the entity; to construct the relationship word vector of the association relationship, the word vector of the relationship word corresponding to each association relationship can be obtained by querying the word vector dictionary, and the word vector of the relationship word can be used as the relationship word vector of the association relationship; furthermore, the set of entity word vectors and relationship word vectors is the graph feature set.
[0113] Then, the graph feature set is subjected to feature extraction processing. In one example, graph data can be generated based on the graph feature set, and node surrounding state information can be fused based on the graph data to obtain second feature information. The applicant has found that this method can greatly improve the retrieval effect after feature fusion processing in subsequent steps. In one example, the graph feature set can be regarded as the word vector set in the aforementioned embodiment, and feature extraction processing can be performed on the graph feature set using the convolution processing method in the aforementioned embodiment.
[0114] The following describes a feature extraction method that can greatly improve the retrieval effect after feature fusion processing in subsequent steps, that is, a method of fusing node surrounding state information based on graph data.
[0115] In one embodiment, feature extraction processing is performed on the graph feature set to obtain second feature information of the sub-graph, including:
[0116] The entity word vectors in the graph feature set are used as node features of nodes in the graph structure, and the relationship word vectors are used as edge features of the connecting edges between nodes to generate graph data; the node features of the neighboring nodes corresponding to each node in the graph data and the edge features of the connecting edges connected to each node are extracted as the node surrounding state information of each node; the node surrounding state information of each node is fused to obtain the second feature information.
[0117] A graph structure is a structure formed by the associations between nodes in a subgraph. If two nodes in a graph have an association, they are connected by an edge. Entities in a subgraph correspond to nodes in the graph structure, and the associations between entities correspond to the edges between nodes.
[0118] The entity word vector is used as the node feature of the node in the graph structure, that is, the entity word vector corresponding to the entity is used as the node feature of the node corresponding to the entity, and the relationship word vector is used as the edge feature of the edge connecting the nodes, that is, the relationship between the entities corresponds to the relationship word vector, as the edge feature of the edge connecting the nodes corresponding to the entity, to generate the graph data corresponding to the graph structure of the sub-graph.
[0119] Furthermore, in the graph data G(V, E), G represents a graph, V is the node feature matrix corresponding to the set of nodes in the graph G, and E is the adjacency matrix corresponding to the set of connecting edges in the graph G, where V can be {V1, V2...Vn}, V1, V2...Vn are the node features of each node, and E can be {E11, E12...E1n; E11, E12...E1n; ...; En1, En2...Enn}, where Exi is the edge feature of the connecting edge between the node Vx and the node Vi. It can be understood that the element Exx (x=1...n) is usually 0. When there is no connecting edge between the nodes, the corresponding element in the adjacency matrix is also 0.
[0120] Then, the node V2's neighbor nodes, such as V1 and V3, and the edges connected to the node V2, such as Ex2 or E2x (x=1...n), are extracted. Node features of the neighbor nodes corresponding to each node and edge features of the edges connected to each node are extracted. For example, the node features of the node V2's neighbor nodes, such as V1 and V3, and the relationship features of the edges connected to the node, such as Ex2 or E2x (x=1...n), are extracted as the node surrounding state information to reflect the neighboring state information around the node.
[0121] Then, in one example, the fusion processing of the node surrounding state information can be performed by splicing the node surrounding state information of each node to the node feature of the node itself, and obtaining a new node feature matrix V corresponding to the node set: {V1+M1, V2+M2...Vn+Mn} as the second feature information, wherein Mi is the node surrounding state information of the i-th node, so that efficient and reliable fusion processing of features can be performed. In one example, based on the following embodiment, the node surrounding state information can be fused by fusing the node features of the neighboring nodes corresponding to each node, the edge features of the connected connecting edges, the node features of the node itself, and the hidden states of the neighboring nodes, so that efficient and reliable fusion processing of features can be further performed.
[0122] In one embodiment, the fusion processing of the node surrounding state information is performed on each node to obtain the second feature information, including:
[0123] The node features of the neighboring nodes corresponding to each node, the edge features of the connected edges, the node features of the node itself, and the historical hidden states of the neighboring nodes are concatenated to obtain the concatenated state features corresponding to each node; compression mapping processing is performed on the concatenated state features corresponding to each node to obtain the current hidden state of each node; the current hidden states of all nodes are summed to obtain the second feature information.
[0124] In this embodiment, the historical hidden state of the neighbor node is the hidden state corresponding to the neighbor node obtained by compression mapping processing before the moment when the splicing state feature is obtained by this splicing. For example, the current hidden state is obtained by the second compression mapping processing, and the historical hidden state is obtained by the first compression mapping processing; further, when the current hidden state is obtained by the first compression mapping processing, the historical hidden state can be zero.
[0125] The node features of the neighboring nodes corresponding to each node, the edge features of the connected connecting edges, the node features of the node itself, and the historical hidden states of the neighboring nodes are spliced into the same feature space. The feature space is the splicing state features corresponding to each node. For example, in this embodiment, the node set V can be {V1, V2...Vn}, and the node surrounding state information of node V2 can include the node features of the neighboring nodes of node V2 (such as V1 and V3) and the edge features of the connecting edges connected to node A (such as Ex2 or E2x (x=1...n)) and the hidden states of the neighboring nodes (such as V1 and V3). Then, splicing them into the same feature space can obtain V2+M2, and accordingly, a new node set such as V is obtained: {V1+M1, V2+M2...Vn+Mn}.
[0126] The compression mapping process compresses and maps the feature space corresponding to the splicing state feature of each node into a smaller feature space to obtain the current hidden state of the node. The compression mapping can be performed based on a neural network in which the penalty term of the partial derivative matrix is less than a predetermined threshold, for example, compressing the feature space corresponding to V2+M2 into a smaller feature space.
[0127] Finally, the current hidden states of all nodes are summed up to obtain the final feature matrix as the second feature information, which can further effectively represent the semantic information in the sub-graph.
[0128] In one embodiment, based on the second information encoding model of the graph neural network, the node features of the neighboring nodes corresponding to each node in the graph data and the edge features of the connecting edges connected to each node can be extracted as the node surrounding state information of each node; the node features of the neighboring nodes corresponding to each node, the edge features of the connected connecting edges, the node features of the node itself and the historical hidden states of the neighboring nodes are spliced together to obtain the splicing state features corresponding to each node; the splicing state features corresponding to each node are compressed and mapped to obtain the current hidden state of each node; the current hidden states of all nodes are summed to obtain the second feature information. The second information encoding model can be any model of the Graph Neural Networks (GNN) series, such as the Graph Convolution Networks (GCN) model, the Graph Attention Networks model, the Graph Autoencoders model, the Graph Generative Networks model and the Graph Spatial-temporal Networks model.
[0129] In step S340 , the first feature information and the second feature information are subjected to feature fusion processing to obtain fused feature information.
[0130] In the implementation of this example, in one example, the feature fusion processing method can be to perform a dot product of the first feature information and the second feature information, and obtain the product information as the fused feature information; in another example, the first feature information and the second feature information are spliced, and the spliced information is obtained as the fused feature information. It is understood that the feature fusion processing method can also be other existing feature fusion methods, such as adding the first feature information and the second feature information.
[0131] Through feature fusion processing, we can obtain fused feature information that effectively reflects the initial retrieval information and the expanded context information, which can effectively improve the retrieval effect.
[0132] In one embodiment, step S340, performing feature fusion processing on the first feature information and the second feature information to obtain fused feature information, includes:
[0133] Performing a dot multiplication process on the first feature information and the second feature information to obtain product information of the first feature information and the second feature information; and using the product information as fused feature information obtained by fusion.
[0134] The dot product processing is the dot product processing of the feature vector or the inner product dot product processing of the feature matrix. The inventor has found that feature fusion can be performed extremely well by using the dot product fusion method. In subsequent steps, the fusion feature information obtained based on the dot product fusion is used to determine that the search results have extremely excellent results.
[0135] In one embodiment, step S340, performing feature fusion processing on the first feature information and the second feature information to obtain fused feature information, includes:
[0136] The first feature information and the second feature information are spliced together to obtain spliced information of the first feature information and the second feature information; and the spliced information is used as fused feature information obtained by fusion.
[0137] The splicing process is to splice the feature vectors into a vector string or the splicing of two smaller-dimensional feature matrices into a larger-dimensional feature matrix. The splicing fusion method can also effectively perform feature fusion to a certain extent. In the subsequent steps, the fusion feature information obtained by splicing and fusion is used to determine whether the retrieval result has a better result.
[0138] In step S350, a search result corresponding to the content to be searched is obtained based on the fused feature information.
[0139] In the implementation of this example, the search results, i.e., the content information retrieved based on the content to be searched, can be content information such as a specific TV series, novel, or short video, and can be search results in scenarios such as content recommendation or content search. For example, in one example, the search results can include information such as the video content and novel content corresponding to a certain record. In one example, the search results corresponding to the content to be searched can be determined based on the fused feature information. In one example, the search results corresponding to the content to be searched can be determined by performing semantic parsing on the fully connected fused feature information; in another example, the search results corresponding to the content to be searched can be determined by performing matching parsing on the fused feature information based on a semantic information parsing table.
[0140] In one embodiment, step S350, determining the search result corresponding to the to-be-searched content based on the fused feature information, includes:
[0141] A full connection operation is performed on the fused feature information to obtain the probability distribution of the semantic categories corresponding to the content to be retrieved; content retrieval is performed based on the probability distribution of the semantic categories to obtain the retrieval results of the content to be retrieved.
[0142] The full connection operation can be to multiply the feature matrix T corresponding to the fused feature information by a weight coefficient W and then add a bias value b to obtain the full connection operation result Yi=T*Wi+bi(i=1...n), where n semantic categories can have n weight coefficients and n bias values b. Furthermore, after the full connection operation, an n-dimensional probability distribution of the semantic categories corresponding to the content to be retrieved can be obtained. Each dimension in the n-dimensional probability distribution represents the probability of a semantic category corresponding to the content to be retrieved, where the semantic categories can be finely divided according to actual conditions. For example, a certain dimension can represent that the probability that a semantic category corresponding to the content to be retrieved is a TV series is 90%, and a certain dimension can represent that the probability that a semantic category corresponding to the content to be retrieved is a novel is 20%.
[0143] Then, content retrieval is performed based on the probability distribution of semantic categories. Content retrieval can be performed based on semantic categories whose corresponding probabilities are greater than a predetermined probability threshold. For example, if the predetermined probability threshold is 80%, content retrieval can be performed in the TV series category. When the retrieval results for the content to be retrieved are obtained, the accuracy of the retrieval results is effectively guaranteed.
[0144] In one embodiment, the fused feature information is input into a fully connected layer of a neural network; a fully connected operation is performed on the fused feature information through the fully connected layer of the neural network to obtain a probability distribution of the semantic category corresponding to the content to be retrieved.
[0145] In one embodiment, step S350, determining the search result corresponding to the to-be-searched content based on the fused feature information, includes:
[0146] Obtain a semantic information parsing table, which contains fused feature information samples and semantic category information samples associated with the fused feature information samples; query the fused feature information samples that match the fused feature information from the semantic information parsing table; perform content retrieval based on the semantic category information samples associated with the matched fused feature information samples to obtain retrieval results for the content to be retrieved.
[0147] The fused feature information sample may be a preset feature vector sample or feature matrix sample, etc., and the semantic category information sample associated with the fused feature information sample may be, for example, a TV series category, a novel category, or a food category. Querying the fused feature information sample that matches the fused feature information may be performed by calculating the similarity between the fused feature information and the fused feature information sample. If the similarity between the two is greater than a predetermined threshold, it indicates that the fused feature information sample matched by the fused feature information matches. Furthermore, it may be determined that the semantic category information corresponding to the content to be retrieved is the semantic category information sample associated with the matching fused feature information sample, such as a TV series category or a novel category. Semantic categories may be finely divided according to actual conditions.
[0148] Then, content retrieval is performed based on the semantic category information sample associated with the matched fusion feature information sample. For example, if the semantic category information sample is a TV series category, content retrieval can be performed in the TV series category to obtain accurate retrieval results for the content to be retrieved, effectively ensuring the accuracy of the retrieval results.
[0149] In this way, based on steps S310 to S350, by obtaining a sub-graph in the knowledge graph that effectively expands the contextual information of the content to be retrieved, the content to be retrieved and the sub-graph are subjected to information encoding processing in two ways, and then feature fusion processing is performed to obtain fused feature information that effectively fuses the initial retrieval information and the expanded contextual information, and obtain a more accurate semantic expression of the content to be retrieved. Furthermore, based on the fused feature information, the search results corresponding to the content to be retrieved can be accurately and reliably obtained, effectively improving the retrieval accuracy and reliability during content retrieval, especially for the content to be retrieved that has not been learned by technologies such as deep learning or the content to be retrieved that provides less information, the retrieval accuracy and reliability during content retrieval can be extremely effectively improved.
[0150] The method described in the above embodiment is further described in detail below with examples.
[0151] Figure 4 A flowchart of a knowledge graph-based search in a scenario in which an embodiment of the present application is applied is shown. This scenario is described by taking content search in a search system, a recommendation system, or the like as an example.
[0152] In this scenario, a knowledge graph-based retrieval description is performed in combination with a representation model framework. The representation model framework may include a first information encoding model (for example, a first information encoding model based on a convolutional neural network), a second information encoding model (for example, a second information encoding model based on a graph neural network), and a neural network fully connected layer. The following describes the knowledge graph-based retrieval process using an embodiment of the present application.
[0153] The process of constructing the representation model framework in this scenario may include:
[0154] (1) Obtain a content sample to be retrieved and a knowledge graph, wherein the knowledge graph includes a to-be-retrieved entity corresponding to the content sample to be retrieved and at least one associated entity associated with the to-be-retrieved entity. For each entity in the content sample to be retrieved, obtain a corresponding training sample by labeling.
[0155] For example, the content sample A to be retrieved only includes entity A1. The semantic category of entity A is marked as TV series, which constitutes a training sample [A1, TV series]. The semantic category marked as novel constitutes a training sample [A1, novel]. It can be understood that the marked semantic category can be fine-grained and set according to needs.
[0156] (2) Searching for associated entities that have a target association relationship with the entity to be retrieved in the knowledge graph to determine the subgraph corresponding to the content sample to be retrieved from the knowledge graph.
[0157] The method for determining the subgraph corresponding to the content sample to be retrieved from the knowledge graph can be applied to the method for determining the subgraph corresponding to the content to be retrieved from the knowledge graph in the aforementioned embodiment of this application. For example, for the content sample A to be retrieved, the obtained subgraph may include the entity to be retrieved "A1" and the associated entities "B1 and C1" that have an association relationship with "A1".
[0158] (3) Information encoding processing is performed on the content sample to be retrieved to obtain the first feature information V1 = CNN (query_sentence) of the content to be retrieved. Specifically, feature extraction processing can be performed on the word vector set based on the first information encoding model of the convolutional neural network to obtain the first feature information of the content to be retrieved. The word vector set is input into the first information encoding model based on the convolutional neural network. The first information encoding model can use the word vector set to construct a feature vector matrix corresponding to the content to be retrieved in the input layer; in the convolution layer, a convolution operation is performed on the feature vector matrix based on a convolution window of the target size to obtain a convolution result matrix. Furthermore, the convolution result matrix can be further pooled in the pooling layer to obtain a pooling result matrix. The convolution result matrix or the pooling result matrix can be used as the first feature information.
[0159] (4) The sub-graph is subjected to information encoding processing to obtain the second feature information V2 = GNN (sub_graph) of the sub-graph. Specifically, the entity word vector corresponding to each entity in the sub-graph and the relationship word vector corresponding to each association relationship can be constructed to obtain the graph feature set corresponding to the sub-graph. The entity word vector in the graph feature set is used as the node feature of the node in the graph structure, and the relationship word vector is used as the edge feature of the connecting edge between the nodes to generate graph data; then, through the second information encoding model based on graph neural network (GNN, Graph Neural Networks), the node features of the neighboring nodes corresponding to each node in the graph data and the edge features of the connecting edges connected to each node are extracted as the node surrounding state information of each node; the node features of the neighboring nodes corresponding to each node, the edge features of the connected connecting edges, the node features of the node itself and the historical hidden states of the neighboring nodes are spliced together to obtain the splicing state features corresponding to each node; the splicing state features corresponding to each node are compressed and mapped to obtain the current hidden state of each node; the current hidden states of all nodes are summed to obtain the second feature information.
[0160] (5) The first feature information and the second feature information are subjected to feature fusion processing to obtain fused feature information. Specifically, the first feature information and the second feature information are subjected to dot multiplication processing to obtain the product information of the first feature information and the second feature information as the fused feature information V obtained by fusion, that is, V = fusion(V1, V2) = V1*V2.
[0161] (6) Input the fused feature information into the fully connected layer of the neural network; perform a fully connected operation on the fused feature information through the fully connected layer of the neural network to obtain the probability distribution vector of the semantic category corresponding to the content sample to be retrieved (for example, p[p1, p2], where p1 can be the probability of the TV series category and p2 can be the probability of the novel category). Compare the probability distribution vector of the semantic category with the pre-labeled semantic category to obtain the semantic category prediction error of the representation model framework. Then, according to the error, adjust the parameters of the first information encoding model, the second information encoding model, and the fully connected layer of the neural network in the representation model framework until the semantic category prediction error is less than the predetermined error, thereby obtaining a trained representation model framework.
[0162] Then, see Figure 4 In this scenario, the knowledge graph-based retrieval based on the trained representation model framework may include steps S410 to S450.
[0163] Step S410: Obtain the content to be retrieved and the knowledge graph, where the knowledge graph includes the entity to be retrieved corresponding to the content to be retrieved and at least one associated entity.
[0164] Step S420: Search the knowledge graph for related entities that have a target association relationship with the entity to be retrieved, so as to determine the subgraph corresponding to the content sample to be retrieved from the knowledge graph. For example, for the retrieval entity "XXX", the following subgraphs can be obtained: Figure 5 The sub-graph shown includes the entity to be retrieved "XX's Record" and the associated entity "Zhang XX, TV series and star" having a target association relationship (including starring role and type) with "XX's Record".
[0165] Step S430: Based on the first information coding model, information coding is performed on the content to be retrieved to obtain first feature information of the content to be retrieved.
[0166] Perform word segmentation on the content to be searched to obtain the words in the content to be searched; construct word vectors for the words in the content to be searched to obtain a word vector set corresponding to the content to be searched.
[0167] Then, the word vector set can be subjected to feature extraction processing based on the first information encoding model to obtain the first feature information of the content to be retrieved, and the word vector set can be input into the first information encoding model based on the convolutional neural network. The first information encoding model can use the word vector set to construct a feature vector matrix corresponding to the content to be retrieved at the input layer; at the convolution layer, a convolution operation is performed on the feature vector matrix based on a convolution window of the target size to obtain a convolution result matrix. Furthermore, the convolution result matrix can be further pooled at the pooling layer to obtain a pooling result matrix. The convolution result matrix or the pooling result matrix can be used as the first feature information.
[0168] Step S440: Based on the second information coding model, perform information coding on the sub-graph to obtain the second feature information of the sub-graph.
[0169] Specifically, the entity word vector corresponding to each entity in the sub-graph and the relationship word vector corresponding to each association relationship can be constructed to obtain the graph feature set corresponding to the sub-graph; the entity word vector in the graph feature set is used as the node feature of the node in the graph structure, and the relationship word vector is used as the edge feature of the connecting edge between the nodes to generate graph data; based on the second information encoding model of the graph neural network, the node features of the neighboring nodes corresponding to each of the nodes in the graph data and the edge features of the connecting edges connected to each of the nodes are extracted as the node surrounding state information of each node; the node features of the neighboring nodes corresponding to each node, the edge features of the connected connecting edges, the node features of the node itself and the historical hidden states of the neighboring nodes are spliced together to obtain the splicing state features corresponding to each node; the splicing state features corresponding to each node are compressed and mapped to obtain the current hidden state of each node; the current hidden states of all nodes are summed to obtain the second feature information.
[0170] In step S450, the first feature information and the second feature information are subjected to feature fusion processing to obtain fused feature information. Specifically, the first feature information and the second feature information are subjected to dot multiplication processing to obtain product information of the first feature information and the second feature information as the fused feature information.
[0171] Step S460: Obtain search results corresponding to the content to be retrieved based on the fused feature information. Specifically, the fused feature information can be input into a fully connected neural network layer; a fully connected operation is performed on the fused feature information through the fully connected neural network layer to obtain a probability distribution of semantic categories corresponding to the content samples to be retrieved. Content retrieval is performed based on the probability distribution of semantic categories to obtain search results for the content to be retrieved.
[0172] In this scenario, by applying the embodiments of the present application, it is possible to obtain a sub-graph that effectively expands the contextual information of the content to be retrieved in the knowledge graph, adopt a method of performing information encoding processing on the content to be retrieved and the sub-graph in two ways, and then perform feature fusion processing to obtain fused feature information that effectively fuses the initial retrieval information and the expanded contextual information, and obtain a more accurate semantic expression of the content to be retrieved. Furthermore, based on the fused feature information, the retrieval results corresponding to the content to be retrieved can be accurately and reliably determined, effectively improving the retrieval accuracy and reliability during content retrieval. For example, if the semantics of a certain record are not learned in the deep learning and other technologies in the existing technology, the retrieval results may appear as related music works of singer Zhang, but based on the embodiments of the present application, it is possible to accurately and reliably retrieve video content or novel content related to the certain record.
[0173] To facilitate better implementation of the knowledge graph-based retrieval method provided in the embodiment of the present application, the embodiment of the present application also provides a knowledge graph-based retrieval device based on the above-mentioned knowledge graph-based retrieval method. The meanings of the terms are the same as those in the above-mentioned knowledge graph-based retrieval method. For specific implementation details, please refer to the description in the method embodiment. Figure 6 A block diagram of a knowledge graph-based retrieval device according to an embodiment of the present application is shown.
[0174] like Figure 6 As shown, the knowledge graph-based retrieval device 500 may include an information acquisition module 510, an association module 520, an encoding module 530, a fusion module 540 and a retrieval module 550.
[0175] The acquisition module 510 can be used to obtain the content to be retrieved and the knowledge graph, wherein the knowledge graph includes the entity to be retrieved corresponding to the content to be retrieved and at least one associated entity having an associated relationship with the entity to be retrieved; the association module 520 can be used to search the knowledge graph for associated entities having a target associated relationship with the entity to be retrieved, so as to determine the sub-graph corresponding to the content to be retrieved from the knowledge graph; the encoding module 530 can be used to perform information encoding processing on the content to be retrieved to obtain the first feature information of the content to be retrieved, and perform information encoding processing on the sub-graph to obtain the second feature information of the sub-graph; the fusion module 540 can be used to perform feature fusion processing on the first feature information and the second feature information to obtain fused feature information; the retrieval module 550 can be used to obtain the retrieval result corresponding to the content to be retrieved based on the fused feature information.
[0176] In some embodiments of the present application, the association module 520 includes: an entity linking unit, which is used to perform entity linking on entities in the content to be retrieved in the knowledge graph, so as to determine the entity to be retrieved corresponding to the content to be retrieved in the knowledge graph; an entity association unit, which is used to determine, from at least one of the associated entities, a target associated entity whose association distance with the entity to be retrieved is less than a predetermined threshold, and the association distance corresponds to the length of the association relationship; a sub-graph acquisition unit, which is used to determine, from the knowledge graph, a sub-graph consisting of the entity to be retrieved, the target associated entity, and the association relationship between the entity to be retrieved and the target associated entity.
[0177] In some embodiments of the present application, the entity linking unit includes: an entity recognition subunit, which is used to perform named entity recognition on the words in the content to be retrieved to identify the entities in the content to be retrieved; a deformation and expansion subunit, which is used to perform deformation and expansion processing on the entities in the content to be retrieved to obtain synonymous and variant entities corresponding to the entities; and an entity matching subunit, which is used to determine, from the entities in the knowledge graph, a target entity that matches the entity in the content to be retrieved and the synonymous and variant entities, as the entity to be retrieved.
[0178] In some embodiments of the present application, the sub-graph acquisition unit includes: an environment information acquisition sub-unit, used to obtain retrieval environment information corresponding to the content to be retrieved, wherein the retrieval environment information represents relevant information in the generation environment of the content to be retrieved; a candidate entity screening sub-unit, used to screen out candidate associated entities that match the retrieval environment information from the target associated entities; and a graph acquisition sub-unit, used to obtain a sub-graph consisting of the entity to be retrieved, the candidate associated entities, and the association relationship between the entity to be retrieved and the candidate associated entities from the knowledge graph.
[0179] In some embodiments of the present application, the encoding module 530 includes: a word segmentation unit, used to perform word segmentation processing on the content to be retrieved to obtain words in the content to be retrieved; a feature construction unit, used to construct word vectors of the words in the content to be retrieved to obtain a word vector set corresponding to the content to be retrieved; a first encoding unit, used to perform feature extraction processing on the word vector set to obtain first feature information of the content to be retrieved.
[0180] In some embodiments of the present application, the first encoding unit includes: a matrix construction subunit, used to use the word vector set to construct a feature vector matrix corresponding to the content to be retrieved; a convolution subunit, used to perform a convolution operation on the feature vector matrix based on a convolution window of a target size to obtain a convolution result matrix; and a generation subunit, used to generate first feature information of the content to be retrieved based on the convolution result matrix.
[0181] In some embodiments of the present application, the encoding module 530 includes: a graph feature construction unit, used to construct an entity word vector corresponding to each entity in the sub-graph and a relationship word vector corresponding to each association relationship to obtain a graph feature set corresponding to the sub-graph; and a second encoding unit, used to perform feature extraction processing on the graph feature set to obtain second feature information of the sub-graph.
[0182] In some embodiments of the present application, the second encoding unit includes: a graph data generation unit, which is used to use the entity word vectors in the graph feature set as node features of nodes in the graph structure, and use the relationship word vectors as edge features of the connecting edges between the nodes to generate graph data; a state information extraction unit, which is used to extract the node features of the neighboring nodes corresponding to each of the nodes in the graph data and the edge features of the connecting edges connected to each of the nodes as the node surrounding state information of each of the nodes; and a fusion encoding unit, which is used to perform a fusion process on the node surrounding state information of each of the nodes to obtain the second feature information.
[0183] In some embodiments of the present application, the fusion module 540 includes: a dot product processing unit, used to perform dot product processing on the first feature information and the second feature information to obtain product information of the first feature information and the second feature information; and a product information determination unit, used to use the product information as the fused feature information obtained by fusion.
[0184] In some embodiments of the present application, the fusion module 540 includes: a splicing processing unit, used to splice the first feature information and the second feature information to obtain splicing information of the first feature information and the second feature information; and a splicing information determination unit, used to use the splicing information as the fused feature information obtained by fusion.
[0185] In some embodiments of the present application, the retrieval module 550 includes: a fully connected operation unit, used to perform a fully connected operation on the fused feature information to obtain the probability distribution of the semantic category corresponding to the content to be retrieved; a first acquisition unit, used to perform content retrieval based on the probability distribution of the semantic category to obtain the retrieval result of the content to be retrieved.
[0186] In some embodiments of the present application, the retrieval module 550 includes: a parsing table acquisition unit, used to obtain a semantic information parsing table, wherein the semantic information parsing table contains a fusion feature information sample and a semantic category information sample associated with the fusion feature information sample; a sample matching unit, used to query a fusion feature information sample that matches the fusion feature information from the semantic information parsing table; and a second acquisition unit, used to perform content retrieval based on the semantic category information sample associated with the matched fusion feature information sample to obtain a retrieval result for the content to be retrieved.
[0187] In this way, the retrieval device 500 based on the knowledge graph can obtain a sub-graph in the knowledge graph that effectively expands the context information of the content to be retrieved, and adopts a method of performing information encoding processing on the content to be retrieved and the sub-graph in two ways, and then performing feature fusion processing to obtain fused feature information that effectively fuses the initial retrieval information and the expanded context information, and obtains a more accurate semantic expression of the content to be retrieved. Furthermore, based on the fused feature information, the retrieval results corresponding to the content to be retrieved can be accurately and reliably determined, effectively improving the retrieval accuracy and reliability during content retrieval.
[0188] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiment of the application, the features and functions of two or more modules or units described above can be concretized in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be concretized.
[0189] In addition, an embodiment of the present application further provides an electronic device, which may be a terminal or a server, such as Figure 7 , which shows a schematic diagram of the structure of the electronic device involved in the embodiment of the present application, specifically:
[0190] The electronic device may include one or more processing core processors 601, one or more computer-readable storage media memories 602, a power supply 603, an input unit 604 and other components. Those skilled in the art will understand that Figure 7The electronic device structure shown in the figure does not constitute a limitation of the electronic device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange components differently.
[0191] Processor 601 is the control center of the electronic device, connecting the various components of the entire computer device using various interfaces and lines. By running or executing software programs and / or modules stored in memory 602 and accessing data stored in memory 602, it performs various functions of the computer device and processes data, thereby monitoring the electronic device as a whole. Optionally, processor 601 may include one or more processing cores; preferably, processor 601 may integrate an application processor and a modem processor, wherein the application processor primarily processes the operating system, user interfaces, and application programs, while the modem processor primarily handles wireless communications. It is understood that the modem processor may not be integrated into processor 601.
[0192] The memory 602 can be used to store software programs and modules. The processor 601 executes various functional applications and data processing by running the software programs and modules stored in the memory 602. The memory 602 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 602 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device. Accordingly, the memory 602 may also include a memory controller to provide the processor 601 with access to the memory 602.
[0193] The electronic device also includes a power supply 603 for supplying power to various components. Preferably, the power supply 603 can be logically connected to the processor 601 via a power management system, thereby enabling the power management system to manage charging, discharging, and power consumption. The power supply 603 can also include one or more DC or AC power supplies, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and other arbitrary components.
[0194] The electronic device may further include an input unit 604, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0195] Although not shown, the electronic device may further include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 601 in the electronic device will load the executable files corresponding to the processes of one or more application programs into the memory 602 according to the following instructions, and the processor 601 will run the application programs stored in the memory 602 to implement various functions. For example, the processor 601 may execute the application programs corresponding to the following steps:
[0196] Obtain content to be retrieved and a knowledge graph, wherein the knowledge graph includes an entity to be retrieved corresponding to the content to be retrieved and at least one associated entity having an associated relationship with the entity to be retrieved; search the knowledge graph for an associated entity having a target associated relationship with the entity to be retrieved, so as to determine a subgraph corresponding to the content to be retrieved from the knowledge graph; perform information encoding processing on the content to be retrieved to obtain first feature information of the content to be retrieved, and perform information encoding processing on the subgraph to obtain second feature information of the subgraph; perform feature fusion processing on the first feature information and the second feature information to obtain fused feature information; and obtain a retrieval result corresponding to the content to be retrieved based on the fused feature information.
[0197] In one embodiment, when searching the knowledge graph for an associated entity having a target association relationship with the entity to be retrieved to determine a subgraph corresponding to the content to be retrieved from the knowledge graph, the processor 601 may execute:
[0198] Perform entity linking on the entities in the content to be retrieved in the knowledge graph to determine the entity to be retrieved corresponding to the content to be retrieved in the knowledge graph; determine a target associated entity from at least one of the associated entities, the target associated entity having an association distance with the entity to be retrieved that is less than a predetermined threshold, wherein the association distance corresponds to the length of the association relationship; and determine a subgraph consisting of the entity to be retrieved, the target associated entity, and the association relationship between the entity to be retrieved and the target associated entity from the knowledge graph.
[0199] In one embodiment, when entity linking is performed on entities in the content to be retrieved in the knowledge graph to determine the entity to be retrieved corresponding to the content to be retrieved in the knowledge graph, the processor 601 may execute:
[0200] Perform named entity recognition on the words in the content to be retrieved to identify the entities in the content to be retrieved; perform deformation and expansion processing on the entities in the content to be retrieved to obtain synonymous and variant entities corresponding to the entities; and determine, from the entities in the knowledge graph, a target entity that matches the entity in the content to be retrieved and the synonymous and variant entities as the entity to be retrieved.
[0201] In one embodiment, when obtaining a subgraph consisting of the entity to be retrieved, the target associated entity, and the association relationship between the entity to be retrieved and the target associated entity from the knowledge graph, the processor 601 may execute:
[0202] Obtain retrieval environment information corresponding to the content to be retrieved, wherein the retrieval environment information represents relevant information in the generation environment of the content to be retrieved; filter out candidate associated entities that match the retrieval environment information from the target associated entities; and obtain a subgraph consisting of the entity to be retrieved, the candidate associated entities, and the association relationship between the entity to be retrieved and the candidate associated entities from the knowledge graph.
[0203] In one embodiment, when performing information encoding processing on the content to be retrieved to obtain the first characteristic information of the content to be retrieved, the processor 601 may execute:
[0204] Perform word segmentation processing on the content to be retrieved to obtain the words in the content to be retrieved; construct word vectors for the words in the content to be retrieved to obtain a word vector set corresponding to the content to be retrieved; perform feature extraction processing on the word vector set to obtain first feature information of the content to be retrieved.
[0205] In one embodiment, when performing feature extraction processing on the word vector set to obtain first feature information of the content to be retrieved, the processor 601 may execute:
[0206] The word vector set is used to construct a feature vector matrix corresponding to the content to be retrieved; a convolution operation is performed on the feature vector matrix based on a convolution window of a target size to obtain a convolution result matrix; and first feature information of the content to be retrieved is generated based on the convolution result matrix.
[0207] In one embodiment, when performing information encoding processing on the sub-graph to obtain the second feature information of the sub-graph, the processor 601 may execute:
[0208] Construct an entity word vector corresponding to each entity in the sub-graph and a relationship word vector corresponding to each association relationship to obtain a graph feature set corresponding to the sub-graph; perform feature extraction processing on the graph feature set to obtain second feature information of the sub-graph.
[0209] In one embodiment, when performing feature extraction processing on the graph feature set to obtain the second feature information of the sub-graph, the processor 601 may execute:
[0210] The entity word vectors in the graph feature set are used as node features of nodes in the graph structure, and the relationship word vectors are used as edge features of the connecting edges between the nodes to generate graph data; the node features of the neighboring nodes corresponding to each node in the graph data and the edge features of the connecting edges connected to each node are extracted as node surrounding state information of each node; the node surrounding state information of each node is fused to obtain the second feature information.
[0211] In one embodiment, when the first feature information and the second feature information are subjected to feature fusion processing to obtain fused feature information, the processor 601 may execute:
[0212] Performing a dot multiplication process on the first feature information and the second feature information to obtain product information of the first feature information and the second feature information; and using the product information as the fused feature information obtained by fusion.
[0213] In one embodiment, when performing feature fusion processing on the first feature information and the second feature information to obtain fused feature information, the processor 601 may execute:
[0214] The first feature information and the second feature information are spliced together to obtain spliced information of the first feature information and the second feature information; and the spliced information is used as the fused feature information obtained by fusion.
[0215] In one embodiment, when obtaining the search result corresponding to the to-be-searched content based on the fusion feature information, the processor 601 may execute:
[0216] A full connection operation is performed on the fused feature information to obtain a probability distribution of semantic categories corresponding to the content to be retrieved; and content retrieval is performed based on the probability distribution of the semantic categories to obtain a retrieval result of the content to be retrieved.
[0217] In one embodiment, when obtaining the search result corresponding to the to-be-searched content based on the fusion feature information, the processor 601 may execute:
[0218] Obtain a semantic information parsing table, wherein the semantic information parsing table includes fused feature information samples and semantic category information samples associated with the fused feature information samples; query the fused feature information samples that match the fused feature information from the semantic information parsing table; perform content retrieval based on the semantic category information samples associated with the matched fused feature information samples to obtain retrieval results for the content to be retrieved.
[0219] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be accomplished by a computer program, or by controlling related hardware through a computer program. The computer program may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0220] To this end, an embodiment of the present application further provides a storage medium storing a computer program, which can be loaded by a processor to execute the steps of any method provided in the embodiment of the present application.
[0221] The storage medium may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0222] Since the computer program stored in the storage medium can execute the steps of any method provided in the embodiments of the present application, the beneficial effects that can be achieved by the method provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0223] According to one aspect of the present application, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various optional implementations of the above-described embodiments of the present application.
[0224] Those skilled in the art will readily conceive of other embodiments of the present application after considering the specification and practicing the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present application that follow the general principles of this application and include common knowledge or customary techniques in the art that are not disclosed herein.
[0225] It should be understood that the present application is not limited to the embodiments that have been described above and shown in the accompanying drawings, but various modifications and changes may be made without departing from the scope thereof.
Claims
1. A retrieval method based on knowledge graph, characterized in that: include: Obtaining content to be retrieved and a knowledge graph, wherein the knowledge graph includes an entity to be retrieved corresponding to the content to be retrieved and at least one associated entity having an associated relationship with the entity to be retrieved; Searching the knowledge graph for associated entities having a target association relationship with the entity to be retrieved, so as to determine a subgraph corresponding to the content to be retrieved from the knowledge graph; Performing information encoding processing on the content to be retrieved to obtain first characteristic information of the content to be retrieved, and performing information encoding processing on the sub-graph to obtain second characteristic information of the sub-graph; Performing feature fusion processing on the first feature information and the second feature information to obtain fused feature information; Obtaining a search result corresponding to the content to be retrieved based on the fused feature information; searching the knowledge graph for an associated entity having a target association relationship with the entity to be retrieved, so as to determine a subgraph corresponding to the content to be retrieved from the knowledge graph, including: Performing entity linking on entities in the content to be retrieved in the knowledge graph to determine the entity to be retrieved corresponding to the content to be retrieved in the knowledge graph; Determine, from at least one of the related entities, a target related entity whose related distance to the entity to be retrieved is less than a predetermined threshold, wherein the related distance corresponds to the length of the related relationship; Acquire retrieval environment information corresponding to the content to be retrieved, wherein the retrieval environment information represents relevant information in a generation environment of the content to be retrieved; Filtering candidate related entities that match the search environment information from the target related entities; From the knowledge graph, a subgraph consisting of the entity to be retrieved, the candidate associated entities, and the association relationship between the entity to be retrieved and the candidate associated entities is obtained.
2. The method according to claim 1, characterized in that The performing entity linking on the entities in the content to be retrieved in the knowledge graph to determine the entities to be retrieved corresponding to the content to be retrieved in the knowledge graph includes: Performing named entity recognition on the words in the content to be retrieved to identify entities in the content to be retrieved; Performing deformation and expansion processing on the entities in the content to be retrieved to obtain synonymous variant entities corresponding to the entities; From the entities in the knowledge graph, a target entity that matches the entity in the content to be retrieved and the synonymous entity is determined as the entity to be retrieved.
3. The method according to claim 1, characterized in that The performing information encoding processing on the content to be retrieved to obtain first characteristic information of the content to be retrieved includes: Performing word segmentation processing on the content to be searched to obtain words in the content to be searched; Construct word vectors for the words in the content to be retrieved, and obtain a word vector set corresponding to the content to be retrieved; Perform feature extraction processing on the word vector set to obtain first feature information of the content to be retrieved.
4. The method according to claim 3, characterized in that Performing feature extraction processing on the word vector set to obtain first feature information of the content to be retrieved includes: Constructing a feature vector matrix corresponding to the content to be retrieved using the word vector set; Performing a convolution operation on the eigenvector matrix based on a convolution window of a target size to obtain a convolution result matrix; First feature information of the content to be retrieved is generated based on the convolution result matrix.
5. The method according to claim 1, wherein The performing information encoding processing on the sub-graph to obtain the second feature information of the sub-graph includes: Constructing entity word vectors corresponding to each entity in the sub-graph and relationship word vectors corresponding to each association relationship to obtain a graph feature set corresponding to the sub-graph; Perform feature extraction processing on the graph feature set to obtain second feature information of the sub-graph.
6. The method according to claim 5, characterized in that The performing feature extraction processing on the graph feature set to obtain the second feature information of the sub-graph includes: Using the entity word vectors in the graph feature set as node features of nodes in the graph structure, and using the relationship word vectors as edge features of edges connecting the nodes, to generate graph data; Extracting node features of neighboring nodes corresponding to each node in the graph data and edge features of connecting edges connected to each node as node surrounding state information of each node; The node surrounding state information is fused for each of the nodes to obtain the second feature information.
7. The method according to claim 1, characterized in that The performing feature fusion processing on the first feature information and the second feature information to obtain fused feature information includes: Performing a dot multiplication process on the first feature information and the second feature information to obtain product information of the first feature information and the second feature information; The product information is used as the fused feature information obtained by fusion.
8. The method according to claim 1, characterized in that The performing feature fusion processing on the first feature information and the second feature information to obtain fused feature information includes: performing splicing processing on the first feature information and the second feature information to obtain spliced information of the first feature information and the second feature information; The splicing information is used as the fusion feature information obtained by fusion.
9. The method according to any one of claims 1 to 8, characterized in that The obtaining of the search result corresponding to the content to be searched based on the fusion feature information includes: Performing a full connection operation on the fused feature information to obtain a probability distribution of the semantic category corresponding to the content to be retrieved; Content retrieval is performed based on the probability distribution of the semantic categories to obtain retrieval results of the content to be retrieved.
10. The method according to any one of claims 1 to 8, characterized in that The obtaining of the search result corresponding to the content to be searched based on the fusion feature information includes: Acquire a semantic information parsing table, wherein the semantic information parsing table includes fused feature information samples and semantic category information samples associated with the fused feature information samples; Querying the semantic information parsing table for a fused feature information sample that matches the fused feature information; Content retrieval is performed based on the semantic category information sample associated with the matched fusion feature information sample to obtain a retrieval result of the content to be retrieved.
11. A retrieval device based on knowledge graph, characterized in that: include: An acquisition module, configured to acquire content to be retrieved and a knowledge graph, wherein the knowledge graph includes an entity to be retrieved corresponding to the content to be retrieved and at least one associated entity having an associated relationship with the entity to be retrieved; An association module, configured to search the knowledge graph for an associated entity having a target association relationship with the entity to be retrieved, so as to determine a subgraph corresponding to the content to be retrieved from the knowledge graph; an encoding module, configured to perform information encoding processing on the content to be retrieved to obtain first characteristic information of the content to be retrieved, and to perform information encoding processing on the sub-graph to obtain second characteristic information of the sub-graph; a fusion module, configured to perform feature fusion processing on the first feature information and the second feature information to obtain fused feature information; A retrieval module, configured to obtain retrieval results corresponding to the content to be retrieved based on the fused feature information; The association module is used to perform entity linking on the entities in the content to be retrieved in the knowledge graph, so as to determine the entity to be retrieved corresponding to the content to be retrieved in the knowledge graph; Determine, from at least one of the related entities, a target related entity whose related distance to the entity to be retrieved is less than a predetermined threshold, wherein the related distance corresponds to the length of the related relationship; Acquire retrieval environment information corresponding to the content to be retrieved, wherein the retrieval environment information represents relevant information in a generation environment of the content to be retrieved; Filtering candidate related entities that match the search environment information from the target related entities; From the knowledge graph, a subgraph consisting of the entity to be retrieved, the candidate associated entities, and the association relationship between the entity to be retrieved and the candidate associated entities is obtained.
12. An electronic device, characterized in that: include: a memory storing computer-readable instructions; A processor reads the computer-readable instructions stored in the memory to execute the method according to any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that Computer-readable instructions are stored thereon, and when the computer-readable instructions are executed by a processor of a computer, the computer is caused to execute the method according to any one of claims 1 to 10.
14. A computer program product, comprising computer instructions, wherein the computer instructions are stored in a computer-readable storage medium; a processor of an electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to perform the method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Knowledge graph-based search method and device, computer equipment and storage medium
CN110321408A
Image scene retrieval system and method based on multi-modal knowledge graph
CN111694965A
Case recommendation method and device based on case knowledge graph and electronic equipment
CN112632224A