CN115168609A - Text matching method and device, computer equipment and storage medium - Google Patents

Text matching method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN115168609A
CN115168609A CN202210818339.7A CN202210818339A CN115168609A CN 115168609 A CN115168609 A CN 115168609A CN 202210818339 A CN202210818339 A CN 202210818339A CN 115168609 A CN115168609 A CN 115168609A
Authority
CN
China
Prior art keywords
knowledge graph
features corresponding
text information
text
attention
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210818339.7A
Other languages
Chinese (zh)
Inventor
黄剑辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202210818339.7A priority Critical patent/CN115168609A/en
Publication of CN115168609A publication Critical patent/CN115168609A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/36Creation of semantic tools, e.g. ontology or thesauri
    • G06F16/367Ontology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/35Clustering; Classification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/134Hyperlinking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods

Abstract

The embodiment of the application discloses a text matching method, a text matching device, computer equipment and a storage medium; the embodiment of the application can acquire text information and a knowledge graph; the method comprises the steps of coding text information to obtain semantic features corresponding to the text information, and coding a knowledge graph to obtain semantic features corresponding to the knowledge graph; based on semantic features corresponding to the text information, performing attention feature extraction on the semantic features corresponding to the knowledge graph to obtain attention features corresponding to the knowledge graph; based on semantic features corresponding to the knowledge graph, performing attention feature extraction on the semantic features corresponding to the text information to obtain attention features corresponding to the text information; and screening a target reference entity object matched with the entity object in the text information from at least one reference entity object in the knowledge graph based on the attention feature corresponding to the knowledge graph and the attention feature corresponding to the text information, so that the accuracy of the entity chain finger can be improved.

Description

Text matching method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a text matching method, apparatus, computer device, and storage medium.
Background
Internet web pages, such as news, blogs, etc., involve a large number of physical objects in the text information. Most web pages themselves do not have relevant descriptions and background descriptions about these entity objects. To help people better understand the content of a web page, many websites or authors will link the entity objects appearing in the web page to the corresponding knowledge base entries, providing the reader with more detailed background material. This practice actually establishes a link relationship between the internet web page and the entity object, and is therefore referred to as an entity chain finger. The inventor of the application finds that the existing entity chain finger method has the problem of low accuracy in the practice of the prior art.
Disclosure of Invention
The embodiment of the application provides a text matching method, a text matching device, computer equipment and a storage medium, and can improve the accuracy of entity chain fingers.
The embodiment of the application provides a text matching method, which comprises the following steps:
acquiring text information and a knowledge graph, wherein the text information comprises entity objects, and the knowledge graph comprises at least one reference entity object;
coding the text information to obtain semantic features corresponding to the text information, and coding the knowledge graph to obtain semantic features corresponding to the knowledge graph;
based on the semantic features corresponding to the text information, performing attention feature extraction on the semantic features corresponding to the knowledge graph to obtain attention features corresponding to the knowledge graph;
based on the semantic features corresponding to the knowledge graph, extracting attention features of the semantic features corresponding to the text information to obtain attention features corresponding to the text information;
and screening out a target reference entity object matched with the entity object in the text information from at least one reference entity object in the knowledge graph based on the attention feature corresponding to the knowledge graph and the attention feature corresponding to the text information.
Correspondingly, the embodiment of the present application further provides a text matching apparatus, including:
an acquisition unit configured to acquire text information and a knowledge graph, the text information including an entity object, wherein the knowledge graph includes at least one reference entity object;
the encoding unit is used for encoding the text information to obtain semantic features corresponding to the text information and encoding the knowledge graph to obtain semantic features corresponding to the knowledge graph;
a first attention feature extraction unit, configured to perform attention feature extraction on semantic features corresponding to the knowledge graph based on semantic features corresponding to the text information, so as to obtain attention features corresponding to the knowledge graph;
a second attention feature extraction unit, configured to perform attention feature extraction on semantic features corresponding to the text information based on semantic features corresponding to the knowledge graph, to obtain attention features corresponding to the text information;
and the screening unit is used for screening a target reference entity object matched with the entity object in the text information from at least one reference entity object in the knowledge graph based on the attention feature corresponding to the knowledge graph and the attention feature corresponding to the text information.
In an embodiment, the first attention feature extracting unit may include:
the first full-connection mapping subunit is configured to perform full-connection mapping on the semantic features corresponding to the text information to obtain full-connection features corresponding to the text information;
the first normalization subunit is configured to perform normalization processing on the full-link features corresponding to the text information to obtain normalized features corresponding to the text information;
and the first attention mapping subunit is configured to perform attention mapping on the semantic features corresponding to the knowledge graph by using the normalized features corresponding to the text information to obtain the attention features corresponding to the knowledge graph.
In an embodiment, the fully-connected mapping subunit may include:
a quantity determination module for determining quantity information of reference entity objects in the knowledge-graph;
the information generation module is used for generating full-connection mapping information and bias information based on the quantity information;
the multiplication operation module is used for carrying out multiplication operation on the semantic features corresponding to the text information and the full-connection mapping information to obtain initial full-connection features of the text information;
and the addition operation is used for adding the initial full-link characteristic of the text information and the bias information to obtain the full-link characteristic of the text information.
In an embodiment, the attention mapping subunit may include:
the logic operation module is used for carrying out logic operation processing on the semantic feature elements of the knowledge graph and the normalization feature elements of the corresponding text information to obtain attention feature elements;
and the integration module is used for integrating the attention characteristic elements to obtain the attention characteristic corresponding to the knowledge graph.
In an embodiment, the second attention feature extraction unit may include:
the statistical subunit is used for performing statistical operation on the semantic features corresponding to the knowledge graph to obtain statistical features corresponding to the knowledge graph;
the second full-connection mapping subunit is used for performing full-connection mapping on the statistical characteristics of the knowledge graph to obtain full-connection characteristics corresponding to the knowledge graph;
the second normalization subunit is used for performing normalization processing on the full-connection features of the knowledge graph to obtain normalization features corresponding to the knowledge graph;
and the second attention mapping subunit is configured to perform attention mapping on the semantic features corresponding to the text information by using the normalized features corresponding to the knowledge graph, so as to obtain the attention features corresponding to the text information.
In an embodiment, the encoding unit may include:
the feature extraction subunit is used for performing feature extraction on the text information to obtain initial features of the text information;
the feature mining subunit is used for performing feature mining on the initial features of the text information to obtain mined features of the text information;
and the first mapping subunit is used for mapping the mined features of the text information to a preset semantic space to obtain semantic features corresponding to the text information.
In an embodiment, the encoding unit may further include:
the knowledge graph identification subunit is used for identifying the knowledge graph to obtain entity information and entity relation information corresponding to the knowledge graph;
the spatial feature extraction subunit is configured to perform spatial feature extraction on the entity information of the knowledge graph and the entity relationship information to obtain a spatial feature corresponding to the entity information and a spatial feature corresponding to the entity relationship information;
a first feature fusion subunit, configured to fuse the spatial feature corresponding to the entity information and the spatial feature corresponding to the entity relationship information to obtain a target spatial feature;
and the second mapping subunit is used for mapping the target space features to a knowledge graph semantic space to obtain semantic features corresponding to the knowledge graph.
In an embodiment, the screening unit may include:
the second feature fusion subunit is used for fusing the attention features corresponding to the knowledge graph and the attention features corresponding to the text information to obtain fused attention features;
a probability distribution mapping subunit, configured to perform probability distribution mapping on the fused attention characteristics to obtain a probability distribution mapping result;
and the screening subunit is used for screening out a target reference entity object matched with the entity object in the text information from at least one reference entity object in the knowledge graph based on the probability distribution mapping result.
In an embodiment, the text matching apparatus provided in the embodiment of the present application may further include:
an object determination unit, configured to determine an associated entity object in the knowledge graph, which is in an association relationship with the target reference entity object;
the cleaning unit is used for collecting the attribute information of the associated entity object and cleaning the attribute information of the associated entity object to obtain the cleaned attribute information of the associated entity object;
and the sending unit is used for sending the attribute information of the associated entity object after cleaning.
Embodiments of the present application also provide a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The computer instructions are read by a processor of the computer device from a computer-readable storage medium, and the computer instructions are executed by the processor to cause the computer device to perform the method provided in the various alternatives of the aspect described above.
Correspondingly, an embodiment of the present application further provides a storage medium, where the storage medium stores instructions, and the instructions, when executed by a processor, implement the text matching method provided in any embodiment of the present application.
The method and the device for acquiring the text information and the knowledge graph can acquire the text information and the knowledge graph, wherein the text information comprises entity objects, and the knowledge graph comprises at least one reference entity object; coding the text information to obtain semantic features corresponding to the text information, and coding the knowledge graph to obtain semantic features corresponding to the knowledge graph; based on semantic features corresponding to the text information, performing attention feature extraction on the semantic features corresponding to the knowledge graph to obtain attention features corresponding to the knowledge graph; based on semantic features corresponding to the knowledge graph, performing attention feature extraction on the semantic features corresponding to the text information to obtain attention features corresponding to the text information; and screening a target reference entity object matched with the entity object in the text information from at least one reference entity object in the knowledge graph based on the attention feature corresponding to the knowledge graph and the attention feature corresponding to the text information, so that the accuracy of the entity chain finger can be improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the description below are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a scene schematic diagram of a text matching method provided in an embodiment of the present application;
fig. 2 is a schematic flowchart of a text matching method provided in an embodiment of the present application;
FIG. 3 is a schematic diagram of a scenario of a knowledge graph provided by an embodiment of the present application;
fig. 4 is a schematic view of another scene of the text matching method according to the embodiment of the present application;
FIG. 5 is a schematic flowchart of a text matching method provided in an embodiment of the present application;
FIG. 6 is a schematic structural diagram of a text matching apparatus according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a computer device provided in an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, however, the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The embodiment of the application provides a text matching method, which can be executed by a text matching device, and the text matching device can be integrated in computer equipment. Wherein the computer device may comprise at least one of a terminal and a server, etc. That is, the text matching method provided in the embodiment of the present application may be executed by a terminal, may be executed by a server, or may be executed by both a terminal and a server that are capable of communicating with each other.
The terminal may include, but is not limited to, a smart phone, a tablet Computer, a notebook Computer, a Personal Computer (PC), a smart home appliance, a wearable electronic device, a VR/AR device, a vehicle-mounted terminal, a smart voice interaction device, and the like.
The server may be an interworking server or a background server among a plurality of heterogeneous systems, an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, a cloud server providing basic cloud computing services such as cloud service, a cloud database, cloud computing, cloud functions, cloud storage, network service, cloud communication, middleware service, domain name service, security service, big data and artificial intelligence platforms, and the like.
It should be noted that the embodiments of the present application can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, driving assistance, and the like.
In an embodiment, as shown in fig. 1, the text matching apparatus may be integrated on a computer device such as a terminal or a server to implement the text matching method provided in the embodiment of the present application. Specifically, the server 11 may obtain text information and a knowledge graph, the text information including entity objects, wherein the knowledge graph includes at least one reference entity object; coding the text information to obtain semantic features corresponding to the text information, and coding the knowledge graph to obtain semantic features corresponding to the knowledge graph; based on semantic features corresponding to the text information, performing attention feature extraction on the semantic features corresponding to the knowledge graph to obtain attention features corresponding to the knowledge graph; based on semantic features corresponding to the knowledge graph, performing attention feature extraction on the semantic features corresponding to the text information to obtain attention features corresponding to the text information; and screening out a target reference entity object matched with the entity object in the text information from at least one reference entity object in the knowledge graph based on the attention feature corresponding to the knowledge graph and the attention feature corresponding to the text information. Then, the server 11 may also determine an associated entity object in the knowledge graph that has an association relationship with the target reference entity object; acquiring attribute information of the associated entity object, and cleaning the attribute information of the associated entity object to obtain the cleaned attribute information of the associated entity object; then, the server 11 may transmit the washed attribute information of the associated entity object to the terminal 10.
The following are detailed below, and it should be noted that the order of description of the following examples is not intended to limit the preferred order of the examples.
The embodiment of the present application will be described from the perspective of a text matching device, where the text matching device may be integrated in a computer device, and the computer device may be a server or a terminal.
As shown in fig. 2, a text matching method is provided, and the specific process includes:
101. textual information and a knowledge-graph are obtained, the textual information comprising entity objects, wherein the knowledge-graph comprises at least one reference entity object.
The text information may include text information in a plurality of different application scenarios. For example, the text information may be news, academic papers, blog content, and so on.
In an embodiment, the textual information may include an entity object. The entity object may refer to an object that exists in a text message in a guest manner and has an actual meaning. For example, a person name, a place name, an organization name, and the like in the text information may be entity objects.
In one embodiment, a large number of physical objects are involved in an internet web page, such as text information of news, blogs, etc. Most web pages themselves do not have relevant descriptions and background descriptions about these physical objects. To help people better understand the content of a web page, many websites or authors will link the entity objects appearing in the web page to the corresponding knowledge base entries, providing the reader with more detailed background material. This practice actually establishes a link relationship between the internet web page and the entity object, and is therefore called an entity chain finger. The Entity chain refers to two main tasks, entity Recognition (Entity Recognition) and Entity Disambiguation (Entity Disambiguation), which are classical problems in the field of natural language processing.
Entity recognition aims to find entity objects from text information, and most typically comprises three types of entity objects such as a person name, a place name, an organization name and the like. In recent years, attempts have been made to identify richer entity types, such as movie names, product names, and the like.
The same entity name in different environments may correspond to different entities, for example, "apple" may refer to a fruit, a famous IT company, or a movie. Such word ambiguity or ambiguity problems are prevalent in natural languages. Linking entity objects appearing in the textual information to a particular entity is a disambiguating process. The basic idea of disambiguation is to exploit the context in which an entity object appears, and analyze the probability at which different entity objects may appear there. For example, if iphone appears in a certain text message, then "apple" has a higher probability of pointing to the IT company called "apple" in the knowledge-graph.
In one embodiment, manual establishment of entity connection relationships is very laborious, and in order to enable computer equipment to automatically implement entity chain instructions, application of knowledge maps becomes an important technical premise.
The knowledge graph is a relational network obtained by connecting all kinds of Information (Heterogeneous Information). Each node in the relationship network represents an "entity" that exists in the real world, i.e., a reference entity object, and each edge is an "relationship" between entities. For example, as shown in FIG. 3, a diagram of a knowledge-graph is shown, wherein the knowledge-graph illustrates information of two people, both called Zhao four.
102. And coding the text information to obtain semantic features corresponding to the text information, and coding the knowledge graph to obtain semantic features corresponding to the knowledge graph.
In an embodiment, after the text information and the knowledge graph are obtained, in order to implement the process of entity chain indexing, the text information may be encoded to obtain semantic features corresponding to the text information, and the knowledge graph may be encoded to obtain semantic features corresponding to the knowledge graph.
In an embodiment, there are multiple methods that may perform encoding processing on text information to obtain semantic features corresponding to the text information.
In an embodiment, feature extraction and feature mining may be performed on the text information to obtain mined features of the text information, and then the mined features of the text information are mapped to a preset semantic space to obtain semantic features corresponding to the text information. Specifically, the step of "encoding the text information to obtain the semantic features corresponding to the text information" may include:
performing feature extraction on the text information to obtain initial features of the text information;
performing feature mining on the initial features of the text information to obtain mined features of the text information;
mapping the mined features of the text information to a preset semantic space to obtain semantic features corresponding to the text information.
For example, the convolution kernel may be used to perform feature extraction on the text information to obtain an initial feature of the text information. And then, forward retransmission and nonlinear conversion are carried out on the initial features of the text information to obtain mined features of the text information. And then multiplying the mined features of the text information by a preset semantic space matrix to map the mined features to a preset semantic space to obtain semantic features corresponding to the text information.
In an embodiment, a preset text matching model may be used to encode the text information to obtain a semantic feature corresponding to the text information.
The preset text matching model may be an artificial intelligence model.
Among them, artificial Intelligence (AI) is a theory, method, technique and application system that simulates, extends and expands human Intelligence using a digital computer or a machine controlled by a digital computer, senses the environment, acquires knowledge and uses the knowledge to obtain the best result. In other words, artificial intelligence is a comprehensive technique of computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can react in a manner similar to human intelligence. Artificial intelligence is the research of the design principle and the realization method of various intelligent machines, so that the machines have the functions of perception, reasoning and decision making.
The artificial intelligence technology is a comprehensive subject and relates to the field of extensive technology, namely the technology of a hardware level and the technology of a software level. The artificial intelligence infrastructure generally includes technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, mechatronics, and the like. The artificial intelligence software technology mainly comprises a computer vision technology, a voice processing technology, a natural language processing technology, machine learning/deep learning and the like.
Machine Learning (ML) is a multi-domain cross subject, and relates to multi-domain subjects such as probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and the like. The special research on how a computer simulates or realizes the learning behavior of human beings so as to acquire new knowledge or skills and reorganize the existing knowledge structure to continuously improve the performance of the computer. Machine learning is the core of artificial intelligence, is the fundamental approach to make computers have intelligence, and is applied in various fields of artificial intelligence. Machine learning and deep learning generally include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and teaching learning. Among them, reinforcement learning is a field of machine learning, emphasizing how to act based on the environment to achieve the maximum expected benefit. The deep reinforcement learning is to combine the deep learning and the reinforcement learning and solve the problem of the reinforcement learning by the deep learning technology.
For example, the text matching model may be at least one of Convolutional Neural Networks (CNNs), deconvolution Neural Networks (des-Convolutional Networks, DN), deep Neural Networks (DNNs), deep Convolutional Inverse Networks (DCIGNs), region-based Convolutional Networks (rcnnns), attention-based sequence Recommendation models (sansrec), region-based fast Convolutional Networks (fast register-based Convolutional Networks, RCNN), and Bidirectional coding (binary entry recommendations) models (transit models, bell models, conditional Field (gcrandom Field, crn), among others.
In an embodiment, the preset text matching model may include a text encoding module, a knowledge graph encoding module, a first attention feature extraction module, a second attention feature extraction module, and a filtering module.
The text encoding module can be used for encoding the text sample to obtain the semantic features corresponding to the text sample. For example, the text encoding module may be a Bidirectional Encoder and decoder (BERT) model.
The knowledge graph coding module can be used for coding the knowledge graph samples to obtain semantic features corresponding to the knowledge graph samples. For example, the knowledge-Graph coding module may be a Graph Convolutional Network (GCN).
The first attention feature extraction module may be configured to perform attention feature extraction on semantic features corresponding to the knowledge graph samples based on the semantic features corresponding to the text samples, so as to obtain attention features corresponding to the knowledge graph samples.
The second attention feature extraction module may be configured to perform attention feature extraction on semantic features corresponding to the text sample based on the semantic features corresponding to the knowledge graph sample, so as to obtain attention features corresponding to the text sample.
The screening module can be used for screening a target reference entity sample matched with an entity sample in the text sample from at least one reference entity sample in the knowledge-graph sample based on the attention feature corresponding to the knowledge-graph sample and the attention feature corresponding to the text sample. For example, the filtering module may be a classification classifier. For example, the screening module may be a classifier. As another example, the screening module may be a multi-classifier, and so on.
In an embodiment, a text encoding module in a preset text matching model may be used to encode the text information to obtain semantic features corresponding to the text information. For example, as shown in fig. 4, when the text encoding module is a BERT model, the text information may be encoded by using the BERT model, so as to obtain semantic features corresponding to the text information. For example, assuming that the text information is text, the semantic features corresponding to the text information may be expressed as follows:
text emb =BERT(text)
wherein text emb Semantic features of the textual information may be represented.
In an embodiment, there are multiple methods for encoding the knowledge graph to obtain semantic features corresponding to the knowledge graph.
In an embodiment, the step of "encoding the knowledge graph to obtain semantic features corresponding to the knowledge graph" may include:
identifying the knowledge graph to obtain entity information and entity relation information corresponding to the knowledge graph;
extracting spatial features of the entity information and the entity relationship information of the knowledge graph to obtain spatial features corresponding to the entity information and spatial features corresponding to the entity relationship information;
fusing the spatial features corresponding to the entity information and the spatial features corresponding to the entity relationship information to obtain target spatial features;
and mapping the target space features to the semantic space of the knowledge graph to obtain semantic features corresponding to the knowledge graph.
In an embodiment, the knowledge graph may be identified to obtain entity information and entity relationship information corresponding to the knowledge graph. The entity information corresponding to the knowledge graph can be used for explaining a reference entity object in the knowledge graph. For example, the entity object may be a matrix in which reference entity objects in the knowledge-graph are recorded. The entity relationship information may be used to describe relationships between reference entity objects in the knowledge-graph. For example, the entity relationship information may also be a matrix, and values in the matrix may indicate whether or not there is a relationship between reference entity objects in the knowledge graph.
In an embodiment, since the knowledge graph is a graph topology structure, and the nodes in the knowledge graph and the connection lines between the nodes form a spatial relationship, the entity information and the entity relationship information of the knowledge graph can be subjected to spatial feature extraction to obtain a spatial feature corresponding to the entity information and a spatial feature corresponding to the entity relationship information. For example, the spatial features of the entity information and the entity relationship information of the knowledge graph may be extracted by using laplace transform, fourier transform, or the like, to obtain the spatial features corresponding to the entity information and the spatial features corresponding to the entity relationship information.
In an embodiment, the spatial features corresponding to the entity information and the spatial features corresponding to the entity relationship information may be fused to obtain the target spatial features. And then, mapping the target space features to a knowledge graph semantic space to obtain semantic features corresponding to the knowledge graph. For example, the spatial features corresponding to the entity information and the spatial features corresponding to the entity relationship information may be spliced to obtain the target spatial features. And then, multiplying the target spatial features by a preset semantic mapping matrix to obtain semantic features corresponding to the knowledge graph.
In an embodiment, a preset text matching model may be used to encode the knowledge graph to obtain semantic features corresponding to the knowledge graph. For example, a knowledge graph coding module in the text matching model may be used to code a knowledge graph to obtain semantic features corresponding to the knowledge graph. For example, as shown in fig. 4, when the knowledge-graph coding module is a GCN, the GCN may be used to code the knowledge graph to obtain semantic features corresponding to the knowledge graph. For example, assuming the knowledge graph is a graph, the semantic features of the knowledge graph can be represented as follows:
graph emb =GCN(graph)
wherein, graph emb May be a semantic feature of the knowledge-graph.
In one embodiment, there is no time-series restriction between the step of "encoding the text information to obtain the semantic features corresponding to the text information" and the step of "encoding the knowledge graph to obtain the semantic features corresponding to the knowledge graph". For example, the two steps may be performed simultaneously or may be performed separately. For example, BRET and GCN may be included in the predetermined text matching model. The text information can be coded by using the BERT to obtain semantic features corresponding to the text information, and the knowledge graph is coded by using the GCN to obtain semantic features corresponding to the knowledge graph.
103. And based on the semantic features corresponding to the text information, extracting attention features of the semantic features corresponding to the knowledge graph to obtain the attention features corresponding to the knowledge graph.
In an embodiment, in order to improve the accuracy of an entity chain, the embodiment of the present application provides a cross attention feature extraction method, that is, based on semantic features corresponding to text information, attention feature extraction is performed on semantic features corresponding to a knowledge graph, so as to obtain attention features corresponding to the knowledge graph. In addition, attention feature extraction is carried out on semantic features corresponding to the text information based on the semantic features corresponding to the knowledge graph, and attention features corresponding to the text information are obtained.
In an embodiment, attention mechanism construction of semantic features of the knowledge graph can be completed based on semantic features of text information, namely extraction of key information on the knowledge graph side is guided based on the semantic features of the text information. Specifically, the step of performing attention feature extraction on semantic features corresponding to the knowledge graph based on semantic features corresponding to the text information to obtain attention features corresponding to the knowledge graph may include:
performing full-connection mapping on semantic features corresponding to the text information to obtain full-connection features corresponding to the text information;
carrying out normalization processing on the full-connection characteristics corresponding to the text information to obtain normalization characteristics corresponding to the text information;
and performing attention mapping on the semantic features corresponding to the knowledge graph by using the normalized features corresponding to the text information to obtain the attention features corresponding to the knowledge graph.
In an embodiment, the step of performing full-join mapping on the semantic features corresponding to the text information to obtain full-join features corresponding to the text information may include:
determining quantity information of reference entity objects in the knowledge graph;
generating full-connection mapping information and bias information based on the quantity information;
performing multiplication operation on semantic features corresponding to the text information and the full-connection mapping information to obtain initial full-connection features of the text information;
and performing addition operation on the initial full-link characteristic of the text information and the bias information to obtain the full-link characteristic of the text information.
The full-connection mapping information may be used to map semantic features corresponding to the text information into initial full-connection features. The bias information can be used for correcting the initial full-connection characteristic of the text information to obtain the full-connection characteristic of the text information, so that the accuracy of the full-connection characteristic is improved. For example, the full-connection mapping information may be a matrix and the offset information may be a vector.
In one embodiment, quantity information of reference entity objects in the knowledge-graph may be determined, and then full-connection mapping information and bias information may be generated based on the quantity information. For example, the dimension of the full-connection mapping information and the dimension of the bias information may be determined according to the number information of the reference entity objects. For example, assuming there are k reference entity objects in the knowledge-graph, then the dimension of the bias information may be k, and the dimension of the fully-connected mapping information may be k.
In an embodiment, the semantic features corresponding to the text information and the full-link mapping information may be multiplied to obtain initial full-link features of the text information. And then, carrying out addition operation on the initial full-link characteristic of the text information and the bias information to obtain the full-link characteristic of the text information.
For example, the full connection map may be as follows:
X=W 1 *text emb +b 1
wherein, X may represent a full connection feature corresponding to the text information. W 1 May represent a mapping parameter matrix, the dimension of which may be m x k, where m may be T emb The size of the dimension, k, may be the number of reference entity objects in the knowledge graph spectrum. b 1 It may be a bias constant with dimension k, so the dimension of X may also be k.
In an embodiment, the full-link feature corresponding to the text information may be normalized to obtain a normalized feature corresponding to the text information. The full-connection feature corresponding to the text information can be normalized in various ways to obtain the normalized feature corresponding to the text information. For example, the normalization processing may be performed on the full-link features corresponding to the text information by using a layer normalization (layer normalization), a batch normalization (batch normalization), a group normalization (groupprmalization), or other method, so as to obtain the normalized features corresponding to the text information.
For example, the normalization process may be as follows:
Figure BDA0003741722100000141
wherein, text1 emb The corresponding normalized features of the textual information may be represented. x is a radical of a fluorine atom i And x j Can represent the corresponding full connection character of the text informationAny one of the feature elements in feature X. Namely, the feature element of the current normalization processing in the full-link feature X corresponding to the text information is divided by the sum of all the feature elements in the full-link feature X corresponding to the text information, so as to obtain the normalization result of the feature element of the current normalization processing. And then, integrating the normalization results of all the feature elements in the full connection feature X to obtain the normalization feature corresponding to the text information.
In an embodiment, attention mapping may be performed on semantic features corresponding to the knowledge graph by using normalized features corresponding to the text information, so as to obtain attention features corresponding to the knowledge graph.
For example, the attention mechanism may be used to fuse the normalized features corresponding to the text information and the semantic features corresponding to the knowledge graph to obtain the attention features corresponding to the knowledge graph.
For another example, the normalized feature corresponding to the text information may include a plurality of normalized feature elements, and the semantic feature of the knowledge-graph includes a plurality of semantic feature elements. Then, the semantic feature elements of the knowledge graph and the normalization feature elements of the corresponding text information can be subjected to logical operation processing to obtain attention feature elements; and then integrating the attention characteristic elements to obtain the attention characteristic corresponding to the knowledge graph. Specifically, the step of performing attention mapping on semantic features corresponding to the knowledge graph by using normalized features corresponding to the text information to obtain attention features corresponding to the knowledge graph may include:
carrying out logical operation processing on semantic feature elements of the knowledge graph and normalization feature elements of corresponding text information to obtain attention feature elements;
and integrating the attention characteristic elements to obtain the attention characteristic corresponding to the knowledge graph.
In one embodiment, the normalized features of the textual information may be a matrix, and the elements in the matrix may be normalized feature elements. Similarly, the semantic features corresponding to the knowledge graph may be a matrix, and the elements in the matrix may be semantic feature elements.
In an embodiment, the semantic feature elements of the knowledge graph and the normalized feature elements of the corresponding text information may be subjected to logical operation processing to obtain the attention feature elements. For example, the semantic feature elements of the knowledge-graph and the normalized feature elements of the text information may be multiplied to obtain attention feature elements. And then, integrating the attention characteristic elements to obtain the attention characteristic corresponding to the knowledge graph.
For example, the attention features corresponding to the knowledge-graph can be expressed as follows:
Graph emb =sum[text1 i *graph i ],i=1,2,…,k
wherein, graph emb The corresponding attention characteristics of the knowledge-graph can be represented. text1 i Can express the normalized feature text1 corresponding to the text information emb Normalized feature elements of (1). graph i Semantic feature graph capable of representing knowledge graph samples emb Corresponding semantic feature elements.
In an embodiment, the attention feature extraction may be performed on the semantic features corresponding to the knowledge graph based on the semantic features corresponding to the text information by using a preset text matching model, so as to obtain the attention feature corresponding to the knowledge graph. For example, a first attention feature extraction module in a preset text matching model may be used to extract attention features of semantic features corresponding to a knowledge graph based on semantic features corresponding to text information, so as to obtain attention features corresponding to the knowledge graph. For example, as shown in fig. 4, 001 in fig. 4 may be a first attention feature extraction module, and the first attention feature extraction module may perform attention feature extraction on semantic features corresponding to a knowledge graph based on semantic features corresponding to text information to obtain attention features corresponding to the knowledge graph.
104. And based on the semantic features corresponding to the knowledge graph, performing attention feature extraction on the semantic features corresponding to the text information to obtain the attention features corresponding to the text information.
In an embodiment, attention feature extraction may be performed on semantic features corresponding to the text information based on semantic features corresponding to the knowledge graph, so as to obtain attention features corresponding to the text information.
In an embodiment, the step of performing attention feature extraction on semantic features corresponding to the text information based on semantic features corresponding to the knowledge graph to obtain attention features corresponding to the text information may include:
performing statistical operation on semantic features corresponding to the knowledge graph to obtain statistical features corresponding to the knowledge graph;
carrying out full-connection mapping on the statistical characteristics of the knowledge graph to obtain full-connection characteristics corresponding to the knowledge graph;
carrying out normalization processing on the full-connection characteristics of the knowledge graph to obtain normalization characteristics corresponding to the knowledge graph;
and performing attention mapping on semantic features corresponding to the text information by utilizing the normalization features corresponding to the knowledge graph to obtain attention features corresponding to the text information.
In one embodiment, since the knowledge graph may include thousands of hundreds of reference entity objects, the amount of information of the attention feature corresponding to the knowledge graph is relatively large. Therefore, the statistical operation can be performed on the semantic features corresponding to the knowledge graph samples to obtain the statistical features corresponding to the knowledge graph. Then, the attention mechanism construction of the semantic features of the text information is guided based on the statistical features of the knowledge graph, namely the extraction of the key information on the text information side is guided based on the statistical features of the knowledge graph.
In an embodiment, there are various ways to perform statistical operation on semantic features corresponding to the knowledge graph to obtain statistical features corresponding to the knowledge graph. For example, the semantic features corresponding to the knowledge graph may be averaged to obtain the statistical features corresponding to the knowledge graph. For another example, the variance may be calculated for the semantic features corresponding to the knowledge-graph to obtain the statistical features corresponding to the knowledge-graph, and so on. For example, the statistical features corresponding to the knowledge-graph may be as follows:
Avggraph emb =avgpooling(graph emb )
wherein, avggraph emb May be statistical features corresponding to the knowledge-graph.
In an embodiment, full-link mapping may be performed on the statistical features of the knowledge graph to obtain full-link features corresponding to the knowledge graph. For example, full-join mapping may be performed on the statistical features of the knowledge graph in the following manner to obtain full-join features corresponding to the knowledge graph:
Y=W 2 *Avggraph emb +b 2
wherein, W 2 May be a mapping parameter matrix with dimensions d n, where d may be Avggraph emb N may be a dimension corresponding to a semantic feature of the text information. b is a mixture of 2 May be a bias constant with dimension d, so the dimension of the fully connected features of the knowledge-graph sample is n x 1.
In an embodiment, the full-link features of the knowledge graph may be normalized to obtain normalized features corresponding to the knowledge graph. For example, the statistical features of the knowledge graph may be normalized in the following manner to obtain normalized features corresponding to the knowledge graph:
Figure BDA0003741722100000161
wherein, graph2 emb The corresponding normalized features of the knowledge-graph may be represented. y is i And y j Any one feature element in the fully connected feature Y corresponding to the knowledge-graph can be represented. Namely, the feature element of the current normalization processing in the full-connection feature Y corresponding to the knowledge graph is divided by the sum of all the feature elements in the full-connection feature Y corresponding to the knowledge graph to obtain the normalization result of the feature element of the current normalization processing. And then, integrating the normalization results of all the characteristic elements in the full-connection characteristic Y to obtain the normalization characteristic corresponding to the knowledge graph.
In an embodiment, attention mapping may be performed on semantic features corresponding to the text information by using normalized features corresponding to the knowledge graph, so as to obtain attention features corresponding to the text information.
For example, the attention mechanism may be used to fuse the normalization feature corresponding to the knowledge graph and the semantic feature corresponding to the text information to obtain the attention mechanism corresponding to the text information.
For another example, the attention mapping may be performed on the semantic features corresponding to the text information by using the normalized features corresponding to the knowledge graph in the following manner to obtain the attention features corresponding to the text information:
Text emb =sum[att2 i *T i ],i=1,2,…,n
wherein, text emb The attention feature corresponding to the text information may be represented. att2 i Can express the normalized feature Att2 corresponding to the knowledge graph emb The characteristic element of (1). T is i Semantic feature Text capable of representing Text information emb Corresponding feature elements.
In an embodiment, the attention feature extraction may be performed on the semantic features corresponding to the text information based on the semantic features corresponding to the knowledge graph by using a preset text matching model, so as to obtain the attention feature corresponding to the text information. For example, the attention feature extraction may be performed on the semantic features corresponding to the text information based on the semantic features corresponding to the knowledge graph by using a second attention feature extraction module in the preset text matching model, so as to obtain the attention features corresponding to the text information. For example, as shown in fig. 4, 002 in the figure may be the second attention feature extraction module. Through the second attention feature extraction module, the attention feature corresponding to the text information can be obtained.
105. And screening out a target reference entity object matched with the entity object in the text information from at least one reference entity object in the knowledge graph based on the attention feature corresponding to the knowledge graph and the attention feature corresponding to the text information.
In an embodiment, after obtaining the attention feature corresponding to the knowledge graph and the attention feature corresponding to the text information, a target reference entity object matching the entity object in the text information may be screened from at least one reference entity object in the knowledge graph based on the attention feature corresponding to the knowledge graph and the attention feature corresponding to the text information. That is, the entity object in the text message and the reference entity object in the knowledge-graph can be judged to be consistent through the attention feature corresponding to the knowledge-graph and the attention feature corresponding to the text message.
For example, the text message is "Zhang Sanzhan conference", wherein the knowledge graph collects a plurality of Zhang Sanzhan reference entity objects, for example, zhang Sanchi is star, zhang Sanchi is professor, zhang Sanchi is net red, and the like. By means of the attention feature corresponding to the knowledge graph and the attention feature corresponding to the text information, the fact that the entity object 'zhang san' in the text information is one of the multiple 'zhang san' in the knowledge graph can be judged.
In an embodiment, the attention feature corresponding to the knowledge graph and the attention feature corresponding to the text information may be fused to obtain a fused feature. And then, screening a target reference entity object matched with the entity object in the text information from at least one reference entity object in the knowledge graph according to the fused features. Specifically, the step of "screening out a target reference entity object matched with the entity object in the text information from at least one reference entity object in the knowledge graph based on the attention feature corresponding to the knowledge graph and the attention feature corresponding to the text information" may include:
fusing the attention features corresponding to the knowledge graph and the attention features corresponding to the text information to obtain fused attention features;
carrying out probability distribution mapping on the fused attention characteristics to obtain a probability distribution mapping result;
and screening out a target reference entity object matched with the entity object in the text information from at least one reference entity object in the knowledge graph based on the probability distribution mapping result.
In an embodiment, there are multiple ways to fuse the attention feature corresponding to the knowledge graph and the attention feature corresponding to the text information to obtain a fused attention feature. For example, the attention feature corresponding to the knowledge graph and the attention feature corresponding to the text information may be subjected to a stitching process to obtain the fused attention feature. For another example, the attention feature corresponding to the knowledge map and the attention feature corresponding to the text information may be multiplied to obtain the post-fusion attention information.
In an embodiment, probability distribution mapping may be performed on the fused attention feature information to obtain a probability distribution mapping result. Then, a target reference entity object matched with the entity object in the text information can be screened out from at least one reference entity object in the knowledge graph based on the probability distribution mapping result. For example, the fused attention feature information may be converted into a probability distribution mapping result using a preset probability distribution mapping space. The probability distribution mapping result may then indicate which reference entity object in the knowledge-graph has the highest matching probability with the entity object in the textual information. Therefore, a target reference entity object matching the entity object in the text information can be screened out from at least one reference entity object in the knowledge graph based on the probability distribution mapping result.
In an embodiment, a preset text matching model may be further used to screen out a target reference entity object matching the entity object in the text information from at least one reference entity object in the knowledge graph based on the attention feature corresponding to the knowledge graph and the attention feature corresponding to the text information. For example, a target reference entity object matched with the entity object in the text information may be screened out from at least one reference entity object in the knowledge graph based on the attention feature corresponding to the knowledge graph and the attention feature corresponding to the text information by a screening module in the preset text matching model. For example, the screening module may be a multi-classifier, and then, based on the attention feature corresponding to the knowledge graph and the attention feature corresponding to the text information, the multi-classifier may be used to screen out a target reference entity object matching the entity object in the text information from at least one reference entity object in the knowledge graph.
In an embodiment, after the target reference entity object matched with the entity object in the text information is screened out, an associated entity object having an association relationship with the target reference entity object in the knowledge graph can be further determined, and information of the associated entity object is sent. For example, if the entity object "zhang san" in the text information obtained by the method provided by the embodiment of the present application is "zhang san" of the star in the knowledge graph, the news of the movie release meeting and the dynamics of the latest movie participated by the star "zhang san" can be sent to the user. Specifically, the method provided by the embodiment of the present application further includes:
determining an associated entity object of an association relationship between the knowledge graph and the target reference entity object;
acquiring attribute information of the associated entity object, and cleaning the attribute information of the associated entity object to obtain the cleaned attribute information of the associated entity object;
and sending the attribute information of the associated entity object after cleaning.
The associated entity object of the association relationship of the target reference entity object may be an object having a connecting line segment with the target reference entity object in the knowledge graph. For example, as shown in fig. 3, the reference entity object "singer" may be an associated entity object of the reference entity object "zhao-si".
Attribute information of the associated entity object may then be collected. The attribute information of the associated entity object may be information describing a relationship between the associated entity object and the target reference entity object. For example, when the target reference entity object is star zhang, the associated entity object may be a movie that was performed zhang, the attribute information may be a showing time of the movie that was performed zhang, and the like.
In an embodiment, since the attribute information of the associated entity object is outdated, after the attribute information of the associated entity object is collected, the attribute information of the associated entity object may be cleaned to obtain the cleaned attribute information of the associated entity object. For example, the attribute information may be processed by using some preset cleaning rules to obtain the cleaned attribute information of the associated entity object. For example, the attribute information may be obtained by washing the time of the attribute information and the like. And then, the cleaned attribute information of the associated entity object can be sent and displayed to the user for browsing.
In an embodiment, before the method provided in the embodiment of the present application is implemented by using a preset text matching model, the model needs to be trained, so as to obtain the preset text matching model with a performance meeting the requirement. Specifically, the method provided in the embodiment of the present application may further include:
acquiring a training sample and a text matching model, wherein the training sample comprises a text sample and a knowledge graph sample;
the method comprises the steps of utilizing a text matching model to carry out coding processing on a text sample to obtain semantic features corresponding to the text sample, and utilizing the text matching model to carry out coding processing on a knowledge graph sample to obtain semantic features corresponding to the knowledge graph sample;
performing attention feature extraction on semantic features corresponding to the knowledge graph samples by using a text model based on the semantic features corresponding to the text samples to obtain attention features corresponding to the knowledge graph samples;
performing attention feature extraction on semantic features corresponding to the text samples by using a text matching model based on the semantic features corresponding to the knowledge graph samples to obtain the attention features corresponding to the text samples;
and training the text matching model by using the attention features corresponding to the knowledge graph samples and the attention features corresponding to the text samples to obtain a preset text matching model.
In the embodiment of the application, text information and a knowledge graph can be obtained, wherein the text information comprises entity objects, and the knowledge graph comprises at least one reference entity object; coding the text information to obtain semantic features corresponding to the text information, and coding the knowledge graph to obtain semantic features corresponding to the knowledge graph; based on the semantic features corresponding to the text information, performing attention feature extraction on the semantic features corresponding to the knowledge graph to obtain attention features corresponding to the knowledge graph; based on semantic features corresponding to the knowledge graph, performing attention feature extraction on the semantic features corresponding to the text information to obtain attention features corresponding to the text information; and screening out a target reference entity object matched with the entity object in the text information from at least one reference entity object in the knowledge graph based on the attention feature corresponding to the knowledge graph and the attention feature corresponding to the text information. According to the method and the device, the attention features corresponding to the text information are used for guiding the generation of the attention features of the knowledge graph, and the attention features corresponding to the text information are guided by the semantic features of the knowledge graph, so that the fusion and interaction of the features between the knowledge graph and the text information are enhanced, more accurate mapping is constructed between the features of the text information and the information of the knowledge graph, the target reference entity object matched with the entity object in the text information can be accurately screened out from at least one reference entity object in the knowledge graph, and the accuracy of entity chain fingers is improved.
The method described in the above examples is further illustrated in detail below by way of example.
The method of the embodiment of the present application will be described by taking an example in which a text matching method is integrated on a server.
In an embodiment, as shown in fig. 5, a text matching method specifically includes the following steps:
201. the server acquires training samples and a text matching model, wherein the training samples comprise text samples and knowledge graph samples.
The text matching model can be an artificial intelligence model which needs training and has performance which does not meet requirements.
In an embodiment, the text matching model may include a text encoding module, a knowledge-graph encoding module, a first attention feature extraction module, a second attention feature extraction module, and a filtering module.
The text encoding module can be used for encoding the text sample to obtain the semantic features corresponding to the text sample. For example, the text encoding module may be a Bidirectional Encoder and decoder (BERT) model.
The knowledge graph coding module can be used for coding the knowledge graph samples to obtain semantic features corresponding to the knowledge graph samples. For example, the knowledge-Graph coding module may be a Graph Convolutional Network (GCN).
The first attention feature extraction module may be configured to perform attention feature extraction on semantic features corresponding to the knowledge graph samples based on the semantic features corresponding to the text samples, so as to obtain attention features corresponding to the knowledge graph samples.
The second attention feature extraction module may be configured to perform attention feature extraction on semantic features corresponding to the text sample based on the semantic features corresponding to the knowledge graph sample, so as to obtain attention features corresponding to the text sample.
The screening module can be used for screening a target reference entity sample matched with an entity sample in the text sample from at least one reference entity sample in the knowledge-graph sample based on the attention feature corresponding to the knowledge-graph sample and the attention feature corresponding to the text sample. For example, the screening module may be a classification classifier. For example, the screening module may be a classifier. As another example, the screening module may be a multi-classifier, and so on.
The training samples may include training data used for training the text matching model. The training samples may include text samples and knowledge-graph samples, among others. The text samples may be text information used to train a text matching model. The knowledge-graph sample may be a knowledge-graph used to train a text matching model.
For example, the training samples may be: sande = [ { "achievement": four Zhao "," content _ m ": four Zhao attended the cultural exchange at Beijing rectangle this night" }, { "id": "id1", "name": four Zhao "," work ": "singer" \ 8230 [ { "label":1} ] ]. Wherein "Zhao Si attends a cultural exchange of rectangles in Beijing this evening" may be a text sample. "Zhao Qu" can be a sample of entities in a sample of text. { "id": id1"," name ": four Zhao", "work": "singer" \8230; "may be a knowledge-graph sample. Wherein [ { "label":1} ] can be used to illustrate the associations between the reference entity samples in the knowledge graph samples. For example, when the label between the reference entity samples in the knowledge-graph sample is 1, it indicates that there is an association relationship between the reference entity samples. And if the labels among the reference entity samples in the knowledge graph samples are 0, indicating that the reference entity samples do not have the association relationship.
202. The server uses the text matching model to encode the text sample to obtain the semantic features corresponding to the text sample, and uses the text matching model to encode the knowledge graph sample to obtain the semantic features corresponding to the knowledge graph sample.
In an embodiment, the server may perform encoding processing on the text sample by using the text matching model to obtain a semantic feature corresponding to the text sample. For example, the server may perform encoding processing on the text sample by using a text encoding module in the text matching model to obtain semantic features corresponding to the text sample. For example, when the text encoding module is a BERT model, the BERT model may be used to encode the text sample to obtain a semantic feature corresponding to the text sample. Specifically, it can be expressed as follows:
T emb =BERT(mention+content)
wherein content can refer to a text sample, and ention can refer to an entity sample in the text sample, T emb May refer to semantic features corresponding to text samples.
In an embodiment, the server may perform encoding processing on the knowledge-graph sample by using the text matching model to obtain semantic features corresponding to the knowledge-graph sample. For example, the server may perform encoding processing on the knowledge graph sample by using a knowledge graph encoding module in the text matching model to obtain semantic features corresponding to the knowledge graph sample. For example, when the knowledge graph coding module is a GCN network, the GCN network may be used to code the knowledge graph samples to obtain semantic features corresponding to the knowledge graph samples. The knowledge graph sample can be a graph topology structure, the entity samples in the knowledge graph sample can be nodes in the graph topology structure, and the relationship between the entity samples in the knowledge graph sample can be edges between the nodes in the graph topology structure. Therefore, the GCN takes the graph topology as input, and the final convergence can obtain the semantic features of the nodes and the edges between the nodes in each graph. The method comprises the following specific steps:
Node i |Side j =GCN(sub graph )
wherein sub graph Can express knowledge graph sample, node i Can be the semantic characteristics of entity samples in the knowledge graph samples, side j It may be a semantic feature that illustrates the knowledge of the relationships between entity samples in a spectrum sample.
Based on the above coding, semantic features corresponding to each entity in the knowledge graph can be obtained.
203. And the server extracts the attention characteristics of the semantic characteristics corresponding to the knowledge graph samples based on the semantic characteristics corresponding to the text samples by using the text model to obtain the attention characteristics corresponding to the knowledge graph samples.
In an embodiment, in order to improve the accuracy of the preset text matching model, so that the preset text matching model can accurately screen out a target reference entity object matched with an entity object in text information from at least one reference entity object in a knowledge graph sample, the embodiment of the application can realize the attention mechanism construction of the semantic features of the knowledge graph based on the semantic features of the text sample, namely, the extraction of key information on the knowledge graph side is guided based on the semantic features of the text sample.
In an embodiment, the server may perform attention feature extraction on semantic features corresponding to the knowledge graph samples based on semantic features corresponding to the text samples by using the text matching model, so as to obtain attention features corresponding to the knowledge graph samples. For example, the first attention feature extraction module in the text matching model may be used to extract the attention feature of the semantic features corresponding to the knowledge-graph samples based on the semantic features corresponding to the text samples, so as to obtain the attention feature corresponding to the knowledge-graph samples.
In one embodiment, the first attention feature extraction module may include two steps of full-join mapping and normalization.
For example, full-join processing is performed on semantic features corresponding to the text sample to obtain full-join features corresponding to the text sample. For example, the full connectivity map may be as follows:
X=W 1 *T emb +b 1
wherein X may represent a fully connected feature to which the text sample corresponds. W is a group of 1 A mapping parameter matrix may be represented, the dimension of which may be m x k, where m may be T emb The size of the dimension, k, may be the number of entity samples in the knowledge-graph. b 1 It may be a bias constant with dimension k, so the dimension of X may also be k.
Then, normalization processing can be performed on the full-connection features of the text sample to obtain normalization features corresponding to the text information. For example, the normalization process may be as follows:
Figure BDA0003741722100000241
wherein, att1 emb Corresponding normalized features of the text sample may be represented. x is the number of i And x j Any one feature element in the fully connected feature X corresponding to the text sample can be represented. Namely, the feature element of the current normalization processing in the full-connection feature X corresponding to the text sample is divided by the sum of all the feature elements in the full-connection feature X corresponding to the text sample, so as to obtain the normalization result of the feature element of the current normalization processing. And then, integrating the normalization results of all the feature elements in the full connection feature X to obtain the normalization feature corresponding to the text sample.
Then, attention mapping can be performed on the semantic features corresponding to the knowledge graph samples through the normalization features corresponding to the text samples, so that attention features corresponding to the knowledge graph samples are obtained. For example, the normalized features corresponding to the text samples and the semantic features corresponding to the knowledge-graph samples may be multiplied to obtain the attention features corresponding to the knowledge-graph samples. For example, the attention features corresponding to the knowledge-graph sample can be expressed as follows:
Graph emb =sum[att1 i *node i ],i=1,2,…,k
wherein, graph emb The attention characteristics corresponding to the knowledge-graph sample can be represented. att1 i Can express the normalized feature Att1 corresponding to the text information emb The characteristic element of (1). node(s) i Feature elements corresponding to semantic features of entity samples of the knowledge-graph sample can be represented.
204. And the server extracts the attention features of the semantic features corresponding to the text samples based on the semantic features corresponding to the knowledge graph samples by using the text matching model to obtain the attention features corresponding to the text samples.
In an embodiment, similar to step 203, the server may perform attention feature extraction on semantic features corresponding to the text samples based on semantic features corresponding to the knowledge-graph samples by using the text matching model, so as to improve the accuracy of the preset text matching model.
In an embodiment, the server may utilize a second attention feature extraction module in the text matching model to perform attention feature extraction on semantic features corresponding to the text sample based on semantic features corresponding to the knowledge-graph sample, so as to obtain attention features corresponding to the text sample.
In one embodiment, the second attention feature extraction model may include two steps of full-join mapping and normalization.
The information content of the attention features corresponding to the knowledge graph samples is large, so that the statistical operation can be performed on the semantic features corresponding to the knowledge graph samples to obtain the statistical features corresponding to the knowledge graph samples. For example, the semantic features of the entity samples in the knowledge graph sample and the semantic features of the relationship between the entity samples in the knowledge graph sample may be averaged to obtain the statistical features corresponding to the knowledge graph sample. For example, semantic features corresponding to a knowledge-graph sample can be as follows:
Avg enb =avgpooling(subgraph)
wherein, the subgraph can represent Node i And Side j
Then, full-connection mapping can be performed on the statistical characteristics of the knowledge graph samples to obtain full-connection characteristics corresponding to the knowledge graph samples. For example, the fully connected features corresponding to a knowledge-graph sample may be as follows:
Y=W 2 *Avg emb +b 2
wherein, W 2 May be a mapping parameter matrix with dimensions d n, where d may be Avg emb N may be a dimension corresponding to a semantic feature of the text sample. b 2 May be a bias constant with dimension d, so the dimension of the fully connected features of the knowledge-graph sample is n x 1.
Then, the full-link features of the knowledge graph samples can be normalized to obtain the normalized features corresponding to the knowledge graph samples. For example, the normalized features corresponding to the knowledge-graph samples can be as follows:
Figure BDA0003741722100000251
wherein, att2 emb The corresponding normalized features of the knowledge-graph sample may be represented. y is i And y j Any one feature element in the fully connected features Y corresponding to the knowledge-graph sample can be represented. Namely, the feature element of the current normalization processing in the fully-connected feature Y corresponding to the knowledge-graph sample is divided by the sum of all the feature elements in the fully-connected feature Y corresponding to the knowledge-graph sample, so as to obtain the normalization result of the feature element of the current normalization processing. And then, integrating the normalization results of all the characteristic elements in the full-link characteristic Y to obtain the normalization characteristic corresponding to the knowledge graph sample.
Then, attention mapping can be performed on semantic features corresponding to the text samples by using the normalized features corresponding to the knowledge graph samples, so as to obtain attention features corresponding to the text samples. For example, the normalized features corresponding to the knowledge graph samples and the semantic features corresponding to the text samples may be multiplied to obtain the attention features corresponding to the text samples. For example, the attention feature corresponding to the text sample can be expressed as follows:
T emb =sum[att2 i *T i ],i=1,2,…,n
wherein, T emb The corresponding attention feature of the text sample may be represented. att2 i Can express the normalized feature Att2 corresponding to the knowledge graph sample emb The characteristic element of (1). T is i Semantic feature T that can represent a text sample emb Corresponding feature elements.
205. And the server trains the text matching model by using the attention features corresponding to the knowledge graph samples and the attention features corresponding to the text samples to obtain a preset text matching model.
In an embodiment, the server may train the text matching model by using the attention feature corresponding to the knowledge graph sample and the attention feature corresponding to the text sample to obtain the preset text matching model.
For example, the server may fuse the attention feature corresponding to the knowledge graph sample and the attention feature corresponding to the text sample to obtain a fused attention feature. And then, judging whether the entity object in the text sample is consistent with the reference entity object in the knowledge graph sample by using a screening module in the text matching model.
For example, the attention feature corresponding to the knowledge graph sample and the attention feature corresponding to the text sample may be spliced to obtain the post-fusion attention feature. For example, it can be as follows:
Fusion=[text emb :Graph emb ]
among them, fusion may represent post-Fusion attention features.
Then, the fused attention features can be input into a classifier for discrimination to obtain a discrimination result. Then, loss information may be calculated based on the discrimination result, and then, the text may be subjected to the loss informationAnd adjusting model parameters in the matching model to obtain a preset text matching model. For example, the loss information may be calculated using a negative log-cross entropy function based on the discrimination result. Then, a mapping parameter matrix W in the text matching model can be matched according to the loss information 1 And W 2 And an offset vector b 1 And b 2 And adjusting the parameters to obtain a preset text matching model.
In the embodiment of the application, a server acquires a training sample and a text matching model, wherein the training sample comprises a text sample and a knowledge graph sample; the server uses the text matching model to encode the text sample to obtain semantic features corresponding to the text sample, and uses the text matching model to encode the knowledge graph sample to obtain semantic features corresponding to the knowledge graph sample; the server extracts the attention features of the semantic features corresponding to the knowledge graph samples based on the semantic features corresponding to the text samples by using the text model to obtain the attention features corresponding to the knowledge graph samples; the server extracts attention features of semantic features corresponding to the text samples based on the semantic features corresponding to the knowledge graph samples by using the text matching model to obtain the attention features corresponding to the text samples; the server trains the text matching model by using the attention features corresponding to the knowledge graph samples and the attention features corresponding to the text samples to obtain a preset text matching model, and the accuracy of entity chain fingers can be improved.
In order to better implement the text matching method provided by the embodiment of the application, in an embodiment, a text matching device is further provided, and the text matching device can be integrated into a computer device. The meaning of the noun is the same as that in the text matching method, and specific implementation details can refer to the description in the method embodiment.
In an embodiment, a text matching apparatus is provided, which may be specifically integrated in a computer device, as shown in fig. 6, and includes: the acquiring unit 301, the encoding unit 302, the first attention feature extracting unit 303, the second attention feature extracting unit 304, and the screening unit 305 are specifically as follows:
an obtaining unit 301, configured to obtain text information and a knowledge graph, where the text information includes an entity object, and the knowledge graph includes at least one reference entity object;
the encoding unit 302 is configured to perform encoding processing on the text information to obtain semantic features corresponding to the text information, and perform encoding processing on the knowledge graph to obtain semantic features corresponding to the knowledge graph;
a first attention feature extraction unit 303, configured to perform attention feature extraction on semantic features corresponding to the knowledge graph based on semantic features corresponding to the text information, to obtain attention features corresponding to the knowledge graph;
a second attention feature extraction unit 304, configured to perform attention feature extraction on semantic features corresponding to the text information based on semantic features corresponding to the knowledge graph, to obtain attention features corresponding to the text information;
a screening unit 305, configured to screen out, from at least one reference entity object in the knowledge graph, a target reference entity object matching the entity object in the text information based on the attention feature corresponding to the knowledge graph and the attention feature corresponding to the text information.
In an embodiment, the first attention feature extracting unit 303 may include:
the first full-connection mapping subunit is configured to perform full-connection mapping on the semantic features corresponding to the text information to obtain full-connection features corresponding to the text information;
the first normalization subunit is used for performing normalization processing on the full-connection features corresponding to the text information to obtain the normalization features corresponding to the text information;
and the first attention mapping subunit is configured to perform attention mapping on the semantic features corresponding to the knowledge graph by using the normalized features corresponding to the text information, so as to obtain the attention features corresponding to the knowledge graph.
In an embodiment, the fully-connected mapping subunit may include:
a quantity determination module for determining quantity information of reference entity objects in the knowledge-graph;
the information generation module is used for generating full-connection mapping information and bias information based on the quantity information;
the multiplication operation module is used for carrying out multiplication operation on the semantic features corresponding to the text information and the full-connection mapping information to obtain initial full-connection features of the text information;
and the addition operation is used for adding the initial full-link characteristic of the text information and the bias information to obtain the full-link characteristic of the text information.
In an embodiment, the attention mapping subunit may include:
the logic operation module is used for carrying out logic operation processing on the semantic feature elements of the knowledge graph and the corresponding normalization feature elements of the text information to obtain attention feature elements;
and the integration module is used for integrating the attention characteristic elements to obtain the attention characteristic corresponding to the knowledge graph.
In an embodiment, the second attention feature extraction unit 304 may include:
the statistical subunit is used for performing statistical operation on the semantic features corresponding to the knowledge graph to obtain statistical features corresponding to the knowledge graph;
the second full-connection mapping subunit is used for performing full-connection mapping on the statistical characteristics of the knowledge graph to obtain full-connection characteristics corresponding to the knowledge graph;
the second normalization subunit is used for performing normalization processing on the full-connection features of the knowledge graph to obtain normalization features corresponding to the knowledge graph;
and the second attention mapping subunit is configured to perform attention mapping on the semantic features corresponding to the text information by using the normalized features corresponding to the knowledge graph, so as to obtain the attention features corresponding to the text information.
In an embodiment, the encoding unit 302 may include:
the feature extraction subunit is used for performing feature extraction on the text information to obtain initial features of the text information;
the feature mining subunit is used for performing feature mining on the initial features of the text information to obtain mined features of the text information;
and the first mapping subunit is used for mapping the mined features of the text information to a preset semantic space to obtain semantic features corresponding to the text information.
In an embodiment, the encoding unit 302 may further include:
the knowledge graph identification subunit is used for identifying the knowledge graph to obtain entity information and entity relation information corresponding to the knowledge graph;
the spatial feature extraction subunit is configured to perform spatial feature extraction on the entity information of the knowledge graph and the entity relationship information to obtain a spatial feature corresponding to the entity information and a spatial feature corresponding to the entity relationship information;
the first feature fusion subunit is configured to fuse the spatial feature corresponding to the entity information and the spatial feature corresponding to the entity relationship information to obtain a target spatial feature;
and the second mapping subunit is used for mapping the target space features to a knowledge graph semantic space to obtain semantic features corresponding to the knowledge graph.
In an embodiment, the screening unit 305 may include:
the second feature fusion subunit is used for fusing the attention feature corresponding to the knowledge graph and the attention feature corresponding to the text information to obtain a fused attention feature;
a probability distribution mapping subunit, configured to perform probability distribution mapping on the fused attention characteristics to obtain a probability distribution mapping result;
and the screening subunit is used for screening a target reference entity object matched with the entity object in the text information from at least one reference entity object in the knowledge graph based on the probability distribution mapping result.
In an embodiment, the text matching apparatus provided in the embodiment of the present application may further include:
an object determination unit, configured to determine an associated entity object in the knowledge graph, which is associated with the target reference entity object;
the cleaning unit is used for collecting the attribute information of the associated entity object and cleaning the attribute information of the associated entity object to obtain the cleaned attribute information of the associated entity object;
and the sending unit is used for sending the attribute information of the associated entity object after cleaning.
In a specific implementation, the above units may be implemented as independent entities, or may be combined arbitrarily to be implemented as the same or several entities, and the specific implementation of the above units may refer to the foregoing method embodiments, which are not described herein again.
The text matching device can improve the accuracy of entity chain fingers.
The embodiment of the present application further provides a computer device, where the computer device may include a terminal or a server, for example, the computer device may be used as a text matching terminal, and the terminal may be a mobile phone, a tablet computer, or the like; also for example, the computer device may be a server, such as a text matching server, or the like. As shown in fig. 7, it shows a schematic structural diagram of a terminal according to an embodiment of the present application, specifically:
the computer device may include components such as a processor 401 of one or more processing cores, memory 402 of one or more computer-readable storage media, a power supply 403, and an input unit 404. Those skilled in the art will appreciate that the computer device configuration illustrated in FIG. 7 does not constitute a limitation of computer devices, and may include more or fewer components than those illustrated, or some components may be combined, or a different arrangement of components. Wherein:
the processor 401 is a control center of the computer device, connects various parts of the entire computer device using various interfaces and lines, performs various functions of the computer device and processes data by operating or executing software programs and/or modules stored in the memory 402 and calling data stored in the memory 402. Optionally, processor 401 may include one or more processing cores; preferably, the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly handles operating systems, user pages, application programs, and the like, and the modem processor mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 401.
The memory 402 may be used to store software programs and modules, and the processor 401 executes various functional applications and data processing by operating the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data created according to use of the computer device, and the like. Further, the memory 402 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 access to the memory 402.
The computer device further comprises a power supply 403 for supplying power to the various components, and preferably, the power supply 403 is logically connected to the processor 401 via a power management system, so that functions of managing charging, discharging, and power consumption are implemented via the power management system. The power supply 403 may also include any component of one or more dc or ac power sources, recharging systems, power failure detection circuitry, power converters or inverters, power status indicators, and the like.
The computer device may also include an input unit 404, the input unit 404 being operable to receive input numeric or character information and to generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
Although not shown, the computer device may further include a display unit and the like, which are not described in detail herein. Specifically, in this embodiment, the processor 401 in the computer device loads the executable file corresponding to the process of one or more application programs into the memory 402 according to the following instructions, and the processor 401 runs the application programs stored in the memory 402, thereby implementing various functions as follows:
acquiring text information and a knowledge graph, wherein the text information comprises entity objects, and the knowledge graph comprises at least one reference entity object;
coding the text information to obtain semantic features corresponding to the text information, and coding the knowledge graph to obtain semantic features corresponding to the knowledge graph;
based on the semantic features corresponding to the text information, performing attention feature extraction on the semantic features corresponding to the knowledge graph to obtain attention features corresponding to the knowledge graph;
based on the semantic features corresponding to the knowledge graph, extracting attention features of the semantic features corresponding to the text information to obtain attention features corresponding to the text information;
and screening out a target reference entity object matched with the entity object in the text information from at least one reference entity object in the knowledge graph based on the attention feature corresponding to the knowledge graph and the attention feature corresponding to the text information.
The above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
According to an aspect of the application, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and executes the computer instructions, so that the computer device executes the method provided in the various alternative implementations of the above embodiments.
It will be understood by those skilled in the art that all or part of the steps of the methods of the above embodiments may be implemented by a computer program, which may be stored in a computer-readable storage medium and loaded and executed by a processor, or by a computer program controlling associated hardware.
To this end, embodiments of the present application further provide a storage medium, in which a computer program is stored, where the computer program can be loaded by a processor to execute the steps in any one of the text matching methods provided in the embodiments of the present application. For example, the computer program may perform the steps of:
acquiring text information and a knowledge graph, wherein the text information comprises entity objects, and the knowledge graph comprises at least one reference entity object;
coding the text information to obtain semantic features corresponding to the text information, and coding the knowledge graph to obtain semantic features corresponding to the knowledge graph;
based on semantic features corresponding to the text information, performing attention feature extraction on the semantic features corresponding to the knowledge graph to obtain attention features corresponding to the knowledge graph;
based on the semantic features corresponding to the knowledge graph, extracting attention features of the semantic features corresponding to the text information to obtain attention features corresponding to the text information;
and screening out a target reference entity object matched with the entity object in the text information from at least one reference entity object in the knowledge graph based on the attention feature corresponding to the knowledge graph and the attention feature corresponding to the text information.
The above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
Since the computer program stored in the storage medium can execute the steps in any text matching method provided in the embodiments of the present application, beneficial effects that can be achieved by any text matching method provided in the embodiments of the present application can be achieved, which are detailed in the foregoing embodiments and will not be described herein again.
The text matching method, the text matching device, the computer device and the storage medium provided by the embodiments of the present application are described in detail above, and a specific example is applied in the text to explain the principle and the implementation of the present application, and the description of the embodiments above is only used to help understand the method and the core idea of the present application; meanwhile, for those skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (15)

1. A method of text matching, comprising:
acquiring text information and a knowledge graph, wherein the text information comprises entity objects, and the knowledge graph comprises at least one reference entity object;
coding the text information to obtain semantic features corresponding to the text information, and coding the knowledge graph to obtain semantic features corresponding to the knowledge graph;
based on semantic features corresponding to the text information, performing attention feature extraction on the semantic features corresponding to the knowledge graph to obtain attention features corresponding to the knowledge graph;
based on semantic features corresponding to the knowledge graph, performing attention feature extraction on the semantic features corresponding to the text information to obtain attention features corresponding to the text information;
and screening out a target reference entity object matched with the entity object in the text information from at least one reference entity object in the knowledge graph based on the attention feature corresponding to the knowledge graph and the attention feature corresponding to the text information.
2. The method according to claim 1, wherein the performing attention feature extraction on semantic features corresponding to the knowledge graph based on semantic features corresponding to the text information to obtain attention features corresponding to the knowledge graph comprises:
performing full-connection mapping on semantic features corresponding to the text information to obtain full-connection features corresponding to the text information;
carrying out normalization processing on the full-connection features corresponding to the text information to obtain normalization features corresponding to the text information;
and performing attention mapping on the semantic features corresponding to the knowledge graph by using the normalization features corresponding to the text information to obtain the attention features corresponding to the knowledge graph.
3. The method according to claim 2, wherein the performing full-link mapping on the semantic features corresponding to the text information to obtain full-link features corresponding to the text information includes:
determining quantity information of reference entity objects in the knowledge-graph;
generating full-connection mapping information and bias information based on the quantity information;
performing multiplication operation on the semantic features corresponding to the text information and the full-connection mapping information to obtain initial full-connection features of the text information;
and adding the initial full-link characteristics of the text information and the bias information to obtain the full-link characteristics of the text information.
4. The method according to claim 2, wherein the normalized feature corresponding to the text information comprises a plurality of normalized feature elements; the semantic features of the knowledge-graph comprise a plurality of semantic feature elements; the attention mapping is performed on the semantic features corresponding to the knowledge graph by using the normalization features corresponding to the text information to obtain the attention features corresponding to the knowledge graph, and the attention mapping includes:
carrying out logical operation processing on semantic feature elements of the knowledge graph and normalization feature elements of corresponding text information to obtain attention feature elements;
and integrating the attention characteristic elements to obtain the attention characteristic corresponding to the knowledge graph.
5. The method of claim 1, wherein the performing attention feature extraction on the semantic features corresponding to the text information based on the semantic features corresponding to the knowledge graph to obtain the attention features corresponding to the text information comprises:
performing statistical operation on the semantic features corresponding to the knowledge graph to obtain statistical features corresponding to the knowledge graph;
performing full-connection mapping on the statistical characteristics of the knowledge graph to obtain full-connection characteristics corresponding to the knowledge graph;
carrying out normalization processing on the full-connection features of the knowledge graph to obtain normalization features corresponding to the knowledge graph;
and performing attention mapping on semantic features corresponding to the text information by utilizing the normalization features corresponding to the knowledge graph to obtain attention features corresponding to the text information.
6. The method according to claim 1, wherein said encoding the text information to obtain a semantic feature corresponding to the text information includes:
extracting the features of the text information to obtain the initial features of the text information;
performing feature mining on the initial features of the text information to obtain mined features of the text information;
mapping the mined features of the text information to a preset semantic space to obtain semantic features corresponding to the text information.
7. The method according to claim 1, wherein the encoding the knowledge-graph to obtain semantic features corresponding to the knowledge-graph comprises:
identifying the knowledge graph to obtain entity information and entity relation information corresponding to the knowledge graph;
extracting spatial features of the entity information and the entity relationship information of the knowledge graph to obtain spatial features corresponding to the entity information and spatial features corresponding to the entity relationship information;
fusing the spatial features corresponding to the entity information and the spatial features corresponding to the entity relationship information to obtain target spatial features;
and mapping the target space features to a knowledge graph semantic space to obtain semantic features corresponding to the knowledge graph.
8. The method of claim 1, wherein the screening out a target reference entity object matching an entity object in the text information from at least one reference entity object in the knowledge-graph based on the attention feature corresponding to the knowledge-graph and the attention feature corresponding to the text information comprises:
fusing the attention feature corresponding to the knowledge graph and the attention feature corresponding to the text information to obtain a fused attention feature;
carrying out probability distribution mapping on the fused attention characteristics to obtain a probability distribution mapping result;
and screening out a target reference entity object matched with the entity object in the text information from at least one reference entity object in the knowledge graph based on the probability distribution mapping result.
9. The method of claim 1, wherein the knowledge-graph further comprises associations between different reference entity objects; the method further comprises the following steps:
determining associated entity objects in the knowledge graph having an association relationship with the target reference entity object;
collecting attribute information of the associated entity object, and cleaning the attribute information of the associated entity object to obtain cleaned attribute information of the associated entity object;
and sending the attribute information of the associated entity object after cleaning.
10. The method according to claim 1, wherein the encoding the text information to obtain semantic features corresponding to the text information and the encoding the knowledge graph to obtain semantic features corresponding to the knowledge graph comprises:
coding the text information by using a preset text matching model to obtain semantic features corresponding to the text information, and coding the knowledge graph by using the preset text matching model to obtain semantic features corresponding to the knowledge graph;
the extracting attention features of the semantic features corresponding to the knowledge graph based on the semantic features corresponding to the text information to obtain the attention features corresponding to the knowledge graph includes:
performing attention feature extraction on semantic features corresponding to the knowledge graph by using the preset text matching model based on the semantic features corresponding to the text information to obtain attention features corresponding to the knowledge graph;
the extracting attention features of the semantic features corresponding to the text information based on the semantic features corresponding to the knowledge graph to obtain the attention features corresponding to the text information includes:
performing attention feature extraction on semantic features corresponding to the text information by using the preset text matching model based on the semantic features corresponding to the knowledge graph to obtain attention features corresponding to the text information;
the screening of the target reference entity object matched with the entity object in the text information from the at least one reference entity object in the knowledge graph based on the attention feature corresponding to the knowledge graph and the attention feature corresponding to the text information comprises:
and screening a target reference entity object matched with the entity object in the text information from at least one reference entity object in the knowledge graph by using the preset text matching model based on the attention feature corresponding to the knowledge graph and the attention feature corresponding to the text information.
11. The method of claim 10, further comprising:
acquiring a training sample and a text matching model, wherein the training sample comprises a text sample and a knowledge graph sample;
the text matching model is used for coding the text sample to obtain semantic features corresponding to the text sample, and the text matching model is used for coding the knowledge graph sample to obtain semantic features corresponding to the knowledge graph sample;
performing attention feature extraction on semantic features corresponding to the knowledge graph samples by using the text model based on the semantic features corresponding to the text samples to obtain attention features corresponding to the knowledge graph samples;
performing attention feature extraction on semantic features corresponding to the text samples by using the text matching model based on the semantic features corresponding to the knowledge graph samples to obtain attention features corresponding to the text samples;
and training the text matching model by using the attention feature corresponding to the knowledge graph sample and the attention feature corresponding to the text sample to obtain the preset text matching model.
12. A text matching apparatus, comprising:
an acquisition unit configured to acquire text information and a knowledge graph, the text information including an entity object, wherein the knowledge graph includes at least one reference entity object;
the encoding unit is used for encoding the text information to obtain semantic features corresponding to the text information and encoding the knowledge graph to obtain semantic features corresponding to the knowledge graph;
a first attention feature extraction unit, configured to perform attention feature extraction on semantic features corresponding to the knowledge graph based on semantic features corresponding to the text information, to obtain attention features corresponding to the knowledge graph;
a second attention feature extraction unit, configured to perform attention feature extraction on semantic features corresponding to the text information based on semantic features corresponding to the knowledge graph, to obtain attention features corresponding to the text information;
and the screening unit is used for screening a target reference entity object matched with the entity object in the text information from at least one reference entity object in the knowledge graph based on the attention feature corresponding to the knowledge graph and the attention feature corresponding to the text information.
13. A computer device comprising a memory and a processor; the memory stores an application program, and the processor is configured to execute the application program in the memory to perform the operation of the text matching method according to any one of claims 1 to 11.
14. A computer readable storage medium storing instructions adapted to be loaded by a processor to perform the steps of the text matching method according to any of claims 1 to 11.
15. A computer program product comprising a computer program or instructions, characterized in that the computer program or instructions, when executed by a processor, implement the steps in the text matching method of any of claims 1 to 11.
CN202210818339.7A 2022-07-12 2022-07-12 Text matching method and device, computer equipment and storage medium Pending CN115168609A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210818339.7A CN115168609A (en) 2022-07-12 2022-07-12 Text matching method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210818339.7A CN115168609A (en) 2022-07-12 2022-07-12 Text matching method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115168609A true CN115168609A (en) 2022-10-11

Family

ID=83492273

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210818339.7A Pending CN115168609A (en) 2022-07-12 2022-07-12 Text matching method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115168609A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116702784A (en) * 2023-08-03 2023-09-05 腾讯科技(深圳)有限公司 Entity linking method, entity linking device, computer equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116702784A (en) * 2023-08-03 2023-09-05 腾讯科技(深圳)有限公司 Entity linking method, entity linking device, computer equipment and storage medium
CN116702784B (en) * 2023-08-03 2023-11-28 腾讯科技(深圳)有限公司 Entity linking method, entity linking device, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
CN112199375B (en) Cross-modal data processing method and device, storage medium and electronic device
CN111324774B (en) Video duplicate removal method and device
CN111625715B (en) Information extraction method and device, electronic equipment and storage medium
CN113761250A (en) Model training method, merchant classification method and device
CN114330966A (en) Risk prediction method, device, equipment and readable storage medium
CN113392179A (en) Text labeling method and device, electronic equipment and storage medium
CN111324773A (en) Background music construction method and device, electronic equipment and storage medium
CN114282059A (en) Video retrieval method, device, equipment and storage medium
CN115168609A (en) Text matching method and device, computer equipment and storage medium
CN112598039A (en) Method for acquiring positive sample in NLP classification field and related equipment
CN117033626A (en) Text auditing method, device, equipment and storage medium
CN116955707A (en) Content tag determination method, device, equipment, medium and program product
CN113392220B (en) Knowledge graph generation method and device, computer equipment and storage medium
CN112801053B (en) Video data processing method and device
CN115129885A (en) Entity chain pointing method, device, equipment and storage medium
CN113886547A (en) Client real-time conversation switching method and device based on artificial intelligence and electronic equipment
Xu et al. Estimating similarity of rich internet pages using visual information
CN114610758A (en) Data processing method and device based on data warehouse, readable medium and equipment
CN114449342A (en) Video recommendation method and device, computer readable storage medium and computer equipment
JP2022111020A (en) Transfer learning method of deep learning model based on document similarity learning and computer device
CN113779248A (en) Data classification model training method, data processing method and storage medium
CN113535946A (en) Text identification method, device and equipment based on deep learning and storage medium
CN114741587A (en) Article recommendation method, device, medium and equipment
CN111768214A (en) Product attribute prediction method, system, device and storage medium
CN117173731B (en) Model training method, image processing method and related device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40074518

Country of ref document: HK