WO2021003813A1 - 基于神经网络模型的答案生成方法及相关设备 - Google Patents

基于神经网络模型的答案生成方法及相关设备 Download PDF

Info

Publication number
WO2021003813A1
WO2021003813A1 PCT/CN2019/102574 CN2019102574W WO2021003813A1 WO 2021003813 A1 WO2021003813 A1 WO 2021003813A1 CN 2019102574 W CN2019102574 W CN 2019102574W WO 2021003813 A1 WO2021003813 A1 WO 2021003813A1
Authority
WO
WIPO (PCT)
Prior art keywords
word vector
word
question
answer
initial
Prior art date
Application number
PCT/CN2019/102574
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 WO2021003813A1 publication Critical patent/WO2021003813A1/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
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/10Office automation; Time management
    • G06Q10/105Human resources
    • G06Q10/1053Employment or hiring
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • This application relates to the field of artificial intelligence technology, and in particular to an answer generation method and related equipment based on a neural network model.
  • the inventor realizes that at present, in the interview process, it is impossible to obtain an accurate analysis of whether the interviewer's answer meets the expected answer.
  • Manual analysis is usually used to judge whether the interviewer's answer to the interview question meets the requirements. This is easily disturbed by the interviewer’s subjective emotions and cannot give an objective and fair evaluation.
  • a neural network model-based answer generation method and related equipment are provided for the problem that the correct answer distribution of complex questions cannot be obtained in the current AI interview process.
  • This application provides an answer generation method based on a neural network model, including the following steps:
  • Obtain the question sentence convert the question sentence to word vector, extract the word vector of the question word in the question sentence after the word vector conversion, obtain the position information of the question word in the question sentence, and splice the position information and After the word vector of the question word, the position word vector is obtained; after the word vector of the question word and the position word vector are entered into the preset word vector embedding model in turn, the embedded word vector and the sample word vector are obtained; The sample word vector and the embedded word vector are added to the memory neural model for calculation to obtain an initial answer; the initial answer and the position word vector are used as parameters to construct an initial answer model, and the initial answer is used as Associated items, a final answer model is obtained after concatenating several initial answer models, and the distribution range of candidate answers of the question sentence is determined according to the output result of the final answer model.
  • This application provides an answer generation device based on a neural network model, including the following modules:
  • the sentence analysis module is configured to obtain a question sentence, perform word vector conversion on the question sentence, extract the word vector of the question word in the question sentence after the word vector conversion, and obtain the position information of the question word in the question sentence, Splicing the position information and the word vector of the question word to obtain a position word vector;
  • the embedding generation module is configured to sequentially input the word vector of the question word and the position word vector into a preset word vector embedding model to obtain the embedded word vector and the sample word vector;
  • the initial answer module is configured to add the sample word vector and the embedded word vector to the memory neural model for calculation to obtain an initial answer
  • the answer distribution module is set to use the initial answer and the position word vector as parameters to construct an initial answer model, use the initial answer as an associated item, and concatenate several initial answer models to obtain a final answer model.
  • the output result of the final answer model is described, and the distribution range of the candidate answers of the question sentence is determined.
  • a computer device includes a memory and a processor, and the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the processor executes the above-mentioned neural network model-based answer generation Method steps.
  • a storage medium storing computer-readable instructions.
  • the one or more processors execute the steps of the above-mentioned neural network model-based answer generation method.
  • this application adopts the method of concatenating multiple initial answers, and introduces the position information of the question words when the word vector is input to the model, so as to realize the step-by-step analysis of the complex interview questions, and accurately obtain the complex The distribution range of the answers to the interview questions.
  • Figure 1 is an overall flowchart of a neural network model-based answer generation method in an embodiment of the application
  • FIG. 2 is a schematic diagram of a sentence analysis process in a neural network model-based answer generation method in an embodiment of this application;
  • Figure 3 is a schematic diagram of the embedding generation process in a neural network model-based answer generation method in an embodiment of the application
  • FIG. 4 is a schematic diagram of the initial answer generation process in a neural network model-based answer generation method in an embodiment of the application
  • FIG. 5 is a schematic diagram of an answer distribution generation process in a neural network model-based answer generation method in an embodiment of the present application
  • Fig. 6 is a structural diagram of an answer generation device based on a neural network model in an embodiment of the application.
  • FIG. 1 is an overall flowchart of a neural network model-based answer generation method in an embodiment of this application.
  • a neural network model-based answer generation method includes the following steps:
  • an expected length of the sentence may be set first, and at least one complete question sentence is contained within the expected length. Then divide the interview question segment into several expected question sentences according to the expected length, and perform question word query on the expected question sentence. If a question word is included in the expected question sentence, the expected interview question length is taken as the actual question sentence length. If the question word is not included in the expected question sentence, sentence expansion is performed on both sides of the expected question sentence until the question word is obtained. If the expected question sentence contains two or more question words, the expected question sentence is split again according to the question of the question word in the expected question sentence. Among them, the question words can be: "answer", "why", etc.
  • Word2Vec can convert One-Hot Encoder into low-dimensional continuous values, that is, dense vectors, and words with similar meanings will be mapped to similar vector spaces. s position.
  • the word vector embedding model can generate a vocabulary based on the attributes of all words in the corpus, where the corpus collects words in Chinese dictionaries and online popular users and sorts them out.
  • the attributes include part of speech classification and the distribution of words in the corpus under each part of speech classification.
  • the classification of words can be divided into "noun”, "verb", "adjective” and so on.
  • the word vector and position word vector of the question word can be classified into the embedding model to obtain the embedded word vector m and the sample word vector u.
  • the calculation process can be: take the outer product of the vector P and the embedded word vector m to obtain the vector o, and at the same time multiply the vector p and the preset parameter matrix W before using sigmoid
  • the function is compressed to the interval of 0-1 to obtain the adaptive conversion coefficient T according to the sample vector u, and the parameter matrix w is obtained after counting the historical data of the answer results.
  • the parameter vector when constructing the initial answer model, includes the embedded word vector m and the sample word vector u.
  • the other vectors are calculated according to the foregoing steps, that is, you only need to input the embedded vector m and the sample vector u to get The initial answer result A, and then according to m, u and A, the input and output of the initial answer model can be obtained.
  • the initial answer result A is used as the input u of the next initial answer model, that is, the previous initial answer result vector A is used as the input vector u of the next initial answer model, and then input
  • the original embedded word vector m can be calculated again to get the secondary answer.
  • the final answer vector of the question sentence can be obtained by concatenating several initial answer models, and then the final answer vector can be used to calculate the relative probability of Softmax to get the range distribution of alternative answers.
  • multiple initial answers are concatenated, and position information of question words is introduced into the word vector input model, thereby realizing a step-by-step analysis of complex interview questions, thereby accurately obtaining answers to complex interview questions distribution area.
  • FIG. 2 is a schematic diagram of the sentence analysis process in a neural network model-based answer generation method in an embodiment of the application.
  • the S1 the question sentence is obtained, and the question sentence is converted into word vectors.
  • Extracting the word vector of the question word in the question sentence after word vector conversion, obtaining the position information of the question word in the question sentence, splicing the position information and the word vector of the question word to obtain the position word vector include:
  • one-hot encoding also known as one-hot encoding
  • one-hot encoding is a commonly used word vector encoding method commonly used in machine learning. For example, suppose there is a characteristic of our company and other companies, the sample is as follows:
  • N the number of the N attributes in each sample. Only one of the N attributes in each sample can be 1, which means that the attribute of the sample belongs to this category. The remaining extended attributes are all 0.
  • the position number of the question word is: "1"
  • the position word vector is introduced to realize the tracking of interview questions, thereby facilitating the analysis of complex interview questions.
  • FIG. 3 is a schematic diagram of the embedding generation process in a neural network model-based answer generation method in an embodiment of this application.
  • the S2 the word vector of the question word and the position word
  • the embedded word vector and the sample word vector are obtained, including:
  • the basic word vector template contains the multi-dimensional vector representation of each basic word.
  • the word vector or position word vector of the question word and the multi-dimensional word vector in the basic word vector template are all reduced in dimensionality to obtain a two-dimensional vector.
  • the two-dimensional position word vector or the word vector of the question word and the two-dimensional word vector in the basic word vector template take the inner product.
  • the inner product is zero, the word vector of the question word or the word vector of the position word in the basic word is obtained.
  • the corresponding word vector in the vector template is the form of the goal pursued in terms of design variables, so the objective function is the function of the design variables and is a scalar.
  • the objective function is the performance standard of the system, such as the lightest weight, lowest cost, and most reasonable form of a structure; the shortest production time and minimum energy consumption of a product; the best formula for an experiment, etc.
  • the process of establishing the objective function is the process of finding the relationship between the design variables and the target.
  • the relationship between the objective function and the design variables can be represented by curves, surfaces or hypersurfaces.
  • the objective function can be calculated using the following formula:
  • the intermediate parameter that can be obtained is T* ⁇ , where ⁇ is the embedding angle, that is, the angle between the word and the word in the coordinate system.
  • a sample word vector is obtained after processing the word vector of the question word by introducing the basic word vector, thereby facilitating effective analysis of the question word attribute in the question sentence.
  • Figure 4 is a schematic diagram of the initial answer generation process in a neural network model-based answer generation method in an embodiment of the application. As shown in the figure, the S3 combines the sample word vector and the embedded word vector After entering the memory neural model together for calculation, the initial answer is obtained, including:
  • the sample word vector and the position word vector are operated, and the operation may be an inner product operation.
  • the sample word vector and the position word vector need to be reduced in dimensionality to obtain a two-dimensional Vector, and then calculate.
  • the probability analysis function is mainly the softmax function.
  • the word vector to be analyzed needs to be de-vectored, that is, when performing the softmax function calculation, the input parameters are all scalars.
  • the activation function can be a sigmoid function, and the initial answer result is changed into an answer with a value range of 0 to 1 through the sigmoid function.
  • the vector corresponding to the uncorrected initial answer is [2,3,5]
  • the vector obtained after sigmoid function compression and correction is [0.4,0.6,1].
  • the interview questions are effectively analyzed through neural network models, activation functions, etc., so as to obtain accurate initial answer results, which is convenient for subsequent analysis of the distribution of complex questions.
  • Figure 5 is a schematic diagram of the answer distribution generation process in a neural network model-based answer generation method in an embodiment of the application.
  • the S4 uses the initial answer and the position word vector as Construct an initial answer model with parameters, use the initial answer as a correlation item, and concatenate several initial answer models to obtain a final answer model, and determine the candidate answer distribution of the question sentence according to the output result of the final answer model
  • the scope includes:
  • Z is the confidence interval
  • n is the number of initial results
  • d is the sampling error range
  • is the standard deviation, generally 0.5.
  • E is the standard deviation of the initial result mean multiplied by the z value, and the total error p.
  • the answer probability distribution analysis can be performed on the answer results obtained each time, that is, a range value of the answer distribution can be preset, and this probability range value can be in a normal distribution, and then The sigmoid function and softmax function are used to obtain the probability distribution every time the result of the answer is obtained. If the probability distribution is less than the distribution range of the preset probability value in the normal distribution graph, the series connection operation is stopped. For example, in the normal distribution graph, the probability distribution width of 95% or more is "2". If the width of the probability distribution of 95% or more obtained after performing an initial answer model calculation is "1.9", the next calculation is stopped.
  • the voting mechanism in the neural network model can be used for the classification operation of the final result, that is, several classifiers are set in the neural network model to classify and vote the final answer results, and then the answer range corresponding to the question sentence is obtained according to the voting results distributed.
  • the obtaining a preset basic word vector template, and obtaining the word vector of the question word according to the correspondence between the basic word vector template and the word vector of the question word or the position word vector Or the objective function value of the position word vector includes:
  • the word vector of the two-dimensional question word or the two-dimensional position word vector is obtained;
  • PCA dimensionality reduction can be used in the process of dimensionality reduction.
  • PCA dimensionality reduction is also known as principal component analysis. It is the most commonly used method of linear dimensionality reduction. Its goal is to transform high-dimensional The data is mapped into a low-dimensional space, that is, the original n features are replaced with a smaller number of m features, and the new features are a linear combination of the old features. And it is expected that the variance of the data in the projected dimension is the largest, and the new m features are as uncorrelated as possible. The mapping from old features to new features captures the inherent variability in the data. In this way, fewer data dimensions are used while retaining the characteristics of more original data points.
  • Obtain a preset word vector template transpose the word vector of the two-dimensional question word or the two-dimensional position word vector and perform inner product calculation with the standard word vector in the preset word vector template to extract
  • the standard word vector with an inner product of 0 is used as the word vector of the question word or the standard word vector corresponding to the position word vector;
  • the standard word vector is used as a parameter into the objective function to obtain the initial objective function value.
  • the calculation formula is as follows:
  • T identifies the objective function
  • w i indicate phrases in Corpus vector of the i-th word
  • u i denotes the standard word feature vector value
  • C (w i, u i ) represents the context of W i;
  • the initial objective function value is corrected by applying the regularization term to obtain the final objective function value.
  • the correction process is to calculate the product of the regularization term and the objective function value, and the regularization term is used as the correction direction to effectively correct the objective function value.
  • the objective function value is accurately obtained, so that the semantics of the interview question can be analyzed more accurately.
  • the operation of the sample word vector and the position word vector to obtain the word vector to be analyzed includes:
  • a vector matrix to be analyzed is obtained; wherein the matrix element is the product value of the sample word vector and the position word vector.
  • the eigenvalue of the matrix cannot be zero. If the eigenvalue of the matrix is zero, the position of the question word in the question sentence needs to be reselected. For example: "Why choose my company", the original question word is "1”, then it will be "2" after reselecting.
  • the final word vector to be analyzed is obtained.
  • the error correction can adopt Granger's formulation theorem or Engle-Granger two-step method to correct.
  • This embodiment effectively obtains the final word vector to be analyzed, thereby increasing the accuracy of obtaining the distribution of interview questions.
  • an answer generation device based on a neural network model is proposed, as shown in Figure 6, including the following modules:
  • the sentence analysis module is configured to obtain a question sentence, perform word vector conversion on the question sentence, extract the word vector of the question word in the question sentence after the word vector conversion, and obtain the position information of the question word in the question sentence, Splicing the position information and the word vector of the question word to obtain a position word vector;
  • the embedding generation module is configured to sequentially input the word vector of the question word and the position word vector into a preset word vector embedding model to obtain the embedded word vector and the sample word vector;
  • the initial answer module is configured to add the sample word vector and the embedded word vector to the memory neural model for calculation to obtain an initial answer
  • the answer distribution module is set to use the initial answer and the position word vector as parameters to construct an initial answer model, use the initial answer as an associated item, and concatenate several initial answer models to obtain a final answer model.
  • the output result of the final answer model is described, and the distribution range of the candidate answers of the question sentence is determined.
  • the sentence analysis module is further set to:
  • the embedded generation module is further configured to:
  • Obtain a preset basic word vector template and obtain the word vector of the question word or the target of the position word vector according to the correspondence between the basic word vector template and the word vector of the question word or the position word vector Function value; input the objective function value into the word vector embedding model to obtain intermediate parameters; multiply the intermediate parameter and the word vector of the question word to obtain the embedded word vector, and convert the intermediate parameter
  • the sample word vector is obtained after multiplying with the position word vector.
  • the initial answer module is further set to:
  • the word vector to be analyzed is obtained; the probability analysis function in the memory neural model is obtained, and the vector to be analyzed is input into the probability analysis function for calculation , Obtain the uncorrected initial answer; apply the activation function to compress the uncorrected initial answer to obtain the corrected initial answer.
  • the answer distribution module is further set to:
  • a computer device includes a memory and a processor.
  • the memory stores computer readable instructions.
  • the processor executes the following steps:.
  • Obtain the question sentence convert the question sentence to word vector, extract the word vector of the question word in the question sentence after the word vector conversion, obtain the position information of the question word in the question sentence, and splice the position information and After the word vector of the question word, the position word vector is obtained; after the word vector of the question word and the position word vector are entered into the preset word vector embedding model in turn, the embedded word vector and the sample word vector are obtained; The sample word vector and the embedded word vector are added to the memory neural model for calculation to obtain an initial answer; the initial answer and the position word vector are used as parameters to construct an initial answer model, and the initial answer is used as Associated items, a final answer model is obtained after concatenating several initial answer models, and the distribution range of candidate answers of the question sentence is determined according to the output result of the final answer model.
  • the present application also provides a non-volatile computer-readable storage medium, including instructions, which when run on a computer, cause the computer to execute the following steps of the neural network model-based answer generation method:
  • Obtain the question sentence convert the question sentence to word vector, extract the word vector of the question word in the question sentence after the word vector conversion, obtain the position information of the question word in the question sentence, and splice the position information and After the word vector of the question word, the position word vector is obtained; after the word vector of the question word and the position word vector are entered into the preset word vector embedding model in turn, the embedded word vector and the sample word vector are obtained; The sample word vector and the embedded word vector are added to the memory neural model for calculation to obtain an initial answer; the initial answer and the position word vector are used as parameters to construct an initial answer model, and the initial answer is used as Associated item, a final answer model is obtained after concatenating several initial answer models, and the distribution range of candidate answers of the question sentence is determined according to the output result of the final answer model.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • Theoretical Computer Science (AREA)
  • Human Resources & Organizations (AREA)
  • Data Mining & Analysis (AREA)
  • Mathematical Physics (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • General Engineering & Computer Science (AREA)
  • Strategic Management (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Artificial Intelligence (AREA)
  • Health & Medical Sciences (AREA)
  • Economics (AREA)
  • Biomedical Technology (AREA)
  • Software Systems (AREA)
  • Computing Systems (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Evolutionary Computation (AREA)
  • Molecular Biology (AREA)
  • General Health & Medical Sciences (AREA)
  • Biophysics (AREA)
  • Marketing (AREA)
  • Operations Research (AREA)
  • Quality & Reliability (AREA)
  • Tourism & Hospitality (AREA)
  • General Business, Economics & Management (AREA)
  • Human Computer Interaction (AREA)
  • Databases & Information Systems (AREA)
  • Machine Translation (AREA)

Abstract

一种基于神经网络模型的答案生成方法、装置、计算机设备和存储介质,包括:获取提问语句,将所述提问语句进行词向量转换,提取词向量转换后的提问语句中问题词的词向量,获取所述问题词在所述提问语句中的位置信息,拼接所述位置信息和所述问题词的词向量后得到位置词向量(S1);将所述问题词的词向量和所述位置词向量依次入参到预设的词向量嵌入模型后,得到嵌入词向量和样本词向量(S2);将所述样本词向量与所述嵌入词向量一同入参到记忆神经模型进行运算后,得到初始答案(S3);以所述初始答案和所述位置词向量作为参数构建初始答案模型,以所述初始答案作为关联项,串接数个所述初始答案模型后得到最终答案模型,根据所述最终答案模型的输出结果,确定所述提问语句的备选答案分布范围(S4)。该方法通过串接多个问题分析模型后,能够有效的给出复杂问题的分布情况。

Description

基于神经网络模型的答案生成方法及相关设备
本申请要求于2019年7月5日提交中国专利局、申请号为201910606471.X、发明名称为“基于神经网络模型的答案生成方法及相关设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及人工智能技术领域,尤其涉及一种基于神经网络模型的答案生成方法及相关设备。
背景技术
普通面试程序复杂,基本上所有的企业单位对于人员的招聘,都是要从很多应聘者的简历中挑选出合格的简历,然后通过一系列的面试步骤对应聘者进行面试和考察,每一个面试步骤都要对面试方式和面试时间进行精心安排以减少对面试官或者应聘者的日常工作和生活的影响。因此大部分的面试过程都是繁杂并且耗时的,白白浪费了参与面试的相关人员的时间,浪费了企业的资源。
发明人意识到目前,在面试过程中,对于面试者的答案是否符合预期答案无法得出准确的分析,通常采用人工分析的方式对面试者回答面试问题是否符合要求进行判断。这容易受到面试官主观情绪干扰而无法给出客观公正的评价。
发明内容
基于此,针对目前AI面试过程中无法对复杂问题得到正确答案分布情况的问题,提供一种基于神经网络模型的答案生成方法及相关设备。
本申请提供了一种基于神经网络模型的答案生成方法,包括如下步骤:
获取提问语句,将所述提问语句进行词向量转换,提取词向量转换后的提问语句中问题词的词向量,获取所述问题词在所述提问语句中的位置信息,拼接所述位置信息和所述问题词的词向量后得到位置词向量;将所述问题词的词向量和所述位置词向量依次入参到预设的词向量嵌入模型后,得到嵌入词向量和样本词向量;将所述样本词向量与所述嵌入词向量一同入参到记忆神经模型进行运算后,得到初始答案;以所述初始答案和所述位置词向量作为参数构建初始答案模型,以所述初始答案作为关联项,串接数个所述初始答案模型后得到最终答案模型,根据所述最终答案模型的输出结果,确定所述提问语句的备选答案分布范围。
本申请提供了一种基于神经网络模型的答案生成装置,包括如下模块:
语句分析模块,设置为获取提问语句,将所述提问语句进行词向量转换,提取词向量转换后的提问语句中问题词的词向量,获取所述问题词在所述提问语句中的位置信息,拼接所述位置信息和所述问题词的词向量后得到位置词向量;
嵌入生成模块,设置为将所述问题词的词向量和所述位置词向量依次入参到预设的词向量嵌入模型后,得到嵌入词向量和样本词向量;
初始答案模块,设置为将所述样本词向量与所述嵌入词向量一同入参到记忆神经模型进行运算后,得到初始答案;
答案分布模块,设置为以所述初始答案和所述位置词向量作为参数构建初始答案模型,以所述初始答案作为关联项,串接数个所述初始答案模型后得到最终答案模型,根据所述最终答案模型的输出结果,确定所述提问语句的备选答案分布范围。
一种计算机设备,包括存储器和处理器,所述存储器中存储有计算机可读指令,所述计算机可读指令被所述处理器执行时,使得所述处理器执行上述基于神经网络模型的答案生成方法的步骤。
一种存储有计算机可读指令的存储介质,所述计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行上述基于神经网络模型的答案生成方法的步骤。
与现有机制相比,本申请通过采用多个初始答案串接的方式,并在词向量输入模型时引入问题词的位置信息,从而实现了对复杂面试问题逐级分析,准确的得到了复杂面试问题答案的分布范围。
附图说明
通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本申请的限制。
图1为本申请在一个实施例中的一种基于神经网络模型的答案生成方法的整体流程图;
图2为本申请在一个实施例中的一种基于神经网络模型的答案生成方法中的语句分析过程示意图;
图3为本申请在一个实施例中的一种基于神经网络模型的答案生成方法中 的嵌入生成过程示意图;
图4为本申请在一个实施例中的一种基于神经网络模型的答案生成方法中的初始答案生成过程示意图;
图5为本申请在一个实施例中的一种基于神经网络模型的答案生成方法中的答案分布生成过程示意图;
图6为本申请在一个实施例中的一种基于神经网络模型的答案生成装置的结构图。
具体实施方式
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
本技术领域技术人员可以理解,除非特意声明,这里使用的单数形式“一”、“一个”、“所述”和“该”也可包括复数形式。应该进一步理解的是,本申请的说明书中使用的措辞“包括”是指存在所述特征、整数、步骤、操作、元件和/或组件,但是并不排除存在或添加一个或多个其他特征、整数、步骤、操作、元件、组件和/或它们的组。
图1为本申请在一个实施例中的一种基于神经网络模型的答案生成方法的整体流程图,一种基于神经网络模型的答案生成方法,包括以下步骤:
S1、获取提问语句,将所述提问语句进行词向量转换,提取词向量转换后的提问语句中问题词的词向量,获取所述问题词在所述提问语句中的位置信息,拼接所述位置信息和所述问题词的词向量后得到位置词向量;
具体的,在对提问语句进行获取时,可以先设置一个语句预期长度,在这个预期长度内包含有至少一个完整的提问语句。然后根据这个预期长度将面试问题语段划分成数个预期提问语句,对预期提问语句进行问题词查询,若在预期提问语句中包含有一个问题词,则以预期面试问题长度作为实际提问语句的长度。若预期提问语句中不包含问题词,则向预期提问语句的两边进行语句扩展直到获得问题词。若预期提问语句中包含有两个或者以上的问题词,则根据问题词在所述预期提问语句中的问题,对预期提问语句进行再次拆分。其中,问题词可以为:“回答”、“为什么”等。
在提取面试问题中的词向量时通常采用word2vec方法进行提取,Word2Vec可以将One-Hot Encoder转化为低维度的连续值,也就是稠密向量,并且其中意思相近的词将被映射到向量空间中相近的位置。
S2、将所述问题词的词向量和所述位置词向量依次入参到预设的词向量嵌入模型后,得到嵌入词向量和样本词向量;
具体的,词向量嵌入模型可以根据语料库中的所有词语的属性,根据属性可以生成词表,其中语料库收集汉语词典中的词语和网络流行用户后整理得到的。其中,属性包括词性分类和各个词性分类下的语料库中词语的分布情况,词语的分类可以分为“名词”、“动词”、“形容词”等。将问题词的词向量和位置词向量入参到嵌入模型后可以进行分类,得到嵌入词向量m和样本词向量u。
S3、将所述样本词向量与所述嵌入词向量一同入参到记忆神经模型进行运算后,得到初始答案;
具体的,在将嵌入词向量m和样本词向量u入参到记忆神经网络模型中前,先对两个向量进行做内积,然后再做一个Softmax相对概率计算后得到向量P,然后再将向量p入参到记忆神经网络模型中进行运算,运算过程可以是,将向量P和嵌入词向量m做外积得到向量o,同时将向量p与预设的参数矩阵W相乘后再使用sigmoid函数压缩到0-1的区间得到根据样本向量u自适应的转化系数T,参数矩阵w是根据回答结果的历史数据统计后得到的。最后输出的初始答案结果对应的向量表示为A=T*o+(1-T)*u。
S4、以所述初始答案和所述位置词向量作为参数构建初始答案模型,以所述初始答案作为关联项,串接数个所述初始答案模型后得到最终答案模型,根据所述最终答案模型的输出结果,确定所述提问语句的备选答案分布范围。
具体的,在构建初始答案模型时,参数向量有嵌入词向量m和样本词向量u,其它的向量都是根据前述步骤计算后得到的,即只需输入嵌入向量m和样本向量u就可以得到初始答案结果A,然后根据m、u和A就可以得到初始答案模型的输入和输出。
在串接数个所述初始答案模型是,以初始答案结果A作为下一个初始答案模型输入的u,即把前一个初始答案结果向量A作为后一个初始答案模型的输入向量u,然后再输入原嵌入词向量m,就可以进行再次运算得到次级答案。以此类推,串接数个初始答案模型就可以得到提问语句最终的答案向量,然后最 终的答案向量做Softmax相对概率计算后就可以得到备选答案范围分布情况。
本实施例,通过采用多个初始答案串接的方式,并在词向量输入模型时引入问题词的位置信息,从而实现了对复杂面试问题逐级分析,从而准确的得到了复杂面试问题答案的分布范围。
图2为本申请在一个实施例中的一种基于神经网络模型的答案生成方法中的语句分析过程示意图,如图所示,所述S1、获取提问语句,将所述提问语句进行词向量转换,提取词向量转换后的提问语句中问题词的词向量,获取所述问题词在所述提问语句中的位置信息,拼接所述位置信息和所述问题词的词向量后得到位置词向量,包括:
S11、获取提问语句,去除所述提问语句中的停顿词,得到待编码语句;
具体的,去停顿词,文中的“的”,“了”,“吗”,“我”等词在每个文本中出现,这些词对于区分文档的类别不会产生影响,因而要去掉它们。对于英文NLTK中有标准的stopwords库,很容易去掉停顿词,得到良好的效果。对于中文,由于没有标准的停顿词库,可以通过查找下载停顿词表,去掉停顿词。
S12、将所述待编码语句进行独热编码,得到数个所述问题词的词向量;
其中,独热编码又称为one-hot编码是机器学习中常用的一种常用的词向量编码方式。例如,假设有一个特征是我公司和其它公司,样本如下:
Data=[‘我公司’,40,50000],[‘其它公司’,22,13000];
编码后得到的向量为:Data=[1,0,40,50000],[0,1,22,13000]。也就是说,一个属性如果有N个可取值,它就可以扩充为N个属性,每个样本的这N个属性中,只能有一个为1,表示该样本的该属性属于这个类别,其余扩展属性都为0。
S13、获取所述问题词在所述待编码语句中的位置编号,将所述位置编号写入所述问题词的词向量尾部后得到所述位置词向量。
例如,问题词为“为什么”则以问题词中第一个文字作为问题词在问题语句中的位置,在“为什么选择我公司?”这个问题语句中,问题词的位置编号为:“1”,相应的位置词向量可以为Data=[1,0,40,50000,1]。
本实施例,通过引入位置词向量,从而实现了对于面试问题的追踪,从而便于对复杂面试问题进行解析。
图3为本申请在一个实施例中的一种基于神经网络模型的答案生成方法中的嵌入生成过程示意图,如图所示,所述S2、将所述问题词的词向量和所述位置词向量依次入参到预设的词向量嵌入模型后,得到嵌入词向量和样本词向量,包括:
S21、获取预设的基本词向量模板,根据所述基本词向量模板与所述问题词的词向量或所述位置词向量的对应关系,得到所述问题词的词向量或者所述位置词向量的目标函数值;
具体的,基本词向量模板中有各个基本词的多维向量表示形式,将问题词的词向量或者位置词向量与基础词向量模板中的多维词向量均进行降维处理得到二维向量,在将二维位置词向量或者问题词的词向量与基础词向量模板中的二维词向量取内积,当内积为零时,得到所述问题词的词向量或所述位置词向量在基础词向量模板中对应的词向量。目标函数f(x)就是用设计变量来表示的所追求的目标形式,所以目标函数就是设计变量的函数,是一个标量。从工程意义讲,目标函数是系统的性能标准,比如,一个结构的最轻重量、最低造价、最合理形式;一件产品的最短生产时间、最小能量消耗;一个实验的最佳配方等等,建立目标函数的过程就是寻找设计变量与目标的关系的过程,目标函数和设计变量的关系可用曲线、曲面或超曲面表示。
S22、将所述目标函数值入参到所述词向量嵌入模型后得到中间参数;
具体的,在本实施例中,目标函数可以采用以下公式进行计算:
Figure PCTCN2019102574-appb-000001
文。再将目标函数值入参到词向量嵌入模型后,可以得到的中间参数为T*α,α为嵌入夹角,即词与词之间在坐标系上的夹角。
S23、将所述中间参数与所述问题词的词向量乘积后得到所述嵌入词向量,将所述中间参数与所述位置词向量乘积后得到所述样本词向量。
本实施例,通过引入基础词向量对问题词的词向量进行加工后得到样本词向量,从而便于对问题语句中的问题词语属性进行有效分析。
图4为本申请在一个实施例中的一种基于神经网络模型的答案生成方法中的初始答案生成过程示意图,如图所示,所述S3、将所述样本词向量与所述嵌入词向量一同入参到记忆神经模型进行运算后,得到初始答案,包括:
S31、将所述样本词向量和所述位置词向量进行运算后,得到待分析词向量;
具体的,将所述样本词向量和所述位置词向量进行运算,运算可以是做内积运算,在进行内积运算前,需要将样本词向量和位置词向量进行降维处理,得到二维向量,然后再进行计算。
S32、获取所述记忆神经模型中的概率分析函数,将所述待分析向量入参到所述概率分析函数进行运算,得到未修正的初始答案;
具体的,概率分析函数主要是softmax函数,在对于待分析向量进行softmax函数计算时,需要将待分析词向量进行去矢量处理,即在进行softmax函数计算时,入参的自变量均为标量。
S33、应用激活函数对所述未修正的初始答案进行压缩处理,得到修正后的初始答案。
其中,激活函数可以是sigmoid函数,通过sigmoid函数将初始答案结果变成取值范围为0~1的答案。例如,未修正的初始答案对应的向量为[2,3,5],则经过sigmoid函数压缩修正后得到的向量为[0.4,0.6,1]。
本实施例,通过神经网络模型和激活函数等对面试问题进行有效分析,从而得到了准确的初始答案结果,便于在后续进行复杂问题答案分布情况的分析。
图5为本申请在一个实施例中的一种基于神经网络模型的答案生成方法中的答案分布生成过程示意图,如图所示,所述S4、以所述初始答案和所述位置词向量作为参数构建初始答案模型,以所述初始答案作为关联项,串接数个所述初始答案模型后得到最终答案模型,根据所述最终答案模型的输出结果,确定所述提问语句的备选答案分布范围,包括:
S41、汇总数个所述初始答案,计算各所述初始答案的置信度,提取置信度大于预设的置信度阈值的初始答案和对应的位置词向量,构建初始答案模型;
其中,置信度计算公式为:N=Z×2×(P×(1-P))/E
Z为置信区间、n为初始结果数量、d为抽样误差范围、σ为标准差,一般取0.5。E为初始结果均值的标准差乘以z值,总误差p。
S42、获取数个所述初始答案模型,以前一个所述初始答案模型输出的初始答案作为后一个所述初始答案模型的样本词向量,连接数个所述初始答案模型后得到所述最终答案模型;
其中,对于初始答案模型的数量控制,可以在对每一次得到的答案结果进行答案概率分布分析,即可以预设一个答案分布的范围值,这个概率范围值可以采用正态分布的方式,然后将每一次得到的答案结果进行sigmoid函数和softmax函数就算得到概率分布情况,若概率分布情况小于正态分布图中预设概率值的分布范围,即停止串接运算。例如,正态分布图中,95%以上的概率分布宽度为“2”,若在进行一次初始答案模型运算后得到的95%以上的概率分布的宽度为“1.9”则停止进行下一次计算。
S43、获取所述最终答案模型输出的最终答案结果,将所述最终答案结果进行分类概率运算后,得到所述提问语句对应的备选答案分布范围。
其中,对于最终结果的分类运算可以采用神经网络模型中的投票机制,即 在神经网络模型中设置数个分类器对最终答案结果进行分类投票,然后根据投票结果得到所述提问语句对应的答案范围分布。
本实施例,通过串接数个初始答案模型的方式,有效的解决了复杂面试问题无法准确得到答案分布情况的问题,从而有效对面试的面试情况做出有效的分析。
在一个实施例中,所述获取预设的基本词向量模板,根据所述基本词向量模板与所述问题词的词向量或所述位置词向量的对应关系,得到所述问题词的词向量或者所述位置词向量的目标函数值,包括:
将所述问题词的词向量或所述位置词向量进行降维后,得到二维问题词的词向量或者二维位置词向量;
具体的,在降维过程中可以采用PCA降维的方式,PCA降维又称为主成分分析法,是最常用的线性降维方法,它的目标是通过某种线性投影,将高维的数据映射到低维的空间中表示,即把原先的n个特征用数目更少的m个特征取代,新特征是旧特征的线性组合。并期望在所投影的维度上数据的方差最大,尽量使新的m个特征互不相关。从旧特征到新特征的映射捕获数据中的固有变异性。以此使用较少的数据维度,同时保留住较多的原数据点的特性。
获取预设的词向量模板,将所述二维问题词的词向量或者所述二维位置词向量转置后与所述预设的词向量模板中的标准词向量做内积计算,抽取出内积为0的标准词向量作为所述问题词的词向量或所述位置词向量对应的标准词向量;
获取所述标准词向量和所述问题词的词向量或者所述位置词向量进行正则化处理得到正则化项,其中,正则化项的计算公式如下:
Figure PCTCN2019102574-appb-000002
将所述标准词向量作为参数入参到目标函数中进行得到初始目标函数值,计算公式如下:
Figure PCTCN2019102574-appb-000003
式子中,T标识目标函数,w i表示标准词向量在语料库中的第i个单词,u i表示标准词向量的特征值,C(w i,u i)表示w i的上下文;
应用所述正则化项对所述初始目标函数值进行修正,得到最终目标函数值。
其中,修正的过程为将正则化项与目标函数值进行乘积计算,正则化项作 为修正向对目标函数值进行有效修正。
本实施例,准确获得目标函数值,从而对于面试问题的的语义得到更加准确的分析。
在一个实施例中,所述将所述样本词向量和所述位置词向量进行运算后,得到待分析词向量,包括:
将所述样本词向量转置后与所述位置词向量做内积,得到待分析向量矩阵;其中,矩阵元素为样本词向量和位置词向量的乘积数值。
计算所述待分析向量矩阵的特征值,将所述样本词向量和所述位置词向量做内积后与所述特征相乘,得到初始待分析词向量;
其中,矩阵特征值不能为零,若矩阵特征值为零,则需要重新选定问题词在问题语句中的位置。例如:“为什么选择我公司”,原来问题词的为“1”,那么重新选定后为“2”。
对所述初始待分析词向量进行误差修正后,得到最终待分析词向量。
其中,误差修正可以采用Granger表述定理或者Engle-Granger两步法进行修正。
本实施例,有效获得最终待分析词向量,从而增加了获得面试问题答案分布的准确度。
在一个实施例中,提出了一种基于神经网络模型的答案生成装置,如图6所示,包括如下模块:
语句分析模块,设置为获取提问语句,将所述提问语句进行词向量转换,提取词向量转换后的提问语句中问题词的词向量,获取所述问题词在所述提问语句中的位置信息,拼接所述位置信息和所述问题词的词向量后得到位置词向量;
嵌入生成模块,设置为将所述问题词的词向量和所述位置词向量依次入参到预设的词向量嵌入模型后,得到嵌入词向量和样本词向量;
初始答案模块,设置为将所述样本词向量与所述嵌入词向量一同入参到记忆神经模型进行运算后,得到初始答案;
答案分布模块,设置为以所述初始答案和所述位置词向量作为参数构建初始答案模型,以所述初始答案作为关联项,串接数个所述初始答案模型后得到最终答案模型,根据所述最终答案模型的输出结果,确定所述提问语句的备选答案分布范围。
在一个实施例中,所述语句分析模块,还设置为:
获取提问语句,去除所述提问语句中的停顿词,得到待编码语句;将所述待编码语句进行独热编码,得到数个所述问题词的词向量;获取所述问题词在所述待编码语句中的位置编号,将所述位置编号写入所述问题词的词向量尾部后得到所述位置词向量。
在一个实施例中,,所述嵌入生成模块,还设置为:
获取预设的基本词向量模板,根据所述基本词向量模板与所述问题词的词向量或所述位置词向量的对应关系,得到所述问题词的词向量或者所述位置词向量的目标函数值;将所述目标函数值入参到所述词向量嵌入模型后得到中间参数;将所述中间参数与所述问题词的词向量乘积后得到所述嵌入词向量,将所述中间参数与所述位置词向量乘积后得到所述样本词向量。
在一个实施例中,所述初始答案模块,还设置为:
将所述样本词向量和所述位置词向量进行运算后,得到待分析词向量;获取所述记忆神经模型中的概率分析函数,将所述待分析向量入参到所述概率分析函数进行运算,得到未修正的初始答案;应用激活函数对所述未修正的初始答案进行压缩处理,得到修正后的初始答案。
在一个实施例中,所述答案分布模块,还设置为:
汇总数个所述初始答案,计算各所述初始答案的置信度,提取置信度大于预设的置信度阈值的初始答案和对应的位置词向量,构建初始答案模型;获取数个所述初始答案模型,以前一个所述初始答案模型输出的初始答案作为后一个所述初始答案模型的样本词向量,连接数个所述初始答案模型后得到所述最终答案模型;获取所述最终答案模型输出的最终答案结果,将所述最终答案结果进行分类概率运算后,得到所述提问语句对应的备选答案分布范围。
一种计算机设备,包括存储器和处理器,所述存储器中存储有计算机可读指令,所述计算机可读指令被所述处理器执行时,使得所述处理器执行以下步骤::。
获取提问语句,将所述提问语句进行词向量转换,提取词向量转换后的提问语句中问题词的词向量,获取所述问题词在所述提问语句中的位置信息,拼接所述位置信息和所述问题词的词向量后得到位置词向量;将所述问题词的词向量和所述位置词向量依次入参到预设的词向量嵌入模型后,得到嵌入词向量和样本词向量;将所述样本词向量与所述嵌入词向量一同入参到记忆神经模型进行运算后,得到初始答案;以所述初始答案和所述位置词向量作为参数构建 初始答案模型,以所述初始答案作为关联项,串接数个所述初始答案模型后得到最终答案模型,根据所述最终答案模型的输出结果,确定所述提问语句的备选答案分布范围。
本申请还提供了一种非易失性计算机可读存储介质,包括指令,当所述指令在计算机上运行时,使得计算机执行如下基于神经网络模型的答案生成方法的步骤:
获取提问语句,将所述提问语句进行词向量转换,提取词向量转换后的提问语句中问题词的词向量,获取所述问题词在所述提问语句中的位置信息,拼接所述位置信息和所述问题词的词向量后得到位置词向量;将所述问题词的词向量和所述位置词向量依次入参到预设的词向量嵌入模型后,得到嵌入词向量和样本词向量;将所述样本词向量与所述嵌入词向量一同入参到记忆神经模型进行运算后,得到初始答案;以所述初始答案和所述位置词向量作为参数构建初始答案模型,以所述初始答案作为关联项,串接数个所述初始答案模型后得到最终答案模型,根据所述最终答案模型的输出结果,确定所述提问语句的备选答案分布范围。
以上所述实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。
以上所述实施例仅表达了本申请一些示例性实施例,其中描述较为具体和详细,但并不能因此而理解为对本申请专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。

Claims (20)

  1. 一种基于神经网络模型的答案生成方法,其中,包括:
    获取提问语句,将所述提问语句进行词向量转换,提取词向量转换后的提问语句中问题词的词向量,获取所述问题词在所述提问语句中的位置信息,拼接所述位置信息和所述问题词的词向量后得到位置词向量;将所述问题词的词向量和所述位置词向量依次入参到预设的词向量嵌入模型后,得到嵌入词向量和样本词向量;将所述样本词向量与所述嵌入词向量一同入参到记忆神经模型进行运算后,得到初始答案;以所述初始答案和所述位置词向量作为参数构建初始答案模型,以所述初始答案作为关联项,串接数个所述初始答案模型后得到最终答案模型,根据所述最终答案模型的输出结果,确定所述提问语句的备选答案分布范围。
  2. 根据权利要求1所述的基于神经网络模型的答案生成的方法,其中,所述获取提问语句,将所述提问语句进行词向量转换,提取词向量转换后的提问语句中问题词的词向量,获取所述问题词在所述提问语句中的位置信息,拼接所述位置信息和所述问题词的词向量后得到位置词向量,包括:
    获取提问语句,去除所述提问语句中的停顿词,得到待编码语句;将所述待编码语句进行独热编码,得到数个所述问题词的词向量;获取所述问题词在所述待编码语句中的位置编号,将所述位置编号写入所述问题词的词向量尾部后得到所述位置词向量。
  3. 根据权利要求1所述的基于神经网络模型的答案生成的方法,其中,所述将所述问题词的词向量和所述位置词向量依次入参到预设的词向量嵌入模型后,得到嵌入词向量和样本词向量,包括:
    获取预设的基本词向量模板,根据所述基本词向量模板与所述问题词的词向量或所述位置词向量的对应关系,得到所述问题词的词向量或者所述位置词向量的目标函数值;将所述目标函数值入参到所述词向量嵌入模型后得到中间参数;将所述中间参数与所述问题词的词向量乘积后得到所述嵌入词向量,将所述中间参数与所述位置词向量乘积后得到所述样本词向量。
  4. 根据权利要求1所述的基于神经网络模型的答案生成的方法,其中,所述将所述样本词向量与所述嵌入词向量一同入参到记忆神经模型进行运算后,得到初始答案,包括:
    将所述样本词向量和所述位置词向量进行运算后,得到待分析词向量;获取所述记忆神经模型中的概率分析函数,将所述待分析向量入参到所述概率分析函数进行运算,得到未修正的初始答案;应用激活函数对所述未修正的初始答案进行压缩处理,得到修正后的初始答案。
  5. 根据权利要求1所述的基于神经网络模型的答案生成的方法,其中,所述以所述初始答案和所述位置词向量作为参数构建初始答案模型,以所述初始答案作为关联项,串接数个所述初始答案模型后得到最终答案模型,根据所述最终答案模型的输出结果,确定所述提问语句的备选答案分布范围,包括:
    汇总数个所述初始答案,计算各所述初始答案的置信度,提取置信度大于预设的置信度阈值的初始答案和对应的位置词向量,构建初始答案模型;获取数个所述初始答案模型,以前一个所述初始答案模型输出的初始答案作为后一个所述初始答案模型的样本词向量,连接数个所述初始答案模型后得到所述最终答案模型;获取所述最终答案模型输出的最终答案结果,将所述最终答案结果进行分类概率运算后,得到所述提问语句对应的备选答案分布范围。
  6. 根据权利要求3所述的基于神经网络模型的答案生成的方法,其中,所述获取预设的基本词向量模板,根据所述基本词向量模板与所述问题词的词向量或所述位置词向量的对应关系,得到所述问题词的词向量或者所述位置词向量的目标函数值,包括:
    将所述问题词的词向量或所述位置词向量进行降维后,得到二维问题词的词向量或者二维位置词向量;获取预设的词向量模板,将所述二维问题词的词向量或者所述二维位置词向量转置后与所述预设的词向量模板中的标准词向量做内积计算,抽取出内积为0的标准词向量作为所述问题词的词向量或所述位置词向量对应的标准词向量;获取所述标准词向量和所述问题词的词向量或者所述位置词向量进行正则化处理得到正则化项,其中,正则化项的计算公式如下:
    Figure PCTCN2019102574-appb-100001
    量作为参数入参到目标函数中进行得到初始目标函数值,计算公式如下:
    Figure PCTCN2019102574-appb-100002
    式子中,T标识目标函数,w i表示标准词向量在语料库中的第i个单词,u i表示标准词向量的特征值,C(w i,u i)表示w i的上下文;应用所述正则化项对所述初始目标函数值进行修正,得到最终目标函数值。
  7. 根据权利要求4述的基于神经网络模型的答案生成的方法,其中,所述将所述样本词向量和所述位置词向量进行运算后,得到待分析词向量,包括:
    将所述样本词向量转置后与所述位置词向量做内积,得到待分析向量矩阵;计算所述待分析向量矩阵的特征值,将所述样本词向量和所述位置词向量做内 积后与所述特征相乘,得到初始待分析词向量;对所述初始待分析词向量进行误差修正后,得到最终待分析词向量。
  8. 一种基于神经网络模型的答案生成装置,其中,包括以下模块:
    语句分析模块,设置为获取提问语句,将所述提问语句进行词向量转换,提取词向量转换后的提问语句中问题词的词向量,获取所述问题词在所述提问语句中的位置信息,拼接所述位置信息和所述问题词的词向量后得到位置词向量;
    嵌入生成模块,设置为将所述问题词的词向量和所述位置词向量依次入参到预设的词向量嵌入模型后,得到嵌入词向量和样本词向量;
    初始答案模块,设置为将所述样本词向量与所述嵌入词向量一同入参到记忆神经模型进行运算后,得到初始答案;
    答案分布模块,设置为以所述初始答案和所述位置词向量作为参数构建初始答案模型,以所述初始答案作为关联项,串接数个所述初始答案模型后得到最终答案模型,根据所述最终答案模型的输出结果,确定所述提问语句的备选答案分布范围。
  9. 根据权利要求8所述的基于神经网络模型的答案生成装置,其中,所述语句分析模块,还设置为:
    获取提问语句,去除所述提问语句中的停顿词,得到待编码语句;将所述待编码语句进行独热编码,得到数个所述问题词的词向量;获取所述问题词在所述待编码语句中的位置编号,将所述位置编号写入所述问题词的词向量尾部后得到所述位置词向量。
  10. 根据权利要求8所述的基于神经网络模型的答案生成装置,其中,所述嵌入生成模块,还设置为:
    获取预设的基本词向量模板,根据所述基本词向量模板与所述问题词的词向量或所述位置词向量的对应关系,得到所述问题词的词向量或者所述位置词向量的目标函数值;将所述目标函数值入参到所述词向量嵌入模型后得到中间参数;将所述中间参数与所述问题词的词向量乘积后得到所述嵌入词向量,将所述中间参数与所述位置词向量乘积后得到所述样本词向量。
  11. 根据权利要求8所述的基于神经网络模型的答案生成装置,其中,所述初始答案模块,还设置为:
    将所述样本词向量和所述位置词向量进行运算后,得到待分析词向量;获取所述记忆神经模型中的概率分析函数,将所述待分析向量入参到所述概率分 析函数进行运算,得到未修正的初始答案;应用激活函数对所述未修正的初始答案进行压缩处理,得到修正后的初始答案。
  12. 根据权利要求8所述的基于神经网络模型的答案生成装置,其中,所述答案分布模块,还设置为:
    汇总数个所述初始答案,计算各所述初始答案的置信度,提取置信度大于预设的置信度阈值的初始答案和对应的位置词向量,构建初始答案模型;获取数个所述初始答案模型,以前一个所述初始答案模型输出的初始答案作为后一个所述初始答案模型的样本词向量,连接数个所述初始答案模型后得到所述最终答案模型;获取所述最终答案模型输出的最终答案结果,将所述最终答案结果进行分类概率运算后,得到所述提问语句对应的备选答案分布范围。
  13. 根据权利要求10所述的基于神经网络模型的答案生成装置,其中,所述嵌入生成模块,还设置为:
    将所述问题词的词向量或所述位置词向量进行降维后,得到二维问题词的词向量或者二维位置词向量;获取预设的词向量模板,将所述二维问题词的词向量或者所述二维位置词向量转置后与所述预设的词向量模板中的标准词向量做内积计算,抽取出内积为0的标准词向量作为所述问题词的词向量或所述位置词向量对应的标准词向量;获取所述标准词向量和所述问题词的词向量或者所述位置词向量进行正则化处理得到正则化项;将所述标准词向量作为参数入参到目标函数中进行得到初始目标函数值,应用所述正则化项对所述初始目标函数值进行修正,得到最终目标函数值。
  14. 根据权利要求11所述的基于神经网络模型的答案生成装置,其中,所述初始答案模块,还设置为:
    将所述样本词向量转置后与所述位置词向量做内积,得到待分析向量矩阵;计算所述待分析向量矩阵的特征值,将所述样本词向量和所述位置词向量做内积后与所述特征相乘,得到初始待分析词向量;对所述初始待分析词向量进行误差修正后,得到最终待分析词向量。
  15. 一种计算机设备,包括存储器和处理器,所述存储器中存储有计算机可读指令,所述计算机可读指令被所述处理器执行时,使得所述处理器执行以下步骤:
    获取提问语句,将所述提问语句进行词向量转换,提取词向量转换后的提问语句中问题词的词向量,获取所述问题词在所述提问语句中的位置信息,拼接所述位置信息和所述问题词的词向量后得到位置词向量;将所述问题词的词向量和所述位置词向量依次入参到预设的词向量嵌入模型后,得到嵌入词向量 和样本词向量;将所述样本词向量与所述嵌入词向量一同入参到记忆神经模型进行运算后,得到初始答案;以所述初始答案和所述位置词向量作为参数构建初始答案模型,以所述初始答案作为关联项,串接数个所述初始答案模型后得到最终答案模型,根据所述最终答案模型的输出结果,确定所述提问语句的备选答案分布范围。
  16. 一种存储有计算机可读指令的存储介质,所述计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行以下步骤:
    获取提问语句,将所述提问语句进行词向量转换,提取词向量转换后的提问语句中问题词的词向量,获取所述问题词在所述提问语句中的位置信息,拼接所述位置信息和所述问题词的词向量后得到位置词向量;将所述问题词的词向量和所述位置词向量依次入参到预设的词向量嵌入模型后,得到嵌入词向量和样本词向量;将所述样本词向量与所述嵌入词向量一同入参到记忆神经模型进行运算后,得到初始答案;以所述初始答案和所述位置词向量作为参数构建初始答案模型,以所述初始答案作为关联项,串接数个所述初始答案模型后得到最终答案模型,根据所述最终答案模型的输出结果,确定所述提问语句的备选答案分布范围。
  17. 根据权利要求16所述的一种存储有计算机可读指令的存储介质,其中,所述获取提问语句,将所述提问语句进行词向量转换,提取词向量转换后的提问语句中问题词的词向量,获取所述问题词在所述提问语句中的位置信息,拼接所述位置信息和所述问题词的词向量后得到位置词向量时,使得所述处理器执行以下步骤:
    获取提问语句,去除所述提问语句中的停顿词,得到待编码语句;将所述待编码语句进行独热编码,得到数个所述问题词的词向量;获取所述问题词在所述待编码语句中的位置编号,将所述位置编号写入所述问题词的词向量尾部后得到所述位置词向量。
  18. 根据权利要求16所述的一种存储有计算机可读指令的存储介质,其中,所述将所述问题词的词向量和所述位置词向量依次入参到预设的词向量嵌入模型后,得到嵌入词向量和样本词向量时,使得所述处理器执行以下步骤:
    获取预设的基本词向量模板,根据所述基本词向量模板与所述问题词的词向量或所述位置词向量的对应关系,得到所述问题词的词向量或者所述位置词向量的目标函数值;将所述目标函数值入参到所述词向量嵌入模型后得到中间参数;将所述中间参数与所述问题词的词向量乘积后得到所述嵌入词向量,将所述中间参数与所述位置词向量乘积后得到所述样本词向量。
  19. 根据权利要求16所述的一种存储有计算机可读指令的存储介质,其中,所述将所述样本词向量与所述嵌入词向量一同入参到记忆神经模型进行运算后,得到初始答案时,使得所述处理器执行以下步骤:
    将所述样本词向量和所述位置词向量进行运算后,得到待分析词向量;获取所述记忆神经模型中的概率分析函数,将所述待分析向量入参到所述概率分析函数进行运算,得到未修正的初始答案;应用激活函数对所述未修正的初始答案进行压缩处理,得到修正后的初始答案。
  20. 根据权利要求16所述的一种存储有计算机可读指令的存储介质,其中,所述以所述初始答案和所述位置词向量作为参数构建初始答案模型,以所述初始答案作为关联项,串接数个所述初始答案模型后得到最终答案模型,根据所述最终答案模型的输出结果,确定所述提问语句的备选答案分布范围时,使得所述处理器执行以下步骤:
    汇总数个所述初始答案,计算各所述初始答案的置信度,提取置信度大于预设的置信度阈值的初始答案和对应的位置词向量,构建初始答案模型;获取数个所述初始答案模型,以前一个所述初始答案模型输出的初始答案作为后一个所述初始答案模型的样本词向量,连接数个所述初始答案模型后得到所述最终答案模型;获取所述最终答案模型输出的最终答案结果,将所述最终答案结果进行分类概率运算后,得到所述提问语句对应的备选答案分布范围。
PCT/CN2019/102574 2019-07-05 2019-08-26 基于神经网络模型的答案生成方法及相关设备 WO2021003813A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910606471.XA CN110457450B (zh) 2019-07-05 2019-07-05 基于神经网络模型的答案生成方法及相关设备
CN201910606471.X 2019-07-05

Publications (1)

Publication Number Publication Date
WO2021003813A1 true WO2021003813A1 (zh) 2021-01-14

Family

ID=68482323

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/102574 WO2021003813A1 (zh) 2019-07-05 2019-08-26 基于神经网络模型的答案生成方法及相关设备

Country Status (2)

Country Link
CN (1) CN110457450B (zh)
WO (1) WO2021003813A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113762791A (zh) * 2021-09-13 2021-12-07 郑州铁路职业技术学院 一种铁路工程造价管理系统
CN113792121A (zh) * 2021-04-08 2021-12-14 北京金山数字娱乐科技有限公司 阅读理解模型的训练方法及装置、阅读理解方法及装置

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111680264B (zh) * 2020-04-20 2023-12-22 重庆兆光科技股份有限公司 一种多文档阅读理解方法
CN113706019B (zh) * 2021-08-30 2024-06-07 平安银行股份有限公司 基于多维数据的业务能力分析方法、装置、设备及介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108345585A (zh) * 2018-01-11 2018-07-31 浙江大学 一种基于深度学习的自动问答方法
US20190087724A1 (en) * 2017-09-21 2019-03-21 Foundation Of Soongsil University Industry Cooperation Method of operating knowledgebase and server using the same
CN109657127A (zh) * 2018-12-17 2019-04-19 北京百度网讯科技有限公司 一种答案获取方法、装置、服务器及存储介质
CN109697228A (zh) * 2018-12-13 2019-04-30 平安科技(深圳)有限公司 智能问答方法、装置、计算机设备及存储介质
CN109766427A (zh) * 2019-01-15 2019-05-17 重庆邮电大学 一种基于堆叠Bi-LSTM网络和协同注意力的虚拟学习环境智能问答方法

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160350653A1 (en) * 2015-06-01 2016-12-01 Salesforce.Com, Inc. Dynamic Memory Network
EP3398117B1 (en) * 2016-02-05 2023-12-20 Deepmind Technologies Limited Augmenting neural networks with external memory
CN108133038B (zh) * 2018-01-10 2022-03-22 重庆邮电大学 一种基于动态记忆网络的实体级别情感分类系统及方法
CN108628935B (zh) * 2018-03-19 2021-10-15 中国科学院大学 一种基于端到端记忆网络的问答方法
CN109271494B (zh) * 2018-08-10 2021-04-27 西安交通大学 一种自动提取中文问答语句焦点的系统
CN109522395A (zh) * 2018-10-12 2019-03-26 平安科技(深圳)有限公司 自动问答方法及装置
CN109684452A (zh) * 2018-12-25 2019-04-26 中科国力(镇江)智能技术有限公司 一种基于答案与答案位置信息的神经网络问题生成方法
CN109902164B (zh) * 2019-03-06 2020-12-18 杭州一知智能科技有限公司 利用卷积双向自注意网络解决开放长格式视频问答的方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190087724A1 (en) * 2017-09-21 2019-03-21 Foundation Of Soongsil University Industry Cooperation Method of operating knowledgebase and server using the same
CN108345585A (zh) * 2018-01-11 2018-07-31 浙江大学 一种基于深度学习的自动问答方法
CN109697228A (zh) * 2018-12-13 2019-04-30 平安科技(深圳)有限公司 智能问答方法、装置、计算机设备及存储介质
CN109657127A (zh) * 2018-12-17 2019-04-19 北京百度网讯科技有限公司 一种答案获取方法、装置、服务器及存储介质
CN109766427A (zh) * 2019-01-15 2019-05-17 重庆邮电大学 一种基于堆叠Bi-LSTM网络和协同注意力的虚拟学习环境智能问答方法

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113792121A (zh) * 2021-04-08 2021-12-14 北京金山数字娱乐科技有限公司 阅读理解模型的训练方法及装置、阅读理解方法及装置
CN113792121B (zh) * 2021-04-08 2023-09-22 北京金山数字娱乐科技有限公司 阅读理解模型的训练方法及装置、阅读理解方法及装置
CN113762791A (zh) * 2021-09-13 2021-12-07 郑州铁路职业技术学院 一种铁路工程造价管理系统

Also Published As

Publication number Publication date
CN110457450B (zh) 2023-12-22
CN110457450A (zh) 2019-11-15

Similar Documents

Publication Publication Date Title
CN108959246B (zh) 基于改进的注意力机制的答案选择方法、装置和电子设备
WO2021003813A1 (zh) 基于神经网络模型的答案生成方法及相关设备
CN108399163B (zh) 结合词聚合与词组合语义特征的文本相似性度量方法
CN110928997A (zh) 意图识别方法、装置、电子设备及可读存储介质
US20090083332A1 (en) Tagging over time: real-world image annotation by lightweight metalearning
CN112015868A (zh) 基于知识图谱补全的问答方法
CN110263343B (zh) 基于短语向量的关键词抽取方法及系统
CN113220844A (zh) 基于实体特征的远程监督关系抽取方法
CN114020906A (zh) 基于孪生神经网络的中文医疗文本信息匹配方法及系统
CN116304748B (zh) 一种文本相似度计算方法、系统、设备及介质
CN112307168A (zh) 基于人工智能的问诊会话处理方法、装置和计算机设备
CN116662582A (zh) 基于自然语言的特定领域业务知识检索方法及检索装置
CN112100212A (zh) 一种基于机器学习和规则匹配的案件情节抽取方法
CN113704437A (zh) 一种融合多头注意力机制和相对位置编码的知识库问答方法
CN113901802A (zh) Crnn网络融合注意力机制的短文本相似度匹配方法
CN115563314A (zh) 多源信息融合增强的知识图谱表示学习方法
Balaji et al. Text summarization using NLP technique
CN113516094A (zh) 一种用于为文档匹配评议专家的系统以及方法
CN111723572B (zh) 基于CNN卷积层和BiLSTM的中文短文本相关性度量方法
CN112541541A (zh) 基于多元素分层深度融合的轻量级多模态情感分析方法
CN115204143B (zh) 一种基于prompt的文本相似度计算方法及系统
CN115017900B (zh) 一种基于多模态多去偏见的对话情感识别方法
CN113342964B (zh) 一种基于移动业务的推荐类型确定方法及系统
CN110633363B (zh) 一种基于nlp和模糊多准则决策的文本实体推荐方法
CN114595324A (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: 19937053

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 19937053

Country of ref document: EP

Kind code of ref document: A1