WO2021000675A1 - 机器阅读理解中文的方法、装置和计算机设备 - Google Patents

机器阅读理解中文的方法、装置和计算机设备 Download PDF

Info

Publication number
WO2021000675A1
WO2021000675A1 PCT/CN2020/093107 CN2020093107W WO2021000675A1 WO 2021000675 A1 WO2021000675 A1 WO 2021000675A1 CN 2020093107 W CN2020093107 W CN 2020093107W WO 2021000675 A1 WO2021000675 A1 WO 2021000675A1
Authority
WO
WIPO (PCT)
Prior art keywords
vector
chinese
text
question
answer
Prior art date
Application number
PCT/CN2020/093107
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 WO2021000675A1 publication Critical patent/WO2021000675A1/zh

Links

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/33Querying
    • G06F16/3331Query processing
    • G06F16/3332Query translation
    • G06F16/3337Translation of the query language, e.g. Chinese to English
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • G06F16/3347Query execution using vector based model

Definitions

  • This application relates to the field of artificial intelligence, in particular to a method, device and computer equipment for machine reading and understanding Chinese.
  • the machine reading comprehension of Chinese text has a low comprehension accuracy rate. For example, if there is a space between English words and words, the space is a natural word breaker. The word segmentation is accurate in the process, so the accuracy of the output answer is relatively high. The inventor found that Chinese word segmentation is different from English word segmentation. The word segmentation processing is more complicated. Different word segmentation processing will get different answers. For example, the word segmentation of "I want to go to school” can be divided into “I want, go, go” , Learning” can also be divided into “I want, go, go to school” or “I, want to go to school”, etc., then the corresponding semantics of the above different participles will change, and thus get Different understanding. Therefore, there is currently a need for a method of machine reading and comprehension that improves the accuracy of machine reading and comprehension of Chinese.
  • the main purpose of this application is to provide a method, device and computer equipment for machine reading and comprehension of Chinese, aiming to solve the problem of low accuracy of machine reading and comprehension of Chinese in the prior art.
  • this application proposes a method for machine reading and understanding Chinese, including:
  • the Chinese text of the first question and the first Chinese text are respectively input into a preset language model for vectorization to obtain the question vector of the Chinese text of the first question and the to-be-understood of the first Chinese text Vector, wherein the language model is BERT;
  • the question vector and the to-be-understood vector are input into a preset first Chinese machine reading comprehension model for calculation to obtain a first answer text corresponding to the Chinese text of the first question.
  • the embodiment of the present application also provides a device for machine reading and understanding Chinese, including:
  • the obtaining unit is used to obtain the Chinese text of the first question and the first Chinese text to be understood;
  • the vectorization unit is configured to input the first question Chinese text and the first Chinese text into a preset language model for vectorization, to obtain the question vector of the first question Chinese text, and the first question A vector of Chinese text to be understood, wherein the language model is BERT;
  • the calculation unit is configured to input the question vector and the to-be-understood vector into a preset first Chinese machine reading comprehension model for calculation to obtain a first answer text corresponding to the question text.
  • An embodiment of the present application further provides a computer device, including a memory and a processor, the memory stores a computer program, and the processor implements the steps of any one of the foregoing methods when the computer program is executed by the processor.
  • the embodiments of the present application also provide a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of any one of the methods described above are implemented.
  • the method, device and computer equipment for machine reading and comprehension of Chinese in the embodiments of this application use BERT to perform vectorization training on the Chinese text of the first question and the first Chinese text, and then use the preset first Chinese machine reading comprehension model Perform calculations to obtain the first answer text corresponding to the question text. Because there is no need to perform word segmentation processing on the first question Chinese text and the first Chinese text, there is no improper word segmentation, so the first answer text finally obtained The accuracy rate is higher.
  • FIG. 1 is a schematic flowchart of a method for machine reading and understanding Chinese in an embodiment of the present application
  • FIG. 2 is a structural block diagram of a device for machine reading and understanding Chinese in an embodiment of the present application
  • FIG. 3 is a schematic block diagram of the structure of a computer device according to an embodiment of the present application.
  • an embodiment of the present application provides a method for machine reading and understanding Chinese, including the steps:
  • the Chinese text of the first question and the first Chinese text are respectively input into a preset language model for vectorization to obtain a question vector of the Chinese text of the first question and a question vector of the Chinese text of the first question.
  • the Chinese text of the first question above refers to a question written in Chinese, such as "What is the starting time of the Sino-Japanese Sino-Japanese War of Jiawu?" etc.; the first Chinese text refers to an article written in Chinese, etc.
  • the content generally contains the answers to the questions in the Chinese text of the first question above.
  • the above language model is BERT.
  • BERT The full name of BERT is based on the two-way encoder representation of Transformer.
  • the training method of BERT determines that it can truly be contexual.
  • Representations contextual representations
  • pre-training pre-traied language model.
  • Use BERT to vectorize the Chinese text of the first question and the first Chinese text to be understood. Instead of segmenting the Chinese text of the first question and the first Chinese text, it is directly input into BERT for vectorization, so no The existence of different word segmentation causes different understanding problems, which can improve the accuracy of subsequent answers.
  • the first Chinese machine reading comprehension model can be any Chinese machine reading comprehension model in the prior art.
  • the basic principle is that the vector to be understood matches the problem vector similar to the problem vector.
  • the answer vector with the highest degree is then converted into the first answer text in Chinese, so I won’t repeat it here.
  • the aforementioned first question Chinese text and the first Chinese text are respectively input into a preset language model for vectorization to obtain the question vector of the first question Chinese text
  • the Step S2 of the to-be-understood vector of the first Chinese text includes:
  • S21 Vectorize the Chinese text of the first question and each character in the first Chinese text to obtain a character vector; and mark each character with a position vector to obtain a character position vector;
  • one of the difficulties of machine reading comprehension lies in the prediction of the answer boundary.
  • boundary prediction methods such as pointer network (pointer network model), etc., which will use RNN (recurrent neural network, Recurrent Neural). Network)
  • RNN recurrent neural network, Recurrent Neural). Network
  • the ability of neural network to realize the abstraction of data in time series completely abandons the RNN, and instead transfers the processed sentences into a large Transformer model for processing. Therefore, the position of each character must be marked in order to truly understand the context information.
  • the method for marking the position vector for each character is Positional Encoding method, this method is the position vector method, the so-called position vector is the vector obtained by vector training on the position where the character appears.
  • the step of inputting the question vector and the to-be-understood vector into a preset first Chinese machine reading comprehension model for calculation to obtain the first answer text corresponding to the Chinese text of the first question After S3, including:
  • S304 In a preset template vector database, search for the second vector group with the highest similarity to each of the first vector groups and the similarity reaches a preset first threshold;
  • the modification method is the above method.
  • the aforementioned template vector database stores a plurality of preset common vectors of common Chinese phrases, and common phrases corresponding to the common vectors. For example, the above-mentioned second vector of "Hello” which is composed of a vector of "You” and a vector of "Good” corresponding to "Hello” is stored.
  • the above specified number is at least greater than or equal to 2, that is, to group the first vector string to obtain multiple first vector groups.
  • the first vector string is "go to eat right away, when do you go", and then form “go to eat right away” ", "When are you” and "Go” three first vector groups, the last first vector group is composed of the vectors corresponding to the remaining text after other composition types. Then find a second vector group that can replace the first vector group in the template vector library.
  • the above-mentioned method for calculating the similarity between the first vector group and the second vector group can use any known algorithm in the prior art, which will not be repeated here, for example, the second vector group corresponding to the first vector group of "going to eat”
  • the Chinese corresponding to the vector group is "Go to eat right away", the second vector group corresponding to the first vector group of "When are you”, the Chinese corresponding to "When are you”, and the second vector group corresponding to "Go” is also "Go”, then the second answer text is finally "Go eat and put, when will you go”.
  • the second vector group with a similarity threshold greater than the second threshold is not found, there is no need to replace the first vector group; if a second vector group with 100% similarity to the first vector group is found Vector group, there is also no need to replace the first vector group.
  • the above-mentioned question vector and the to-be-understood vector are input into a preset first Chinese machine reading comprehension model for calculation to obtain the first answer text corresponding to the Chinese text of the first question
  • step S3 include:
  • a vector forms a first vector string (x1, x2, x3 ⁇ xn), where x is the first vector and n is an integer greater than 1;
  • the preset first combination vector (y1, y2) is found, the previous three first vectors are combined to obtain a second vector combination (x1, x2, x3), and the template vector In the database, search for the preset second combination vector (y1, y2, y3) with the greatest similarity to the second combination vector and greater than the second threshold; and so on, when the combination vector (y1, y2) is not obtained , Y3 ⁇ yn), then “In the first vector, replace the corresponding vector combination (x1, y2, y3, x2, x3 ⁇ xn-1), and solidify the combination vector (y1, y2, y3 ⁇ yn-1) into the first vector string "first solidification process;
  • the first answer text is the five words "I want to eat”, vectorize them, and the search order will get the five first vectors of "I", “Yes”, “Go”, “Eat” and "Meal”.
  • the five first vectors form (x1, x2, x3, x4, x5) the first vector string.
  • the above-mentioned first curing process and/or the second curing process are repeated until a third vector that is all cured vectors is obtained String (all the first vectors on the string are either replaced and solidified, or they are solidified).
  • a third answer text with more fluent sentences can be obtained.
  • the above-mentioned first Chinese text is a text formed by a respondent in answering a question in the Chinese text of the first question; said inputting said question vector and said to-be-understood vector to a preset first Chinese machine After calculating in the reading comprehension model to obtain the first answer text corresponding to the Chinese text of the first question, step S3 includes:
  • S333 Search a preset score-similarity list for a score corresponding to the similarity of the answer
  • the above process is the process of machine scoring.
  • the foregoing fourth answer text refers to a preset Chinese text, and the recorded content is the correct answer to the question in the foregoing first question text.
  • the foregoing methods for comparing the answer similarity between the fourth answer text and the first answer text include multiple methods, such as using the same vectorization rule to respectively vectorize the fourth answer text and the first answer text, and then calculate The similarity of two vectors, or, calculating the similarity of the sort order of each character, etc.
  • the above score-similarity list is a list in which the score and the similarity have a specified mapping relationship. For example, the similarity in a range corresponds to a fixed score. The higher the similarity is, the corresponding score is also The trend will be higher. It can quickly complete the machine scoring process, improve the efficiency of scoring and reduce the consumption of human resources.
  • step S1 of obtaining the Chinese text of the first question and the first Chinese text to be understood the method includes:
  • the above-mentioned Chinese reading comprehension data set uses the CMRC (Chinese Machine Reading Comprehension) 2018 data set provided by the Harbin Institute of Technology IFLYTEK Lab. This data set is currently the only one in the People’s Republic of China with relatively high quality. Gao's public Chinese reading comprehension data set.
  • This embodiment is the process of training to obtain the first Chinese machine reading comprehension model. When the similarity between the answer text output by the second Chinese machine reading comprehension model and the corresponding second answer text reaches a specified value, the training can be considered to be finished. .
  • the above-mentioned second Chinese machine reading comprehension model is a neural network model, such as a long and short-term memory model and other neural network models that implement reading supervision.
  • the specific training process is the standard training process of neural network, so I won’t repeat it here.
  • the aforementioned first question Chinese text and the first Chinese text are respectively input into a preset language model for vectorization to obtain the question vector of the first question Chinese text and the first Chinese text Before step S2 of the vector to be understood, it includes:
  • the Chinese text of the first question and the first Chinese text are used by the user as pure Chinese text, but it cannot prevent that the Chinese text of the first question and the first Chinese text do not contain foreign words.
  • the foreign language here refers to languages other than Chinese, such as English, Japanese, Korean, etc.
  • Translate the searched foreign words using the preset translation engine to obtain the corresponding Chinese and then replace the corresponding foreign words with Chinese to obtain the first question Chinese text and the first Chinese text that are pure Chinese, and improve the Chinese The accuracy of machine reading comprehension.
  • the Chinese text of the first question and the first Chinese text are respectively traversed, and characters that are not Chinese characters are extracted, and then the language type corresponding to the extracted characters is recognized, and then the corresponding translation engine is called according to the language type. Translation, and finally replace the corresponding foreign words with the translated Chinese.
  • the difference between Chinese and other characters can be distinguished according to the number of bytes of characters. For example, one Chinese character is two bytes, and one English character is one byte.
  • this application also provides a device for machine reading and understanding Chinese, including:
  • the obtaining unit 10 is used to obtain the Chinese text of the first question and the first Chinese text to be understood;
  • the vectorization unit 20 is configured to input the first question Chinese text and the first Chinese text into a preset language model for vectorization, to obtain a question vector of the first question Chinese text, and The to-be-understood vector of the first Chinese text, where the language model is BERT;
  • the calculation unit 30 is configured to input the question vector and the to-be-understood vector into a preset first Chinese machine reading comprehension model for calculation to obtain a first answer text corresponding to the Chinese text of the first question.
  • the vectorization unit 20 includes:
  • a character vector module for respectively vectorizing the first question Chinese text and each character in the first Chinese text to obtain a character vector; and marking each character with a position vector to obtain a character position vector;
  • the character merging module is used to merge the character vector and the character position vector corresponding to each character to obtain a question vector corresponding to the Chinese text of the first question, and a vector to be understood corresponding to the first Chinese text.
  • the device for machine reading and understanding Chinese further includes:
  • the first judgment and replacement unit is used to judge whether there are non-Chinese words in the first answer text, and if so, convert the non-Chinese words into corresponding Chinese, and replace them in the first answer text to obtain pure Chinese Text of the first answer;
  • the first vectorization unit is used to vectorize each Chinese character in the first answer text of the pure Chinese to obtain multiple first vectors corresponding to the first order of the characters in the first answer text of the pure Chinese , Multiple first vectors form a first vector string;
  • a first combining unit configured to form a group of a plurality of the first vectors according to the first order, and a specified number of the first vectors to obtain a plurality of first vector groups
  • the first searching unit is configured to search for each of the first vector groups in a preset template vector database to find the second vector group with the highest similarity and the similarity reaching the preset first threshold;
  • a replacement unit configured to, if the second vector group is found, replace the second vector group with the corresponding first vector group in the first vector string to obtain a second vector string;
  • the first conversion unit is used to convert the second vector string into Chinese to obtain the second answer text.
  • the device for machine reading and understanding Chinese further includes:
  • the second judgment unit is used to judge whether there are non-Chinese words in the first answer text, and if so, convert the non-Chinese words into corresponding Chinese, and replace them in the first answer text to obtain pure Chinese First answer text
  • the second vectorization unit is used to vectorize each Chinese character in the first answer text of the pure Chinese to obtain multiple first vectors corresponding to the first order of the characters in the first answer text of the pure Chinese ,
  • a plurality of the first vectors form a first vector string (x1, x2, x3 ⁇ xn), where x is the first vector, and n is an integer greater than 1;
  • the second search unit is configured to, according to the first order, first combine the first vector x1 with the first vector x2 to obtain a first vector combination (x1 , X2), and in the preset template vector database, search for the preset first combination vector (y1, y2) with the greatest similarity to the first combination vector (x1, x2) and greater than the preset second threshold. ), where y is a preset vector;
  • the first curing unit is configured to, if the preset first combination vector (y1, y2) is found, combine the previous three first vectors to obtain a second vector combination (x1, x2, x3), and In the template vector database, search for the preset second combination vector (y1, y2, y3) with the greatest similarity to the second combination vector and greater than the second threshold; and so on, when no combination is obtained Vector (y1, y2, y3 ⁇ yn), then “in the first vector, replace the corresponding Vector combination (x1, x2, x3 ⁇ xn-1), and solidify the combination vector (y1, y2, y3 ⁇ yn-1) into the first vector string "The first curing process;
  • the second curing unit is used to perform the second step of "curing the first vector combination (x1, x2) in the first vector string" if the second combination vector (y1, y2) is not found Curing process; at the same time, with the third first vector as the starting vector, repeat the first curing process and/or the second curing process until a third vector string that is all cured vectors is obtained;
  • the second conversion unit is used to convert the third vector string into Chinese to obtain the third answer text.
  • the above-mentioned first Chinese text is a text formed by a respondent in answering a question in the Chinese text of the first question; said inputting said question vector and said to-be-understood vector to a preset first Chinese machine After calculating in the reading comprehension model to obtain the first answer text corresponding to the Chinese text of the first question, the steps include:
  • the score is output as a score for the degree of understanding of the first Chinese text.
  • the device for machine reading and understanding Chinese further includes:
  • the acquiring data set unit is used to acquire a preset Chinese reading comprehension data set; wherein the Chinese reading comprehension data set includes the Chinese text of the second question, the second Chinese text to be understood, and the text of the fourth answer in a one-to-one correspondence. Multiple pieces of training data;
  • the training vector unit is used to vectorize each piece of training data by using the language model to obtain training data of the second question Chinese text vector, the second Chinese text vector, and the fourth answer text vector in a one-to-one correspondence;
  • the training unit is configured to input the training vector data into a preset second Chinese machine reading comprehension model for training to obtain the first Chinese machine reading comprehension model.
  • the device for machine reading and understanding Chinese further includes:
  • the above-mentioned units and modules are corresponding devices for executing the above-mentioned method embodiments, and are not described here.
  • an embodiment of the present application also provides a computer device.
  • the computer device may be a server, and its internal structure may be as shown in FIG. 3.
  • the computer equipment includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the computer designed processor is used to provide calculation and control capabilities.
  • the memory of the computer device includes a non-volatile storage medium and an internal memory.
  • the non-volatile storage medium stores an operating system, a computer program, and a database.
  • the internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium.
  • the database of the computer equipment is used to store data such as language models and various Chinese texts.
  • the network interface of the computer device is used to communicate with an external terminal through a network connection.
  • the computer program is executed by the processor to realize the method for machine reading and understanding Chinese described in any of the above embodiments.
  • the embodiments of the present application also provide a computer-readable storage medium.
  • the computer-readable storage medium may be nonvolatile or volatile, and a computer program is stored thereon, and the computer program is executed by a processor.
  • Non-volatile memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory.
  • Volatile memory may include random access memory (RAM) or external cache memory.
  • RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual-rate data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
  • SRAM static RAM
  • DRAM dynamic RAM
  • SDRAM synchronous DRAM
  • SDRAM dual-rate data rate SDRAM
  • SSRSDRAM dual-rate data rate SDRAM
  • ESDRAM enhanced SDRAM
  • SLDRAM synchronous Link (Synchlink) DRAM
  • SLDRAM synchronous Link (Synchlink) DRAM
  • Rambus direct RAM
  • DRAM direct memory bus dynamic RAM
  • RDRAM memory bus dynamic RAM

Abstract

本申请涉及人工智能领域,揭示了一种机器阅读理解中文的方法、装置和计算机设备,利用BERT对第一问题中文文本和所述第一中文文本进行向量化训练,然后利用预设的第一中文机器阅读理解模型中进行计算,得到对应所述问题文本的第一答案文本,因为无需对第一问题中文文本和所述第一中文文本进行分词处理所以不存在分词不当的情况发生,因此最终得到的第一答案文本的准确率更高。

Description

机器阅读理解中文的方法、装置和计算机设备
本申请要求于2019年7月4日提交中国专利局、申请号为201910597621.5,发明名称为“机器阅读理解中文的方法、装置和计算机设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及到人工智能领域,特别是涉及到一种机器阅读理解中文的方法、装置和计算机设备。
背景技术
中文文本的机器阅读理解相对于英文的机器阅读理解而言,理解准确率等不高,比如,英文单词与单词之间具有空格,该空格即为一个天然的分词符,在机器机器阅读理解的过程中分词准确,所以输出的答案的准确率相对较高。发明人发现,中文分词与英文分词不同,分词处理比较复杂,不同的分词处理,会得到不同的答案,比如,对“我要去上学”进行分词处理,可以分为“我要,去,上,学”,也可以分为“我要,去,上学”,又或者分为“我,要去上,学”等等,那么上述不同的分词,其对应的语义等会发生变化,从而得到不同的理解。所以,目前需要一种提高机器阅读理解中文正确率的机器阅读理解中文的方法。
技术问题
本申请的主要目的为提供一种机器阅读理解中文的方法、装置和计算机设备,旨在解决现有技术中机器阅读理解中文准确率低的问题。
技术解决方案
为了实现上述发明目的,本申请提出一种机器阅读理解中文的方法,包括:
获取第一问题中文文本,以及待理解的第一中文文本;
分别将所述第一问题中文文本和所述第一中文文本输入到预设的语言模型中进行向量化,得到所述第一问题中文文本的问题向量,以及所述第一中文文本的待理解向量,其中,所述语言模型为BERT;
将所述问题向量和所述待理解向量输入到预设的第一中文机器阅读理解模型中进行计算,得到对应所述第一问题中文文本的第一答案文本。
本申请实施例还提供一种机器阅读理解中文的装置,包括:
获取单元,用于获取第一问题中文文本,以及待理解的第一中文文本;
向量化单元,用于分别将所述第一问题中文文本和所述第一中文文本输入到预设的语言模型中进行向量化,得到所述第一问题中文文本的问题向量,以及所述第一中文文本的待理解向量,其中,所述语言模型为BERT;
计算单元,用于将所述问题向量和所述待理解向量输入到预设的第一中文机器阅读理解模型中进行计算,得到对应所述问题文本的第一答案文本。
本申请实施例还提供一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现上述任一项所述方法的步骤。
本申请实施例还提供一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述任一项所述的方法的步骤。
有益效果
本申请实施例的机器阅读理解中文的方法、装置和计算机设备,利用BERT对第一问题中文文本和所述第一中文文本进行向量化训练,然后利用预设的第一中文机器阅读理解模型中进行计算,得到对应所述问题文本的第一答案文本,因为无需对第一问题中文文本和所述第一中文文本进行分词处理所以不存在分词不当的情况发生,因此最终得到的第一答案文本的准确率更高。
附图说明
图1 是本申请一实施例中机器阅读理解中文的方法的流程示意图;
图2 是本申请一实施例中机器阅读理解中文的装置的结构框图;
图3 是本申请一实施例的计算机设备的结构示意框图。
本发明的最佳实施方式
参照图1,本申请实施例提供一种机器阅读理解中文的方法,包括步骤:
S1、获取第一问题中文文本,以及待理解的第一中文文本;
S2、分别将所述第一问题中文文本和所述第一中文文本输入到预设的语言模型中进行向量化,得到所述第一问题中文文本的问题向量,以及所述第一中文文本的待理解向量,其中,所述语言模型为BERT;
S3、将所述问题向量和所述待理解向量输入到预设的第一中文机器阅读理解模型中进行计算,得到对应所述第一问题中文文本的第一答案文本。
如上述步骤S1所述,上述第一问题中文文本是指利用中文撰写的问题,比如“中日甲午战争的开始时间是多少?”等;上述第一中文文本是指利用中文撰写的文章等,其内容一般包含有上述第一问题中文文本中问题的答案。
如上述步骤S2所述,上述语言模型为BERT,BERT的全称是基于Transformer的双向编码器表征,BERT的训练方法决定了他能真正做到contexual representations(上下文表征),比起其它的词向量表示方法,也是目前唯一一个可以真正做到deeply bidirectional(深度双向)的pre-traied(预训练)语言模型。使用BERT对第一问题中文文本,以及待理解的第一中文文本进行向量化,没有对第一问题中文文本和第一中文文本进行分词处理,而是直接输入到BERT中进行向量化,所以不存在分词不同而造成理解不同的问题发生,可以提高后续的答案的准确性。
如上述步骤S3所述,上述第一中文机器阅读理解模型可以为现有技术中的任意一种的中文机器阅读理解模型,其基本原理是,在待理解向量中匹配出与所述问题向量相似度最高的答案向量,然后将答案向量转换成中文的第一答案文本,在此不再赘述。
在一个实施例中,上述分别将所述第一问题中文文本和所述第一中文文本输入到预设的语言模型中进行向量化,得到所述第一问题中文文本的问题向量,以及所述第一中文文本的待理解向量的步骤S2,包括:
S21、分别对所述第一问题中文文本,以及所述第一中文文本中的每一个字符向量化,得到字符向量;以及给每一个字符标记位置向量,得到字符位置向量;
S22、将每一个字符对应的字符向量和字符位置向量合并,得到对应对所述第一问题中文文本的问题向量,以及对应所述第一中文文本的待理解向量。
在本实施例中,机器阅读理解的一个难点在于答案边界的预测,边界预测方法有很多,例如pointer network(指针网络模型)等,其会利用RNN(循环神经网络,Recurrent Neural Network)神经网络的能力,实现时间序列上对数据的抽象。而本申请中使用的BERT,完全抛弃了RNN,取而代之的是将经过处理的句子传入大型的Transformer模型中进行处理,所以,必须对每一字符的位置进行标记,以便于真正理解上下文信息。在本申请实施例中,给每一个字符标记位置向量的方法是Positional Encoding的方法,该方法即为位置向量的方法,所谓位置向量,就是对字符出现的位置进行向量训练而得到的向量。
在一个实施例中,上述将所述问题向量和所述待理解向量输入到预设的第一中文机器阅读理解模型中进行计算,得到对应所述第一问题中文文本的第一答案文本的步骤S3之后,包括:
S301、判断所述第一答案文本中是否存在非中文词语,若有,则将非中文词语转换成对应的中文,并替换到所述第一答案文本中,得到纯中文的第一答案文本;
S302、将所述纯中文的第一答案文本中的每一个汉字进行向量化,得到对应所述纯中文的第一答案文本中文字的第一顺序的多个第一向量,多个第一向量形成第一向量串;
S303、将多个所述第一向量按照所述第一顺序,每指定数量的所述第一向量形成一组,得到多个第一向量组;
S304、到预设的模板向量数据库中,各所述第一向量组查找与其相似度最高,且相似度达到预设的第一阈值的第二向量组;
S305、若查找到所述第二向量组,则将所述第二向量组替换所述第一向量串中对应的第一向量组,得到第二向量串;
S306、将所述第二向量串转换成中文,得到第二答案文本。
在本实施例中,因为第一答案文本是机器从第一中文文本中提取出的,可能存在语法错误等,比如第一答案文本为“去吃饭马上”,而其正确的表达应该为“马上去吃饭”,所以需要将第一答案文本修改为“马上去吃饭”,修改方法即为上述方法。上述模板向量数据库中存储有多个预设的中文常用词组的常用向量,以及与所述常用向量对应的常用词组。比如,存储有“你好”对应的由“你”的向量和“好”的组成的“你好”的上述第二向量等。上述指定数量至少大于等于2,即为将第一向量串进行分组,得到多个第一向量组,比如第一向量串是“去吃饭马上,你时什么候去”,然后形成“去吃饭马上”、“你时什么候”和“去”三个第一向量组,最后一个第一向量组是由其他组成型后剩余文字对应的向量组成的。然后在模板向量库中找到可以替换第一向量组的第二向量组。上述第一向量组和第二向量组的相似度计算方法可以利用现有技术中的任意一种已知算法,在此不再赘述,比如“去吃饭马上”的第一向量组对应的第二向量组对应的中文为“马上去吃饭”,“你时什么候”的第一向量组对应的第二向量组对应的中文为“你什么时候”,而“去”对应的第二向量组也为“去”,那么最终得到第二答案文本为“马上去吃放,你什么时候去”。在其它实施例中,如果没有找到与第一向量组相似度阈值大于第二阈值的第二向量组,则无需替换第一向量组;如果找到与第一向量组相似度为100%的第二向量组,同样无需替换第一向量组。
在另一个实施例中,上述将所述问题向量和所述待理解向量输入到预设的第一中文机器阅读理解模型中进行计算,得到对应所述第一问题中文文本的第一答案文本的步骤S3之后,包括:
S311、判断所述第一答案文本中是否存在非中文词语,若有,则将非中文词语转换成对应的中文,并替换到所述第一答案文本中,得到纯中文的第一答案文本;
S312、将所述纯中文的第一答案文本中的每一个汉字进行向量化,得到对应所述纯中文的第一答案文本中文字的第一顺序的多个第一向量,多个所述第一向量形成第一向量串(x1、x2、x3······xn),其中,x为第一向量,n为大于1的整数;
S313、按照所述第一顺序,先以第一个所述第一向量x1为起始向量,与第二个所述第一向量x2进行组合,得到第一向量组合(x1、x2),并在预设的模板向量数据库中,查找与所述第一组合向量(x1、x2)相似度最大,且大于预设的第二阈值的预设第一组合向量(y1、y2),其中y为预设的向量;
S314、若查找到所述预设第一组合向量(y1、y2),则以前三个所述第一向量进行组合,得到第二向量组合(x1、x2、x3),并在所述模板向量数据库中,查找与所述第二组合向量相似度最大,且大于所述第二阈值的预设第二组合向量(y1、y2、y3);以此类推,当未得到组合向量(y1、y2、y3······yn)时,则进行“在所述第一向量中,由组合向量(y1、y2、y3······yn-1)替换对应的向量组合(x1、x2、x3······xn-1),并将所述组合向量(y1、y2、y3······yn-1)固化到所述第一向量串中”的第一固化过程;
S315、若未查找到所述第二组合向量(y1、y2),则进行“将所述第一向量组合(x1、x2)固化所述第一向量串中”的第二固化过程;同时以第三个所述第一向量为起始向量,重复所述第一固化过程和/或所述第二固化过程,直到得到全部是固化的向量的第三向量串;
S316、将所述第三向量串转换成中文,得到第三答案文本。
在本实施例中,比如第一答案文本为“我要去吃饭”五个字,将其向量化,找顺序得到“我”“要”“去”“吃”“饭”五个第一向量,五个第一向量形成(x1、x2、x3、x4、x5)的第一向量串。然后现将“我”“要”两个向量组合得到(x1、x2),然后到模板向量数据库查找查找与所述第一向量组合(x1、x2)相似度最大,且大于预设的第二阈值的预设第一组合向量(y1、y2),如果存在第一组合向量(y1、y2),则将“我”“要”“去”三个第一向量组合,得到第二向量组合(x1、x2、x3),然后到模板向量数据库查找查找与所述第二向量组合(x1、x2、x3)相似度最大,且大于预设的第二阈值的预设第二组合向量(y1、y2、y3),如果存在第二组合向量(y1、y2、y3),则将“我”“要”“去”“吃”四个第一向量组合,得到第三向量组合(x1、x2、x3、x4、)继续上述的步骤,查找第三组合向量(y1、y2、y3、y4),如果不存在第三组合向量,则将第二组合向量(y1、y2、y3)替换第二向量组合(x1、x2、x3),并固化,然后以“吃”和“饭”的向量开始组合,重复上述步骤,直到将整个第一答案文本处理完毕。即从第一向量串中的第一个第一向量和第二个第一向量开始,重复上述第一固化过程和/或所述第二固化过程,直到得到全部是固化的向量的第三向量串(全部的第一向量串上的第一向量要么被替换固化,要么本身被固化)。将预设的组合向量不断地替换第一答案文本中各文字组合的向量组合,可以得到语句更加通顺的第三答案文本。
在一个实施例中,上述第一中文文本为答题者回答所述第一问题中文文本中问题形成的文本;所述将所述问题向量和所述待理解向量输入到预设的第一中文机器阅读理解模型中进行计算,得到对应所述第一问题中文文本的第一答案文本的步骤S3之后,包括:
S331、获取对应所述问题文本中问题的正确答案的第四答案文本;
S332、计算所述第四答案文本与所述第一答案文本的答案相似度;
S333、到预设的分值-相似度列表中查找与所述答案相似度对应的分值;
S334、将所述分值作为对所述第一中文文本理解程度的得分输出。
在本实施例中,上述过程即为机器评分的过程。上述第四答案文本是指预先设置的中文文本,其记载的内容是对应上述第一问题文本中问题的正确答案。上述比较第四答案文本与所述第一答案文本的答案相似度的方法包括多种,比如使用相同的向量化规则分别将所述第四答案文本与所述第一答案文本向量化,然后计算两个向量的相似度,又或者,计算每一个字符排序顺序的相似度等等。上述分值-相似度列表是一种分值和相似度呈指定映射关系的列表,比如,一个范围内的相似度,对应一个固定分值等,基本呈现相似度越高,对应的分值也会越高的趋势。可以快速地完成机器评分的过程,提高阅卷评分的效率,降低人力资源的消耗等。
在一个实施例中,上述获取第一问题中文文本,以及待理解的第一中文文本的步骤S1之前,包括:
S101、获取预设的中文阅读理解数据集;其中,中文阅读理解数据集包括成一一对应关系的第二问题中文文本、待理解的第二中文文本和第四答案文本的多条训练数据;
S102、利用所述语言模型给每一条训练数据进行向量化,得到呈一一对应关系的第二问题中文文本向量、第二中文文本向量和第四答案文本向量的训练数据;
S103、将所述训练向量数据输入到预设的第二中文机器阅读理解模型中进行训练,得到所述第一中文机器阅读理解模型。
在本实施例中,上述中文阅读理解数据集选用哈工大讯飞实验室提供的CMRC(Chinese Machine Reading Comprehension,中文机器阅读理解)2018数据集,该数据集目前是中华人民共和国国内唯一的、质量较高的公开的中文阅读理解数据集。本实施例即为训练得到第一中文机器阅读理解模型的过程,当第二中文机器阅读理解模型输出的答案文本与其对应的第二答案文本的像似度达到指定值时,既可以认为训练结束。上述第二中文机器阅读理解模型是一个神经网络模型,比如长短期记忆模型等实现阅读监督学的的神经网络模型。具体的训练过程为神经网络的标准训练过程,在此不再赘述
在一个实施例中,上述分别将所述第一问题中文文本和所述第一中文文本输入到预设的语言模型中进行向量化,得到第一问题中文文本的问题向量,以及第一中文文本的待理解向量的步骤S2之前,包括:
S201、分别在所述第一问题中文文本和第一中文文本查找外文单词;
S202、若查找到,则将查找到的外文单词翻译成中文,并将翻译得到的中文替换对应的外文单词。
在本实施例中,上述第一问题中文文本和第一中文文本是用户将其作为纯中文文本使用的,但是并不能杜绝第一问题中文文本和第一中文文本中不含有外文单词。这里的外文是指除中文以外的语言文字,如英语、日语、韩语等。将查找出的外文单词利用预设的翻译引擎对其进行翻译得到对应的中文,然后使用中文替换掉对应的外文单词,从而得到是纯中文的第一问题中文文本和第一中文文本,提高中文机器阅读理解的准确性。在本实施例中,分别遍历第一问题中文文本和第一中文文本,提取出不属于中文字符的字符,然后识别出提取出的字符对应的语言类型,然后根据语言类型调用对应的翻译引擎进行翻译,最后将翻译得到的中文替换其对应的外文单词。本实施例中,可以根据字符的字节数量不同而区分中文与其它文字的区别,比如,中文一个字符为两个字节,而英文一个字符为一个字节等。
参照图2,本申请还提供一种机器阅读理解中文的装置,包括:
获取单元10,用于获取第一问题中文文本,以及待理解的第一中文文本;
向量化单元20,用于分别将所述第一问题中文文本和所述第一中文文本输入到预设的语言模型中进行向量化,得到所述第一问题中文文本的问题向量,以及所述第一中文文本的待理解向量,其中,所述语言模型为BERT;
计算单元30,用于将所述问题向量和所述待理解向量输入到预设的第一中文机器阅读理解模型中进行计算,得到对应所述第一问题中文文本的第一答案文本。
在一个实施例中,上述向量化单元20,包括:
字符向量模块,用于分别对所述第一问题中文文本,以及所述第一中文文本中的每一个字符向量化,得到字符向量;以及给每一个字符标记位置向量,得到字符位置向量;
字符合并模块,用于将每一个字符对应的字符向量和字符位置向量合并,得到对应对所述第一问题中文文本的问题向量,以及对应所述第一中文文本的待理解向量。
在一个实施例中,上述机器阅读理解中文的装置还包括:
第一判断替换单元,用于判断所述第一答案文本中是否存在非中文词语,若有,则将非中文词语转换成对应的中文,并替换到所述第一答案文本中,得到纯中文的第一答案文本;
第一向量化单元,用于将所述纯中文的第一答案文本中的每一个汉字进行向量化,得到对应所述纯中文的第一答案文本中文字的第一顺序的多个第一向量,多个第一向量形成第一向量串;
第一组合单元,用于将多个所述第一向量按照所述第一顺序,每指定数量的所述第一向量形成一组,得到多个第一向量组;
第一查找单元,用于到预设的模板向量数据库中,各所述第一向量组查找与其相似度最高,且相似度达到预设的第一阈值的第二向量组;
替换单元,用于若查找到所述第二向量组,则将所述第二向量组替换所述第一向量串中对应的第一向量组,得到第二向量串;
第一转换单元,用于将所述第二向量串转换成中文,得到第二答案文本。
在另一实施例中,上述机器阅读理解中文的装置还包括:
第二判断单元,用于判断所述第一答案文本中是否存在非中文词语,若有,则将非中文词语转换成对应的中文,并替换到所述第一答案文本中,得到纯中文的第一答案文本;
第二向量化单元,用于将所述纯中文的第一答案文本中的每一个汉字进行向量化,得到对应所述纯中文的第一答案文本中文字的第一顺序的多个第一向量,多个所述第一向量形成第一向量串(x1、x2、x3······xn),其中,x为第一向量,n为大于1的整数;
第二查找单元,用于按照所述第一顺序,先以第一个所述第一向量x1为起始向量,与第二个所述第一向量x2进行组合,得到第一向量组合(x1、x2),并在预设的模板向量数据库中,查找与所述第一组合向量(x1、x2)相似度最大,且大于预设的第二阈值的预设第一组合向量(y1、y2),其中y为预设的向量;
第一固化单元,用于若查找到所述预设第一组合向量(y1、y2),则以前三个所述第一向量进行组合,得到第二向量组合(x1、x2、x3),并在所述模板向量数据库中,查找与所述第二组合向量相似度最大,且大于所述第二阈值的预设第二组合向量(y1、y2、y3);以此类推,当未得到组合向量(y1、y2、y3······yn)时,则进行“在所述第一向量中,由组合向量(y1、y2、y3······yn-1)替换对应的向量组合(x1、x2、x3······xn-1),并将所述组合向量(y1、y2、y3······yn-1)固化到所述第一向量串中”的第一固化过程;
第二固化单元,用于若未查找到所述第二组合向量(y1、y2),则进行“将所述第一向量组合(x1、x2)固化所述第一向量串中”的第二固化过程;同时以第三个所述第一向量为起始向量,重复所述第一固化过程和/或所述第二固化过程,直到得到全部是固化的向量的第三向量串;
第二转换单元,用于将所述第三向量串转换成中文,得到第三答案文本。
在一个实施例中,上述第一中文文本为答题者回答所述第一问题中文文本中问题形成的文本;所述将所述问题向量和所述待理解向量输入到预设的第一中文机器阅读理解模型中进行计算,得到对应所述第一问题中文文本的第一答案文本的步骤之后,包括:
获取对应所述问题文本中问题的正确答案的第四答案文本;
计算所述第四答案文本与所述第一答案文本的答案相似度;
到预设的分值-相似度列表中查找与所述答案相似度对应的分值;
将所述分值作为对所述第一中文文本理解程度的得分输出。
在一个实施例中,上述机器阅读理解中文的装置还包括:
获取数据集单元,用于获取预设的中文阅读理解数据集;其中,中文阅读理解数据集包括成一一对应关系的第二问题中文文本、待理解的第二中文文本和第四答案文本的多条训练数据;
训练向量单元,用于利用所述语言模型给每一条训练数据进行向量化,得到呈一一对应关系的第二问题中文文本向量、第二中文文本向量和第四答案文本向量的训练数据;
训练单元,用于将所述训练向量数据输入到预设的第二中文机器阅读理解模型中进行训练,得到所述第一中文机器阅读理解模型。
在一个实施例中,上述机器阅读理解中文的装置还包括:
分别在所述第一问题中文文本和第一中文文本查找外文单词;
若查找到,则将查找到的外文单词翻译成中文,并将翻译得到的中文替换对应的外文单词。
上述各单元、模块为执行上述方法实施例的对应装置,在此不在一一展开说明。
参照图3,本申请实施例中还提供一种计算机设备,该计算机设备可以是服务器,其内部结构可以如图3所示。该计算机设备包括通过系统总线连接的处理器、存储器、网络接口和数据库。其中,该计算机设计的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统、计算机程序和数据库。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的数据库用于存储语言模型、各种中文文本等数据。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时以实现上述任一实施例中所述的机器阅读理解中文的方法。
本申请实施例中还提供一种一种计算机可读存储介质,计算机可读存储介质可以是非易失性,也可以是易失性,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述任一实施例中所述的机器阅读理解中文的方法。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储与一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的和实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可以包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM通过多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双速据率SDRAM(SSRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。

Claims (20)

  1. 一种机器阅读理解中文的方法,其中,包括:
    获取第一问题中文文本,以及待理解的第一中文文本;
    分别将所述第一问题中文文本和所述第一中文文本输入到预设的语言模型中进行向量化,得到所述第一问题中文文本的问题向量,以及所述第一中文文本的待理解向量,其中,所述语言模型为BERT;
    将所述问题向量和所述待理解向量输入到预设的第一中文机器阅读理解模型中进行计算,得到对应所述第一问题中文文本的第一答案文本。
  2. 根据权利要求1所述的机器阅读理解中文的方法,其中,所述分别将所述第一问题中文文本和所述第一中文文本输入到预设的语言模型中进行向量化,得到所述第一问题中文文本的问题向量,以及所述第一中文文本的待理解向量的步骤,包括:
    分别对所述第一问题中文文本,以及所述第一中文文本中的每一个字符向量化,得到字符向量;以及给每一个字符标记位置向量,得到字符位置向量;
    将每一个字符对应的字符向量和字符位置向量合并,得到对应对所述第一问题中文文本的问题向量,以及对应所述第一中文文本的待理解向量。
  3. 根据权利要求1所述的机器阅读理解中文的方法,其中,所述将所述问题向量和所述待理解向量输入到预设的第一中文机器阅读理解模型中进行计算,得到对应所述第一问题中文文本的第一答案文本的步骤之后,包括:
    判断所述第一答案文本中是否存在非中文词语,若有,则将非中文词语转换成对应的中文,并替换到所述第一答案文本中,得到纯中文的第一答案文本;
    将所述纯中文的第一答案文本中的每一个汉字进行向量化,得到对应所述纯中文的第一答案文本中文字的第一顺序的多个第一向量,多个第一向量形成第一向量串;
    将多个所述第一向量按照所述第一顺序,每指定数量的所述第一向量形成一组,得到多个第一向量组;
    到预设的模板向量数据库中,各所述第一向量组查找与其相似度最高,且相似度达到预设的第一阈值的第二向量组;
    若查找到所述第二向量组,则将所述第二向量组替换所述第一向量串中对应的第一向量组,得到第二向量串;
    将所述第二向量串转换成中文,得到第二答案文本。
  4. 根据权利要求1所述的机器阅读理解中文的方法,其中,所述将所述问题向量和所述待理解向量输入到预设的第一中文机器阅读理解模型中进行计算,得到对应所述第一问题中文文本的第一答案文本的步骤之后,包括:
    判断所述第一答案文本中是否存在非中文词语,若有,则将非中文词语转换成对应的中文,并替换到所述第一答案文本中,得到纯中文的第一答案文本;
    将所述纯中文的第一答案文本中的每一个汉字进行向量化,得到对应所述纯中文的第一答案文本中文字的第一顺序的多个第一向量,多个所述第一向量形成第一向量串(x1、x2、x3······xn),其中,x为第一向量,n为大于1的整数;
    按照所述第一顺序,先以第一个所述第一向量x1为起始向量,与第二个所述第一向量x2进行组合,得到第一向量组合(x1、x2),并在预设的模板向量数据库中,查找与所述第一组合向量(x1、x2)相似度最大,且大于预设的第二阈值的预设第一组合向量(y1、y2),其中y为预设的向量;
    若查找到所述预设第一组合向量(y1、y2),则以前三个所述第一向量进行组合,得到第二向量组合(x1、x2、x3),并在所述模板向量数据库中,查找与所述第二组合向量相似度最大,且大于所述第二阈值的预设第二组合向量(y1、y2、y3);以此类推,当未得到组合向量(y1、y2、y3······yn)时,则进行“在所述第一向量中,由组合向量(y1、y2、y3······yn-1)替换对应的向量组合(x1、x2、x3······xn-1),并将所述组合向量(y1、y2、y3······yn-1)固化到所述第一向量串中”的第一固化过程;
    若未查找到所述第二组合向量(y1、y2),则进行“将所述第一向量组合(x1、x2)固化所述第一向量串中”的第二固化过程;同时以第三个所述第一向量为起始向量,重复所述第一固化过程和/或所述第二固化过程,直到得到全部是固化的向量的第三向量串;
    将所述第三向量串转换成中文,得到第三答案文本。
  5. 根据权利要求1所述的机器阅读理解中文的方法,其中,所述第一中文文本为答题者回答所述第一问题中文文本中问题形成的文本;所述将所述问题向量和所述待理解向量输入到预设的第一中文机器阅读理解模型中进行计算,得到对应所述第一问题中文文本的第一答案文本的步骤之后,包括:
    获取对应所述问题文本中问题的正确答案的第四答案文本;
    计算所述第四答案文本与所述第一答案文本的答案相似度;
    到预设的分值-相似度列表中查找与所述答案相似度对应的分值;
    将所述分值作为对所述第一中文文本理解程度的得分输出。
  6. 根据权利要求1所述的机器阅读理解中文的方法,其中,所述获取第一问题中文文本,以及待理解的第一中文文本的步骤之前,包括:
    获取预设的中文阅读理解数据集;其中,中文阅读理解数据集包括成一一对应关系的第二问题中文文本、待理解的第二中文文本和第四答案文本的多条训练数据;
    利用所述语言模型给每一条训练数据进行向量化,得到呈一一对应关系的第二问题中文文本向量、第二中文文本向量和第四答案文本向量的训练数据;
    将所述训练向量数据输入到预设的第二中文机器阅读理解模型中进行训练,得到所述第一中文机器阅读理解模型。
  7. 根据权利要求1所述的机器阅读理解中文的方法,其中,所述分别将所述第一问题中文文本和所述第一中文文本输入到预设的语言模型中进行向量化,得到第一问题中文文本的问题向量,以及第一中文文本的待理解向量的步骤之前,包括:
    分别在所述第一问题中文文本和第一中文文本查找外文单词;
    若查找到,则将查找到的外文单词翻译成中文,并将翻译得到的中文替换对应的外文单词。
  8. 一种机器阅读理解中文的装置,其中,包括:
    获取单元,用于获取第一问题中文文本,以及待理解的第一中文文本;
    向量化单元,用于分别将所述第一问题中文文本和所述第一中文文本输入到预设的语言模型中进行向量化,得到所述第一问题中文文本的问题向量,以及所述第一中文文本的待理解向量,其中,所述语言模型为BERT;
    计算单元,用于将所述问题向量和所述待理解向量输入到预设的第一中文机器阅读理解模型中进行计算,得到对应所述第一问题中文文本的第一答案文本。
  9. 一种计算机设备,包括存储器和处理器,其中,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现一种机器阅读理解中文的方法,该方法包括如下步骤:
    获取第一问题中文文本,以及待理解的第一中文文本;
    分别将所述第一问题中文文本和所述第一中文文本输入到预设的语言模型中进行向量化,得到所述第一问题中文文本的问题向量,以及所述第一中文文本的待理解向量,其中,所述语言模型为BERT;
    将所述问题向量和所述待理解向量输入到预设的第一中文机器阅读理解模型中进行计算,得到对应所述第一问题中文文本的第一答案文本。
  10. 根据权利要求9所述的计算机设备,其中,所述分别将所述第一问题中文文本和所述第一中文文本输入到预设的语言模型中进行向量化,得到所述第一问题中文文本的问题向量,以及所述第一中文文本的待理解向量的步骤,包括:
    分别对所述第一问题中文文本,以及所述第一中文文本中的每一个字符向量化,得到字符向量;以及给每一个字符标记位置向量,得到字符位置向量;
    将每一个字符对应的字符向量和字符位置向量合并,得到对应对所述第一问题中文文本的问题向量,以及对应所述第一中文文本的待理解向量。
  11. 根据权利要求9所述的计算机设备,其中,所述将所述问题向量和所述待理解向量输入到预设的第一中文机器阅读理解模型中进行计算,得到对应所述第一问题中文文本的第一答案文本的步骤之后,包括:
    判断所述第一答案文本中是否存在非中文词语,若有,则将非中文词语转换成对应的中文,并替换到所述第一答案文本中,得到纯中文的第一答案文本;
    将所述纯中文的第一答案文本中的每一个汉字进行向量化,得到对应所述纯中文的第一答案文本中文字的第一顺序的多个第一向量,多个第一向量形成第一向量串;
    将多个所述第一向量按照所述第一顺序,每指定数量的所述第一向量形成一组,得到多个第一向量组;
    到预设的模板向量数据库中,各所述第一向量组查找与其相似度最高,且相似度达到预设的第一阈值的第二向量组;
    若查找到所述第二向量组,则将所述第二向量组替换所述第一向量串中对应的第一向量组,得到第二向量串;
    将所述第二向量串转换成中文,得到第二答案文本。
  12. 根据权利要求9所述的计算机设备,其中,所述将所述问题向量和所述待理解向量输入到预设的第一中文机器阅读理解模型中进行计算,得到对应所述第一问题中文文本的第一答案文本的步骤之后,包括:
    判断所述第一答案文本中是否存在非中文词语,若有,则将非中文词语转换成对应的中文,并替换到所述第一答案文本中,得到纯中文的第一答案文本;
    将所述纯中文的第一答案文本中的每一个汉字进行向量化,得到对应所述纯中文的第一答案文本中文字的第一顺序的多个第一向量,多个所述第一向量形成第一向量串(x1、x2、x3······xn),其中,x为第一向量,n为大于1的整数;
    按照所述第一顺序,先以第一个所述第一向量x1为起始向量,与第二个所述第一向量x2进行组合,得到第一向量组合(x1、x2),并在预设的模板向量数据库中,查找与所述第一组合向量(x1、x2)相似度最大,且大于预设的第二阈值的预设第一组合向量(y1、y2),其中y为预设的向量;
    若查找到所述预设第一组合向量(y1、y2),则以前三个所述第一向量进行组合,得到第二向量组合(x1、x2、x3),并在所述模板向量数据库中,查找与所述第二组合向量相似度最大,且大于所述第二阈值的预设第二组合向量(y1、y2、y3);以此类推,当未得到组合向量(y1、y2、y3······yn)时,则进行“在所述第一向量中,由组合向量(y1、y2、y3······yn-1)替换对应的向量组合(x1、x2、x3······xn-1),并将所述组合向量(y1、y2、y3······yn-1)固化到所述第一向量串中”的第一固化过程;
    若未查找到所述第二组合向量(y1、y2),则进行“将所述第一向量组合(x1、x2)固化所述第一向量串中”的第二固化过程;同时以第三个所述第一向量为起始向量,重复所述第一固化过程和/或所述第二固化过程,直到得到全部是固化的向量的第三向量串;
    将所述第三向量串转换成中文,得到第三答案文本。
  13. 根据权利要求9所述的计算机设备,其中,所述第一中文文本为答题者回答所述第一问题中文文本中问题形成的文本;所述将所述问题向量和所述待理解向量输入到预设的第一中文机器阅读理解模型中进行计算,得到对应所述第一问题中文文本的第一答案文本的步骤之后,包括:
    获取对应所述问题文本中问题的正确答案的第四答案文本;
    计算所述第四答案文本与所述第一答案文本的答案相似度;
    到预设的分值-相似度列表中查找与所述答案相似度对应的分值;
    将所述分值作为对所述第一中文文本理解程度的得分输出。
  14. 根据权利要求9所述的计算机设备,其中,所述获取第一问题中文文本,以及待理解的第一中文文本的步骤之前,包括:
    获取预设的中文阅读理解数据集;其中,中文阅读理解数据集包括成一一对应关系的第二问题中文文本、待理解的第二中文文本和第四答案文本的多条训练数据;
    利用所述语言模型给每一条训练数据进行向量化,得到呈一一对应关系的第二问题中文文本向量、第二中文文本向量和第四答案文本向量的训练数据;
    将所述训练向量数据输入到预设的第二中文机器阅读理解模型中进行训练,得到所述第一中文机器阅读理解模型。
  15. 根据权利要求9所述的计算机设备,其中,所述分别将所述第一问题中文文本和所述第一中文文本输入到预设的语言模型中进行向量化,得到第一问题中文文本的问题向量,以及第一中文文本的待理解向量的步骤之前,包括:
    分别在所述第一问题中文文本和第一中文文本查找外文单词;
    若查找到,则将查找到的外文单词翻译成中文,并将翻译得到的中文替换对应的外文单词。
  16. 一种计算机可读存储介质,其上存储有计算机程序,其中,所述计算机程序被处理器执行时实现一种机器阅读理解中文的方法,该方法包括如下步骤:
    获取第一问题中文文本,以及待理解的第一中文文本;
    分别将所述第一问题中文文本和所述第一中文文本输入到预设的语言模型中进行向量化,得到所述第一问题中文文本的问题向量,以及所述第一中文文本的待理解向量,其中,所述语言模型为BERT;
    将所述问题向量和所述待理解向量输入到预设的第一中文机器阅读理解模型中进行计算,得到对应所述第一问题中文文本的第一答案文本。
  17. 根据权利要求16所述的计算机可读存储介质,其中,所述分别将所述第一问题中文文本和所述第一中文文本输入到预设的语言模型中进行向量化,得到所述第一问题中文文本的问题向量,以及所述第一中文文本的待理解向量的步骤,包括:
    分别对所述第一问题中文文本,以及所述第一中文文本中的每一个字符向量化,得到字符向量;以及给每一个字符标记位置向量,得到字符位置向量;
    将每一个字符对应的字符向量和字符位置向量合并,得到对应对所述第一问题中文文本的问题向量,以及对应所述第一中文文本的待理解向量。
  18. 根据权利要求16所述的计算机可读存储介质,其中,所述将所述问题向量和所述待理解向量输入到预设的第一中文机器阅读理解模型中进行计算,得到对应所述第一问题中文文本的第一答案文本的步骤之后,包括:
    判断所述第一答案文本中是否存在非中文词语,若有,则将非中文词语转换成对应的中文,并替换到所述第一答案文本中,得到纯中文的第一答案文本;
    将所述纯中文的第一答案文本中的每一个汉字进行向量化,得到对应所述纯中文的第一答案文本中文字的第一顺序的多个第一向量,多个第一向量形成第一向量串;
    将多个所述第一向量按照所述第一顺序,每指定数量的所述第一向量形成一组,得到多个第一向量组;
    到预设的模板向量数据库中,各所述第一向量组查找与其相似度最高,且相似度达到预设的第一阈值的第二向量组;
    若查找到所述第二向量组,则将所述第二向量组替换所述第一向量串中对应的第一向量组,得到第二向量串;
    将所述第二向量串转换成中文,得到第二答案文本。
  19. 根据权利要求16所述的计算机可读存储介质,其中,所述将所述问题向量和所述待理解向量输入到预设的第一中文机器阅读理解模型中进行计算,得到对应所述第一问题中文文本的第一答案文本的步骤之后,包括:
    判断所述第一答案文本中是否存在非中文词语,若有,则将非中文词语转换成对应的中文,并替换到所述第一答案文本中,得到纯中文的第一答案文本;
    将所述纯中文的第一答案文本中的每一个汉字进行向量化,得到对应所述纯中文的第一答案文本中文字的第一顺序的多个第一向量,多个所述第一向量形成第一向量串(x1、x2、x3······xn),其中,x为第一向量,n为大于1的整数;
    按照所述第一顺序,先以第一个所述第一向量x1为起始向量,与第二个所述第一向量x2进行组合,得到第一向量组合(x1、x2),并在预设的模板向量数据库中,查找与所述第一组合向量(x1、x2)相似度最大,且大于预设的第二阈值的预设第一组合向量(y1、y2),其中y为预设的向量;
    若查找到所述预设第一组合向量(y1、y2),则以前三个所述第一向量进行组合,得到第二向量组合(x1、x2、x3),并在所述模板向量数据库中,查找与所述第二组合向量相似度最大,且大于所述第二阈值的预设第二组合向量(y1、y2、y3);以此类推,当未得到组合向量(y1、y2、y3······yn)时,则进行“在所述第一向量中,由组合向量(y1、y2、y3······yn-1)替换对应的向量组合(x1、x2、x3······xn-1),并将所述组合向量(y1、y2、y3······yn-1)固化到所述第一向量串中”的第一固化过程;
    若未查找到所述第二组合向量(y1、y2),则进行“将所述第一向量组合(x1、x2)固化所述第一向量串中”的第二固化过程;同时以第三个所述第一向量为起始向量,重复所述第一固化过程和/或所述第二固化过程,直到得到全部是固化的向量的第三向量串;
    将所述第三向量串转换成中文,得到第三答案文本。
  20. 根据权利要求16所述的计算机可读存储介质,其中,所述第一中文文本为答题者回答所述第一问题中文文本中问题形成的文本;所述将所述问题向量和所述待理解向量输入到预设的第一中文机器阅读理解模型中进行计算,得到对应所述第一问题中文文本的第一答案文本的步骤之后,包括:
    获取对应所述问题文本中问题的正确答案的第四答案文本;
    计算所述第四答案文本与所述第一答案文本的答案相似度;
    到预设的分值-相似度列表中查找与所述答案相似度对应的分值;
    将所述分值作为对所述第一中文文本理解程度的得分输出。
PCT/CN2020/093107 2019-07-04 2020-05-29 机器阅读理解中文的方法、装置和计算机设备 WO2021000675A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910597621.5 2019-07-04
CN201910597621.5A CN110442691A (zh) 2019-07-04 2019-07-04 机器阅读理解中文的方法、装置和计算机设备

Publications (1)

Publication Number Publication Date
WO2021000675A1 true WO2021000675A1 (zh) 2021-01-07

Family

ID=68428611

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/093107 WO2021000675A1 (zh) 2019-07-04 2020-05-29 机器阅读理解中文的方法、装置和计算机设备

Country Status (2)

Country Link
CN (1) CN110442691A (zh)
WO (1) WO2021000675A1 (zh)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110442691A (zh) * 2019-07-04 2019-11-12 平安科技(深圳)有限公司 机器阅读理解中文的方法、装置和计算机设备
TWI753325B (zh) * 2019-11-25 2022-01-21 國立中央大學 產生機器翻譯模型的計算裝置及方法及機器翻譯裝置
CN111241244A (zh) * 2020-01-14 2020-06-05 平安科技(深圳)有限公司 基于大数据的答案位置获取方法、装置、设备及介质
CN111177326B (zh) * 2020-04-10 2020-08-04 深圳壹账通智能科技有限公司 基于精标注文本的关键信息抽取方法、装置及存储介质
CN111814466A (zh) * 2020-06-24 2020-10-23 平安科技(深圳)有限公司 基于机器阅读理解的信息抽取方法、及其相关设备

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104376842A (zh) * 2013-08-12 2015-02-25 清华大学 神经网络语言模型的训练方法、装置以及语音识别方法
CN105279552A (zh) * 2014-06-18 2016-01-27 清华大学 一种基于字的神经网络的训练方法和装置
CN106126734A (zh) * 2016-07-04 2016-11-16 北京奇艺世纪科技有限公司 文档的分类方法和装置
CN107506346A (zh) * 2017-07-10 2017-12-22 北京享阅教育科技有限公司 一种基于机器学习的中文阅读难度分级方法及系统
CN107967318A (zh) * 2017-11-23 2018-04-27 北京师范大学 一种采用lstm神经网络的中文短文本主观题自动评分方法和系统
CN109670029A (zh) * 2018-12-28 2019-04-23 百度在线网络技术(北京)有限公司 用于确定问题答案的方法、装置、计算机设备及存储介质
US20190121849A1 (en) * 2017-10-20 2019-04-25 MachineVantage, Inc. Word replaceability through word vectors
CN109766418A (zh) * 2018-12-13 2019-05-17 北京百度网讯科技有限公司 用于输出信息的方法和装置
CN109840322A (zh) * 2018-11-08 2019-06-04 中山大学 一种基于强化学习的完形填空型阅读理解分析模型及方法
CN110442691A (zh) * 2019-07-04 2019-11-12 平安科技(深圳)有限公司 机器阅读理解中文的方法、装置和计算机设备

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2019020893A (ja) * 2017-07-13 2019-02-07 国立研究開発法人情報通信研究機構 ノン・ファクトイド型質問応答装置
KR102012404B1 (ko) * 2017-08-18 2019-08-20 동아대학교 산학협력단 언어 분석기별 정답 레이블 분포를 이용한 자연어 이해 방법
CN109086303B (zh) * 2018-06-21 2021-09-28 深圳壹账通智能科技有限公司 基于机器阅读理解的智能对话方法、装置、终端
CN109408824B (zh) * 2018-11-05 2023-04-25 百度在线网络技术(北京)有限公司 用于生成信息的方法和装置
CN109918491B (zh) * 2019-03-12 2022-07-29 焦点科技股份有限公司 一种基于知识库自学习的智能客服问句匹配方法

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104376842A (zh) * 2013-08-12 2015-02-25 清华大学 神经网络语言模型的训练方法、装置以及语音识别方法
CN105279552A (zh) * 2014-06-18 2016-01-27 清华大学 一种基于字的神经网络的训练方法和装置
CN106126734A (zh) * 2016-07-04 2016-11-16 北京奇艺世纪科技有限公司 文档的分类方法和装置
CN107506346A (zh) * 2017-07-10 2017-12-22 北京享阅教育科技有限公司 一种基于机器学习的中文阅读难度分级方法及系统
US20190121849A1 (en) * 2017-10-20 2019-04-25 MachineVantage, Inc. Word replaceability through word vectors
CN107967318A (zh) * 2017-11-23 2018-04-27 北京师范大学 一种采用lstm神经网络的中文短文本主观题自动评分方法和系统
CN109840322A (zh) * 2018-11-08 2019-06-04 中山大学 一种基于强化学习的完形填空型阅读理解分析模型及方法
CN109766418A (zh) * 2018-12-13 2019-05-17 北京百度网讯科技有限公司 用于输出信息的方法和装置
CN109670029A (zh) * 2018-12-28 2019-04-23 百度在线网络技术(北京)有限公司 用于确定问题答案的方法、装置、计算机设备及存储介质
CN110442691A (zh) * 2019-07-04 2019-11-12 平安科技(深圳)有限公司 机器阅读理解中文的方法、装置和计算机设备

Also Published As

Publication number Publication date
CN110442691A (zh) 2019-11-12

Similar Documents

Publication Publication Date Title
WO2021000675A1 (zh) 机器阅读理解中文的方法、装置和计算机设备
CN108920473A (zh) 一种基于同类词与同义词替换的数据增强机器翻译方法
KR102199835B1 (ko) 언어 교정 시스템 및 그 방법과, 그 시스템에서의 언어 교정 모델 학습 방법
CN110674646A (zh) 一种基于字节对编码技术的蒙汉机器翻译系统
US20230080671A1 (en) User intention recognition method and apparatus based on statement context relationship prediction
CN113449514A (zh) 一种适用于特定垂直领域的文本纠错方法及其纠错装置
WO2023184633A1 (zh) 一种中文拼写纠错方法及系统、存储介质及终端
CN114925170B (zh) 文本校对模型训练方法及装置、计算设备
US20220019737A1 (en) Language correction system, method therefor, and language correction model learning method of system
Cheng et al. Research on automatic error correction method in English writing based on deep neural network
CN112632956A (zh) 文本匹配方法、装置、终端和存储介质
Dutta Word-level language identification using subword embeddings for code-mixed Bangla-English social media data
KR20230174503A (ko) 신경망 기반 질의 자동 생성 시스템 및 방법
CN111090720B (zh) 一种热词的添加方法和装置
CN110955768B (zh) 一种基于句法分析的问答系统答案生成方法
CN114330375A (zh) 一种基于固定范式的术语翻译方法及系统
Wu A Computational Neural Network Model for College English Grammar Correction
Li et al. Intelligent braille conversion system of Chinese characters based on Markov model
CN113590745A (zh) 一种可解释的文本推断方法
CN112530406A (zh) 一种语音合成方法、语音合成装置及智能设备
Lin et al. A Chinese Spelling Check Framework Based on Reverse Contrastive Learning
Wang et al. Intelligent English Automatic Translation System Based on Multi-Feature Fusion
CN111259650A (zh) 基于类标序列生成式对抗模型的文本自动生成方法
CN114036950B (zh) 一种医疗文本命名实体识别方法及系统
Chai Research on Chinese-English Patent Machine Translation Based on Fusion Strategy Model

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: 20835290

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20835290

Country of ref document: EP

Kind code of ref document: A1