Automatic question answering method, device and equipment and storage medium

By acquiring entity aliases and using entity recognition and attribute mapping models for semantic encoding, the problems of relying on annotation logic and lacking deep semantic understanding in traditional automatic question answering are solved, thus achieving higher question answering accuracy.

CN112328759BActive Publication Date: 2026-04-10PING AN TECH (SHENZHEN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-29
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

Traditional semantic analysis methods rely on labeled logical forms as supervisory data, and information retrieval lacks an understanding of deep semantics, resulting in low accuracy of automatic question answering.

Method used

By obtaining entity aliases in the problem to be predicted, the entity names are determined using a pre-set entity recognition model, and semantic encoding is performed in combination with a pre-set graph database and attribute mapping model to improve the accuracy of entity recognition and attribute mapping.

Benefits of technology

It improves the accuracy of automatic question answering and enhances the representation and generalization capabilities of entity recognition and attribute mapping models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112328759B_ABST
    Figure CN112328759B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of artificial intelligence, and discloses an automatic question answering method and device, computer equipment and a computer readable storage medium, the method comprising: obtaining candidate entities of each word in a to-be-predicted question according to a preset alias dictionary; determining an entity name corresponding to the to-be-predicted question based on a preset entity recognition model and according to the to-be-predicted question and a plurality of candidate entities; determining a triple corresponding to the entity name according to the entity name and a preset graph database; determining a target attribute name corresponding to the to-be-predicted question based on a preset attribute mapping model and according to each attribute name and the to-be-predicted question, and taking an attribute value corresponding to the target attribute name as a question answer of the to-be-predicted question; and implementing semantic coding of entity recognition of a question by the preset entity recognition model and attribute mapping of the question by the attribute mapping model, improving the representation ability and generalization ability of machine reading of a text, and thus improving the accuracy of the preset entity recognition model and the attribute mapping model.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of artificial intelligence, and particularly relates to an automatic question answering method and device, computer equipment and a computer readable storage medium. BACKGROUND

[0002] Knowledge graph technology is an important part of artificial intelligence technology, which describes the concepts, entities and their key relationships in the objective world in a structured manner. Knowledge graph technology provides a better ability to organize, manage and understand the massive information on the Internet, and expresses the information on the Internet in a form closer to human cognition of the world. Therefore, establishing a knowledge base with semantic processing ability and open interconnection ability can produce application value in intelligent search, intelligent question answering, personalized recommendation and other intelligent information services.

[0003] The methods currently used in mainstream automatic question answering based on knowledge base can be divided into two categories: semantic analysis based (SP-based) method and information retrieval based (IR-based) method. The semantic analysis based method first converts the natural language form of the question into a certain type of logical expression form. The traditional semantic analysis needs to use the logical form with part-of-speech information marked as supervision, and is subject to a small number of logical predicates in a narrow domain. The information retrieval method first obtains a series of candidate answers from the knowledge base through a rough comparison method, then extracts features from the question and the candidate answers, and uses them to sort the candidate answers to select the highest score as the final answer. However, the information retrieval method lacks understanding of deep semantics, resulting in low accuracy of automatic question answering. SUMMARY

[0004] The main purpose of the present application is to provide an automatic question answering method, device, computer equipment and computer readable storage medium, which aims to solve the technical problem that the traditional semantic analysis needs to use the logical form with marked supervision data, and relies on a small number of logical predicates, while the information retrieval lacks understanding of deep semantics, resulting in low accuracy of automatic question answering of semantic analysis and information retrieval.

[0005] In a first aspect, the present application provides an automatic question answering method, which comprises the following steps:

[0006] According to the pre-set alias dictionary, the entity aliases of each word in the to-be-predicted question are obtained, and the entity aliases are used as candidate entities, wherein the entity aliases and the candidate entities are multiple;

[0007] determine, based on the preset entity recognition model, an entity name corresponding to the question to be predicted according to the question to be predicted and the candidate entities;

[0008] determine, according to the entity name and a preset graph database, a triple corresponding to the entity name in the preset graph database, wherein the triple includes an attribute name and an attribute value, and the triple is multiple;

[0009] determine, based on a preset attribute mapping model, a target attribute name corresponding to the question to be predicted according to each attribute name and the question to be predicted, and take an attribute value corresponding to the target attribute name as an answer to the question to be predicted.

[0010] In a second aspect, the present application further provides an automatic question answering device, which comprises:

[0011] an acquisition module configured to acquire entity aliases of each word in a question to be predicted according to a preset alias dictionary, and take the entity aliases as candidate entities, wherein the entity aliases and the candidate entities are multiple;

[0012] a first determination module configured to determine, based on a preset entity recognition model, an entity name corresponding to the question to be predicted according to the question to be predicted and the candidate entities;

[0013] a second determination module configured to determine, according to the entity name and a preset graph database, a triple corresponding to the entity name in the preset graph database, wherein the triple includes an attribute name and an attribute value, and the triple is multiple;

[0014] a third determination module configured to determine, based on a preset attribute mapping model, a target attribute name corresponding to the question to be predicted according to each attribute name and the question to be predicted, and take an attribute value corresponding to the target attribute name as an answer to the question to be predicted.

[0015] In a third aspect, the present application further provides a computer device, which comprises a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein the computer program, when executed by the processor, implements the steps of the automatic question answering method as described above.

[0016] In a fourth aspect, the present application further provides a computer readable storage medium, which stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the automatic question answering method as described above.

[0017] The application provides an automatic question answering method and device, computer equipment and a computer readable storage medium. The application obtains entity aliases in each word of a to-be-predicted question according to a preset alias dictionary, and takes the entity aliases as candidate entities, wherein the entity aliases and the candidate entities are multiple. The application determines an entity name corresponding to the to-be-predicted question based on a preset entity recognition model and the to-be-predicted question and the multiple candidate entities. The application determines a triple corresponding to the entity name in a preset graph database based on the entity name and the preset graph database, wherein the triple includes the entity name, an attribute name and an attribute value, and the triple is multiple. The application determines a target attribute name corresponding to the to-be-predicted question based on each attribute name and the to-be-predicted question based on a preset attribute mapping model, and takes an attribute value corresponding to the target attribute name as an answer to the to-be-predicted question. The application realizes entity recognition of a question by a preset entity recognition model and semantic coding of attribute mapping of the question by an attribute mapping model, improves the representation ability and generalization ability of reading text, and thus improves the accuracy of the preset entity recognition model and the attribute mapping model, and improves the accuracy of automatic question answering. BRIEF DESCRIPTION OF DRAWINGS

[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0019] Figure 1 A flowchart of an automatic question answering method provided by an embodiment of the present application;

[0020] Figure 2 A flowchart of a sub-step of the automatic question answering method in Figure 1

[0021] Figure 3 A flowchart of a sub-step of the automatic question answering method in Figure 1

[0022] Figure 4 A flowchart of a step of training the preset entity recognition model;

[0023] Figure 5 A flowchart of a step of training the preset attribute mapping model;

[0024] Figure 6 A schematic block diagram of an automatic question answering device provided by an embodiment of the present application;

[0025] Figure 7 A structural schematic block diagram of a computer equipment related to an embodiment of the present application.​​

[0026] The objectives, functional features and advantages of the present application will be further described with reference to the embodiments in combination with the accompanying drawings. DETAILED DESCRIPTION

[0027] The technical solutions in the embodiments of the present application will be clearly and completely described in combination with the accompanying drawings. Obviously, the described embodiments are only some of the embodiments of the present application, but not all of them. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present application.

[0028] The flowchart shown in the accompanying drawings is only an example and does not necessarily include all the contents and operations / steps, nor does it necessarily be executed in the described order. For example, some operations / steps can be decomposed, combined or partially merged, so that the actual execution order can be changed according to the actual situation.

[0029] The embodiments of the present application provide an automatic question answering method and device, computer equipment and a computer readable storage medium. The automatic question answering method can be applied to computer equipment, which can be a notebook computer, a desktop computer or other electronic equipment.

[0030] Some embodiments of the present application will be described in detail below in combination with the accompanying drawings. In the case of no conflict, the embodiments described below and the features in the embodiments can be combined with each other.

[0031] Please refer to Figure 1 , Figure 1 A flowchart of an automatic question answering method provided by an embodiment of the present application is shown in FIG. 1.

[0032] As shown in FIG. 1, the automatic question answering method includes steps S101 to S104. Figure 1

[0033] Step S101, according to a preset alias dictionary, obtaining entity aliases of each word in a to-be-predicted question, and taking the entity aliases as candidate entities, wherein the entity aliases and the candidate entities are multiple.

[0034] ​In an example, an entity alias list in a preset alias dictionary is obtained, and entity aliases of each word in the to-be-predicted question are obtained according to the entity alias list. For example, when the to-be-predicted question is obtained, entity aliases in the entity alias list are compared with each word in the to-be-predicted question based on the entity alias list in the preset alias dictionary. If a word in the to-be-predicted question is the same as any one of the entity aliases in the entity alias list, all entity aliases in the entity alias list corresponding to the entity name are determined, and the all entity aliases are determined as entity aliases of the word in the to-be-predicted question. Alternatively, the to-be-predicted question is divided into multiple words, and each word is used as search information to search the entity alias list. If any one of the entity aliases in the entity alias list is the same as a word in the to-be-predicted question, all entity aliases in the entity alias list are determined as entity aliases of the word in the to-be-predicted question. The obtained entity aliases are used as candidate entities, and the number of entity aliases and candidate entities is multiple.

[0035] In step S102, an entity name corresponding to the to-be-predicted question is determined based on a preset entity recognition model and the to-be-predicted question and the multiple candidate entities.

[0036] In an example, the preset entity recognition model is obtained by training a first preset pre-training language model based on training data. Based on the preset entity recognition model, an entity name corresponding to the to-be-predicted question is determined based on the to-be-predicted question and the multiple candidate entities. The entity name is a commonly used name in a question, and the candidate entity is an entity alias. The entity alias is a special name or an old name, and the like. For example, the to-be-predicted question is “Who is the author of Hongloumeng?” and “Hongloumeng” is an entity name. Alternatively, the to-be-predicted question is “Who is the author of Shitouji?” and “Shitouji” is an entity alias, and “Hongloumeng” corresponding to “Shitouji” is an entity name.

[0037] In an example, the to-be-predicted question is input into the preset entity recognition model, and a name corresponding to the to-be-predicted question is recognized based on the preset entity recognition model. Based on the name and the multiple candidate entities, an entity name corresponding to the to-be-predicted question is determined. For example, the name is compared with each candidate entity. If the name is the same as any one of the multiple candidate entities, the name is used as the entity name of the to-be-predicted question.

[0038] In an embodiment, specifically, referring to Figure 2 , step S102 includes sub-step S1021 to sub-step S1023.

[0039] In sub-step S1021, each word in the to-be-predicted question is replaced according to the multiple candidate entities, and multiple text records are generated.

[0040] For example, the question to be predicted is "Who is the author of the Stone Records?" and Hong Lou Meng is a candidate entity of the word "Stone Records" in the question to be predicted "Who is the author of the Stone Records?". The position of Stone Records in the question to be predicted "Who is the author of the Stone Records?" is determined, and the word "Stone Records" is replaced by the candidate entity "Hong Lou Meng" at the position of Stone Records in the question to be predicted "Who is the author of the Stone Records?". Alternatively, if the multiple candidate entities are not candidate entities of the same word, the positions of each candidate entity in the question to be predicted are determined, and each word is replaced by the corresponding candidate entity at the position of each word in the question to be predicted, to generate corresponding text records, that is, the number of text records is the same as the number of candidate entities.

[0041] Sub-step S1022, inputting the multiple text records into a preset entity recognition model respectively to predict the prediction value of the candidate entity in each text record.

[0042] For example, when the multiple text records are obtained, each text record is input into a preset entity recognition model, and the prediction value of the candidate entity in each text record is predicted by the preset entity recognition model. For example, each text record is input into a preset entity recognition model, the preset entity recognition model includes a dictionary file, and each text record is split by the dictionary file to obtain a text sequence corresponding to each text record. When the text sequence is obtained, the text sequence is represented by a vector to obtain corresponding text vector information. The preset entity recognition model includes a multi-head attention mechanism model, the text vector information is input into the multi-head attention mechanism model, the multi-head attention mechanism model obtains the vector representation corresponding to each word in the text vector information that fuses context information, and outputs text semantic vector information. The semantic vector corresponding to each text record in the text semantic vector information is obtained, the preset entity recognition model includes a linear conversion layer, and the linear conversion layer is used to linearly convert the text semantic vector information corresponding to each text record to obtain the prediction value of the candidate entity in each text record.

[0043] Sub-step S1023, according to the prediction value of the candidate entity in each text record, determining that the candidate entity in the target text record is an entity name, and taking the entity name as the entity name corresponding to the question to be predicted.

[0044] In an embodiment of the present application, when the predicted values of the candidate entities in each text record are obtained, the predicted values of the candidate entities in each text record are compared to determine the text record with the highest predicted value of the candidate alias. The preset entity recognition model is used to obtain the target text record with the highest predicted value of the candidate alias, and the candidate entity in the target text record with the highest predicted value of the candidate alias is determined as the entity name in the problem to be predicted.

[0045] In step S103, the triple corresponding to the entity name in the preset graph database is determined according to the entity name and the preset graph database; the triple includes the entity name, the attribute name and the attribute value, and the triple is a plurality of groups.

[0046] In an embodiment of the present application, when the entity name of the problem to be predicted is obtained, the preset graph database is queried based on the entity name, and the preset graph database includes a plurality of triples, each of which is stored in the graph data in a structured manner. The plurality of triples corresponding to the entity name in the preset graph database are obtained by querying the preset graph database based on the entity name, and the triple includes the entity name, the attribute name and the attribute value. For example, when the entity name is “The Smiling, Proud Wanderer”, the preset graph database is searched based on the entity name, and the triple corresponding to the entity name is obtained, which is “The Smiling, Proud Wanderer ||| language version ||| Cantonese and Mandarin”, wherein the language version is the attribute name, and Cantonese and Mandarin are the attribute values. The triple corresponding to the entity name is a plurality of groups.

[0047] In step S104, the target attribute name corresponding to the problem to be predicted is determined based on each attribute name and the problem to be predicted based on the preset attribute mapping model, and the attribute value corresponding to the target attribute name is determined as the question and answer of the problem to be predicted.

[0048] In an embodiment of the present application, when the plurality of triples corresponding to the entity name are obtained, each attribute text pair is obtained by combining the problem to be predicted and the attribute value in each triple. Each attribute text pair is input into the preset attribute mapping model, the preset attribute mapping model predicts the predicted score of each attribute text pair, the attribute text pair with the highest predicted score is determined as the target attribute text pair, and the target attribute text pair output by the preset attribute mapping model is obtained. When the target attribute text pair is obtained, the attribute name in the target attribute text pair is determined as the target attribute name, and the triple corresponding to the target attribute name in the graph database is determined based on the target attribute name, and the attribute value in the triple corresponding to the target attribute name is determined as the question and answer corresponding to the problem to be predicted.

[0049] In an embodiment of the present application, specifically, referring to Figure 3 Step S104 includes sub-step S1041 to sub-step S1043.

[0050] In substep S1041, each attribute name is combined with the to-be-predicted question to generate a plurality of attribute-text pairs.

[0051] In an example, a plurality of groups of triples corresponding to the entity names are obtained, and attribute names in each group of triples are obtained. Each attribute name is combined with the to-be-predicted question to obtain an attribute-text pair corresponding to the combination of each attribute name and the to-be-predicted question, where the attribute-text pair has the same number of attribute values as the attribute values.

[0052] In substep S1042, each attribute-text pair is input into a preset attribute mapping model to obtain a predicted score of the attribute name in each attribute-text pair.

[0053] In an embodiment, each attribute-text pair obtained is input into a preset attribute mapping model, the preset attribute mapping model includes a dictionary file, each attribute-text pair is split by the dictionary file to obtain a word sequence of each question and attribute name in each attribute-text pair, the word sequence of each question and the word sequence of each attribute name are padded to obtain a word sequence of a uniform fixed length, the word sequence of the question and the word sequence of the attribute name are spliced to generate a corresponding attribute-text sequence, the attribute-text sequence is marked by a special symbol to mark the division positions of the question and each attribute value, and the attribute-text sequence is labeled. When the attribute-text sequence is obtained, the attribute-text sequence is vectorized to obtain corresponding text vector information. The preset attribute mapping model includes a multi-head attention network model, the text vector information is input into the multi-head attention network model, the multi-head attention network model obtains a vector representation corresponding to each word in the input text vector that fuses context information, thereby obtaining text semantic vector information output by the multi-head attention network model. The division positions of the question and each attribute name in the text semantic vector information are marked based on the special symbol, a semantic vector corresponding to each attribute-text in the text semantic vector information is obtained, the preset entity recognition model includes a linear conversion layer, the semantic vector of each attribute-text pair is linearly converted by the linear conversion layer to obtain a predicted score of the attribute name in each attribute-text pair.

[0054] In substep S1043, a target attribute-text pair with the highest predicted score output by the preset attribute mapping model is obtained according to the predicted scores of the attribute names in each attribute-text pair.

[0055] In an example, when the prediction scores of the attribute names in the attribute text pairs are obtained, the prediction scores of the attribute names in the attribute text pairs are compared, the attribute text pair with the highest prediction score of the attribute names is determined, and the attribute text pair with the highest prediction score of the attribute names is taken as a target attribute text pair, and the target attribute text pair with the highest prediction score of the attribute names output by the preset attribute mapping model is obtained.

[0056] In sub-step S1044, the attribute name in the target attribute text pair is taken as a target attribute name corresponding to the problem to be predicted.

[0057] In an example, when the target attribute text pair with the highest prediction score output by the preset attribute mapping model is obtained, the target attribute text pair includes the problem to be predicted and the attribute name, and the attribute name in the target attribute text pair is taken as a target attribute name.

[0058] In an embodiment, before the entity name corresponding triple is determined according to the entity name and the preset graph database, the method further includes: obtaining any one triple in the preset knowledge base, and obtaining an alias list of the entity name in the triple based on a preset alias dictionary; determining whether the triple exists in the preset graph knowledge base according to the alias list; if it is determined that the triple exists, taking the preset graph knowledge base as the preset graph database; and if it is determined that the triple does not exist, creating a node in the preset knowledge base and importing the triple at the node to generate the preset graph database.

[0059] In an embodiment, a preset knowledge base is obtained, and the preset knowledge base includes a plurality of triples. Any one triple in the preset knowledge base is obtained, and the triple includes an entity name, an attribute name and an attribute value. The preset alias dictionary is queried based on the entity name, and the alias dictionary includes a plurality of entity aliases corresponding to the entity name, wherein the entity name is also an entity alias. When the entity alias is obtained, the preset graph knowledge base is searched to determine whether a node of the entity alias exists in the preset graph knowledge base. If the node of the entity alias exists, it is determined whether an attribute name node in the triple exists in the node of the entity alias. If the attribute name node in the triple exists, the preset graph knowledge base is taken as the preset graph database. If the node of the entity alias does not exist, a node of the entity alias is created, and the triple corresponding to the node of the entity alias is imported into the node of the entity alias to generate the preset graph database.

[0060] In an embodiment, before the entity alias in the problem to be predicted is obtained based on the preset alias dictionary and the entity alias is taken as a candidate entity, the method further includes: obtaining each text in the preset knowledge base, and identifying the entity name in each text; and extracting the entity alias of the entity name based on a preset attribute rule to generate the preset alias dictionary.

[0061] In an embodiment, each text in the knowledge base is acquired, and an entity name in each text is identified. The entity name is a common name of a name, and the entity alias is an old name of the name. The identification manner includes that annotation is performed, all names of the same semantic name are acquired, entity names in all names are extracted according to preset attribute rules, an alias list of the entity name is generated, and the alias list of each entity name constitutes an alias dictionary. The preset attribute rules can be extracted in a probabilistic manner, for example, the probabilities of all names of the same semantic name are acquired, the name with the highest probability is taken as the entity name, and the other names are taken as entity aliases.

[0062] In an embodiment of the present application, a candidate entity of an entity name in a to-be-predicted question is acquired through a preset alias dictionary, each candidate entity and the to-be-predicted question are input into a preset entity recognition model to obtain an entity name of the to-be-predicted question, each attribute name in a triple corresponding to the entity name is obtained based on a preset graph database and the entity name, each attribute name and the to-be-predicted question are input into a preset attribute mapping model to obtain a target attribute name corresponding to the predicted question, and thus a question and answer corresponding to the to-be-predicted question are acquired, thereby improving the accuracy of machine reading multiple documents.

[0063] In an embodiment, specifically, refer to Figure 4 , Figure 4 A flowchart of a process for training the preset entity recognition model.

[0064] As shown in Figure 4 , the training of the preset entity recognition model includes steps S201 to S204.

[0065] In step S201, to-be-trained data is acquired, and a target entity name and candidate entity names of a question in the to-be-trained data are determined, wherein the target entity name is different from the candidate entity names, and the candidate entity names are multiple.

[0066] In an exemplary embodiment, to-be-trained data is acquired, the to-be-trained data including a to-be-trained question, a question and answer of the to-be-trained question, and a triple corresponding to the to-be-trained question. For example, the to-be-trained data is a to-be-trained question “Who is the author of Meihuafallen?”, a triple “Meihuafallen ||| author ||| Baozhao”, and a question and answer “Baozhao” of the to-be-trained question. A target entity name in the to-be-trained question is determined, which can be manually annotated. A candidate entity name in the to-be-trained question is determined, which can be a candidate entity name of the same word or a candidate entity name of each word. For example, the to-be-trained question is segmented into words, and candidate entity names of each word are acquired through an alias dictionary.

[0067] In step S202, a first character of the target entity name is obtained, the first character is used to replace the target entity name in the question, and positive example data of the training data is generated, wherein the label value of the positive example data is 1.

[0068] In an example, when the target entity name of the question to be trained in the training data is determined, a first character of the target entity name is obtained, and the first character is a preset character. For example, the character is [MASK]. The position of the target entity name in the question is determined, and the first character is used to replace the target entity name. For example, the question is “Who is the author of Meihuafallen?”, wherein Meihuafallen is the target entity name of the question. When the position of Meihuafallen in “Who is the author of Meihuafallen?” is determined, [MASK] is used to replace Meihuafallen, and corresponding positive example data is generated, wherein the question in the positive example data is “[MASK] author is who coming?” and the positive example data is labeled, and the label value of the positive example data is 1.

[0069] In step S203, a second character of the candidate entity name is obtained, the second character is used to replace each candidate entity name in the question, and multiple negative example data of the training data is generated, wherein the label value of each negative example data is 0.

[0070] In an example, when the multiple candidate entity names of the question to be trained in the training data are determined, a second character of the candidate entity name is obtained, and the second character is a preset character. For example, the second character is [MASK]. The position of each candidate entity name in the question is determined, and the second character is used to replace the target entity name. For example, the question is “Who is the author of Meihuafallen?”, wherein Meihuafallen and Huafallen are candidate entity names of the question. When the positions of Meihuafallen and Huafallen in “Who is the author of Meihuafallen?” are determined, [MASK] is used to replace Meihuafallen, and corresponding negative example data is generated, wherein the question in the negative example data is “[MASK] author is who coming?” or [MASK] is used to replace Huafallen, and corresponding negative example data is generated, wherein the question in the negative example data is “Mei [MASK] author is who coming?”, and the positive example data is labeled, and the label value of the positive example data is 0.

[0071] In step S204, a first pre-trained language model is trained according to the positive example data and the label value of the positive example data, and the multiple negative example data and the label value of each negative example data, and a corresponding preset entity recognition model is generated.

[0072] The positive example data and the plurality of negative example data are input into a first preset pre-training language model. The first preset pre-training language model (Bidirectional Encoder Representations from Transformers, BERT) includes a dictionary file vocab.txt. The questions in the positive example data and the negative example data are segmented by words according to the dictionary file vocab.txt, to obtain word sequences of the questions in each of the positive example data and the negative example data. The word sequences of the questions are filled or truncated according to a preset filling rule or a truncation rule, to generate character word sequences with a uniform length. The segmented questions are spliced to obtain corresponding text sequences. The text sequences include type symbols and position symbols of the questions. For example, a [CLS] character is used as a classification symbol of the text sequences, and a [SEP] is used as a position division symbol of the questions. The obtained text sequences are vectorized to obtain text vector information corresponding to the text sequences. In an example, each word in the input text sequence is represented by a pre-trained word feature vector to obtain the text vector information. The text vector information includes semantic representation information, position representation information, and segmentation representation information of each word in the text sequence.

[0073] The first preset pre-training language model includes a multi-head attention network model. The text vector information obtained is input into the multi-head attention network model. The multi-head attention network model obtains vector representations of each word in the input text vector that fuses context information. The multi-head attention network model outputs text semantic vector information. In an example, the obtained text vector information is input into the multi-head attention network model. The multi-head attention network model includes a first linear mapping layer. The first linear mapping layer maps the text vector information to semantic vectors in different semantic spaces, to capture semantic information in different dimensions. Self-attention operations are performed on the semantic vectors in the different semantic spaces, to output text semantic vectors in the different semantic spaces. The text semantic vectors in the different semantic spaces are spliced. The spliced vector information is mapped back to the original semantic space by the first linear mapping layer, to obtain output text semantic vector information.

[0074] For example, the obtained text vector information is input into the multi-head attention network model. The multi-head attention network model includes a first linear mapping layer. The first linear mapping layer maps the text vector information to semantic vectors in different semantic spaces, to capture semantic information in different dimensions. For example, a linear term formula in the first linear mapping layer is Q′ i = QW i Q , K′ i = KW t k, V' i = Vw i V wherein Q is a query value, K is a key value, V is a value vector, i is a linear term mapped to i semantic spaces, Q', i, K'i, V'.i is a semantic vector of the i-th semantic space.

[0075] By performing a self-attention operation on the semantic vectors in different semantic spaces, the text semantic vectors in different semantic spaces are output. For example, the formula of the self-attention operation is wherein softmax is a normalization function, T is a vector transposition operation, d k is the dimension of the key vector, and hend i is a text semantic vector of the input text sequence in the i-th semantic space. When the text semantic vectors in different semantic spaces are obtained, the text semantic vectors in different semantic spaces are spliced, for example, c = Concat(hend1,..., hend i )W, wherein Concat is a vector splicing operation, W is a linear term for mapping back to the original semantic space from different semantic spaces, and C is a second text semantic vector output by the multi-head self-attention network model. The spliced vector information is mapped back to the original semantic space through the first linear mapping layer to obtain the output text semantic vector information.

[0076] When the text semantic vector information is obtained, the semantic vectors of the entity name and each entity alias are obtained from the text semantic vector information. The semantic vectors of the entity name and each entity alias are linearly transformed based on the second linear mapping layer of the first preset pre-training language model to obtain the probability score value of the entity name and the probability score value of each entity alias. After the probability score value of the entity name and the probability score value of each entity alias are obtained, the probability score value of the entity name and the probability score value of each entity alias are normalized by using the softmax function, and the cross-entropy loss with the label value (1 or 0) is calculated. The cross-entropy loss is used as a loss function. When multiple loss functions are obtained, the corresponding model parameters are obtained through the back propagation mechanism, the model parameters of the first first preset pre-training language model are updated through the model parameters, and the corresponding preset entity recognition model is generated.

[0077] In this embodiment, by training the pre-training language model, the preset entity recognition model is obtained, the entity recognition of the problem by the preset entity recognition model is realized, the semantic encoding of the entity name is realized, the representation ability and the generalization ability of the preset entity recognition model are improved, and the accuracy of the preset entity recognition model is improved.

[0078] In an embodiment, specifically, refer to Figure 5 , Figure 5 is a flowchart of the preset attribute mapping model.

[0079] As Figure 5 shown, the preset attribute mapping model includes steps S301 to S304.

[0080] Step S301, obtaining the training data, determining the target attribute name of the question in the training data, and obtaining the candidate attribute name associated with the target attribute name, wherein the candidate attribute name is multiple.

[0081] In an exemplary embodiment, the training data is obtained, which includes the training question, the answer to the training question, and the corresponding triple of the training question. For example, the training data is the training question “Who is the author of Plum Blossom Falling?”, the triple “Plum Blossom Falling ||| author ||| Bao Zhao”, and the answer to the training question “Bao Zhao”. The target attribute name in the question is determined, which can be manually labeled. The candidate attribute name associated with the target attribute name is obtained. The method of obtaining the candidate attribute name includes querying the preset graph database through the target attribute name, the preset graph database including multiple sets of triples, each set of triples including an entity name, an attribute name, and an attribute value. The attribute name in each triple of the same node of the target attribute is obtained, and the obtained attribute name is taken as the candidate attribute name of the target attribute name.

[0082] Step S302, generating the positive example data of the training data by including the question containing the target attribute name, wherein the label value of the positive example data is 1.

[0083] In an exemplary embodiment, when the attribute name of the training question in the training data is determined as the target attribute name, the positive example data of the training data is generated, wherein the positive example data includes the training question, the answer to the training question, and the corresponding triple. The positive example data is labeled, and the label value of the positive example data is 1.

[0084] Step S303, replacing the target attribute name in the question with each candidate attribute name respectively to generate multiple negative example data of the training data, wherein the label value of each negative example data is 0.

[0085] For example, when the question is "What is the language of the TV series 'Laughing in the River'?", and "language" is the target attribute name of the question, and "dialect", "leading actor", "director", etc. are candidate attribute names of the target attribute name, when the position of "language" in "What is the language of the TV series 'Laughing in the River'?" is determined, "dialect", "leading actor", "director", etc. are replaced with "language" to generate corresponding negative example data, wherein the question in the negative example data is "What is the dialect of the TV series 'Laughing in the River'?", or "What is the leading actor of the TV series 'Laughing in the River'?", etc. The negative example data is labeled, and the label value of the negative example data is 0.

[0086] In step S304, a second pre-trained language model is trained according to the positive example data and the label value of the positive example data, and the plurality of negative example data and the label value of each negative example data, to generate a corresponding preset attribute mapping model.

[0087] In an exemplary embodiment, the positive example data and the plurality of negative example data are input into a second preset pre-trained language model, wherein the second preset pre-trained language model (Bidirectional Encoder Representations from Transformers BERT) includes a dictionary file vocab.txt, and the questions in the positive example data and the negative example data are segmented according to words through the dictionary file vocab.txt to obtain word sequences of the questions in each positive example data and negative example data, and the word sequences of the questions are generated into character word sequences of uniform length according to a preset padding rule or a truncation rule. Wherein, the segmented questions are spliced to obtain corresponding text sequences, wherein the text sequences include type symbols and position symbols of each question, for example, [CLS] characters are used as classification symbols of the text sequences, and [SEP] is used as a position division symbol of each question. The obtained text sequences are vectorized to obtain text vector information corresponding to the text sequences. In an exemplary embodiment, each word in the input text sequence is represented by a pre-trained word feature vector to obtain text vector information, which includes semantic representation information, position representation information, and segmentation representation information of each word in the text sequence.

[0088] The second preset pre-training language model includes a multi-head attention network model. The text vector information obtained is input into the multi-head attention network model. The multi-head attention network model obtains a vector representation corresponding to each word in the input text vector that fuses context information. The multi-head attention network model outputs text semantic vector information. For example, the text vector information obtained is input into the multi-head attention network model. The multi-head attention network model includes a first linear mapping layer. The first linear mapping layer maps the text vector information to semantic vectors in different semantic spaces, capturing semantic information in different dimensions. Self-attention operations are performed on the semantic vectors in different semantic spaces, and text semantic vectors in different semantic spaces are output. The text semantic vectors in different semantic spaces are spliced. The spliced vector information is mapped back to the original semantic space through the first linear mapping layer, and output text semantic vector information is obtained.

[0089] For example, the text vector information obtained is input into the multi-head attention network model. The multi-head attention network model includes a first linear mapping layer. The first linear mapping layer maps the text vector information to semantic vectors in different semantic spaces, capturing semantic information in different dimensions. For example, the linear term in the first linear mapping layer is Q' i = QW i Q , K' i = KW t k , V' i = VW i V where Q is a query value, K is a key value, V is a value vector, i is a linear term mapped to i semantic spaces, Q', i, K', i, and V', i are semantic vectors in the i-th semantic space.

[0090] Self-attention operations are performed on the semantic vectors in different semantic spaces, and text semantic vectors in different semantic spaces are output. For example, the self-attention operation formula is where softmax is a normalization function, T is a vector transpose operation, d k is the dimension of the key vector, hend i is the text semantic vector of the input text sequence in the i-th semantic space. When the text semantic vectors in different semantic spaces are obtained, the text semantic vectors in different semantic spaces are spliced, for example, c = Concat(hend1,..., hend i)W, wherein Concat is a vector concatenation operation, W is a linear term of mapping different semantic spaces back to the initial semantic space, and C is a second text semantic vector output by the multi-head self-attention network model. The concatenated vector information is mapped back to the original semantic space through a first linear mapping layer to obtain the output text semantic vector information.

[0091] When the text semantic vector information is obtained, the semantic vectors of the entity name and each entity alias are obtained from the text semantic vector information. The semantic vectors of the entity name and each entity alias are linearly transformed based on a second linear mapping layer of the first preset pre-training language model to obtain a probability score value of the attribute name and probability score values of each other attribute name. After the probability score value of the attribute name and the probability score values of each other attribute name are obtained, the probability score value of the attribute name and the probability score values of each other attribute name are subjected to softmax normalization processing, and a cross-entropy loss with a label value (1 or 0) is calculated, and the cross-entropy loss is used as a loss function. When a plurality of loss functions are obtained, corresponding model parameters are obtained through a back propagation mechanism, the model parameters of the first first preset pre-training language model are updated through the model parameters, and a corresponding preset attribute mapping model is generated.

[0092] In this embodiment, the preset attribute mapping model is obtained by training the pre-training language model, the attribute mapping of the question is realized by the preset attribute mapping model, the semantic encoding of the attribute name is realized, the representation ability and the generalization ability of the preset attribute mapping model are improved, and the accuracy of the preset attribute mapping model is improved.

[0093] Please refer to Figure 6 , Figure 6 a schematic block diagram of an automatic question answering device provided in the embodiments of the present application.

[0094] As Figure 6 shown, the automatic question answering device 400 comprises an acquisition module 401, a first determination module 402, a second determination module 403, and a third determination module 404.

[0095] The acquisition module 401 is configured to acquire entity aliases of each word in a to-be-predicted question according to a preset alias dictionary, and use the entity aliases as candidate entities, wherein the entity aliases and the candidate entities are multiple.

[0096] The first determination module 402 is configured to determine an entity name corresponding to the to-be-predicted question based on a preset entity recognition model and the to-be-predicted question and the multiple candidate entities.

[0097] The second determination module 403 is configured to determine a triple corresponding to the entity name in a preset graph database according to the entity name and the preset graph database, wherein the triple comprises the entity name, an attribute name, and an attribute value, and the triple is multiple groups.

[0098] The third determining module 404 is configured to determine a target attribute name corresponding to the to-be-predicted question according to each attribute name and the to-be-predicted question based on a preset attribute mapping model, and take an attribute value corresponding to the target attribute name as an answer to the to-be-predicted question.

[0099] The first determining module 402 is specifically configured to:

[0100] generate a plurality of text records by replacing a corresponding word in the to-be-predicted question with each candidate entity;

[0101] input each of the plurality of text records into a preset entity recognition model to predict a predicted value of a candidate entity in each of the text records;

[0102] determine that a candidate entity in a target text record is an entity name according to the predicted value of the candidate entity in each of the text records, and take the entity name as a corresponding entity name of the to-be-predicted question.

[0103] The third determining module 404 is specifically configured to:

[0104] combine each attribute name with the to-be-predicted question to generate a plurality of attribute text pairs;

[0105] input each of the attribute text pairs into a preset attribute mapping model to obtain a predicted score of an attribute name in each of the attribute text pairs;

[0106] obtain a target attribute text pair with the highest predicted score output by the preset attribute mapping model according to the predicted score of the attribute name in each of the attribute text pairs;

[0107] take an attribute name in the target attribute text pair as a target attribute name corresponding to the to-be-predicted question.

[0108] The automatic question answering device is specifically configured to:

[0109] obtain to-be-trained data, determine a target entity name and candidate entity names of a question in the to-be-trained data, wherein the target entity name is different from the candidate entity names, and the candidate entity names are multiple;

[0110] replace the target entity name in the question with a first character of the target entity name to generate positive example data of the to-be-trained data, wherein a label value of the positive example data is 1;

[0111] acquire a second character of the candidate entity name, replace the corresponding candidate entity name in the question with the second character to generate a plurality of negative example data of the training data, wherein the label value of each negative example data is 0;

[0112] According to the positive example data and the label value of the positive example data, and the plurality of negative example data and the label value of each negative example data, train a first pre-training language model to generate a corresponding preset entity recognition model.

[0113] Among them, the automatic question and answer device is specifically used for:

[0114] acquire the target attribute name of the question in the training data, and acquire the candidate attribute name associated with the target attribute name, wherein the candidate attribute name is a plurality of;

[0115] generate a positive example data of the training data by replacing the target attribute name in the question with the target attribute name, wherein the label value of the positive example data is 1;

[0116] replace the target attribute name in the question with each candidate attribute name respectively to generate a plurality of negative example data of the training data, wherein the label value of each negative example data is 0;

[0117] According to the positive example data and the label value of the positive example data, and the plurality of negative example data and the label value of each negative example data, train a second pre-training language model to generate a corresponding preset attribute mapping model.

[0118] Among them, the automatic question and answer device is specifically used for:

[0119] acquire any one of the triplets in the preset knowledge base, and acquire an alias list of the entity name in the triplet based on the preset alias dictionary;

[0120] determine whether the triplet exists in the preset graph knowledge base according to the alias list;

[0121] if it is determined that the triplet exists, the preset graph knowledge base is used as a preset graph database;

[0122] if it is determined that the triplet does not exist, a node is created in the preset knowledge base and the triplet is imported at the node to generate a preset graph database.

[0123] Among them, the automatic question and answer device is specifically used for:

[0124] acquire each text in the preset knowledge base, and identify the entity name in each text;

[0125] extract the entity alias of the entity name based on the preset attribute rule to generate a preset alias dictionary.

[0126] It should be noted that, for the convenience and brevity of description, the specific working process of the apparatus and each module and unit described above can be clearly understood by those skilled in the art, and the corresponding process in the foregoing automatic question answering method embodiments can be referred to, which will not be described here.

[0127] The apparatus provided by the foregoing embodiments can be implemented in the form of a computer program, which can run on a computer device such as the computer device shown in Figure 7 .

[0128] Please refer to Figure 7 , Figure 7 for a structural schematic block diagram of a computer device provided by an embodiment of the present application. The computer device can be a terminal.

[0129] As shown in Figure 7 , the computer device includes a processor, a memory and a network interface connected through a system bus, wherein the memory can include a non-volatile storage medium and an internal memory.

[0130] The non-volatile storage medium can store an operating system and a computer program. The computer program includes program instructions, which when executed, can cause the processor to perform any one of the automatic question answering methods.

[0131] The processor is configured to provide computing and control capabilities to support the operation of the entire computer device.

[0132] The internal memory provides an environment for the running of the computer program in the non-volatile storage medium, which when executed by the processor, can cause the processor to perform any one of the automatic question answering methods.

[0133] The network interface is configured to perform network communication, such as sending assigned tasks, etc. Those skilled in the art can understand that Figure 7 the structure shown in the foregoing description is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0134] It should be appreciated that the processor can be a central processing unit (CPU), the processor can also be other general-purpose processors, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.

[0135] In one embodiment, the processor is configured to run a computer program stored in the memory to implement the following steps:

[0136] According to a preset alias dictionary, an entity alias of each word in the problem to be predicted is obtained, and the entity alias is taken as a candidate entity, wherein the entity alias and the candidate entity are multiple;

[0137] Based on a preset entity recognition model, an entity name corresponding to the problem to be predicted is determined according to the problem to be predicted and the multiple candidate entities;

[0138] According to the entity name and a preset graph database, a triple corresponding to the entity name in the preset graph database is determined; wherein the triple includes the entity name, an attribute name and an attribute value, and the triple is multiple groups;

[0139] Based on a preset attribute mapping model, a target attribute name corresponding to the problem to be predicted is determined according to each attribute name and the problem to be predicted, and an attribute value corresponding to the target attribute name is taken as a question and answer of the problem to be predicted.

[0140] In one embodiment, when the processor determines the entity name corresponding to the problem to be predicted according to the problem to be predicted and the multiple candidate entities based on the preset entity recognition model, it is configured to implement:

[0141] According to the multiple candidate entities, the corresponding words in the problem to be predicted are replaced respectively to generate multiple text records;

[0142] The multiple text records are input into a preset entity recognition model respectively, and the prediction value of the candidate entity in each text record is predicted;

[0143] According to the predicted value of the candidate entity in each of the text records, the candidate entity in the target text record is determined as an entity name, and the entity name is taken as the entity name corresponding to the to-be-predicted question.

[0144] In one embodiment, the processor, when implementing the target attribute name corresponding to the to-be-predicted question based on the preset attribute mapping model according to each of the attribute names and the to-be-predicted question, is configured to implement:

[0145] Each of the attribute names is combined with the to-be-predicted question to generate a plurality of attribute text pairs;

[0146] Each of the attribute text pairs is input into a preset attribute mapping model to obtain a predicted score of the attribute name in each of the attribute text pairs;

[0147] According to the predicted score of the attribute name in each of the attribute text pairs, a target attribute text pair with the highest predicted score output by the preset attribute mapping model is obtained;

[0148] The attribute name in the target attribute text pair is taken as the target attribute name corresponding to the to-be-predicted question.

[0149] In one embodiment, the processor, when implementing the target attribute name corresponding to the to-be-predicted question based on the preset attribute mapping model according to each of the attribute names and the to-be-predicted question, is configured to implement:

[0150] Obtain the target entity name and the candidate entity name of the question in the to-be-trained data, wherein the target entity name and the candidate entity name are different, and the candidate entity name is multiple;

[0151] Obtain the first character of the target entity name, replace the target entity name in the question with the first character, and generate positive example data of the to-be-trained data, wherein the label value of the positive example data is 1;

[0152] Obtain the second character of the candidate entity name, replace each of the corresponding candidate entity names in the question with the second character, and generate a plurality of negative example data of the to-be-trained data, wherein the label value of each of the negative example data is 0;

[0153] According to the positive example data and the label value of the positive example data, and the plurality of negative example data and the label value of each of the negative example data, a first pre-trained language model is trained to generate a corresponding preset entity recognition model.

[0154] In one embodiment, the processor, when implementing the target attribute name corresponding to the to-be-predicted question based on the preset attribute mapping model according to each of the attribute names and the to-be-predicted question, is configured to implement:

[0155] Obtain the target attribute name of the question in the to-be-trained data, and obtain the candidate attribute name associated with the target attribute name, wherein the candidate attribute name is multiple;

[0156] generating positive example data of the to-be-trained data by replacing the target attribute name in the question with the target attribute name, wherein a label value of each of the negative example data is 0;

[0157] generating positive example data of the to-be-trained data by replacing the target attribute name in the question with the target attribute name, wherein a label value of each of the negative example data is 0;

[0158] training a second pre-trained language model according to the positive example data and the label value of the positive example data, and the plurality of negative example data and the label value of each of the negative example data, to generate a corresponding preset attribute mapping model.

[0159] In one embodiment, before determining the corresponding triple of the entity name according to the entity name and the preset graph database, the processor is configured to:

[0160] obtaining any one triple in the preset knowledge base, and obtaining an alias list of the entity name in the triple based on a preset alias dictionary;

[0161] determining whether the triple exists in the preset graph knowledge base according to the alias list;

[0162] if it is determined that the triple exists, taking the preset graph knowledge base as the preset graph database;

[0163] if it is determined that the triple does not exist, creating a node in the preset knowledge base and importing the triple at the node to generate the preset graph database.

[0164] In one embodiment, before obtaining the entity alias in the to-be-predicted question according to the preset alias dictionary and taking the entity alias as a candidate entity, the processor is configured to:

[0165] obtaining each text in the preset knowledge base, and identifying the entity name in each of the texts;

[0166] extracting the entity alias of the entity name based on a preset attribute rule to generate a preset alias dictionary.

[0167] The embodiments of the application further provide a computer readable storage medium, and the computer readable storage medium stores a computer program, the computer program includes program instructions, and the method implemented by the program instructions can refer to each embodiment of the automatic question answering method.

[0168] The computer readable storage medium can be an internal storage unit of the computer device, for example, a hard disk or a memory of the computer device.

[0169] Further, the computer readable storage medium can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required by a function, and the like; and the data storage area can store data created according to the use of the blockchain node, and the like.

[0170] The application refers to a new application mode of computer technology, including storage, point-to-point transmission, consensus mechanism, encryption algorithm, and the like, of a preset alias dictionary, a preset entity recognition model, a preset graph database, and a preset attribute mapping model of a blockchain.

[0171] It should be noted that in this document, the terms "comprising", "containing" or any other variant thereof are intended to cover a non-exclusive inclusion, so that a process, method, article or system that includes a list of elements not only includes those elements, but also includes other elements not expressly listed or inherent to such process, method, article or system. Without more limitations, the element defined by the statement "comprising a" does not exclude the presence of additional identical elements in the process, method, article or system that includes the element.

[0172] The above-mentioned sequence numbers of the embodiments of the present application are only for description, and do not represent the advantages and disadvantages of the embodiments. The above description is merely a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present application, and these modifications or replacements should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. An automatic question answering method, characterized by, The method comprises the following steps: According to the preset alias dictionary, the entity alias of each word in the problem to be predicted is obtained, and the entity alias is taken as a candidate entity, wherein the entity alias and the candidate entity are multiple; Based on the preset entity recognition model, the entity name corresponding to the problem to be predicted is determined according to the problem to be predicted and the multiple candidate entities; According to the entity name and the preset graph database, the triple corresponding to the entity name in the preset graph database is determined, wherein the triple includes the entity name, the attribute name and the attribute value, and the triple is multiple groups; Each attribute name is combined with the problem to be predicted respectively to generate multiple attribute text pairs; Each attribute text pair is input into the preset attribute mapping model to obtain the prediction score of the attribute name in each attribute text pair; According to the prediction score of the attribute name in each attribute text pair, the target attribute text pair with the highest prediction score output by the preset attribute mapping model is obtained, the attribute name in the target attribute text pair is taken as the target attribute name, and the attribute value corresponding to the target attribute name is taken as the question and answer of the problem to be predicted; Wherein, the process of obtaining the prediction score of the attribute name in each attribute text pair includes: using the dictionary file in the preset attribute mapping model to split each attribute text pair to obtain the word sequence of each question and attribute name in each attribute text pair; The word sequence of each question and the word sequence of each attribute name in each attribute text pair are filled to obtain a unified fixed length word sequence; The word sequence of each question and the word sequence of each attribute name in each attribute text pair are spliced to generate the attribute text sequence corresponding to each attribute text pair; Wherein, each attribute text sequence marks the segmentation position of the question and each attribute value by a special symbol, and each attribute text sequence is marked; Each attribute text sequence is vectorized to obtain the text semantic vector information corresponding to each attribute text pair; Based on the special symbol, the segmentation position of each question and each attribute name in each text semantic vector information is marked, and the semantic vector corresponding to each attribute text pair in each text semantic vector information is obtained; The semantic vector corresponding to each attribute text pair is linearly converted to obtain the prediction score of the attribute name in each attribute text pair.

2. The automatic question answering method of claim 1, wherein, The method further comprises the following steps: According to the multiple candidate entities, the corresponding words in the problem to be predicted are replaced to generate multiple text records; The multiple text records are input into the preset entity recognition model respectively, and the prediction value of the candidate entity in each text record is predicted; According to the prediction value of the candidate entity in each text record, the candidate entity in the target text record is determined as the entity name, and the entity name is taken as the entity name corresponding to the problem to be predicted.

3. The automatic question answering method of claim 1, wherein, The method further comprises the following steps: The method comprises the following steps: obtaining training data, determining the target entity name of the question in the training data and the candidate entity name, wherein the target entity name and the candidate entity name are different, and the candidate entity name is multiple; obtaining the first character of the target entity name, replacing the target entity name in the question with the first character to generate positive example data of the training data, wherein the label value of the positive example data is 1; obtaining the second character of the candidate entity name, replacing the corresponding candidate entity name in the question with the second character to generate multiple negative example data of the training data, wherein the label value of each negative example data is 0; 4. The automatic question answering method of claim 1, wherein, training a first pre-training language model according to the positive example data and the label value of the positive example data, and the multiple negative example data and the label value of each negative example data, to generate a corresponding preset entity recognition model. The method further comprises: obtaining training data, determining the target attribute name of the question in the training data, and obtaining the candidate attribute name associated with the target attribute name, wherein the candidate attribute name is multiple; generating positive example data of the training data by including the question with the target attribute name, wherein the label value of the positive example data is 1; replacing the target attribute name in the question with each candidate attribute name to generate multiple negative example data of the training data, wherein the label value of each negative example data is 0; 5. The automatic question answering method of claim 1, wherein, training a second pre-training language model according to the positive example data and the label value of the positive example data, and the multiple negative example data and the label value of each negative example data, to generate a corresponding preset attribute mapping model. Before determining the corresponding triple of the entity name according to the entity name and the preset graph database, the method further comprises: obtaining any one triple in the preset knowledge base, and obtaining an alias list of the entity name in the triple based on a preset alias dictionary; determining whether the triple exists in the preset graph knowledge base according to the alias list; if it is determined that the triple exists, the preset graph knowledge base is used as the preset graph database; 6. The automatic question answering method of claim 1, wherein, if it is determined that the triple does not exist, a node is created in the preset knowledge base and the triple is imported at the node to generate a preset graph database. Before obtaining the entity alias in the question to be predicted according to the preset alias dictionary and taking the entity alias as a candidate entity, the method further comprises: obtaining each text in the preset knowledge base and identifying the entity name in each text; 7. An automatic question answering apparatus characterized by comprising: extracting the entity alias of the entity name based on a preset attribute rule to generate a preset alias dictionary. The method comprises: an obtaining module is configured to obtain the entity alias of each word in the question to be predicted according to the preset alias dictionary, and take the entity alias as a candidate entity, wherein the entity alias and the candidate entity are multiple; a first determining module is configured to determine the entity name corresponding to the question to be predicted based on the preset entity recognition model and the question to be predicted and the multiple candidate entities. The second determining module is configured to determine, according to the entity name and a preset graph database, a triple corresponding to the entity name in the preset graph database, wherein the triple includes the entity name, an attribute name and an attribute value, and the triple is a plurality of triples. The generating module is configured to combine each attribute name with the to-be-predicted question to generate a plurality of attribute text pairs. The predicting module is configured to input each attribute text pair into a preset attribute mapping model to obtain a predicted score of the attribute name in each attribute text pair. The third determining module is configured to obtain, according to the predicted score of the attribute name in each attribute text pair, a target attribute text pair with the highest predicted score output by the preset attribute mapping model, take the attribute name in the target attribute text pair as a target attribute name, and take the attribute value corresponding to the target attribute name as an answer to the to-be-predicted question.

8. A computer device, comprising: The computer device includes a processor, a memory, and a computer program stored on the memory and executable by the processor, wherein when the computer program is executed by the processor, the steps of the automatic question answering method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, wherein when the computer program is executed by the processor, the steps of the automatic question answering method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Question and answer method based on knowledge map

    CN107748757A