CN113204628A - Method and device for obtaining answers to question sentences, electronic equipment and readable storage medium - Google Patents

Method and device for obtaining answers to question sentences, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN113204628A
CN113204628A CN202110532093.2A CN202110532093A CN113204628A CN 113204628 A CN113204628 A CN 113204628A CN 202110532093 A CN202110532093 A CN 202110532093A CN 113204628 A CN113204628 A CN 113204628A
Authority
CN
China
Prior art keywords
question
character string
obtaining
entity
acquiring
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110532093.2A
Other languages
Chinese (zh)
Inventor
张文剑
薛小娜
王博
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Minglue Artificial Intelligence Group Co Ltd
Original Assignee
Shanghai Minglue Artificial Intelligence Group Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Minglue Artificial Intelligence Group Co Ltd filed Critical Shanghai Minglue Artificial Intelligence Group Co Ltd
Priority to CN202110532093.2A priority Critical patent/CN113204628A/en
Publication of CN113204628A publication Critical patent/CN113204628A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/332Query formulation
    • G06F16/3329Natural language query formulation or dialogue systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/36Creation of semantic tools, e.g. ontology or thesauri
    • G06F16/367Ontology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying
    • G06F16/90335Query processing
    • G06F16/90344Query processing by using string matching techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/237Lexical tools
    • G06F40/247Thesauruses; Synonyms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computational Linguistics (AREA)
  • Databases & Information Systems (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Health & Medical Sciences (AREA)
  • Data Mining & Analysis (AREA)
  • General Health & Medical Sciences (AREA)
  • Mathematical Physics (AREA)
  • Human Computer Interaction (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Animal Behavior & Ethology (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application relates to the technical field of knowledge maps and discloses a method for acquiring answers to question sentences, which comprises the following steps: acquiring a first alternative entity corresponding to a question character string; acquiring first label information of a first alternative entity, and acquiring characteristic information corresponding to the first label information; the characteristic information is used for representing a first relation corresponding to the first label information or a first attribute corresponding to the first label information; obtaining synonyms of the characteristic information, and obtaining answer candidate paths in a preset knowledge graph database according to the first candidate entities and the synonyms; and obtaining answers corresponding to the question character strings according to the answer candidate paths. Because the synonym of the characteristic information is considered when the answer candidate path is obtained, the answer candidate path is obtained together according to the alternative entity and the synonym, so that more accurate answer candidate path can be obtained, and the answer credibility is improved. The application also discloses a device, electronic equipment and a storage medium for obtaining the answers to the question sentences.

Description

Method and device for obtaining answers to question sentences, electronic equipment and readable storage medium
Technical Field
The present application relates to the field of knowledge graph technology, and for example, to a method, an apparatus, an electronic device, and a readable storage medium for obtaining answers to questions.
Background
Knowledge question-answering is a question-answering form based on a knowledge graph library and is mainly applied to intelligent customer service systems in the industries of medical treatment, banks, insurance and the like. Knowledge question answering means that a question is given, the question is semantically understood and analyzed, and the answer of the question is obtained through query of a graph database.
In the process of implementing the embodiments of the present disclosure, it is found that at least the following problems exist in the related art: in the prior art, under the condition of knowledge question answering, the screened candidate paths are not accurate enough due to the diversity and complexity of natural language expression in input question character strings, so that the reliability of answers obtained by a user during the knowledge question answering is not high.
Disclosure of Invention
The following presents a simplified summary in order to provide a basic understanding of some aspects of the disclosed embodiments. This summary is not an extensive overview nor is intended to identify key/critical elements or to delineate the scope of such embodiments but rather as a prelude to the more detailed description that is presented later.
The embodiment of the disclosure provides a method, a device, an electronic device and a readable storage medium for obtaining answers to questions and sentences, so as to improve the credibility of the answers obtained during knowledge question answering.
In some embodiments, the method for obtaining answers to question sentences includes: acquiring a question character string; acquiring a first alternative entity corresponding to the question character string; acquiring first label information of the first alternative entity, and acquiring characteristic information corresponding to the first label information; the characteristic information is used for representing a first relation corresponding to the first label information or a first attribute corresponding to the first label information; obtaining synonyms of the feature information, and obtaining answer candidate paths in a preset knowledge graph database according to the first candidate entities and the synonyms; and obtaining the answer corresponding to the question character string according to the answer candidate path.
In some embodiments, the means for obtaining answers to question sentences includes: a first obtaining module configured to obtain a question string; the second acquisition module is configured to acquire a first alternative entity corresponding to the question string; a third obtaining module, configured to obtain first tag information of the first candidate entity, and obtain feature information corresponding to the first tag information; the characteristic information is used for representing a first relation corresponding to the first label information or a first attribute corresponding to the first label information; the fourth obtaining module is configured to obtain synonyms of the feature information, and obtain answer candidate paths in a preset knowledge graph database according to the first candidate entities and the synonyms; and the fifth acquisition module is configured to acquire answers corresponding to the question character strings according to the answer candidate paths.
In some embodiments, the electronic device includes a processor and a memory storing program instructions, the processor being configured to execute the above-described method for obtaining answers to question sentences when executing the program instructions.
In some embodiments, the readable storage medium stores executable instructions that, when executed, perform the above-described method for obtaining answers to question sentences.
The method, the device, the electronic equipment and the readable storage medium for obtaining the answers to the question sentences, provided by the embodiment of the disclosure, can achieve the following technical effects: acquiring a question character string; acquiring a first alternative entity corresponding to a question character string; acquiring first label information of a first alternative entity, and acquiring characteristic information corresponding to the first label information; the characteristic information is used for representing a first relation corresponding to the first label information or a first attribute corresponding to the first label information; obtaining synonyms of the characteristic information, and obtaining answer candidate paths in a preset knowledge graph database according to the first candidate entities and the synonyms; and obtaining answers corresponding to the question character strings according to the answer candidate paths. The synonym of the characteristic information is considered when the answer candidate path is obtained, the answer candidate path is obtained according to the alternative entity and the synonym, and the answer corresponding to the question character string is obtained according to the answer candidate path, so that a more comprehensive answer candidate path can be obtained, and the reliability of the answer obtained when the user asks for knowledge is improved.
The foregoing general description and the following description are exemplary and explanatory only and are not restrictive of the application.
Drawings
One or more embodiments are illustrated by way of example in the accompanying drawings, which correspond to the accompanying drawings and not in limitation thereof, in which elements having the same reference numeral designations are shown as like elements and not in limitation thereof, and wherein:
fig. 1 is a schematic diagram of a method for obtaining answers to a question provided by an embodiment of the present disclosure;
fig. 2 is a schematic diagram of an apparatus for obtaining answers to a question provided in an embodiment of the present disclosure;
fig. 3 is a schematic diagram of an electronic device provided by an embodiment of the present disclosure.
Detailed Description
So that the manner in which the features and elements of the disclosed embodiments can be understood in detail, a more particular description of the disclosed embodiments, briefly summarized above, may be had by reference to the embodiments, some of which are illustrated in the appended drawings. In the following description of the technology, for purposes of explanation, numerous details are set forth in order to provide a thorough understanding of the disclosed embodiments. However, one or more embodiments may be practiced without these details. In other instances, well-known structures and devices may be shown in simplified form in order to simplify the drawing.
The terms "first," "second," and the like in the description and in the claims, and the above-described drawings of embodiments of the present disclosure, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It should be understood that the data so used may be interchanged under appropriate circumstances such that embodiments of the present disclosure described herein may be made. Furthermore, the terms "comprising" and "having," as well as any variations thereof, are intended to cover non-exclusive inclusions.
The term "plurality" means two or more unless otherwise specified.
In the embodiment of the present disclosure, the character "/" indicates that the preceding and following objects are in an or relationship. For example, A/B represents: a or B.
The term "and/or" is an associative relationship that describes objects, meaning that three relationships may exist. For example, a and/or B, represents: a or B, or A and B.
Referring to fig. 1, an embodiment of the present disclosure provides a method for obtaining answers to a question, including:
step S101, obtaining a question character string;
step S102, a first alternative entity corresponding to a question character string is obtained;
step S103, acquiring first label information of the first alternative entity and acquiring characteristic information corresponding to the first label information; the characteristic information is used for representing a first relation corresponding to the first label information or a first attribute corresponding to the first label information;
step S104, obtaining synonyms of the characteristic information, and obtaining answer candidate paths in a preset knowledge map database according to the first candidate entities and the synonyms;
step S105, obtaining answers corresponding to the question character strings according to the answer candidate paths.
By adopting the method for acquiring the answers of the question provided by the embodiment of the disclosure, the character string of the question is acquired; acquiring a first alternative entity corresponding to a question character string; acquiring first label information of a first alternative entity, and acquiring characteristic information corresponding to the first label information; the characteristic information is used for representing a first relation corresponding to the first label information or a first attribute corresponding to the first label information; obtaining synonyms of the characteristic information, and obtaining answer candidate paths in a preset knowledge graph database according to the first candidate entities and the synonyms; and obtaining answers corresponding to the question character strings according to the answer candidate paths. The synonym of the characteristic information is considered when the answer candidate path is obtained, the answer candidate path is obtained according to the alternative entity and the synonym, and the answer corresponding to the question character string is obtained according to the answer candidate path, so that the more accurate answer candidate path can be obtained, and the reliability of the answer obtained when the user asks for knowledge is improved.
Optionally, the obtaining of the first candidate entity corresponding to the question string includes: slicing the question character string to obtain a character string set; the character string set comprises a plurality of sub character strings; determining substrings which are the same as pre-stored character strings in a knowledge graph database as alternative substrings; acquiring a first alternative entity corresponding to an alternative substring from a knowledge graph database; the knowledge map database stores a first alternative entity and a pre-stored character string corresponding to the first alternative entity.
In some embodiments, the question string input by a user is acquired as "abcb", and the "abcb" is sliced to obtain a string set; the substrings in the string collection include "a", "b", "c", "ab", "bc", "cb", "abc", "bcb", and "abcb"; the pre-stored strings in the knowledge graph database include "abc" and "bcb"; the first alternative entities to which the alternative substrings correspond are "abc" and "bcb".
Optionally, after the obtaining of the candidate substring, the method further includes: and labeling the alternative substrings according to the first label information.
In this way, natural language processing is performed on the question character strings, and the question character strings are sliced to obtain substrings, so that the first alternative entities obtained in the knowledge map database are more comprehensive, and the answer reliability obtained when a user performs knowledge question answering is increased.
Optionally, preset first tag information of the first candidate entity is obtained, and feature information corresponding to the preset first tag information is obtained. Optionally, the feature information is used to characterize a first relationship of a first candidate entity corresponding to the first tag information; or the characteristic information is used for representing a first attribute of a first candidate entity corresponding to the preset first label information. The corresponding relation between the preset first tag information and the characteristic information is stored in the knowledge map database.
Optionally, the obtaining synonyms of the feature information includes: constructing a synonymy dictionary of the characteristic information through a Schema (data model) in a preset knowledge map database; and obtaining synonyms of the feature information according to the synonym dictionary. Optionally, the Schema of the knowledge graph database,
optionally, when the feature information is a first relationship corresponding to preset first tag information, a synonym corresponding to the first relationship is obtained from a preset synonym dictionary, and the synonym corresponding to the first relationship is determined as the synonym of the feature information.
Optionally, when the feature information is a first attribute corresponding to preset first tag information, a synonym corresponding to the first attribute is obtained from the synonym dictionary, and the synonym corresponding to the first attribute is determined as the synonym of the feature information.
Optionally, obtaining an answer candidate path in a preset knowledge graph database according to the first candidate entity and the synonym, including: acquiring the length of a first alternative entity and the position of the first alternative entity in a question character string, acquiring a first number of overlapped words between a synonym and the question character string, acquiring a first number of overlapped words between the synonym and the question character string, and acquiring a first character string distance between the synonym and the question character string; screening the first alternative entity according to the length, the position, the first overlapped word number and the first character string distance to obtain a second alternative entity; and obtaining an answer candidate path according to the second candidate entity.
Optionally, after obtaining a first number of words overlapped between the synonym and the question character string, and obtaining a first character string distance between the synonym and the question character string, the method further includes: acquiring a first number of overlapped words between a first relation and a question character string, acquiring a first number of overlapped words between the first relation and the question character string, and acquiring a first character string distance between the first relation and the question character string; the method comprises the steps of obtaining a first number of overlapped words between a first attribute and a question character string, obtaining a first number of overlapped words between the first attribute and the question character string, and obtaining a first character string distance between the first attribute and the question character string.
Optionally, the screening the first candidate entity according to the length, the position, the first number of overlapped words, and the first string distance to obtain a second candidate entity includes: respectively acquiring the weight of the length, the position, the first overlapped word number and the first character string distance; according to the weights, carrying out weighted calculation on the length, the position, the first overlapped word number and the first character string distance to obtain a score of the alternative entity; and acquiring a second alternative entity from the first alternative entity according to the alternative entity score.
Optionally, the obtaining the weights of the length, the position, the first overlapped word number and the first character string distance respectively comprises: obtaining a weight of a length of a first candidate entity, obtaining a weight of a position of the first candidate entity in a question string, obtaining a weight of a first number of overlapping words between a synonym and the question string, obtaining a weight of a first number of overlapping words between a first relationship and the question string, obtaining a weight of a first number of overlapping words between a first attribute and the question string, obtaining a weight of a first distance of a string between a synonym and the question string, obtaining a weight of a first distance of a string between a first relationship and the question string, and obtaining a weight of a first distance of a string between a first attribute and the question string.
Optionally, obtaining a second candidate entity from the first candidate entity according to the candidate entity score includes: and determining the two first candidate entities with the highest scores of the candidate entities as second candidate entities.
Optionally, obtaining an answer candidate path according to a second candidate entity includes: acquiring second label information of a second alternative entity; matching a second relation corresponding to the second tag information from the knowledge graph database; the knowledge map database stores the corresponding relation between the second tag information and the second relation; and determining an answer candidate path according to the second relation and the second candidate entity.
Optionally, the second tag information is the same as the first tag information.
Optionally, matching a second relationship corresponding to the second tag information from the knowledge graph database includes: matching a second relation corresponding to the second tag information from the Schema of the knowledge graph database; the Schema of the knowledge map database stores the corresponding relationship between the second tag information and the second relationship.
Optionally, determining an answer candidate path according to the second relationship and the second candidate entity includes: and determining the second relation and the second candidate entity as answer candidate paths.
Optionally, obtaining an answer candidate path according to a second candidate entity includes: acquiring second label information of a second alternative entity; matching a second attribute corresponding to the second tag information from the knowledge graph database; the knowledge map database stores the corresponding relation between the second tag information and the second attribute; and determining an answer candidate path according to the second candidate entity or the second attribute.
Optionally, the second tag information is the same as the first tag information.
Optionally, matching a second attribute corresponding to the second tag information from the knowledge graph database includes: matching a second attribute corresponding to the second tag information from the Schema of the knowledge graph database; the Schema of the knowledge map database stores the corresponding relationship between the second tag information and the second attribute.
Optionally, determining an answer candidate path according to the second attribute and the second candidate entity includes: and determining the second attribute and the second candidate entity as the answer candidate path.
Optionally, obtaining an answer corresponding to the question character string according to the answer candidate path includes: acquiring a second number of overlapped words between the answer candidate path and the question character string, acquiring a second character string distance between the answer candidate path and the question character string, and acquiring semantic similarity between the answer candidate path and the question character string; obtaining a path score corresponding to the answer candidate path according to the second overlapped word number, the second character string distance and the semantic similarity, and determining the answer candidate path with the highest path score as the answer path; and inquiring answers corresponding to the question character strings in a knowledge map database according to the answer paths.
Optionally, in the case that the answer candidate path is a second relationship and a second alternative entity; obtaining a second number of overlapped words between the answer candidate path and the question character string, obtaining a second character string distance between the answer candidate path and the question character string, and obtaining semantic similarity between the answer candidate path and the question character string, the method further comprises the following steps: and acquiring a synonym of the second relation, acquiring a second character overlapping number between the synonym and the question character string, and acquiring a second overlapping word number between the synonym and the question character string.
Optionally, in the case that the answer candidate path is a second attribute and a second alternative entity; obtaining a second number of overlapped words between the answer candidate path and the question character string, obtaining a second character string distance between the answer candidate path and the question character string, and obtaining semantic similarity between the answer candidate path and the question character string, the method further comprises the following steps: and acquiring a synonym of the second attribute, acquiring a second character overlapping number between the synonym and the question character string, and acquiring a second overlapping word number between the synonym and the question character string.
Optionally, obtaining a path score corresponding to the answer candidate path according to the second number of overlapped words, the second string distance, and the semantic similarity, includes: and respectively acquiring the weights of the second overlapped word number, the second character string distance and the semantic similarity, and performing weighted calculation on the second overlapped word number, the second character string distance and the semantic similarity according to the weights to obtain a path score corresponding to the answer candidate path.
In some embodiments, a question string is obtained, and the question string is sliced to obtain a string set; the character string set comprises a plurality of sub character strings; determining substrings identical to the character strings in the knowledge graph database as alternative substrings to obtain an alternative substring set { e }m}; and acquiring a first alternative entity corresponding to the alternative substring from the knowledge graph database. Acquiring preset first label information l of first alternative entityiWherein l isiFirst label information of the ith first alternative entity; according to the first label information liLabeling the alternative substrings to obtain an entity mention set { (e)m,lm) In which emFor the m-th candidate substring, lmThe mth first label information; obtaining first label information liFirst relation l of corresponding first candidate entityirjFrom a predetermined relational thesaurus
Figure BDA0003068243010000081
Obtaining synonyms corresponding to the first relation, obtaining the length of the first alternative entity and the position of the first alternative entity in the question character string, obtaining the first number of overlapped words between the synonyms and the question character string, and obtaining the first character string distance between the synonyms and the question character string; acquiring a first number of overlapped words between a first relation and a question character string, acquiring a first number of overlapped words between the first relation and the question character string, and acquiring a first character string distance between the first relation and the question character string; acquiring a first number of overlapped words between a first attribute and a question character string, acquiring a first number of overlapped words between the first attribute and the question character string, and acquiring a first character string distance between the first attribute and the question character string; respectively acquiring the weight of the length, the position, the first overlapped word number and the first character string distance;according to the weights, carrying out weighted calculation on the length, the position, the first overlapped word number and the first character string distance to obtain an alternative entity score of the first alternative entity; determining the two first candidate entities with the highest candidate entity score as the second candidate entities (e)1,l1) And (e)2,l2) (ii) a Acquiring second label information of a second alternative entity; matching a second relation corresponding to the second tag information from the knowledge graph database; the knowledge map database stores the corresponding relation between the second tag information and the second relation; and determining the second relation and the second candidate entity as answer candidate paths. Acquiring a second number of overlapped words between the answer candidate path and the question character string, acquiring a second character string distance between the answer candidate path and the question character string, and acquiring semantic similarity between the answer candidate path and the question character string; obtaining synonyms of a second relation, obtaining a second character overlapping number between the synonyms and the question character string, and obtaining a second overlapping word number between the synonyms and the question character string; respectively obtaining the weights of the second overlapped word number, the second character string distance and the semantic similarity, carrying out weighted calculation on the second overlapped word number, the second character string distance and the semantic similarity according to the weights, obtaining a path score corresponding to an answer candidate path, and determining the answer candidate path with the highest path score as the answer path; and inquiring answers corresponding to the question character strings in a knowledge map database according to the answer paths.
Therefore, the synonym of the first relation is considered when the answer candidate path is obtained, the candidate entity most relevant to the question character string can be screened out, the answer candidate path most relevant to the question character string can be obtained according to the candidate entity and the synonym, and the answer corresponding to the question character string is obtained according to the answer candidate path, so that a more accurate answer candidate path can be obtained, and the answer credibility obtained when the user asks for knowledge is increased.
In some embodiments, a question string is obtained and cutSlice processing to obtain a character string set; the character string set comprises a plurality of sub character strings; determining substrings identical to the character strings in the knowledge graph database as alternative substrings to obtain an alternative substring set { e }m}; and acquiring a first alternative entity corresponding to the alternative substring from the knowledge graph database. Acquiring preset first label information l of first alternative entityiWherein l isiFirst label information of the ith first alternative entity; first label information liLabeling the alternative substrings to obtain an entity mention set { (e)m,lm) In which emFor the m-th candidate substring, lmThe first label information of the mth alternative substring; obtaining first label information liFirst attribute l of corresponding first candidate entityipkFrom a predetermined attribute thesaurus
Figure BDA0003068243010000101
Obtaining synonyms corresponding to the first attributes, obtaining the length of the first alternative entity and the position of the first alternative entity in the question character string, obtaining the first number of overlapped words between the synonyms and the question character string, and obtaining the first character string distance between the synonyms and the question character string; acquiring a first number of overlapped words between a first attribute and a question character string, acquiring a first number of overlapped words between the first attribute and the question character string, and acquiring a first character string distance between the first attribute and the question character string; acquiring a first number of overlapped words between a first attribute and a question character string, acquiring a first number of overlapped words between the first attribute and the question character string, and acquiring a first character string distance between the first attribute and the question character string; respectively acquiring the weight of the length, the position, the first overlapped word number and the first character string distance; according to the weights, carrying out weighted calculation on the length, the position, the first overlapped word number and the first character string distance to obtain an alternative entity score of the first alternative entity; determining two first alternative entities with highest alternative entity scores as second alternative entities(e1,l1) And (e)2,l2) (ii) a Acquiring second label information of a second alternative entity; matching a second attribute corresponding to the second tag information from the knowledge graph database; corresponding attributes between the second tag information and the second attributes are stored in the knowledge map database; and determining the second attribute and the second candidate entity as the answer candidate path. Acquiring a second number of overlapped words between the answer candidate path and the question character string, acquiring a second character string distance between the answer candidate path and the question character string, and acquiring semantic similarity between the answer candidate path and the question character string; obtaining a synonym of a second attribute, obtaining a second character overlapping number between the synonym and the question character string, and obtaining a second overlapping word number between the synonym and the question character string; respectively obtaining the weights of the second overlapped word number, the second character string distance and the semantic similarity, carrying out weighted calculation on the second overlapped word number, the second character string distance and the semantic similarity according to the weights, obtaining a path score corresponding to an answer candidate path, and determining the answer candidate path with the highest path score as the answer path; and inquiring answers corresponding to the question character strings in a knowledge map database according to the answer paths.
Therefore, the synonym of the first attribute is considered when the answer candidate path is obtained, the candidate entity most relevant to the question character string can be screened out, the answer candidate path most relevant to the question character string can be obtained according to the candidate entity and the synonym, and the answer corresponding to the question character string is obtained according to the answer candidate path, so that a more accurate answer candidate path can be obtained, and the answer credibility obtained when the user performs knowledge question answering is increased.
Referring to fig. 2, an embodiment of the present disclosure provides an apparatus for obtaining answers to a question, including: a first obtaining module 201, a second obtaining module 202, a third obtaining module 203, a fourth obtaining module 204 and a fifth obtaining module 205; the first obtaining module 201 is configured to obtain a question string and send the question string to the second obtaining module 202; the second obtaining module 202 is configured to receive the question string sent by the first obtaining module 201, obtain a first candidate entity corresponding to the question string, and send the first candidate entity to the third obtaining module 203; the third obtaining module 203 is configured to receive the first candidate entity sent by the second obtaining module 202, obtain first tag information of the first candidate entity, and obtain feature information corresponding to the first tag information; the characteristic information is used for representing a first relation corresponding to the first label information or a first attribute corresponding to the first label information; and sends the feature information to the fourth obtaining module 204; the fourth obtaining module 204 is configured to receive the feature information sent by the third obtaining module 203, obtain a synonym of the feature information, obtain an answer candidate path in a preset knowledge graph database according to the first candidate entity and the synonym, and send the answer candidate path to the fifth obtaining module 205; the fifth obtaining module 205 is configured to receive the answer candidate path sent by the fourth obtaining module 204, and obtain an answer corresponding to the question string according to the answer candidate path.
Optionally, the second obtaining module includes: the device comprises a natural language processing module and a first determining module. The natural language processing module is configured to receive the question string sent by the first obtaining module, and slice the question string to obtain a string set; the set of strings includes a number of substrings. The first determining module is configured to determine substrings identical to the character strings in the knowledge graph database as alternative substrings, acquire a first alternative entity corresponding to the alternative substrings from the knowledge graph database, and send the first alternative entity to the third acquiring module.
Optionally, the fourth obtaining module includes: a screening module and a second determining module; the screening module is configured to obtain a second alternative entity from the first alternative entity according to the alternative entity score; the second determining module is configured to obtain an answer candidate path according to the second candidate entity and send the answer candidate path to the fifth obtaining module.
Acquiring a question character string through a first acquisition module; a second acquisition module acquires a first alternative entity corresponding to the question character string; the third acquisition module acquires first label information of the first alternative entity and characteristic information corresponding to the first label information; the characteristic information is used for representing a first relation corresponding to the first label information or a first attribute corresponding to the first label information; the fourth obtaining module obtains synonyms of the feature information and obtains answer candidate paths in a preset knowledge map database according to the first candidate entities and the synonyms; and the fifth acquisition module acquires answers corresponding to the question character strings according to the answer candidate paths. The synonym of the characteristic information is considered when the answer candidate path is obtained, the answer candidate path is obtained according to the alternative entity and the synonym, and the answer corresponding to the question character string is obtained according to the answer candidate path, so that a more comprehensive answer candidate path can be obtained, and the answer credibility obtained when the user asks for knowledge is increased.
In some embodiments, the knowledge-graph is composed of triples that include entities, relationships, or attributes. The large number of triples constitutes a knowledge-graph database that is typically stored in a graph database that facilitates querying of the triple relationships. The graph database stores triples for a preset Schema (data model), wherein specific categories of entities, relationships and attributes are stored in the Schema in advance, and each category of entities, relationships and attributes has a corresponding label. The relation among the entities of the knowledge map library and the attributes of the entities can be obtained by inquiring in the Schema through the tags.
In some embodiments, the entity comprises: a number of "names of people", etc.; the corresponding relationship of the "person name" includes: "friends", "family", "classmates" and "colleagues", etc.; the attributes corresponding to each "person name" include: "gender", "age", "birth place" and "occupation" etc.
Therefore, the knowledge map database with the schema is combined with the question-answering system through the deep learning technology, the average response time of the question-answering system is prolonged, and the answer credibility provided by the question-answering system can be greatly improved.
As shown in fig. 3, an embodiment of the present disclosure provides an electronic device including a processor (processor)100 and a memory (memory)301 storing program instructions. Optionally, the device may also include a Communication Interface 302 and a bus 303. The processor 300, the communication interface 302 and the memory 301 may communicate with each other via a bus 303. The communication interface 302 may be used for information transfer. The processor 300 may call program instructions in the memory 301 to perform the method for obtaining answers to question sentences of the above-described embodiment.
In addition, the program instructions in the memory 301 may be implemented in the form of software functional units and stored in a readable storage medium when the program instructions are sold or used as independent products.
The memory 301 is a readable storage medium and can be used for storing software programs, executable programs, such as program instructions/modules corresponding to the methods in the embodiments of the present disclosure. The processor 100 executes functional applications and data processing by executing program instructions/modules stored in the memory 301, that is, implements the method for obtaining answers to question sentences in the above-described embodiment.
The memory 301 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal device, and the like. Further, the memory 301 may include a high-speed random access memory, and may also include a nonvolatile memory.
By adopting the electronic equipment provided by the embodiment of the disclosure, the question character string is obtained; acquiring a first alternative entity corresponding to a question character string; acquiring first label information of a first alternative entity, and acquiring characteristic information corresponding to the first label information; the characteristic information is used for representing a first relation corresponding to the first label information or a first attribute corresponding to the first label information; obtaining synonyms of the characteristic information, and obtaining answer candidate paths in a preset knowledge graph database according to the first candidate entities and the synonyms; and obtaining answers corresponding to the question character strings according to the answer candidate paths. The synonym of the characteristic information is considered when the answer candidate path is obtained, the answer candidate path is obtained according to the alternative entity and the synonym, and the answer corresponding to the question character string is obtained according to the answer candidate path, so that the more accurate answer candidate path can be obtained, and the reliability of the answer obtained when the user asks for knowledge is improved.
Optionally, the electronic device is a computer or the like.
The disclosed embodiments provide a readable storage medium storing executable instructions configured to perform the above-described method for obtaining answers to question sentences.
The disclosed embodiments provide a computer program product comprising a computer program stored on a computer-readable storage medium, the computer program comprising program instructions that, when executed by a computer, cause the computer to perform the above-described method for obtaining answers to question sentences.
The readable storage medium may be a transitory readable storage medium or a non-transitory readable storage medium.
The technical solution of the embodiments of the present disclosure may be embodied in the form of a software product, where the computer software product is stored in a storage medium and includes one or more instructions to enable a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method of the embodiments of the present disclosure. And the aforementioned storage medium may be a non-transitory storage medium comprising: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes, and may also be a transient storage medium.
The above description and drawings sufficiently illustrate embodiments of the disclosure to enable those skilled in the art to practice them. Other embodiments may incorporate structural, logical, electrical, process, and other changes. The examples merely typify possible variations. Individual components and functions are optional unless explicitly required, and the sequence of operations may vary. Portions and features of some embodiments may be included in or substituted for those of others. Furthermore, the words used in the specification are words of description only and are not intended to limit the claims. As used in the description of the embodiments and the claims, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. Similarly, the term "and/or" as used in this application is meant to encompass any and all possible combinations of one or more of the associated listed. Furthermore, the terms "comprises" and/or "comprising," when used in this application, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. Without further limitation, an element defined by the phrase "comprising an …" does not exclude the presence of other like elements in a process, method or apparatus that comprises the element. In this document, each embodiment may be described with emphasis on differences from other embodiments, and the same and similar parts between the respective embodiments may be referred to each other. For methods, products, etc. of the embodiment disclosures, reference may be made to the description of the method section for relevance if it corresponds to the method section of the embodiment disclosure.
Those of skill in the art would appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software may depend upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the disclosed embodiments. It can be clearly understood by the skilled person that, for convenience and brevity of description, the specific working processes of the system, the apparatus and the unit described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the embodiments disclosed herein, the disclosed methods, products (including but not limited to devices, apparatuses, etc.) may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units may be merely a logical division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or 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, devices or units, and may be in an electrical, mechanical 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 implement the present embodiment. In addition, functional units in the embodiments of the present disclosure 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 flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. In the description corresponding to the flowcharts and block diagrams in the figures, operations or steps corresponding to different blocks may also occur in different orders than disclosed in the description, and sometimes there is no specific order between the different operations or steps. For example, two sequential operations or steps may in fact be executed substantially concurrently, or they may sometimes be executed in the reverse order, depending upon the functionality involved. Each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.

Claims (10)

1. A method for obtaining answers to question sentences, comprising:
acquiring a question character string;
acquiring a first alternative entity corresponding to the question character string;
acquiring first label information of the first alternative entity, and acquiring characteristic information corresponding to the first label information; the characteristic information is used for representing a first relation corresponding to the first label information or a first attribute corresponding to the first label information;
obtaining synonyms of the feature information, and obtaining answer candidate paths in a preset knowledge graph database according to the first candidate entities and the synonyms;
and obtaining the answer corresponding to the question character string according to the answer candidate path.
2. The method according to claim 1, wherein obtaining the first candidate entity corresponding to the question string comprises:
slicing the question character string to obtain a character string set; the character string set comprises a plurality of sub character strings;
determining substrings which are the same as pre-stored character strings in the knowledge map database as alternative substrings;
and acquiring a first candidate entity corresponding to the candidate substring from the knowledge map database.
3. The method of claim 1, wherein obtaining an answer candidate path in a pre-defined knowledge graph database according to the first candidate entity and the synonym comprises:
acquiring the length of the first alternative entity and the position of the first alternative entity in the question character string, acquiring the first number of overlapped words between the synonym and the question character string, and acquiring the first character string distance between the synonym and the question character string;
screening the first alternative entity according to the length, the position, the first overlapped word number and the first character string distance to obtain a second alternative entity;
and obtaining an answer candidate path according to the second candidate entity.
4. The method of claim 3, wherein filtering the first candidate entity according to the length, the position, the first number of words overlapped, and the first string distance to obtain a second candidate entity comprises:
respectively acquiring the weight of the length, the position, the first overlapped word number and the first character string distance;
according to each weight, carrying out weighted calculation on the length, the position, the first overlapped word number and the first character string distance to obtain a score of an alternative entity;
and acquiring a second alternative entity from the first alternative entity according to the alternative entity score.
5. The method of claim 3, wherein obtaining an answer candidate path from the second candidate entity comprises:
acquiring second label information of the second alternative entity;
matching a second relation corresponding to the second tag information from the knowledge graph database; the knowledge map database stores the corresponding relation between the second tag information and the second relation;
and determining an answer candidate path according to the second relation and the second candidate entity.
6. The method of claim 3, wherein obtaining an answer candidate path from the second candidate entity comprises:
acquiring second label information of the second alternative entity;
matching a second attribute corresponding to the second tag information from the knowledge graph database; the knowledge map database stores the corresponding relation between the second tag information and the second attribute;
and determining an answer candidate path according to the second candidate entity and the second attribute.
7. The method according to any one of claims 1 to 6, wherein obtaining the answer corresponding to the question string according to the answer candidate path includes:
acquiring a second number of overlapped words between the answer candidate path and the question character string, acquiring a second character string distance between the answer candidate path and the question character string, and acquiring semantic similarity between the answer candidate path and the question character string;
obtaining a path score corresponding to the answer candidate path according to the second overlapped word number, the second character string distance and the semantic similarity, and determining the answer candidate path with the highest path score as an answer path;
and inquiring an answer corresponding to the question character string in the knowledge map database according to the answer path.
8. An apparatus for obtaining answers to a question, comprising:
a first obtaining module configured to obtain a question string;
the second acquisition module is configured to acquire a first alternative entity corresponding to the question string;
a third obtaining module, configured to obtain first tag information of the first candidate entity, and obtain feature information corresponding to the first tag information; the characteristic information is used for representing a first relation corresponding to the first label information or a first attribute corresponding to the first label information;
the fourth obtaining module is configured to obtain synonyms of the feature information, and obtain answer candidate paths in a preset knowledge graph database according to the first candidate entities and the synonyms;
and the fifth acquisition module is configured to acquire answers corresponding to the question character strings according to the answer candidate paths.
9. An electronic device comprising a processor and a memory storing program instructions, wherein the processor is configured to execute the method for obtaining answers to question sentences according to any one of claims 1 to 7 when executing the program instructions.
10. A readable storage medium storing executable instructions, which when executed perform the method for obtaining answers to question sentences according to any one of claims 1 to 7.
CN202110532093.2A 2021-05-17 2021-05-17 Method and device for obtaining answers to question sentences, electronic equipment and readable storage medium Pending CN113204628A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110532093.2A CN113204628A (en) 2021-05-17 2021-05-17 Method and device for obtaining answers to question sentences, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110532093.2A CN113204628A (en) 2021-05-17 2021-05-17 Method and device for obtaining answers to question sentences, electronic equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN113204628A true CN113204628A (en) 2021-08-03

Family

ID=77031298

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110532093.2A Pending CN113204628A (en) 2021-05-17 2021-05-17 Method and device for obtaining answers to question sentences, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN113204628A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113704445A (en) * 2021-10-28 2021-11-26 北京明略昭辉科技有限公司 Knowledge base question and answer method and device, electronic equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110532368A (en) * 2019-09-04 2019-12-03 深圳前海达闼云端智能科技有限公司 Question answering method, electronic equipment and computer readable storage medium
CN110837550A (en) * 2019-11-11 2020-02-25 中山大学 Knowledge graph-based question and answer method and device, electronic equipment and storage medium
CN111414465A (en) * 2020-03-16 2020-07-14 北京明略软件***有限公司 Processing method and device in question-answering system based on knowledge graph
CN111563147A (en) * 2020-04-03 2020-08-21 北京明略软件***有限公司 Entity linking method and device in knowledge question-answering system
CN112199473A (en) * 2020-10-16 2021-01-08 上海明略人工智能(集团)有限公司 Multi-turn dialogue method and device in knowledge question-answering system
CN112667821A (en) * 2020-12-16 2021-04-16 北京华如慧云数据科技有限公司 Military knowledge graph construction and question-answering method based on encyclopedic data

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110532368A (en) * 2019-09-04 2019-12-03 深圳前海达闼云端智能科技有限公司 Question answering method, electronic equipment and computer readable storage medium
CN110837550A (en) * 2019-11-11 2020-02-25 中山大学 Knowledge graph-based question and answer method and device, electronic equipment and storage medium
CN111414465A (en) * 2020-03-16 2020-07-14 北京明略软件***有限公司 Processing method and device in question-answering system based on knowledge graph
CN111563147A (en) * 2020-04-03 2020-08-21 北京明略软件***有限公司 Entity linking method and device in knowledge question-answering system
CN112199473A (en) * 2020-10-16 2021-01-08 上海明略人工智能(集团)有限公司 Multi-turn dialogue method and device in knowledge question-answering system
CN112667821A (en) * 2020-12-16 2021-04-16 北京华如慧云数据科技有限公司 Military knowledge graph construction and question-answering method based on encyclopedic data

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113704445A (en) * 2021-10-28 2021-11-26 北京明略昭辉科技有限公司 Knowledge base question and answer method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
US11334635B2 (en) Domain specific natural language understanding of customer intent in self-help
US8082264B2 (en) Automated scheme for identifying user intent in real-time
CA3083723C (en) Method and apparatus for providing personalized self-help experience
EP4109295A1 (en) Knowledge graph-based question answering method and apparatus, computer device, and medium
CN112667794A (en) Intelligent question-answer matching method and system based on twin network BERT model
CN110297893B (en) Natural language question-answering method, device, computer device and storage medium
US12008047B2 (en) Providing an object-based response to a natural language query
CN112507139B (en) Knowledge graph-based question and answer method, system, equipment and storage medium
CN112231452A (en) Question-answering method, device, equipment and storage medium based on natural language processing
CN112307190A (en) Medical literature sorting method and device, electronic equipment and storage medium
CN115098668A (en) Document sorting method, sorting device, electronic equipment and storage medium
CN113342944B (en) Corpus generalization method, apparatus, device and storage medium
CN113204628A (en) Method and device for obtaining answers to question sentences, electronic equipment and readable storage medium
CN117278675A (en) Outbound method, device, equipment and medium based on intention classification
CN112800226A (en) Method for obtaining text classification model, method, device and equipment for text classification
CN110929526B (en) Sample generation method and device and electronic equipment
CN114138954A (en) User consultation problem recommendation method, system, computer equipment and storage medium
CN115270746A (en) Question sample generation method and device, electronic equipment and storage medium
CN114218378A (en) Content pushing method, device, equipment and medium based on knowledge graph
CN113793663A (en) Medical data processing method and system
CN112632907A (en) Document marking method, device and equipment
JP3548955B2 (en) Problem solving database search system and computer readable storage medium storing problem solving database search program
CN110851560A (en) Information retrieval method, device and equipment
CN117033584B (en) Method and device for determining case text and electronic equipment
CN113468294A (en) Method and device for question answering of ancient poems, electronic equipment 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