A Question Answering Method and Device Based on Knowledge Graph

Through the Q&A method based on knowledge graph, users can directly acquire a variety of literary knowledge during the writing process, solving the problem of frequent switching tools and improving efficiency and experience.

CN114647718BActive Publication Date: 2025-08-05BEIJING KINGSOFT DIGITAL ENTERTAINMENT CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202011507708.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-18
Publication Date
2025-08-05
Estimated Expiration
2040-12-18

AI Technical Summary

Technical Problem

In the prior art, when users need to acquire multiple types of literary knowledge during the writing process, they must frequently switch different tools for searching, resulting in inefficiency and affecting the continuity of writing.

Method used

Through a question-and-answer method based on knowledge graph, the matching of the question statements with multiple knowledge fields is obtained, and the knowledge graph is used for quadratic matching, the problem type and target knowledge field are determined, and the query statement is constructed to query to return the answer.

Benefits of technology

You can directly obtain relevant knowledge without switching tools, which improves users' efficiency in obtaining answers and writing experience, and shortens the path to obtaining knowledge.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114647718B_ABST
    Figure CN114647718B_ABST
Patent Text Reader

Abstract

The present application provides a question-answering method and device based on a knowledge graph, wherein the method includes: obtaining a question statement, matching the question statement with multiple question types corresponding to at least one knowledge field, and performing secondary matching with the knowledge graph of the corresponding field; determining the question type corresponding to the question statement and the target knowledge field to which the question type belongs based on preset conditions; constructing a target query statement according to the question-answering template corresponding to the question type and the question statement, and querying the knowledge graph corresponding to the target knowledge field through the target query statement and returning an answer.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of information data processing technology, and in particular to a question-answering method and apparatus based on a knowledge graph, a computing device, and a computer-readable storage medium. Background Art

[0002] In existing independent software and the Internet, the search engine services that can be provided are usually retrieval tools or simple questions and answers about single literary knowledge (such as idioms, ancient poems or golden sentences). In a certain scenario, users need to obtain and use multiple types of literary knowledge in writing. For example, to ask questions such as "idioms describing diligence", "the next sentence of looking up at the bright moon", and "Lu Xun's famous sayings", they must switch to different third-party search or dictionary tools many times. These tools currently mainly support returning relevant knowledge based on the keywords in the user's input. If the input information is relatively complex or does not exist in the tool's knowledge base, the required answer cannot be provided. As a result, users must spend a lot of time selecting different types of retrieval tools, and screening, filtering and comprehensive processing of the literary knowledge returned by the retrieval tools, which greatly disrupts the continuity of users' ideas about document writing and their user experience. Summary of the Invention

[0003] In view of this, the embodiments of the present application provide a question-answering method and apparatus based on a knowledge graph, a computing device, and a computer-readable storage medium to address the technical deficiencies in the prior art.

[0004] According to a first aspect of an embodiment of this specification, a question-answering method based on a knowledge graph is provided, comprising:

[0005] Obtain a question statement, match the question statement with multiple question types corresponding to at least one knowledge field, and perform secondary matching with the knowledge graph of the corresponding field;

[0006] Determining the question type corresponding to the question statement and the target knowledge domain to which the question type belongs based on preset conditions;

[0007] A target query statement is constructed according to the question-answer template corresponding to the question type and the question statement, and a query is performed in the knowledge graph corresponding to the target knowledge field through the target query statement to return an answer.

[0008] According to a second aspect of an embodiment of this specification, a knowledge question-answering device based on a knowledge graph is provided, comprising:

[0009] a statement matching module configured to obtain a question statement, match the question statement with a plurality of question types corresponding to at least one knowledge domain, and perform secondary matching with a knowledge graph of the corresponding domain;

[0010] A question type determination module is configured to determine the question type corresponding to the question statement and the target knowledge domain to which the question type belongs based on preset conditions;

[0011] The answer generation module is configured to construct a target query statement based on the question and answer template corresponding to the question type and the question statement, and to query and return an answer in the knowledge graph corresponding to the target knowledge field through the target query statement.

[0012] According to the third aspect of the embodiments of this specification, a computing device is provided, including a memory, a processor, and computer instructions stored in the memory and executable on the processor, wherein the processor implements the steps of the knowledge graph-based question-answering method when executing the instructions.

[0013] According to a fourth aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores computer instructions, which, when executed by a processor, implement the steps of the knowledge graph-based question-answering method.

[0014] This application traverses the question types corresponding to the current knowledge field in turn through the question statements, and performs entity connection on the knowledge graph corresponding to the current knowledge field. By meeting the preset question type requirements, the question type corresponding to the question statement is determined, so that accurate answers and detailed information can be provided for users to choose. There is no need to segment the question statements, which shortens the path for users to obtain relevant knowledge. Users can directly ask questions and generate corresponding answers without switching to third-party tools, which greatly improves the efficiency of users in obtaining answers to questions and the user experience of question and answering. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 is a structural block diagram of a computing device provided in an embodiment of the present application;

[0016] Figure 2 This is a flowchart of the knowledge graph-based question-answering method provided in an embodiment of the present application;

[0017] Figure 3 is another flow chart of the question-answering method based on the knowledge graph provided in an embodiment of the present application;

[0018] Figure 4 is another flow chart of the question-answering method based on the knowledge graph provided in an embodiment of the present application;

[0019] Figure 5 is another flow chart of the question-answering method based on the knowledge graph provided in an embodiment of the present application;

[0020] Figure 6is another flow chart of the question-answering method based on the knowledge graph provided in an embodiment of the present application;

[0021] Figure 7 is another flow chart of the question-answering method based on the knowledge graph provided in an embodiment of the present application;

[0022] Figure 8 is another flow chart of the question-answering method based on the knowledge graph provided in an embodiment of the present application;

[0023] Figure 9 It is a structural diagram of a knowledge question-answering device based on a knowledge graph provided in an embodiment of the present application. DETAILED DESCRIPTION

[0024] The following description sets forth many specific details to facilitate a thorough understanding of the present application. However, the present application can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the scope of the present application. Therefore, the present application is not limited to the specific implementations disclosed below.

[0025] The terms used in one or more embodiments of this specification are for the purpose of describing specific embodiments only and are not intended to limit one or more embodiments of this specification. The singular forms "a," "the," and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.

[0026] It should be understood that although the terms "first," "second," and the like may be used in one or more embodiments of this specification to describe various information, such information should not be limited to these terms. These terms are merely used to distinguish information of the same type from one another. For example, "first" could also be referred to as "second," and similarly, "second" could also be referred to as "first," without departing from the scope of one or more embodiments of this specification.

[0027] First, the terms involved in one or more embodiments of the present invention are explained.

[0028] Knowledge Graph: A semantic network that aims to describe conceptual entities in the objective world and the relationships between them. It is a structured semantic knowledge base (Knowledge Base) used to describe concepts and their relationships in the physical world in symbolic form. Its basic components are triples, entities and their related attributes and attribute values. Entities are connected to each other through relationships, forming a network-like knowledge structure.

[0029] Triple: A representation method of knowledge graph. Common forms include (entity 1, relationship, entity 2) or (entity, attribute, attribute value) and (relationship, relationship attribute, relationship attribute value), etc. For example, (Yao Ming, plays for, NBA), (Yao Ming, height, 2.29m) and (plays for, current or not, no).

[0030] Entity: Also known as a node in the knowledge graph, entity is the basic unit of the knowledge graph and an important language unit that carries information in the text.

[0031] Attribute: Data Properties. Attributes are inherent characteristics of an entity or relationship. For example, Zhang San’s age is 24, where “age” is an attribute.

[0032] Entity Linking: Entity Linking is the process of mapping certain strings in a text to corresponding entities in the knowledge base.

[0033] Question type: This refers to the type of user question. In this article, questions are categorized into three main categories: idioms, poetry, and famous quotes, each corresponding to three different graphs. Each category has a Q&A template for that specific question type. The question type also serves as the name of the corresponding Q&A template (e.g., PoetryQuestionTypes.POETRY_CONTENT, a poetry question category).

[0034] Question and answer template: Question and answer template is a unified name for all templates from questions to answers in this article. It is specifically divided into question and answer templates, Cypher templates, and answer result templates.

[0035] Query statements: Query statements are database query and programming languages similar to Structured Query Language (SQL), such as Cypher Query. Cypher is a descriptive graph query language that allows expressive and efficient queries on graph storage without having to write graph structure traversal code.

[0036] Knowledge domain: refers to all the "knowledge" corresponding to a certain "domain", where "domain" is part of the objective world and is the finite union of all concepts in the problem space; "knowledge" is the union of all concepts and all axioms in a certain domain. At the same time, the knowledge domain in this application can refer to a field containing specific knowledge under a vertical field. The vertical field mainly refers to a non-comprehensive, professional, and in-depth subdivision of a specific field. For example, government affairs, literature, finance, sports, and entertainment all belong to vertical fields, and each vertical field includes its corresponding concept set.

[0037] In this application, a question-answering method and apparatus based on a knowledge graph, a computing device, and a computer-readable storage medium are provided, which are described in detail one by one in the following embodiments.

[0038] Figure 1 1 shows a block diagram of a computing device 100 according to an embodiment of the present disclosure. Components of the computing device 100 include, but are not limited to, a memory 110 and a processor 120. The processor 120 is connected to the memory 110 via a bus 130, and a database 150 is used to store data.

[0039] The computing device 100 also includes an access device 140 that enables the computing device 100 to communicate via one or more networks 160. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 140 may include one or more of any type of network interface (e.g., a network interface card (NIC)), whether wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a Worldwide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.

[0040] In one embodiment of the present specification, the above components of the computing device 100 and Figure 1 Other components not shown in the figure may also be connected to each other, for example, via a bus. Figure 1 The computing device structure block diagram shown is for illustrative purposes only and is not intended to limit the scope of this specification. Those skilled in the art may add or replace other components as needed.

[0041] The computing device 100 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook computer, etc.), a mobile phone (e.g., a smartphone), a wearable computing device (e.g., a smartwatch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or PC. The computing device 100 may also be a mobile or stationary server.

[0042] The processor 120 may execute Figure 2 Steps in the method shown. Figure 2 It is a schematic flowchart showing a question-answering method based on a knowledge graph according to an embodiment of the present application, including steps 202 to 206.

[0043] Step 202: Obtain a question statement, match the question statement with multiple question types corresponding to at least one knowledge field, and perform secondary matching with the knowledge graph of the corresponding field.

[0044] In one embodiment of the present application, Figure 3 As shown, before obtaining the question statement in the target knowledge domain, steps 302 to 304 are also included:

[0045] Step 302: Based on the knowledge data corresponding to at least one knowledge field, construct a knowledge graph corresponding to each knowledge field.

[0046] When applied, the question-answering method of this application can ask and answer questions related to a specific vertical field. The vertical field mainly refers to a non-comprehensive, professional, and in-depth subdivision of a specific field. For example, government affairs, literature, finance, sports, and entertainment all belong to vertical fields. For example, within the vertical field of literature, multiple knowledge fields such as idioms, poetry, and celebrity quotes can be divided as the main objects of knowledge question-answering in this application. Then, knowledge data in the idiom field, poetry field, and celebrity quote field are obtained respectively through open source databases, encyclopedias, or machine learning, so as to construct an idiom knowledge graph, a poetry knowledge graph, and a celebrity quote knowledge graph and store them in the noe4j graph database.

[0047] Step 304: Determine at least one question type corresponding to each knowledge domain.

[0048] At the same time, this application will also merge the high-frequency questions that often appear in the field of idioms and poetry, and construct multiple question types corresponding to each knowledge field and store them in the question type database. The first type is to confirm the keywords of the big "category" of the question template, such as "idioms", "poems", "famous quotes", etc.; the second type is the keyword in each question template, which works together with the entity conditions to further confirm the specific question type corresponding to the question sentence; the two have different functions, but there is a possibility of duplication, that is, if there is the keyword "idiom" in the question, it can be determined that it is a question in the big category of "idioms". Some question templates of the idiom category may also need to meet the keyword "idiom" in the question sentence, of course, only a part of it. The entity conditions and keyword conditions in the template are not independent of each other, and both conditions need to be met at the same time.

[0049] Specifically, when the question statement is "the interpretation of hearing the cock-crow and rising to dance", when traversing the idiom question template IDIOM_MEANING (when traversing the idiom template, it is necessary to switch the graph to the idiom graph), it is necessary to satisfy the existence of keywords in ['meaning', 'implication', 'definition', 'explanation'] in the question; it is also necessary to satisfy the existence of at least one idiom entity in the question (which can be found in the idiom knowledge graph, here is "hearing the cock-crow and rising to dance") - the type can be determined only when both the keyword condition and the entity condition are met.

[0050] The question types can be divided into two levels. The first level is the abstract types of "idioms", "poems", "famous quotes" and "mixed", and the corresponding second level is the specific types such as "idiom interpretation", "poems and upper and lower sentences", "famous quotes authors" or "query by feature identification", and at least one keyword is pre-defined in each question type, for example, "idioms", "poems", "famous quotes", "author", "description", "metaphor", "adjective", "previous sentence" and "next sentence", etc.

[0051] This application uses knowledge graphs and question types to identify the intent of question sentences, thereby avoiding errors when segmenting question sentences.

[0052] In one embodiment of the present application, the system or terminal of the present application first obtains the question statement (Question) input by the user, and then calls the knowledge graph corresponding to each knowledge field in at least one knowledge field, as well as the question type corresponding to each knowledge field, and forms a fixed calling order according to the number, complexity or recognition difficulty of the question type, matches the question statement with multiple question types corresponding to at least one knowledge field, and performs a secondary match with the knowledge graph of the corresponding field.

[0053] Specifically, if Figure 4 As shown, the question statement is matched with multiple question types corresponding to at least one knowledge field, and a second matching is performed with the knowledge graph of the corresponding field, including steps 402 to 406.

[0054] Step 402: Call the knowledge graph and multiple question types corresponding to each knowledge field in a preset order.

[0055] In the case where the question statement is a question related to the major category of literature, assuming that the major category of literature includes the field of idioms, the field of poetry, and the field of famous quotes, a specific calling order is set for each knowledge field according to dimensions such as the complexity of the corresponding question types in the field of idioms, the field of poetry, and the field of famous quotes, the number of types of question types, or the logical hierarchy of question types. For example, the idiom knowledge graph and multiple idiom question types corresponding to the idiom field, the poetry knowledge graph and multiple poetry question types corresponding to the poetry field, and the famous quote knowledge graph and multiple famous quote question types corresponding to the famous quote field are called in sequence in the order of idioms-poems-famous quotes.

[0056] Step 404: traverse the question statement through multiple question types corresponding to each knowledge field, and extract keywords from the question statement using keywords in each question type.

[0057] The system or terminal of the present application sequentially obtains multiple idiom question types in the idiom field, traverses the question statement through each idiom question type for keyword matching, and if the match is successful, it indicates that the question statement has the same keywords as a certain idiom question type and stops matching. If the match fails, it switches to the next poetry knowledge graph in sequence and so on.

[0058] It should be noted that when special keywords such as "idioms", "poems" or "famous quotes" appear, you can skip the preset order and directly call the corresponding knowledge graph and multiple question types.

[0059] Step 406: Based on the knowledge graph corresponding to each knowledge field, entity recognition is performed on the question statement through entity linking.

[0060] The system or terminal of the present application first switches to the idiom knowledge graph in sequence, and then performs entity recognition on the question statement through entity linking. If the recognition is successful, it means that the question statement contains entities in the idiom knowledge graph and stops matching. If the recognition fails, it switches to the next poetry knowledge graph in sequence and so on.

[0061] This application achieves comprehensive knowledge query by traversing the question types of each knowledge field through question statements and using the knowledge graph of each knowledge field for entity linking, thereby shortening the path for users to acquire literary knowledge.

[0062] Step 204: Determine the question type corresponding to the question statement and the target knowledge domain to which the question type belongs based on preset conditions.

[0063] In one embodiment of the present application, the preset conditions include keyword conditions and entity conditions, wherein the entity condition refers to determining whether the question statement contains an entity in the knowledge graph corresponding to the knowledge field, and if so, the entity condition is satisfied; the keyword condition refers to determining whether the question statement contains a keyword corresponding to any of the multiple question types corresponding to the knowledge field, and if so, the keyword condition is satisfied. For example, if the entity "idiom A" in the idiom knowledge graph appears in the question statement and contains the keywords "meaning", "implication", "implication", "interpretation" or "explanation", then it can be determined that the question type corresponding to the question statement is "query idiom interpretation", and the corresponding target knowledge field is the idiom field. If not, continue to traverse other idiom question types. If the keywords "source", "from" or "from" are matched, then it can be determined that the question type corresponding to the question statement is "query idiom source", and the corresponding target knowledge field is the idiom field.

[0064] In the above embodiment, each entity in the knowledge graph corresponding to each of the knowledge fields is provided with at least one feature label, and the feature label can generally represent the "core keyword" of each idiom, poem or famous quote. At the same time, at least one attribute information corresponding to the entity in each knowledge graph often contains key information that can represent the entity. For example, if the author of the famous quote is a writer or celebrity with high reputation, the author's corresponding name words such as "Lu Xun" or "Mencius" can be used as the keyword for the text corpus of the famous quote, and the method can be manually introduced. Others such as the author's name, type, source work, country or era, etc. can be introduced as special feature labels. The system or terminal of the present application establishes an association relationship between each entity and its label. For example, the famous quote "The trustworthy person is the happiest, and the honest is the most naive." and its feature labels "integrity", "honesty" and "Lu Xun" are respectively used as entities and establish an association relationship, thereby realizing label matching using the knowledge graph.

[0065] Therefore, under the condition that each entity in the knowledge graph corresponding to each of the knowledge fields is provided with at least one characteristic label, the preset condition also includes a label condition, i.e., determining whether the question statement contains the characteristic label in the knowledge graph corresponding to the knowledge field, wherein, in the case where there are multiple characteristic labels in the question statement, the same characteristic labels should be excluded, and the characteristic label with the longest number of characters should be selected, or at least one characteristic label that can represent multiple characteristic labels can be calculated or predicted by a computer algorithm or a neural network model, or the characteristic labels can be screened according to preset rules to ensure that there is no inclusive relationship between the multiple characteristic labels and there is mutual difference. For example, if the question statement contains "the characteristic label B of the idiom" and the keyword "idiom", it can be determined that the question type corresponding to the question statement is "querying for idioms with the characteristic label B", and the corresponding target knowledge field is the idiom field.

[0066] It's important to note that in all three graphs, whether it's the idiom graph, the poetry graph, or the famous quote graph, entities are associated with one or more feature tags. For example, the idiom graph is stored in Neo4j as "idiom" and "tag" nodes, with lines connecting them where they're related. Feature tags can also be considered a type of "entity condition."

[0067] Of course, there are other idiom question types, such as "Query the dynasty of idioms", "Query the story of idioms", "Query idioms containing X characters", "Query idioms with N characters", "Query synonyms of idioms", and "Query antonyms of idioms", etc. Each idiom question type has its corresponding entity conditions and keyword conditions. For poetry question types and celebrity quote question types, please refer to the idiom question type, and this application will not go into details again.

[0068] In another embodiment of the present application, Figure 5 As shown, in the case where the question type corresponding to the question statement cannot be determined based on meeting the preset conditions, steps 502 to 508 are also included.

[0069] Step 502: Determine whether the question statement contains any of the preset special keywords; if so, execute step 504; if not, execute step 508.

[0070] In the above embodiment, if the question statement is matched in the order of idioms-poems-famous quotes by calling the idiom knowledge graph and multiple idiom question types corresponding to the idiom field, the poetry knowledge graph and multiple poetry question types corresponding to the poetry field, and the celebrity quote knowledge graph and multiple celebrity quote question types corresponding to the celebrity quote field, and still cannot determine the question type corresponding to the question statement, if there are special keywords such as "description", "metaphor" or "description" in the question statement, then the system or terminal of the present application will enter a comprehensive query. If there are still no special keywords, then the system or terminal of the present application will execute a fallback strategy.

[0071] Step 504: perform label matching between the question statement and the feature labels in the knowledge graph corresponding to all knowledge fields through entity linking.

[0072] In comprehensive queries, the knowledge graphs corresponding to all knowledge fields will be matched with the question statements through entity linking. Specifically, both the idiom knowledge graph and the poetry knowledge graph contain feature tags, so when matching, you can simultaneously search for corresponding feature tags. It should be noted that when matching feature tags, the longest feature tag should be matched. It cannot be the case that one side matches "mountain" and the other side matches "water", but empty matching is allowed.

[0073] In addition, in the field of poetry, if a whole sentence (greater than three characters) of poetry is matched in the question statement, then there are also some poetry question types similar to "the next sentence of poetry D", and the corresponding feature labels can be "five-character quatrain" or "seven-character regulated verse", etc., and the author of the poem is not used as the feature label of the poem, but the name of the character mentioned in the poem can be used as the feature label of the poem. For example, in "Summer Quatrain" and its line "I still miss Xiang Yu, who refused to cross the Yangtze River.", its author "Li Qingzhao" is not used as the feature label of the poem, but "Xiang Yu" can be used as the feature label of the poem.

[0074] Step 506: Construct a tag list based on the matched at least one feature tag, and generate an answer based on the tag list.

[0075] Since there may be multiple matched feature tags, a feature tag list is formed by several feature tags with the longest number of characters, or several feature tags manually screened, or several feature tags determined by the calculated probability distribution of each feature tag corresponding to the topic of the question statement, and all possible matching results are returned as the answer, that is, each feature tag corresponds to each entity in the knowledge graph in each knowledge field.

[0076] Step 508: Generate an answer through a fallback strategy.

[0077] Specifically, as Figure 6 shown, generating an answer through the fallback strategy includes steps 602 to 606.

[0078] Step 602: Invoke the knowledge graph corresponding to each knowledge domain in a preset order.

[0079] Step 604: Based on the knowledge graph corresponding to each knowledge domain, globally match the question statement across all knowledge domains by means of entity linking.

[0080] Step 606: Take all the entities and feature tags in the knowledge graph corresponding to each matched knowledge domain as the answer and return them.

[0081] In the fallback strategy, since the question statement does not contain keywords in the middle, it is impossible to perform intent recognition on the question statement. For example, when the user directly enters "having too much fun in the land of idleness to think of home", it is impossible to determine the question type. At this time, it is necessary to use the method of entity linking to identify idioms, poems, verses or feature tags in the question as much as possible. According to the preset order formed in the rule matching stage, the knowledge graph corresponding to each knowledge domain is invoked. Specifically, first match whether there are idioms in the question statement through the idiom knowledge graph, then match whether there are verses in the question statement through the poem knowledge graph, then match whether there are famous quotes in the question statement through the famous quotes knowledge graph, then perform label matching between multiple knowledge graphs, and finally perform matching of poem titles. Among them, the poem knowledge graph can perform fuzzy matching. The label matching between multiple knowledge graphs is a comprehensive query without keywords. When matching verses, it is required that the number of characters in the verse is not less than three to prevent misinterpreting some words in the verse as a verse and to ensure the general rule of the number of characters in the verse.

[0082] Fuzzy answers will also be given when generating answers. For example, if the question statement is "Describe autumn" or just "The torrent dashes down three thousand feet", then the system or terminal of the present application will return all the idioms and poems related to "autumn" through the fallback strategy, or find the ancient poem "Viewing the Lu Mountain Waterfall" and then answer "The following answers are found for you: xxx".

[0083] The present application compensates for the processing of special or fuzzy questions input by users through comprehensive query and fallback strategy, ensuring the smooth progress and implementation of question answering.

[0084] Step 206: Construct a target query statement according to the question-answering template corresponding to the question type and the question statement, and query and return an answer in the knowledge graph corresponding to the target knowledge domain through the target query statement.

[0085] In one embodiment of the present application, step 206 specifically includes steps 702 to 706 .

[0086] Step 702: Obtain the entities matched to the question statement in the knowledge graph corresponding to the target knowledge domain.

[0087] Step 704: Fill the matched entities into the empty slots of the question-answer template corresponding to the question type by slot filling, and generate a target query statement corresponding to the question statement.

[0088] Step 706: Query the knowledge graph corresponding to the target knowledge domain through the target query statement and return the answer.

[0089] After determining the question type corresponding to the question statement, this application further determines the question-answering template corresponding to the question type, and the entities matched to the question statement in the knowledge graph corresponding to the target knowledge field, and then fills the matched entities into the empty slots of the question-answering template corresponding to the question type by slot filling, to obtain the target query statement corresponding to the question statement, and then searches the knowledge graph corresponding to the target knowledge field according to the target query statement, and uses the returned data as the final answer. For example, the question statement is "the author of Quiet Night Thoughts", and its corresponding question type is "query the author of poetry", and finally answers according to the template: the author of the poem "Quiet Night Thoughts" is "Li Bai", and at the same time returns the translation, appreciation, author profile and other related content of "Quiet Night Thoughts" from the poetry knowledge graph; for another example, the question statement is "idioms describing autumn", and its corresponding question type is "query idioms with the feature label "autumn", and finally answers according to the template: idioms describing autumn include "the maple forest is dyed with colors, one leaf knows autumn, frost "Ye Zhiqiu, Qiu Yang Gaogao", and at the same time return the analysis and source of each idiom and other related content from the idiom knowledge graph; for example, the question statement is "What are Lu Xun's classic quotes?", and its corresponding question type is "Query the famous quotes of the author "Lu Xun"." The final answer is according to the template: Lu Xun's famous quotes include "People who keep their promises are the happiest, and honesty is the most naive." At the same time, the author "Lu Xun", type "maxim", country "China", era "modern and contemporary" and other attribute information are returned from the famous quotes knowledge graph.

[0090] This application traverses the problem types corresponding to the current knowledge domain for the problem statement in sequence, and performs entity connection on the knowledge graph corresponding to the current knowledge domain. By satisfying the preset conditions for the problem type, the problem type corresponding to the problem statement is determined, so as to provide accurate answers and their detailed information for the user to choose. There is no need to segment the problem statement, shortening the path for the user to obtain relevant knowledge, enabling the user to directly ask questions and generate corresponding answers without switching to a third-party tool, greatly improving the efficiency of the user to obtain the problem answer and the usage experience of the question and answer.

[0091] Figure 8 FIG. shows a knowledge graph-based question and answer method according to an embodiment of the present specification. The knowledge graph-based question and answer method is described by taking the problem statement "having no thought of Shu" as an example, and includes steps 802 to 812.

[0092] Step 802: Defaultly mark the problem statement "having no thought of Shu" as "unknown".

[0093] Step 804: Traverse the idiom knowledge graph and multiple idiom problem types for the problem statement "having no thought of Shu", match the idiom problem type that meets the specified conditions. If the match is successful, change the mark to "idiom" and determine the problem type to generate an answer.

[0094] It should be noted that it is also possible to selectively traverse the poetry knowledge graph or the famous quotes knowledge graph and their problem types, and the specific order can be adjusted according to the actual situation or directly selected according to whether there are special keywords in the problem statement.

[0095] Step 806: Traverse the poetry knowledge graph and multiple poetry problem types for the problem statement "having no thought of Shu", match the poetry problem type that meets the specified conditions. If the match is successful, change the mark to "poetry" and determine the problem type to generate an answer.

[0096] Step 808: Traverse the poetry knowledge graph and multiple famous quotes problem types for the problem statement "having no thought of Shu", match the famous quotes problem type that meets the specified conditions. If the match is successful, change the mark to "gold-sentences" and determine the problem type to generate an answer.

[0097] Step 810: Perform a comprehensive query on the problem statement "having no thought of Shu". In the case of matching at least one feature tag, change the mark to "chaos" and generate an answer according to the feature tag list.

[0098] Step 812: In the case where the mark is still "unknown", generate a fuzzy answer corresponding to the problem statement "having no thought of Shu" through a fallback strategy.

[0099] This application can switch between different literary knowledge graphs according to the natural question-and-answer sentences input by the user, thereby answering the literary questions raised by the user and providing accurate corresponding idioms, poems, golden sentences, etc. and their detailed information for the user to choose, shortening the user's path to acquiring literary knowledge, allowing users to directly ask questions and generate corresponding answers during the writing process without switching to third-party tools, making it easier for users to maintain high efficiency in literary creation.

[0100] Corresponding to the above method embodiment, this specification also provides an embodiment of a knowledge question answering device based on a knowledge graph. Figure 9 The schematic diagram of the structure of the knowledge question answering device based on the knowledge graph of one embodiment of this specification is shown. Figure 9 As shown, the device includes:

[0101] The sentence matching module 901 is configured to obtain a question sentence, match the question sentence with multiple question types corresponding to at least one knowledge domain, and perform secondary matching with the knowledge graph of the corresponding domain;

[0102] The question type determination module 902 is configured to determine the question type corresponding to the question statement and the target knowledge domain to which the question type belongs based on preset conditions;

[0103] The answer generation module 903 is configured to construct a target query statement based on the question and answer template corresponding to the question type and the question statement, and to query and return an answer in the knowledge graph corresponding to the target knowledge field through the target query statement.

[0104] Optionally, the device further comprises:

[0105] A graph construction module is configured to construct a knowledge graph corresponding to each knowledge field based on the knowledge data corresponding to at least one knowledge field;

[0106] The question type building module is configured to determine at least one question type corresponding to each knowledge domain, wherein at least one keyword is predefined in each question type.

[0107] Optionally, the statement matching module 901 includes:

[0108] A data calling unit is configured to call the knowledge graph and multiple question types corresponding to each knowledge field in a preset order;

[0109] An entity recognition unit is configured to perform entity recognition on the question statement by entity linking according to the knowledge graph corresponding to each knowledge field;

[0110] The keyword extraction unit is configured to traverse the question statement through multiple question types corresponding to each knowledge field, and extract keywords from the question statement through keywords in each question type.

[0111] Optionally, the device further comprises:

[0112] A comprehensive query module is configured to determine whether the question statement contains any of the preset multiple special keywords; if so, execute the tag matching module; if not, execute the fallback module;

[0113] A label matching module is configured to perform label matching between the question statement and the feature labels in the knowledge graph corresponding to all knowledge fields through entity linking;

[0114] The tag matching module is further configured to construct a tag list based on the matched at least one feature tag, and generate an answer based on the tag list;

[0115] The fallback module is configured to generate answers through a fallback strategy.

[0116] Optionally, the backup module includes:

[0117] A data calling unit is configured to call the knowledge graph corresponding to each knowledge field in a preset order;

[0118] A fuzzy matching unit is configured to perform fuzzy matching on the question statement by entity linking according to the knowledge graph corresponding to each knowledge field;

[0119] The answer returning unit is configured to return all entities and feature labels in the knowledge graph corresponding to each matched knowledge field as answers.

[0120] Optionally, the answer generation module 903 includes:

[0121] An entity matching unit is configured to obtain entities matched to the question statement in the knowledge graph corresponding to the target knowledge domain;

[0122] The statement construction unit is configured to fill the matched entity into the empty slot of the question-answer template corresponding to the question type by slot filling, and generate a target query statement corresponding to the question statement.

[0123] This application traverses the question types corresponding to the current knowledge field in turn through the question statements, and performs entity connection on the knowledge graph corresponding to the current knowledge field. By meeting the preset question type requirements, the question type corresponding to the question statement is determined, so that accurate answers and detailed information can be provided for users to choose. There is no need to segment the question statements, which shortens the path for users to obtain relevant knowledge. Users can directly ask questions and generate corresponding answers without switching to third-party tools, which greatly improves the efficiency of users in obtaining answers to questions and the user experience of question and answering.

[0124] It should be noted that the components in a device claim should be understood as the functional modules necessary to implement each step of the program flow or method. The individual functional modules are not defined by actual functional division or separation. A device claim defined by such a set of functional modules should be understood as a functional module architecture that primarily implements the solution through the computer program described in the specification, rather than a physical device that primarily implements the solution through hardware.

[0125] An embodiment of the present application further provides a computing device, including a memory, a processor, and computer instructions stored in the memory and executable on the processor, wherein when the processor executes the instructions, the following steps are implemented:

[0126] Obtain a question statement, match the question statement with multiple question types corresponding to at least one knowledge field, and perform secondary matching with the knowledge graph of the corresponding field;

[0127] Determining the question type corresponding to the question statement and the target knowledge domain to which the question type belongs based on preset conditions;

[0128] A target query statement is constructed according to the question-answer template corresponding to the question type and the question statement, and a query is performed in the knowledge graph corresponding to the target knowledge field through the target query statement to return an answer.

[0129] An embodiment of the present application also provides a computer-readable storage medium storing computer instructions, which, when executed by a processor, implement the steps of the knowledge graph-based question-answering method as described above.

[0130] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of this computer-readable storage medium and the technical scheme of the above-mentioned knowledge graph-based question-answering method are based on the same concept. For details not described in detail in the technical scheme of the computer-readable storage medium, please refer to the description of the technical scheme of the above-mentioned knowledge graph-based question-answering method.

[0131] The foregoing description of this specification describes specific embodiments. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that described in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or the sequential order to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0132] The computer instructions include computer program code, which may be in source code form, object code form, executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal, and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.

[0133] It should be noted that for the aforementioned method embodiments, for ease of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.

[0134] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0135] The preferred embodiments of the present application disclosed above are intended only to help illustrate the present application. The optional embodiments do not describe all details in detail, nor do they limit the invention to the specific embodiments described. Obviously, many modifications and variations can be made based on the content of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present application, so that those skilled in the art can better understand and utilize the present application. The present application is limited only by the claims and their full scope and equivalents.

Claims

1. A question-answering method based on knowledge graph, characterized in that: include: Get the question statement and call the knowledge graph and multiple question types corresponding to each knowledge field in a preset order; Traverse the question statement through multiple question types corresponding to each knowledge field, and extract keywords from the question statement using keywords in each question type; According to the knowledge graph corresponding to each knowledge field, entity recognition is performed on the question sentence by entity linking, wherein the knowledge fields include idiom field, poetry field and famous quote field; Determine the question type corresponding to the question statement and the target knowledge domain to which the question type belongs based on preset conditions, wherein the preset conditions include: determining whether the question statement contains keywords corresponding to any of the multiple question types corresponding to the knowledge domain; and further determining whether the question statement contains entities in the knowledge graph corresponding to the knowledge domain; Each entity in the knowledge graph corresponding to each of the knowledge fields is correspondingly provided with at least one feature tag, and the preset condition further includes: determining whether the question statement contains the feature tag in the knowledge graph corresponding to the knowledge field; A target query statement is constructed according to the question-answer template corresponding to the question type and the question statement, and a query is performed in the knowledge graph corresponding to the target knowledge field through the target query statement to return an answer.

2. The method according to claim 1, characterized in that Before getting the question statement, it also includes: Based on the knowledge data corresponding to at least one knowledge field, construct a knowledge graph corresponding to each knowledge field; Identify at least one question type for each knowledge area; At least one keyword is predefined in each question type.

3. The method according to claim 1, characterized in that in, When there are multiple feature tags in the question sentence, identical feature tags are excluded, and the feature tag with the longest number of characters is selected.

4. The method according to claim 3, characterized in that In the case where the question type corresponding to the question statement cannot be determined based on the preset conditions, the method further includes: Determining whether the question statement contains any of the preset multiple special keywords; If so, the question statement is matched with the feature labels in the knowledge graph corresponding to all knowledge fields through entity linking; Building a tag list based on the matched at least one feature tag, and generating an answer based on the tag list; If not, an answer is generated through a catch-all strategy, wherein the catch-all strategy is to globally match the question statement in all knowledge fields, and return all entities and feature labels in the knowledge graph corresponding to each knowledge field that is matched as the answer.

5. The method according to claim 4, characterized in that Generate answers through a comprehensive strategy, including: Call the knowledge graph corresponding to each knowledge field in the preset order; According to the knowledge graph corresponding to each knowledge domain, the question statement is globally matched in all knowledge domains by entity linking; All entities and feature labels in the knowledge graph corresponding to each matched knowledge field are returned as answers.

6. The method according to claim 1, characterized in that Constructing a target query statement based on the question-answer template corresponding to the question type and the question statement, including: Obtaining entities matched to the question statement in the knowledge graph corresponding to the target knowledge domain; The matched entity is filled into the empty slot of the question-answer template corresponding to the question type by slot filling, and a target query statement corresponding to the question statement is generated.

7. A knowledge question-answering device based on knowledge graph, characterized in that: include: The sentence matching module is configured to obtain the question sentence and call the knowledge graph corresponding to each knowledge field and multiple question types in a preset order; Traverse the question statement through multiple question types corresponding to each knowledge field, and extract keywords from the question statement using keywords in each question type; According to the knowledge graph corresponding to each knowledge field, entity recognition is performed on the question sentence by entity linking, wherein the knowledge fields include idiom field, poetry field and famous quote field; The question type determination module is configured to determine the question type corresponding to the question statement and the target knowledge domain to which the question type belongs based on preset conditions, wherein the preset conditions include: determining whether the question statement contains keywords corresponding to any of the multiple question types corresponding to the knowledge domain; further determining whether the question statement contains entities in the knowledge graph corresponding to the knowledge domain; each entity in the knowledge graph corresponding to each knowledge domain is correspondingly provided with at least one feature tag; the preset conditions also include: determining whether the question statement contains feature tags in the knowledge graph corresponding to the knowledge domain; The answer generation module is configured to construct a target query statement based on the question and answer template corresponding to the question type and the question statement, and to query and return an answer in the knowledge graph corresponding to the target knowledge field through the target query statement.

8. The device according to claim 7, characterized in that Also includes: A graph construction module is configured to construct a knowledge graph corresponding to each knowledge field based on the knowledge data corresponding to at least one knowledge field; The question type building module is configured to determine at least one question type corresponding to each knowledge domain.

9. A computing device comprising a memory, a processor, and computer instructions stored in the memory and executable on the processor, wherein: When the processor executes the instructions, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer-readable storage medium storing computer instructions, characterized in that: When the instruction is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

11. A computer program product, characterized in that The method comprises computer instructions, which, when executed by a processor, implement the steps of the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Answer providing method and apparatus

    CN106919655A

  • Intelligent question-answering method and system based on knowledge graph

    CN111309877A

  • Entity query method and device based on knowledge graph

    CN111522927A