Question and answer matching method and device, electronic equipment and storage medium

By identifying the question entity in the question-answering system and converting it into the natural language form of the target triple, the problems of low efficiency and poor accuracy in question-answering matching in the prior art are solved, and efficient and accurate question-answering matching is achieved.

CN115221298BActive Publication Date: 2026-01-09UBTECH ROBOTICS CORP LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210704092.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-21
Publication Date
2026-01-09
Estimated Expiration
2042-06-21

AI Technical Summary

Technical Problem

Existing question-answering matching methods are difficult, have low accuracy and low efficiency in matching the relationship between natural questions and triples, and cannot efficiently and accurately determine the answer information corresponding to the question.

Method used

By acquiring the question text, identifying the question entity, determining the target triple based on the question entity, converting it into candidate text in natural language form, and then matching it with the question text to determine the target answer information.

Benefits of technology

It narrows the search matching range, improves the efficiency and accuracy of question-and-answer matching, avoids the low degree of relationship matching and high difficulty when directly matching natural language question forms with triples, and achieves efficient and accurate question-and-answer matching.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115221298B_ABST
    Figure CN115221298B_ABST
Patent Text Reader

Abstract

The application is suitable for the technical field of computers, and provides a question and answer matching method and device, electronic equipment and a storage medium, including: obtaining a question text; determining a question entity according to the question text; determining a target triple corresponding to the question entity according to the question entity; converting the target triple into a natural language form to obtain a candidate text; and matching the question text with the candidate text to determine target answer information. The embodiment of the application can efficiently and accurately realize question and answer matching.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of computers, and particularly relates to a question and answer matching method and device, electronic equipment and a storage medium. BACKGROUND

[0002] A question and answer system is a high-level form of an information retrieval system, which can accurately answer questions raised by users in natural language. The method run in the question and answer system, i.e., a question and answer matching method for determining corresponding answer information according to an input question, is a research direction that is highly concerned and has a wide development prospect in the field of artificial intelligence and natural language processing. The current question and answer matching method usually needs to perform relationship matching between a natural question and a triple to determine the answer information corresponding to the question, and the matching difficulty is great, the precision is poor, and the efficiency is low. SUMMARY

[0003] Therefore, the embodiments of the present application provide a question and answer matching method and device, electronic equipment and a storage medium to solve the problem of how to efficiently and accurately implement question and answer matching in the prior art.

[0004] A first aspect of the embodiments of the present application provides a question and answer matching method, comprising:

[0005] obtaining a question text;

[0006] determining a question entity according to the question text;

[0007] determining a target triple corresponding to the question entity according to the question entity;

[0008] converting the target triple into a natural language form to obtain a candidate text;

[0009] matching the question text with the candidate text to determine target answer information.

[0010] Optionally, the determining a question entity according to the question text comprises:

[0011] inputting the question text into a trained entity recognition model for processing to obtain a question entity.

[0012] Optionally, the determining a target triple corresponding to the question entity according to the question entity comprises:

[0013] determining a candidate entity from a preset entity library according to the question entity;

[0014] determining the target triple from a preset triple database according to the candidate entity.

[0015] Optionally, the determining the candidate entity according to the question entity comprises:

[0016] According to the question entity, a first entity matching the character of the question entity is obtained from the entity library.

[0017] The entity similarity between the question entity and the first entity is determined, and a candidate entity is screened from the first entity according to the entity similarity.

[0018] Optionally, the determining the entity similarity between the question entity and the first entity comprises:

[0019] The question entity is subjected to word segmentation and part-of-speech extraction processing to determine the question entity key word corresponding to the question entity.

[0020] The first entity is subjected to word segmentation and part-of-speech extraction processing to determine the first entity key word corresponding to the first entity.

[0021] The question entity key word and the first entity key word are subjected to word-level similarity calculation to obtain the entity similarity.

[0022] Optionally, the determining the target triple according to the candidate entity from the preset triple database comprises:

[0023] According to the candidate entity, a triple whose head information matches the candidate entity is obtained from the triple database as a candidate triple.

[0024] According to a preset filtering condition, a target triple is screened from the candidate triple.

[0025] Optionally, the matching the question text with the candidate text to determine the target answer information comprises:

[0026] Each sentence pair composed of the question text and each candidate text is input into a preset binary classification model for processing to obtain the target classification result corresponding to each candidate text and the corresponding confidence.

[0027] According to the target classification result corresponding to each candidate text and the corresponding confidence, the target answer information is determined.

[0028] A second aspect of the embodiment of the application provides a question and answer matching device, comprising:

[0029] An acquisition unit is configured to acquire a question text.

[0030] A question entity determination unit is configured to determine a question entity according to the question text.

[0031] A triple determination unit is configured to determine a target triple corresponding to the question entity according to the question entity;

[0032] A conversion unit is configured to convert the target triple into a natural language form to obtain a candidate text;

[0033] A matching unit is configured to match the question text with the candidate text to determine target answer information.

[0034] A third aspect of the embodiments of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, when the processor executes the computer program, the electronic device implements the steps of the question and answer matching method.

[0035] A fourth aspect of the embodiments of the present application provides a computer readable storage medium, the computer readable storage medium stores a computer program, when the computer program is executed by a processor, the electronic device implements the steps of the question and answer matching method.

[0036] A fifth aspect of the embodiments of the present application provides a computer program product, when the computer program product is executed on an electronic device, the electronic device executes the question and answer matching method of any one of the first aspect.

[0037] Compared with the prior art, the embodiments of the present application have the beneficial effects that: in the embodiments of the present application, the question text is obtained, the question entity is determined according to the question text, and the target triple corresponding to the question entity is determined according to the question entity. Then, the target triple is converted into a natural language form to obtain a candidate text, and the question text is matched with the candidate text to determine the target answer information. Since the target triple can be determined according to the question entity, the search and matching range can be reduced, and the question and answer matching efficiency can be improved. Then, the determined target triple can be further converted into a natural language form of the candidate text, and the question text is matched with the candidate text to determine the target answer information. That is, the natural language form of the question text can be accurately matched with the natural language form of the candidate text, avoiding the case that the relationship matching degree is low and the question and answer matching difficulty is large when the question text is directly matched with the triple. Therefore, the question and answer matching can be efficiently and accurately implemented. BRIEF DESCRIPTION OF DRAWINGS

[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiments or prior art description will be briefly introduced as follows.

[0039] Figure 1 is an implementation flow diagram of a question and answer matching method provided by the embodiments of the present application;

[0040] Figure 2 is a schematic diagram of a question and answer matching device provided by an embodiment of the present application;

[0041] Figure 3 is a schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0042] In the following description, for the purposes of explanation and not limitation, specific details are set forth, such as particular system configurations, techniques, etc., in order to provide a thorough understanding of the embodiments of the application. However, it will be apparent to those skilled in the art that the embodiments of the application can be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the embodiments of the application with unnecessary detail.

[0043] In order to illustrate the technical solutions described in the present application, the following will be described through specific embodiments.

[0044] It should be understood that the term "comprising" as used in the specification and the appended claims indicates the presence of the recited features, integers, steps, operations, elements, and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.

[0045] It should also be understood that the terms used in the present application specification are only for the purpose of describing specific embodiments and are not intended to limit the present application. As used in the present application specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms, unless the context clearly indicates otherwise.

[0046] It should be further understood that the term "and / or" as used in the present application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes these combinations.

[0047] As used in the present application specification and the appended claims, the term "if" can be interpreted as meaning "when" or "once" or "in response to a determination" or "in response to detecting" depending on the context. Similarly, the phrase "if determined" or "if detected [the described condition or event]" can be interpreted as meaning "once determined" or "in response to a determination" or "once detected [the described condition or event]" or "in response to detecting [the described condition or event]" depending on the context.

[0048] In addition, in the description of the present application, the terms "first", "second", "third", etc. are only used for differentiation in description and cannot be understood as indicating or implying relative importance.

[0049] For ease of understanding, first some related concepts of the embodiments of the present application are explained as follows:

[0050] Entity: Entity is an abstraction of an objective individual, a person, a movie, a phrase can be regarded as an entity. For example: star A, "A Big Shout", "the Forbidden City in Beijing", etc.

[0051] Triple: A knowledge expression method, which consists of three elements, "head", "relation" and "tail", which usually correspond to the subject, predicate / answer and object of the sentence respectively. For example: ["Shenzhen City", "area", "1997.47 square kilometers"]. Compared with two-dimensional table storage data, triple storage data has the characteristics of less space occupation, good sparsity and flexibility, and is often used in question and answer systems.

[0052] At present, the question and answer matching method based on triple usually includes two main steps of entity recognition and relation extraction. Among them, entity recognition is to identify the entity in the question, that is, the theme content that needs to be understood in the question, and relation extraction is to identify which attribute of the entity the question asks in the question. For example, for the question "What is the area of Shenzhen City?", the entity to be identified is "Shenzhen City", and the relation to be extracted is "area". However, due to the huge gap between the definition method of relation in triple and the use method of relation in natural language, the extraction scheme needs to be mapped and matched, which cannot achieve good accuracy, resulting in low matching degree and great matching difficulty when finding the matching answer in triple according to the natural language form of the question. And when the data volume is very large, the retrieval and matching speed is slow. The current question and answer matching method usually needs to match the relations between natural questions and triples to determine the answer information corresponding to the question, which has great matching difficulty, poor accuracy and low efficiency.

[0053] In order to solve the above technical problems, the embodiments of the present application provide a question and answer matching method, device, electronic equipment and storage medium, which comprises: acquiring a question text; determining a question entity according to the question text; determining a target triple corresponding to the question entity according to the question entity; converting the target triple into a natural language form to obtain a candidate text; matching the question text with the candidate text to determine target answer information.

[0054] Since the target triple can be determined according to the question entity, the search matching range can be narrowed, and the question and answer matching efficiency can be improved; then, the determined target triple can be further converted into a candidate text in natural language form, and then the question text is matched with the candidate text to determine the target answer information, that is, the question text in natural language form can be accurately matched with the candidate text in natural language form, and the case that the relationship matching degree is low and the question and answer matching difficulty is large when the question text is directly matched with the triple is avoided, so that the question and answer matching can be efficiently and accurately realized.

[0055] Example One

[0056] Figure 1 A flowchart of a question and answer matching method provided by an embodiment of the application is shown, and the execution subject of the question and answer matching method can be a computer, a mobile phone, a robot or the like electronic device, and the details are as follows:

[0057] In S101, a question text is acquired.

[0058] In the embodiment of the application, the question text is a sentence in which a user asks a question. For example, "What is the area of Shenzhen City?", "I want to know how tall is the star A?" and the like.

[0059] The electronic device acquires the question text input by the user. In an embodiment, character information input by the user through the keyboard of the electronic device can be acquired to obtain the question text. In another embodiment, the voice information of the user can be acquired through the microphone of the electronic device, and the question text can be obtained by performing text recognition on the voice information.

[0060] In S102, a question entity is determined according to the question text.

[0061] In the embodiment of the application, the question entity is an entity contained in the question, which is generally the theme content to be understood in the question. For example, for the question text "What is the area of Shenzhen City?", the question entity is "Shenzhen City"; for the question text "I want to know how tall is the star A?", the question entity is "star A".

[0062] After the question is acquired, the entity information contained in the question text is recognized as the question entity by using a preset entity recognition algorithm.

[0063] In S103, a target triple corresponding to the question entity is determined according to the question entity.

[0064] After determining the question entity in the question text, a target triple associated with the question entity is searched from a preset triple database according to the question entity. The number of the target triples can be one or more. In an embodiment, a triple containing information of the question entity can be directly determined as the target triple; in another embodiment, a triple with head information consistent with the information of the question entity can be determined as the target triple.

[0065] In S104, the target triple is converted into a natural language form to obtain a candidate text.

[0066] After determining the target triple associated with the question entity, the target triple is converted into a natural language form text. These texts converted from the target triple are candidate texts that can possibly match the question text, and the texts are referred to as candidate texts.

[0067] In an embodiment, the target triple can be converted into a corresponding natural language text according to a preset natural language text template, that is, a candidate text is obtained. Exemplarily, the natural language text template can be: [head entity]+of+[relation]+is+[tail entity]. If a current target triple is ["Shenzhen City", "area", "1997.47 square kilometers"], a corresponding candidate text is obtained according to the natural language text template, that is, "Shenzhen City's area is 1997.47 square kilometers".

[0068] In S105, the question text is matched with the candidate text to determine the target answer information.

[0069] In the embodiment of the application, after determining the candidate text corresponding to the target triple, the question text is matched with the candidate text by a preset matching algorithm to obtain the target answer information for answering the question text. Then, the target answer information can be fed back to the user in a manner of screen display, voice playing, or information pushing.

[0070] In an embodiment, if multiple candidate texts are determined in step S104, a text with the highest matching degree to the question text is determined from the multiple candidate texts as the target text by using a preset matching algorithm. Then, the target text can be directly used as the target answer information. For example, for the question text "What is the area of Shenzhen?", the corresponding target text "The area of Shenzhen is 1997.47 square kilometers" can be directly output as the target answer information. Alternatively, a triple corresponding to the target text can be used as the target answer information. For example, the triple ["Shenzhen", "area", "1997.47 square kilometers"] corresponding to the target text can be used as the target answer information, and the target answer information is transmitted to a next-level system for processing. Alternatively, after determining the triple corresponding to the target text, the tail information of the triple is used as the target answer information. For example, the tail information "1997.47 square kilometers" in the triple ["Shenzhen", "area", "1997.47 square kilometers"] corresponding to the target text is fed back to the user as the target answer information.

[0071] In the embodiments of the present application, the target triple can be determined according to the question entity, so that the search matching range can be narrowed and the question and answer matching efficiency can be improved. Then, the determined target triple can be further converted into a candidate text in natural language form, and the question text is matched with the candidate text to determine the target answer information. That is, the question text in natural language form can be accurately matched with the candidate text in natural language form, and the situation of low relationship matching degree and high question and answer matching difficulty when the question text is directly matched with the triple can be avoided. Therefore, the corresponding answer information of the question can be efficiently and accurately determined.

[0072] Optionally, the determining the question entity according to the question text comprises:

[0073] The question text is input into the trained entity recognition model for processing to obtain the question entity.

[0074] In an embodiment of the present application, the trained entity recognition model is a neural network model for entity recognition obtained through offline training in advance. In an embodiment, the entity recognition model can be obtained by fine-tuning an existing pre-trained language model. For example, a sentence with entity positions marked as entity recognition sample data, and the language model is trained or fine-tuned to obtain an entity recognition model. In some embodiments, the entity recognition sample data can be marked in BIO format, where B (Begin) is used to mark the start position of the entity, I (Inner) is used to mark the non-start position of the entity, and O (Other) is used to mark the non-entity position. For example, for the entity recognition sample data "the height of star A is XX cm", the corresponding BIO marking is "BIIOOOOOOOO".

[0075] The question text is input into the trained entity recognition model described above, and the entity recognition model can locate the position of the entity in the question text, and extract the entity as the question entity at the position.

[0076] In an embodiment of the present application, since the trained entity recognition model can accurately perform entity recognition on the question text, the question entity can be accurately extracted, and the accuracy of the question and answer matching method is ensured.

[0077] Optionally, the determining the target triple corresponding to the question entity according to the question entity comprises:

[0078] determining a candidate entity from a pre-set entity library according to the question entity;

[0079] determining the target triple from a pre-set triple database according to the candidate entity.

[0080] In an embodiment of the present application, the pre-set entity library stores a large number of entities that the user may ask in advance, and the pre-set triple database stores a large number of triples corresponding to these entities, which include the answers corresponding to the question text.

[0081] After the question entity is extracted from the question text, an entity with consistent, similar, or synonymous information with the question entity is searched from the pre-set entity library as a candidate entity. Then, according to the candidate entity, a triple related to the candidate entity is obtained from the pre-set triple database as the target triple.

[0082] In an embodiment of the present application, since the candidate entity consistent with the question entity can be screened from the entity library, the entity information that the user wants to ask can be more accurately and comprehensively obtained, so that the target triple can be more accurately determined according to the candidate entity, and the accuracy of the question and answer matching is improved.

[0083] Optionally, the determining the candidate entity from the preset entity library according to the question entity comprises:

[0084] obtaining a first entity matching the character of the question entity from the entity library according to the question entity;

[0085] determining the entity similarity between the question entity and the first entity, and screening the candidate entity from the first entity according to the entity similarity.

[0086] In the embodiment of the present application, after determining the question entity, the character-level matching method is used to screen the entity matching the character of the question entity from the entity library as the first entity, and the number of the first entity can be multiple. In an embodiment, the first entity corresponding to the question entity can be determined by the inverted index retrieval engine.

[0087] After the preliminary screening of the first entity matching the character of the question entity, the similarity between the question entity and the first entity (the similarity is referred to as the entity similarity) is calculated, and the first entity with the highest entity similarity to the question entity is screened from the first entity as the candidate entity (wherein K is a positive integer), or the first entity with the entity similarity greater than the preset similarity threshold is screened as the candidate entity. In an embodiment, when calculating the similarity between the question entity and the first entity, the question entity can be segmented and converted into a corresponding question entity vector according to the word level, the first entity can be segmented and converted into a corresponding first entity vector according to the word level, and then the cosine similarity algorithm is used to calculate the word-level cosine similarity between the question entity and the first entity as the entity similarity.

[0088] In the embodiment of the present application, since the first entity matching the character of the question entity can be quickly screened from the entity library according to the word level, and the candidate entity can be further accurately screened from the first entity by similarity calculation, the candidate entity related to the question entity can be efficiently and accurately determined, and the efficiency and accuracy of the question and answer matching are improved.

[0089] Optionally, the determining the entity similarity between the question entity and the first entity comprises:

[0090] segmenting and part-of-speech extracting the question entity to determine the question entity keyword corresponding to the question entity;

[0091] segmenting and part-of-speech extracting the first entity to determine the first entity keyword corresponding to the first entity;

[0092] The question entity key word and the first entity key word are subjected to word-level similarity calculation to obtain the entity similarity.

[0093] In the embodiments of the present application, the question entity and the first entity can be subjected to word segmentation processing and part-of-speech extraction processing respectively, and important words are reserved according to the part-of-speech to obtain the question entity key word and the first entity key word. The word segmentation processing can be realized by a preset word segmentation algorithm, and the part-of-speech extraction processing can be realized by an open source tool. For example, the part-of-speech tags and meanings of the words contained in the entity can be as shown in Table 1:

[0094]

[0095] In one embodiment, after the word segmentation processing and the part-of-speech extraction processing, the words with the part-of-speech tags of n, nr, ns, nt, nw, nz, PER, LOC are determined as important words, and the important words in the question entity are reserved to obtain the question entity key word, and the important words in the first entity are reserved to obtain the first entity key word. For example, if the current question entity is “Beijing’s Forbidden City”, the corresponding question entity key word obtained after the word segmentation and the part-of-speech extraction processing is “Beijing” and “Forbidden City”.

[0096] After obtaining the question entity key word and the first entity key word, the question key word vector corresponding to the question entity and the first entity key word vector corresponding to the first entity are determined according to the question entity key word and the first entity key word. Then, the cosine similarity between the question key word vector and the first entity key word is calculated, so as to realize the word-level similarity calculation between the question entity and the first entity, and obtain the entity similarity.

[0097] In the embodiments of the present application, since the word-level similarity calculation is performed after the question entity key word and the first entity key word are obtained through the word segmentation processing and the part-of-speech extraction processing, the accuracy of the similarity calculation is not affected by irrelevant characters, the accuracy of the subsequent entity screening is ensured, and the accuracy of the question and answer matching is improved.

[0098] Optionally, the determining the target triple from the candidate entity in the preset triple database comprises:

[0099] According to the candidate entity, a triple with head information matched with the candidate entity is obtained from the triple database as a candidate triple.

[0100] According to a preset filtering condition, a target triple is screened from the candidate triple.

[0101] In the embodiments of the present application, since the head information of the triple is usually the subject content to be asked in the question sentence, after the candidate entity is screened according to the question entity, the triple whose head information matches the candidate entity can be screened from the preset triple database as the candidate triple related to the question text.

[0102] Then, the target triple is further screened from the candidate triple according to a preset filtering condition, so as to narrow the subsequent matching range and improve the question and answer matching efficiency. The preset filtering condition can include conditions related to the character length, source information and editing times of the triple. For example, the preset filtering condition includes: screening out the triple whose character length is greater than a preset length; screening out the triple whose source is a specified source; and screening out the triple whose editing times are less than a preset number.

[0103] Optionally, the matching of the question text with the candidate text to determine the target answer information comprises:

[0104] processing each sentence pair composed of the question text and each candidate text in the question text set by the preset binary classification model to obtain the target classification result corresponding to each candidate text and the corresponding confidence;

[0105] determining the target answer information according to the target classification result corresponding to each candidate text and the corresponding confidence.

[0106] In the embodiments of the present application, the preset binary classification model is a double-sentence binary classification language model that can perform binary classification on the matching result of the candidate text and the question text. The target classification result of the binary classification can be divided into two categories: “can answer the question” and “cannot answer the question”. In an embodiment, the pre-training language model can be fine-tuned by sample data with labeled classification categories, so as to obtain the binary classification model. Each sample data is a double-sentence data containing a question and an answer. In the label of the sample data, “1” represents “can answer the question”, indicating that the answer in the double-sentence data can answer the question; and “0” represents “cannot answer the question”, indicating that the answer in the double-sentence data cannot answer the question. The following shows some examples of sample data:

[0107] 1 How tall is Star A? The height of Star A is xxx cm.

[0108] 0 How tall is Star A? The weight of Star A is xxx kg.

[0109] 1 How many people are there in Shenzhen? The population of Shenzhen is xxx million people.

[0110] 0 How many people are there in Shenzhen? The area of Shenzhen is xxx square kilometers.

[0111] In the embodiment of the present application, after the current candidate text is determined, the current question text and each candidate text can be combined to form a sentence pair (also referred to as double sentence data) respectively. Then, the sentence pair is input into the binary classification model for processing, so that the target classification result and the confidence of the candidate text in the sentence pair are obtained. The confidence is a probability representing that the candidate text is classified into the current target classification result, and its value range is [0, 1].

[0112] In an embodiment, the pre-trained language model described above can be a BERT model (a bidirectional language model). The CLS hidden vector can be obtained by processing the sentence pair (also referred to as double sentence) input into the BERT model, and the confidence of the candidate question in the sentence pair can be obtained based on the CLS hidden vector.

[0113] After the target classification result and the corresponding confidence of each candidate text are determined, the candidate text with the highest confidence from the candidate texts with the target classification result of “can answer the question” can be selected as the target text. Then, the target answer information is determined according to the target text.

[0114] In the embodiment of the present application, since the target classification result and the confidence of the candidate text can be accurately determined based on the preset binary classification model, the target answer information can be accurately determined from the candidate text, and the accuracy of the question and answer matching is improved.

[0115] It should be understood that the size of the serial number of each step in the above embodiment does not mean the order of execution, and the execution order of each process should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiment of the present application.

[0116] Example Two

[0117] Figure 2 A structure schematic diagram of a question and answer matching device provided by an embodiment of the present application is shown. For ease of illustration, only the parts related to the embodiment of the present application are shown:

[0118] The question and answer matching device comprises an acquisition unit 21, a question entity determination unit 22, a triple determination unit 23, a conversion unit 24 and a matching unit 25. Wherein:

[0119] The acquisition unit 21 is configured to acquire a question text.

[0120] The question entity determination unit 22 is configured to determine a question entity according to the question text.

[0121] The triple determination unit 23 is configured to determine a target triple corresponding to the question entity according to the question entity.

[0122] A conversion unit 24 is configured to convert the target triple into a natural language form to obtain a candidate text.

[0123] A matching unit 25 is configured to match the question text with the candidate text to determine target answer information.

[0124] Optionally, the question entity determination unit 22 is specifically configured to input the question text into a trained entity recognition model for processing to obtain question entities.

[0125] Optionally, the triple determination unit 23 includes:

[0126] A candidate entity determination module is configured to determine candidate entities from a preset entity library according to the question entities.

[0127] A target triple determination module is configured to determine the target triple from a preset triple database according to the candidate entities.

[0128] Optionally, the candidate entity determination module includes:

[0129] A first entity determination unit is configured to acquire, from the entity library, first entities matching characters of the question entities according to the question entities.

[0130] A candidate entity determination unit is configured to determine entity similarity between the question entities and the first entities, and to screen candidate entities from the first entities according to the entity similarity.

[0131] Optionally, in the candidate entity determination unit, the determination of the entity similarity between the question entities and the first entities includes:

[0132] performing word segmentation and part-of-speech extraction processing on the question entities to determine question entity keywords corresponding to the question entities;

[0133] performing word segmentation and part-of-speech extraction processing on the first entities to determine first entity keywords corresponding to the first entities;

[0134] performing word-level similarity calculation on the question entity keywords and the first entity keywords to obtain the entity similarity.

[0135] Optionally, the target triple determination module is specifically configured to acquire, from the triple database, triples matching the candidate entities in head information as candidate triples according to the candidate entities, and to screen target triples from the candidate triples according to a preset filtering condition.

[0136] Optionally, the matching unit 25 is specifically configured to input each sentence pair composed of the question text and each candidate text into a preset binary classification model respectively for processing, to obtain a target classification result corresponding to each candidate text and a corresponding confidence degree; and determine the target answer information according to the target classification result corresponding to each candidate text and the corresponding confidence degree.

[0137] It should be noted that the information interaction and execution process between the above apparatuses / units are based on the same concept as the method embodiments of the present application, and specific functions and technical effects thereof can be referred to the method embodiments part, which will not be repeated here.

[0138] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above functional units and modules is exemplified, and in actual application, the above functions can be completed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to complete all or part of the above described functions. Each functional unit and module in the embodiments can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of software functional unit. In addition, the specific names of each functional unit and module are only for easy distinction, and do not limit the protection scope of the present application. The specific working process of the units and modules in the system can refer to the corresponding process in the foregoing method embodiments, which will not be repeated here.

[0139] Example Three

[0140] Figure 3 is a schematic diagram of an electronic device provided by an embodiment of the present application. As shown in Figure 3 The electronic device 3 of this embodiment includes a processor 30, a memory 31, and a computer program 32, such as a question and answer matching program, stored in the memory 31 and executable on the processor 30. The processor 30 implements the steps in each of the above question and answer matching method embodiments when executing the computer program 32, such as Figure 1 Steps S101-S105 shown. Alternatively, the processor 30 implements the functions of each module / unit in each of the above apparatus embodiments when executing the computer program 32, such as Figure 2 The functions of the obtaining unit 21 to the matching unit 25 shown.

[0141] By way of example, the computer program 32 can be divided into one or more modules / units, which are stored in the memory 31 and executed by the processor 30 to accomplish the present application. The one or more modules / units can be a series of computer program instruction segments capable of accomplishing a specific function, which are used to describe the execution process of the computer program 32 in the electronic device 3.

[0142] The electronic device 3 can be a desktop computer, a notebook computer, a palm computer, a cloud server and the like. The electronic device can include, but is not limited to, the processor 30 and the memory 31. Those skilled in the art can understand that the electronic device 3 can include more or less components, or combine certain components, or include different components, for example, the electronic device can also include an input / output device, a network access device, a bus and the like. Figure 3 The electronic device 3 is only an example and does not constitute a limitation on the electronic device 3, which can include more or less components than those shown, or combine certain components, or include different components, for example, the electronic device can also include an input / output device, a network access device, a bus and the like.

[0143] The processor 30 can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor.

[0144] The memory 31 can be an internal storage unit of the electronic device 3, such as a hard disk or a memory of the electronic device 3. The memory 31 can also be an external storage device of the electronic device 3, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card and the like equipped on the electronic device 3. Further, the memory 31 can include both the internal storage unit and the external storage device of the electronic device 3. The memory 31 is used to store the computer program and other programs and data required by the electronic device. The memory 31 can also be used to temporarily store data that has been output or will be output.

[0145] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above-mentioned division of each functional unit and module is exemplified, and in actual application, the above-mentioned functions can be completed by different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be realized in the form of hardware or software. In addition, the specific names of each functional unit and module are only for easy distinction, and do not limit the protection scope of the present application. The specific working process of the units and modules in the above system can refer to the corresponding process in the foregoing method embodiments, which will not be repeated here.

[0146] In the above embodiments, the description of each embodiment has its own emphasis, and the parts not described or recorded in detail in a certain embodiment can be referred to the related description of other embodiments.

[0147] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be realized in electronic hardware or a combination of computer software and electronic hardware. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. A person skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0148] In the embodiments provided in the present application, it should be understood that the disclosed devices / equipment and methods can be implemented in other ways. For example, the device / equipment embodiments described above are only schematic, for example, the division of the modules or units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the shown or discussed each other can be indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.

[0149] The units described as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on a plurality of network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.

[0150] In addition, each of the function units in each of the embodiments of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software function unit.

[0151] The integrated module / unit, if realized in the form of a software function unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the above-mentioned embodiment methods can also be implemented by a computer program instructing related hardware to complete, and the computer program can be stored in a computer-readable storage medium. When the processor executes the computer program, the steps of each method embodiment described above can be implemented. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or some intermediate forms, etc. The computer-readable medium can include any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium, etc. It should be noted that the content included in the computer-readable medium can 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, the computer-readable medium does not include electrical carrier signals and telecommunication signals.

[0152] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements for some technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.

Claims

1. A question-and-answer matching method, characterized in that, The method comprises the following steps: obtaining a question text; determining a question entity according to the question text; determining a target triple corresponding to the question entity according to the question entity; converting the target triple into a natural language form to obtain a candidate text; matching the question text with the candidate text to determine target answer information, including: inputting each sentence pair composed of the question text and each candidate text into a preset binary classification model for processing to obtain a target classification result and a corresponding confidence degree corresponding to each candidate text; and determining the target answer information according to the target classification result and the corresponding confidence degree corresponding to each candidate text.

2. The question and answer matching method of claim 1, wherein, The method comprises the following steps: inputting the question text into a trained entity recognition model for processing to obtain the question entity.

3. The question and answer matching method of claim 1, wherein, The method comprises the following steps: determining a candidate entity from a preset entity library according to the question entity; determining the target triple from a preset triple database according to the candidate entity.

4. The question and answer matching method of claim 2, wherein, The method comprises the following steps: obtaining a first entity matching the character of the question entity from the entity library according to the question entity; determining an entity similarity between the question entity and the first entity, and screening a candidate entity from the first entity according to the entity similarity.

5. The question and answer matching method of claim 4, wherein, The method comprises the following steps: performing word segmentation and part-of-speech extraction processing on the question entity to determine a question entity keyword corresponding to the question entity; performing word segmentation and part-of-speech extraction processing on the first entity to determine a first entity keyword corresponding to the first entity; performing word-level similarity calculation on the question entity keyword and the first entity keyword to obtain the entity similarity.

6. The question and answer matching method of claim 3, wherein, The method comprises the following steps: obtaining a triple matching the head information of the candidate entity from the triple database as a candidate triple according to the candidate entity; screening a target triple from the candidate triple according to a preset filtering condition.

7. A question and answer matching apparatus characterized by comprising: The method comprises the following steps: an obtaining unit configured to obtain a question text; a question entity determination unit configured to determine a question entity according to the question text; a triple determination unit configured to determine a target triple corresponding to the question entity according to the question entity; a conversion unit configured to convert the target triple into a natural language form to obtain a candidate text; a matching unit configured to match the question text with the candidate text to determine target answer information, including: inputting each sentence pair composed of the question text and each candidate text into a preset binary classification model for processing to obtain a target classification result and a corresponding confidence degree corresponding to each candidate text; and determining the target answer information according to the target classification result and the corresponding confidence degree corresponding to each candidate text.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The computer program is configured to, when executed by the processor, cause the electronic device to implement the steps of the method of any one of claims 1 to 6.

9. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 8. The computer program is configured to, when executed by the processor, cause the electronic device to implement the steps of the method of any one of claims 1 to 6.

Citation Information

Patent Citations

  • Question answering method, question answering device, computer equipment and storage medium

    CN110502621A

  • Knowledge base question-answering method fusing fact texts

    CN112256847A