WO2021068615A1 - 文书中问答数据获取方法、装置、计算机设备和存储介质 - Google Patents

文书中问答数据获取方法、装置、计算机设备和存储介质 Download PDF

Info

Publication number
WO2021068615A1
WO2021068615A1 PCT/CN2020/106124 CN2020106124W WO2021068615A1 WO 2021068615 A1 WO2021068615 A1 WO 2021068615A1 CN 2020106124 W CN2020106124 W CN 2020106124W WO 2021068615 A1 WO2021068615 A1 WO 2021068615A1
Authority
WO
WIPO (PCT)
Prior art keywords
candidate
document
question
answer
factor
Prior art date
Application number
PCT/CN2020/106124
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 WO2021068615A1 publication Critical patent/WO2021068615A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/332Query formulation
    • G06F16/3329Natural language query formulation or dialogue systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/338Presentation of query results
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures

Definitions

  • This application relates to the field of artificial intelligence technology, and in particular to a method, device, computer equipment, and storage medium for obtaining question and answer data in a document.
  • a document refers to a written material that records information and expresses intent.
  • Documents can be written materials formed in accordance with certain styles and requirements in social activities by agencies, organizations, enterprises, institutions, and individuals for a certain need. In occasions where a large number of documents need to be quickly reviewed, such as incoming documents, reviewing, and updating the library, the need for custom extraction of document question and answer information is very urgent.
  • a method, device, computer device, and storage medium for obtaining question and answer data in a document are provided.
  • a method for obtaining question and answer data in a document includes:
  • the candidate answers are sorted according to the similarity, and the candidate answer with the highest ranking is used as the answer to the document question.
  • a device for obtaining question and answer data in a document includes:
  • Information acquisition module used to acquire documents to be processed and input document questions
  • the keyword acquisition module is used to identify the entity words in the document question through entity word recognition technology, and use the identified entity words as the keywords of the document question;
  • the question factor obtaining module is used to perform synonym expansion and semantic expansion on the keywords respectively to obtain question factors;
  • a candidate fragment acquisition module configured to split the document to be processed to obtain multiple document fragments, and use the document fragment containing the questioning factor as a candidate fragment;
  • a candidate answer obtaining module configured to search in the candidate fragments based on the question factor to obtain the candidate answer of the document question
  • the candidate answer processing module is used to sort the candidate answers according to the similarity, and use the candidate answer with the highest ranking as the answer to the document question.
  • a computer device including a memory and one or more processors, the memory stores computer readable instructions, and when the computer readable instructions are executed by the processor, the one or more processors execute The following steps:
  • the candidate answers are sorted according to the similarity, and the candidate answer with the highest ranking is used as the answer to the document question.
  • One or more computer-readable storage media storing computer-readable instructions.
  • the one or more processors perform the following steps:
  • the candidate answers are sorted according to the similarity, and the candidate answer with the highest ranking is used as the answer to the document question.
  • the method, device, computer equipment, and storage medium for obtaining the question and answer data in the above-mentioned document use entity word recognition technology to identify the entity words in the input document question, and use the identified entity words as the keywords of the document question, and then perform the key words separately Synonym expansion and semantic expansion are used to obtain question factors.
  • the resulting question factors cover both synonym and semantic levels.
  • the document to be processed is split to obtain multiple document fragments.
  • the document fragment containing the question factor is used as a candidate fragment.
  • the candidate fragments obtained have a wider range.
  • Fig. 1 is an application scenario diagram of a method for obtaining question and answer data in a document according to one or more embodiments
  • FIG. 2 is a schematic flowchart of a method for obtaining question and answer data in a document according to one or more embodiments
  • Fig. 3 is a schematic flowchart of a candidate answer obtaining step according to one or more embodiments
  • FIG. 4 is a schematic flowchart of a candidate answer sorting step according to one or more embodiments
  • FIG. 5 is a block diagram of a device for obtaining question and answer data in a document according to one or more embodiments
  • Figure 6 is a block diagram of a computer device according to one or more embodiments.
  • the method for obtaining question and answer data in the document provided in this application can be applied to the application environment as shown in FIG. 1.
  • the terminal 102 and the server 104 communicate through the network.
  • the server 104 obtains the document to be processed and the input document question from the terminal 102, recognizes the entity word in the document question through entity word recognition technology, and uses the identified entity word as the key word of the document question; performs synonym expansion and semantics on the keywords respectively Expand to get the question factor; split the document to be processed to obtain multiple document fragments, and use the document fragment containing the question factor as a candidate fragment; search among the candidate fragments based on the question factor to obtain candidate answers to the document question; and according to the similarity
  • the candidate answers are sorted, and the highest-ranked candidate answer is used as the answer to the essay question.
  • the terminal 102 may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices.
  • the server 104 may be implemented by an independent server or a server cluster composed of multiple
  • a method for obtaining question and answer data in a document is provided. Taking the method applied to the server in Fig. 1 as an example for description, the method includes the following steps:
  • Step 202 Obtain the document to be processed and the document question entered.
  • Documents to be processed can be uploaded by the user through the user terminal, and the user conducts a question-and-answer document.
  • Clerical questions refer to questions raised by users about handling documents, such as asking attorney fees for a certain document.
  • the clerical questions can be "how much is the lawyer's fee", or "the amount of lawyer's fee", or it can be related to information that may be attached.
  • Supplementary explanation for example, it can be a phrase or sentence pattern that often appears with the question in experience, or it can be another name for the word in the question.
  • the words that often appear before and after attorney fees can be payment, commitment, and so on.
  • Step 204 Identify the entity words in the document question through entity word recognition technology, and use the identified entity words as keywords of the document question.
  • Entognizing the entity words in the document question through entity word recognition technology specifically refers to the input document question, the word segmentation first, and the word segmentation tool is used to segment the document question.
  • the word segmentation tool can be jieba, SnowNLP, pynlpir, thulac and other tools.
  • the word segmentation tool is used to segment the document question "the amount of lawyer's fees", and the result of the word segmentation processing is "attorney's fee/of/amount”.
  • Word segmentation can also be performed through maximum matching method and reverse maximum matching method.
  • part-of-speech tagging is performed. Part-of-speech tagging refers to dividing words into categories such as nouns, verbs, and adjectives.
  • Part-of-speech tagging can be implemented based on probability statistics or based on preset rules.
  • Entity words refer to words that express names of people, places, organizations, etc., and entity words can specifically be nouns. Take the word segmentation processing result "lawyer's fee/of/amount" as an example, extract the words corresponding to the noun as the key words of the document question, and obtain the keywords "lawyer's fee” and "amount”.
  • Step 206 Perform synonym expansion and semantic expansion on the keywords respectively to obtain question factors.
  • the keyword can be expanded based on the preset synonym dictionary, and the keyword can be searched in the dictionary. After the keyword is found in the dictionary, the corresponding synonym of the keyword is returned.
  • the semantic expansion of keywords is based on a preset common-sense knowledge base. For example, using HowNet’s synonymous relationship expansion, through HowNet’s synonym search method, all words that are synonymous with the keyword are obtained.
  • Step 208 Split the document to be processed to obtain multiple document fragments, and use the document fragment containing the questioning factor as the candidate fragment.
  • splitting the document to be processed to obtain multiple document fragments includes: converting the document to be processed into a character string, when the length of the string of the document to be processed is greater than a preset length and the document to be processed includes multiple In the natural segment, the document to be processed is split into different document fragments according to the natural segment; when the string length of the document to be processed is less than or equal to the preset length, the document to be processed is split based on the preset sliding window length and the preset spacing. Divided into fragments of different documents. For example, the number of characters corresponding to the length of the string exceeds 10,000 characters and the document to be processed includes multiple natural segments, and the document to be processed is directly divided into different document fragments according to the natural segments.
  • the sliding window length can be defined as 5 sentences and the spacing is 2 sentences, that is, every 5 sentences Form a document fragment, every 2 sentences as the beginning of the next document fragment.
  • Step 210 Search in candidate segments based on the question factor to obtain candidate answers to the document question.
  • the QANet a standard reading comprehension task model, can be used to input question factors and candidate fragments into the reading comprehension task model, and the model outputs candidate answers.
  • M the number of questioning factors
  • N the number of document fragments containing questioning factors in the document to be processed
  • searching in the candidate fragments based on the questioning factor to obtain candidate answers to the document question includes: Step 302: Obtain a trained reading comprehension task model.
  • the reading comprehension task model includes The embedding layer, the embedding coding layer, the context-query attention layer, the model coding layer, and the output layer are sequentially connected; step 304, the questioning factor and the candidate segment are input to the embedding layer, and the questioning factor and the candidate segment are respectively processed through the embedding coding layer Encoding is performed to obtain the question factor coding block and the candidate segment coding block; step 306, through the context-query attention layer, obtain the similarity between the question factor coding block and the candidate fragment coding block; step 308, based on the question factor coding block For the similarity between the coding blocks of the candidate segment, the predicted position of the candidate answer is obtained through the model coding layer; in step 310, the probability that each predicted position is the starting position of the candidate answer and the probability of the ending position of the
  • the reading comprehension task model QANet contains five main components: embedding layer, embedding coding layer, context-query attention layer, model coding layer and output layer.
  • QANet's embedded encoder and model encoder abandon the complex recursive structure of RNN (Recurrent Neural Network), and build a neural network by using convolution and self-attention mechanisms to make the model's training rate and inference rate Greatly speed up, and can process input words in parallel.
  • Input candidate fragments and questioning factors to the embedding layer of the reading comprehension task model, and then the embedded coding layer encodes the candidate fragments and questioning factors respectively, and then learns the similarity between the two coding blocks in the context-query attention layer.
  • the vector after the attention layer is coded by the model coding layer to the coding block to obtain the predicted position of the candidate answer, and finally the probability that each predicted position is the beginning and end of the candidate answer corresponding to the document question is calculated through the output layer decoding.
  • Output a Span set, S ⁇ c_i, c_(i+1),...,c_(i+j) ⁇
  • Span refers to extracting a continuous segment from the candidate segment as the answer.
  • Step 212 Sort the candidate answers according to the similarity, and use the candidate answer with the highest ranking as the answer to the document question.
  • the candidate answers are sorted according to the similarity, and the candidate answer with the highest ranking is used as the answer to the document question, including: step 402, multiple candidate answers corresponding to a single candidate segment Perform pairwise similarity matching calculation, and use the candidate answer with the highest mean similarity as the candidate answer of a single candidate segment; step 404, use the mean of similarity between the candidate answer of a single candidate segment and other candidate answers of the single candidate segment as a single candidate segment; step 406, obtain the degree of matching between a single candidate segment and the question factor, and obtain the weight of the candidate answer according to the degree of match and the candidate weight of the single candidate segment; step 408, obtain the candidate answer corresponding to each candidate segment The weight value, the candidate answer corresponding to the highest value among the weight values is used as the answer to the clerical question.
  • the Fuzzywuzzy model can be used to perform pairwise similarity matching calculations for multiple answers obtained from each candidate segment.
  • the FuzzyWuzzy model is used to calculate the matching degree between strings.
  • the answer obtained from each candidate segment is first converted into a string, and then based on the converted string, the function in the FuzzyWuzzy model is called to output the similarity matching degree of the string. , That is, the similarity matching degree between every two answers is obtained.
  • the matching degree and the candidate weight of each candidate segment can be normalized, and the weighted summation is performed according to the normalized matching degree and the candidate weight to obtain the weight of each candidate answer. Chemical processing simplifies calculations, thereby improving the efficiency of obtaining answers. More specifically, the matching degree and the candidate weight are weighted and summed according to a ratio of 6.5:3.5. It has been verified by multiple experiments that the accuracy of the obtained answer is higher when this ratio is verified.
  • the above-mentioned method for obtaining question and answer data in the document uses entity word recognition technology to identify the entity words in the input document question, use the identified entity words as the keywords of the document question, and then perform synonym expansion and semantic expansion on the keywords to obtain the question factor
  • the question factor thus obtained covers both synonym and semantic levels.
  • the document to be processed is split to obtain multiple document fragments, and the document fragment containing the question factor is used as a candidate fragment, so that the range of candidate fragments obtained is wider.
  • obtaining the degree of matching between a single candidate segment and the questioning factor includes: obtaining the number of first words after synonym expansion processing and the number of second words after semantic expansion processing; comparing the number of first words with the second words
  • the ratio of the quantity and the single candidate segment are input to the Elasticsearch search model to obtain the matching degree between the single candidate segment and the questioning factor.
  • each document fragment can be separately stored in the Elasticsearch retrieval model.
  • the Elasticsearch retrieval model is used to quickly retrieve stored documents, and treat each document fragment as a document.
  • the Elasticsearch retrieval model can firstly extract documents based on the retrieval sentence, such as the question factor.
  • the question factor is used to traverse each document fragment, and the document fragments that do not include the question factor are excluded to obtain candidate fragments, that is, the candidate fragment includes the question factor. Fragments of instruments. Then, according to the ratio of the words after synonym expansion and the words after semantic expansion in the question factor, the matching degree between the candidate segment and the question factor is returned. Among them, the ratio of the words after synonym expansion to the words after semantic expansion can be 3:1, and the accuracy of the obtained answers is higher when the ratio is verified by multiple experiments.
  • the candidate fragments can be output in the candidate list. When the Elasticsearch search model returns candidate fragments, it will also return the corresponding matching degree.
  • the matching degree can be the score of the matching degree, and the score can be normalized as min-max. It will be processed and stored in the score list.
  • a device for obtaining question and answer data in a document including: an information obtaining module 502, a keyword obtaining module 504, a question factor obtaining module 506, a candidate fragment obtaining module 508, and a candidate The answer obtaining module 510 and the candidate answer processing module 512.
  • the information acquisition module is used to acquire the documents to be processed and the document questions entered.
  • the keyword acquisition module is used to identify the entity words in the document question through entity word recognition technology, and use the identified entity words as the keywords of the document question.
  • the question factor acquisition module is used for synonym expansion and semantic expansion of keywords to obtain question factors.
  • the candidate fragment acquisition module is used to split the document to be processed to obtain multiple document fragments, and use the document fragment containing the questioning factor as the candidate fragment.
  • the candidate answer obtaining module is used to search among the candidate segments based on the questioning factor to obtain candidate answers to the document question.
  • the candidate answer processing module is used to sort the candidate answers according to the similarity, and use the candidate answer with the top rank as the answer to the essay question.
  • the candidate fragment acquisition module includes: a first splitting unit for converting the document to be processed into a character string, when the length of the string of the document to be processed is greater than a preset length and the document to be processed includes multiple natural When segmenting, the document to be processed is split into different document fragments according to the natural segment; the second splitting unit is used for when the string length of the document to be processed is less than or equal to the preset length, based on the preset sliding window length and the preset length. Set the spacing to split the document to be processed into different document fragments.
  • the candidate answer obtaining module includes: a model obtaining unit for obtaining a trained reading comprehension task model.
  • the reading comprehension task model includes an embedding layer, an embedding coding layer, and a context-query attention layer connected in sequence.
  • Model coding layer and output layer coding unit for inputting questioning factors and candidate fragments into the embedding layer, and encoding the questioning factors and candidate fragments respectively through the embedding coding layer to obtain questioning factor coding blocks and candidate fragment coding blocks ; Coding block processing unit, used to obtain the similarity between the question factor coding block and the candidate segment coding block through the context-query attention layer; the position obtaining unit, used to obtain the similarity between the question factor coding block and the candidate segment coding block based on the question factor
  • the predicted position of the candidate answer is obtained through the model coding layer; the position processing unit is used to calculate the probability that each predicted position is the starting position of the candidate answer and the probability of the ending position of the candidate answer through the output layer decoding, and the probability is greater than the preset
  • the predicted position of the first threshold is taken as the starting position of the candidate answer, and the predicted position with the probability greater than the preset second threshold is taken as the ending position of the candidate answer.
  • the candidate answer processing module is also used to perform pairwise similarity matching calculations on multiple candidate answers corresponding to a single candidate segment, and the candidate answer with the highest average similarity is regarded as the candidate answer of the single candidate segment;
  • the average of the similarity between the candidate answer of the candidate segment and the other candidate answers of a single candidate segment is used as the candidate weight of a single candidate segment;
  • the degree of matching between a single candidate segment and the question factor is obtained, and according to the matching degree and the candidate weight of the single candidate segment,
  • the weight of the candidate answer; the weight corresponding to the candidate answer of each candidate segment is obtained, and the candidate answer corresponding to the highest value among the weights is used as the answer to the document question.
  • the candidate answer processing module is also used to obtain the number of first words after synonym expansion processing and the number of second words after semantic expansion processing; the ratio of the number of first words to the number of second words and the single candidate
  • the fragments are input to the Elasticsearch search model to obtain the matching degree between a single candidate fragment and the questioning factor.
  • the various modules in the question-and-answer data acquisition device in the above-mentioned document can be implemented in whole or in part by software, hardware and a combination thereof.
  • the above-mentioned modules may be embedded in the form of hardware or independent of the processor in the computer equipment, or may be stored in the memory of the computer equipment in the form of software, so that the processor can call and execute the operations corresponding to the above-mentioned modules.
  • a computer device is provided.
  • the computer device may be a server, and its internal structure diagram may be as shown in FIG. 6.
  • the computer equipment includes a processor, a memory, a network interface, and a database connected through a system bus.
  • the processor of the computer device is used to provide calculation and control capabilities.
  • the memory of the computer device includes a non-volatile or volatile storage medium and internal memory.
  • the non-volatile or volatile storage medium stores an operating system, computer readable instructions, and a database.
  • the internal memory provides an environment for the operation of the operating system and computer-readable instructions in the non-volatile storage medium.
  • the database of the computer equipment is used to store data such as documents to be processed, clerical questions, question factors, candidate answers, etc.
  • the network interface of the computer device is used to communicate with an external terminal through a network connection.
  • FIG. 6 is only a block diagram of part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied.
  • the specific computer device may Including more or fewer parts than shown in the figure, or combining some parts, or having a different arrangement of parts.
  • a computer device includes a memory and one or more processors.
  • the memory stores computer-readable instructions.
  • the one or more processors perform the following steps:
  • the candidate answers are sorted according to the similarity, and the highest-ranked candidate answer is used as the answer to the essay question.
  • the processor further implements the following steps when executing the computer-readable instructions:
  • the document to be processed is split into different document fragments based on the preset sliding window length and the preset interval.
  • the processor further implements the following steps when executing the computer-readable instructions:
  • the reading comprehension task model includes successively connected embedding layer, embedding coding layer, context-query attention layer, model coding layer and output layer;
  • the predicted position of the candidate answer is obtained through the model coding layer.
  • the processor further implements the following steps when executing the computer-readable instructions:
  • the weight value corresponding to the candidate answer of each candidate segment is obtained, and the candidate answer corresponding to the highest value among the weight values is used as the answer to the document question.
  • the processor further implements the following steps when executing the computer-readable instructions:
  • the ratio of the number of first words to the number of second words and the single candidate segment are input into the Elasticsearch search model to obtain the matching degree of the single candidate segment with the question factor.
  • One or more computer-readable storage media storing computer-readable instructions.
  • the one or more processors perform the following steps:
  • the candidate answers are sorted according to the similarity, and the highest-ranked candidate answer is used as the answer to the essay question.
  • the computer-readable storage medium may be non-volatile or volatile.
  • the document to be processed is split into different document fragments based on the preset sliding window length and the preset interval.
  • the reading comprehension task model includes successively connected embedding layer, embedding coding layer, context-query attention layer, model coding layer and output layer;
  • the predicted position of the candidate answer is obtained through the model coding layer.
  • the weight value corresponding to the candidate answer of each candidate segment is obtained, and the candidate answer corresponding to the highest value among the weight values is used as the answer to the document question.
  • the ratio of the number of first words to the number of second words and the single candidate segment are input into the Elasticsearch search model to obtain the matching degree of the single candidate segment with the question factor.
  • 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), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous chain Channel (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Artificial Intelligence (AREA)
  • Databases & Information Systems (AREA)
  • Computational Linguistics (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Evolutionary Computation (AREA)
  • Evolutionary Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Human Computer Interaction (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种文书中问答数据获取方法、装置、计算机设备和存储介质,涉及人工智能领域,文书中问答数据获取方法包括:获取待处理文书以及输入的文书问题(S202),通过实体词识别技术识别文书问题中的实体词,将识别出的实体词作为文书问题的关键词(S204);对关键词分别进行同义词扩展以及语义扩展,得到提问因子(S206);对待处理文书进行拆分,得到多个文书片段,将包含提问因子的文书片段作为候选片段(S208);基于提问因子在候选片段中查找,得到文书问题的候选答案(S210);及根据相似度对各候选答案进行排序,将排序最前的候选答案作为文书问题的答案(S212)。

Description

文书中问答数据获取方法、装置、计算机设备和存储介质
相关申请的交叉引用
本申请要求于2019年10月12日提交中国专利局,申请号为201910970168.8,申请名称为“文书中问答数据获取方法、装置、计算机设备和存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及人工智能技术领域,特别是涉及一种文书中问答数据获取方法、装置、计算机设备和存储介质。
背景技术
文书指的是一种记录信息、表达意图的文字材料。文书可以是机关、团体、企事业单位以及个人在社会活动中,为了某种需要,按照一定的体式和要求形成的书面文字材料。在进件、审核、更新文库等需要对大量文书进行快速审阅的场合,通过自定义提取文书问答信息的需求十分迫切。
传统的文书问答信息的获取一般都是基于关键词的检索,然而,发明人意识到,用关键词进行检索的方式停留在语法层面,检索返回的内容有些和答案的关联不太紧密,导致通过检索方式获取到的问答信息的准确率不高。
发明内容
根据本申请公开的各种实施例,提供一种文书中问答数据获取方法、装置、计算机设备和存储介质。
一种文书中问答数据获取方法包括:
获取待处理文书以及输入的文书问题;
通过实体词识别技术识别所述文书问题中的实体词,将识别出的实体词作为所述文书问题的关键词;
对所述关键词分别进行同义词扩展以及语义扩展,得到提问因子;
对所述待处理文书进行拆分,得到多个文书片段,将包含所述提问因子的文书片段作为候选片段;
基于所述提问因子在所述候选片段中查找,得到所述文书问题的候选答案;及
根据相似度对各所述候选答案进行排序,将排序最前的候选答案作为所述文书问题的答案。
一种文书中问答数据获取装置包括:
信息获取模块,用于获取待处理文书以及输入的文书问题;
关键词获取模块,用于通过实体词识别技术识别所述文书问题中的实体词,将识别出的实体词作为所述文书问题的关键词;
提问因子获取模块,用于对所述关键词分别进行同义词扩展以及语义扩展,得到提问因子;
候选片段获取模块,用于对所述待处理文书进行拆分,得到多个文书片段,将包含所述提问因子的文书片段作为候选片段;
候选答案获取模块,用于基于所述提问因子在所述候选片段中查找,得到所述文书问题的候选答案;及
候选答案处理模块,用于根据相似度对各所述候选答案进行排序,将排序最前的候选答案作为所述文书问题的答案。
一种计算机设备,包括存储器和一个或多个处理器,所述存储器中储存有计算机可读指令,所述计算机可读指令被所述处理器执行时,使得所述一个或多个处理器执行以下步骤:
获取待处理文书以及输入的文书问题;
通过实体词识别技术识别所述文书问题中的实体词,将识别出的实体词作为所述文书问题的关键词;
对所述关键词分别进行同义词扩展以及语义扩展,得到提问因子;
对所述待处理文书进行拆分,得到多个文书片段,将包含所述提问因子的文书片段作为候选片段;
基于所述提问因子在所述候选片段中查找,得到所述文书问题的候选答案;及
根据相似度对各所述候选答案进行排序,将排序最前的候选答案作为所述文书问题的答案。
一个或多个存储有计算机可读指令的计算机可读存储介质,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行以下步骤:
获取待处理文书以及输入的文书问题;
通过实体词识别技术识别所述文书问题中的实体词,将识别出的实体词作为所述文书问题的关键词;
对所述关键词分别进行同义词扩展以及语义扩展,得到提问因子;
对所述待处理文书进行拆分,得到多个文书片段,将包含所述提问因子的文书片段作为候选片段;
基于所述提问因子在所述候选片段中查找,得到所述文书问题的候选答案;及
根据相似度对各所述候选答案进行排序,将排序最前的候选答案作为所述文书问题的答案。
上述文书中问答数据获取方法、装置、计算机设备和存储介质,通过实体词识别技术 识别输入的文书问题中的实体词,将识别出的实体词作为文书问题的关键词,再对关键词分别进行同义词扩展以及语义扩展,得到提问因子,由此得到的提问因子涵盖了同义词和语义两个层面,对待处理文书进行拆分,得到多个文书片段,将包含提问因子的文书片段作为候选片段,这样得到的候选片段的范围更广,基于提问因子在候选片段中查找,得到文书问题的候选答案,再根据相似度对各候选答案进行排序,将排序最前的候选答案作为文书问题的答案,这样候选答案覆盖广,再对候选答案进行筛选最终确定文书问题的答案,可以有效提高获取到的提问答案的准确率。
本申请的一个或多个实施例的细节在下面的附图和描述中提出。本申请的其它特征和优点将从说明书、附图以及权利要求书变得明显。
附图说明
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。
图1为根据一个或多个实施例中文书中问答数据获取方法的应用场景图;
图2为根据一个或多个实施例中文书中问答数据获取方法的流程示意图;
图3为根据一个或多个实施例中候选答案获取步骤的流程示意图;
图4为根据一个或多个实施例中候选答案排序步骤的流程示意图;
图5为根据一个或多个实施例中文书中问答数据获取装置的框图;
图6为根据一个或多个实施例中计算机设备的框图。
具体实施方式
为了使本申请的技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
本申请提供的文书中问答数据获取方法,可以应用于如图1所示的应用环境中。终端102与服务器104通过网络进行通信。服务器104从终端102获取待处理文书以及输入的文书问题,通过实体词识别技术识别文书问题中的实体词,将识别出的实体词作为文书问题的关键词;对关键词分别进行同义词扩展以及语义扩展,得到提问因子;对待处理文书进行拆分,得到多个文书片段,将包含提问因子的文书片段作为候选片段;基于提问因子在候选片段中查找,得到文书问题的候选答案;及根据相似度对各候选答案进行排序,将排序最前的候选答案作为文书问题的答案。其中,终端102可以但不限于是各种个人计算机、笔记本电脑、智能手机、平板电脑和便携式可穿戴设备,服务器104可以用独立的服务器或者是多个服务器组成的服务器集群来实现。
在其中一个实施例中,如图2所示,提供了一种文书中问答数据获取方法,以该方法 应用于图1中的服务器为例进行说明,包括以下步骤:
步骤202,获取待处理文书以及输入的文书问题。
待处理文书可由用户通过用户终端上传,用户进行问答的文书。文书问题是指用户对待处理文书提出的问题,例如针对某一文书提问律师费,文书问题具体可以是“律师费是多少”,也可是“律师费的金额”,还可以是对可能附带信息的补充说明,比如可以是经验上经常与问题出现的词组或句式,也可以是问题中词语的别称。比如经常与律师费前后出现的词可以是支付、承担等。
步骤204,通过实体词识别技术识别文书问题中的实体词,将识别出的实体词作为文书问题的关键词。
通过实体词识别技术识别文书问题中的实体词具体是指对于输入的文书问题,先进行分词处理,通过分词工具对文书问题进行分词处理,分词工具可以是jieba、SnowNLP、pynlpir、thulac等工具。比如通过分词工具对文书问题“律师费的金额”进行分词处理,得到分词处理的结果为“律师费/的/金额”。也可以通过最大匹配法、逆向最大匹配法等方式进行分词处理。在分词处理之后进行词性标注,词性标注是指将词分为名词、动词、形容词等类别,词性标注可以基于概率统计或基于预设规则实现。实体词是指表示人名、地名、组织名等的词,实体词具体可以是名词。以分词处理结果“律师费/的/金额”为例,提取名词对应的词语作为文书问题的关键词,得到关键词为“律师费”和“金额”。
步骤206,对关键词分别进行同义词扩展以及语义扩展,得到提问因子。
可以基于预设同义词词典对关键词进行同义词扩展,对关键词进行词典查询,在词典中找到该关键词后,返回该关键词对应的同义词。基于预设常识性知识库对关键词进行语义扩展,比如,应用知网的同义关系扩展,通过知网的同义词查找方式,得到与关键词同义的所有词。
步骤208,对待处理文书进行拆分,得到多个文书片段,将包含提问因子的文书片段作为候选片段。
在其中一个实施例中,对待处理文书进行拆分,得到多个文书片段,包括:将待处理文书转换成字符串,当待处理文书的字符串长度大于预设长度且待处理文书包括多个自然段时,按照自然段将待处理文书拆分为不同的文书片段;当待处理文书的字符串长度小于或等于预设长度时,基于预设滑窗长度和预设间距将待处理文书拆分为不同的文书片段。比如字符串长度对应的字数超过1万个字且待处理文书包括多个自然段,直接按自然段将待处理文书拆分成不同的文书片段。当待处理文书的字符串长度较短时,则使用滑窗与间距对待处理文书进行拆分,例如300字的短文书,可以定义滑窗长度为5句,间距为2句,即每5句组成一个文书片段,每隔2句作为下一文书片段的起始。
步骤210,基于提问因子在候选片段中查找,得到文书问题的候选答案。
可以通过标准的阅读理解任务模型QANet,将提问因子和候选片段输入至阅读理解任务模型,模型输出候选答案。当提问因子的数量为M,待处理文书中包含提问因子的文书 片段的数量为N时,假设每个问题返回一个答案,则一共生成M×N个答案。
在其中一个实施例中,如图3所示,基于提问因子在所述候选片段中查找,得到文书问题的候选答案,包括:步骤302,获取已训练的阅读理解任务模型,阅读理解任务模型包括依次连接的嵌入层、嵌入编码层、语境-查询注意力层、模型编码层以及输出层;步骤304,将提问因子和候选片段输入至嵌入层,通过嵌入编码层分别对提问因子和候选片段进行编码,得到提问因子编码块和候选片段编码块;步骤306,通过语境-查询注意力层,获取提问因子编码块与候选片段编码块之间的相似度;步骤308,基于提问因子编码块与候选片段编码块之间的相似度,通过模型编码层获得候选答案的预测位置;步骤310,通过输出层解码计算每一个预测位置为候选答案开始位置的概率和候选答案结尾位置的概率,将概率大于预设第一阈值的预测位置作为候选答案开始位置,将概率大于预设第二阈值的预测位置作为候选答案结尾位置。阅读理解任务模型QANet包含五个主要的组成部分:嵌入层、嵌入编码层、语境-查询注意力层、模型编码层以及输出层。QANet的嵌入编码器和模型编码器摒弃了RNN(Recurrent Neural Network,循环神经网络)的复杂递归结构,通过使用卷积和自注意力机制构建了一个神经网络,使得该模型的训练速率和推断速率大大加快,并且可以并行处理输入的词。输入候选片段和提问因子至阅读理解任务模型的嵌入层,再由嵌入编码层分别编码候选片段和提问因子,然后在语境-查询注意力层学习这两个编码块之间的相似度,将经过注意力层的向量由模型编码层对编码块编码,获得候选答案的预测位置,最后通过输出层解码计算出每一个预测位置是文书问题对应的候选答案的开头和结尾的概率。假设候选片段C包括n个词,用数学式可以表示为C={c_1,c_2,...,c_n},提问因子Q包括m个词,Q={q_1,q_2,...,q_m},输出一个Span集,S={c_i,c_(i+1),...,c_(i+j)},Span是指从候选片段中抽取一段连续的片段作为答案。
步骤212,根据相似度对各候选答案进行排序,将排序最前的候选答案作为文书问题的答案。
在其中一个实施例中,如图4所示,根据相似度对各候选答案进行排序,将排序最前的候选答案作为文书问题的答案,包括:步骤402,对单个候选片段对应的多个候选答案进行两两相似度匹配计算,将相似度均值最高的候选答案作为单个候选片段的候选答案;步骤404,将单个候选片段的候选答案与单个候选片段的其它候选答案的相似度均值作为单个候选片段的候选权值;步骤406,获取单个候选片段与提问因子的匹配度,根据匹配度以及单个候选片段的候选权值,得到候选答案的权值;步骤408,获取各候选片段的候选答案对应的权值,将各个权值中最高值对应的候选答案作为文书问题的答案。可以通过Fuzzywuzzy模型实现对每个候选片段得到的多个答案进行两两相似度匹配计算。FuzzyWuzzy模型用于计算字符串之间的匹配度,先将从每个候选片段得到的答案转换成字符串,再基于转换后的字符串通过调用FuzzyWuzzy模型中的函数,输出字符串的相似匹配度,即得到每两个答案之间的相似匹配度。具体地,可以将匹配度以及各个候选片段的候选权值进行归一化处理,根据归一化处理后的匹配度以及候选权值进行加权求和,得 到各个候选答案的权值,通过归一化处理简化计算,从而提高答案获取效率。更为具体地,匹配度与候选权值按照6.5:3.5的比例进行加权求和,经多次试验验证在该比例时,获取到的答案的准确率更高。
上述文书中问答数据获取方法,通过实体词识别技术识别输入的文书问题中的实体词,将识别出的实体词作为文书问题的关键词,再对关键词进行同义词扩展以及语义扩展,得到提问因子,由此得到的提问因子涵盖了同义词和语义两个层面,对待处理文书进行拆分,得到多个文书片段,将包含提问因子的文书片段作为候选片段,这样得到的候选片段的范围更广,基于提问因子在候选片段中查找,得到文书问题的候选答案,再根据相似度对各候选答案进行排序,将排序最前的候选答案作为文书问题的答案,这样候选答案覆盖广,再对候选答案进行筛选最终确定文书问题的答案,可以有效提高获取到的提问答案的准确率。
在其中一个实施例中,获取单个候选片段与提问因子的匹配度,包括:获取同义词扩展处理后的第一词语数量以及语义扩展处理后的第二词语数量;将第一词语数量与第二词语数量之比以及单个候选片段输入至Elasticsearch检索模型,得到单个候选片段与提问因子的匹配度。比如可以将各文书片段分别存储至Elasticsearch检索模型中,Elasticsearch检索模型用于快速检索存储文档,将每个文书片段视为一篇文档。Elasticsearch检索模型可以先根据检索语句,比如以提问因子对文档进行粗提取,具体来说以提问因子遍历各个文书片段,排除不包括提问因子的文书片段,得到候选片段,即候选片段为包括提问因子的文书片段。然后根据提问因子中同义词扩展后的词语与语义扩展后的词语之比,返回候选片段与提问因子的匹配度。其中,同义词扩展后的词语与语义扩展后的词语之比具体可以是3:1,经多次试验验证在该比例时,获取到的答案的准确率更高。具体可以将候选片段放在候选列表中输出,Elasticsearch检索模型在返回候选片段时,还会返回相应的匹配度,匹配度具体可以是匹配程度的分值,将该分值作min-max归一化处理,并存入分值列表。
应该理解的是,虽然图2-4的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,图2-4中的至少一部分步骤可以包括多个子步骤或者多个阶段,这些子步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些子步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤的子步骤或者阶段的至少一部分轮流或者交替地执行。
在其中一个实施例中,如图5所示,提供了一种文书中问答数据获取装置,包括:信息获取模块502、关键词获取模块504、提问因子获取模块506、候选片段获取模块508、候选答案获取模块510和候选答案处理模块512。信息获取模块,用于获取待处理文书以及输入的文书问题。关键词获取模块,用于通过实体词识别技术识别文书问题中的实体词, 将识别出的实体词作为文书问题的关键词。提问因子获取模块,用于对关键词分别进行同义词扩展以及语义扩展,得到提问因子。候选片段获取模块,用于对待处理文书进行拆分,得到多个文书片段,将包含提问因子的文书片段作为候选片段。候选答案获取模块,用于基于提问因子在候选片段中查找,得到文书问题的候选答案。候选答案处理模块,用于根据相似度对各候选答案进行排序,将排序最前的候选答案作为文书问题的答案。
在其中一个实施例中,候选片段获取模块包括:第一拆分单元,用于将待处理文书转换成字符串,当待处理文书的字符串长度大于预设长度且待处理文书包括多个自然段时,按照自然段将待处理文书拆分为不同的文书片段;第二拆分单元,用于当待处理文书的字符串长度小于或等于预设长度时,基于预设滑窗长度和预设间距将待处理文书拆分为不同的文书片段。
在其中一个实施例中,候选答案获取模块包括:模型获取单元,用于获取已训练的阅读理解任务模型,阅读理解任务模型包括依次连接的嵌入层、嵌入编码层、语境-查询注意力层、模型编码层以及输出层;编码单元,用于将提问因子和候选片段输入至所述嵌入层,通过嵌入编码层分别对提问因子和候选片段进行编码,得到提问因子编码块和候选片段编码块;编码块处理单元,用于通过语境-查询注意力层获取提问因子编码块与候选片段编码块之间的相似度;位置获取单元,用于基于提问因子编码块与候选片段编码块之间的相似度,通过模型编码层获得候选答案的预测位置;位置处理单元,用于通过输出层解码计算每一个预测位置为候选答案开始位置的概率和候选答案结尾位置的概率,将概率大于预设第一阈值的预测位置作为候选答案开始位置,将概率大于预设第二阈值的预测位置作为候选答案结尾位置。
在其中一个实施例中,候选答案处理模块还用于对单个候选片段对应的多个候选答案进行两两相似度匹配计算,将相似度均值最高的候选答案作为单个候选片段的候选答案;将单个候选片段的候选答案与单个候选片段的其它候选答案的相似度均值作为单个候选片段的候选权值;获取单个候选片段与提问因子的匹配度,根据匹配度以及单个候选片段的候选权值,得到候选答案的权值;获取各候选片段的候选答案对应的权值,将各个权值中最高值对应的候选答案作为文书问题的答案。
在其中一个实施例中,候选答案处理模块还用于获取同义词扩展处理后的第一词语数量以及语义扩展处理后的第二词语数量;将第一词语数量与第二词语数量之比以及单个候选片段输入至Elasticsearch检索模型,得到单个候选片段与提问因子的匹配度。
关于文书中问答数据获取装置的具体限定可以参见上文中对于文书中问答数据获取方法的限定,在此不再赘述。上述文书中问答数据获取装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。
在一个实施例中,提供了一种计算机设备,该计算机设备可以是服务器,其内部结构 图可以如图6所示。该计算机设备包括通过系统总线连接的处理器、存储器、网络接口和数据库。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性或易失性存储介质、内存储器。该非易失性或易失性存储介质存储有操作系统、计算机可读指令和数据库。该内存储器为非易失性存储介质中的操作系统和计算机可读指令的运行提供环境。该计算机设备的数据库用于存储待处理文书、文书问题、提问因子、候选答案等数据。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机可读指令被处理器执行时以实现一种文书中问答数据获取方法。
本领域技术人员可以理解,图6中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。
一种计算机设备,包括存储器和一个或多个处理器,存储器中储存有计算机可读指令,计算机可读指令被处理器执行时,使得一个或多个处理器执行以下步骤:
获取待处理文书以及输入的文书问题;
通过实体词识别技术识别文书问题中的实体词,将识别出的实体词作为文书问题的关键词;
对关键词分别进行同义词扩展以及语义扩展,得到提问因子;
对待处理文书进行拆分,得到多个文书片段,将包含提问因子的文书片段作为候选片段;
基于提问因子在候选片段中查找,得到文书问题的候选答案;及
根据相似度对各候选答案进行排序,将排序最前的候选答案作为文书问题的答案。
在其中一个实施例中,处理器执行计算机可读指令时还实现以下步骤:
将待处理文书转换成字符串,当待处理文书的字符串长度大于预设长度且待处理文书包括多个自然段时,按照自然段将待处理文书拆分为不同的文书片段;及
当待处理文书的字符串长度小于或等于预设长度时,基于预设滑窗长度和预设间距将待处理文书拆分为不同的文书片段。
在其中一个实施例中,处理器执行计算机可读指令时还实现以下步骤:
获取已训练的阅读理解任务模型,阅读理解任务模型包括依次连接的嵌入层、嵌入编码层、语境-查询注意力层、模型编码层以及输出层;
将提问因子和候选片段输入至嵌入层,通过嵌入编码层分别对提问因子和候选片段进行编码,得到提问因子编码块和候选片段编码块;
通过语境-查询注意力层获取提问因子编码块与候选片段编码块之间的相似度;
基于提问因子编码块与候选片段编码块之间的相似度,通过模型编码层获得候选答案的预测位置;及
通过输出层解码计算每一个预测位置为候选答案开始位置的概率和候选答案结尾位 置的概率,将概率大于预设第一阈值的预测位置作为候选答案开始位置,将概率大于预设第二阈值的预测位置作为候选答案结尾位置。
在其中一个实施例中,处理器执行计算机可读指令时还实现以下步骤:
对单个候选片段对应的多个候选答案进行两两相似度匹配计算,将相似度均值最高的候选答案作为单个候选片段的候选答案;
将单个候选片段的候选答案与单个候选片段的其它候选答案的相似度均值作为单个候选片段的候选权值;
获取单个候选片段与提问因子的匹配度,根据匹配度以及单个候选片段的候选权值,得到候选答案的权值;及
获取各候选片段的候选答案对应的权值,将各个权值中最高值对应的候选答案作为文书问题的答案。
在其中一个实施例中,处理器执行计算机可读指令时还实现以下步骤:
获取同义词扩展处理后的第一词语数量以及语义扩展处理后的第二词语数量;及
将第一词语数量与第二词语数量之比以及单个候选片段输入至Elasticsearch检索模型,得到单个候选片段与提问因子的匹配度。
一个或多个存储有计算机可读指令的计算机可读存储介质,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行以下步骤:
获取待处理文书以及输入的文书问题;
通过实体词识别技术识别文书问题中的实体词,将识别出的实体词作为文书问题的关键词;
对关键词分别进行同义词扩展以及语义扩展,得到提问因子;
对待处理文书进行拆分,得到多个文书片段,将包含提问因子的文书片段作为候选片段;
基于提问因子在候选片段中查找,得到文书问题的候选答案;及
根据相似度对各候选答案进行排序,将排序最前的候选答案作为文书问题的答案。
其中,该计算机可读存储介质可以是非易失性,也可以是易失性的。
在其中一个实施例中,计算机可读指令被处理器执行时还实现以下步骤:
将待处理文书转换成字符串,当待处理文书的字符串长度大于预设长度且待处理文书包括多个自然段时,按照自然段将待处理文书拆分为不同的文书片段;及
当待处理文书的字符串长度小于或等于预设长度时,基于预设滑窗长度和预设间距将待处理文书拆分为不同的文书片段。
在其中一个实施例中,计算机可读指令被处理器执行时还实现以下步骤:
获取已训练的阅读理解任务模型,阅读理解任务模型包括依次连接的嵌入层、嵌入编码层、语境-查询注意力层、模型编码层以及输出层;
将提问因子和候选片段输入至嵌入层,通过嵌入编码层分别对提问因子和候选片段进行编码,得到提问因子编码块和候选片段编码块;
通过语境-查询注意力层获取提问因子编码块与候选片段编码块之间的相似度;
基于提问因子编码块与候选片段编码块之间的相似度,通过模型编码层获得候选答案的预测位置;及
通过输出层解码计算每一个预测位置为候选答案开始位置的概率和候选答案结尾位置的概率,将概率大于预设第一阈值的预测位置作为候选答案开始位置,将概率大于预设第二阈值的预测位置作为候选答案结尾位置。
在其中一个实施例中,计算机可读指令被处理器执行时还实现以下步骤:
对单个候选片段对应的多个候选答案进行两两相似度匹配计算,将相似度均值最高的候选答案作为单个候选片段的候选答案;
将单个候选片段的候选答案与单个候选片段的其它候选答案的相似度均值作为单个候选片段的候选权值;
获取单个候选片段与提问因子的匹配度,根据匹配度以及单个候选片段的候选权值,得到候选答案的权值;及
获取各候选片段的候选答案对应的权值,将各个权值中最高值对应的候选答案作为文书问题的答案。
在其中一个实施例中,计算机可读指令被处理器执行时还实现以下步骤:
获取同义词扩展处理后的第一词语数量以及语义扩展处理后的第二词语数量;及
将第一词语数量与第二词语数量之比以及单个候选片段输入至Elasticsearch检索模型,得到单个候选片段与提问因子的匹配度。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机可读指令来指令相关的硬件来完成,所述的计算机可读指令可存储于一计算机可读取存储介质中,该计算机可读指令在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。
以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。

Claims (20)

  1. 一种文书中问答数据获取方法,包括:
    获取待处理文书以及输入的文书问题;
    通过实体词识别技术识别所述文书问题中的实体词,将识别出的实体词作为所述文书问题的关键词;
    对所述关键词分别进行同义词扩展以及语义扩展,得到提问因子;
    对所述待处理文书进行拆分,得到多个文书片段,将包含所述提问因子的文书片段作为候选片段;
    基于所述提问因子在所述候选片段中查找,得到所述文书问题的候选答案;及
    根据相似度对各所述候选答案进行排序,将排序最前的候选答案作为所述文书问题的答案。
  2. 根据权利要求1所述的方法,其中,所述对所述待处理文书进行拆分,得到多个文书片段,包括:
    将所述待处理文书转换成字符串,当所述待处理文书的字符串长度大于预设长度且所述待处理文书包括多个自然段时,按照自然段将所述待处理文书拆分为不同的文书片段;及
    当所述待处理文书的字符串长度小于或等于预设长度时,基于预设滑窗长度和预设间距将所述待处理文书拆分为不同的文书片段。
  3. 根据权利要求1所述的方法,其中,所述基于所述提问因子在所述候选片段中查找,得到所述文书问题的候选答案,包括:
    获取已训练的阅读理解任务模型,所述阅读理解任务模型包括依次连接的嵌入层、嵌入编码层、语境-查询注意力层、模型编码层以及输出层;
    将所述提问因子和所述候选片段输入至所述嵌入层,通过所述嵌入编码层分别对所述提问因子和所述候选片段进行编码,得到提问因子编码块和候选片段编码块;
    通过所述语境-查询注意力层,获取所述提问因子编码块与所述候选片段编码块之间的相似度;
    基于所述提问因子编码块与所述候选片段编码块之间的相似度,通过模型编码层获得候选答案的预测位置;及
    通过所述输出层解码计算所述每一个预测位置为候选答案开始位置的概率和候选答案结尾位置的概率,将概率大于预设第一阈值的预测位置作为所述候选答案开始位置,将概率大于预设第二阈值的预测位置作为所述候选答案结尾位置。
  4. 根据权利要求1所述的方法,其中,所述根据相似度对各所述候选答案进行排序,将排序最前的候选答案作为所述文书问题的答案,包括:
    对单个候选片段对应的多个候选答案进行两两相似度匹配计算,将相似度均值最高的候选答案作为所述单个候选片段的候选答案;
    将所述单个候选片段的候选答案与所述单个候选片段的其它候选答案的相似度均值作为所述单个候选片段的候选权值;
    获取所述单个候选片段与所述提问因子的匹配度,根据所述匹配度以及所述单个候选片段的候选权值,得到所述候选答案的权值;及
    获取各候选片段的候选答案对应的权值,将各个权值中最高值对应的候选答案作为所述文书问题的答案。
  5. 根据权利要求4所述的方法,其中,所述获取所述单个候选片段与所述提问因子的匹配度,包括:
    获取同义词扩展处理后的第一词语数量以及语义扩展处理后的第二词语数量;及
    将所述第一词语数量与所述第二词语数量之比以及所述单个候选片段输入至Elasticsearch检索模型,得到所述单个候选片段与所述提问因子的匹配度。
  6. 根据权利要求4所述的方法,其中,所述根据所述匹配度以及所述单个候选片段的候选权值,得到所述候选答案的权值,包括:
    将所述匹配度以及所述单个候选片段的候选权值进行归一化处理,根据归一化处理后的匹配度以及候选权值进行加权求和,得到所述候选答案的权值。
  7. 根据权利要求1所述的方法,其中,所述对所述关键词分别进行同义词扩展以及语义扩展,得到提问因子,包括:
    基于所述关键词在预设同义词词典中查询,获得所述关键词对应的同义词;
    基于所述关键词在预设常识性知识库的同义关系中查找,获得所述关键词的同义词;及
    将获得的关键词对应的同义词作为提问因子。
  8. 一种文书中问答数据获取装置,其中,所述装置包括:
    信息获取模块,用于获取待处理文书以及输入的文书问题;
    关键词获取模块,用于通过实体词识别技术识别所述文书问题中的实体词,将识别出的实体词作为所述文书问题的关键词;
    提问因子获取模块,用于对所述关键词分别进行同义词扩展以及语义扩展,得到提问因子;
    候选片段获取模块,用于对所述待处理文书进行拆分,得到多个文书片段,将包含所述提问因子的文书片段作为候选片段;
    候选答案获取模块,用于基于所述提问因子在所述候选片段中查找,得到所述文书问题的候选答案;及
    候选答案处理模块,用于根据相似度对各所述候选答案进行排序,将排序最前的候选答案作为所述文书问题的答案。
  9. 一种计算机设备,包括存储器及一个或多个处理器,所述存储器中储存有计算机可读指令,所述计算机可读指令被所述一个或多个处理器执行时,使得所述一个或多个处 理器执行以下步骤:
    获取待处理文书以及输入的文书问题;
    通过实体词识别技术识别所述文书问题中的实体词,将识别出的实体词作为所述文书问题的关键词;
    对所述关键词分别进行同义词扩展以及语义扩展,得到提问因子;
    对所述待处理文书进行拆分,得到多个文书片段,将包含所述提问因子的文书片段作为候选片段;
    基于所述提问因子在所述候选片段中查找,得到所述文书问题的候选答案;及
    根据相似度对各所述候选答案进行排序,将排序最前的候选答案作为所述文书问题的答案。
  10. 根据权利要求9所述的计算机设备,其中,所述处理器执行所述计算机可读指令时还执行以下步骤:
    将所述待处理文书转换成字符串,当所述待处理文书的字符串长度大于预设长度且所述待处理文书包括多个自然段时,按照自然段将所述待处理文书拆分为不同的文书片段;及
    当所述待处理文书的字符串长度小于或等于预设长度时,基于预设滑窗长度和预设间距将所述待处理文书拆分为不同的文书片段。
  11. 根据权利要求9所述的计算机设备,其中,所述处理器执行所述计算机可读指令时还执行以下步骤:
    获取已训练的阅读理解任务模型,所述阅读理解任务模型包括依次连接的嵌入层、嵌入编码层、语境-查询注意力层、模型编码层以及输出层;
    将所述提问因子和所述候选片段输入至所述嵌入层,通过所述嵌入编码层分别对所述提问因子和所述候选片段进行编码,得到提问因子编码块和候选片段编码块;
    通过所述语境-查询注意力层,获取所述提问因子编码块与所述候选片段编码块之间的相似度;
    基于所述提问因子编码块与所述候选片段编码块之间的相似度,通过模型编码层获得候选答案的预测位置;及
    通过所述输出层解码计算所述每一个预测位置为候选答案开始位置的概率和候选答案结尾位置的概率,将概率大于预设第一阈值的预测位置作为所述候选答案开始位置,将概率大于预设第二阈值的预测位置作为所述候选答案结尾位置。
  12. 根据权利要求9所述的计算机设备,其中,所述处理器执行所述计算机可读指令时还执行以下步骤:
    对单个候选片段对应的多个候选答案进行两两相似度匹配计算,将相似度均值最高的候选答案作为所述单个候选片段的候选答案;
    将所述单个候选片段的候选答案与所述单个候选片段的其它候选答案的相似度均值 作为所述单个候选片段的候选权值;
    获取所述单个候选片段与所述提问因子的匹配度,根据所述匹配度以及所述单个候选片段的候选权值,得到所述候选答案的权值;及
    获取各候选片段的候选答案对应的权值,将各个权值中最高值对应的候选答案作为所述文书问题的答案。
  13. 根据权利要求12所述的计算机设备,其中,所述处理器执行所述计算机可读指令时还执行以下步骤:
    获取同义词扩展处理后的第一词语数量以及语义扩展处理后的第二词语数量;及
    将所述第一词语数量与所述第二词语数量之比以及所述单个候选片段输入至Elasticsearch检索模型,得到所述单个候选片段与所述提问因子的匹配度。
  14. 根据权利要求12所述的计算机设备,其中,所述处理器执行所述计算机可读指令时还执行以下步骤:
    将所述匹配度以及所述单个候选片段的候选权值进行归一化处理,根据归一化处理后的匹配度以及候选权值进行加权求和,得到所述候选答案的权值。
  15. 一个或多个存储有计算机可读指令的计算机可读存储介质,所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器执行以下步骤:
    获取待处理文书以及输入的文书问题;
    通过实体词识别技术识别所述文书问题中的实体词,将识别出的实体词作为所述文书问题的关键词;
    对所述关键词分别进行同义词扩展以及语义扩展,得到提问因子;
    对所述待处理文书进行拆分,得到多个文书片段,将包含所述提问因子的文书片段作为候选片段;
    基于所述提问因子在所述候选片段中查找,得到所述文书问题的候选答案;及
    根据相似度对各所述候选答案进行排序,将排序最前的候选答案作为所述文书问题的答案。
  16. 根据权利要求15所述的计算机可读存储介质,其中,所述计算机可读指令被所述处理器执行时还执行以下步骤:
    将所述待处理文书转换成字符串,当所述待处理文书的字符串长度大于预设长度且所述待处理文书包括多个自然段时,按照自然段将所述待处理文书拆分为不同的文书片段;及
    当所述待处理文书的字符串长度小于或等于预设长度时,基于预设滑窗长度和预设间距将所述待处理文书拆分为不同的文书片段。
  17. 根据权利要求16所述的计算机可读存储介质,其中,所述计算机可读指令被所述处理器执行时还执行以下步骤:
    获取已训练的阅读理解任务模型,所述阅读理解任务模型包括依次连接的嵌入层、嵌 入编码层、语境-查询注意力层、模型编码层以及输出层;
    将所述提问因子和所述候选片段输入至所述嵌入层,通过所述嵌入编码层分别对所述提问因子和所述候选片段进行编码,得到提问因子编码块和候选片段编码块;
    通过所述语境-查询注意力层,获取所述提问因子编码块与所述候选片段编码块之间的相似度;
    基于所述提问因子编码块与所述候选片段编码块之间的相似度,通过模型编码层获得候选答案的预测位置;及
    通过所述输出层解码计算所述每一个预测位置为候选答案开始位置的概率和候选答案结尾位置的概率,将概率大于预设第一阈值的预测位置作为所述候选答案开始位置,将概率大于预设第二阈值的预测位置作为所述候选答案结尾位置。
  18. 根据权利要求15所述的计算机可读存储介质,其中,所述计算机可读指令被所述处理器执行时还执行以下步骤:
    对单个候选片段对应的多个候选答案进行两两相似度匹配计算,将相似度均值最高的候选答案作为所述单个候选片段的候选答案;
    将所述单个候选片段的候选答案与所述单个候选片段的其它候选答案的相似度均值作为所述单个候选片段的候选权值;
    获取所述单个候选片段与所述提问因子的匹配度,根据所述匹配度以及所述单个候选片段的候选权值,得到所述候选答案的权值;及
    获取各候选片段的候选答案对应的权值,将各个权值中最高值对应的候选答案作为所述文书问题的答案。
  19. 根据权利要求18所述的计算机可读存储介质,其中,所述计算机可读指令被所述处理器执行时还执行以下步骤:
    获取同义词扩展处理后的第一词语数量以及语义扩展处理后的第二词语数量;及
    将所述第一词语数量与所述第二词语数量之比以及所述单个候选片段输入至Elasticsearch检索模型,得到所述单个候选片段与所述提问因子的匹配度。
  20. 根据权利要求18所述的计算机可读存储介质,其中,所述计算机可读指令被所述处理器执行时还执行以下步骤:
    将所述匹配度以及所述单个候选片段的候选权值进行归一化处理,根据归一化处理后的匹配度以及候选权值进行加权求和,得到所述候选答案的权值。
PCT/CN2020/106124 2019-10-12 2020-07-31 文书中问答数据获取方法、装置、计算机设备和存储介质 WO2021068615A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910970168.8A CN110955761A (zh) 2019-10-12 2019-10-12 文书中问答数据获取方法、装置、计算机设备和存储介质
CN201910970168.8 2019-10-12

Publications (1)

Publication Number Publication Date
WO2021068615A1 true WO2021068615A1 (zh) 2021-04-15

Family

ID=69975597

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/106124 WO2021068615A1 (zh) 2019-10-12 2020-07-31 文书中问答数据获取方法、装置、计算机设备和存储介质

Country Status (2)

Country Link
CN (1) CN110955761A (zh)
WO (1) WO2021068615A1 (zh)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113204976A (zh) * 2021-04-19 2021-08-03 北京大学 一种实时问答方法及系统
CN113220832A (zh) * 2021-04-30 2021-08-06 北京金山数字娱乐科技有限公司 一种文本处理方法及装置
CN113515932A (zh) * 2021-07-28 2021-10-19 北京百度网讯科技有限公司 处理问答信息的方法、装置、设备和存储介质
CN113536788A (zh) * 2021-07-28 2021-10-22 平安科技(深圳)有限公司 信息处理方法、装置、存储介质及设备
CN113553412A (zh) * 2021-06-30 2021-10-26 北京百度网讯科技有限公司 问答处理方法、装置、电子设备和存储介质
CN113656393A (zh) * 2021-08-24 2021-11-16 北京百度网讯科技有限公司 数据处理方法、装置、电子设备以及存储介质
CN115292469A (zh) * 2022-09-28 2022-11-04 之江实验室 一种结合段落搜索和机器阅读理解的问答方法
CN117056497A (zh) * 2023-10-13 2023-11-14 北京睿企信息科技有限公司 一种基于llm的问答方法、电子设备及存储介质
CN117669512A (zh) * 2024-02-01 2024-03-08 腾讯科技(深圳)有限公司 答案生成方法、装置、设备及存储介质

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110955761A (zh) * 2019-10-12 2020-04-03 深圳壹账通智能科技有限公司 文书中问答数据获取方法、装置、计算机设备和存储介质
CN111625635B (zh) * 2020-05-27 2023-09-29 北京百度网讯科技有限公司 问答处理方法、装置、设备及存储介质
CN111782790A (zh) * 2020-07-03 2020-10-16 阳光保险集团股份有限公司 一种文档的分析方法、装置、电子设备及存储介质
CN112287080B (zh) * 2020-10-23 2023-10-03 平安科技(深圳)有限公司 问题语句的改写方法、装置、计算机设备和存储介质
CN112417126B (zh) * 2020-12-02 2024-01-23 车智互联(北京)科技有限公司 一种问答方法、计算设备以及存储介质
CN112507079B (zh) * 2020-12-15 2023-01-17 科大讯飞股份有限公司 文书间案情匹配方法、装置、设备及存储介质
CN113157890A (zh) * 2021-04-25 2021-07-23 深圳壹账通智能科技有限公司 智能问答方法、装置、电子设备及可读存储介质
CN113076431B (zh) * 2021-04-28 2022-09-02 平安科技(深圳)有限公司 机器阅读理解的问答方法、装置、计算机设备及存储介质
CN114330718B (zh) * 2021-12-23 2023-03-24 北京百度网讯科技有限公司 因果关系的提取方法、装置及电子设备
CN116340467B (zh) * 2023-05-11 2023-11-17 腾讯科技(深圳)有限公司 文本处理方法、装置、电子设备、及计算机可读存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090018984A1 (en) * 2000-06-30 2009-01-15 Solinsky James C System and method for dynamic knowledge construction
CN103902652A (zh) * 2014-02-27 2014-07-02 深圳市智搜信息技术有限公司 自动问答系统
CN109697228A (zh) * 2018-12-13 2019-04-30 平安科技(深圳)有限公司 智能问答方法、装置、计算机设备及存储介质
CN109800284A (zh) * 2018-12-19 2019-05-24 中国电子科技集团公司第二十八研究所 一种面向任务的非结构化信息智能问答系统构建方法
CN110955761A (zh) * 2019-10-12 2020-04-03 深圳壹账通智能科技有限公司 文书中问答数据获取方法、装置、计算机设备和存储介质

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180089569A1 (en) * 2016-09-28 2018-03-29 International Business Machines Corporation Generating a temporal answer to a question

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090018984A1 (en) * 2000-06-30 2009-01-15 Solinsky James C System and method for dynamic knowledge construction
CN103902652A (zh) * 2014-02-27 2014-07-02 深圳市智搜信息技术有限公司 自动问答系统
CN109697228A (zh) * 2018-12-13 2019-04-30 平安科技(深圳)有限公司 智能问答方法、装置、计算机设备及存储介质
CN109800284A (zh) * 2018-12-19 2019-05-24 中国电子科技集团公司第二十八研究所 一种面向任务的非结构化信息智能问答系统构建方法
CN110955761A (zh) * 2019-10-12 2020-04-03 深圳壹账通智能科技有限公司 文书中问答数据获取方法、装置、计算机设备和存储介质

Cited By (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113204976A (zh) * 2021-04-19 2021-08-03 北京大学 一种实时问答方法及系统
CN113204976B (zh) * 2021-04-19 2024-03-29 北京大学 一种实时问答方法及系统
CN113220832A (zh) * 2021-04-30 2021-08-06 北京金山数字娱乐科技有限公司 一种文本处理方法及装置
CN113220832B (zh) * 2021-04-30 2023-09-05 北京金山数字娱乐科技有限公司 一种文本处理方法及装置
CN113553412B (zh) * 2021-06-30 2023-07-25 北京百度网讯科技有限公司 问答处理方法、装置、电子设备和存储介质
CN113553412A (zh) * 2021-06-30 2021-10-26 北京百度网讯科技有限公司 问答处理方法、装置、电子设备和存储介质
CN113515932A (zh) * 2021-07-28 2021-10-19 北京百度网讯科技有限公司 处理问答信息的方法、装置、设备和存储介质
CN113536788A (zh) * 2021-07-28 2021-10-22 平安科技(深圳)有限公司 信息处理方法、装置、存储介质及设备
CN113515932B (zh) * 2021-07-28 2023-11-10 北京百度网讯科技有限公司 处理问答信息的方法、装置、设备和存储介质
CN113536788B (zh) * 2021-07-28 2023-12-05 平安科技(上海)有限公司 信息处理方法、装置、存储介质及设备
CN113656393A (zh) * 2021-08-24 2021-11-16 北京百度网讯科技有限公司 数据处理方法、装置、电子设备以及存储介质
CN113656393B (zh) * 2021-08-24 2024-01-12 北京百度网讯科技有限公司 数据处理方法、装置、电子设备以及存储介质
CN115292469A (zh) * 2022-09-28 2022-11-04 之江实验室 一种结合段落搜索和机器阅读理解的问答方法
CN115292469B (zh) * 2022-09-28 2023-02-07 之江实验室 一种结合段落搜索和机器阅读理解的问答方法
CN117056497A (zh) * 2023-10-13 2023-11-14 北京睿企信息科技有限公司 一种基于llm的问答方法、电子设备及存储介质
CN117056497B (zh) * 2023-10-13 2024-01-23 北京睿企信息科技有限公司 一种基于llm的问答方法、电子设备及存储介质
CN117669512A (zh) * 2024-02-01 2024-03-08 腾讯科技(深圳)有限公司 答案生成方法、装置、设备及存储介质
CN117669512B (zh) * 2024-02-01 2024-05-14 腾讯科技(深圳)有限公司 答案生成方法、装置、设备及存储介质

Also Published As

Publication number Publication date
CN110955761A (zh) 2020-04-03

Similar Documents

Publication Publication Date Title
WO2021068615A1 (zh) 文书中问答数据获取方法、装置、计算机设备和存储介质
WO2021027533A1 (zh) 文本语义识别方法、装置、计算机设备和存储介质
WO2020258506A1 (zh) 文本信息匹配度检测方法、装置、计算机设备和存储介质
CN112818093B (zh) 基于语义匹配的证据文档检索方法、系统及存储介质
CN113076431B (zh) 机器阅读理解的问答方法、装置、计算机设备及存储介质
CN111191002B (zh) 一种基于分层嵌入的神经代码搜索方法及装置
CN109543007A (zh) 提问数据生成方法、装置、计算机设备和存储介质
CN112287069B (zh) 基于语音语义的信息检索方法、装置及计算机设备
CN110879834B (zh) 一种基于循环卷积网络的观点检索系统及其观点检索方法
CN111178053B (zh) 一种结合语义和文本结构进行生成式摘要抽取的文本生成方法
CN111291177A (zh) 一种信息处理方法、装置和计算机存储介质
CN111291188A (zh) 一种智能信息抽取方法及系统
US20200073890A1 (en) Intelligent search platforms
CN112395875A (zh) 一种关键词提取方法、装置、终端以及存储介质
CN111985228A (zh) 文本关键词提取方法、装置、计算机设备和存储介质
CN112766319A (zh) 对话意图识别模型训练方法、装置、计算机设备及介质
CN114756733A (zh) 一种相似文档搜索方法、装置、电子设备及存储介质
CN112307182A (zh) 一种基于问答系统的伪相关反馈的扩展查询方法
Ahmed et al. Named entity recognition by using maximum entropy
CN111143507A (zh) 一种基于复合式问题的阅读理解方法
CN112632258A (zh) 文本数据处理方法、装置、计算机设备和存储介质
CN114298055B (zh) 基于多级语义匹配的检索方法、装置、计算机设备和存储介质
CN110309504B (zh) 基于分词的文本处理方法、装置、设备及存储介质
Li et al. LSTM-based deep learning models for answer ranking
CN111507108B (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: 20874728

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 180822)

122 Ep: pct application non-entry in european phase

Ref document number: 20874728

Country of ref document: EP

Kind code of ref document: A1