CN111831911A - Query information processing method and device, storage medium and electronic device - Google Patents
Query information processing method and device, storage medium and electronic device Download PDFInfo
- Publication number
- CN111831911A CN111831911A CN202010688963.0A CN202010688963A CN111831911A CN 111831911 A CN111831911 A CN 111831911A CN 202010688963 A CN202010688963 A CN 202010688963A CN 111831911 A CN111831911 A CN 111831911A
- Authority
- CN
- China
- Prior art keywords
- entity
- semantic
- word
- query information
- candidate
- 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.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/953—Querying, e.g. by the use of web search engines
- G06F16/9535—Search customisation based on user profiles and personalisation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/335—Filtering based on additional data, e.g. user or group profiles
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/36—Creation of semantic tools, e.g. ontology or thesauri
- G06F16/367—Ontology
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/279—Recognition of textual entities
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Computational Linguistics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Animal Behavior & Ethology (AREA)
- Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- Audiology, Speech & Language Pathology (AREA)
- General Health & Medical Sciences (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The application relates to a query information processing method, a query information processing device, a storage medium and an electronic device, wherein the method comprises the following steps: performing entity identification on the acquired query information to obtain a plurality of entity words corresponding to the query information, wherein the query information is used for querying data stored in a database; for each entity word, acquiring at least one candidate entity matched with the entity word from entity nodes included in a knowledge graph, wherein the knowledge graph is constructed for data stored in a database; constructing a semantic structure chart corresponding to query information based on candidate entities corresponding to all entity words, wherein semantic nodes in the semantic structure chart represent the semantics of all entity words, and connecting lines in the semantic structure chart represent the semantic relation between all semantic nodes and data to be queried; and querying the database according to the semantic structure diagram. The method and the device solve the technical problem that the accuracy rate of understanding the intention of inquiring the information is low in the related technology.
Description
Technical Field
The present application relates to the field of computers, and in particular, to a method and an apparatus for processing query information, a storage medium, and an electronic apparatus.
Background
With the rapid development of the internet, network content covers all walks of life, and helps a user to quickly search desired content, which is a basic target of a search engine, but the search intentions of the user are wide, the query information (query) expression input by the user is often not standard, ambiguity and ambiguity exist, great difficulty is brought to the intention understanding of the query information, and whether the intention understanding of the query information is correct or not directly affects the quality of search results.
The current intention understanding of query information mainly comprises a template matching method and a machine learning method based on intention classification and slot filling. The method based on template matching needs to manually predefine common query information templates and match corresponding templates based on the query information of users so as to identify corresponding intentions. The method of machine learning based on intention classification and slot filling requires that an intention classification system and elements needing to be filled under different classifications are firstly established, and then an intention classifier and a slot filling model are trained by marking training data. However, this method depends on the training corpus, and marking the training corpus consumes a lot of manpower, increases new intention categories or slots, and requires marking corresponding training data and performing model training again. On the other hand, due to the profound precision of the language, the intention understanding of a lot of query information needs enough prior knowledge, the existing prior knowledge is difficult to be utilized by the existing method, and the intention of the query information cannot be correctly understood under the condition that the training corpus is sparse.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The application provides a query information processing method, a query information processing device, a storage medium and an electronic device, which are used for at least solving the technical problem of low accuracy in understanding the intention of query information in the related art.
According to an aspect of an embodiment of the present application, there is provided a method for processing query information, including:
performing entity identification on the acquired query information to obtain a plurality of entity words corresponding to the query information, wherein the query information is used for querying data stored in a database;
for each entity word, acquiring at least one candidate entity matched with the entity word from entity nodes included in a knowledge graph, wherein the knowledge graph is constructed for data stored in the database;
constructing a semantic structure chart corresponding to the query information based on candidate entities corresponding to all entity words, wherein semantic nodes in the semantic structure chart represent the semantics of all entity words, and connecting lines in the semantic structure chart represent the semantic relationship between all semantic nodes and data to be queried;
and querying the database according to the semantic structure diagram.
According to another aspect of the embodiments of the present application, there is also provided a device for processing query information, including:
the identification module is used for carrying out entity identification on the acquired query information to obtain a plurality of entity words corresponding to the query information, wherein the query information is used for querying data stored in a database;
the acquisition module is used for acquiring at least one candidate entity matched with the entity word from entity nodes included in a knowledge graph aiming at each entity word, wherein the knowledge graph is constructed for data stored in the database;
the building module is used for building a semantic structure chart corresponding to the query information based on candidate entities corresponding to all entity words, wherein semantic nodes in the semantic structure chart represent the semantics of all entity words, and connecting lines in the semantic structure chart represent the semantic relation between all semantic nodes and data to be queried;
and the query module is used for querying the database according to the semantic structure chart.
According to another aspect of the embodiments of the present application, there is also provided a computer-readable storage medium including a stored program which, when executed, performs the above-mentioned method.
According to another aspect of the embodiments of the present application, there is also provided an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the above method through the computer program.
In the embodiment of the application, entity identification is carried out on the obtained query information to obtain a plurality of entity words corresponding to the query information, wherein the query information is used for querying data stored in a database; for each entity word, acquiring at least one candidate entity matched with the entity word from entity nodes included in a knowledge graph, wherein the knowledge graph is constructed for data stored in a database; constructing a semantic structure chart corresponding to query information based on candidate entities corresponding to all entity words, wherein semantic nodes in the semantic structure chart represent the semantics of all entity words, and connecting lines in the semantic structure chart represent the semantic relation between all semantic nodes and data to be queried; according to the method for inquiring the database by the semantic structure chart, the prior knowledge of the knowledge chart is utilized to understand the inquiry information, different components in the inquiry information are related to the entity in the knowledge chart, the candidate entity corresponding to the entity word is used in the semantic structure chart to form semantic nodes to express the semantics of each entity word in the inquiry information, the semantic relation between each semantic node and the data to be inquired is expressed by using connecting lines, the attributes and the relation of the entity word in the inquiry information in the knowledge chart are effectively utilized to construct the corresponding semantic structure chart to express the semantics of the inquiry information, the semantic structure chart can include rich information of the semantic relation between the entity and the data to be inquired, the aim of more accurately understanding the semantics between each component in the inquiry information and the data to be inquired is achieved, and the technical effect of improving the accuracy rate of understanding the intention of the inquiry information is realized, and the technical problem of low accuracy in understanding the intention of inquiring information in the related technology is solved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
FIG. 1 is a schematic diagram of a hardware environment for a method of processing query information according to an embodiment of the present application;
FIG. 2 is a flow chart of an alternative query processing method according to an embodiment of the present application;
FIG. 3 is a schematic diagram of a query page in accordance with an alternative embodiment of the present application;
FIG. 4 is a schematic illustration of entity identification according to an alternative embodiment of the present application;
FIG. 5 is an entity diagram of a semantic subgraph according to an alternative embodiment of the present application;
FIG. 6 is a schematic diagram of a knowledge-graph based query intent understanding process in accordance with an alternative embodiment of the present application;
FIG. 7 is a first schematic diagram of an alternative apparatus for processing query information according to an embodiment of the present application;
FIG. 8 is a second schematic diagram of an alternative apparatus for processing query information according to an embodiment of the present application;
FIG. 9 is a third schematic diagram of an alternative query processing device according to an embodiment of the present application;
FIG. 10 is a fourth schematic diagram of an alternative query processing device according to an embodiment of the present application;
FIG. 11 is a fifth diagram of an alternative query processing device according to an embodiment of the present application;
fig. 12 is a block diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions better understood by those skilled in the art, 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, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. 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.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
According to an aspect of an embodiment of the present application, an embodiment of a method for processing query information is provided.
Alternatively, in the present embodiment, the processing method of the query information may be applied to a hardware environment formed by the terminal 101 and the server 103 as shown in fig. 1. As shown in fig. 1, the server 103 is connected to the terminal 101 through a network, which may be used to provide services (such as multimedia services, game services, application services, financial services, shopping services, etc.) for the terminal or a client installed on the terminal, and a database may be provided on the server or separately from the server for providing data storage services for the server 103, and the network includes but is not limited to: the terminal 101 is not limited to a PC, a mobile phone, a tablet computer, and the like. The query information processing method according to the embodiment of the present application may be executed by the server 103, the terminal 101, or both the server 103 and the terminal 101. The method for the terminal 101 to execute the query information processing according to the embodiment of the present application may be executed by a client installed thereon.
Fig. 2 is a flowchart of an alternative query information processing method according to an embodiment of the present application, and as shown in fig. 2, the method may include the following steps:
step S202, entity identification is carried out on the obtained query information to obtain a plurality of entity words corresponding to the query information, wherein the query information is used for querying data stored in a database;
step S204, aiming at each entity word, acquiring at least one candidate entity matched with the entity word from entity nodes included in a knowledge graph, wherein the knowledge graph is constructed for data stored in the database;
step S206, constructing a semantic structure diagram corresponding to the query information based on candidate entities corresponding to all entity words, wherein semantic nodes in the semantic structure diagram represent the semantics of all entity words, and connecting lines in the semantic structure diagram represent the semantic relationship between all semantic nodes and data to be queried;
and S208, inquiring the database according to the semantic structure chart.
Through the steps S202 to S208, the query information is understood by using the priori knowledge of the knowledge map, different components in the query information are associated with the entities in the knowledge map, the semantic nodes are formed by using the candidate entities corresponding to the entity words in the semantic structure map to represent the semantics of the entity words in the query information, the semantic relation between each semantic node and the data to be queried is represented by using the connecting lines, the attributes and the relation of the entity words in the query information in the knowledge map are effectively utilized to construct the corresponding semantic structure map to represent the semantics of the query information, the semantic structure map can include rich information of the semantic relation between the entities and the data to be queried, the purpose of more accurately understanding the semantics between each component in the query information and the data to be queried is achieved, and the technical effect of improving the accuracy of understanding the intention of the query information is achieved, and the technical problem of low accuracy in understanding the intention of inquiring information in the related technology is solved.
On the other hand, the knowledge graph is used for constructing the semantic structure diagram to express the intention of inquiring information, an inquiring information template or an intention category does not need to be defined in advance, more templates or intention categories do not need to be newly established along with the development of the service, and the knowledge graph only needs to be correspondingly updated according to the service requirement, so that the service expansion can be better adapted. In addition, a large number of templates or intention categories do not need to be stored in the search engine, and storage space is saved. The semantic structure chart capable of accurately expressing the query intention is used for querying the data, more accurate data can be obtained and returned to the user, and the query experience of the user is improved.
In the technical solution provided in step S202, the query information (query) is used for querying the database, and may be but is not limited to the query information input by the user through the search box.
Optionally, in this embodiment, the database is used to store the queried data, and different databases may be established according to different data requirements, for example: the movie application may build a database of movie information, the shopping application may build a database of shopping information, the game application may build a database of game information, and so on.
In an optional embodiment, fig. 3 is a schematic diagram of a query page according to an optional embodiment of the present application, as shown in fig. 3, taking a movie search as an example, the movie query page provides a search box, a user can input content (for example, a movie of a grandpa) to be queried in the search box, and a search engine can query the content (the movie of the grandpa) input by the user as query information in a database of movie information by clicking a search button. Firstly, entity recognition is carried out on query information 'a grandfather film', three entity words including 'a grandfather', a grandfather 'and a film' can be recognized.
Optionally, in this embodiment, the manner of performing entity identification on the query information may be, but is not limited to, using a named entity identification technology, identifying an entity having a specific meaning in the text, which may include a name of a person, a name of a place, a name of an organization, a proper noun, an adjective, and the like. The entity to be identified can be set according to requirements, such as: in connection with movie entertainment searches, the identified entities may include, but are not limited to: movie, character, game, music, etc.
In step S202, performing entity identification on the obtained query information to obtain a plurality of initial entities corresponding to the query information includes:
s11, carrying out error correction processing on the query information to obtain correction information;
s12, performing word segmentation processing on the correction information to obtain a plurality of word groups;
s13, aiming at each phrase, carrying out entity recognition on the phrase;
and S14, determining the phrase as an entity word under the condition that the phrase is identified as the entity, and acquiring the entity part of speech and the entity type corresponding to the entity word.
Optionally, in this embodiment, before the word segmentation process, an error correction process may be performed on the query information, so as to obtain correction information that can express the intention more accurately, and perform the word segmentation process on the correction information, so that the obtained multiple word groups are more accurate, and accuracy of subsequent entity identification is ensured.
Optionally, in this embodiment, the error correction process may include, but is not limited to, the following: the method for correcting the query information includes but is not limited to firstly searching whether the query information contains wrongly written characters through a preset error correction algorithm or a trained error correction model, modifying the wrongly written characters, then continuously detecting whether grammatical errors exist in the query information after the wrongly written characters are modified through the error correction algorithm or the trained error correction model, and automatically correcting the grammatical errors to obtain modified information.
Optionally, in this embodiment, for a phrase identified as an entity, the phrase is determined as an entity word, and an entity part-of-speech and an entity type corresponding to the entity word are obtained. Therefore, the intention expressed by the phrase can be more accurately identified.
In an alternative embodiment, fig. 4 is a schematic illustration of entity identification according to an alternative embodiment of the present application, as shown in fig. 4, the user may input "a grandpa movie", correct the movie as query information, change the wrongly written words to obtain correction information "a grandpa movie", the correction information 'a grandpa film for feeling' is participled to obtain a plurality of phrases 'a grandpa', 'feeling' and 'film', carrying out entity recognition on each phrase, recognizing a certain grandfather as an entity, taking the certain grandfather as an entity WORD, acquiring the corresponding entity part of speech and entity type of the entity WORD, acquiring the entity part of speech of the certain grandfather as a proper noun nr, acquiring the entity type of a human noun collection PERSON _ WORD, and expressing the information corresponding to the entity WORD 'certain grandfather' by using the certain grandfather/nr/PERSON _ WORD; recognizing that the 'percept' is an entity, taking the 'percept' as an entity word, acquiring the part of speech and the entity type of the entity corresponding to the entity word, acquiring that the part of speech of the 'percept' is an adjective a and has no entity type, and expressing information corresponding to the entity word 'percept' by the 'percept/a'; recognizing that the 'movie' is an entity, taking the 'movie' as an entity word, acquiring the corresponding entity part of speech and entity type of the 'movie', acquiring that the entity part of speech of the 'movie' is a noun n, and representing information corresponding to the entity word 'movie' by using 'movie/n' without the entity type.
In the technical solution provided in step S204, the knowledge graph may be, but is not limited to, a visual structure constructed based on knowledge in a knowledge domain, and the knowledge graph can clearly show the interrelation between the knowledge in the knowledge domain. The knowledge graph corresponding to the database shows the interrelation between knowledge in the knowledge field corresponding to the data stored in the database, such as: for the movie and television entertainment information, a knowledge map related to the fields of movie and television entertainment encyclopedias and the like can be constructed and used for displaying the association relation between movie and television entertainment knowledge, the movie and television knowledge map is applied to a database of movie and television entertainment data, and the relation between movie and television entertainment knowledge can be visually displayed in a visualization mode. For the medical knowledge, a knowledge graph in the medical field can be constructed to show the association relationship between medical related knowledge, and the medical knowledge graph can be applied to a database of medical data to show the mutual relationship between medical knowledge.
Optionally, in this embodiment, at least one candidate entity matching each entity word may be obtained, but is not limited to, by one of the following two ways:
first, an entity node in the knowledge graph, where the entity identifier is the same as the entity word, is obtained, where the entity identifier may include, but is not limited to, an entity name (name) and an entity alias (alias), and it is determined that the entity identifiers are the same if one of the entity name and the entity alias is the same. And for the entity node with the same entity identifier as the entity word, acquiring the entity node with the same entity information (entity part of speech and/or entity type) as the entity word as the at least one candidate entity corresponding to the entity word.
In the step S204, for each entity word, obtaining at least one candidate entity matching the entity word from the entity nodes included in the knowledge graph includes:
s21, acquiring entity nodes with entity names the same as the entity words from the entity nodes included in the knowledge graph;
s22, acquiring entity nodes with the entity names the same as the entity words from entity nodes with the entity names different from the entity words, wherein the entity identifiers comprise the entity names and the entity names;
and S23, acquiring entity nodes with entity information being the same as the entity information of the entity word from the entity nodes with the entity identifiers being the same as the entity word as the at least one candidate entity corresponding to the entity word, wherein the entity information comprises the entity part of speech and/or the entity type.
Optionally, in this embodiment, the entity nodes in the knowledge graph may be primarily screened by using the entity names and the entity alias, and then the entity nodes having the same entity information as the entity word are precisely located in the primarily screened entity nodes as the candidate entities corresponding to the entity word, so that the matched candidate entities can precisely express the semantics of the entity word.
In a second mode, the candidate entities are determined by adopting a semantic recall mode based on the feature vectors, namely: and generating entity feature vectors by using the entity words, the entity part of speech and the entity types of the entity words as features, calculating the node similarity by using the entity feature vectors and the node feature vectors of each entity node, and acquiring corresponding entity nodes with higher node similarity in the knowledge graph as candidate entities.
In the step S204, for each entity word, obtaining at least one candidate entity matching the entity word from the entity nodes included in the knowledge graph includes:
s31, generating entity feature vectors corresponding to the entity words by using the entity words, the entity parts of speech of the entity words and the entity types of the entity words;
s32, calculating the node similarity between the entity feature vector and the node feature vector of each entity node included in the knowledge graph;
and S33, acquiring the entity nodes with the node similarity higher than the target similarity from the entity nodes included in the knowledge graph as the at least one candidate entity corresponding to the entity word.
Optionally, in this embodiment, the manner of generating the entity feature vector corresponding to the entity word may include, but is not limited to: and calculating the entity word, the entity part of speech of the entity word and the entity type of the entity word by using a feature vector generation algorithm, or inputting the entity word, the entity part of speech of the entity word and the entity type of the entity word into a trained feature extraction model, and automatically generating an entity feature vector by using the feature extraction model.
Optionally, in this embodiment, the node feature vector of each entity node included in the knowledge-graph may be, but is not limited to, generated in the same manner as described above.
Alternatively, in the present embodiment, the target similarity may be set to, but not limited to, 100%, or may also be set to a numerical value of 98%, 95%, or the like, to allow a certain error to occur.
In the technical solution provided in step S206, the semantic structure diagram is used for showing semantics of the query information according to the connection relationship between the entity nodes. The semantic structure diagram can be drawn by, but not limited to, entity nodes and connecting lines connecting the entity nodes, the semantic nodes in the semantic structure diagram represent the semantics of each entity word, and the connecting lines in the semantic structure diagram represent the semantic relationship between each semantic node and the data to be queried.
Optionally, in this embodiment, each entity word corresponds to a semantic node in the semantic structure diagram, and the semantic node may be, but is not limited to, an entity in at least one candidate entity corresponding to the entity word.
In step S206, the constructing the semantic structure diagram corresponding to the query information based on the candidate entity corresponding to each entity word includes:
s41, taking a preset node as an initial current semantic structure diagram, executing the following operations on each entity word until the semantic structure diagram is obtained after each entity word is traversed, wherein the preset node is used for indicating the position of the data to be inquired in the current semantic structure diagram:
s411, acquiring an unrepeated entity word from each entity word as a current entity word;
s412, screening out a current target entity from at least one candidate entity corresponding to the current entity word;
s413, acquiring the connection relation of the current target entity from the knowledge graph;
s414, adding the current target entity as a semantic node into the current semantic structure chart;
and S415, constructing a connecting line between the semantic node and the preset node, and endowing the connecting line with the connection relation of the current target entity to obtain a next current semantic structure diagram.
Optionally, in this embodiment, a certain candidate entity corresponding to each entity word may be added to the semantic structure diagram one by one through the above loop process, so as to construct a final semantic structure diagram.
Optionally, in this embodiment, a connection relationship that each current target entity has in an entity node corresponding to the knowledge graph is obtained, another entity node to which the connection relationships are connected may be content that a user wants to search, and the connection relationship that the entity node has is given to a connection line constructed between the semantic node and a preset node to represent a semantic relationship between each semantic node and data to be queried.
Optionally, in this embodiment, a preset node (q node) is used to indicate a position of data to be queried in a current semantic structure diagram, the q node and a plurality of target entities are used as nodes in the semantic structure diagram, the q node and the plurality of semantic nodes are connected by using a connection relationship to form the semantic structure diagram, and any entity that can replace the q node may be a result that a user wants to search.
Optionally, in this embodiment, for each entity word currently being processed, one candidate entity is screened from at least one candidate entity corresponding to the current entity word as the current target entity, and the screening may be performed in a manner of randomly screening the current target entity, or screening a candidate entity capable of most embodying the semantics of each entity word as the current target entity.
Optionally, in this embodiment, if the current entity word only corresponds to one candidate entity, the semantics of the current entity word may be considered to be determined, and the candidate entity may be taken as the current target entity. If the current entity word corresponds to a plurality of candidate entities, the semantics of the current entity word can be considered to be ambiguous, and a candidate entity which can most embody the semantics of the current entity word can be screened from the plurality of candidate entities to be used as a current target entity.
In step S412, the step of screening out a current target entity from at least one candidate entity corresponding to the current entity word includes:
s51, determining a candidate entity as the current target entity under the condition that the current entity word corresponds to the candidate entity;
s52, under the condition that the current entity word corresponds to a plurality of candidate entities, aiming at each candidate entity, calculating the average distance between the candidate entity and each semantic node in the current semantic structure chart; and determining the candidate entity with the closest average distance in each candidate entity as the current target entity.
Optionally, in this embodiment, the distance between the candidate entity and the semantic node may be represented by, but is not limited to, the distance between the positions of the entities in the knowledge-graph. The distance between locations in the knowledge-graph may be represented, but is not limited to, using the number of entity nodes of the inter-entity intervals or the number of connecting lines of the inter-entity intervals.
Optionally, in this embodiment, first, the distance between the candidate entity and each semantic node in the current semantic structure diagram is calculated, and then an average value of the obtained distances is obtained to obtain an average distance.
Optionally, in this embodiment, the more similar the semantics expressed by the nodes closer to each other in the knowledge graph may be, so that the candidate entity with the closest average distance among the candidate entities may be determined as the entity capable of expressing the word sense of the entity most.
In an alternative embodiment, the semantic structure diagram may be, but is not limited to, called a semantic subgraph, and the semantic subgraph includes entities, connection relations, and a preset q node in the knowledge graph. Any entity that can replace the q-node is the result that the user wants to find. A semantic sub-graph of a query information query can be represented by a series of nodes and sets of edges (i.e., connecting lines), the types of edges being relationships that already exist in the knowledge-graph, and any edge being directly or indirectly connected to a q-node.
The semantic subgraph can be constructed by adopting the above loop process in a state transition mode, but not limited to, the construction process can be as follows: firstly, an initial state S is defined, and the initial state S comprises an initial semantic sub-graph G and an entity set omega in which none of candidate entities corresponding to entity words is added to the semantic sub-graph. The initial semantic subgraph G in the initial state S only comprises q nodes, all candidate entities recalled by all entity words in the query are not added into the initial semantic subgraph G, all entity words in omega are traversed, a target entity is screened out for each entity word one by one and added into the current semantic subgraph, the connection relation of the target entity is given to a connecting line between the target entity and the q nodes, the next state Si is obtained, i represents the number of circulation times until the final state Sn is obtained, and n represents the number of the entity words. And the final state Sn comprises a semantic subgraph Gn and an entity set omega n of the semantic subgraph, wherein the candidate entities corresponding to the entity words are added to the entity set omega n of the semantic subgraph, the semantic subgraph Gn shows the connection relation between each target entity and the q node, and the entity set omega n is an empty set.
For example: taking the query information as "a grandfather film" as an example, fig. 5 IS a schematic diagram of a semantic subgraph according to an optional embodiment of the present application, and as shown in fig. 5, the semantic subgraph constructed by the query information "a grandfather film" includes a q node, a connection relationship "act/direct" between a target entity "a grandfather", "a movie" and "a grandfather" and the q node, a connection relationship "IS _ a" between the target entity "the movie" and the q node, and a connection relationship "category" between the target entity "the grandfather" and the q node.
In the technical solution provided in step S208, the semantic structure diagram is used to query the database, data matched with the semantic structure diagram can be queried from the database, and the queried data can be displayed on a search page as a query result for a user to browse.
Optionally, in this embodiment, the queried data may include, but is not limited to, web page links, movie resource files, pictures, and the like.
Optionally, in this embodiment, the data query using the semantic structure diagram may be performed by converting the semantic structure diagram into a format (for example, a logical expression) that can be recognized by a search engine, and then performing a query on the database using the converted result.
In the step S208, querying the database according to the semantic structure diagram includes:
s61, converting the semantic structure chart into a logic expression;
and S62, querying the database by using the logic expression.
Optionally, in this embodiment, the semantic structure diagram may be converted into a logical expression, and the logical expression is used to perform query on the database, so as to obtain a query result.
Optionally, in this embodiment, the representation format of the semantic structure diagram is converted into a logical expression supported by a search engine, and the data meeting the condition is recalled by the search engine and returned to the user.
In the step S61, the converting the semantic structure diagram into a logical expression includes:
s71, mapping each semantic branch in the plurality of semantic branches included in the semantic structure diagram into a field and a field value having a corresponding relationship, to obtain a plurality of sets of fields and field values having a corresponding relationship, where each semantic branch includes a preset node and a semantic node connected by a connecting line, the semantic relationship represented by the connecting line is mapped into the field, and the semantics represented by the semantic node is mapped into the field value;
and S72, connecting the multiple groups of fields and field values with corresponding relations by using a logical relation word to obtain the logical expression.
Optionally, in this embodiment, the semantics in the semantic structure diagram are extracted in a manner that the semantic branches are mapped to the fields and the field values having the corresponding relationships, so as to obtain the filtering condition of the data. Each semantic branch comprises a preset node and a semantic node which are connected through a connecting line, the semantic relation represented by the connecting line is mapped into a field, and the semantics represented by the semantic node is mapped into a field value. For example: the mapping form of the semantic branch can be "field: value ", which are fields and field values of data in a search engine.
Optionally, in this embodiment, the logical relation term may include, but is not limited to: and, (and), or, (or), not (not), and the like. And (and) connection can be used among various semantic branches, or (or) connection relations included in one semantic branch can be used, and not (not) can be used according to the recognized semantic meaning which represents negation.
In the above optional embodiment, taking "a grandfather film" as an example, the semantic branch includes: branch 1, semantic node "somebody week" and q node connection relation "act/direct"; branch 2, connection relation "IS _ a" between semantic node "movie" and q node; and branch 3, a connection relation "category" between the semantic node "perceptron" and the q node. Mapping Branch 1 to actor: a certain one of the week or a director: somebody week, branch 2 is mapped to channel: movie, mapping branch 3 to category: and (2) feeling a human, using and connection among the maps, and obtaining logic expressions of (operator: certain editor in week) and category: human and channel: a movie. Using the logical expressions (operator: director: week) and category: human and channel: the search results screened by the movie query database through the search engine are shown in fig. 3, and five movies of a certain director or director in a certain week are displayed on the search page.
Optionally, in this embodiment, the logical expression is recognizable by the search engine, and the logical expression is provided to the search engine, and the search engine can recall corresponding data according to the search condition shown in the logical expression. Such as: for the semantic branch in fig. 4 where the q node has an IS _ a relationship with the "movie" node, this branch IS mapped to "channel: movie "the search engine will recall data for which the channel field is a movie, but will not recall data for which the other channel field is a television show or an art.
The application also provides an optional embodiment, and the optional embodiment provides a query intention understanding system based on the knowledge graph, different components in the query information are related to entity nodes or attributes in the knowledge graph, and corresponding semantic subgraphs are constructed to represent the intention of the query by effectively utilizing the attributes and the relations of the entities, so that the problems of poor expansibility and low accuracy of the conventional query intention understanding method are solved. FIG. 6 is a schematic diagram of a knowledge-graph based query intent understanding process according to an alternative embodiment of the present application, which may include, but is not limited to, the following stages as shown in FIG. 6: a query preprocessing stage, a candidate entity recall stage, a semantic subgraph construction stage and a structured search stage. The following is a detailed description of the processing procedure of each stage:
in the query preprocessing stage, the received query is preprocessed in a manner that may include, but is not limited to, error correction, word segmentation, and entity identification. Entity names (term) such as drama, person, character, game, music, etc. included in the query can be identified by entity identification.
And in the candidate entity recall stage, performing candidate entity recall operation on term identified in the query. Candidate entities matching it are recalled for each term by searching the knowledge graph for entity names and their aliases.
And in the semantic subgraph construction stage, constructing a corresponding semantic subgraph according to the recalled candidate entities. The semantic subgraph is composed of entities, relations and a preset q node in the knowledge graph. Any entity that can replace the q-node is the result that the user wants to find. A query's semantic subgraph can be represented by a set of edges, the type of edge being an existing relationship in the knowledge graph, and any edge being connected to the q-node, either directly or indirectly.
And in the structured search stage, converting the semantic subgraph generated in the semantic subgraph construction stage into a logic expression supported by a search engine, recalling data meeting the conditions through the search engine, and returning the data to the user.
Through the query process provided by the optional embodiment, the priori knowledge in the knowledge graph can be directly applied to query intention understanding, the knowledge graph comprises more attribute relation information, and the intention expressed by each component and each component in the query can be more accurately understood. In addition, the query intention is expressed in a mode of constructing a semantic subgraph through a knowledge graph, and a query template or intention category does not need to be defined in advance, so that the business is easier to expand.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present application is not limited by the order of acts described, as some steps may occur in other orders or concurrently depending on the application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required in this application.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a computer-readable storage medium (such as ROM/RAM, magnetic disk, optical disk), and includes instructions for enabling a terminal device (which may be a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present application.
According to another aspect of the embodiment of the application, a query information processing device for implementing the query information processing method is also provided. Fig. 7 is a schematic diagram of an alternative apparatus for processing query information according to an embodiment of the present application, as shown in fig. 7, the apparatus may include:
the identification module 72 is configured to perform entity identification on the obtained query information to obtain a plurality of entity words corresponding to the query information, where the query information is used to query data stored in a database;
an obtaining module 74, configured to, for each entity word, obtain at least one candidate entity matching the entity word from entity nodes included in a knowledge graph, where the knowledge graph is constructed for data stored in the database;
a building module 76, configured to build a semantic structure diagram corresponding to the query information based on candidate entities corresponding to each entity word, where a semantic node in the semantic structure diagram represents the semantics of each entity word, and a connecting line in the semantic structure diagram represents a semantic relationship between each semantic node and data to be queried;
and the query module 78 is used for querying the database according to the semantic structure diagram.
It should be noted that the identification module 72 in this embodiment may be configured to execute the step S202 in this embodiment, the obtaining module 74 in this embodiment may be configured to execute the step S204 in this embodiment, the constructing module 76 in this embodiment may be configured to execute the step S206 in this embodiment, and the querying module 78 in this embodiment may be configured to execute the step S208 in this embodiment.
It should be noted here that the modules described above are the same as the examples and application scenarios implemented by the corresponding steps, but are not limited to the disclosure of the above embodiments. It should be noted that the modules described above as a part of the apparatus may operate in a hardware environment as shown in fig. 1, and may be implemented by software or hardware.
Through the module, the prior knowledge of the knowledge graph is utilized to understand the query information, different components in the query information are associated to the entities in the knowledge graph, the semantic nodes are formed by the candidate entities corresponding to the entity words in the semantic structure graph to represent the semantics of the entity words in the query information, the semantic relation between the semantic nodes and the data to be queried is represented by connecting lines, the attributes and the relation of the entity words in the query information in the knowledge graph are effectively utilized to construct the corresponding semantic structure graph to represent the semantics of the query information, the semantic structure graph can include rich information of the semantic relation between the entities and the data to be queried, the purpose of more accurately understanding the semantics between the components in the query information and the data to be queried is achieved, and the technical effect of improving the accuracy of understanding the intention of the query information is achieved, and the technical problem of low accuracy in understanding the intention of inquiring information in the related technology is solved.
Fig. 8 is a second schematic diagram of an optional apparatus for processing query information according to an embodiment of the present application, as shown in fig. 8, optionally, the obtaining module 74 includes:
a first obtaining unit 82, configured to obtain, from entity nodes included in the knowledge graph, an entity node having an entity name that is the same as the entity word;
a second obtaining unit 84, configured to obtain an entity node having an entity name different from the entity word and having an entity alias identical to the entity word, where the entity identifier includes the entity name and the entity alias;
a third obtaining unit 86, configured to obtain, from entity nodes whose entity identifiers are the same as the entity word, entity nodes whose entity information is the same as the entity information of the entity word as the at least one candidate entity corresponding to the entity word, where the entity information includes an entity part of speech and/or an entity type.
Fig. 9 is a third schematic diagram of an optional query information processing apparatus according to an embodiment of the present application, as shown in fig. 9, optionally, the obtaining module 74 includes:
a generating unit 92, configured to generate an entity feature vector corresponding to the entity word by using the entity word, the entity part of speech of the entity word, and the entity type of the entity word;
a calculating unit 94, configured to calculate a node similarity between the entity feature vector and a node feature vector of each entity node included in the knowledge-graph;
a fourth obtaining unit 96, configured to obtain, from the entity nodes included in the knowledge graph, an entity node with a node similarity higher than the target similarity as the at least one candidate entity corresponding to the entity word.
As an alternative embodiment, the building module is configured to:
taking a preset node as an initial current semantic structure chart, executing the following operations on each entity word until the semantic structure chart is obtained after each entity word is traversed, wherein the preset node is used for indicating the position of data to be queried in the current semantic structure chart:
acquiring an unretraversed entity word from each entity word as a current entity word;
screening a current target entity from at least one candidate entity corresponding to the current entity word;
acquiring the connection relation of the current target entity from the knowledge graph;
adding the current target entity as a semantic node into the current semantic structure chart;
and constructing a connecting line between the semantic node and the preset node, and endowing the connecting line with the connection relation of the current target entity to obtain the next current semantic structure chart.
As an alternative embodiment, the building module is configured to:
determining one candidate entity as the current target entity under the condition that the current entity word corresponds to the one candidate entity;
under the condition that the current entity word corresponds to a plurality of candidate entities, calculating the average distance between each candidate entity and each semantic node in the current semantic structure chart; and determining the candidate entity with the closest average distance in each candidate entity as the current target entity.
Fig. 10 is a fourth schematic diagram of an optional apparatus for processing query information according to an embodiment of the present application, as shown in fig. 10, optionally, the query module 78 includes:
a conversion unit 102, configured to convert the semantic structure diagram into a logical expression;
and the query unit 104 is configured to query the database by using the logical expression.
As an alternative embodiment, the conversion unit is configured to:
mapping each semantic branch in a plurality of semantic branches included in the semantic structure diagram into a field and a field value with a corresponding relationship to obtain a plurality of groups of fields and field values with corresponding relationships, wherein each semantic branch comprises a preset node and a semantic node which are connected through a connecting line, the semantic relationship represented by the connecting line is mapped into the field, and the semantics represented by the semantic node is mapped into the field value;
and connecting the plurality of groups of fields and field values with corresponding relations by using a logical relation word to obtain the logical expression.
Fig. 11 is a fifth schematic diagram of an optional apparatus for processing query information according to an embodiment of the present application, as shown in fig. 11, optionally, the identifying module 72 includes:
an error correction unit 112, configured to perform error correction processing on the query information to obtain correction information;
a word segmentation unit 114, configured to perform word segmentation processing on the correction information to obtain multiple word groups;
an identifying unit 116, configured to perform entity identification on each phrase;
the determining unit 118 is configured to, if the word group is identified as an entity, determine the word group as an entity word, and obtain an entity part of speech and an entity type corresponding to the entity word.
It should be noted here that the modules described above are the same as the examples and application scenarios implemented by the corresponding steps, but are not limited to the disclosure of the above embodiments. It should be noted that the modules described above as a part of the apparatus may be operated in a hardware environment as shown in fig. 1, and may be implemented by software, or may be implemented by hardware, where the hardware environment includes a network environment.
According to another aspect of the embodiment of the application, a server or a terminal for implementing the processing method of the query information is also provided.
Fig. 12 is a block diagram of an electronic device according to an embodiment of the present application, and as shown in fig. 12, the electronic device may include: one or more processors 1201 (only one of which is shown), a memory 1203, and a transmission 1205. as shown in fig. 12, the electronic apparatus may also include an input-output device 1207.
The memory 1203 may be used to store software programs and modules, such as program instructions/modules corresponding to the method and apparatus for processing query information in the embodiment of the present application, and the processor 1201 executes various functional applications and data processing by running the software programs and modules stored in the memory 1203, that is, implements the method for processing query information described above. The memory 1203 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 1203 may further include memory located remotely from the processor 1201, which may be connected to the electronic device through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The above-mentioned transmission means 1205 is used for receiving or sending data via a network, and may also be used for data transmission between the processor and the memory. Examples of the network may include a wired network and a wireless network. In one example, the transmission device 1205 includes a Network adapter (NIC) that can be connected to a router via a Network cable and other Network devices to communicate with the internet or a local area Network. In one example, the transmission device 1205 is a Radio Frequency (RF) module, which is used to communicate with the internet in a wireless manner.
Among them, the memory 1203 is specifically used for storing an application program.
The processor 1201 may invoke an application stored in the memory 1203 via the transmission 1205 to perform the following steps:
performing entity identification on the acquired query information to obtain a plurality of entity words corresponding to the query information, wherein the query information is used for querying data stored in a database;
for each entity word, acquiring at least one candidate entity matched with the entity word from entity nodes included in a knowledge graph, wherein the knowledge graph is constructed for data stored in the database;
constructing a semantic structure chart corresponding to the query information based on candidate entities corresponding to all entity words, wherein semantic nodes in the semantic structure chart represent the semantics of all entity words, and connecting lines in the semantic structure chart represent the semantic relationship between all semantic nodes and data to be queried;
and querying the database according to the semantic structure diagram.
By adopting the embodiment of the application, a scheme for processing the query information is provided. The prior knowledge of the knowledge graph is utilized to understand the query information, different components in the query information are associated to the entity in the knowledge graph, in the semantic structure chart, the semantic node is formed by the candidate entities corresponding to the entity words to represent the semantics of each entity word in the query information, the semantic relation between each semantic node and the data to be queried is represented by using connecting lines, the attributes and the relations of the entity words in the query information in the knowledge graph are effectively utilized, the corresponding semantic structure chart is constructed to represent the semantics of the query information, the semantic structure chart can comprise rich information of the semantic relation between the entities and the data to be queried, the purpose of more accurately understanding the semantics between each component in the query information and the data to be queried is achieved, and the technical effect of improving the accuracy of understanding the intention of the query information is achieved, and the technical problem of low accuracy in understanding the intention of inquiring information in the related technology is solved.
Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment is not described herein again.
It can be understood by those skilled in the art that the structure shown in fig. 12 is only an illustration, and the electronic device may be a terminal device such as a smart phone (e.g., an Android phone, an iOS phone, etc.), a tablet computer, a palm computer, and a Mobile Internet Device (MID), a PAD, etc. Fig. 12 is a diagram illustrating a structure of the electronic device. For example, the electronic device may also include more or fewer components (e.g., network interfaces, display devices, etc.) than shown in FIG. 12, or have a different configuration than shown in FIG. 12.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by a program for instructing hardware associated with an electronic device, where the program may be stored in a computer-readable storage medium, and the computer-readable storage medium may include: flash disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.
Embodiments of the present application also provide a computer-readable storage medium. Alternatively, in the present embodiment, the computer-readable storage medium described above may be used for program codes for executing a processing method of query information.
Alternatively, in this embodiment, the computer-readable storage medium may be located on at least one of a plurality of network devices in the network shown in the above embodiment.
Optionally, in this embodiment, the computer readable storage medium is configured to store program code for performing the following steps:
performing entity identification on the acquired query information to obtain a plurality of entity words corresponding to the query information, wherein the query information is used for querying data stored in a database;
for each entity word, acquiring at least one candidate entity matched with the entity word from entity nodes included in a knowledge graph, wherein the knowledge graph is constructed for data stored in the database;
constructing a semantic structure chart corresponding to the query information based on candidate entities corresponding to all entity words, wherein semantic nodes in the semantic structure chart represent the semantics of all entity words, and connecting lines in the semantic structure chart represent the semantic relationship between all semantic nodes and data to be queried;
and querying the database according to the semantic structure diagram.
Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment is not described herein again.
Optionally, in this embodiment, the computer-readable storage medium may include, but is not limited to: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
The integrated unit in the above embodiments, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in the above computer-readable storage medium. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a computer-readable storage medium and includes several instructions for causing one or more computer devices (which may be personal computers, servers, network devices, etc.) to execute all or part of the steps of the methods described in the embodiments of the present application.
In the above embodiments of the present application, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The foregoing is only a preferred embodiment of the present application and it should be noted that those skilled in the art can make several improvements and modifications without departing from the principle of the present application, and these improvements and modifications should also be considered as the protection scope of the present application.
Claims (11)
1. A query information processing method is characterized by comprising the following steps:
performing entity identification on the acquired query information to obtain a plurality of entity words corresponding to the query information, wherein the query information is used for querying data stored in a database;
for each entity word, acquiring at least one candidate entity matched with the entity word from entity nodes included in a knowledge graph, wherein the knowledge graph is constructed for data stored in the database;
constructing a semantic structure chart corresponding to the query information based on candidate entities corresponding to all entity words, wherein semantic nodes in the semantic structure chart represent the semantics of all entity words, and connecting lines in the semantic structure chart represent the semantic relationship between all semantic nodes and data to be queried;
and querying the database according to the semantic structure diagram.
2. The method of claim 1, wherein for each entity word, obtaining at least one candidate entity matching the entity word from the entity nodes included in the knowledge-graph comprises:
acquiring entity nodes with entity names the same as the entity words from the entity nodes included in the knowledge graph;
acquiring entity nodes with the entity names same as the entity words from entity nodes with the entity names different from the entity words, wherein the entity identifiers comprise the entity names and the entity names;
and acquiring entity nodes with entity information identical to the entity word from the entity nodes with the entity identifiers identical to the entity word as the at least one candidate entity corresponding to the entity word, wherein the entity information comprises entity part of speech and/or entity type.
3. The method of claim 1, wherein for each entity word, obtaining at least one candidate entity matching the entity word from the entity nodes included in the knowledge-graph comprises:
generating an entity feature vector corresponding to the entity word by using the entity word, the entity part of speech of the entity word and the entity type of the entity word;
calculating a node similarity between the entity feature vector and a node feature vector of each entity node included in the knowledge-graph;
and acquiring the entity nodes with the node similarity higher than the target similarity from the entity nodes included in the knowledge graph as the at least one candidate entity corresponding to the entity word.
4. The method of claim 1, wherein constructing the semantic structure diagram corresponding to the query information based on the candidate entities corresponding to each entity word comprises:
taking a preset node as an initial current semantic structure chart, executing the following operations on each entity word until the semantic structure chart is obtained after each entity word is traversed, wherein the preset node is used for indicating the position of data to be queried in the current semantic structure chart:
acquiring an unretraversed entity word from each entity word as a current entity word;
screening a current target entity from at least one candidate entity corresponding to the current entity word;
acquiring the connection relation of the current target entity from the knowledge graph;
adding the current target entity as a semantic node into the current semantic structure chart;
and constructing a connecting line between the semantic node and the preset node, and endowing the connecting line with the connection relation of the current target entity to obtain the next current semantic structure chart.
5. The method of claim 4, wherein the screening of the at least one candidate entity corresponding to the current entity word for a current target entity comprises:
determining one candidate entity as the current target entity under the condition that the current entity word corresponds to the one candidate entity;
under the condition that the current entity word corresponds to a plurality of candidate entities, calculating the average distance between each candidate entity and each semantic node in the current semantic structure chart; and determining the candidate entity with the closest average distance in each candidate entity as the current target entity.
6. The method of claim 1, wherein querying the database based on the semantic structure graph comprises:
converting the semantic structure diagram into a logic expression;
querying the database using the logical expression.
7. The method of claim 6, wherein converting the semantic structure graph into a logical expression comprises:
mapping each semantic branch in a plurality of semantic branches included in the semantic structure diagram into a field and a field value with a corresponding relationship to obtain a plurality of groups of fields and field values with corresponding relationships, wherein each semantic branch comprises a preset node and a semantic node which are connected through a connecting line, the semantic relationship represented by the connecting line is mapped into the field, and the semantics represented by the semantic node is mapped into the field value;
and connecting the plurality of groups of fields and field values with corresponding relations by using a logical relation word to obtain the logical expression.
8. The method according to claim 1, wherein performing entity identification on the obtained query information to obtain a plurality of initial entities corresponding to the query information comprises:
carrying out error correction processing on the query information to obtain correction information;
performing word segmentation processing on the correction information to obtain a plurality of word groups;
aiming at each phrase, carrying out entity recognition on the phrase;
and under the condition that the phrase is identified as the entity, determining the phrase as an entity word, and acquiring the entity part of speech and the entity type corresponding to the entity word.
9. A device for processing query information, comprising:
the identification module is used for carrying out entity identification on the acquired query information to obtain a plurality of entity words corresponding to the query information, wherein the query information is used for querying data stored in a database;
the acquisition module is used for acquiring at least one candidate entity matched with the entity word from entity nodes included in a knowledge graph aiming at each entity word, wherein the knowledge graph is constructed for data stored in the database;
the building module is used for building a semantic structure chart corresponding to the query information based on candidate entities corresponding to all entity words, wherein semantic nodes in the semantic structure chart represent the semantics of all entity words, and connecting lines in the semantic structure chart represent the semantic relation between all semantic nodes and data to be queried;
and the query module is used for querying the database according to the semantic structure chart.
10. A computer-readable storage medium, comprising a stored program, wherein the program is operable to perform the method of any of claims 1 to 8.
11. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor executes the method of any of the preceding claims 1 to 8 by means of the computer program.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010688963.0A CN111831911B (en) | 2020-07-16 | 2020-07-16 | Query information processing method and device, storage medium and electronic device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010688963.0A CN111831911B (en) | 2020-07-16 | 2020-07-16 | Query information processing method and device, storage medium and electronic device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111831911A true CN111831911A (en) | 2020-10-27 |
CN111831911B CN111831911B (en) | 2023-07-07 |
Family
ID=72924412
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010688963.0A Active CN111831911B (en) | 2020-07-16 | 2020-07-16 | Query information processing method and device, storage medium and electronic device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111831911B (en) |
Cited By (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112417163A (en) * | 2020-11-13 | 2021-02-26 | 中译语通科技股份有限公司 | Entity clue fragment-based candidate entity alignment method and device |
CN112463319A (en) * | 2020-11-17 | 2021-03-09 | 北京金山云网络技术有限公司 | Content detection model generation method and device, electronic equipment and storage medium |
CN112486988A (en) * | 2020-11-27 | 2021-03-12 | 京东方科技集团股份有限公司 | Data processing method, device, equipment and storage medium |
CN112765993A (en) * | 2021-01-20 | 2021-05-07 | 上海德拓信息技术股份有限公司 | Semantic parsing method, system, device and readable storage medium |
CN112948508A (en) * | 2021-04-15 | 2021-06-11 | 平安科技(深圳)有限公司 | Information prediction method, device, equipment and medium based on multilayer associated knowledge graph |
CN113127506A (en) * | 2021-06-16 | 2021-07-16 | 北京明略昭辉科技有限公司 | Target query statement construction method and device, storage medium and electronic device |
CN113139389A (en) * | 2021-04-29 | 2021-07-20 | 南宁师范大学 | Graph model semantic query expansion method and device based on dynamic optimization |
CN113157727A (en) * | 2021-05-24 | 2021-07-23 | 腾讯音乐娱乐科技(深圳)有限公司 | Method, apparatus and storage medium for providing recall result |
CN113569030A (en) * | 2021-07-29 | 2021-10-29 | 北京三快在线科技有限公司 | Information query method, device, equipment and storage medium |
CN113836922A (en) * | 2021-08-19 | 2021-12-24 | 赢火虫信息科技(上海)有限公司 | Named entity error correction method and device and electronic equipment |
CN114153928A (en) * | 2021-12-03 | 2022-03-08 | 中国电信股份有限公司 | Method, system, equipment and medium for constructing urban geographic semantic knowledge network |
CN114781400A (en) * | 2022-06-17 | 2022-07-22 | 之江实验室 | Cross-media knowledge semantic expression method and device |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140236579A1 (en) * | 2013-02-18 | 2014-08-21 | Nadine Sina Kurz | Method and Device for Performing Natural Language Searches |
CN107526812A (en) * | 2017-08-24 | 2017-12-29 | 北京奇艺世纪科技有限公司 | A kind of searching method, device and electronic equipment |
CN108268580A (en) * | 2017-07-14 | 2018-07-10 | 广东神马搜索科技有限公司 | The answering method and device of knowledge based collection of illustrative plates |
CN109002516A (en) * | 2018-07-06 | 2018-12-14 | 国网电子商务有限公司 | A kind of searching method and device |
CN109033135A (en) * | 2018-06-06 | 2018-12-18 | 北京大学 | A kind of natural language querying method and system of software-oriented project knowledge map |
US20190317965A1 (en) * | 2019-06-28 | 2019-10-17 | Intel Corporation | Methods and apparatus to facilitate generation of database queries |
CN110727862A (en) * | 2019-09-24 | 2020-01-24 | 苏宁云计算有限公司 | Method and device for generating query strategy of commodity search |
-
2020
- 2020-07-16 CN CN202010688963.0A patent/CN111831911B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140236579A1 (en) * | 2013-02-18 | 2014-08-21 | Nadine Sina Kurz | Method and Device for Performing Natural Language Searches |
CN108268580A (en) * | 2017-07-14 | 2018-07-10 | 广东神马搜索科技有限公司 | The answering method and device of knowledge based collection of illustrative plates |
CN107526812A (en) * | 2017-08-24 | 2017-12-29 | 北京奇艺世纪科技有限公司 | A kind of searching method, device and electronic equipment |
CN109033135A (en) * | 2018-06-06 | 2018-12-18 | 北京大学 | A kind of natural language querying method and system of software-oriented project knowledge map |
CN109002516A (en) * | 2018-07-06 | 2018-12-14 | 国网电子商务有限公司 | A kind of searching method and device |
US20190317965A1 (en) * | 2019-06-28 | 2019-10-17 | Intel Corporation | Methods and apparatus to facilitate generation of database queries |
CN110727862A (en) * | 2019-09-24 | 2020-01-24 | 苏宁云计算有限公司 | Method and device for generating query strategy of commodity search |
Cited By (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112417163A (en) * | 2020-11-13 | 2021-02-26 | 中译语通科技股份有限公司 | Entity clue fragment-based candidate entity alignment method and device |
CN112463319A (en) * | 2020-11-17 | 2021-03-09 | 北京金山云网络技术有限公司 | Content detection model generation method and device, electronic equipment and storage medium |
CN112486988A (en) * | 2020-11-27 | 2021-03-12 | 京东方科技集团股份有限公司 | Data processing method, device, equipment and storage medium |
CN112765993A (en) * | 2021-01-20 | 2021-05-07 | 上海德拓信息技术股份有限公司 | Semantic parsing method, system, device and readable storage medium |
CN112948508A (en) * | 2021-04-15 | 2021-06-11 | 平安科技(深圳)有限公司 | Information prediction method, device, equipment and medium based on multilayer associated knowledge graph |
CN112948508B (en) * | 2021-04-15 | 2024-04-30 | 平安科技(深圳)有限公司 | Information prediction method, device, equipment and medium based on multi-layer associated knowledge graph |
CN113139389A (en) * | 2021-04-29 | 2021-07-20 | 南宁师范大学 | Graph model semantic query expansion method and device based on dynamic optimization |
CN113139389B (en) * | 2021-04-29 | 2023-01-13 | 南宁师范大学 | Graph model semantic query expansion method and device based on dynamic optimization |
CN113157727A (en) * | 2021-05-24 | 2021-07-23 | 腾讯音乐娱乐科技(深圳)有限公司 | Method, apparatus and storage medium for providing recall result |
CN113127506B (en) * | 2021-06-16 | 2021-10-15 | 北京明略昭辉科技有限公司 | Target query statement construction method and device, storage medium and electronic device |
CN113127506A (en) * | 2021-06-16 | 2021-07-16 | 北京明略昭辉科技有限公司 | Target query statement construction method and device, storage medium and electronic device |
CN113569030A (en) * | 2021-07-29 | 2021-10-29 | 北京三快在线科技有限公司 | Information query method, device, equipment and storage medium |
CN113836922A (en) * | 2021-08-19 | 2021-12-24 | 赢火虫信息科技(上海)有限公司 | Named entity error correction method and device and electronic equipment |
CN114153928A (en) * | 2021-12-03 | 2022-03-08 | 中国电信股份有限公司 | Method, system, equipment and medium for constructing urban geographic semantic knowledge network |
CN114781400A (en) * | 2022-06-17 | 2022-07-22 | 之江实验室 | Cross-media knowledge semantic expression method and device |
Also Published As
Publication number | Publication date |
---|---|
CN111831911B (en) | 2023-07-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111831911A (en) | Query information processing method and device, storage medium and electronic device | |
CN109388795B (en) | Named entity recognition method, language recognition method and system | |
CN109582799B (en) | Method and device for determining knowledge sample data set and electronic equipment | |
CN113377971B (en) | Multimedia resource generation method and device, electronic equipment and storage medium | |
CN110909725A (en) | Method, device and equipment for recognizing text and storage medium | |
CN117056471A (en) | Knowledge base construction method and question-answer dialogue method and system based on generation type large language model | |
CN104239340B (en) | Search result screening technique and device | |
CN108628830B (en) | Semantic recognition method and device | |
JP2020027649A (en) | Method, apparatus, device and storage medium for generating entity relationship data | |
US11250035B2 (en) | Knowledge graph generating apparatus, method, and non-transitory computer readable storage medium thereof | |
CN111046221A (en) | Song recommendation method and device, terminal equipment and storage medium | |
CN108304424B (en) | Text keyword extraction method and text keyword extraction device | |
CN111310440A (en) | Text error correction method, device and system | |
CN112836057B (en) | Knowledge graph generation method, device, terminal and storage medium | |
CN112650842A (en) | Human-computer interaction based customer service robot intention recognition method and related equipment | |
CN110209780B (en) | Question template generation method and device, server and storage medium | |
CN110852056A (en) | Method, device and equipment for acquiring text similarity and readable storage medium | |
CN105653547A (en) | Method and device for extracting keywords of text | |
CN112632950A (en) | PPT generation method, device, equipment and computer-readable storage medium | |
CN118093839B (en) | Knowledge operation question-answer dialogue processing method and system based on deep learning | |
CN114141384A (en) | Method, apparatus and medium for retrieving medical data | |
CN112732743B (en) | Data analysis method and device based on Chinese natural language | |
CN112148958A (en) | Method, apparatus, and computer storage medium for information recommendation | |
CN117932022A (en) | Intelligent question-answering method and device, electronic equipment and storage medium | |
WO2021135103A1 (en) | Method and apparatus for semantic analysis, computer device, and storage medium |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |