CN113268572A - Question answering method and device - Google Patents

Question answering method and device Download PDF

Info

Publication number
CN113268572A
CN113268572A CN202010093503.3A CN202010093503A CN113268572A CN 113268572 A CN113268572 A CN 113268572A CN 202010093503 A CN202010093503 A CN 202010093503A CN 113268572 A CN113268572 A CN 113268572A
Authority
CN
China
Prior art keywords
question
source
pairs
similar
similarity
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010093503.3A
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.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies 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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN202010093503.3A priority Critical patent/CN113268572A/en
Priority to PCT/CN2020/140928 priority patent/WO2021159877A1/en
Publication of CN113268572A publication Critical patent/CN113268572A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/332Query formulation
    • G06F16/3329Natural language query formulation or dialogue systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/31Indexing; Data structures therefor; Storage structures
    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis

Landscapes

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

Abstract

The application is applicable to the technical field of terminal artificial intelligence and the field of natural language processing, and provides a question answering method and a device, wherein the method comprises the following steps: generating at least one group of question pairs according to the source question and at least one similar question, inputting the characteristic information of each group of question pairs into a preset similarity model to obtain the question similarity of each group of question pairs, and taking the answer corresponding to the similar question in the question pair to which the question similarity with the maximum parameter value belongs as the answer of the source question. The semantic information of the source question and the similar question is determined through the similarity model, and the similarity between the source question and the similar question is determined according to the semantic information, so that the similar question closest to the semantic information of the source question can be determined according to a plurality of similarities, the answer of the similar question closest in semantic can be used as the answer of the source question, the condition that the answer is determined only according to the semantic information of the source question is avoided, and the robustness of obtaining the answer is improved.

Description

Question answering method and device
Technical Field
The application belongs to the technical field of terminal artificial intelligence and the field of natural language processing, and particularly relates to a question and answer method and device.
Background
A Frequently Asked Question (FAQ) question-answering system is a question-answering system based on question-answer pairs, is used for automatically answering common service Questions, and has become one of the key requirements of terminal equipment.
In the related art, after a question provided by a user is obtained, the question may be input to a preset matching model between the question and an answer, semantic information of the question is matched through the matching model, the answer corresponding to the semantic information of the question is determined, and the answer corresponding to the question is output.
However, in the process of matching answers to questions, the matched answers are determined only according to semantic information of the questions, and the obtained answers are low in robustness.
Disclosure of Invention
The embodiment of the application provides a question answering method and device, which can solve the problem that the robustness of the answer obtained by matching is low.
In a first aspect, an embodiment of the present application provides a question answering method, including:
generating at least one group of question pairs according to a source question and at least one similar question, wherein the similar question is selected from a preset question library according to the source question;
inputting the feature information of each group of problem pairs into a preset similarity model to obtain the problem similarity of each group of problem pairs, wherein the similarity model is used for determining the semantic information of the similar problem and the source problem in each group of problem pairs according to the feature information and determining the problem similarity of each group of problem pairs according to the semantic information of the similar problem and the source problem in each group of problem pairs, the problem similarity is used for representing the similarity between the similar problem and the source problem in the problem pairs, and the feature information of each group of problem pairs is extracted according to each group of problem pairs;
and taking the answer of the similar question in the question pair corresponding to the question similarity with the maximum parameter value as the answer of the source question.
Optionally, the generating at least one group of question pairs according to the source question and the at least one similar question includes:
acquiring the source question input by a user;
searching at least one similar question in the question bank according to the keyword of the source question;
and combining each similar question with the source question to generate at least one group of question pairs.
Optionally, the searching for at least one similar question in the question bank according to the keyword of the source question includes:
carrying out standardization processing on the source problem to obtain a processed source problem;
determining initial similarity between each initial question in the question bank and the processed source question according to a preset index and by combining the keywords in the processed source question;
and selecting a preset number of initial problems from the initial problems as at least one similar problem according to the initial similarity.
Optionally, the inputting the feature information of each group of question pairs into a preset similarity model to obtain the question similarity of each group of question pairs includes:
for each group of problem pairs, carrying out feature extraction on the problem pairs to obtain feature information of the problem pairs;
inputting each feature information into an input layer of the similarity model, forwarding the feature information to a coding layer of the similarity model through the input layer, and learning the feature information through the coding layer to obtain semantic information of the similar problem and the source problem in the problem pair;
inputting semantic information of the similar question and the source question in the question pair into a local interaction layer of the similarity model, and comparing the characteristic information of the question pair with the semantic information through the local interaction layer to obtain difference data between the similar question and the source question in the question pair;
inputting the difference data into a polymerization layer of the similarity model, and normalizing the difference data through the polymerization layer to obtain standard difference data;
inputting the standard difference data into a prediction layer of the similarity model, and calculating the standard difference data through the prediction layer to obtain the problem similarity of the problem pair.
Optionally, the feature information includes: character feature information and word feature information;
the inputting each feature information into an input layer of the similarity model, forwarding the feature information to a coding layer of the similarity model through the input layer, and learning the feature information through the coding layer to obtain semantic information of the similar question and the source question in the question pair includes:
inputting each feature information into an input layer of the similarity model, forwarding the feature information to a coding layer of the similarity model through the input layer, and splicing character feature information and word feature information in the feature information through the coding layer to obtain semantic information of the similar problem of the problem pair and semantic information of the source problem.
Optionally, before the feature information of each group of question pairs is input into a preset similarity model to obtain the question similarity of each group of question pairs, the method further includes:
constructing a plurality of groups of sample question pairs according to the question library;
expanding a plurality of groups of the sample problem pairs to obtain a sample training set;
and training a preset initial similarity model according to the sample training set to obtain the similarity model.
Optionally, before generating at least one group of question pairs according to the source question and the at least one similar question, the method further includes:
performing subject word extraction on each initial problem in the problem library to obtain at least one subject word;
establishing an index according to at least one subject term;
and searching at least one similar question in the question bank according to the index and in combination with the source question.
Optionally, the extracting a subject term from each initial question in the question bank to obtain at least one subject term includes:
combining all the initial questions in the question bank to obtain a text to be extracted;
and extracting the subject term of the text to be extracted to obtain at least one subject term.
Optionally, the creating an index according to at least one topic word includes:
determining the weight corresponding to each subject term according to the information entropy of each subject term;
and establishing the index according to each subject term and the weight corresponding to each subject term.
In a second aspect, an embodiment of the present application provides a question answering device, including:
the generating module is used for generating at least one group of question pairs according to a source question and at least one similar question, wherein the similar question is selected from a preset question library according to the source question;
an input module, configured to input feature information of each group of the problem pairs into a preset similarity model, so as to obtain problem similarity of each group of the problem pairs, where the similarity model is configured to determine semantic information of a similar problem and a source problem in each group of the problem pairs according to the feature information, and determine problem similarity of each group of the problem pairs according to the semantic information of the similar problem and the source problem in each group of the problem pairs, where the problem similarity is used to represent similarity between the similar problem in the problem pairs and the source problem, and the feature information of each group of the problem pairs is extracted according to each group of the problem pairs;
and the determining module is used for taking the answer of the similar question in the question pair corresponding to the question similarity with the maximum parameter value as the answer of the source question.
Optionally, the generating module is specifically configured to obtain the source question input by the user; searching at least one similar question in the question bank according to the keyword of the source question; and combining each similar question with the source question to generate at least one group of question pairs.
Optionally, the generating module is further specifically configured to perform standardized processing on the source problem to obtain a processed source problem; determining initial similarity between each initial question in the question bank and the processed source question according to a preset index and by combining the keywords in the processed source question; and selecting a preset number of initial problems from the initial problems as at least one similar problem according to the initial similarity.
Optionally, the input module is specifically configured to, for each group of the problem pairs, perform feature extraction on the problem pairs to obtain feature information of the problem pairs; inputting each feature information into an input layer of the similarity model, forwarding the feature information to a coding layer of the similarity model through the input layer, and learning the feature information through the coding layer to obtain semantic information of the similar problem and the source problem in the problem pair; inputting semantic information of the similar question and the source question in the question pair into a local interaction layer of the similarity model, and comparing the characteristic information of the question pair with the semantic information through the local interaction layer to obtain difference data between the similar question and the source question in the question pair; inputting the difference data into a polymerization layer of the similarity model, and normalizing the difference data through the polymerization layer to obtain standard difference data; inputting the standard difference data into a prediction layer of the similarity model, and calculating the standard difference data through the prediction layer to obtain the problem similarity of the problem pair.
Optionally, the feature information includes: character feature information and word feature information;
the input module is further specifically configured to input each piece of feature information into an input layer of the similarity model, forward the feature information to a coding layer of the similarity model through the input layer, and splice word feature information and word feature information in the feature information through the coding layer to obtain semantic information of the similar problem of the problem pair and semantic information of the source problem.
Optionally, the apparatus further comprises:
the construction module is used for constructing a plurality of groups of sample question pairs according to the question bank;
the expansion module is used for expanding the plurality of groups of sample problem pairs to obtain a sample training set;
and the training module is used for training a preset initial similarity model according to the sample training set to obtain the similarity model.
Optionally, the apparatus further comprises:
the extraction module is used for extracting the subject term of each initial question in the question bank to obtain at least one subject term;
the establishing module is used for establishing an index according to at least one subject term;
and the searching module is used for searching at least one similar question in the question bank according to the index and in combination with the source question.
Optionally, the extracting module is specifically configured to combine the initial questions in the question bank to obtain a text to be extracted; and extracting the subject term of the text to be extracted to obtain at least one subject term.
Optionally, the establishing module is specifically configured to determine, according to the information entropy of each topic word, a weight corresponding to each topic word; and establishing the index according to each subject term and the weight corresponding to each subject term.
In a third aspect, an embodiment of the present application provides a terminal device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor, when executing the computer program, implements the question-answering method according to any one of the first aspects.
In a fourth aspect, the present application provides a computer-readable storage medium, where a computer program is stored, where the computer program is executed by a processor to implement the question answering method according to any one of the above first aspects.
In a fifth aspect, an embodiment of the present application provides a computer program product, which, when running on a terminal device, causes the terminal device to execute the question-answering method described in any one of the above first aspects.
Compared with the prior art, the embodiment of the application has the advantages that:
according to the source problem and at least one similar problem, at least one group of problem pairs is generated, the characteristic information of each group of problem pairs is input into a preset similarity model, the problem similarity of each group of problem pairs is obtained, and then the answer corresponding to the similar problem in the problem pair to which the problem similarity with the largest parameter value belongs is used as the answer of the source problem. The similarity model is used for determining semantic information of similar problems and source problems in each group of problem pairs according to the characteristic information, determining problem similarity of each group of problem pairs according to the semantic information of the similar problems and the source problems in each group of problem pairs, and the problem similarity is used for representing the similarity between the similar problems in the problem pairs and the source problems. The semantic information of the source question and the similar question is determined through the similarity model, and the similarity between the source question and the similar question is determined according to the semantic information, so that the similar question closest to the semantic information of the source question can be determined according to a plurality of similarities, the answer of the similar question closest in semantic can be used as the answer of the source question, the condition that the answer is determined only according to the semantic information of the source question is avoided, and the robustness of obtaining the answer is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
Fig. 1 is a schematic view of a question-answering scene related to a question-answering method provided in an embodiment of the present application;
fig. 2 is a block diagram of a partial structure of a mobile phone provided in an embodiment of the present application;
fig. 3 is a schematic flow chart of a question answering method provided in an embodiment of the present application;
FIG. 4 is a schematic flow chart diagram of a method for generating at least one set of problem pairs provided by an embodiment of the present application;
fig. 5 is a schematic diagram of a question and answer interface displayed by a terminal device according to an embodiment of the present application;
FIG. 6 is a schematic flow chart diagram of a method for obtaining problem similarity for each group of problem pairs according to an embodiment of the present application;
FIG. 7 is a schematic diagram of a similarity model according to an embodiment of the present disclosure;
fig. 8 is a block diagram illustrating a structure of a question answering device according to an embodiment of the present application;
fig. 9 is a block diagram of another question answering device according to an embodiment of the present application;
fig. 10 is a block diagram of a structure of another question answering device according to an embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
The terminology used in the following examples is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in the specification of this application and the appended claims, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, such as "one or more", unless the context clearly indicates otherwise. It should also be understood that in the embodiments of the present application, "one or more" means one, two, or more than two; "and/or" describes the association relationship of the associated objects, indicating that three relationships may exist; for example, a and/or B, may represent: a alone, both A and B, and B alone, where A, B may be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
The question answering method provided by the embodiment of the application can be applied to terminal devices such as mobile phones, tablet computers, wearable devices, vehicle-mounted devices, Augmented Reality (AR)/Virtual Reality (VR) devices, notebook computers, ultra-mobile personal computers (UMPCs), netbooks, Personal Digital Assistants (PDAs), and the like, and the embodiment of the application does not limit the specific types of the terminal devices at all.
For example, the terminal device may be a Station (ST) in a WLAN, which may be a cellular phone, a cordless phone, a Session Initiation Protocol (SIP) phone, a Wireless Local Loop (WLL) station, a Personal Digital Assistant (PDA) device, a handheld device with Wireless communication capability, a computing device or other processing device connected to a Wireless modem, a vehicle-mounted device, a vehicle-mounted networking terminal, a computer, a laptop, a handheld communication device, a handheld computing device, a satellite Wireless device, a Wireless modem card, a television set-top box (STB), a Customer Premises Equipment (CPE), and/or other devices for communicating over a Wireless system and a next generation communication system, such as a Mobile terminal in a 5G Network or a Public Land Mobile Network (future evolved, PLMN) mobile terminals in the network, etc.
By way of example and not limitation, when the terminal device is a wearable device, the wearable device may also be a generic term for intelligently designing daily wearing by applying wearable technology, developing wearable devices, such as glasses, gloves, watches, clothing, shoes, and the like. A wearable device is a portable device that is worn directly on the body or integrated into the clothing or accessories of the user. The wearable device is not only a hardware device, but also realizes powerful functions through software support, data interaction and cloud interaction. The generalized wearable intelligent device has the advantages that the generalized wearable intelligent device is complete in function and large in size, can realize complete or partial functions without depending on a smart phone, such as a smart watch or smart glasses, and only is concentrated on a certain application function, and needs to be matched with other devices such as the smart phone for use, such as various smart bracelets for monitoring physical signs, smart jewelry and the like.
Fig. 1 is a schematic view of a question-answering scene related to a question-answering method provided in an embodiment of the present application, and as shown in fig. 1, a terminal device 110 in the schematic view of the question-answering scene may detect an operation triggered by a user, determine a source question posed by the user according to the operation triggered by the user, and determine an answer to the source question from answers to a plurality of similar questions similar to the source question in a preset question library.
In a possible implementation manner, after obtaining a source problem proposed by a user, the terminal device 110 may search a preset problem library for similar problems similar to the source problem, and then combine each similar problem with the source problem to obtain at least one group of problem pairs, thereby performing feature extraction on each group of problem pairs to obtain feature information.
Then, the terminal device 110 may input the feature information into a pre-trained similarity model, analyze and identify the feature information of each question pair through the similarity model, determine the source question and semantic information of each similar question, obtain question similarity between the similar question in each question pair and the source question, and use the similar question in the question pair corresponding to the question similarity with the highest parameter value as the similar question closest to the source question, so as to use the answer to the similar question as the answer to the source question.
Moreover, the terminal device 110 may not only obtain the source problem according to the operation triggered by the user, but also convert the voice information according to the received voice information sent by the user to obtain the text information, and use the text information as the source problem obtained by the terminal device 110.
In addition, the feature information extracted by the terminal device 110 based on the question pair may include: character feature information, word feature information, part of speech feature information, binary matching feature information and problem-to-subject word feature information. The word feature information is used to represent feature information of a single word in a source problem and a similar problem, for example, the word feature information may represent feature information of a single word when an Out of speech (OOV) problem occurs; the word characteristic information is used for representing the characteristic information of each word in the source problem and the similar problem; the part-of-speech characteristic information is used for indicating that each word belongs to other parts-of-speech such as verbs, nouns or adjectives; the binary matching characteristic information is used for representing the matching degree among all the words; the question pair subject word feature information represents the subject word extracted based on the question pair.
It should be noted that, in practical applications, the terminal device 110 may obtain the answer to the source question in different scenarios in the above manner. For example, terminal device 110 may obtain a source question for a function of terminal device 110; the terminal device 110 may also obtain a source problem for the application program in the process of displaying the interface of the application program after the application program is run. Certainly, the terminal device 110 may also obtain the source question in other scenarios, and show the answer of the source question to the user, which is not limited in the scenario of obtaining the source question in the embodiment of the present application.
Take the terminal device as a mobile phone as an example. Fig. 2 is a block diagram of a partial structure of a mobile phone according to an embodiment of the present application. Referring to fig. 2, the handset includes: a Radio Frequency (RF) circuit 210, a memory 220, an input unit 230, a display unit 240, a sensor 250, an audio circuit 260, a wireless fidelity (WiFi) module 270, a processor 280, and a power supply 290. Those skilled in the art will appreciate that the handset configuration shown in fig. 2 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
The following describes each component of the mobile phone in detail with reference to fig. 2:
the RF circuit 210 may be used for receiving and transmitting signals during information transmission and reception or during a call, and in particular, receives downlink information of a base station and then processes the received downlink information to the processor 280; in addition, the data for designing uplink is transmitted to the base station. Typically, the RF circuitry includes, but is not limited to, an antenna, at least one Amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like. In addition, the RF circuitry 210 may also communicate with networks and other devices via wireless communications. The wireless communication may use any communication standard or protocol, including but not limited to Global System for Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE)), e-mail, Short Messaging Service (SMS), and the like.
The memory 220 may be used to store software programs and modules, and the processor 280 executes various functional applications and data processing of the mobile phone by operating the software programs and modules stored in the memory 220. The memory 220 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. Further, the memory 220 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The input unit 230 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the cellular phone. Specifically, the input unit 230 may include a touch panel 231 and other input devices 232. The touch panel 231, also referred to as a touch screen, may collect touch operations of a user (e.g., operations of the user on or near the touch panel 231 using any suitable object or accessory such as a finger, a stylus, etc.) thereon or nearby, and drive the corresponding connection device according to a preset program. Alternatively, the touch panel 231 may include two parts of a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts it to touch point coordinates, and then provides the touch point coordinates to the processor 280, and can receive and execute commands from the processor 280. In addition, the touch panel 231 may be implemented in various types, such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. The input unit 230 may include other input devices 232 in addition to the touch panel 231. In particular, other input devices 232 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
The display unit 240 may be used to display information input by the user or information provided to the user and various menus of the mobile phone. The Display unit 240 may include a Display panel 241, and optionally, the Display panel 241 may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like. Further, the touch panel 231 may cover the display panel 241, and when the touch panel 231 detects a touch operation thereon or nearby, the touch panel is transmitted to the processor 280 to determine the type of the touch event, and then the processor 280 provides a corresponding visual output on the display panel 241 according to the type of the touch event. Although in fig. 2, the touch panel 231 and the display panel 241 are two independent components to implement the input and output functions of the mobile phone, in some embodiments, the touch panel 231 and the display panel 241 may be integrated to implement the input and output functions of the mobile phone.
Audio circuitry 260, speaker 261, and microphone 262 may provide an audio interface between the user and the handset. The audio circuit 260 may transmit the electrical signal converted from the received audio data to the speaker 261, and convert the electrical signal into a sound signal by the speaker 261 and output the sound signal; on the other hand, the microphone 262 converts the collected sound signals into electrical signals, which are received by the audio circuit 260 and converted into audio data, which are processed by the audio data output processor 280, and then transmitted to, for example, another cellular phone via the RF circuit 210, or output to the memory 220 for further processing.
WiFi belongs to short-distance wireless transmission technology, and the mobile phone can help a user to receive and send e-mails, browse webpages, access streaming media and the like through the WiFi module 270, and provides wireless broadband internet access for the user. Although fig. 2 shows the WiFi module 270, it is understood that it does not belong to the essential constitution of the handset, and may be omitted entirely as needed within the scope not changing the essence of the invention.
The processor 280 is a control center of the mobile phone, connects various parts of the entire mobile phone by using various interfaces and lines, and performs various functions of the mobile phone and processes data by operating or executing software programs and/or modules stored in the memory 220 and calling data stored in the memory 220, thereby performing overall monitoring of the mobile phone. Alternatively, processor 280 may include one or more processing units; preferably, the processor 280 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into processor 280.
The handset also includes a power supply 290 (e.g., a battery) for powering the various components, which may preferably be logically coupled to the processor 280 via a power management system, such that the power management system may be used to manage charging, discharging, and power consumption.
Fig. 3 is a schematic flowchart of a question answering method provided in an embodiment of the present application, which may be applied to the terminal device described above by way of example and not limitation, and referring to fig. 3, the method includes:
step 301, performing subject term extraction on each initial question in the question bank to obtain at least one subject term.
The question bank may include a plurality of initial questions, and each initial question corresponds to a preset answer. Moreover, each initial problem may be a preset common service problem, for example, the initial problem may be set according to a function that can be implemented by the terminal device, or the initial problem may be set according to a frequency of the input problem.
The terminal equipment can establish an index according to the subject term so as to conveniently and quickly find out similar problems matched with source problems provided by a user in a question bank according to each initial problem corresponding to the index, thereby determining the similar problems with the semantics being closest to the source file in a plurality of similar problems, and further taking the answers of the similar problems as the answers of the source problems.
In the process of establishing the index, the subject terms of each initial problem in the problem library can be extracted according to a preset problem library to obtain at least one subject term, so that the index for searching for similar problems can be generated according to each subject term in the subsequent step.
Optionally, the terminal device may combine each initial problem in the problem library to obtain a text to be extracted, and then extract a subject term from the text to be extracted to obtain at least one subject term.
In a possible implementation manner, the terminal device may first obtain each initial question from a preset question library, determine a question group to which each initial question belongs, and then combine the initial questions corresponding to each question group for different question groups to obtain a text to be extracted, which is composed of the initial questions of different question groups. And then, the terminal equipment can determine whether each word is the subject word according to the information entropy of each word in the text to be extracted through a preset subject word extraction mode, so that the extraction of the subject words is realized, and at least one subject word is obtained.
The information entropy is used for representing the information quantity of the word. For example, if the higher the uncertainty of a word, the larger the amount of information needed to determine the word, the larger the entropy of the word.
For example, the terminal device may obtain initial questions for different question groups from a preset FAQ, for each question group, the terminal device may combine the initial questions of the question group to obtain a text to be extracted, and extract at least one topic word from each Term of the text to be extracted by using a Term Frequency-Inverse text Frequency index (TF-IDF) topic extraction algorithm according to the entropy of information of each Term in the text to be extracted.
Step 302, establishing an index according to at least one subject term.
Wherein the index is used to find similar questions from the source question.
The terminal equipment can construct an index for searching similar problems according to the extracted at least one subject term. In the process of constructing the index, the weight corresponding to the information entropy can be distributed to each subject term according to the information entropy of each subject term. For example, if the entropy of information of a certain subject word is high, indicating that the amount of information represented by the subject word is also large, the weight corresponding to the subject word is also high.
Correspondingly, in the process of establishing the index, the terminal device can determine the weight corresponding to each subject term according to the information entropy of each subject term, and then establish the index according to each subject term and the weight corresponding to each subject term.
The index established according to the subject term is generated on the basis of the initial index, and the initial index is generated by combining the keywords of each initial question. For example, different weights may be assigned to each keyword in the initial index according to the frequency of occurrence of each keyword.
In a possible implementation manner, after obtaining the subject term and the weight of the subject term, the terminal device may add the subject term to the initial index on the basis of the initial index, and adjust the weight of each keyword in the initial index according to the weight of each subject term to increase the weight occupied by the subject term and decrease the weight occupied by the keyword, thereby generating the index after adding the subject term.
For example, after the terminal device obtains at least one subject term, for each subject term, the subject term may be compared with each keyword in the initial index to determine whether the subject term is consistent with each keyword, if so, the weight of the keyword may be increased, and if not, the subject term may be added to the initial index, and then the weight of the subject term is increased.
It should be noted that, after the index is created, the terminal device may indicate the matching degree between the subject term and each initial question through the association degree, and if the association degree is higher, the subject term is more matched with the initial question. And the degree of association can be determined according to the weight of the subject term in the initial question. For example, at least one subject word may be included in the initial question, different weights may be assigned to different subject words according to the information entropy of each subject word, and thus the assigned weight may be used as the degree of association between the initial question and the subject word.
Step 303, training a preset initial similarity model according to the initial questions in the question bank to obtain a similarity model.
The terminal device may search for a similar question similar to the source question according to the index, and may further determine a similar question closest to the source question from the plurality of similar questions, so that in a subsequent step, an answer to the similar question having the closest semantics may be used as an answer to the source question.
The terminal equipment can construct sample data according to a plurality of initial problems in the problem base, and train the pre-established initial similarity model according to the constructed sample data until the trained similarity model meets the preset accuracy, so that the similarity model for determining the problem similarity between the source problem and each similar problem is obtained.
Optionally, the terminal device may construct a plurality of groups of sample problem pairs according to the problem library, expand the plurality of groups of sample problem pairs to obtain a sample training set, and train a preset initial similarity model according to the sample training set to obtain a similarity model.
In a possible implementation manner, the terminal device may determine a problem group to which each initial problem belongs in the problem library, and form a plurality of sets of sample problem pairs from a plurality of initial problems of the same problem group or form a plurality of sets of sample problem pairs from a plurality of initial problems of different problem groups according to the initial problem corresponding to each problem group, thereby obtaining a plurality of positive sample problem pairs and a plurality of negative sample problem pairs.
Wherein positive example problem pairs consist of initial problems of the same problem group, and negative example problem pairs consist of initial problems in different problem groups.
Further, the terminal device can also expand the sample problem pairs to obtain a sample training set consisting of a large number of sample problem pairs, so as to improve the number of the sample problem pairs and improve the accuracy of the similarity model obtained by training.
For example, after obtaining the sample training set, the terminal device may input a large number of positive sample problem pairs and negative sample problem pairs in the sample training set into a pre-established initial similarity model, modify model parameters of the initial similarity model according to the problem similarity output by the initial similarity model, input other positive sample problem pairs and negative sample problem pairs in the sample training set into the modified initial similarity model again, and then modify the model parameters of the modified similarity model according to the output problem similarity until the problem similarity output by the modified similarity model satisfies a preset similarity threshold, or the number of times of training reaches a preset training threshold, thereby obtaining the similarity model.
It should be noted that, in the embodiment of the present application, the description is only given by taking the steps 301 and 302 and then the step 303 as examples, but in practical applications, the step 303 may be performed first and then the steps 301 and 302 may be performed, the steps 301 and 303 may also be performed simultaneously, and the step 302 may be performed after the step 301 is performed, and the execution sequence of the steps 301, 302, and 303 is not limited in the embodiment of the present application.
In addition, in practical applications, the terminal device may have trained the similarity model and generated the index, and then step 301 to step 303 may not be executed any more, but after acquiring the source question posed by the user, step 304 is executed to determine and present an answer corresponding to the source question to the user.
Step 304, generating at least one set of question pairs according to the source question and the at least one similar question.
Wherein the similar questions are selected from a preset question bank according to the source questions.
Corresponding to step 302 and step 303, after generating an index and training to obtain a similarity model, if a source problem input by a user is detected, the terminal device may search at least one similar problem in the problem library according to the index and in combination with the source problem, that is, the terminal device may search a similar problem similar to the semantics of the source problem in the problem library according to the index, so as to generate at least one group of problem pairs according to the source problem and the similar problem, so that in a subsequent step, the similar problem with the semantics being closest to the source problem may be determined.
In a possible implementation manner, the terminal device may detect an operation triggered by a user, obtain a source problem input by the user according to the operation triggered by the user, search, by combining with the generated index, similar problems similar to the source problem from a preset problem library for keywords of each source problem, and combine each similar problem with the source problem to obtain at least one group of problem pairs.
Optionally, referring to fig. 4, step 304 may include steps 3041 to 3043:
step 3041, obtain the source question input by the user.
The terminal device can show a question-answer interface for question-answering to the user according to the operation triggered by the user, and in the question-answer interface, the source question input by the user is obtained according to the operation triggered by the user again, so that similar questions can be searched according to the source question in the subsequent steps.
In a possible implementation manner, the terminal device may detect a manual input operation triggered by a user in a displayed question-answering interface, and if the manual input operation triggered by the user is detected, text information input by the user may be acquired according to the manual input operation, so that the acquired text information may be used as a source question input by the user.
Or the terminal device may detect the voice information input by the user, and if it is detected that the voice information includes the wakeup word, may convert other voice segments in the voice information into text information, so that the text information obtained by conversion may also be used as a source problem input by the user.
For example, referring to fig. 5, fig. 5 shows a question-answering interface displayed by a terminal device, if a user utters a voice "hi, wormwood, and the air cushion BB is not wet spam", the terminal device detects the voice, determines that the voice segment includes a wakeup word "wormwood", and may convert the other voice segment "whether the air cushion BB is wet spam" into text information, and use the text information as a source question input by the user.
Step 3042, at least one similar question is found in the question bank according to the keywords of the source question.
After obtaining the source problem input by the user, the terminal device may extract the keyword in the source problem, and according to the extracted keyword, find out similar problems in the problem base by combining the generated index, so that in subsequent steps, a problem pair may be generated according to each similar problem.
In a possible implementation manner, the terminal device may extract keywords from the source question according to the obtained source question to obtain at least one keyword of the source question, match each keyword with the index, and determine an initial question in the question bank that matches each keyword, so that at least one similar question may be selected from a plurality of initial questions.
Further, in the process of searching for similar problems, the terminal device may perform standardization processing on the source problem to obtain a processed source problem, determine an initial similarity between each initial problem in the problem library and the processed source problem according to a preset index and in combination with a keyword in the processed source problem, and select a preset number of initial problems from the plurality of initial problems as at least one similar problem according to the plurality of initial similarities.
In the process of carrying out standardization processing, the terminal equipment can firstly execute preprocessing modes such as synonym replacement and tone word deletion on the source problem, replace the words in the source problem with words consistent with the words in the index, and recognize and delete the tone words in the source problem to obtain the preprocessed source problem.
The terminal device may extract keywords from the processed source problem in the process of determining the initial similarity to obtain at least one keyword of the processed source problem, match each extracted keyword with each topic word in the index, and determine at least one topic word respectively matched with each keyword, so as to determine at least one initial problem corresponding to at least one topic word, and may use the association degree between each initial problem and the topic word as the initial similarity between the initial problem and the source problem.
Finally, the terminal device may sort the initial similarities according to the sizes of the parameter values of the initial similarities from large to small, and determine at least one initial similarity with the largest parameter value, so that the initial problem corresponding to the preset number of initial similarities with the largest parameter value is used as the similarity problem of the source problem.
For example, corresponding to the example of step 3042, if the source question of the user input is "air cushion BB is not wet garbage", extracting the keywords may include: "air cushion BB" and "trash", then similar problems resulting from matching may include: "air cushion BB belongs to dry garbage", "air cushion BB belongs to recyclable garbage", "air cushion is not wet garbage", "air cushion is not dry garbage" and "air cushion is wet garbage".
Step 3043, combine each similar question with the source question to generate at least one set of question pairs.
After the terminal device selects and obtains the similar problems, each similar problem can be combined with the source problem to obtain at least one group of problem pairs, so that in the subsequent step, the problem similarity between the source problem and each similar problem can be obtained by comparing the characteristic information of the similar problems and the source problem in each group of problem pairs.
For example, corresponding to step 3042, the user may ask the source question "whether air cushion BB is wet trash", and the source question may be combined with each similar question to obtain a question pair consisting of one source question and one similar question, such as a question pair consisting of "whether air cushion BB is wet trash" and "how air cushion BB belongs to dry trash".
And 305, inputting the characteristic information of each group of problem pairs into a preset similarity model to obtain the problem similarity of each group of problem pairs.
The similarity model can be used for determining semantic information of similar problems and source problems in each group of problem pairs according to the characteristic information, and determining the problem similarity of each group of problem pairs according to the semantic information of the similar problems and the source problems in each group of problem pairs. The question similarity may be used to represent the similarity between similar questions in the question pair and the source question.
In addition, the feature information of each group of problem pairs is extracted according to each group of problem pairs. For example, the terminal device may perform feature extraction on the source question and the similar question respectively to obtain feature information including at least one of word feature information, part-of-speech feature information, binary matching feature information, question-to-subject word feature information, and the like.
In a possible implementation manner, the terminal device may first perform feature extraction on each group of problem pairs to obtain feature information of each group of problem pairs, then input each feature information into the established similarity model, compare and analyze the feature information through each network layer of the similarity model to determine the source problem and semantic information of each similar problem, and output the semantic information to obtain the problem similarity, that is, the similarity between the source problem and each similar problem, so that in the subsequent step, the similar problem with the semantic information closest to the source problem can be determined according to each similarity.
It should be noted that, in practical application, since the feature information of the source problem is fixed, the terminal device may extract the word feature information, the part-of-speech feature information, and the binary matching feature information of the source problem in the process of extracting the feature information; then extracting the feature information of each similar problem to obtain character feature information, word feature information, part of speech feature information and binary matching feature information; finally, problem-to-subject term feature information can be extracted based on the source problem and the similar problem.
Of course, feature information of the problem pair may also be extracted by other methods, which is not limited in the embodiment of the present application.
Alternatively, since the similarity model may include a plurality of network layers, each of which performs a different operation, referring to fig. 6, step 305 may include a plurality of steps including step 3051 to step 3055:
step 3051, for each group of problem pairs, performing feature extraction on the problem pairs to obtain feature information of the problem pairs.
The terminal equipment can extract the characteristics of each group of problem pairs, for each group of problem pairs, the terminal equipment can extract the characteristics of the source problem and the similar problem respectively to obtain the character characteristic information, the word characteristic information, the part of speech characteristic information and the binary matching characteristic information of the source problem and the similar problem, and then can extract the problem pair subject term characteristic information of the obtained problem pairs based on the source problem and the similar problem, so that the characteristic information of the problem pairs obtained by combining various kinds of characteristic information is obtained.
Step 3052, inputting each feature information into an input layer of the similarity model, forwarding the feature information to a coding layer of the similarity model through the input layer, and learning the feature information through the coding layer to obtain semantic information of the similar problem and the source problem in the problem pair.
After extracting the feature information of each group of problem pairs, the terminal device can input the feature information into the similarity model, and learn the input feature information through the input layer and the coding layer of the similarity model to obtain the semantic information of the source problem and the similar problem.
In addition, in the process of learning semantic information, the coding layer of the similarity model can splice word feature information and word feature information in the feature information to obtain semantic information of similar problems of problem pairs and semantic information of source problems, so that problem similarity between the source problems and the similar problems can be determined according to the semantic information in subsequent steps.
In a possible implementation manner, the terminal device may input feature information of each group of problem pairs to the similarity model, the input layer of the similarity model may receive the feature information and forward the feature information to the coding layer, the coding layer may obtain word feature information and word feature information of a source problem and a similar problem in the feature information, and the coding layer may perform concatenation according to each word feature information and in combination with the word feature information to obtain statement feature information of the source problem and the similar problem, and then learn the statement feature information to obtain semantic information of the source problem and the similar problem.
For example, the coding layer may include a Convolutional Neural Network (CNN) and a bidirectional Long Short-Term Memory model (Bi-directional Long Short-Term Memory, Bilstm), and after obtaining the word feature information and the word feature information, the coding layer may first input the word feature information into the CNN, further perform feature extraction on the word feature information through the CNN, input the word feature information and the extracted word feature information into the Bilstm, and perform splicing learning on the word feature information and the extracted word feature information through the Bilstm to obtain semantic information of the source problem and the similar problem, respectively.
In addition, referring to fig. 7, fig. 7 is an architecture diagram of a similarity model, as shown in the figure, the similarity model may include: an input layer, an encoding layer, a local encoding layer, an aggregation layer, and a prediction layer. The input Layer is used for receiving and forwarding feature information, the coding Layer can be composed of CNN and BilSTM and used for splicing word feature information and learning to obtain semantic information, the local coding Layer is composed of an attention Layer (AttentionLayer) and Layer Normalization (Layer Normalization) and used for comparing word feature information of a source problem and a similar problem, the aggregation Layer is composed of a maximum pooling Layer and a minimum pooling Layer and used for extracting invariant features and avoiding overfitting of a similarity model, and the prediction Layer is composed of a Normalization exponential function (SoftMax function) and used for calculating problem similarity between the source problem and the similar problem.
Step 3053, inputting semantic information of the similar problem and the source problem in the problem pair into a local interaction layer of the similarity model, and comparing the characteristic information and the semantic information of the problem pair through the local interaction layer to obtain difference data between the similar problem and the source problem in the problem pair.
After obtaining the semantic information of the problem pair, the terminal device may input the semantic information into a local interaction layer of the similarity model, determine subject words in the source problem and the similar problem through the local interaction layer by using an attention mechanism, perform local feature comparison between each subject word of the source problem and each subject word in the similar problem, and determine the difference between each subject word, thereby obtaining difference data between each subject word representing the similar problem and each subject word of the source problem.
Step 3054, inputting the difference data into a polymerization layer of the similarity model, and normalizing the difference data through the polymerization layer to obtain standard difference data.
After the terminal device obtains the difference data, the difference data can be further processed, so that in the subsequent step, the problem similarity of the problem pair can be calculated according to the processed difference data, thereby reducing the calculation amount and the time spent on calculating the problem similarity.
In a possible implementation manner, the terminal device may input the difference data into an aggregation layer of the similarity model, and perform feature extraction on the difference data through the aggregation layer in a minimum pooling manner and a maximum pooling manner to obtain an invariant feature of the difference data, that is, standard difference data.
Step 3055, inputting the standard difference data into a prediction layer of the similarity model, and calculating the standard difference data through the prediction layer to obtain the problem similarity of the problem pair.
After the terminal equipment obtains the standard difference data, the standard difference data can be input into a prediction layer of the similarity model, and the similarity between the similar problem in each problem pair and the source problem, namely the problem similarity of each problem pair, is obtained by calculating according to the standard difference data through the prediction layer.
And step 306, taking the answer of the similar question in the question pair corresponding to the question similarity with the maximum parameter value as the answer of the source question.
After obtaining the question similarity of each group of question pairs, the terminal device may determine the similar question having the closest semantic meaning to the source question according to the question similarity of the plurality of groups of question pairs, that is, the similar question in the question pair having the highest parameter value and to which the question similarity belongs is used as the similar question having the closest semantic meaning to the source question, so that the answer to the similar question may be used as the answer to the source question.
In a possible implementation manner, for each problem similarity, the terminal device may obtain a parameter value of the problem similarity, compare the parameter value of the problem similarity with parameter values of other problem similarities, and determine whether the parameter value of the problem similarity is greater than the parameter values of the other problem similarities.
After the similarity of each question is compared with the similarity of each other question, the magnitude relation among the similarity of each question can be determined, so that the similarity of each question can be sequenced from large to small according to the magnitude relation among the similarity of each question, the similarity of the question with the largest parameter value is determined, the similar question in the question pair corresponding to the similarity of the question can be used as the similar question closest to the source question, and the answer corresponding to the determined similar question is used as the answer of the source question.
It should be noted that, in practical application, after determining the answer to the source question, the terminal device may display the answer to the user, and in the process of displaying the answer to the user, the terminal device may display the answer in a text display manner through the display unit, or may play the answer in a voice through the speaker, and the method of displaying the answer is not limited in the embodiment of the present application.
In summary, the question answering method provided in the embodiment of the present application generates at least one group of question pairs according to a source question and at least one similar question, inputs feature information of each group of question pairs into a preset similarity model to obtain question similarity of each group of question pairs, and uses an answer corresponding to a similar question in a question pair to which the question similarity with the largest parameter value belongs as an answer of the source question. The similarity model is used for determining semantic information of similar problems and source problems in each group of problem pairs according to the characteristic information, determining problem similarity of each group of problem pairs according to the semantic information of the similar problems and the source problems in each group of problem pairs, and the problem similarity is used for representing the similarity between the similar problems in the problem pairs and the source problems. The semantic information of the source question and the similar question is determined through the similarity model, and the similarity between the source question and the similar question is determined according to the semantic information, so that the similar question closest to the semantic information of the source question can be determined according to a plurality of similarities, the answer of the similar question closest in semantic can be used as the answer of the source question, the condition that the answer is determined only according to the semantic information of the source question is avoided, and the robustness of obtaining the answer is improved.
In addition, because the semantic space between the source question and the answer is inconsistent, and the semantic space between the source question and the similar question is consistent, the method and the device for determining the source question and the similar question in the same semantic space improve the accuracy of determining the similar question, and therefore improve the accuracy of obtaining the answer of the source question.
In addition, because the answer corresponding to the question may be updated continuously, and the answer may not be obtained by searching for the answer through the source question, the embodiment of the present application determines the similar question close to the source question by comparing the source question with the similar question, thereby taking the answer of the similar question as the answer of the source question, avoiding searching for the answer which may be updated through the source question, and improving the accuracy of obtaining the answer.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
Corresponding to the question answering method described in the foregoing embodiment, fig. 8 is a block diagram of a question answering device provided in the embodiment of the present application, and only the relevant parts of the embodiment of the present application are shown for convenience of description.
Referring to fig. 8, the apparatus includes:
a generating module 801, configured to generate at least one group of question pairs according to a source question and at least one similar question, where the similar question is selected from a preset question library according to the source question;
an input module 802, configured to input feature information of each group of the problem pairs into a preset similarity model, to obtain problem similarity of each group of the problem pairs, where the similarity model is configured to determine semantic information of a similar problem and a source problem in each group of the problem pairs according to the feature information, and determine problem similarity of each group of the problem pairs according to the semantic information of the similar problem and the source problem in each group of the problem pairs, where the problem similarity is used to represent similarity between the similar problem and the source problem in the problem pairs, and the feature information of each group of the problem pairs is extracted according to each group of the problem pairs;
the determining module 803 is configured to use the answer to the similar question in the question pair corresponding to the question similarity with the largest parameter value as the answer to the source question.
Optionally, the generating module 801 is specifically configured to obtain the source question input by the user; searching at least one similar question in the question bank according to the keyword of the source question; combining each of the similar questions with the source question to generate at least one set of the question pairs.
Optionally, the generating module 801 is further specifically configured to perform standardization processing on the source problem to obtain a processed source problem; determining the initial similarity between each initial question in the question bank and the processed source question according to a preset index and by combining the keywords in the processed source question; selecting a preset number of initial problems from the initial problems as at least one similar problem according to the initial similarity.
Optionally, the input module 802 is specifically configured to, for each group of the problem pairs, perform feature extraction on the problem pairs to obtain feature information of the problem pairs; inputting each piece of feature information into an input layer of the similarity model, forwarding the feature information to a coding layer of the similarity model through the input layer, and learning the feature information through the coding layer to obtain semantic information of the similar problem and the source problem in the problem pair; inputting semantic information of the similar problem and the source problem in the problem pair into a local interaction layer of the similarity model, and comparing the characteristic information of the problem pair with the semantic information through the local interaction layer to obtain difference data between the similar problem and the source problem in the problem pair; inputting the difference data into a convergence layer of the similarity model, and normalizing the difference data through the convergence layer to obtain standard difference data; and inputting the standard difference data into a prediction layer of the similarity model, and calculating the standard difference data through the prediction layer to obtain the problem similarity of the problem pair.
Optionally, the feature information includes: character feature information and word feature information;
the input module 802 is further specifically configured to input each piece of feature information into an input layer of the similarity model, forward the feature information to a coding layer of the similarity model through the input layer, and splice word feature information and word feature information in the feature information through the coding layer to obtain semantic information of the similar problem of the problem pair and semantic information of the source problem.
Optionally, referring to fig. 9, the apparatus further includes:
a construction module 804, configured to construct a plurality of sets of sample question pairs according to the question bank;
an expansion module 805, configured to expand multiple sets of the sample problem pairs to obtain a sample training set;
the training module 806 is configured to train a preset initial similarity model according to the sample training set to obtain the similarity model.
Optionally, referring to fig. 10, the apparatus further includes:
an extracting module 807, configured to perform topic word extraction on each initial question in the question bank to obtain at least one topic word;
an establishing module 808, configured to establish an index according to at least one of the topic terms, where the index is used to search the similar problem according to the source problem;
the searching module 809 is configured to search the question bank for at least one similar question in combination with the source question according to the index.
Optionally, the extracting module 807 is specifically configured to combine the initial questions in the question bank to obtain a text to be extracted; and extracting the subject term of the text to be extracted to obtain at least one subject term.
Optionally, the establishing module 808 is specifically configured to determine, according to the information entropy of each topic word, a weight corresponding to each topic word; and establishing the index according to each subject term and the weight corresponding to each subject term.
To sum up, the question answering device provided in the embodiment of the present application generates at least one group of question pairs according to a source question and at least one similar question, inputs feature information of each group of question pairs into a preset similarity model to obtain question similarity of each group of question pairs, and then takes an answer corresponding to a similar question in a question pair to which the question similarity with the largest parameter value belongs as an answer of the source question. The similarity model is used for determining semantic information of similar problems and source problems in each group of problem pairs according to the characteristic information, determining problem similarity of each group of problem pairs according to the semantic information of the similar problems and the source problems in each group of problem pairs, and the problem similarity is used for representing the similarity between the similar problems in the problem pairs and the source problems. The semantic information of the source question and the similar question is determined through the similarity model, and the similarity between the source question and the similar question is determined according to the semantic information, so that the similar question closest to the semantic information of the source question can be determined according to a plurality of similarities, the answer of the similar question closest in semantic can be used as the answer of the source question, the condition that the answer is determined only according to the semantic information of the source question is avoided, and the robustness of obtaining the answer is improved.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described system embodiments are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, all or part of the processes in the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium and can implement the steps of the embodiments of the methods described above when the computer program is executed by a processor. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer readable medium may include at least: any entity or device capable of carrying computer program code to a question answering apparatus, a recording medium, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), an electrical carrier signal, a telecommunications signal, and a software distribution medium. Such as a usb-disk, a removable hard disk, a magnetic or optical disk, etc. In certain jurisdictions, computer-readable media may not be an electrical carrier signal or a telecommunications signal in accordance with legislative and patent practice.
An embodiment of the present application provides a terminal device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the method according to any one of fig. 3, fig. 4, and fig. 6 when executing the computer program.
The present application provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the computer program implements the method according to any one of fig. 3, fig. 4, and fig. 6.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

Claims (12)

1. A question-answering method, comprising:
generating at least one group of question pairs according to a source question and at least one similar question, wherein the similar question is selected from a preset question library according to the source question;
inputting the feature information of each group of problem pairs into a preset similarity model to obtain the problem similarity of each group of problem pairs, wherein the similarity model is used for determining the semantic information of the similar problem and the source problem in each group of problem pairs according to the feature information and determining the problem similarity of each group of problem pairs according to the semantic information of the similar problem and the source problem in each group of problem pairs, the problem similarity is used for representing the similarity between the similar problem and the source problem in the problem pairs, and the feature information of each group of problem pairs is extracted according to each group of problem pairs;
and taking the answer of the similar question in the question pair corresponding to the question similarity with the maximum parameter value as the answer of the source question.
2. The method of claim 1, wherein generating at least one set of question pairs based on the source question and at least one similar question comprises:
acquiring the source question input by a user;
searching at least one similar question in the question bank according to the keyword of the source question;
and combining each similar question with the source question to generate at least one group of question pairs.
3. The method of claim 2, wherein said finding at least one of said similar questions in said question bank based on said keyword of said source question comprises:
carrying out standardization processing on the source problem to obtain a processed source problem;
determining initial similarity between each initial question in the question bank and the processed source question according to a preset index and by combining the keywords in the processed source question;
and selecting a preset number of initial problems from the initial problems as at least one similar problem according to the initial similarity.
4. The method of claim 1, wherein the inputting the feature information of each group of question pairs into a preset similarity model to obtain question similarity of each group of question pairs comprises:
for each group of problem pairs, carrying out feature extraction on the problem pairs to obtain feature information of the problem pairs;
inputting each feature information into an input layer of the similarity model, forwarding the feature information to a coding layer of the similarity model through the input layer, and learning the feature information through the coding layer to obtain semantic information of the similar problem and the source problem in the problem pair;
inputting semantic information of the similar question and the source question in the question pair into a local interaction layer of the similarity model, and comparing the characteristic information of the question pair with the semantic information through the local interaction layer to obtain difference data between the similar question and the source question in the question pair;
inputting the difference data into a polymerization layer of the similarity model, and normalizing the difference data through the polymerization layer to obtain standard difference data;
inputting the standard difference data into a prediction layer of the similarity model, and calculating the standard difference data through the prediction layer to obtain the problem similarity of the problem pair.
5. The method of claim 4, wherein the feature information comprises: character feature information and word feature information;
the inputting each feature information into an input layer of the similarity model, forwarding the feature information to a coding layer of the similarity model through the input layer, and learning the feature information through the coding layer to obtain semantic information of the similar question and the source question in the question pair includes:
inputting each feature information into an input layer of the similarity model, forwarding the feature information to a coding layer of the similarity model through the input layer, and splicing character feature information and word feature information in the feature information through the coding layer to obtain semantic information of the similar problem of the problem pair and semantic information of the source problem.
6. The method of claim 1, wherein before the inputting the feature information of each group of question pairs into a preset similarity model to obtain question similarity of each group of question pairs, the method further comprises:
constructing a plurality of groups of sample question pairs according to the question library;
expanding a plurality of groups of the sample problem pairs to obtain a sample training set;
and training a preset initial similarity model according to the sample training set to obtain the similarity model.
7. The method of claim 1, wherein prior to said generating at least one set of question pairs based on a source question and at least one similar question, the method further comprises:
performing subject word extraction on each initial problem in the problem library to obtain at least one subject word;
establishing an index according to at least one subject term;
and searching at least one similar question in the question bank according to the index and in combination with the source question.
8. The method of claim 7, wherein said performing subject term extraction on each initial question in said question bank to obtain at least one subject term comprises:
combining all the initial questions in the question bank to obtain a text to be extracted;
and extracting the subject term of the text to be extracted to obtain at least one subject term.
9. The method of claim 7, wherein said creating an index based on at least one of said subject words comprises:
determining the weight corresponding to each subject term according to the information entropy of each subject term;
and establishing the index according to each subject term and the weight corresponding to each subject term.
10. A question answering device, comprising:
the generating module is used for generating at least one group of question pairs according to a source question and at least one similar question, wherein the similar question is selected from a preset question library according to the source question;
an input module, configured to input feature information of each group of the problem pairs into a preset similarity model, so as to obtain problem similarity of each group of the problem pairs, where the similarity model is configured to determine semantic information of a similar problem and a source problem in each group of the problem pairs according to the feature information, and determine problem similarity of each group of the problem pairs according to the semantic information of the similar problem and the source problem in each group of the problem pairs, where the problem similarity is used to represent similarity between the similar problem in the problem pairs and the source problem, and the feature information of each group of the problem pairs is extracted according to each group of the problem pairs;
and the determining module is used for taking the answer of the similar question in the question pair corresponding to the question similarity with the maximum parameter value as the answer of the source question.
11. A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the method according to any of claims 1 to 9 when executing the computer program.
12. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1 to 9.
CN202010093503.3A 2020-02-14 2020-02-14 Question answering method and device Pending CN113268572A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202010093503.3A CN113268572A (en) 2020-02-14 2020-02-14 Question answering method and device
PCT/CN2020/140928 WO2021159877A1 (en) 2020-02-14 2020-12-29 Question answering method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010093503.3A CN113268572A (en) 2020-02-14 2020-02-14 Question answering method and device

Publications (1)

Publication Number Publication Date
CN113268572A true CN113268572A (en) 2021-08-17

Family

ID=77227331

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010093503.3A Pending CN113268572A (en) 2020-02-14 2020-02-14 Question answering method and device

Country Status (2)

Country Link
CN (1) CN113268572A (en)
WO (1) WO2021159877A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114218351A (en) * 2021-11-26 2022-03-22 北京工业大学 Text retrieval method and device

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111309878B (en) * 2020-01-19 2023-08-22 支付宝(杭州)信息技术有限公司 Search type question-answering method, model training method, server and storage medium
CN113268572A (en) * 2020-02-14 2021-08-17 华为技术有限公司 Question answering method and device
CN113821622B (en) * 2021-09-29 2023-09-15 平安银行股份有限公司 Answer retrieval method and device based on artificial intelligence, electronic equipment and medium
CN114491034B (en) * 2022-01-24 2024-05-28 聚好看科技股份有限公司 Text classification method and intelligent device
CN117113092B (en) * 2023-10-24 2024-01-23 北京睿企信息科技有限公司 Question expansion method based on question-answering task model and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107704506A (en) * 2017-08-30 2018-02-16 华为技术有限公司 The method and apparatus of intelligent response
CN108345672A (en) * 2018-02-09 2018-07-31 平安科技(深圳)有限公司 Intelligent response method, electronic device and storage medium
CN108595619A (en) * 2018-04-23 2018-09-28 海信集团有限公司 A kind of answering method and equipment
CN109145099A (en) * 2018-08-17 2019-01-04 百度在线网络技术(北京)有限公司 Answering method and device based on artificial intelligence
CN110597966A (en) * 2018-05-23 2019-12-20 北京国双科技有限公司 Automatic question answering method and device
WO2021159877A1 (en) * 2020-02-14 2021-08-19 华为技术有限公司 Question answering method and apparatus

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103425640A (en) * 2012-05-14 2013-12-04 华为技术有限公司 Multimedia questioning-answering system and method
CN107145573A (en) * 2017-05-05 2017-09-08 上海携程国际旅行社有限公司 The problem of artificial intelligence customer service robot, answers method and system
CN108345585A (en) * 2018-01-11 2018-07-31 浙江大学 A kind of automatic question-answering method based on deep learning
CN110399473B (en) * 2019-06-28 2023-08-29 创新先进技术有限公司 Method and device for determining answers to user questions

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107704506A (en) * 2017-08-30 2018-02-16 华为技术有限公司 The method and apparatus of intelligent response
CN108345672A (en) * 2018-02-09 2018-07-31 平安科技(深圳)有限公司 Intelligent response method, electronic device and storage medium
CN108595619A (en) * 2018-04-23 2018-09-28 海信集团有限公司 A kind of answering method and equipment
CN110597966A (en) * 2018-05-23 2019-12-20 北京国双科技有限公司 Automatic question answering method and device
CN109145099A (en) * 2018-08-17 2019-01-04 百度在线网络技术(北京)有限公司 Answering method and device based on artificial intelligence
WO2021159877A1 (en) * 2020-02-14 2021-08-19 华为技术有限公司 Question answering method and apparatus

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114218351A (en) * 2021-11-26 2022-03-22 北京工业大学 Text retrieval method and device

Also Published As

Publication number Publication date
WO2021159877A1 (en) 2021-08-19

Similar Documents

Publication Publication Date Title
CN107943860B (en) Model training method, text intention recognition method and text intention recognition device
CN113268572A (en) Question answering method and device
CN110096580B (en) FAQ conversation method and device and electronic equipment
CN113378556B (en) Method and device for extracting text keywords
CN110570840B (en) Intelligent device awakening method and device based on artificial intelligence
CN112820299B (en) Voiceprint recognition model training method and device and related equipment
CN104217717A (en) Language model constructing method and device
CN111046227A (en) Video duplicate checking method and device
CN110825863B (en) Text pair fusion method and device
CN111177371A (en) Classification method and related device
CN111597804B (en) Method and related device for training entity recognition model
CN112214605A (en) Text classification method and related device
CN112749252A (en) Text matching method based on artificial intelligence and related device
WO2021139486A1 (en) Text incrementation method and apparatus, and terminal device
CN113761122A (en) Event extraction method, related device, equipment and storage medium
CN110597957B (en) Text information retrieval method and related device
CN112307198B (en) Method and related device for determining abstract of single text
CN110866114B (en) Object behavior identification method and device and terminal equipment
CN111062200B (en) Speaking generalization method, speaking recognition device and electronic equipment
CN110390102B (en) Emotion analysis method and related device
CN112328783A (en) Abstract determining method and related device
CN110781274A (en) Question-answer pair generation method and device
CN113569043A (en) Text category determination method and related device
CN111723783A (en) Content identification method and related device
CN113535926B (en) Active dialogue method and device and voice terminal

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