CN112417885A - Answer generation method and device based on artificial intelligence, computer equipment and medium - Google Patents

Answer generation method and device based on artificial intelligence, computer equipment and medium Download PDF

Info

Publication number
CN112417885A
CN112417885A CN202011288043.6A CN202011288043A CN112417885A CN 112417885 A CN112417885 A CN 112417885A CN 202011288043 A CN202011288043 A CN 202011288043A CN 112417885 A CN112417885 A CN 112417885A
Authority
CN
China
Prior art keywords
text
query
information
question
preset
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
CN202011288043.6A
Other languages
Chinese (zh)
Inventor
毛经纬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN202011288043.6A priority Critical patent/CN112417885A/en
Publication of CN112417885A publication Critical patent/CN112417885A/en
Priority to PCT/CN2021/090555 priority patent/WO2022105122A1/en
Withdrawn legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/289Phrasal analysis, e.g. finite state techniques or chunking
    • G06F40/295Named entity recognition
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/332Query formulation
    • G06F16/3329Natural language query formulation or dialogue systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • G06F16/3344Query execution using natural language analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/253Grammatical analysis; Style critique
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis

Abstract

The application relates to the technical field of artificial intelligence, and discloses an answer generation method, an answer generation device, computer equipment and a medium based on artificial intelligence, wherein the method comprises the following steps: acquiring data information and identifying the data information by using an information identification model corresponding to the information type of the data information to obtain a text; when the length of the text is larger than a preset length threshold value, segmenting the text according to a preset sliding window to obtain a plurality of text segments; receiving query information and generating a query question corresponding to the query information according to the query information and a preset question template; splicing each text segment and the query question to obtain input information, and inputting the input information into a BERT model to obtain a feature vector corresponding to each text character in the input information; and determining a question answer corresponding to the query question in the text segment according to a preset calculation formula and the feature vector. The method and the system can improve the accuracy of answering questions by the question answering system.

Description

Answer generation method and device based on artificial intelligence, computer equipment and medium
Technical Field
The present application relates to the field of artificial intelligence technologies, and in particular, to an answer generation method and apparatus, a computer device, and a medium based on artificial intelligence.
Background
The Question Answering System (QA) is a high-level form of information retrieval System, which integrates information retrieval, information extraction, natural language processing and other technologies, and can answer questions posed by users in natural language with accurate and simple natural language. Generally, a question-answering system extracts information from acquired data to acquire answers corresponding to questions, but since the Chinese expression mode is flexible and the positions of occurrence of keywords in sentences having the same semantic meaning are also uncertain, wrong answers are easily extracted. At present, information extraction is usually based on a named entity recognition model, and due to the limitation of the named entity recognition model on an input text, information loss is possibly caused, so that complete data information is difficult to extract, the accuracy rate of information extraction is easily low, and the accuracy rate of answering questions by a question-answering system is low.
Therefore, how to improve the accuracy of answering questions by the question-answering system becomes a technical problem to be solved urgently.
Disclosure of Invention
In view of the above, there is a need for an answer generation method, apparatus, computer device and medium based on artificial intelligence, which can improve the accuracy of answering questions by a question-answering system.
A first aspect of the present invention provides an artificial intelligence-based answer generation method, including:
acquiring data information, and identifying the data information by using an information identification model corresponding to the information type of the data information to obtain a text;
when the length of the text is larger than a preset length threshold value, segmenting the text according to a preset sliding window to obtain a plurality of text segments;
receiving query information, and generating a query question corresponding to the query information according to the query information and a preset question template;
splicing each text segment and the query question to obtain input information, and inputting the input information into a pre-trained BERT model to obtain a feature vector corresponding to each text character in the input information;
calculating a first initial probability corresponding to each text character according to a preset first probability calculation formula and a feature vector corresponding to each text character in the input information, and calculating a second ending probability corresponding to each text character according to a preset second probability calculation formula and a feature vector corresponding to each text character in the input information;
calculating the error probability of the input information according to a preset third probability calculation formula;
and when the error probability does not exceed a preset error probability threshold, determining a question answer corresponding to the query question in the text segment according to the starting probability corresponding to the text characters and the ending probability corresponding to the text characters.
According to an optional embodiment of the present invention, after the identifying the data information using the information identification model corresponding to the information type of the data information to obtain a text, the answer generating method further includes:
judging whether the text has error characters or not;
if the text has wrong characters, searching words with the similarity higher than a preset similarity threshold value with the wrong characters from a preset word bank to obtain candidate word groups;
determining a first character in the candidate phrase according to an editing distance algorithm;
and replacing the error characters by the first characters, and obtaining a new text according to the replaced text.
According to an optional embodiment of the present invention, the segmenting the text according to a preset sliding window to obtain a plurality of text segments includes:
starting to slide the sliding window without overlapping from the first text character of the text, and judging whether a sliding ending condition is met after each sliding;
when the sliding end condition is determined to be met, stopping sliding of the sliding window, and determining the starting position and the ending position of the sliding window in the text in each sliding process as character segmentation nodes;
and cutting out the text characters with the preset length threshold from each character cutting node to obtain a plurality of text segments.
According to an optional embodiment of the present invention, the query information includes at least one query sentence, and the generating of the query question corresponding to the query information according to the query information and a preset question template includes:
performing syntactic analysis and named entity recognition on each query sentence to obtain a syntax tree corresponding to each query sentence;
matching the grammar tree corresponding to each query sentence with a problem template in a problem template database established in advance;
and when a problem template is matched with a grammar tree in the problem template database, converting the query sentence corresponding to the grammar tree into a question sentence based on the problem template matched with the grammar tree to obtain a query problem.
According to an optional embodiment of the present invention, the parsing and named entity recognition of each query sentence to obtain a syntax tree corresponding to each query sentence includes:
performing word segmentation on each query sentence to obtain a plurality of query words;
performing part-of-speech tagging on the plurality of query terms to obtain part-of-speech tagging labels corresponding to the query terms;
carrying out named entity recognition on the plurality of query terms, and determining named entity terms in the plurality of query terms;
and obtaining a grammar tree corresponding to each query sentence according to the part-of-speech tagging labels corresponding to the plurality of query words and the named entity words.
According to an optional embodiment of the present invention, before the inputting the input information into a pre-trained BERT model to obtain a feature vector corresponding to each text character in the input information, the answer generating method further includes:
determining an initial vector, a category vector and a position vector corresponding to each literal character in the input information, wherein the category vector is used for representing a content object corresponding to each literal character, and the position vector is used for representing the relative position of each literal character in the input information;
superposing an initial vector, a category vector and a position vector corresponding to each literal character in the input information to obtain a target vector corresponding to each literal character;
the inputting the input information into a pre-trained BERT model to obtain the feature vector corresponding to each text character in the input information comprises the following steps:
and inputting the target vector corresponding to each character into a pre-trained BERT model to obtain the characteristic vector corresponding to each character in the input information.
According to an optional embodiment of the present invention, after determining the question answer corresponding to the query question in the text fragment, the answer generating method further includes:
acquiring a secret level corresponding to the query question and acquiring a user level of a user;
judging whether the user level is matched with the secret level;
and outputting a question answer corresponding to the query question when the user level is matched with the secret level.
A second aspect of the present invention provides an artificial intelligence-based answer generating apparatus, comprising:
the text generation module is used for acquiring data information and identifying the data information by using an information identification model corresponding to the information type of the data information to obtain a text;
the segmentation processing module is used for segmenting the text according to a preset sliding window when the length of the text is greater than a preset length threshold value to obtain a plurality of text segments;
the problem generation module is used for receiving query information and generating a query problem corresponding to the query information according to the query information and a preset problem template;
the vector determination module is used for splicing each text segment and the query question to obtain input information, and inputting the input information into a pre-trained BERT model to obtain a feature vector corresponding to each text character in the input information;
the probability calculation module is used for calculating the initial probability corresponding to each text character according to a preset first probability calculation formula and the feature vector corresponding to each text character in the input information, and calculating the ending probability corresponding to each text character according to a preset second probability calculation formula and the feature vector corresponding to each text character in the input information;
the probability calculation module is further used for calculating the error probability of the input information according to a preset third probability calculation formula;
and the answer generation module is used for determining the answer to the question corresponding to the query question in the text segment according to the starting probabilities corresponding to the text characters and the ending probabilities corresponding to the text characters when the error probability does not exceed a preset error probability threshold.
A third aspect of the invention provides a computer device comprising a memory and a processor; the memory is used for storing a computer program; the processor, when executing the computer program, implements the artificial intelligence based answer generation method as described above.
A fourth aspect of the present invention provides a computer-readable storage medium storing a computer program which, when executed by a processor, implements the artificial intelligence based answer generating method as described above.
The embodiment of the application discloses an answer generation method, an answer generation device, computer equipment and a storage medium based on artificial intelligence, wherein data information is processed according to the information type of the data information to obtain a text segment, if an information identification model corresponding to the information type of the data information is adopted to identify the data information to obtain a text, the text is segmented to obtain the text segment, the information type of the data information is various and is not limited to the character type, the use range of a question-answering system is improved, meanwhile, the data information is preprocessed to obtain a more accurate text segment, and therefore the accuracy of answer to questions is improved; then, the obtained query information and a preset question template are used for generating a query question corresponding to the query information, so that the problem that the generation of a question answer is influenced due to unclear query information is avoided, and the accuracy of the question answer is improved; the text segments and the query questions are spliced to obtain input information, the input information is input into a pre-trained BERT model to obtain a feature vector corresponding to each text character in the input information, the text segments and the query questions are spliced to obtain the input information, single input of the BERT model is achieved, the processing speed of the BERT model can be increased, the problem answer generation speed is increased, meanwhile, the text segments and the query questions are spliced to enable more comprehensive interaction to be conducted among features, the accuracy of the BERT model in determining full-text semantic information is improved, the accuracy of the feature vector corresponding to each text character is improved, and the accuracy of problem answer generation is further improved; then, calculating the initial probability corresponding to each text character according to a preset first probability calculation formula and the feature vector corresponding to each text character in the input information; calculating the ending probability corresponding to each text character according to a preset second probability calculation formula and the feature vector corresponding to each text character in the input information; calculating the error probability of the input information according to a preset third probability calculation formula; and finally, when the error probability does not exceed a preset error probability threshold, determining the question answers corresponding to the query questions in the text segments according to the initial probabilities corresponding to the text characters and the ending probabilities corresponding to the text characters, and determining that the question answers are not included in the text segments when the error probability exceeds the preset error probability threshold through the preset error probability threshold, so that the wrong question answers can be prevented from being determined in the text segments not including the question answers, and the accuracy of the question answering system for answering the questions is further improved.
Drawings
FIG. 1 is a flowchart illustrating an artificial intelligence-based answer generation method according to an embodiment of the present invention;
FIG. 2 is a schematic block diagram of an artificial intelligence-based answer generation apparatus according to an embodiment of the present invention;
fig. 3 is a schematic block diagram of a structure of a computer device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The flow diagrams depicted in the figures are merely illustrative and do not necessarily include all of the elements and operations/steps, nor do they necessarily have to be performed in the order depicted. For example, some operations/steps may be decomposed, combined or partially combined, so that the actual execution sequence may be changed according to the actual situation.
The embodiment of the application provides an answer generation method and device based on artificial intelligence, computer equipment and a computer readable storage medium. The answer generation method based on artificial intelligence can be applied to terminal equipment or a server, the terminal equipment can be electronic equipment such as a mobile phone, a tablet computer, a notebook computer, a desktop computer, a personal digital assistant and wearable equipment, and the server can be a single server or a server cluster consisting of a plurality of servers. The following explanation is given by taking the example that the answer generation method based on artificial intelligence is applied to a server.
Some embodiments of the present application will be described in detail below with reference to the accompanying drawings. The embodiments described below and the features of the embodiments can be combined with each other without conflict.
Referring to fig. 1, fig. 1 is a schematic flowchart illustrating an answer generation method based on artificial intelligence according to an embodiment of the present application.
As shown in fig. 1, the method for generating answers based on artificial intelligence specifically includes steps S11 to S17, and the order of the steps in the flowchart may be changed or some of the steps may be omitted according to different requirements.
And S11, acquiring data information, and identifying the data information by using an information identification model corresponding to the information type of the data information to obtain a text.
The information type may be a text type, a picture type, or a voice type, which is not limited in the embodiments of the present invention. And when the information type of the data information is a non-character type, converting the information type of the data information into a character type, and obtaining a text according to the converted data information. For example, when the information type of the data information is a picture type, inputting the data information into a preset image recognition model to obtain text information corresponding to the data information, and obtaining a text according to the text information corresponding to the data information; and when the information type of the data information is a voice type, inputting the data type into a preset voice recognition model to obtain text information corresponding to the data information, and obtaining a text according to the text information corresponding to the data information. The information types of the data information are various and are not limited to character types, and the application range of the question answering system is widened.
In an embodiment, when the data information is a voice type, after the acquiring the data information, the method specifically further includes:
identifying the type of the accent of the region to which the data information belongs; performing voice correction processing on the data information based on the regional accent type;
the recognizing the data information by using the information recognition model corresponding to the information type of the data information to obtain the text comprises:
inputting the processed data information into a preset voice recognition model to obtain text information corresponding to the data information; and obtaining a text through the text information corresponding to the data information.
When a user in a different area inputs voice, the user can own the accent of the area, and the accent is regionalized, so that the recognition is difficult, and the voice recognition is easy to be wrong. And based on the regional accent type, performing voice correction processing on the data information to obtain mandarin conforming to the standard, and further more accurately identifying the content of the data information to obtain more accurate text, thereby improving the accuracy of answer generation.
In an embodiment, after the identifying the data information by using the information identification model corresponding to the information type of the data information to obtain a text, the method specifically further includes the following steps:
judging whether the text has error characters or not;
if the text has wrong characters, searching words with the similarity higher than a preset similarity threshold value with the wrong characters from a preset word bank to obtain candidate word groups;
determining a first character in the candidate phrase according to an editing distance algorithm;
and replacing the error characters by the first characters, and obtaining a new text according to the replaced text.
In this alternative embodiment, the question-answering system may automatically recognize the correction when the text has misspellings, homophones. The error correction of the Chinese characters is realized by using an edit distance algorithm, firstly, words with higher word similarity and pinyin similarity are searched in a preset word bank (usually the word bank in the same industry field with the text) to be used as candidate words, so as to reduce the calculation range of the edit distance, then, the edit distance between each candidate word and a word needing error correction is calculated, the candidate word with the minimum edit distance is selected, and if the edit distance value exceeds a set error correction threshold value, the result is returned.
The data information is preprocessed according to the information type of the data information to obtain a text, the information type of the data information is various and is not limited to the character type, the use range of a question-answering system is widened, meanwhile, the data information is preprocessed to obtain more accurate text segments, and therefore the accuracy rate of answer to questions is improved.
It should be noted that, in order to ensure the privacy and security of the data in the data information process, the information data in the processing process, such as the acquired data information, the text obtained by identifying the data information, and the like, may be stored in the block chain.
And S12, when the length of the text is larger than a preset length threshold value, segmenting the text according to a preset sliding window to obtain a plurality of text segments.
The preset length threshold is the maximum text length which can be identified by the BERT model.
In an embodiment, the segmenting the text according to a preset sliding window to obtain a plurality of text segments specifically includes the following steps based on artificial intelligence:
starting to slide the sliding window without overlapping from the first text character of the text, and judging whether a sliding ending condition is met after each sliding;
when the sliding end condition is determined to be met, stopping sliding of the sliding window, and determining the starting position and the ending position of the sliding window in the text in each sliding process as character segmentation nodes;
and cutting out the text characters with the preset length threshold from each character cutting node to obtain a plurality of text segments.
Wherein it is determined that the preset sliding end condition is satisfied when a difference between an end position of the sliding window in the text and an end position of the text after each sliding is less than or equal to the length threshold; determining that the preset sliding end condition is not satisfied when a difference value between an end position of the sliding window in the text and an end position of the text after each sliding is greater than the length threshold.
Illustratively, the BERT model allows a maximum text length of the input, i.e., a text length threshold, denoted m. When the length L of the text T is greater than the set maximum text length m, the text T needs to be segmented, for example, the text T is segmented according to a preset sliding window d to obtain a plurality of text segments. For example, the text preset length threshold m of the BERT model is 500, the preset sliding window is 40, and the length L of the existing text T is 600, for example, where the text T ═ T [ T ]1,t2,...,t600]And the length of the text T is larger than the text length threshold, and the text T is segmented according to the sliding window d to obtain 4 text segments with the lengths of 500, 500, 500 and 480 respectively, for example [ T1,t2,...,t500],,[t41,t42,...,t540],[t81,t82,...,t580],[t121,t122,...,t600]。
The text is segmented according to the preset text length threshold of the BERT model, the situation that the reading of text information is incomplete due to the fact that the text is too long is avoided, and the accuracy of answer generation is further improved.
And S13, receiving query information, and generating a query question corresponding to the query information according to the query information and a preset question template.
Illustratively, a user inputs query information to be queried on a search page of a question-answering system, and the question-answering system acquires the query information and generates a query question corresponding to the query information according to the content of the query information and a preset question template. For example, the query information input by the user and required to be queried is 'date of discharge of plums', and the query question corresponding to the query information is generated according to the preset question template and the query information as follows: what is the date of discharge of the plum.
In an embodiment, the query information includes at least one query sentence, and the generating of the query question corresponding to the query information according to the query information and a preset question template includes:
performing syntactic analysis and named entity recognition on each query sentence to obtain a syntax tree corresponding to each query sentence;
matching the grammar tree corresponding to each query sentence with a problem template in a problem template database established in advance;
and when a problem template is matched with a grammar tree in the problem template database, converting the query sentence corresponding to the grammar tree into a question sentence based on the problem template matched with the grammar tree to obtain a query problem.
Illustratively, the question templates may include the following, wherein the format of the question templates in the database may be as follows:
question template representing "how many": QP < CD ═ number < CLP;
question template representing "number of days": QP < OD ═ number;
causal relationship problem template: (IP | PP ═ coast < < because >, (IP | PP | VP) < < (IP | PP | VP < < so | then));
turning relationship problem template: ((IP | PP ═ front.,. IP ═ however) | < (IP | PP ═ front | < (IP | PP | VP ═ however >)).
The symbols therein are from the Stanford Natural language labs definition of the components present in the syntax tree. When a question template is successfully matched on the grammar tree of the current query sentence, the current query sentence is rewritten into the question sentence based on the question template by using the question template, thereby generating the query question.
The question template database is formed by learning language rules from a large amount of article data to obtain a large amount of question templates. For each query sentence in the query content, matching a question template in a question template database by using a respective syntax tree, and directly converting the query sentence into a corresponding question sentence by using the matched question template once the matching is successful so as to generate a corresponding query question. When the sentence is not matched with the question template in the current question template database, the query sentence can not generate a question; and (4) through batch statistics, sentences which can not be used for inquiring the problems can not be generated, a new problem template is formulated, and the problem template database is updated. The problem template and the problem template database are only illustrated here, and the embodiment does not limit the problem template and the problem template database.
In an embodiment, the parsing and named entity recognition of each query sentence to obtain a syntax tree corresponding to each query sentence includes:
performing word segmentation on each query sentence to obtain a plurality of query words;
performing part-of-speech tagging on the plurality of query terms to obtain part-of-speech tagging labels corresponding to the query terms;
carrying out named entity recognition on the plurality of query terms, and determining named entity terms in the plurality of query terms;
and obtaining a grammar tree corresponding to each query sentence according to the part-of-speech tagging labels corresponding to the plurality of query words and the named entity words.
For example, the process of parsing a query sentence and named entity recognition may include the steps of: firstly, segmenting a query sentence to obtain a plurality of query words, then, according to symbols used for representing time nouns in syntactic analysis, performing part-of-speech tagging on each query word to obtain part-of-speech tagging labels corresponding to each query word, and performing named entity recognition on each query word, such as name of a person, name of a mechanism, name of a place or other entities with names as identifiers, so as to determine named entity words in the plurality of query words. After the syntactic analysis and the named entity recognition of the query sentence are completed, a corresponding syntax tree can be established for the query sentence according to the part-of-speech tagging labels corresponding to the query words in the query sentence and the named entity words in the query sentence.
For example, a query sentence is "2020 spreading of coronavirus", the query sentence is subjected to word segmentation to obtain a plurality of query words, such as "2020 | spreading of coronavirus | with the symbol" | "representing segmentation, and then each query word is tagged with a part-of-speech tag according to the symbol used for representing time nouns in syntactic analysis, for example," NT "represents a common noun in syntactic analysis, so" 2020 "is labeled as" NT "; and performing named entity recognition on each query word, and determining named entity words in the plurality of query words, such as determining named entity words identified by time in 2020, and determining coronas and viruses as named entity words identified by name. And finally, obtaining a grammar tree corresponding to the query sentence according to the part-of-speech tagging labels and the named entity words corresponding to the plurality of query words in the query sentence. And matching the grammar tree corresponding to the query sentence with a question template in a question template database established in advance to generate a query question corresponding to the query sentence, so that the accuracy of generating the query question can be improved, and the accuracy of the answer to the question can be improved.
The query question corresponding to the query information is generated according to the query information and the preset question template, so that the problem that the generation of the answer to the question is influenced due to unclear query information is avoided, and the accuracy of the answer to the question is improved.
And S14, splicing each text segment and the query question to obtain input information, and inputting the input information into a pre-trained BERT model to obtain a feature vector corresponding to each text character in the input information.
Illustratively, the training tasks of the BERT Model may include a Masked Language Model (MLM) task and/or a Next Sentence Prediction (NSP) task, where the MLM task is configured to mask words in a training text segment at a preset ratio and predict the Masked words, and the preset ratio may be reasonably set according to an actual situation, for example, the preset ratio may be 15%, 20%, and the like; the NSP task is used to predict sentence-pair relationships, such as determining whether sentence B is a context of sentence a. The feature vector corresponding to each text character in the input information is obtained by using a pre-trained BERT model, and due to the capability of fusing full-text semantic information with the BERT model, the accuracy of the feature vector corresponding to each text character can be improved, so that the accuracy of the answer to the question is improved.
Illustratively, the splicing the text segment and the query question to obtain input information, and inputting the input information into a pre-trained BERT model may specifically include: converting each character in the text segment and the query question into a one-dimensional vector through a query word vector table, and splicing the text segment converted into the one-dimensional vector and the query question converted into the one-dimensional vector to obtain input information, wherein the input information comprises a plurality of text characters. For example, the text segment is a text W, and each character in the text W is converted into a one-dimensional vector by querying a word vector table, such as W ═ W1,w2,...,wn](ii) a The query question is a question Q, and each character in the question Q is converted into a one-dimensional vector by querying a word vector table, for example, Q ═ Q [ ]1,q2,...,qn]Changing W to [ W1,w2,...,wn]And Q ═ Q1,q2,...,qn]And splicing to obtain input information, and inputting the input information into a pre-trained BERT model.
For example, a special classification mark, such as a CLS mark, can be added in front of the query question for marking; when splicing together query questions and text paragraphs, distinctive marks are made using special marks, e.g. [ CLSq ] marks, in between, e.g. SEP marks1,q2,...,qn SEP w1,w2,...,wn]。
Exemplarily, a pre-trained BERT model determines full-text semantic information corresponding to the input information according to the input information, and processes a vector of each character in the input information according to the full-text semantic information to obtain a vector representation corresponding to each character in the input information after the full-text semantic information is fused with each character in the input information, so as to obtain a feature vector corresponding to each text character in the input information, such as a feature vector V ═ V [ V ] V ═ V [ ]1,v2,...,vm]。
The input information is obtained by splicing the text segment and the query question, so that the single input of the BERT model is realized, the processing speed of the BERT model can be increased, and the generation rate of the question answer is increased. Meanwhile, the text fragments and the query questions are spliced, so that more comprehensive interaction can be performed among the features, the accuracy of the BERT model for determining full-text semantic information is improved, and the accuracy of generating answers to the questions is improved.
In an embodiment, before the inputting the input information into a pre-trained BERT model to obtain a feature vector corresponding to each text character in the input information, the method further includes:
determining an initial vector, a category vector and a position vector corresponding to each literal character in the input information, wherein the category vector is used for representing a content object corresponding to each literal character, and the position vector is used for representing the relative position of each literal character in the input information;
respectively superposing an initial vector, a category vector and a position vector corresponding to each literal character in the input information to obtain a target vector corresponding to each literal character;
the inputting the input information into a pre-trained BERT model to obtain the feature vector corresponding to each text character in the input information comprises the following steps: and inputting the target vector corresponding to each character into a pre-trained BERT model to obtain the characteristic vector corresponding to each character in the input information.
Each literal character in the input information may be referred to as a Token (Token), and the initial vector corresponding to each literal character may also be referred to as word embedding (Token embedding), which may refer to the initialized vector of each textual character. The category vector corresponding to each text character may also be referred to as Segment embedding (Segment embedding), which is used to represent a content object corresponding to each text character, and may be used to distinguish a query question from a text Segment in the input information, where for example, text character a is a text character in the query question, text character B is a text character in the text Segment, the category vector of text character a is 0, and the category vector of text character B is 1. The Position vector corresponding to each text character may also be referred to as Position Embedding (Position Embedding), and is used to indicate a relative Position of each text character in the input information.
The text segments and the query questions are spliced to obtain input information, so that single input of the BERT model is realized, the processing speed of the BERT model can be increased, and the generation rate of answer to the questions is increased. Meanwhile, the text segments and the query questions are spliced, so that the features can be interacted more comprehensively, the accuracy of the BERT model for determining full-text semantic information is improved, the accuracy of the feature vector corresponding to each text character is improved, and the accuracy of the generation of the answer to the question is further improved.
S15, calculating the initial probability corresponding to each text character according to a preset first probability calculation formula and the feature vector corresponding to each text character in the input information, and calculating the ending probability corresponding to each text character according to a preset second probability calculation formula and the feature vector corresponding to each text character in the input information.
Illustratively, the first probability calculation formula is:
Figure BDA0002782975730000141
wherein v issIs the initial probability parameter of the BERT model, viIs a feature vector corresponding to the i-th character after semantic fusion in the text segment, vjThe average value of the feature vectors after semantic fusion of all characters in the text segment is obtained, and m is the maximum text length allowed to be input by the BERT model.
And calculating the initial probability corresponding to each text character in the text segment, namely the initial probability of the answer to the question according to the first probability calculation formula and the feature vector corresponding to each text character in the input information after semantic fusion. For example, a text segment W ═ W1,w2,...,wn]Query question Q ═ Q1,q2,...,qn]Splicing the query question Q and the text segment W to obtain input information V, and performing semantic fusion through a BERT model to obtain semantic fusion of each text character in the input information VThe corresponding characteristic vector being combined, e.g. V ═ V1,v2,...,vm]And calculating data required in the first probability calculation formula according to the feature vector corresponding to each text character after semantic fusion in the input information V, and substituting the obtained data into the first probability calculation formula to calculate the initial probability corresponding to each text character in the text segment W, such as calculating the initial probability corresponding to W1 and the initial probability corresponding to the initial probability … Wn corresponding to W2.
Illustratively, the second probability calculation formula is:
Figure BDA0002782975730000151
wherein v iseIs the end probability parameter of the BERT model, viIs a feature vector corresponding to the i-th character after semantic fusion in the text segment, vjThe average value of the feature vectors after semantic fusion of all characters in the text segment is obtained, and m is the maximum text length allowed to be input by the BERT model.
And calculating the ending probability corresponding to each text character in the text fragment, namely the ending probability of the answer to the question according to the second probability calculation formula and the feature vector corresponding to each text character in the input information after semantic fusion. For example, a text segment W ═ W1,w2,...,wn]Query question Q ═ Q1,q2,...,qn]Splicing the query question Q and the text segment W to obtain input information V, performing semantic fusion through a BERT model to obtain a feature vector corresponding to each text character in the input information V after semantic fusion, wherein if V is [ V ═ V [ [ V ] V [ ]1,v2,...,vm]And calculating the required data in the second probability calculation formula according to the feature vector corresponding to each text character after semantic fusion in the input information V, and substituting the obtained data into the second probability calculation formula to calculate the end probability corresponding to each text character in the text segment W, such as calculating the end probability corresponding to W1 and the end probability corresponding to the end probability … Wn corresponding to W2.
And S16, calculating the error probability of the input information according to a preset third probability calculation formula.
Illustratively, the third probability calculation formula is:
PN=σ(w*vcls+b)
wherein, sigma is sigmoid function, w is weight matrix which can be learnt in BERT model, b is error probability parameter of BERT model, vclsIs the feature vector corresponding to the CLS token in the input information.
And after acquiring the feature vector corresponding to each text character in the input information after semantic fusion, substituting the feature vector corresponding to the CLS mark in the input information V into the third probability calculation formula to calculate the error probability of the input information, namely calculating the probability that the text segment in the input information does not contain the answer to the question.
S17, when the error probability does not exceed a preset error probability threshold, determining a question answer corresponding to the query question in the text fragment according to the starting probability corresponding to the text characters and the ending probability corresponding to the text characters.
Illustratively, the threshold of the error probability is set to 0.5, when the value of the error probability is less than or equal to 0.5, it is determined that the question answer corresponding to the query question exists in the text segment, and the question answer corresponding to the query question is determined in the text segment according to the start probabilities corresponding to the plurality of text characters and the end probabilities corresponding to the plurality of text characters. And determining the maximum product value by respectively calculating the product value of the starting probability corresponding to each text character and the ending probability corresponding to all other text characters, and determining the text between the two text characters corresponding to the maximum product value as the answer to the question corresponding to the query question. For example, a text fragment includes a text character [ w ]1,w2,...,wn]Calculating the product of the start probability corresponding to each text character and the end probabilities corresponding to all other text characters in the text segment, such as calculating the start probability of the text character W1 and the end probabilities of the text characters W2 and W3 … WnThe product value of the start probability of the text character W2 and the end probabilities of the text characters W3, W4 … Wn, the product value of the start probability of the text character W3 and the end probability of the text character W4 … Wn, the maximum value of the product values is determined, and the text between two text characters corresponding to the maximum product value is determined as the question answer corresponding to the query question. When the numerical value of the product of the start probability of the text character W2 and the end probability of the text character W6 is a maximum value, the text between the text character W2 and the text character W6 is determined as a question answer corresponding to the query question.
For example, when the error probability exceeds a preset error probability threshold, a prompt instruction may be generated according to a preset prompt rule. For example, the error probability threshold is set to 0.5, and when the value of the error probability is greater than 0.5, it is determined that no answer to the question corresponding to the query question exists in the text segment, and a prompt instruction is generated according to a preset prompt rule.
Through the preset error probability threshold, when the error probability exceeds the preset error probability threshold, the text segment is determined not to include the question answer, the situation that the wrong question answer is determined in the text segment not including the question answer can be avoided, and therefore the accuracy of the question answer is improved.
In an embodiment, after determining the answer to the question corresponding to the query question in the text segment, the method further includes:
acquiring a secret level corresponding to the query question and acquiring a user level of a user;
judging whether the user level is matched with the secret level;
and outputting a question answer corresponding to the query question when the user level is matched with the secret level.
Verifying the user identity of the current user, determining the user level, matching the user level with the secret level of the current query question, outputting the question answer corresponding to the query question when the user level is matched with the secret level, and not outputting the question answer corresponding to the query question when the user level is not matched with the secret level. The identity of the current user can be verified by matching and judging the confidentiality level and the user level, and if the confidentiality level and the user level are matched, the current user is indicated to belong to the search authority corresponding to the query problem. Through the verification of the user identity, the safety of the information can be ensured.
In the answer generation method based on artificial intelligence provided in the above embodiment, data information is processed according to information types of the data information to obtain text segments, and if an information identification model corresponding to the information types of the data information is used to identify the data information to obtain a text, the text is segmented to obtain the text segments, where the information types of the data information are various and are not limited to character types, so that the use range of a question-answering system is extended, and meanwhile, the data information is preprocessed to obtain more accurate text segments, thereby increasing the accuracy of answers to questions; then, the obtained query information and a preset question template are used for generating a query question corresponding to the query information, so that the problem that the generation of a question answer is influenced due to unclear query information is avoided, and the accuracy of the question answer is improved; the text segments and the query questions are spliced to obtain input information, the input information is input into a pre-trained BERT model to obtain a feature vector corresponding to each text character in the input information, the text segments and the query questions are spliced to obtain the input information, single input of the BERT model is achieved, the processing speed of the BERT model can be increased, the problem answer generation speed is increased, meanwhile, the text segments and the query questions are spliced to enable more comprehensive interaction to be conducted among features, the accuracy of the BERT model in determining full-text semantic information is improved, the accuracy of the feature vector corresponding to each text character is improved, and the accuracy of problem answer generation is further improved; then, calculating the initial probability corresponding to each text character according to a preset first probability calculation formula and the feature vector corresponding to each text character in the input information; calculating the ending probability corresponding to each text character according to a preset second probability calculation formula and the feature vector corresponding to each text character in the input information; calculating the error probability of the input information according to a preset third probability calculation formula; and finally, when the error probability does not exceed a preset error probability threshold, determining the question answer corresponding to the query question in the text segment according to the initial probability corresponding to the text characters and the end probability corresponding to the text characters, and determining that the question answer is not included in the text segment when the error probability exceeds the preset error probability threshold through the preset error probability threshold, so that the wrong question answer can be prevented from being determined in the text segment not including the question answer, and the accuracy of answering the question by the question-answering system is improved.
Referring to fig. 2, fig. 2 is a schematic block diagram of an artificial intelligence based answer generating device according to an embodiment of the present application, where the answer generating device is configured to execute the above-mentioned artificial intelligence based answer generating method. Wherein, the answer generating device can be configured in a server or a terminal.
The server may be an independent server or a server cluster. The terminal can be an electronic device such as a mobile phone, a tablet computer, a notebook computer, a desktop computer, a personal digital assistant and a wearable device.
As shown in fig. 2, the artificial intelligence based answer generating apparatus 20 includes: a text generation module 201, a segmentation processing module 202, a question generation module 203, a vector determination module 204, a probability calculation module 205 and an answer generation module 206.
The text generation module 201 is configured to obtain data information, and identify the data information by using an information identification model corresponding to an information type of the data information to obtain a text;
the segmentation processing module 202 is configured to, when the length of the text is greater than a preset length threshold, perform segmentation processing on the text according to a preset sliding window to obtain a plurality of text segments;
the question generation module 203 is configured to receive query information and generate a query question corresponding to the query information according to the query information and a preset question template;
the vector determination module 204 is configured to splice each text segment with the query question to obtain input information, and input the input information into a pre-trained BERT model to obtain a feature vector corresponding to each text character in the input information;
a probability calculation module 205, configured to calculate, according to a preset first probability calculation formula and a feature vector corresponding to each text character in the input information, a start probability corresponding to each text character, and calculate, according to a preset second probability calculation formula and a feature vector corresponding to each text character in the input information, an end probability corresponding to each text character;
the probability calculation module 205 is further configured to calculate an error probability of the input information according to a preset third probability calculation formula;
an answer generating module 206, configured to determine, when the error probability does not exceed a preset error probability threshold, a question answer corresponding to the query question in the text fragment according to a start probability corresponding to the plurality of text characters and an end probability corresponding to the plurality of text characters.
It should be noted that, as will be clear to those skilled in the art, for convenience and brevity of description, the specific working processes of the apparatus and the modules and units described above may refer to the corresponding processes in the embodiment of the answer generation method based on artificial intelligence, and are not described herein again.
The answer generating apparatus provided in the above embodiment may be implemented in a form of a computer program, and the computer program may be run on a computer device as shown in fig. 3.
Referring to fig. 3, fig. 3 is a schematic block diagram of a computer device according to an embodiment of the present disclosure. The computer device may be a server or a terminal device.
As shown in fig. 3, the computer device 30 includes a processor 301 and a memory 302 connected by a system bus, wherein the memory 302 may include a nonvolatile storage medium and a volatile storage medium.
The memory 302 may store an operating system and computer programs. The computer program comprises program instructions that, when executed, cause the processor 301 to perform any of the artificial intelligence based answer generation methods described herein.
The processor 301 is used to provide computing and control capabilities, supporting the operation of the overall computer device.
In a possible embodiment, the computer device further comprises a network interface for performing network communication, such as sending assigned tasks, etc. Those skilled in the art will appreciate that the architecture shown in fig. 3 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
It should be understood that Processor 301 is a Central Processing Unit (CPU), and may be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, etc. Wherein a general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Wherein, in one embodiment, the processor executes a computer program stored in the memory to implement the steps of:
acquiring data information, and identifying the data information by using an information identification model corresponding to the information type of the data information to obtain a text;
when the length of the text is larger than a preset length threshold value, segmenting the text according to a preset sliding window to obtain a plurality of text segments;
receiving query information, and generating a query question corresponding to the query information according to the query information and a preset question template;
splicing each text segment and the query question to obtain input information, and inputting the input information into a pre-trained BERT model to obtain a feature vector corresponding to each text character in the input information;
calculating the initial probability corresponding to each text character according to a preset first probability calculation formula and the feature vector corresponding to each text character in the input information, and calculating the ending probability corresponding to each text character according to a preset second probability calculation formula and the feature vector corresponding to each text character in the input information;
calculating the error probability of the input information according to a preset third probability calculation formula;
and when the error probability does not exceed a preset error probability threshold, determining a question answer corresponding to the query question in the text segment according to the starting probability corresponding to the text characters and the ending probability corresponding to the text characters.
Specifically, the specific implementation method of the program instructions by the processor may refer to the description of the relevant steps in the embodiment of the artificial intelligence based answer generation method, which is not described herein again.
An embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, where the computer program includes program instructions, and the program instructions, when executed, implement the following steps:
acquiring data information, and identifying the data information by using an information identification model corresponding to the information type of the data information to obtain a text;
when the length of the text is larger than a preset length threshold value, segmenting the text according to a preset sliding window to obtain a plurality of text segments;
receiving query information, and generating a query question corresponding to the query information according to the query information and a preset question template;
splicing each text segment and the query question to obtain input information, and inputting the input information into a pre-trained BERT model to obtain a feature vector corresponding to each text character in the input information;
calculating the initial probability corresponding to each text character according to a preset first probability calculation formula and the feature vector corresponding to each text character in the input information, and calculating the ending probability corresponding to each text character according to a preset second probability calculation formula and the feature vector corresponding to each text character in the input information;
calculating the error probability of the input information according to a preset third probability calculation formula;
and when the error probability does not exceed a preset error probability threshold, determining a question answer corresponding to the query question in the text segment according to the starting probability corresponding to the text characters and the ending probability corresponding to the text characters.
Specifically, the specific implementation method of the program instructions executed by the processor may refer to the description of the relevant steps in the embodiment of the answer generation method based on artificial intelligence, which is not repeated herein.
The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, for example, a hard disk or a memory of the computer device. The computer readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like provided on the computer device.
According to the answer generation device, the computer device and the computer readable storage medium provided by the foregoing embodiments, data information is processed according to information types of the data information to obtain text segments, for example, the data information is identified by using an information identification model corresponding to the information types of the data information to obtain a text, and the text is segmented to obtain the text segments, where the information types of the data information are various and are not limited to character types, so that the use range of a question-answering system is increased, and meanwhile, the data information is preprocessed to obtain more accurate text segments, thereby increasing the accuracy of answers to questions; then, the obtained query information and a preset question template are used for generating a query question corresponding to the query information, so that the problem that the generation of a question answer is influenced due to unclear query information is avoided, and the accuracy of the question answer is improved; the text segments and the query questions are spliced to obtain input information, the input information is input into a pre-trained BERT model to obtain a feature vector corresponding to each text character in the input information, the text segments and the query questions are spliced to obtain the input information, single input of the BERT model is achieved, the processing speed of the BERT model can be increased, the problem answer generation speed is increased, meanwhile, the text segments and the query questions are spliced to enable more comprehensive interaction to be conducted among features, the accuracy of the BERT model in determining full-text semantic information is improved, the accuracy of the feature vector corresponding to each text character is improved, and the accuracy of problem answer generation is further improved; then, calculating the initial probability corresponding to each text character according to a preset first probability calculation formula and the feature vector corresponding to each text character in the input information; calculating the ending probability corresponding to each text character according to a preset second probability calculation formula and the feature vector corresponding to each text character in the input information; calculating the error probability of the input information according to a preset third probability calculation formula; and finally, when the error probability does not exceed a preset error probability threshold, determining the question answer corresponding to the query question in the text segment according to the initial probability corresponding to the text characters and the end probability corresponding to the text characters, and determining that the question answer is not included in the text segment when the error probability exceeds the preset error probability threshold through the preset error probability threshold, so that the wrong question answer can be prevented from being determined in the text segment not including the question answer, and the accuracy of answering the question by the question-answering system is improved.
The blockchain referred to in the application is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items. It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments. While the invention has been described with reference to specific embodiments, the scope of the invention is not limited thereto, and those skilled in the art can easily conceive various equivalent modifications or substitutions within the technical scope of the invention. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. An artificial intelligence based answer generating method, comprising:
acquiring data information, and identifying the data information by using an information identification model corresponding to the information type of the data information to obtain a text;
when the length of the text is larger than a preset length threshold value, segmenting the text according to a preset sliding window to obtain a plurality of text segments;
receiving query information, and generating a query question corresponding to the query information according to the query information and a preset question template;
splicing each text segment and the query question to obtain input information, and inputting the input information into a pre-trained BERT model to obtain a feature vector corresponding to each text character in the input information;
calculating the initial probability corresponding to each text character according to a preset first probability calculation formula and the feature vector corresponding to each text character in the input information, and calculating the ending probability corresponding to each text character according to a preset second probability calculation formula and the feature vector corresponding to each text character in the input information;
calculating the error probability of the input information according to a preset third probability calculation formula;
and when the error probability does not exceed a preset error probability threshold, determining a question answer corresponding to the query question in the text segments according to the starting probabilities corresponding to the text characters and the ending probabilities corresponding to the text characters.
2. The artificial intelligence based answer generating method of claim 1, wherein after said identifying the data information using an information identification model corresponding to an information type of the data information into text, the method further comprises:
judging whether the text has error characters or not;
if the text has wrong characters, searching words with the similarity higher than a preset similarity threshold value with the wrong characters from a preset word bank to obtain candidate word groups;
determining a first character in the candidate phrase according to an editing distance algorithm;
and replacing the error characters by the first characters, and obtaining a new text according to the replaced text.
3. The artificial intelligence based answer generating method of claim 1, wherein the segmenting the text according to a preset sliding window to obtain a plurality of text segments comprises:
starting to slide the sliding window without overlapping from the first text character of the text, and judging whether a sliding ending condition is met after each sliding;
when the sliding end condition is determined to be met, stopping sliding of the sliding window, and determining the starting position and the ending position of the sliding window in the text in each sliding process as character segmentation nodes;
and cutting out the text characters with the preset length threshold from each character cutting node to obtain a plurality of text segments.
4. The artificial intelligence based answer generating method of claim 1, wherein the query information comprises at least one query sentence, and the generating of the query question corresponding to the query information according to the query information and a preset question template comprises:
performing syntactic analysis and named entity recognition on each query sentence to obtain a syntax tree corresponding to each query sentence;
matching the grammar tree corresponding to each query sentence with a problem template in a problem template database established in advance;
and when a problem template is matched with a grammar tree in the problem template database, converting the query sentence corresponding to the grammar tree into a question sentence based on the problem template matched with the grammar tree to obtain a query problem.
5. The artificial intelligence based answer generation method of claim 4, wherein said parsing and named entity recognition each of said query sentences to obtain a syntax tree corresponding to each query sentence comprises:
performing word segmentation on each query sentence to obtain a plurality of query words;
performing part-of-speech tagging on the plurality of query terms to obtain part-of-speech tagging labels corresponding to the query terms;
carrying out named entity recognition on the plurality of query terms, and determining named entity terms in the plurality of query terms;
and obtaining a grammar tree corresponding to each query sentence according to the part-of-speech tagging labels corresponding to the plurality of query words and the named entity words.
6. The artificial intelligence based answer generation method of any one of claims 1 to 5, wherein before entering the input information into each text character of a pre-trained BERT model, the method further comprises:
determining an initial vector, a category vector and a position vector corresponding to each literal character in the input information, wherein the category vector is used for representing a content object corresponding to each literal character, and the position vector is used for representing the relative position of each literal character in the input information;
superposing an initial vector, a category vector and a position vector corresponding to each literal character in the input information to obtain a target vector corresponding to each literal character;
the inputting the input information into a pre-trained BERT model to obtain the feature vector corresponding to each text character in the input information comprises the following steps:
and inputting the target vector corresponding to each character into a pre-trained BERT model to obtain the characteristic vector corresponding to each character in the input information.
7. The artificial intelligence based answer generating method of any one of claims 1-5, wherein after determining the question answer corresponding to the query question in the text passage, the method further comprises:
acquiring a secret level corresponding to the query question and acquiring a user level of a user;
judging whether the user level is matched with the secret level;
and outputting a question answer corresponding to the query question when the user level is matched with the secret level.
8. An artificial intelligence based answer generating apparatus, comprising:
the text generation module is used for acquiring data information and identifying the data information by using an information identification model corresponding to the information type of the data information to obtain a text;
the segmentation processing module is used for segmenting the text according to a preset sliding window when the length of the text is greater than a preset length threshold value to obtain a plurality of text segments;
the problem generation module is used for receiving query information and generating a query problem corresponding to the query information according to the query information and a preset problem template;
the vector determination module is used for splicing each text segment and the query question to obtain input information, and inputting the input information into a pre-trained BERT model to obtain a feature vector corresponding to each text character in the input information;
the probability calculation module is used for calculating the initial probability corresponding to each text character according to a preset first probability calculation formula and the feature vector corresponding to each text character in the input information, and calculating the ending probability corresponding to each text character according to a preset second probability calculation formula and the feature vector corresponding to each text character in the input information;
the probability calculation module is further used for calculating the error probability of the input information according to a preset third probability calculation formula;
and the answer generation module is used for determining the answer to the question corresponding to the query question in the text segment according to the starting probabilities corresponding to the text characters and the ending probabilities corresponding to the text characters when the error probability does not exceed a preset error probability threshold.
9. A computer device, wherein the computer device comprises a memory and a processor;
the memory for storing a computer program;
the processor, when executing the computer program, implementing the artificial intelligence based answer generating method of any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which, when executed by a processor, implements the artificial intelligence based answer generating method according to any one of claims 1 to 7.
CN202011288043.6A 2020-11-17 2020-11-17 Answer generation method and device based on artificial intelligence, computer equipment and medium Withdrawn CN112417885A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202011288043.6A CN112417885A (en) 2020-11-17 2020-11-17 Answer generation method and device based on artificial intelligence, computer equipment and medium
PCT/CN2021/090555 WO2022105122A1 (en) 2020-11-17 2021-04-28 Answer generation method and apparatus based on artificial intelligence, and computer device and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011288043.6A CN112417885A (en) 2020-11-17 2020-11-17 Answer generation method and device based on artificial intelligence, computer equipment and medium

Publications (1)

Publication Number Publication Date
CN112417885A true CN112417885A (en) 2021-02-26

Family

ID=74831933

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011288043.6A Withdrawn CN112417885A (en) 2020-11-17 2020-11-17 Answer generation method and device based on artificial intelligence, computer equipment and medium

Country Status (2)

Country Link
CN (1) CN112417885A (en)
WO (1) WO2022105122A1 (en)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113157722A (en) * 2021-04-01 2021-07-23 北京达佳互联信息技术有限公司 Data processing method, device, server, system and storage medium
CN113268571A (en) * 2021-07-21 2021-08-17 北京明略软件系统有限公司 Method, device, equipment and medium for determining correct answer position in paragraph
CN113344122A (en) * 2021-06-29 2021-09-03 复旦大学 Operation flow diagnosis method and device and storage medium
CN113378572A (en) * 2021-06-22 2021-09-10 云知声智能科技股份有限公司 Named entity identification method and device, electronic equipment and storage medium
CN113392638A (en) * 2021-06-11 2021-09-14 北京世纪好未来教育科技有限公司 Text evaluation method, device, equipment and medium
CN113688611A (en) * 2021-08-30 2021-11-23 中国平安人寿保险股份有限公司 Advertisement title rewriting method, device, server and medium based on artificial intelligence
CN114363466A (en) * 2022-03-22 2022-04-15 长沙居美网络科技有限公司 Intelligent cloud calling system based on AI
WO2022105122A1 (en) * 2020-11-17 2022-05-27 平安科技(深圳)有限公司 Answer generation method and apparatus based on artificial intelligence, and computer device and medium
CN114743012A (en) * 2022-04-08 2022-07-12 北京金堤科技有限公司 Text recognition method and device
CN115424622A (en) * 2022-11-04 2022-12-02 之江实验室 Man-machine voice intelligent interaction method and device
CN116340467A (en) * 2023-05-11 2023-06-27 腾讯科技(深圳)有限公司 Text processing method, text processing device, electronic equipment and computer readable storage medium

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116776886B (en) * 2023-08-15 2023-12-05 浙江同信企业征信服务有限公司 Information extraction method, device, equipment and storage medium
CN117520523B (en) * 2023-12-29 2024-03-29 中邮消费金融有限公司 Data processing method, device, equipment and storage medium
CN117708304A (en) * 2024-02-01 2024-03-15 浙江大华技术股份有限公司 Database question-answering method, equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106997339A (en) * 2016-01-22 2017-08-01 阿里巴巴集团控股有限公司 Text feature, file classification method and device
CN108363743A (en) * 2018-01-24 2018-08-03 清华大学深圳研究生院 A kind of intelligence questions generation method, device and computer readable storage medium
CN109766423A (en) * 2018-12-29 2019-05-17 上海智臻智能网络科技股份有限公司 Answering method and device neural network based, storage medium, terminal
CN110309400A (en) * 2018-02-07 2019-10-08 鼎复数据科技(北京)有限公司 A kind of method and system that intelligent Understanding user query are intended to
CN110647629A (en) * 2019-09-20 2020-01-03 北京理工大学 Multi-document machine reading understanding method for multi-granularity answer sorting
CN111507097A (en) * 2020-04-16 2020-08-07 腾讯科技(深圳)有限公司 Title text processing method and device, electronic equipment and storage medium
CN111737499A (en) * 2020-07-27 2020-10-02 平安国际智慧城市科技股份有限公司 Data searching method based on natural language processing and related equipment

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10942919B2 (en) * 2018-06-29 2021-03-09 Entigenlogic Llc Generating further knowledge to process query
US10885045B2 (en) * 2019-03-07 2021-01-05 Wipro Limited Method and system for providing context-based response for a user query
CN110674271B (en) * 2019-08-27 2023-01-06 腾讯科技(深圳)有限公司 Question and answer processing method and device
CN111767381A (en) * 2020-06-30 2020-10-13 北京百度网讯科技有限公司 Automatic question answering method and device
CN112417885A (en) * 2020-11-17 2021-02-26 平安科技(深圳)有限公司 Answer generation method and device based on artificial intelligence, computer equipment and medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106997339A (en) * 2016-01-22 2017-08-01 阿里巴巴集团控股有限公司 Text feature, file classification method and device
CN108363743A (en) * 2018-01-24 2018-08-03 清华大学深圳研究生院 A kind of intelligence questions generation method, device and computer readable storage medium
CN110309400A (en) * 2018-02-07 2019-10-08 鼎复数据科技(北京)有限公司 A kind of method and system that intelligent Understanding user query are intended to
CN109766423A (en) * 2018-12-29 2019-05-17 上海智臻智能网络科技股份有限公司 Answering method and device neural network based, storage medium, terminal
CN110647629A (en) * 2019-09-20 2020-01-03 北京理工大学 Multi-document machine reading understanding method for multi-granularity answer sorting
CN111507097A (en) * 2020-04-16 2020-08-07 腾讯科技(深圳)有限公司 Title text processing method and device, electronic equipment and storage medium
CN111737499A (en) * 2020-07-27 2020-10-02 平安国际智慧城市科技股份有限公司 Data searching method based on natural language processing and related equipment

Cited By (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022105122A1 (en) * 2020-11-17 2022-05-27 平安科技(深圳)有限公司 Answer generation method and apparatus based on artificial intelligence, and computer device and medium
CN113157722A (en) * 2021-04-01 2021-07-23 北京达佳互联信息技术有限公司 Data processing method, device, server, system and storage medium
CN113157722B (en) * 2021-04-01 2023-12-26 北京达佳互联信息技术有限公司 Data processing method, device, server, system and storage medium
CN113392638A (en) * 2021-06-11 2021-09-14 北京世纪好未来教育科技有限公司 Text evaluation method, device, equipment and medium
CN113378572A (en) * 2021-06-22 2021-09-10 云知声智能科技股份有限公司 Named entity identification method and device, electronic equipment and storage medium
CN113378572B (en) * 2021-06-22 2023-11-10 云知声智能科技股份有限公司 Named entity recognition method and device, electronic equipment and storage medium
CN113344122A (en) * 2021-06-29 2021-09-03 复旦大学 Operation flow diagnosis method and device and storage medium
CN113268571A (en) * 2021-07-21 2021-08-17 北京明略软件系统有限公司 Method, device, equipment and medium for determining correct answer position in paragraph
CN113688611B (en) * 2021-08-30 2023-07-25 中国平安人寿保险股份有限公司 Advertisement title rewriting method, device, server and medium based on artificial intelligence
CN113688611A (en) * 2021-08-30 2021-11-23 中国平安人寿保险股份有限公司 Advertisement title rewriting method, device, server and medium based on artificial intelligence
CN114363466B (en) * 2022-03-22 2022-06-10 长沙居美网络科技有限公司 Intelligent cloud calling system based on AI
CN114363466A (en) * 2022-03-22 2022-04-15 长沙居美网络科技有限公司 Intelligent cloud calling system based on AI
CN114743012A (en) * 2022-04-08 2022-07-12 北京金堤科技有限公司 Text recognition method and device
CN114743012B (en) * 2022-04-08 2024-02-06 北京金堤科技有限公司 Text recognition method and device
CN115424622A (en) * 2022-11-04 2022-12-02 之江实验室 Man-machine voice intelligent interaction method and device
CN116340467A (en) * 2023-05-11 2023-06-27 腾讯科技(深圳)有限公司 Text processing method, text processing device, electronic equipment and computer readable storage medium
CN116340467B (en) * 2023-05-11 2023-11-17 腾讯科技(深圳)有限公司 Text processing method, text processing device, electronic equipment and computer readable storage medium

Also Published As

Publication number Publication date
WO2022105122A1 (en) 2022-05-27

Similar Documents

Publication Publication Date Title
CN112417885A (en) Answer generation method and device based on artificial intelligence, computer equipment and medium
CN110020424B (en) Contract information extraction method and device and text information extraction method
CN111737499B (en) Data searching method based on natural language processing and related equipment
Hussain et al. Using linguistic knowledge to classify non-functional requirements in SRS documents
CN112926327B (en) Entity identification method, device, equipment and storage medium
US11113470B2 (en) Preserving and processing ambiguity in natural language
CN112396049A (en) Text error correction method and device, computer equipment and storage medium
CN112699665B (en) Triple extraction method and device of safety report text and electronic equipment
CN111339751A (en) Text keyword processing method, device and equipment
CN112215008A (en) Entity recognition method and device based on semantic understanding, computer equipment and medium
CN114417865B (en) Description text processing method, device and equipment for disaster event and storage medium
CN113032528B (en) Case analysis method, case analysis device, case analysis equipment and storage medium
CN112818093A (en) Evidence document retrieval method, system and storage medium based on semantic matching
CN111814482B (en) Text key data extraction method and system and computer equipment
CN113821605A (en) Event extraction method
CN113204956B (en) Multi-model training method, abstract segmentation method, text segmentation method and text segmentation device
JP2019144706A (en) Device, method and program for learning relationship estimation model
CN111539383B (en) Formula knowledge point identification method and device
CN111783425B (en) Intention identification method based on syntactic analysis model and related device
CN111985212A (en) Text keyword recognition method and device, computer equipment and readable storage medium
CN111782892A (en) Similar character recognition method, device, apparatus and storage medium based on prefix tree
CN112989820B (en) Legal document positioning method, device, equipment and storage medium
CN113486680B (en) Text translation method, device, equipment and storage medium
CN113515705A (en) Response information generation method, device, equipment and computer readable storage medium
CN113962196A (en) Resume processing method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WW01 Invention patent application withdrawn after publication

Application publication date: 20210226

WW01 Invention patent application withdrawn after publication