WO2019242297A1 - 基于机器阅读理解的智能对话方法、装置、终端 - Google Patents

基于机器阅读理解的智能对话方法、装置、终端 Download PDF

Info

Publication number
WO2019242297A1
WO2019242297A1 PCT/CN2019/070350 CN2019070350W WO2019242297A1 WO 2019242297 A1 WO2019242297 A1 WO 2019242297A1 CN 2019070350 W CN2019070350 W CN 2019070350W WO 2019242297 A1 WO2019242297 A1 WO 2019242297A1
Authority
WO
WIPO (PCT)
Prior art keywords
text
vector
question
word
answer
Prior art date
Application number
PCT/CN2019/070350
Other languages
English (en)
French (fr)
Inventor
何麒
Original Assignee
深圳壹账通智能科技有限公司
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 深圳壹账通智能科技有限公司 filed Critical 深圳壹账通智能科技有限公司
Publication of WO2019242297A1 publication Critical patent/WO2019242297A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/289Phrasal analysis, e.g. finite state techniques or chunking

Definitions

  • the present application relates to the field of artificial intelligence technology, and in particular, the present application relates to an intelligent dialogue method, device, and terminal based on machine reading comprehension.
  • the inventors realized that the existing intelligent dialogue system is limited by the amount of data pre-stored in the corpus, and a large number of questions cannot be answered, especially when the user asks a new question, the system cannot answer or answer the question. In addition, because frequently asked questions and answers change frequently, it takes time to update the data in the corpus regularly.
  • the purpose of this application is to solve at least one of the aforementioned technical defects.
  • the present application provides an intelligent dialogue method based on machine reading comprehension, which includes the following steps: obtaining a text corresponding to a question posed by a user; performing word segmentation processing and vectorization processing on the question and text to obtain each word in the question.
  • the corresponding question vector and the text vector corresponding to each word in the text; the question vector and the text vector are input into the attention model to obtain a first vector and a second vector.
  • the first vector is used to indicate that the problem is noticing any word in the text.
  • the second vector is used to indicate the degree of influence of the text on the generated question; the answer start point and the answer end point are determined in the text according to the first vector and the second vector, and the paragraph between the answer start point and the answer end point Determined as the answer to the question.
  • the present application also provides an intelligent dialogue device based on machine reading comprehension, including: a text acquisition unit for acquiring text corresponding to a question and a question posed by a user; a pre-processing unit for processing the question and text Word segmentation processing and vectorization processing to obtain the problem vector corresponding to each word in the question and the text vector corresponding to each word in the text; the attention calculation unit is used to input the problem vector and the text vector into the attention model to obtain the first vector and the first vector Two vectors, the first vector is used to indicate the degree of influence of the question on any word in the noticed text, the second vector is used to indicate the degree of influence of the text on the generated question; the answer positioning unit is used to Determine the answer start point and the answer end point in the text, and determine the paragraph between the answer start point and the answer end point as the answer to the question.
  • a text acquisition unit for acquiring text corresponding to a question and a question posed by a user
  • a pre-processing unit for processing the question and text Word segmentation processing and vector
  • the present application also provides an intelligent dialogue terminal based on machine reading comprehension, which includes: one or more processors; a memory; and one or more application programs, wherein the one or more application programs are stored in The memory is configured to be executed by the one or more processors, and the one or more programs are configured to execute the intelligent conversation method based on machine reading comprehension according to any one of the embodiments of the first aspect. .
  • the present application also provides a computer-readable storage medium having stored thereon a computer program that, when executed by a processor, implements the intelligent conversation based on machine reading comprehension according to any one of the embodiments of the first aspect. method.
  • the intelligent dialogue method, device, terminal, and computer-readable storage medium based on machine reading comprehension described above first retrieve a matching text based on a question, and then accurately locate a paragraph that can be used as an answer from the retrieved text, that is, directly from the present Some texts take relevant paragraphs as answers. Because the existing text is written by people, such as the content in Baidu Encyclopedia or the user ’s answer in the Post Bar, the answer generated by the method of this embodiment is completely natural language.
  • the method of this embodiment does not need to set a "question-answer" pair in advance, and is no longer limited to a pre-stored question bank, which can flexibly answer various questions of users and overcome
  • the existing technology needs to continuously maintain the defects of the problem database, which reduces the cost of data update.
  • the method of this embodiment based on the use of the attention mechanism, comprehensively considers the impact of the two-way attention of the problem on the text and the text on the problem. Comprehensively understand the relationship between the question and the text, so that the final output of the answer is more accurate and avoid unanswered questions .
  • FIG. 1 is a flowchart of an intelligent dialogue method based on machine reading comprehension according to an embodiment
  • FIG. 2 is a flowchart of an intelligent conversation method based on machine reading comprehension according to another embodiment
  • FIG. 3 is a flowchart of an intelligent conversation method based on machine reading comprehension according to another embodiment
  • FIG. 4 is a structural block diagram of an intelligent dialogue method device based on machine reading comprehension according to an embodiment
  • FIG. 5 is a structural block diagram of a preprocessing unit in an intelligent dialog method device based on machine reading comprehension according to another embodiment
  • FIG. 6 is a structural block diagram of a preprocessing unit in an intelligent dialogue method device based on machine reading comprehension according to another embodiment
  • FIG. 7 is a schematic diagram of the internal structure of an intelligent dialogue method terminal based on machine reading comprehension in an embodiment.
  • terminal and terminal equipment as used herein include both wireless signal receiver devices, and only devices with wireless signal receivers that do not have transmission capabilities, as well as receiving and transmitting hardware.
  • Such equipment may include: cellular or other communication equipment, which has a single-line display or multi-line display or a cellular or other communication device without a multi-line display; PCS (Personal Communications Service, Personal Communication System), which can combine voice and data Processing, fax and / or data communication capabilities; PDA (Personal Digital Assistant), which can include RF receivers, pagers, Internet / Intranet access, web browsers, notepads, calendars, and / or GPS (Global Positioning System (Global Positioning System) receiver; conventional laptop and / or palmtop computer or other device having and / or conventional laptop and / or palmtop computer or other device including a radio frequency receiver.
  • GPS Global Positioning System
  • terminal may be portable, transportable, installed in a vehicle (air, sea, and / or land), or suitable and / or configured to operate locally, and / or Runs in a distributed fashion on any other location on Earth and / or space.
  • the "terminal” and “terminal equipment” used herein may also be communication terminals, Internet terminals, music / video playback terminals, such as PDA, MID (Mobile Internet Device), and / or have music / video playback
  • Functional mobile phones can also be smart TVs, set-top boxes and other devices.
  • the remote network device used here includes, but is not limited to, a computer, a network host, a single network server, multiple network server sets, or a cloud composed of multiple servers.
  • the cloud is composed of a large number of computers or network servers based on cloud computing.
  • cloud computing is a type of distributed computing, a super virtual computer composed of a group of loosely coupled computer sets.
  • communication between the remote network device, the terminal device and the WNS server can be achieved by any communication method, including but not limited to, mobile communication based on 3GPP, LTE, WIMAX, TCP / IP, and UDP protocols.
  • Computer network communication and short-range wireless transmission based on Bluetooth and infrared transmission standards.
  • the method in this embodiment includes:
  • Step S101 Obtain a question and a text corresponding to the question from a user
  • Step S102 Perform word segmentation processing and vectorization processing on the question and text to obtain a question vector corresponding to each word in the question and a text vector corresponding to each word in the text;
  • Step S103 The question vector and the text vector are input into the attention model to obtain a first vector and a second vector.
  • the first vector is used to indicate the degree of influence of the problem on any word in the noticed text
  • the second vector is used to indicate the text is The impact of the problem
  • Step S104 Determine the answer start point and the answer end point in the text according to the first vector and the second vector, and determine the paragraph between the answer start point and the answer end point as the answer to the question.
  • a text related to the question is automatically searched, and the searched text comes from a network or a database; then, the question and the searched text are preprocessed (such as word segmentation, vector Processing, etc.) to obtain the question vector and text vector, so that the expression of the question and text conforms to the input of the attention model; then, the question vector and the text vector are input into the attention model at the same time to jointly reveal the problem and the text.
  • the first and second vectors of the degree of interaction between them that is, using the Attention Mechanism (AM) to imitate the way humans understand texts. In layman's terms, when humans read texts with questions, they will react to them because of questions.
  • AM Attention Mechanism
  • Each word in the text is assigned a different attention, that is, it is easier for people to notice certain words in the text that are related to the problem and ignore other unrelated words.
  • the first and second vectors describe the problem and the text. The distribution of attention between the two; finally, the answer is determined in the text based on the first and second vectors And answers termination point, and answer section between the starting point and ending point to determine the answers to questions.
  • the method of this embodiment first retrieves matching text based on a question, and then accurately locates a paragraph that can be used as an answer from the retrieved text, that is, directly intercepts the relevant paragraph from the existing text as Answer. Because the existing text is written by a person, such as the content in Baidu Encyclopedia or the user ’s answer in the Post Bar, the answer generated by the method of this embodiment completely conforms to the rules of natural language, improving the readability of the answer Sex. Secondly, the method of this embodiment does not need to set a "question-answer" pair in advance, and is no longer limited to a pre-stored question bank. , Reducing the cost of data updates.
  • the method of this embodiment is based on the use of the attention mechanism, which comprehensively considers the two-way attention effect of the question on the text and the text on the question, and can more fully understand the relationship between the question and the text, so that the final output answer is more Be precise and avoid asking the wrong questions.
  • step S101 specifically includes: acquiring a question posed by a user, and searching a network and / or a database for a text corresponding to the question.
  • the corresponding keywords are extracted from the questions posed by the user, and the extracted keywords are used as search terms, and the text corresponding to the questions posed by the user is searched from the network through crawler technology and the like.
  • the method for extracting keywords is the prior art, and will not be described again.
  • calculate the degree of match between the question raised by the user and the text stored in the database calculate the recall value according to the degree of match, and return the text with the highest recall value as the text corresponding to the question raised by the user.
  • a threshold can be set, and the text with a recall value higher than the threshold is used as the text corresponding to the question raised by the user; or, the text is sorted according to the recall value, and the text with the highest ranking is obtained as the text corresponding to the question raised by the user .
  • the multiple paragraphs of text are connected end-to-end to form a piece of text, which is used as the text corresponding to the question raised by the user, and subsequent vectorization is performed based on the synthesized text.
  • the above two search methods can also be combined, which specifically include: searching the database for the text corresponding to the question raised by the user; when the corresponding text cannot be obtained from the database , Search the web for text corresponding to a user ’s question.
  • the searched text can be added to the database to achieve the purpose of automatic updating and expanding the database, and reduce the cost of data update.
  • this embodiment combines a database and a network search method, and preferentially adopts a database search method.
  • the network search method is used to obtain the text corresponding to the question raised by the user to achieve a balanced search text. The purpose of accuracy and efficiency.
  • step S102 specifically includes:
  • Step S201 Perform word segmentation processing on the question and the text respectively;
  • Step S202 Input the word segmentation results of the question and the text into the vectorized model, respectively, to obtain a first question vector corresponding to each word in the question and a first text vector corresponding to each word in the text;
  • the vectorization model can be selected from models such as glove and word2vec.
  • Step S203 Use a bidirectional recurrent neural network to update the first question vector and the first text vector to obtain a question vector corresponding to the first question vector and a text vector corresponding to the first text vector.
  • the question posed by the user is "What is an oxygen bag”
  • the article corresponding to the question asked by the user is "Today, an oxygen bag was issued in Beijing, and the oxygen bag is a bag for oxygen.”
  • the three words obtained after processing are "oxygen bag”, "yes” and "what”.
  • the three words obtained are input into the text vector model to obtain three first problem vectors.
  • the first problem vectors X 1 , X 2 , and X 3 are updated by a bidirectional recurrent neural network to obtain updated problem vectors X ′ 1 , X ′ 2 , and X ′ 3 .
  • the specific process is: obtaining the first order vector (X 1 , X 2 , X 3 ) and the reverse order (X 3 , X 2 , X 1 ) and (X 1 , X 2 , X 3 ) and ( X 3 , X 2 , X 1 ) are input to a bidirectional recurrent neural network for context learning, and the updated three problem vectors X ′ 1 , X ′ 2 , and X ′ 3 are output through the bidirectional recurrent neural network.
  • the two-way recurrent neural network uses the LSTM structure.
  • the bidirectional recurrent neural network is used to perform context learning on the problem and the text, respectively. Semantics to optimize the first problem vector and the first text vector. For example, the word “Apple” has different semantics in "I want to eat an apple” and "My new computer is an apple.” The use of two-way recurrent neural network can well disambiguate, so that the optimized text vector and problem vector can more accurately represent the semantics of the problem and text.
  • step S102 specifically includes:
  • Step S301 Perform word segmentation processing on the question and the text respectively;
  • Step S302 Remove the punctuation marks from the text segmentation results and the question segmentation results.
  • Step S303 input the question segmentation result and the text segmentation result without punctuation marks into a vectorized model, and obtain a first question vector corresponding to each word in the question and a first text vector corresponding to each word in the text;
  • Step S304 Use a bidirectional recurrent neural network to update the first problem vector and the first text vector to obtain a problem vector corresponding to the first problem vector and a text vector corresponding to the first text vector.
  • punctuation marks are also included in the word segmentation results, and these punctuation marks obviously do not help any semantic understanding. Therefore, before vectorizing the text and the question, remove the punctuation marks from the question and text word segmentation results. Symbol, only vectorize the text part of the word segmentation result. Following the previous example, for the text, only the "today”, “Beijing”, “fat”, “le”, “oxygen bag”, “oxygen bag”, “yes”, “for”, “filling”, “oxygen”, and “bag” are required. The words are vectorized, and 12 first text vectors are finally obtained, which reduces the data processing amount and improves the processing efficiency.
  • step S103 specifically includes:
  • Step S401 Input the question vector and the text vector into the first neural network based on the attention mechanism to obtain the attention distribution probability distribution.
  • the attention value in the attention distribution probability distribution is used to indicate that any word in the question is important to the attention text. Influence of any word;
  • Step S402 The attention value corresponding to each word in the text is used as a weight, and the problem vector is weighted and averaged to obtain a first vector corresponding to each word in the text.
  • Step S403 Take the maximum value from the attention value corresponding to each word in the text, normalize the maximum value corresponding to each word in the text, and use the normalized maximum value as a weight to weight the average of the text vector To get the second vector.
  • a set of attention values corresponding to the problem vector X ′ 1 is obtained by the attention model ( ⁇ 1,1 , ⁇ 1,2 , ..., ⁇ 1,14 ), where the attention value ⁇ 1,1 is the problem The degree of influence of the first word "oxygen bag” in the note text on the first word "today”, attention value ⁇ 1,14 is the first word in the question "oxygen bag” on the note text The degree of influence of the 14th word ".” In this case.
  • the scheme of filtering out the punctuation marks in the question and text is not adopted; similarly, a set of attention values corresponding to the problem vector X ′ 2 is obtained through the attention model.
  • ⁇ i, j represents the degree of influence of the i-th word in the learned question on the j-th word in the noticed text, that is, the attention value; i is a positive integer not greater than n, and n is the length of the problem, that is, the problem segmentation
  • m 14.
  • the attention model can be obtained by using common neural network training, such as CNN, RNN, BiRNN, GRU, LSTM, Deep LSTM, etc.
  • the training method of the model is a general neural network training method, which is not described in detail here.
  • the attention vector corresponding to each word in the text is used as a weight
  • the problem vector is weighted and averaged to obtain a first vector corresponding to each word in the text, that is, each line of the attention distribution probability distribution A is used as a weight.
  • the problem vectors X ′ 1 , X ′ 2 , and X ′ 3 are weighted and averaged to obtain the first vector corresponding to each word in the text.
  • a total of 14 first vectors W 1 , W 2 ,..., W 14 are obtained .
  • step S104 specifically includes:
  • Step S501 Input a first vector and a second vector into a second neural network, and obtain a first probability value of each word in the text as a starting point of an answer;
  • Step S502 Input the first vector, the second vector, and the first probability value into the third neural network, and obtain the second probability value of each word in the text as the answer termination point;
  • Step S503 According to the first probability value and the second probability value, calculate the paragraph between the words in the text as the third probability value of the answer, and take the paragraph corresponding to the largest third probability value as the answer to the question.
  • the second neural network and the third neural network are preferably bidirectional LSTMs (Time Recurrent Neural Networks).
  • first, 14 first vectors W 1 , W 2 ,..., W 14 and a second vector U are input to a first bidirectional LSTM to obtain 14 first probability values ⁇ P 1 , P 2 , ..., P 14 ⁇ , where P 1 represents the probability of the first word "today" in the text as the starting point of the answer.
  • the first probability values ⁇ P 1 , P 2 ,..., P 14 ⁇ , 14 first vectors W 1 , W 2 ,..., W 14 and the second vector U are input to the second bidirectional LSTM to obtain an output.
  • the third probability value of the paragraph between the words in the text as the answer that is, calculate the first probability value ⁇ P 1 , P 2 , ..., P 14 ⁇
  • the paragraph between the corresponding answer start point and answer end point is the answer to the question.
  • an embodiment of the present application further provides an intelligent dialogue device 40 based on machine reading comprehension, including:
  • a text acquiring unit 401 configured to acquire a question posed by a user and a text corresponding to the question
  • the preprocessing unit 402 is configured to perform word segmentation processing and vectorization processing on the question and the text to obtain a question vector corresponding to each word in the question and a text vector corresponding to each word in the text;
  • An attention calculation unit 403 is configured to input a question vector and a text vector into an attention model to obtain a first vector and a second vector.
  • the first vector is used to indicate the degree of influence of the problem on any word in the noticed text.
  • the second vector Used to indicate the impact of text on the problem;
  • the answer positioning unit 404 is configured to determine an answer start point and an answer end point in the text according to the first vector and the second vector, and determine a paragraph between the answer start point and the answer end point as an answer to the question.
  • the text obtaining unit 401 is specifically configured to: obtain a question posed by a user, and search a network and / or a database for a text corresponding to the question.
  • the pre-processing unit 402 includes:
  • Word segmentation subunit 501 which is used to perform word segmentation processing on the question and the text respectively;
  • the vectorization subunit 502 is configured to input the word segmentation results of the question and the text into a vectorization model, respectively, to obtain a first question vector corresponding to each word in the question and a first text vector corresponding to each word in the text;
  • the optimization subunit 503 is configured to update the first problem vector and the first text vector by using a bidirectional recurrent neural network to obtain a problem vector corresponding to the first problem vector and a text vector corresponding to the first text vector.
  • the pre-processing unit further includes a filtering sub-unit 504, which is used to remove punctuation marks from text segmentation results and question segmentation results from the filtering sub-unit.
  • the attention calculation unit 403 is specifically configured to:
  • the problem vector and text vector are input into the first neural network based on the attention mechanism to obtain the attention distribution probability distribution.
  • the attention value in the attention distribution probability distribution is used to indicate that any word in the problem is related to any word in the attention text. Degree of influence
  • the answer positioning unit 404 is specifically configured to:
  • the paragraph between each word in the text is calculated as the third probability value of the answer, and the paragraph corresponding to the largest third probability value is used as the answer to the question.
  • the second neural network and the third neural network are both bidirectional LSTM time recurrent neural networks.
  • the intelligent dialogue device based on machine reading comprehension and the intelligent dialogue method based on machine reading comprehension in this embodiment adopt the same inventive concept and can obtain the same technical effects, which are not described herein again.
  • the embodiment of the present application further provides an intelligent dialogue terminal based on machine reading comprehension, which includes: one or more processors; a memory; one or more An application program, in which one or more application programs are stored in a memory and configured to be executed by one or more processors, and the one or more programs are configured to execute the machine reading comprehension based on any one of the above embodiments Smart conversation methods.
  • FIG. 7 is a schematic diagram of the internal structure of an intelligent dialog terminal based on machine reading comprehension in an embodiment.
  • the terminal includes a processor, a nonvolatile storage medium, a memory, and a network interface connected through a system bus.
  • the non-volatile storage medium of the computer device stores an operating system, a database, and computer-readable instructions.
  • the database may store control information sequences.
  • the processor may implement a An intelligent dialogue method based on machine reading comprehension.
  • the processor of the computer equipment is used to provide computing and control capabilities to support the operation of the entire computer equipment.
  • the memory of the computer device may store computer-readable instructions.
  • the processor may cause the processor to execute an intelligent dialogue method based on machine reading comprehension.
  • the network interface of the computer equipment is used to connect and communicate with the terminal.
  • the specific computer equipment may be Include more or fewer parts than shown in the figure, or combine certain parts, or have a different arrangement of parts.
  • the intelligent dialogue terminal based on machine reading comprehension provided by this embodiment adopts the same inventive concept as the above-mentioned intelligent dialogue method based on machine reading comprehension, and has the same beneficial effects, which will not be repeated here.
  • an embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon.
  • the program is executed by a processor, any one of the foregoing implementations is implemented.
  • the aforementioned storage medium may be a read-only memory, a magnetic disk, or an optical disk.
  • steps in the flowchart of the drawings are sequentially displayed in accordance with the directions of the arrows, these steps are not necessarily performed in the order indicated by the arrows. Unless explicitly stated herein, the execution of these steps is not strictly limited, and they can be performed in other orders. Moreover, at least a part of the steps in the flowchart of the drawing may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily performed at the same time, but may be performed at different times. The execution order is also It is not necessarily performed sequentially, but may be performed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Machine Translation (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种基于机器阅读理解的智能对话方法、装置、终端,上述方法包括:获取用户提出的问题与问题对应的文本(S101);对问题和文本进行分词处理和向量化处理,得到问题中各个词对应的问题向量和文本中各个词对应的文本向量(S102);将问题向量和文本向量输入注意力模型,得到第一向量和第二向量,第一向量用于指示问题对于注意到文本中任一词的影响度,第二向量用于指示文本对于生成问题的影响度(S103);根据第一向量和第二向量在文本中确定答案起始点和答案终止点,并将答案起始点和答案终止点之间的段落确定为问题的答案(S104)。该方法无需预先设置"问题-答案"对,可灵活地回答用户的各种问题,克服了现有技术需要不断维护问题库的缺陷,减少了数据更新成本。

Description

基于机器阅读理解的智能对话方法、装置、终端
本申请要求于2018年6月21日提交中国专利局、申请号为201810642836.X,发明名称为“基于机器阅读理解的智能对话方法、装置、终端”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及人工智能技术领域,具体而言,本申请涉及一种基于机器阅读理解的智能对话方法、装置、终端。
背景技术
现有的智能对话***主要靠检索用户输入的问题获取答案。基于信息检索的自然语言对话技术需要将大规模的对话语料以“问题-答案”对的方式进行索引,在线对话时,通过搜索找到与用户输入相似的问题,并将其对应的答案返回给用户。然而,当用户输入与库中语料匹配度较低时,无法保证***返回语义相关的对话,现有的智能对话***可扩展性低,也无法产生语料从没有的回复。
因此,发明人意识到现有的智能对话***受限于语料库中预存的数据量,大量问题无法得到回答,尤其是当用户提出的新问题时,***更是无法回答或答非所问。此外,由于常见问题和答案时常会变动,需要耗费人力对语料库中数据进行定期更新。
发明内容
本申请的目的旨在至少能解决上述的技术缺陷之一。
第一方面,本申请提供一种基于机器阅读理解的智能对话方法,包括如下步骤:获取用户提出的问题与问题对应的文本;对问题和文本进行分词处理和向量化处理,得到问题中各个词对应的问题向量和文本中各个词对应的文本向量;将问题向量和文本向量输入注意力模型,得到第一向量和第二向量,第一向量用于指示问题对于注意到文本中任一词的影响度,第二向量用于指示文本对于生成问题的影响度;根据第一向量和第二向量在文本中确定答案起始点和答案终止点,并将答案起 始点和答案终止点之间的段落确定为问题的答案。
第二方面,本申请还提供了一种基于机器阅读理解的智能对话装置,包括:文本获取单元,用于获取用户提出的问题与问题对应的文本;预处理单元,用于对问题和文本进行分词处理和向量化处理,得到问题中各个词对应的问题向量和文本中各个词对应的文本向量;注意力计算单元,用于将问题向量和文本向量输入注意力模型,得到第一向量和第二向量,第一向量用于指示问题对于注意到文本中任一词的影响度,第二向量用于指示文本对于生成问题的影响度;答案定位单元,用于根据第一向量和第二向量在文本中确定答案起始点和答案终止点,并将答案起始点和答案终止点之间的段落确定为问题的答案。
第三方面,本申请还提供一种基于机器阅读理解的智能对话终端,其包括:一个或多个处理器;存储器;一个或多个应用程序,其中所述一个或多个应用程序被存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个程序配置用于:执行第一方面中任一实施例所述的基于机器阅读理解的智能对话方法。
第四方面,本申请还提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现第一方面中任一实施例所述的基于机器阅读理解的智能对话方法。
上述的基于机器阅读理解的智能对话方法、装置、终端及计算机可读存储介质,先基于问题检索到匹配的文本,再从检索到的文本中精准定位到可作为答案的段落,即直接从现有的文本中截取相关段落作为答案,由于现有的文本是由人撰写的,如百度百科中的内容或贴吧中用户的回答,因此,通过本实施例的方法生成的答案完全符自然语言的规则,提高了答案的可阅读性;其次,本实施例的方法无需预先设置“问题-答案”对,也不再受限于预存的问题库,可灵活地回答用户的各种问题,克服了现有技术需要不断维护问题库的缺陷,减少了数据更新的成本;此外,本实施例的方法,基于利用注意力机制,综合考虑了问题对文本、文本对问题的双向注意力影响,能够更全面地理解问题与文本之间的关系,以使得最终输出的答案更加精准,避免答非所问。
附图说明
本申请上述的和/或附加的方面和优点从下面结合附图对实施例的描述中将变得明显和容易理解,其中:
图1为一个实施例的基于机器阅读理解的智能对话方法流程图;
图2为另一个实施例的基于机器阅读理解的智能对话方法流程图;
图3为另一个实施例的基于机器阅读理解的智能对话方法流程图;
图4为一个实施例的基于机器阅读理解的智能对话方法装置的结构框图;
图5为另一个实施例的基于机器阅读理解的智能对话方法装置中预处理单元的结构框图;
图6为另一个实施例的基于机器阅读理解的智能对话方法装置中预处理单元的结构框图;
图7为一个实施例中基于机器阅读理解的智能对话方法终端的内部结构示意图。
具体实施方式
下面详细描述本申请的实施例,所述实施例的示例在附图中示出,其中自始至终相同或类似的标号表示相同或类似的元件或具有相同或类似功能的元件。下面通过参考附图描述的实施例是示例性的,仅用于解释本申请,而不能解释为对本申请的限制。
本技术领域技术人员可以理解,除非特意声明,这里使用的单数形式“一”、“一个”、“所述”和“该”也可包括复数形式。应该进一步理解的是,本申请的说明书中使用的措辞“包括”是指存在所述特征、整数、步骤、操作、元件和/或组件,但是并不排除存在或添加一个或多个其他特征、整数、步骤、操作、元件、组件和/或它们的组。应该理解,当我们称元件被“连接”或“耦接”到另一元件时,它可以直接连接或耦接到其他元件,或者也可以存在中间元件。此外,这里使用的“连接”或“耦接”可以包括无线连接或无线耦接。这里使用的措辞“和/或”包括一个或更多个相关联的列出项的全部或任一单元和全部组合。
本技术领域技术人员可以理解,除非另外定义,这里使用的所有术语(包括技术术语和科学术语),具有与本申请所属领域中的普通技术人员的一般理解相同的意义。还应该理解的是,诸如通用字典中定义的那些术语,应该被理解为具有与现有技术的上下文中的意义一致的意义,并且除非像这里一样被特定定义,否则不会用理想化或过于正式的含义来解释。
本技术领域技术人员可以理解,这里所使用的“终端”、“终端设备”既包括无线信号接收器的设备,其仅具备无发射能力的无线信号接收器的设备,又包括接收和 发射硬件的设备,其具有能够在双向通讯链路上,执行双向通讯的接收和发射硬件的设备。这种设备可以包括:蜂窝或其他通讯设备,其具有单线路显示器或多线路显示器或没有多线路显示器的蜂窝或其他通讯设备;PCS(Personal Communications Service,个人通讯***),其可以组合语音、数据处理、传真和/或数据通讯能力;PDA(Personal Digital Assistant,个人数字助理),其可以包括射频接收器、寻呼机、互联网/内联网访问、网络浏览器、记事本、日历和/或GPS(Global Positioning System,全球定位***)接收器;常规膝上型和/或掌上型计算机或其他设备,其具有和/或包括射频接收器的常规膝上型和/或掌上型计算机或其他设备。这里所使用的“终端”、“终端设备”可以是便携式、可运输、安装在交通工具(航空、海运和/或陆地)中的,或者适合于和/或配置为在本地运行,和/或以分布形式,运行在地球和/或空间的任何其他位置运行。这里所使用的“终端”、“终端设备”还可以是通讯终端、上网终端、音乐/视频播放终端,例如可以是PDA、MID(Mobile Internet Device,移动互联网设备)和/或具有音乐/视频播放功能的移动电话,也可以是智能电视、机顶盒等设备。
本技术领域技术人员可以理解,这里所使用的远端网络设备,其包括但不限于计算机、网络主机、单个网络服务器、多个网络服务器集或多个服务器构成的云。在此,云由基于云计算(Cloud Computing)的大量计算机或网络服务器构成,其中,云计算是分布式计算的一种,由一群松散耦合的计算机集组成的一个超级虚拟计算机。本申请的实施例中,远端网络设备、终端设备与WNS服务器之间可通过任何通讯方式实现通讯,包括但不限于,基于3GPP、LTE、WIMAX的移动通讯、基于TCP/IP、UDP协议的计算机网络通讯以及基于蓝牙、红外传输标准的近距无线传输方式。
下面对本申请实施例提供的一种基于机器阅读理解的智能对话方法进行介绍,参见图1所示,本实施例的方法包括:
步骤S101、获取用户提出的问题与问题对应的文本;
步骤S102、对问题和文本进行分词处理和向量化处理,得到问题中各个词对应的问题向量和文本中各个词对应的文本向量;
步骤S103、将问题向量和文本向量输入注意力模型,得到第一向量和第二向量,第一向量用于指示问题对于注意到文本中任一词的影响度,第二向量用于指示文本对于生成问题的影响度;
步骤S104、根据第一向量和第二向量在文本中确定答案起始点和答案终止点, 并将答案起始点和答案终止点之间的段落确定为问题的答案。
本申请实施例中,首先,基于用户提出的问题,自动搜索与该问题相关的文本,搜索到的文本来自于网络或数据库;然后,对问题以及搜索到的文本进行预处理(如分词、向量化处理等),得到问题向量和文本向量,以使得问题和文本的表达方式符合注意力模型的输入;接着,将问题向量和文本向量同时输入到注意力模型中,得到共同揭示问题与文本之间相互影响度的第一向量和第二向量,即利用注意力机制(AM,Attention Mechanism)模仿人类理解文本的方式,通俗地说,就是当人类带着问题阅读文本时,会因为问题而对文本中各个词分配不同的注意力,也就是说,人们会更容易注意到文本中与问题相关的某些词,而忽略其它无关的词,第一向量和第二向量就描述了问题和文本之间的注意力分配情况;最后,根据第一向量和第二向量在文本中确定答案起始点和答案终止点,并将答案起始点和答案终止点之间的段落确定为问题的答案。
与现有技术相比,本实施例的方法,先基于问题检索到匹配的文本,再从检索到的文本中精准定位到可作为答案的段落,即直接从现有的文本中截取相关段落作为答案,由于现有的文本是由人撰写的,如百度百科中的内容或贴吧中用户的回答,因此,通过本实施例的方法生成的答案完全符自然语言的规则,提高了答案的可阅读性。其次,本实施例的方法无需预先设置“问题-答案”对,也不再受限于预存的问题库,可灵活地回答用户的各种问题,克服了现有技术需要不断维护问题库的缺陷,减少了数据更新的成本。此外,本实施例的方法,基于利用注意力机制,综合考虑了问题对文本、文本对问题的双向注意力影响,能够更全面地理解问题与文本之间的关系,以使得最终输出的答案更加精准,避免答非所问。
进一步地,步骤S101具体包括:获取用户提出的问题,在网络和/或数据库中搜索与问题对应的文本。
例如,从用户提出的问题中提取出相应的关键词,以提取出的关键词为检索词,通过爬虫技术等方式,从网络中搜索到与用户提出的问题对应的文本。其中,提取关键词的方法为现有技术,再次不在赘述。当然,也可以直接将整个问题作为检索词,在网络中搜索与用户提出的问题对应的文本。
例如,计算用户提出的问题与数据库中预存的文本的匹配度,根据匹配度计算recall(召回率)值,返回recall值最大的文本,作为与用户提出的问题对应的文本,其中,数据库中预先存储有大量的文本。实际中,可设置阈值,将recall值高于阈值的文本作为与用户提出的问题对应的文本;或,根据recall值对文本进行排序, 获取排序靠前的文本作为与用户提出的问题对应的文本。
当通过网络或数据库获取到多段文本时,将这多段文本首尾相连合成一段文本,作为与用户提出的问题对应的文本,基于该合成的文本进行后续的向量化处理。
进一步地,为平衡搜索文本的准确度和效率,还可以将上述两种搜索方法结合,具体包括:在数据库中搜索与用户提出的问题对应的文本;当无法从数据库中获取到对应的文本时,在网络中搜索与用户提出的问题对应的文本。此外,在网络搜索的过程中,可以将搜索到的文本添加到数据库中,以达到自动更新、扩充数据库的目的,减少数据更新的成本。
数据库中的文本资源有限,但搜索到的文本可靠度更高;而网络中的文本资源包罗万象,但与问题的匹配度和准确度都存疑,且搜索成本较高。因此,本实施例结合数据库与网络搜索方式,优先采用数据库搜索的方式,当数据库搜索不同合适的文本时,再利用网络搜索的方式获取与用户提出的问题对应的文本,以达到平衡搜索文本的准确度和效率的目的。
进一步地,如图2所示,步骤S102具体包括:
步骤S201、分别对问题和文本进行分词处理;
步骤S202、分别将问题和文本的分词结果输入向量化模型,得到问题中各个词对应的第一问题向量和文本中各个词对应的第一文本向量;
其中,向量化模型可选用如glove、word2vec等模型。
步骤S203、利用双向循环神经网络更新第一问题向量和第一文本向量,得到第一问题向量对应的问题向量和第一文本向量对应的文本向量。
例如,用户提出的问题为“氧气袋是什么”,搜索到的与用户提出的问题对应的本文为“今天北京发了氧气袋,氧气袋是用来装氧气的袋子。”,对问题进行分词处理后得到的三个词为“氧气袋”“是”“什么”,将得到的三个词分别输入文本向量模型后得到三个第一问题向量,“氧气袋”对应的第一问题向量为X 1=(x 1,1,x 1,2,…,x 1,v),“是”对应的第一文本向量为X 2=(x 2,1,x 2,2,…,x 2,v),“什么”对应的第一问题向量为X 3=(x 3,1,x 3,2,…,x 3,v),其中,V为预设的向量维度。同理,对问题对应的文本进行分词处理后得到14个词,分别为“今天”“北京”“发”“了”“氧气袋”“,”“氧气袋”“是”“用来”“装”“氧气”“的”“袋子”“。”,将得到的14个词输入向量化模型,得到对应的14个第一文本向量Y 1、Y 2、…、Y 14,例如,“今天”对应的向量为Y 1=(y 1,1,y 1,2,…,y 1,v),“北京”对应的向量为Y 2=(y 2,1,y 2,2,…,y 2,v)。
随后,通过双向循环神经网络对第一问题向量X 1、X 2、X 3进行更新,得到更新后的问题向量X′ 1、X′ 2、X′ 3。具体过程为:得到第一问题向量的正序排列(X 1,X 2,X 3)和倒序排列(X 3,X 2,X 1),将(X 1,X 2,X 3)和(X 3,X 2,X 1)输入双向循环神经网络进行上下文学习,通过双向循环神经网络输出更新后的3个问题向量X′ 1、X′ 2、X′ 3。同理,得到第一文本向量的正序排列(Y 1,Y 2,…,Y 14)和倒序排列(Y 14,Y 13,…,Y 1),将(Y 1,Y 2,…,Y 14)和(Y 14,Y 13,…,Y 1)输入双向循环神经网络中进行学习上下文,得到更新后的14个文本向量Y′ 1、……、Y′ 14
其中,双向循环神经网络选用LSTM结构。
通过向量化模型得到的第一问题向量和第一文本向量精准度不高,因此,本实施例利用双向循环神经网络对问题和文本分别进行上下文学习,能够识别同一词语在不同语境中的不同语义,以达到对第一问题向量和第一文本向量进行优化的目的,例如,“苹果”一词在“我想吃苹果”和“我新买的电脑是苹果”中就存在不同的语义,而利用双向循环神经网络可以很好地消除歧义,使得优化后的文本向量和问题向量能过更加准确地表征问题和文本的语义。
进一步地,如图3所示,步骤S102具体包括:
步骤S301、分别对问题和文本进行分词处理;
步骤S302、去除文本的分词结果和问题的分词结果中的标点符号;
步骤S303、分别将去除标点符号的问题分词结果和文本分词结果输入向量化模型,得到问题中各个词对应的第一问题向量和文本中各个词对应的第一文本向量;
步骤S304、利用双向循环神经网络更新第一问题向量和第一文本向量,得到第一问题向量对应的问题向量和第一文本向量对应的文本向量。
通过前述例子可知,在分词结果中还包括标点符号,而这些标点符号显然对语义理解没有任何帮助,因此,在对文本和问题进行向量化处理之前,先去除问题和文本的分词结果中的标点符号,仅对分词结果中的文字部分进行向量化处理。接前述例子,针对文本仅需要对“今天”“北京”“发”“了”“氧气袋”“氧气袋”“是”“用来”“装”“氧气”“的”“袋子”这12词进行向量化处理,最终得到12个第一文本向量,降低了数据处理量,提高了处理效率。
进一步地,步骤S103具体包括:
步骤S401、将问题向量和文本向量输入基于注意力机制的第一神经网络,得到注意力分配概率分布,注意力分配概率分布中的注意力值用于指示问题中任一词对于注意到文本中任一词的影响度;
步骤S402、以文本中各个词对应的注意力值作为权重,对问题向量进行加权平均,得到文本中各个词对应的第一向量;
步骤S403、从文本中各个词对应的注意力值中取最大值,将对文本中各个词对应的最大值进行归一化,以归一化后的最大值作为权重,对文本向量进行加权平均,得到第二向量。
以前述的氧气袋为例,问题向量X′ 1、X′ 2、X′ 3中,基于词“氧气袋”,在阅读文本“今天北京发了氧气袋,氧气袋是用来装氧气的袋子。”时,对文本中“今天”“北京”“发”“了”“氧气袋”“,”“氧气袋”“是”“用来”“装”“氧气”“的”“袋子”“。”各个词的注意力是不同的,读者不会关注对“今天”“北京”“发了”“是”等词,更容易关注“氧气袋”“是”“用来”“氧气”“袋子”等词。因此,利用注意力机制,可以得到问题向量中的各个词对注意到文本向量中各个词的影响度,将这一影响度称为注意力值。例如,通过注意力模型得到问题向量X′ 1对应的一组注意力值为(α 1,11,2,…,α 1,14),其中,注意力值α 1,1为问题中的第一个词“氧气袋”对注意到文本中的第一个词“今天”的影响度,注意力值α 1,14为问题中的第一个词“氧气袋”对注意到文本中的第14个词“。”的影响度,此处,未采用滤除问题和文本中的标点符号的方案;同理,通过注意力模型得到问题向量X′ 2对应的一组注意力值为(α 2,12,2,…,α 2,14),问题向量X′ 3对应的一组注意力值为(α 3,13,2,…,α 3,14),最终得到注意力分配概率分布A,如下:
Figure PCTCN2019070350-appb-000001
其中,α i,j表示获知问题中的第i个词对注意到文本中第j个词的影响度,即注意力值;i为不大于n的正整数,n为问题长度,即问题分词后得到的词的数量,在上述例子中n=3;j为不大于m的正整数,m为文本长度,即文本分词后得到的词的数量,在上述例子中m=14。
其中,注意力模型可选用常见的神经网络训练得到,如CNN、RNN、BiRNN、GRU、LSTM、Deep LSTM等,模型的训练方法为通用的神经网络训练方法,在此不在赘述。注意力分配概率分布的计算方式可以有很多种,经过测试后优选使用表现较好的linear after MLP方法。
接着,以文本中各个词对应的注意力值作为权重,对问题向量进行加权平均,得到文本中各个词对应的第一向量,即,将注意力分配概率分布A的每一行作为权 值,对问题向量X′ 1、X′ 2、X′ 3进行加权平均,得到文本中各个词对应的第一向量,例如,文本中第一个词“今天”对应的第一向量为W 1=α 1,1X′ 12,1X′ 23,1X′ 3,按照上述方法一共得到14个第一向量W 1、W 2、……、W 14。其中,为了保证权重的客观性,已预先对注意力分配概率分布A中每一行的注意力值进行了归一化处理,如,使α 1,12,13,1=1。
然后,从文本中各个词对应的注意力值中取最大值,即,取注意力分配概率分布A中每行的最大值,得到14个最大值max{α 1,1,α 2,1,α 3,1}、……max{α 1,14,α 2,14,α 3,14},对14个最大值进行归一化得到(β 12,…,β 14),以归一化后的最大值(β 12,…,β 14)作为权重,对文本向量进行加权平均,得到第二向量U=β 1Y′ 12Y′ 2+…+β 14Y′ 14
进一步地,步骤S104具体包括:
步骤S501、将第一向量和第二向量输入第二神经网络,得到文本中各个词作为答案起始点的第一概率值;
步骤S502、将第一向量、第二向量和第一概率值输入第三神经网络,得到文本中各个词作为答案终止点的第二概率值;
步骤S503、根据第一概率值和第二概率值,计算文本中各个词之间的段落作为答案的第三概率值,取最大的第三概率值对应的段落作为问题的答案。
其中,第二神经网络和第三神经网络优选双向LSTM(时间递归神经网络)。
接上述例子,首先,将14个第一向量W 1、W 2、……、W 14和第二向量U输入第一双向LSTM,得到输出的14个第一概率值{P 1,P 2,……,P 14},其中,P 1表示文本中第一个词“今天”作为答案起始点的概率。
接着,将第一概率值{P 1,P 2,……,P 14}、14个第一向量W 1、W 2、……、W 14和第二向量U输入第二双向LSTM,得到输出的14个第二概率值{Q 1,Q 2,……,Q 14},其中,Q 1表示文本中第一个词“今天”作为答案终止点的概率。
最后,根据第一概率值和第二概率值,计算文本中各个词之间的段落作为答案的第三概率值,即,计算第一概率数值{P 1,P 2,……,P 14}与第二概率值{Q 1,Q 2,……,Q 14}两两组合的乘积P i·Q j,作为第三概率值,其中,i=1,2…,14,j=1,2…,14,且i<j,取所有第三概率值P i·Q j中的最大值,即找到一组答案起始点在答案终止点之前,且第三概率值最大的组合,该组合对应的答案起始点和答案终止点之间的段落即为问题的答案。
基于与上述基于机器阅读理解的智能对话方法相同的发明构思,如图4所示,本申请实施例还提供了一种基于机器阅读理解的智能对话装置40,包括:
文本获取单元401,用于获取用户提出的问题与问题对应的文本;
预处理单元402,用于对问题和文本进行分词处理和向量化处理,得到问题中各个词对应的问题向量和文本中各个词对应的文本向量;
注意力计算单元403,用于将问题向量和文本向量输入注意力模型,得到第一向量和第二向量,第一向量用于指示问题对于注意到文本中任一词的影响度,第二向量用于指示文本对于生成问题的影响度;
答案定位单元404,用于根据第一向量和第二向量在文本中确定答案起始点和答案终止点,并将答案起始点和答案终止点之间的段落确定为问题的答案。
进一步地,文本获取单元401具体用于:获取用户提出的问题,在网络和/或数据库中搜索与问题对应的文本。
进一步地,如图5所示,预处理单元402包括:
分词子单元501,用于分别对问题和文本进行分词处理;
向量化子单元502,用于分别将问题和文本的分词结果输入向量化模型,得到问题中各个词对应的第一问题向量和文本中各个词对应的第一文本向量;
优化子单元503,用于利用双向循环神经网络更新第一问题向量和第一文本向量,得到第一问题向量对应的问题向量和第一文本向量对应的文本向量。
进一步地,如图6所示,预处理单元中还包括过滤子单元504,过滤子单元用于去除文本的分词结果和问题的分词结果中的标点符号。
进一步地,注意力计算单元403具体用于:
将问题向量和文本向量输入基于注意力机制的第一神经网络,得到注意力分配概率分布,注意力分配概率分布中的注意力值用于指示问题中任一词对于注意到文本中任一词的影响度;
以文本中各个词对应的注意力值作为权重,对问题向量进行加权平均,得到文本中各个词对应的第一向量;
从文本中各个词对应的注意力值中取最大值,将对文本中各个词对应的最大值进行归一化,以归一化后的最大值作为权重,对文本向量进行加权平均,得到第二向量。
进一步地,答案定位单元404具体用于:
将第一向量和第二向量输入第二神经网络,得到文本中各个词作为答案起始点的第一概率值;
将第一向量、第二向量和第一概率值输入第三神经网络,得到文本中各个词作 为答案终止点的第二概率值;
根据第一概率值和第二概率值,计算文本中各个词之间的段落作为答案的第三概率值,取最大的第三概率值对应的段落作为问题的答案。
其中,第二神经网络和第三神经网络均为双向LSTM时间递归神经网络。
本实施例的基于机器阅读理解的智能对话装置与基于机器阅读理解的智能对话方法采用相同的发明构思,能够取得相同的技术效果,在此不再赘述。
基于与上述基于机器阅读理解的智能对话方法相同的发明构思,本申请实施例还提供了一种基于机器阅读理解的智能对话终端,其包括:一个或多个处理器;存储器;一个或多个应用程序,其中一个或多个应用程序被存储在存储器中并被配置为由一个或多个处理器执行,一个或多个程序配置用于:执行上述任一实施例中的基于机器阅读理解的智能对话方法。
图7为一个实施例中基于机器阅读理解的智能对话终端的内部结构示意图。如图7所示,该终端包括通过***总线连接的处理器、非易失性存储介质、存储器和网络接口。其中,该计算机设备的非易失性存储介质存储有操作***、数据库和计算机可读指令,数据库中可存储有控件信息序列,该计算机可读指令被处理器执行时,可使得处理器实现一种基于机器阅读理解的智能对话方法。该计算机设备的处理器用于提供计算和控制能力,支撑整个计算机设备的运行。该计算机设备的存储器中可存储有计算机可读指令,该计算机可读指令被处理器执行时,可使得处理器执行一种基于机器阅读理解的智能对话方法。该计算机设备的网络接口用于与终端连接通信。本领域技术人员可以理解,图7中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。
本实施例提供的基于机器阅读理解的智能对话终端,采用了与上述基于机器阅读理解的智能对话方法相同的发明构思,具有相同的有益效果,在此不再赘述。
基于与上述基于机器阅读理解的智能对话方法相同的发明构思,本申请实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现上述任一实施例的基于机器阅读理解的智能对话方法。
上述提到的存储介质可以是只读存储器,磁盘或光盘等。
应该理解的是,虽然附图的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明, 这些步骤的执行并没有严格的顺序限制,其可以以其他的顺序执行。而且,附图的流程图中的至少一部分步骤可以包括多个子步骤或者多个阶段,这些子步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,其执行顺序也不必然是依次进行,而是可以与其他步骤或者其他步骤的子步骤或者阶段的至少一部分轮流或者交替地执行。
以上仅是本申请的部分实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本申请原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本申请的保护范围。

Claims (20)

  1. 一种基于机器阅读理解的智能对话方法,包括如下步骤:
    获取用户提出的问题与所述问题对应的文本;
    对所述问题和所述文本进行分词处理和向量化处理,得到所述问题中各个词对应的问题向量和所述文本中各个词对应的文本向量;
    将所述问题向量和所述文本向量输入注意力模型,得到第一向量和第二向量,所述第一向量用于指示所述问题对于注意到所述文本中任一词的影响度,所述第二向量用于指示所述文本对于生成所述问题的影响度;
    根据所述第一向量和所述第二向量在所述文本中确定答案起始点和答案终止点,并将所述答案起始点和所述答案终止点之间的段落确定为所述问题的答案。
  2. 根据权利要求1所述的方法,所述获取用户提出的问题与所述问题对应的文本,包括:
    获取用户提出的问题,在网络和/或数据库中搜索与所述问题对应的文本。
  3. 根据权利要求1所述的方法,所述对所述问题和所述文本进行分词处理和向量化处理,得到所述问题中各个词对应的问题向量和所述文本中各个词对应的文本向量,包括:
    分别对所述问题和所述文本进行分词处理;
    分别将所述问题和所述文本的分词结果输入向量化模型,得到所述问题中各个词对应的第一问题向量和所述文本中各个词对应的第一文本向量;
    利用双向循环神经网络更新所述第一问题向量和所述第一文本向量,得到所述第一问题向量对应的问题向量和所述第一文本向量对应的文本向量。
  4. 根据权利要求3所述的方法,所述分别将所述问题和所述文本的分词结果输入向量化模型之前,所述方法还包括:
    去除所述文本的分词结果和所述问题的分词结果中的标点符号。
  5. 根据权利要求1所述的方法,所述将所述问题向量和所述文本向量输入注意力模型,得到第一向量和第二向量,包括:
    将所述问题向量和所述文本向量输入基于注意力机制的第一神经网络,得到注意力分配概率分布,所述注意力分配概率分布中的注意力值用于指示所述问题中任一词对于注意到所述文本中任一词的影响度;
    以所述文本中各个词对应的注意力值作为权重,对所述问题向量进行加权平 均,得到所述文本中各个词对应的第一向量;
    从所述文本中各个词对应的注意力值中取最大值,将对所述文本中各个词对应的最大值进行归一化,以归一化后的最大值作为权重,对所述文本向量进行加权平均,得到第二向量。
  6. 根据权利要求1所述的方法,所述根据所述第一向量和所述第二向量在所述文本中确定答案起始点和答案终止点,并将所述答案起始点和所述答案终止点之间的段落确定为所述问题的答案,包括:
    将所述第一向量和所述第二向量输入第二神经网络,得到所述文本中各个词作为答案起始点的第一概率值;
    将所述第一向量、所述第二向量和所述第一概率值输入第三神经网络,得到所述文本中各个词作为答案终止点的第二概率值;
    根据所述第一概率值和所述第二概率值,计算所述文本中各个词之间的段落作为答案的第三概率值,取最大的第三概率值对应的段落作为所述问题的答案。
  7. 根据权利要求6所述的方法,所述第二神经网络和所述第三神经网络均为双向LSTM时间递归神经网络。
  8. 一种基于机器阅读理解的智能对话装置,包括:
    文本获取单元,用于获取用户提出的问题与所述问题对应的文本;
    预处理单元,用于对所述问题和所述文本进行分词处理和向量化处理,得到所述问题中各个词对应的问题向量和所述文本中各个词对应的文本向量;
    注意力计算单元,用于将所述问题向量和所述文本向量输入注意力模型,得到第一向量和第二向量,所述第一向量用于指示所述问题对于注意到所述文本中任一词的影响度,所述第二向量用于指示所述文本对于生成所述问题的影响度;
    答案定位单元,用于根据所述第一向量和所述第二向量在所述文本中确定答案起始点和答案终止点,并将所述答案起始点和所述答案终止点之间的段落确定为所述问题的答案。
  9. 一种基于机器阅读理解的智能对话终端,其包括:
    一个或多个处理器;
    存储器;
    一个或多个应用程序,其中所述一个或多个应用程序被存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个程序配置用于:执行一种基于机器阅读理解的智能对话方法,所述方法包括如下步骤:
    获取用户提出的问题与所述问题对应的文本;
    对所述问题和所述文本进行分词处理和向量化处理,得到所述问题中各个词对应的问题向量和所述文本中各个词对应的文本向量;
    将所述问题向量和所述文本向量输入注意力模型,得到第一向量和第二向量,所述第一向量用于指示所述问题对于注意到所述文本中任一词的影响度,所述第二向量用于指示所述文本对于生成所述问题的影响度;
    根据所述第一向量和所述第二向量在所述文本中确定答案起始点和答案终止点,并将所述答案起始点和所述答案终止点之间的段落确定为所述问题的答案。
  10. 根据权利要求9所述的智能对话终端,所述获取用户提出的问题与所述问题对应的文本,包括:
    获取用户提出的问题,在网络和/或数据库中搜索与所述问题对应的文本。
  11. 根据权利要求9所述的智能对话终端,所述对所述问题和所述文本进行分词处理和向量化处理,得到所述问题中各个词对应的问题向量和所述文本中各个词对应的文本向量,包括:
    分别对所述问题和所述文本进行分词处理;
    分别将所述问题和所述文本的分词结果输入向量化模型,得到所述问题中各个词对应的第一问题向量和所述文本中各个词对应的第一文本向量;
    利用双向循环神经网络更新所述第一问题向量和所述第一文本向量,得到所述第一问题向量对应的问题向量和所述第一文本向量对应的文本向量。
  12. 根据权利要求11所述的智能对话终端,所述分别将所述问题和所述文本的分词结果输入向量化模型之前,所述方法还包括:
    去除所述文本的分词结果和所述问题的分词结果中的标点符号。
  13. 根据权利要求9所述的智能对话终端,所述将所述问题向量和所述文本向量输入注意力模型,得到第一向量和第二向量,包括:
    将所述问题向量和所述文本向量输入基于注意力机制的第一神经网络,得到注意力分配概率分布,所述注意力分配概率分布中的注意力值用于指示所述问题中任一词对于注意到所述文本中任一词的影响度;
    以所述文本中各个词对应的注意力值作为权重,对所述问题向量进行加权平均,得到所述文本中各个词对应的第一向量;
    从所述文本中各个词对应的注意力值中取最大值,将对所述文本中各个词对应的最大值进行归一化,以归一化后的最大值作为权重,对所述文本向量进行加权平 均,得到第二向量。
  14. 根据权利要求9所述的智能对话终端,所述根据所述第一向量和所述第二向量在所述文本中确定答案起始点和答案终止点,并将所述答案起始点和所述答案终止点之间的段落确定为所述问题的答案,包括:
    将所述第一向量和所述第二向量输入第二神经网络,得到所述文本中各个词作为答案起始点的第一概率值;
    将所述第一向量、所述第二向量和所述第一概率值输入第三神经网络,得到所述文本中各个词作为答案终止点的第二概率值;
    根据所述第一概率值和所述第二概率值,计算所述文本中各个词之间的段落作为答案的第三概率值,取最大的第三概率值对应的段落作为所述问题的答案。
  15. 根据权利要求14所述的智能对话终端,所述第二神经网络和所述第三神经网络均为双向LSTM时间递归神经网络。
  16. 一种计算机可读非易失性存储介质,其上存储有计算机程序,该程序被处理器执行时实现一种基于机器阅读理解的智能对话方法,所述方法包括如下步骤:
    获取用户提出的问题与所述问题对应的文本;
    对所述问题和所述文本进行分词处理和向量化处理,得到所述问题中各个词对应的问题向量和所述文本中各个词对应的文本向量;
    将所述问题向量和所述文本向量输入注意力模型,得到第一向量和第二向量,所述第一向量用于指示所述问题对于注意到所述文本中任一词的影响度,所述第二向量用于指示所述文本对于生成所述问题的影响度;
    根据所述第一向量和所述第二向量在所述文本中确定答案起始点和答案终止点,并将所述答案起始点和所述答案终止点之间的段落确定为所述问题的答案。
  17. 根据权利要求16所述的计算机可读非易失性存储介质,所述获取用户提出的问题与所述问题对应的文本,包括:
    获取用户提出的问题,在网络和/或数据库中搜索与所述问题对应的文本。
  18. 根据权利要求16所述的计算机可读非易失性存储介质,所述对所述问题和所述文本进行分词处理和向量化处理,得到所述问题中各个词对应的问题向量和所述文本中各个词对应的文本向量,包括:
    分别对所述问题和所述文本进行分词处理;
    分别将所述问题和所述文本的分词结果输入向量化模型,得到所述问题中各个词对应的第一问题向量和所述文本中各个词对应的第一文本向量;
    利用双向循环神经网络更新所述第一问题向量和所述第一文本向量,得到所述第一问题向量对应的问题向量和所述第一文本向量对应的文本向量。
  19. 根据权利要求18所述的计算机可读非易失性存储介质,所述分别将所述问题和所述文本的分词结果输入向量化模型之前,所述方法还包括:
    去除所述文本的分词结果和所述问题的分词结果中的标点符号。
  20. 根据权利要求16所述的计算机可读非易失性存储介质,所述将所述问题向量和所述文本向量输入注意力模型,得到第一向量和第二向量,包括:
    将所述问题向量和所述文本向量输入基于注意力机制的第一神经网络,得到注意力分配概率分布,所述注意力分配概率分布中的注意力值用于指示所述问题中任一词对于注意到所述文本中任一词的影响度;
    以所述文本中各个词对应的注意力值作为权重,对所述问题向量进行加权平均,得到所述文本中各个词对应的第一向量;
    从所述文本中各个词对应的注意力值中取最大值,将对所述文本中各个词对应的最大值进行归一化,以归一化后的最大值作为权重,对所述文本向量进行加权平均,得到第二向量。
PCT/CN2019/070350 2018-06-21 2019-01-04 基于机器阅读理解的智能对话方法、装置、终端 WO2019242297A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810642836.XA CN109086303B (zh) 2018-06-21 2018-06-21 基于机器阅读理解的智能对话方法、装置、终端
CN201810642836.X 2018-06-21

Publications (1)

Publication Number Publication Date
WO2019242297A1 true WO2019242297A1 (zh) 2019-12-26

Family

ID=64840084

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/070350 WO2019242297A1 (zh) 2018-06-21 2019-01-04 基于机器阅读理解的智能对话方法、装置、终端

Country Status (2)

Country Link
CN (1) CN109086303B (zh)
WO (1) WO2019242297A1 (zh)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111428467A (zh) * 2020-02-19 2020-07-17 平安科技(深圳)有限公司 生成阅读理解的问题题目的方法、装置、设备及存储介质
CN111753521A (zh) * 2020-06-28 2020-10-09 深圳壹账通智能科技有限公司 基于人工智能的阅读理解方法及相关设备
CN112163405A (zh) * 2020-09-08 2021-01-01 北京百度网讯科技有限公司 问题的生成方法和装置
CN112464643A (zh) * 2020-11-26 2021-03-09 广州视源电子科技股份有限公司 一种机器阅读理解方法、装置、设备及存储介质
CN112764784A (zh) * 2021-02-03 2021-05-07 河南工业大学 基于神经机器翻译的软件缺陷自动修复方法及装置
CN113239148A (zh) * 2021-05-14 2021-08-10 廖伟智 基于机器阅读理解的科技资源检索方法
CN113300813A (zh) * 2021-05-27 2021-08-24 中南大学 基于注意力的针对文本的联合信源信道方法
CN113535918A (zh) * 2021-07-14 2021-10-22 梁晨 预训练对偶注意力神经网络语义推断对话检索方法及***、检索设备、存储介质
CN114638365A (zh) * 2022-05-17 2022-06-17 之江实验室 一种机器阅读理解推理方法及装置、电子设备、存储介质

Families Citing this family (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109086303B (zh) * 2018-06-21 2021-09-28 深圳壹账通智能科技有限公司 基于机器阅读理解的智能对话方法、装置、终端
CN109766423A (zh) * 2018-12-29 2019-05-17 上海智臻智能网络科技股份有限公司 基于神经网络的问答方法及装置、存储介质、终端
CN109918560B (zh) * 2019-01-09 2024-03-12 平安科技(深圳)有限公司 一种基于搜索引擎的问答方法和装置
CN109753661B (zh) * 2019-01-11 2022-12-02 国信优易数据股份有限公司 一种机器阅读理解方法、装置、设备及存储介质
CN110134967A (zh) * 2019-05-22 2019-08-16 北京金山数字娱乐科技有限公司 文本处理方法、装置、计算设备及计算机可读存储介质
CN110399472B (zh) * 2019-06-17 2022-07-15 平安科技(深圳)有限公司 面试提问提示方法、装置、计算机设备及存储介质
CN110287290A (zh) * 2019-06-26 2019-09-27 平安科技(深圳)有限公司 基于阅读理解的营销线索提取方法、装置及计算机可读存储介质
CN110442691A (zh) * 2019-07-04 2019-11-12 平安科技(深圳)有限公司 机器阅读理解中文的方法、装置和计算机设备
CN112445887B (zh) * 2019-08-29 2024-05-03 南京大学 基于检索的机器阅读理解***的实现方法及装置
CN111291841B (zh) * 2020-05-13 2020-08-21 腾讯科技(深圳)有限公司 图像识别模型训练方法、装置、计算机设备和存储介质
CN111814466A (zh) * 2020-06-24 2020-10-23 平安科技(深圳)有限公司 基于机器阅读理解的信息抽取方法、及其相关设备
CN111813989B (zh) * 2020-07-02 2023-07-18 中国联合网络通信集团有限公司 信息处理方法、设备及存储介质
CN111813961B (zh) * 2020-08-25 2020-12-18 腾讯科技(深圳)有限公司 基于人工智能的数据处理方法、装置及电子设备
CN113239165B (zh) * 2021-05-17 2023-04-18 山东新一代信息产业技术研究院有限公司 基于云化机器人的阅读理解方法、***及存储介质
CN113505219A (zh) * 2021-06-15 2021-10-15 北京三快在线科技有限公司 文本处理方法、装置、电子设备及计算机可读存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106776562A (zh) * 2016-12-20 2017-05-31 上海智臻智能网络科技股份有限公司 一种关键词提取方法和提取***
CN107562792A (zh) * 2017-07-31 2018-01-09 同济大学 一种基于深度学习的问答匹配方法
CN108170816A (zh) * 2017-12-31 2018-06-15 厦门大学 一种基于深度神经网络的智能视觉问答模型
CN109086303A (zh) * 2018-06-21 2018-12-25 深圳壹账通智能科技有限公司 基于机器阅读理解的智能对话方法、装置、终端

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101354714B (zh) * 2008-09-09 2010-09-08 浙江大学 一种基于概率潜在语义分析的问题推荐方法
CN106844368B (zh) * 2015-12-03 2020-06-16 华为技术有限公司 用于人机对话的方法、神经网络***和用户设备
US10230751B2 (en) * 2016-02-09 2019-03-12 International Business Machines Corporation Forecasting and classifying cyber attacks using neural embeddings migration
CN106484664B (zh) * 2016-10-21 2019-03-01 竹间智能科技(上海)有限公司 一种短文本间相似度计算方法
CN106570708B (zh) * 2016-10-31 2020-09-11 厦门快商通科技股份有限公司 一种智能客服知识库的管理方法及***
CN107220296B (zh) * 2017-04-28 2020-01-17 北京拓尔思信息技术股份有限公司 问答知识库的生成方法、神经网络的训练方法以及设备
CN108021705B (zh) * 2017-12-27 2020-10-23 鼎富智能科技有限公司 一种答案生成方法及装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106776562A (zh) * 2016-12-20 2017-05-31 上海智臻智能网络科技股份有限公司 一种关键词提取方法和提取***
CN107562792A (zh) * 2017-07-31 2018-01-09 同济大学 一种基于深度学习的问答匹配方法
CN108170816A (zh) * 2017-12-31 2018-06-15 厦门大学 一种基于深度神经网络的智能视觉问答模型
CN109086303A (zh) * 2018-06-21 2018-12-25 深圳壹账通智能科技有限公司 基于机器阅读理解的智能对话方法、装置、终端

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
LIU, FEILONG ET AL.: "Attention of Bilinear Function Based Bi-LSTM Model for Machine Reading Comprehension", COMPUTER SCIENCE, vol. 44, no. 6A, 30 June 2017 (2017-06-30), pages 92 - 96; 122, ISSN: 1002-137X *
RONG, GUANGHUI ET AL.: "Question Answer Matching Method Based on Deep Learning", JOURNAL OF COMPUTER APPLICATIONS, vol. 37, no. 10, 10 October 2017 (2017-10-10), ISSN: 1001-9081 *

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111428467A (zh) * 2020-02-19 2020-07-17 平安科技(深圳)有限公司 生成阅读理解的问题题目的方法、装置、设备及存储介质
CN111428467B (zh) * 2020-02-19 2024-05-07 平安科技(深圳)有限公司 生成阅读理解的问题题目的方法、装置、设备及存储介质
CN111753521A (zh) * 2020-06-28 2020-10-09 深圳壹账通智能科技有限公司 基于人工智能的阅读理解方法及相关设备
CN111753521B (zh) * 2020-06-28 2023-03-28 深圳壹账通智能科技有限公司 基于人工智能的阅读理解方法及相关设备
CN112163405A (zh) * 2020-09-08 2021-01-01 北京百度网讯科技有限公司 问题的生成方法和装置
CN112464643A (zh) * 2020-11-26 2021-03-09 广州视源电子科技股份有限公司 一种机器阅读理解方法、装置、设备及存储介质
CN112464643B (zh) * 2020-11-26 2022-11-15 广州视源电子科技股份有限公司 一种机器阅读理解方法、装置、设备及存储介质
CN112764784B (zh) * 2021-02-03 2022-10-11 河南工业大学 基于神经机器翻译的软件缺陷自动修复方法及装置
CN112764784A (zh) * 2021-02-03 2021-05-07 河南工业大学 基于神经机器翻译的软件缺陷自动修复方法及装置
CN113239148A (zh) * 2021-05-14 2021-08-10 廖伟智 基于机器阅读理解的科技资源检索方法
CN113300813A (zh) * 2021-05-27 2021-08-24 中南大学 基于注意力的针对文本的联合信源信道方法
CN113300813B (zh) * 2021-05-27 2022-08-30 中南大学 基于注意力的针对文本的联合信源信道方法
CN113535918A (zh) * 2021-07-14 2021-10-22 梁晨 预训练对偶注意力神经网络语义推断对话检索方法及***、检索设备、存储介质
CN114638365A (zh) * 2022-05-17 2022-06-17 之江实验室 一种机器阅读理解推理方法及装置、电子设备、存储介质

Also Published As

Publication number Publication date
CN109086303A (zh) 2018-12-25
CN109086303B (zh) 2021-09-28

Similar Documents

Publication Publication Date Title
WO2019242297A1 (zh) 基于机器阅读理解的智能对话方法、装置、终端
US11087166B2 (en) Training method of image-text matching model, bi-directional search method, and relevant apparatus
US11294953B2 (en) Similar face retrieval method, device and storage medium
US10650102B2 (en) Method and apparatus for generating parallel text in same language
WO2020177282A1 (zh) 一种机器对话方法、装置、计算机设备及存储介质
WO2020140635A1 (zh) 文本匹配方法、装置及存储介质、计算机设备
US20210168098A1 (en) Providing local service information in automated chatting
US11782998B2 (en) Embedding based retrieval for image search
CN111241237B (zh) 一种基于运维业务的智能问答数据处理方法及装置
WO2023020005A1 (zh) 神经网络模型的训练方法、图像检索方法、设备和介质
US20090132515A1 (en) Method and Apparatus for Performing Multi-Phase Ranking of Web Search Results by Re-Ranking Results Using Feature and Label Calibration
US20210279622A1 (en) Learning with limited supervision for question-answering with light-weight markov models
US11977567B2 (en) Method of retrieving query, electronic device and medium
WO2020215683A1 (zh) 基于卷积神经网络的语义识别方法及装置、非易失性可读存储介质、计算机设备
US11836174B2 (en) Method and apparatus of establishing similarity model for retrieving geographic location
US11379527B2 (en) Sibling search queries
WO2023207096A1 (zh) 一种实体链接方法、装置、设备及非易失性可读存储介质
US20240177506A1 (en) Method and Apparatus for Generating Captioning Device, and Method and Apparatus for Outputting Caption
CN113342944B (zh) 一种语料泛化方法、装置、设备及存储介质
CN112307738B (zh) 用于处理文本的方法和装置
CN115098722B (zh) 文本和图像的匹配方法、装置、电子设备和存储介质
CN114547273B (zh) 问题回答方法及相关装置、电子设备、存储介质
WO2020151318A1 (zh) 基于爬虫模型的语料构建方法、装置及计算机设备
US20240126993A1 (en) Transformer-based text encoder for passage retrieval
CN117591656A (zh) 基于对比学习的智能对话问答方法及***

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19822033

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 07.05.2021)

122 Ep: pct application non-entry in european phase

Ref document number: 19822033

Country of ref document: EP

Kind code of ref document: A1