[go: up one dir, main page]

WO2021051585A1 - Method for constructing natural language processing system, electronic apparatus, and computer device - Google Patents

Method for constructing natural language processing system, electronic apparatus, and computer device Download PDF

Info

Publication number
WO2021051585A1
WO2021051585A1 PCT/CN2019/118031 CN2019118031W WO2021051585A1 WO 2021051585 A1 WO2021051585 A1 WO 2021051585A1 CN 2019118031 W CN2019118031 W CN 2019118031W WO 2021051585 A1 WO2021051585 A1 WO 2021051585A1
Authority
WO
WIPO (PCT)
Prior art keywords
neural network
sentence
text vector
text
output
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2019/118031
Other languages
French (fr)
Chinese (zh)
Inventor
王健宗
苏雪琦
彭话易
程宁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Publication of WO2021051585A1 publication Critical patent/WO2021051585A1/en
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • G06F16/3344Query execution using natural language analysis

Definitions

  • This application relates to the field of artificial intelligence technology, and in particular to a method for constructing a natural language processing system, electronic devices, computer equipment, and storage media.
  • Natural language processing which uses computers to process human language, embodies the highest tasks and realm of artificial intelligence. Common application methods include information extraction, machine translation, and intelligent question and answer systems. In the natural language processing system of the intelligent question answering system, accurate and concise natural language is used to answer the questions raised by human users in natural language.
  • the inventor found that the current commonly used method is to use a pre-trained neural network-based classifier to extract the structured features of natural language sentences, and then retrieve or infer the corresponding answers from the pre-established knowledge base based on the structured features.
  • a pre-trained neural network-based classifier to extract the structured features of natural language sentences, and then retrieve or infer the corresponding answers from the pre-established knowledge base based on the structured features.
  • the scenarios that are not in the knowledge base have poor application effects, lack of versatility, and severely limited application scenarios.
  • this application proposes a construction method, electronic device, computer equipment, and storage medium for a natural language processing system, which can automatically train neural networks and achieve better processing effects, and improve the accuracy and accuracy of building a natural language processing system. Convenience.
  • this application proposes a method for constructing a natural language processing system, which includes the steps of: extracting several word features from the received sentence text; converting the word features into a D-dimensional text vector , And pass the text vector to the neural network; obtain the output sentence of the neural network after receiving the text vector, and calculate the goal of the neural network through the backpropagation algorithm according to the error term between the output sentence and the text vector Weight parameter; and adjust the weight parameter of each node of the neural network according to the target weight parameter until the output sentence of the neural network meets a preset condition, and a natural language processing system is obtained.
  • the present application also provides an electronic device, which includes: an extraction module, adapted to extract several word features from the received sentence text; a conversion module, adapted to convert the word features into D Dimensional text vector, and pass the text vector into the neural network; the calculation module is adapted to obtain the output sentence after the neural network receives the text vector, and pass the inverse direction according to the error term between the output sentence and the text vector.
  • the propagation algorithm calculates the target weight parameter of the neural network; and an adjustment module, adapted to adjust the weight parameter of each node of the neural network according to the target weight parameter, until the output sentence of the neural network meets the preset condition, and the natural language processing is obtained system.
  • the present application also provides a computer device, including a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor, and the processor executes the computer-readable instructions When realizing the steps of the above method.
  • the present application also provides a non-volatile computer-readable storage medium on which computer-readable instructions are stored, and the computer-readable instructions implement the steps of the foregoing method when executed by a processor.
  • the construction method, electronic device, computer equipment, and storage medium of the natural language processing system proposed in this application convert the word features extracted from the received sentence text into a D-dimensional text vector, and then transfer the text vector to the nerves.
  • Network obtain the output sentence of the neural network after receiving the text vector, and then calculate the target weight parameter of the neural network through the backpropagation algorithm according to the error term of the output sentence and the text vector, and then calculate the target weight parameter of the neural network according to the target weight parameter
  • the weight parameters of each node of the neural network are adjusted, and the neural network is continuously and automatically trained until the output sentence of the neural network meets the preset conditions, and a natural language processing system with better processing effect is obtained, which improves the construction of the natural language processing system. Accuracy and convenience.
  • FIG. 1 is a schematic flowchart of a method for constructing a natural language processing system according to an exemplary embodiment of the present application
  • Fig. 2 is a schematic structural diagram of a neural network shown in an exemplary embodiment of the present application
  • FIG. 3 is a schematic flowchart of a method for constructing a natural language processing system according to an exemplary embodiment of the present application
  • FIG. 4 is a schematic flowchart of a method for constructing a natural language processing system according to an exemplary embodiment of the present application
  • FIG. 5 is a schematic flowchart of a method for constructing a natural language processing system according to an exemplary embodiment of the present application
  • Fig. 6 is a schematic structural diagram of a neural network shown in an exemplary embodiment of the present application.
  • FIG. 7 is a schematic diagram of program modules of an electronic device shown in an exemplary embodiment of the present application.
  • FIG. 8 is a schematic diagram of the hardware architecture of an electronic device shown in an exemplary embodiment of the present application.
  • Fig. 1 is a schematic flowchart of a method for constructing a natural language processing system according to an embodiment of the present application. The method includes the following steps:
  • Step S110 extract several word features from the received sentence text
  • Step S120 Convert the word feature into a D-dimensional text vector, and pass the text vector into the neural network;
  • Step S130 Obtain the output sentence after the neural network receives the text vector, and calculate the target weight parameter of the neural network through the back propagation algorithm according to the error term between the output sentence and the text vector;
  • Step S140 Adjust the weight parameter of each node of the neural network according to the target weight parameter until the output sentence of the neural network meets a preset condition, and a natural language processing system is obtained.
  • Natural language processing which uses computers to process human language, embodies the highest tasks and realm of artificial intelligence. Common application methods include information extraction, machine translation, and intelligent question and answer systems. In the natural language processing system of the intelligent question answering system, accurate and concise natural language is used to answer the questions raised by human users in natural language. Taking the intelligent question answering system as an example, the system can understand the meaning of what the user says, and then make the corresponding answer.
  • the received sentence text can be the sentence text obtained by directly converting the words spoken by the user in the scenes of machine translation, intelligent question answering system, robot customer service, etc.
  • the grammar is divided into several words, and several of the word features that can express the key information of the sentence text are extracted.
  • the dimension D of the word vector is set according to the dimension of the neural network, and all words are randomly initialized to a D-dimensional text vector, and then all D-dimensional text vectors for the context
  • the encoding obtains a vector of a hidden layer, which becomes a form that can be processed by the neural network.
  • FC neural networks which are actually multiple neurons connected according to certain rules.
  • Figure 2 shows a fully connected (FC) neural network.
  • Neurons are laid out in layers.
  • the leftmost layer is called the input layer, which is responsible for receiving input data;
  • the rightmost layer is called the output layer, and users can get the data output by the neural network from the output layer.
  • the layers between the input layer and the output layer are called hidden layers because they are invisible to the outside.
  • Each neuron in the Nth layer is connected to all neurons in the N-1th layer (this is the meaning of fully connected), and the output of the neurons in the N-1th layer is the input of the Nth layer of neurons.
  • Each connection has a weight.
  • the above rules define the structure of a fully connected neural network.
  • the hidden layer shown in the neural network in Figure 2 is only one layer.
  • the number of hidden layers can have multiple layers, which is not limited to what is shown in the figure.
  • there are many other types of neural networks such as Convolutional Neural Networks (CNN) and Recurrent Neural Networks (RNN), all of which have different connection rules.
  • CNN Convolutional Neural Networks
  • RNN Recurrent Neural Networks
  • the neural network outputs information according to the received input information.
  • the neural network needs to be trained, usually by training the neural network through training samples.
  • the constructed neural network is a natural language processing system. Therefore, sentence text can be selected as a training sample.
  • the sentence text can be a sentence in the form of a text obtained directly, or it can be obtained through audio, etc. For the sentence text converted from recognition, this application does not limit the source form of the sentence text.
  • the sentence text is parsed to extract the word features, and the neural network "understands" the meaning of the sentence text according to the word features.
  • the step of extracting several word features from the received sentence text may include the following steps:
  • step S301 the sentence text is divided into several words according to the grammar, and the part of speech of the words in the sentence text is marked according to the part of speech tag set;
  • Step S302 Decompose the sentence text into word features according to the part of speech.
  • the Chinese part-of-speech tag set of the Institute of Computing Technology (99 in total, 22 first-class, 66 second-class, 11 third-class) mainly refers to the following part-of-speech tag sets: Peking University "People's Daily" corpus part-of-speech tag set, Peking University 2002 new version of part-of-speech Marker set (draft), Tsinghua University Chinese Tree Bank Part-of-Speech Marker Set, Ministry of Education Pragmatics Part-of-Speech Marker Set (National Recommendation Standard Draft 2002 Edition), and Chinese Penn Tree Bank Part-of-Speech Marker Set of the University of Pennsylvania (Chinese Penn Tree Bank).
  • Part of speech tagging is to determine the most appropriate part of speech for each word according to the context of the sentence.
  • There are 26 basic parts of speech tags in the current tag set (noun n, time word t, location word s, location word f, numeral m, quantifier q, distinguishing word b, pronoun r, verb v, adjective a, state word z , Adverb d, preposition p, conjunction c, auxiliary u, modal particle y, interjection e, onomatopoeia o, idiom i, idiomatic expression l, abbreviation j, preceded by component h, followed by component k, morpheme g, non
  • proper nouns person's name nr, place name ns, organization name nt, other proper nouns nz
  • the sentence text can be decomposed into word features.
  • the sentence text "I am a little cat” can be decomposed into 4 word features, namely "I r” and “ ⁇ v” ", "a m”, “little meow n”.
  • HMM Hidden Markov Model, Hidden Markov Model
  • HMM graph models There is a probability of emission, that is, the probability from a part of speech to each word, and the transition probability between part of speech and part of speech to find p(t
  • part-of-speech tagging methods based on conversion ideas and classification-based ideas. This application does not limit the way of part-of-speech tagging.
  • the step of converting the word feature into a D-dimensional text vector may include the following steps:
  • Step S401 matching D-1 entries related to the word feature according to the similarity measurement method
  • Step S402 setting D entry weights according to the correlation between the character feature and the entry.
  • Step S403 Generate a D-dimensional text vector according to the weights of the D entries.
  • the word feature can be broken into (01010101110) values through the hash algorithm, and the word2vec algorithm can be used.
  • the word2vec algorithm also considers the upper and lower semantics, while the word2vec algorithm also considers the order of the upper and lower sentences, which is better used in paragraphs.
  • the weight of the word feature can be used to recombine the vector.
  • D-1 entries related to the word feature according to the similarity measurement method (for example, cosine distance); set D entries according to the degree of correlation between the word feature and the entry Weight; generating a D-dimensional text vector according to the weights of the D entries.
  • the similarity measurement method for example, cosine distance
  • the step of calculating the target weight parameter of the neural network through a backpropagation algorithm according to the error term between the output sentence and the text vector may include the following steps:
  • Step S501 starting from the output layer of the neural network, calculate the error terms of each hidden layer in reverse order.
  • Step S502 Calculate the weight parameter of each node of the hidden layer according to the error term.
  • a neural network is actually a function from an input vector to an output vector, that is, to calculate the output of the neural network based on the input, first the value of each element of the input vector needs to be assigned to the corresponding neuron of the input layer of the neural network, and then according to the formula in turn Calculate the value of each neuron in each layer forward, until the value of all neurons in the output layer of the last layer is calculated. Finally, string together the values of each neuron in the output layer to get the output vector. According to the difference between the output result and the expected result, how to adjust the weight parameter of the neuron is inversely deduced, so that the output result of the neural network can achieve the expected effect.
  • each unit of the neural network is numbered.
  • the input layer has three nodes, numbered 1, 2, and 3 sequentially; the 4 nodes of the hidden layer are numbered 4, 5, 6, and 7 in order; the two nodes of the output layer are numbered 8, 9.
  • Figure 6 shows a fully connected neural network, so each node is connected to all nodes in the upper layer. For example, there are connections between node 4 of the hidden layer and the three nodes 1, 2, and 3 of the input layer, and the weight parameters of the connections are w41, w42, and w43, respectively.
  • Nodes 1, 2, and 3 are the nodes of the input layer, and the output value is the input vector itself.
  • the output values of nodes 1, 2, and 3 are x1, x2, and x3, respectively.
  • the output value of node 1, 2, 3 is the input value of node 4.
  • the weight parameter between node 4 and the input layer 1, 2, 3, node 4 can be calculated The output value a4.
  • the output values of nodes 5, 6, and 7 are a5, a6, and a7, respectively, and the output values of nodes 8, 9 of the output layer are y1, and y2, respectively.
  • the output value of the output layer node is the actual output value of the neural network.
  • the target weight parameter of the hidden layer can be calculated according to the error between the actual output value and the expected output value corresponding to the input value to reduce the actual output value and the expected output value The error between.
  • the preset condition includes: the proportion of sentences that exist in nature in the output sentences of the neural network reaches a preset threshold.
  • the neural network "analyzes" the received sentence text to obtain an output sentence that can be "understood” by the machine.
  • the data set publicly available on the Internet can be used as a true value reference to predict whether the output sentence is a "true sentence”.
  • the step until the output sentence of the neural network satisfies the preset condition further includes: judging whether the output sentence is a sentence existing in nature; calculating the total amount of the output sentence of the neural network as the first number, and calculating which belongs to the natural world The total number of output sentences of the sentences existing in the sentence is the second number; the ratio of the second number to the first number is calculated, and it is judged whether the ratio reaches a preset threshold. According to the obtained batch of output sentences, whether the proportion of "true sentences" reaches a preset threshold (for example, 90%, etc.), it is judged whether the neural network is trained to a better state.
  • a preset threshold for example, 90%, etc.
  • the neural network may be a deep neural network, which is a multi-layer neural network, and the advantage of multi-layer is that it can express complex functions with fewer parameters.
  • An effective method to build a multilayer neural network is simply divided into two steps. One is to train one layer of the network each time, and the other is to tune the high-level representation r generated from the original representation x upward and the high-level representation r generated downward The x'is as consistent as possible. the way is:
  • Wake-Sleep algorithm For tuning.
  • the weights between the other layers except the top layer are changed to bidirectional, so that the top layer is still a single-layer neural network, and the other layers become a graph model.
  • the upward weight is used for "cognition” and the downward weight is used for "generation”.
  • the Wake-Sleep algorithm uses the Wake-Sleep algorithm to adjust all the weights. Reaching agreement between cognition and generation is to ensure that the top-level representation of the generation can restore the underlying nodes as accurately as possible. For example, a node on the top layer represents a human face, then the image of all faces should activate this node, and the image generated downward from this result should be able to represent a rough face image.
  • the Wake-Sleep algorithm is divided into two parts: Wake and Sleep.
  • Wake stage the cognitive process, through the characteristics of the outside world and upward weight (cognitive weight) to generate the abstract representation of each layer (node state), and use gradient descent to modify the downward weight between layers (generate weight) . That is, "If reality is different from what I imagined, changing my weight makes what I imagined is like this".
  • the construction method of the natural language processing system proposed in this application can convert the word features extracted from the received sentence text into a D-dimensional text vector, pass the text vector into a neural network, and obtain the neural network to receive the text
  • the output sentence after the vector is calculated by the backpropagation algorithm to calculate the target weight parameter of the neural network, and the weight parameter of each node of the neural network is adjusted according to the target weight parameter, until the output sentence of the neural network meets the preset condition, through Automatically train neural networks and achieve better processing results, which improves the accuracy and convenience of building natural language processing systems.
  • the application further provides an electronic device.
  • FIG. 7 is a schematic diagram of program modules of the electronic device 20 according to an exemplary embodiment of the present application.
  • the electronic device 20 includes:
  • the extraction module 201 is adapted to extract several word features from the received sentence text
  • the conversion module 202 is adapted to convert the word feature into a D-dimensional text vector, and pass the text vector into a neural network;
  • the calculation module 203 is adapted to obtain the output sentence after the neural network receives the text vector, and calculate the target weight parameter of the neural network through a back propagation algorithm;
  • the adjustment module 204 is adapted to adjust the weight parameter of each node of the neural network according to the target weight parameter until the output sentence of the neural network meets a preset condition.
  • the extraction module 201 includes: a labeling unit adapted to label the part of speech of words in the sentence text; and a decomposition unit adapted to decompose the sentence text into word features according to the part of speech.
  • the conversion module 202 includes: a matching unit, adapted to match D-1 entries related to the word feature according to a similarity measure; a setting unit, adapted to match the word feature with the word feature according to the The degree of relevance of the term sets D term weights; and the vector generating unit is adapted to generate a D-dimensional text vector according to the D term weights.
  • the similarity measurement method includes cosine distance.
  • calculation module 203 is further adapted to calculate the error term of each hidden layer in reverse order starting from the output layer of the neural network; and calculate the weight parameter of each node of the hidden layer according to the error term.
  • the preset condition includes: the proportion of sentences that belong to the natural world in the output sentences of the neural network reaches a preset threshold.
  • the neural network is a deep neural network.
  • the electronic device 20 proposed in this application can convert the word features extracted from the received sentence text into a D-dimensional text vector, pass the text vector into a neural network, and obtain the output of the neural network after receiving the text vector Sentence, calculate the target weight parameter of the neural network through the backpropagation algorithm, adjust the weight parameter of each node of the neural network according to the target weight parameter, until the output sentence of the neural network meets the preset condition, through the automatic training of the neural network And achieve a better processing effect, improve the accuracy and convenience of building a natural language processing system.
  • the present application also provides a computer device 20, including a memory 21, a processor 22, and computer-readable instructions stored on the memory 21 and running on the processor 22, and the processor 22 executes
  • the computer-readable instructions implement the steps of the above method.
  • the computer readable instructions can be stored in the memory 24.
  • the present application also provides a non-volatile computer-readable storage medium on which computer-readable instructions are stored, and the computer-readable instructions implement the steps of the foregoing method when executed by a processor.
  • This application also provides a computer device, such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a rack server, a blade server, a tower server, or a cabinet server (including independent servers, or more) that can execute programs.
  • a server cluster composed of two servers) and so on.
  • the computer device in this embodiment at least includes but is not limited to: a memory, a processor, etc., which can be communicably connected to each other through a system bus.
  • This embodiment also provides a non-volatile computer-readable storage medium, such as flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory ( SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disks, optical disks, servers, App application malls, etc., on which storage There are computer-readable instructions, and the corresponding functions are realized when the program is executed by the processor.
  • the non-volatile computer-readable storage medium of this embodiment is used to store the electronic device 20, and when executed by the processor 22, realizes the construction method of the natural language processing system of the present application.
  • the technical solution of this application essentially or the part that contributes to the existing technology can be embodied in the form of a software product, and the computer software product is stored in a storage medium (such as ROM/RAM, magnetic disk, The optical disc) includes several instructions to enable a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the method described in each embodiment of the present application.
  • a terminal device which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Artificial Intelligence (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Human Computer Interaction (AREA)
  • Machine Translation (AREA)

Abstract

Disclosed are a method for constructing a natural language processing system, an electronic apparatus, a computer device, and a storage medium. The method comprises: extracting several word and phrase features from received sentence text (S110); converting the word and phrase features to a D-dimensional text vector, and transmitting the text vector to a neural network (S120); acquiring an output sentence obtained after the neural network has received the text vector, and calculating a target weight parameter of the neural network according to an error term between the output sentence and the text vector and by means of a backpropagation algorithm (S130); and adjusting a weight parameter of each node of the neural network according to the target weight parameter until the output sentence of the neural network satisfies a preset condition, and obtaining a natural language processing system (S140). A neural network is automatically trained, and a good processing effect is achieved, thereby improving the accuracy and convenience of constructing a natural language processing system.

Description

自然语言处理系统的构建方法、电子装置及计算机设备Construction method, electronic device and computer equipment of natural language processing system

本申请要求于2019年9月17日提交中国专利局,专利名称为“自然语言处理系统的构建方法、电子装置及计算机设备”,申请号为201910876792.1的发明专利的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application requires that it be submitted to the Chinese Patent Office on September 17, 2019. The patent name is "Natural language processing system construction method, electronic device and computer equipment", and the application number is 201910876792.1. The priority of the Chinese patent application for the invention patent, which The entire content is incorporated into this application by reference.

技术领域Technical field

本申请涉及人工智能技术领域,尤其涉及一种自然语言处理系统的构建方法、电子装置、计算机设备及存储介质。This application relates to the field of artificial intelligence technology, and in particular to a method for constructing a natural language processing system, electronic devices, computer equipment, and storage media.

背景技术Background technique

利用计算机来处理人类的语言的自然语言处理,体现了人工智能的最高任务与境界,常见的应用方式包括信息提取、机器翻译、智能问答系统等。在智能问答系统的自然语言处理系统中,实现用准确、简洁的自然语言回答人类用户用自然语言提出的问题。Natural language processing, which uses computers to process human language, embodies the highest tasks and realm of artificial intelligence. Common application methods include information extraction, machine translation, and intelligent question and answer systems. In the natural language processing system of the intelligent question answering system, accurate and concise natural language is used to answer the questions raised by human users in natural language.

发明人发现目前常用的方法是利用预先训练好的基于神经网络的分类器提取自然语言语句的结构化特征,然后基于该结构化特征从预先建立的知识库中检索或推理得到相应的答案。在上述基于神经网络的分类器的训练以及知识库的建立过程中,都需要提供大量标注有结构化特征的训练数据供基于神经网络的分类器执行深度学习,这种手动标注费时且昂贵,对于知识库中没有的场景,应用效果较差,缺乏通用性,应用场景严重受限。The inventor found that the current commonly used method is to use a pre-trained neural network-based classifier to extract the structured features of natural language sentences, and then retrieve or infer the corresponding answers from the pre-established knowledge base based on the structured features. In the training of the above-mentioned neural network-based classifier and the establishment of the knowledge base, it is necessary to provide a large amount of training data labeled with structured features for the neural network-based classifier to perform deep learning. This manual labeling is time-consuming and expensive. The scenarios that are not in the knowledge base have poor application effects, lack of versatility, and severely limited application scenarios.

发明内容Summary of the invention

有鉴于此,本申请提出一种自然语言处理系统的构建方法、电子装置、计算机设备及存储介质,能够自动训练神经网络并达到较佳的处理效果,提高了构建自然语言处理系统的准确性以及便利性。In view of this, this application proposes a construction method, electronic device, computer equipment, and storage medium for a natural language processing system, which can automatically train neural networks and achieve better processing effects, and improve the accuracy and accuracy of building a natural language processing system. Convenience.

首先,为实现上述目的,本申请提出一种自然语言处理系统的构建方法,该方法包括步骤:从接收的语句文本中提取若干字词特征;将所述字词特征转换成D维度的文本向量,并将所述文本向量传入神经网络;获取神经网络接收所述文本向量后的输出语句,根据所述输出语句与所述文本向量的误差项通过反向传播算法计算所述神经网络的目标权重参数;及根据所述目标权重参数调整所述神经网络各节点的权重参数,直至神经网络的输出 语句满足预设条件,得到自然语言处理系统。First of all, in order to achieve the above objective, this application proposes a method for constructing a natural language processing system, which includes the steps of: extracting several word features from the received sentence text; converting the word features into a D-dimensional text vector , And pass the text vector to the neural network; obtain the output sentence of the neural network after receiving the text vector, and calculate the goal of the neural network through the backpropagation algorithm according to the error term between the output sentence and the text vector Weight parameter; and adjust the weight parameter of each node of the neural network according to the target weight parameter until the output sentence of the neural network meets a preset condition, and a natural language processing system is obtained.

此外,为实现上述目的,本申请还提供一种电子装置,其包括:提取模块,适于从接收的语句文本中提取若干字词特征;转换模块,适于将所述字词特征转换成D维度的文本向量,并将所述文本向量传入神经网络;计算模块,适于获取神经网络接收所述文本向量后的输出语句,根据所述输出语句与所述文本向量的误差项通过反向传播算法计算所述神经网络的目标权重参数;及调整模块,适于根据所述目标权重参数调整所述神经网络各节点的权重参数,直至神经网络的输出语句满足预设条件,得到自然语言处理系统。In addition, in order to achieve the above object, the present application also provides an electronic device, which includes: an extraction module, adapted to extract several word features from the received sentence text; a conversion module, adapted to convert the word features into D Dimensional text vector, and pass the text vector into the neural network; the calculation module is adapted to obtain the output sentence after the neural network receives the text vector, and pass the inverse direction according to the error term between the output sentence and the text vector The propagation algorithm calculates the target weight parameter of the neural network; and an adjustment module, adapted to adjust the weight parameter of each node of the neural network according to the target weight parameter, until the output sentence of the neural network meets the preset condition, and the natural language processing is obtained system.

为实现上述目的,本申请还提供一种计算机设备,包括存储器、处理器以及存储在存储器上并可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现上述方法的步骤。To achieve the above objective, the present application also provides a computer device, including a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor, and the processor executes the computer-readable instructions When realizing the steps of the above method.

为实现上述目的,本申请还提供非易失性计算机可读存储介质,其上存储有计算机可读指令,所述计算机可读指令被处理器执行时实现上述方法的步骤。To achieve the foregoing objective, the present application also provides a non-volatile computer-readable storage medium on which computer-readable instructions are stored, and the computer-readable instructions implement the steps of the foregoing method when executed by a processor.

本申请所提出的自然语言处理系统的构建方法、电子装置、计算机设备及存储介质,通过将接收的语句文本中提取的字词特征转换成D维度的文本向量,将所述文本向量传入神经网络,获取神经网络接收所述文本向量后的输出语句,再根据所述输出语句与所述文本向量的误差项通过反向传播算法计算所述神经网络的目标权重参数,根据所述目标权重参数调整所述神经网络各节点的权重参数,通过不断自动训练神经网络,直至神经网络的输出语句满足预设条件,得到具有较佳的处理效果的自然语言处理系统,提高了构建自然语言处理系统的准确性以及便利性。The construction method, electronic device, computer equipment, and storage medium of the natural language processing system proposed in this application convert the word features extracted from the received sentence text into a D-dimensional text vector, and then transfer the text vector to the nerves. Network, obtain the output sentence of the neural network after receiving the text vector, and then calculate the target weight parameter of the neural network through the backpropagation algorithm according to the error term of the output sentence and the text vector, and then calculate the target weight parameter of the neural network according to the target weight parameter The weight parameters of each node of the neural network are adjusted, and the neural network is continuously and automatically trained until the output sentence of the neural network meets the preset conditions, and a natural language processing system with better processing effect is obtained, which improves the construction of the natural language processing system. Accuracy and convenience.

附图说明Description of the drawings

图1是本申请一示例性实施例示出的自然语言处理系统的构建方法的流程示意图;FIG. 1 is a schematic flowchart of a method for constructing a natural language processing system according to an exemplary embodiment of the present application;

图2是本申请一示例性实施例示出的神经网络的结构示意图;Fig. 2 is a schematic structural diagram of a neural network shown in an exemplary embodiment of the present application;

图3是本申请一示例性实施例示出的自然语言处理系统的构建方法的流程示意图;3 is a schematic flowchart of a method for constructing a natural language processing system according to an exemplary embodiment of the present application;

图4是本申请一示例性实施例示出的自然语言处理系统的构建方法的流程示意图;4 is a schematic flowchart of a method for constructing a natural language processing system according to an exemplary embodiment of the present application;

图5是本申请一示例性实施例示出的自然语言处理系统的构建方法的流程示意图;FIG. 5 is a schematic flowchart of a method for constructing a natural language processing system according to an exemplary embodiment of the present application;

图6是本申请一示例性实施例示出的神经网络的结构示意图;Fig. 6 is a schematic structural diagram of a neural network shown in an exemplary embodiment of the present application;

图7是本申请一示例性实施例示出的电子装置的程序模块示意图;FIG. 7 is a schematic diagram of program modules of an electronic device shown in an exemplary embodiment of the present application;

图8是本申请一示例性实施例示出的电子装置的硬件架构示意图。FIG. 8 is a schematic diagram of the hardware architecture of an electronic device shown in an exemplary embodiment of the present application.

本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The realization, functional characteristics, and advantages of the purpose of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings.

具体实施方式detailed description

为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the purpose, technical solutions, and advantages of this application clearer, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present application, and are not used to limit the present application. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of this application.

需要说明的是,在本申请中涉及“第一”、“第二”等的描述仅用于描述目的,而不能理解为指示或暗示其相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该特征。另外,各个实施例之间的技术方案可以相互结合,但是必须是以本领域普通技术人员能够实现为基础,当技术方案的结合出现相互矛盾或无法实现时应当认为这种技术方案的结合不存在,也不在本申请要求的保护范围之内。It should be noted that the descriptions related to "first", "second", etc. in this application are only for descriptive purposes, and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of indicated technical features . Therefore, the features defined with "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but it must be based on what can be achieved by a person of ordinary skill in the art. When the combination of technical solutions is contradictory or cannot be achieved, it should be considered that such a combination of technical solutions does not exist. , Is not within the scope of protection required by this application.

参阅图1所示,是本申请一实施例之自然语言处理系统的构建方法的流程示意图,所述方法包括以下步骤:Refer to Fig. 1, which is a schematic flowchart of a method for constructing a natural language processing system according to an embodiment of the present application. The method includes the following steps:

步骤S110,从接收的语句文本中提取若干字词特征;Step S110, extract several word features from the received sentence text;

步骤S120,将所述字词特征转换成D维度的文本向量,并将所述文本向量传入神经网络;Step S120: Convert the word feature into a D-dimensional text vector, and pass the text vector into the neural network;

步骤S130,获取神经网络接收所述文本向量后的输出语句,根据所述输出语句与所述文本向量的误差项通过反向传播算法计算所述神经网络的目标权重参数;及Step S130: Obtain the output sentence after the neural network receives the text vector, and calculate the target weight parameter of the neural network through the back propagation algorithm according to the error term between the output sentence and the text vector; and

步骤S140,根据所述目标权重参数调整所述神经网络各节点的权重参数,直至神经网络的输出语句满足预设条件,得到自然语言处理系统。Step S140: Adjust the weight parameter of each node of the neural network according to the target weight parameter until the output sentence of the neural network meets a preset condition, and a natural language processing system is obtained.

利用计算机来处理人类的语言的自然语言处理,体现了人工智能的最高任务与境界,常见的应用方式包括信息提取、机器翻译、智能问答系统等。在智能问答系统的自然语言处理系统中,实现用准确、简洁的自然语言回答人类用户用自然语言提出的问题。以智能问答系统为例,系统可以根据用户说的话,理解其中含义,进而作出对应的回答。Natural language processing, which uses computers to process human language, embodies the highest tasks and realm of artificial intelligence. Common application methods include information extraction, machine translation, and intelligent question and answer systems. In the natural language processing system of the intelligent question answering system, accurate and concise natural language is used to answer the questions raised by human users in natural language. Taking the intelligent question answering system as an example, the system can understand the meaning of what the user says, and then make the corresponding answer.

从接收的语句文本中提取若干字词特征,所述接收的语句文本可以是用户在机器翻译、智能问答系统、机器人客服等场景下所说的话直接转换成文字得到的语句文本,将语句文本按照语法分割成若干字词,提取其中若干能表达所述语句文本的关键信息的字词特征。例如,当用户在机器人客服场景下说:“我上周提交的保险理赔进度怎么样了?”时,可以将其按照语法分割成“我”、“上周”、“提交”、“的”、“保险”、“理赔”、 “进度”、“怎么样”、“了”,从中提取出能表达所述语句文本的关键信息的字词特征:“我”、“的”、“保险”、“理赔”、“进度”。字词特征需要转化成神经网络可以识别的形式,根据神经网络的维度设定词向量的维度D,对所有的词随机初始化为一个D维度的文本向量,然后对上下文所有的D维度的文本向量编码得到一个隐藏层的向量,从而成为所述神经网络可以处理的形式。Several word features are extracted from the received sentence text. The received sentence text can be the sentence text obtained by directly converting the words spoken by the user in the scenes of machine translation, intelligent question answering system, robot customer service, etc. The grammar is divided into several words, and several of the word features that can express the key information of the sentence text are extracted. For example, when the user says in the robot customer service scenario: "How is the progress of the insurance claim that I submitted last week?", it can be grammatically divided into "I", "Last week", "Submit", "Of" , "Insurance", "Claim", "Progress", "How", "Lau", extract the word features that can express the key information of the sentence text: "I", "的", "Insurance" , "Claim", "Progress". The word features need to be transformed into a form that can be recognized by the neural network. The dimension D of the word vector is set according to the dimension of the neural network, and all words are randomly initialized to a D-dimensional text vector, and then all D-dimensional text vectors for the context The encoding obtains a vector of a hidden layer, which becomes a form that can be processed by the neural network.

目前通常是通过神经网络进行自然语言处理,神经网络其实就是按照一定规则连接起来的多个神经元。参阅图2,图2展示了一个全连接(full connected,FC)神经网络,通过观察,可以发现FC神经网络的规则包括:At present, natural language processing is usually performed through neural networks, which are actually multiple neurons connected according to certain rules. Refer to Figure 2. Figure 2 shows a fully connected (FC) neural network. Through observation, it can be found that the rules of the FC neural network include:

1)、神经元按照层来布局。最左边的层叫做输入层,负责接收输入数据;最右边的层叫输出层,用户可以从输出层获取神经网络输出的数据。输入层和输出层之间的层叫做隐藏层,因为它们对于外部来说是不可见的。1). Neurons are laid out in layers. The leftmost layer is called the input layer, which is responsible for receiving input data; the rightmost layer is called the output layer, and users can get the data output by the neural network from the output layer. The layers between the input layer and the output layer are called hidden layers because they are invisible to the outside.

2)、同一层的神经元之间没有连接。2) There is no connection between neurons in the same layer.

3)、第N层的每个神经元和第N-1层的所有神经元相连(这就是full connected的含义),第N-1层神经元的输出就是第N层神经元的输入。3) Each neuron in the Nth layer is connected to all neurons in the N-1th layer (this is the meaning of fully connected), and the output of the neurons in the N-1th layer is the input of the Nth layer of neurons.

4)、每个连接都有一个权值。4) Each connection has a weight.

上面这些规则定义了全连接神经网络的结构,其中,图2中的神经网络所示的隐藏层仅为一层,实际上隐藏层的层数可以有多层,不以图中所示为限。事实上还存在很多其它结构的神经网络,比如卷积神经网络(CNN)、循环神经网络(RNN),他们都具有不同的连接规则。The above rules define the structure of a fully connected neural network. Among them, the hidden layer shown in the neural network in Figure 2 is only one layer. In fact, the number of hidden layers can have multiple layers, which is not limited to what is shown in the figure. . In fact, there are many other types of neural networks, such as Convolutional Neural Networks (CNN) and Recurrent Neural Networks (RNN), all of which have different connection rules.

神经网络根据接收的输入信息输出信息,为了保证输出信息的准确性,需要对神经网络进行训练,通常是通过训练样本训练神经网络。本申请一实施例中,所构建的神经网络是一个自然语言处理系统,因而,可以选用语句文本作为训练样本,所述语句文本可以是直接获取的文本形式的语句,也可以是通过对音频等进行识别转换而成的语句文本,本申请对语句文本的来源形式不作限定。The neural network outputs information according to the received input information. In order to ensure the accuracy of the output information, the neural network needs to be trained, usually by training the neural network through training samples. In an embodiment of this application, the constructed neural network is a natural language processing system. Therefore, sentence text can be selected as a training sample. The sentence text can be a sentence in the form of a text obtained directly, or it can be obtained through audio, etc. For the sentence text converted from recognition, this application does not limit the source form of the sentence text.

获取语句文本后,通过对语句文本进行解析以提取其中的字词特征,神经网络根据字词特征“理解”所述语句文本的含义。After the sentence text is obtained, the sentence text is parsed to extract the word features, and the neural network "understands" the meaning of the sentence text according to the word features.

如图3所示,本申请一实施例中,所述从接收的语句文本中提取若干字词特征的步骤可以包括以下步骤:As shown in FIG. 3, in an embodiment of the present application, the step of extracting several word features from the received sentence text may include the following steps:

步骤S301,将语句文本按照语法分割成若干字词,根据词性标记集标注语句文本中字词的词性;及In step S301, the sentence text is divided into several words according to the grammar, and the part of speech of the words in the sentence text is marked according to the part of speech tag set; and

步骤S302,根据所述词性将所述语句文本分解成字词特征。Step S302: Decompose the sentence text into word features according to the part of speech.

目前,计算所汉语词性标记集(共计99个,22个一类,66个二类,11个三类)主要参考了以下词性标记集:北大《人民日报》语料库词性标记集、北大2002新版词性标记集(草稿)、清华大学汉语树库词性标记集、教育部语用所词性标记集(国家推荐标准草案2002版)、美国宾州大学中文树库(Chinese Penn Tree Bank)词性标记集。例如,当用户在机器人客服场景下说:“我上周提交的保险理赔进度怎么样了?”时,可以将其按照语法分割成“我”、“上周”、“提交”、“的”、“保险”、“理赔”、“进度”、“怎么样”、“了”,根据词性标记集标注语句文本中字词的词性。At present, the Chinese part-of-speech tag set of the Institute of Computing Technology (99 in total, 22 first-class, 66 second-class, 11 third-class) mainly refers to the following part-of-speech tag sets: Peking University "People's Daily" corpus part-of-speech tag set, Peking University 2002 new version of part-of-speech Marker set (draft), Tsinghua University Chinese Tree Bank Part-of-Speech Marker Set, Ministry of Education Pragmatics Part-of-Speech Marker Set (National Recommendation Standard Draft 2002 Edition), and Chinese Penn Tree Bank Part-of-Speech Marker Set of the University of Pennsylvania (Chinese Penn Tree Bank). For example, when the user says in the robot customer service scenario: "How is the progress of the insurance claim that I submitted last week?", it can be grammatically divided into "I", "Last week", "Submit", "Of" , "Insurance", "Claim", "Progress", "How", "Lau", mark the part of speech of the words in the sentence text according to the part of speech tag set.

词性标注就是依据句子的上下文给每个词确定一个最合适的词性。目前的标记集里有26个基本词类标记(名词n、时间词t、处所词s、方位词f、数词m、量词q、区别词b、代词r、动词v、形容词a、状态词z、副词d、介词p、连词c、助词u、语气词y、叹词e、拟声词o、成语i、习惯用语l、简称j、前接成分h、后接成分k、语素g、非语素字x、标点符号w)外,从语料库应用的角度,增加了专有名词(人名nr、地名ns、机构名称nt、其他专有名词nz);从语言学角度也增加了一些标记,总共使用了40多个标记,详见表1。Part of speech tagging is to determine the most appropriate part of speech for each word according to the context of the sentence. There are 26 basic parts of speech tags in the current tag set (noun n, time word t, location word s, location word f, numeral m, quantifier q, distinguishing word b, pronoun r, verb v, adjective a, state word z , Adverb d, preposition p, conjunction c, auxiliary u, modal particle y, interjection e, onomatopoeia o, idiom i, idiomatic expression l, abbreviation j, preceded by component h, followed by component k, morpheme g, non In addition to morphemes x and punctuation marks w), from the perspective of corpus application, proper nouns (person's name nr, place name ns, organization name nt, other proper nouns nz) have been added; some marks have also been added from the perspective of linguistics. More than 40 markers were used, see Table 1 for details.

表1记性代码标注对照表Table 1 Marking comparison table of memory codes

代码Code 名称name 代码Code 名称name 代码Code 名称name AgAg 形语素Morpheme ll 习用语Idioms ss 处所词Location word aa 形容词adjective MgMg 数语素Number morphemes TgTg 时间语素Temporal morphemes adad 副形词Adverb mm 数词numeral tt 时间词Time word anan 名形词Nouns NgNg 名语素Nominal Morpheme UgUg 助语素Auxiliary morpheme BgBg 区别语素Distinguishing morphemes nn 名词noun uu 助词particle bb 区别词Distinguishing words nrnr 人名Person's name VgVg 动语素Verbal morpheme cc 连词conjunction nsns 地名Place name vv 动词verb DgDg 副语素Adverb morpheme ntnt 机构团体Institutional groups vdvd 副动词Adverb dd 副词adverb nxnx 外文字符Foreign characters vnvn 名动词Noun verb ee 叹词interjection nznz 其它专名Other proper names ww 标点符号Punctuation ff 方位词Position of the word oo 拟声词Onomatopoeia xx 非语素字Non-morpheme gg 语素Morpheme pp 介词preposition YgYg 语气语素Mood morpheme hh 前接成分Front component QgQg 量语素Morpheme yy 语气词Modal ii 成语idiom qq 量词quantifier zz 状态词State word

jj 简略语Abbreviation RgRg 代语素Morpheme  To  To kk 后接成分Followed by ingredients rr 代词pronoun  To  To

以下通过一个实例简单介绍如何对语句文本“我是一只小喵”进行词性标注:The following uses an example to briefly introduce how to tag the sentence text "I am a little cat":

进行词性标注的代码如下:The code for part-of-speech tagging is as follows:

“import jieba.posseg as pseg"Import jieba.posseg as pseg

words=pseg.cut(“我是一只小喵”)words=pseg.cut("I am a little cat")

for word,flag in words:for word, flag in words:

print('%s%s'%(word,flag))”print('%s%s'%(word,flag))"

输出结果如下:The output is as follows:

我rI r

是vIs v

一只mOne m

小喵nLittle meow n

根据上述词性标注的结果,可以将所述语句文本分解成字词特征,例如,语句文本“我是一只小喵”可以分解成4个字词特征,分别为“我r”、“是v”、“一只m”、“小喵n”。According to the results of the above-mentioned part-of-speech tagging, the sentence text can be decomposed into word features. For example, the sentence text "I am a little cat" can be decomposed into 4 word features, namely "I r" and "是v" ", "a m", "little meow n".

词性标注中的一个难点,就是针对一词多性的情况,比如工作、表演等词,它们既可以做动词又可以做名词,这类词又叫做兼类词,兼类词在常用词中出现的概率很大。针对这种情况我们通常利用概率的方法来解决,比如HMM(Hidden Markov Model,隐马尔科夫模型)是一种常用的方法来处理这种词语的标注,具体来说,就是利用HMM的图模型有一个发射的概率,即从一个词性到每个单词的概率,还有词性到词性之间的转移概率来求p(t|w)(其中,p(t|w)表示的是这个词属于某个词性的概率),具体的公式计算可以利用贝叶斯计算概率的方法。当然,还有基于转换的思想和基于分类的思想的方法进行词性标注。本申请对词性标注的方式不作限定。One of the difficulties in part-of-speech tagging is that for words with multiple genders, such as work, performance and other words, they can be used as both verbs and nouns. Such words are also called mixed words, which appear in common words. The probability is very high. In view of this situation, we usually use probabilistic methods to solve it. For example, HMM (Hidden Markov Model, Hidden Markov Model) is a commonly used method to deal with the labeling of such words, specifically, the use of HMM graph models There is a probability of emission, that is, the probability from a part of speech to each word, and the transition probability between part of speech and part of speech to find p(t|w) (where p(t|w) means that the word belongs to The probability of a certain part of speech), the specific formula calculation can use the Bayesian method of calculating the probability. Of course, there are also part-of-speech tagging methods based on conversion ideas and classification-based ideas. This application does not limit the way of part-of-speech tagging.

对于神经网络而言,输入信息实际为一个D维向量,且输入向量的维数=输入层节点数。For the neural network, the input information is actually a D-dimensional vector, and the dimension of the input vector = the number of nodes in the input layer.

如图4所示,本申请一实施例中,所述将所述字词特征转换成D维度的文本向量的步骤可以包括以下步骤:As shown in FIG. 4, in an embodiment of the present application, the step of converting the word feature into a D-dimensional text vector may include the following steps:

步骤S401,根据相似性度量方式匹配与所述字词特征相关的D-1个词条;Step S401, matching D-1 entries related to the word feature according to the similarity measurement method;

步骤S402,根据所述字词特征与所述词条的相关程度设置D个词条权重;及Step S402, setting D entry weights according to the correlation between the character feature and the entry; and

步骤S403,根据所述D个词条权重生成D维度的文本向量。Step S403: Generate a D-dimensional text vector according to the weights of the D entries.

通过word2vec算法和/或doc2vec算法将所述字词特征转换成D维度的文本向量;将所述 文本向量传入所述深度神经网络中,通过所述深度神经网络的隐藏层对所述文本向量进行处理。由于神经网络的输入向量的维数=输入层节点数,因此,需要将一个字词特征转换成一列向量,可以通过hash算法把字词特征打散成(01010101110)的数值,通过word2vec算法则可以在把字词特征打散成数值的同时还定义成向量,word2vec算法还考虑了上下语义,doc2vec算法还考虑了上下语句顺序,用在段落中较好。The word feature is converted into a D-dimensional text vector through the word2vec algorithm and/or the doc2vec algorithm; the text vector is passed into the deep neural network, and the text vector is processed through the hidden layer of the deep neural network To process. Since the dimension of the input vector of the neural network = the number of nodes in the input layer, it is necessary to convert a word feature into a list of vectors. The word feature can be broken into (01010101110) values through the hash algorithm, and the word2vec algorithm can be used The word2vec algorithm also considers the upper and lower semantics, while the word2vec algorithm also considers the order of the upper and lower sentences, which is better used in paragraphs.

根据词向量组成句向量的方式如下:The way to compose sentence vectors according to word vectors is as follows:

1)、如果是一个字词特征转换成一列向量,一般用简单相加来求得;1). If a word feature is converted into a list of vectors, it is generally obtained by simple addition;

2)、如果是一个字词特征转换成一个向量,可以用字词特征的权重组合成向量的方式。2) If a word feature is converted into a vector, the weight of the word feature can be used to recombine the vector.

当然,还可以根据相似性度量方式(例如,余弦距离)匹配与所述字词特征相关的D-1个词条;根据所述字词特征与所述词条的相关程度设置D个词条权重;根据所述D个词条权重生成D维度的文本向量。Of course, it is also possible to match D-1 entries related to the word feature according to the similarity measurement method (for example, cosine distance); set D entries according to the degree of correlation between the word feature and the entry Weight; generating a D-dimensional text vector according to the weights of the D entries.

如图5所示,本申请一实施例中,所述根据所述输出语句与所述文本向量的误差项通过反向传播算法计算所述神经网络的目标权重参数的步骤可以包括以下步骤:As shown in FIG. 5, in an embodiment of the present application, the step of calculating the target weight parameter of the neural network through a backpropagation algorithm according to the error term between the output sentence and the text vector may include the following steps:

步骤S501,从神经网络的输出层开始,反向依次计算各隐藏层的误差项;及Step S501, starting from the output layer of the neural network, calculate the error terms of each hidden layer in reverse order; and

步骤S502,根据所述误差项计算隐藏层各节点的权重参数。Step S502: Calculate the weight parameter of each node of the hidden layer according to the error term.

神经网络实际上就是一个输入向量到输出向量的函数,即根据输入计算神经网络的输出,首先需要将输入向量的每个元素的值赋给神经网络的输入层的对应神经元,然后根据公式依次向前计算每一层的每个神经元的值,直到最后一层输出层的所有神经元的值计算完毕。最后,将输出层每个神经元的值串在一起就得到了输出向量。根据输出结果与预期结果的差距,反推神经元的权重参数该如何调整,以使神经网络的输出结果达到预期效果。A neural network is actually a function from an input vector to an output vector, that is, to calculate the output of the neural network based on the input, first the value of each element of the input vector needs to be assigned to the corresponding neuron of the input layer of the neural network, and then according to the formula in turn Calculate the value of each neuron in each layer forward, until the value of all neurons in the output layer of the last layer is calculated. Finally, string together the values of each neuron in the output layer to get the output vector. According to the difference between the output result and the expected result, how to adjust the weight parameter of the neuron is inversely deduced, so that the output result of the neural network can achieve the expected effect.

为了便于描述,以下以一个全连接(full connected,FC)神经网络为例进行说明,如图6所示,给神经网络的每个单元写上编号。输入层有三个节点,依次编号为1、2、3;隐藏层的4个节点,编号依次为4、5、6、7;输出层的两个节点编号为8、9。图6所示的为全连接神经网络,所以每个节点都和上一层的所有节点有连接。例如,隐藏层的节点4与输入层的1、2、3三个节点之间都有连接,其连接上的权重参数分别为w41、w42、w43。For ease of description, the following takes a fully connected (FC) neural network as an example for description. As shown in Figure 6, each unit of the neural network is numbered. The input layer has three nodes, numbered 1, 2, and 3 sequentially; the 4 nodes of the hidden layer are numbered 4, 5, 6, and 7 in order; the two nodes of the output layer are numbered 8, 9. Figure 6 shows a fully connected neural network, so each node is connected to all nodes in the upper layer. For example, there are connections between node 4 of the hidden layer and the three nodes 1, 2, and 3 of the input layer, and the weight parameters of the connections are w41, w42, and w43, respectively.

节点1、2、3是输入层的节点,其输出值就是输入向量本身。根据图6所示,节点1、2、3的输出值分别是x1、x2、x3。节点1、2、3的输出值为节点4的输入值,根据节点1、2、3的输出值、节点4与输入层1、2、3三个节点之间的权重参数可以计算出节点4的输出值a4。相似地,还可以计算出节点5、6、7的输出值分别为a5、a6、a7,及输出层的节点8、9的输 出值分别为y1、y2。Nodes 1, 2, and 3 are the nodes of the input layer, and the output value is the input vector itself. According to Figure 6, the output values of nodes 1, 2, and 3 are x1, x2, and x3, respectively. The output value of node 1, 2, 3 is the input value of node 4. According to the output value of node 1, 2, 3, the weight parameter between node 4 and the input layer 1, 2, 3, node 4 can be calculated The output value a4. Similarly, it can be calculated that the output values of nodes 5, 6, and 7 are a5, a6, and a7, respectively, and the output values of nodes 8, 9 of the output layer are y1, and y2, respectively.

输出层节点的输出值即为该神经网络的实际输出值,可以根据实际输出值与输入值对应的预期输出值之前的误差计算隐藏层的目标权重参数,以减小实际输出值与预期输出值之间的误差。The output value of the output layer node is the actual output value of the neural network. The target weight parameter of the hidden layer can be calculated according to the error between the actual output value and the expected output value corresponding to the input value to reduce the actual output value and the expected output value The error between.

计算一个节点的误差项,需要先计算每个与其相连的下一层节点的误差项。这就要求误差项的计算顺序必须是从输出层开始,然后反向依次计算每个隐藏层的误差项,直至与输入层相连的那个隐藏层。这也是反向传播算法的名字的含义。当所有节点的误差项计算完毕后,就可以更新所述神经网络各节点的权重参数。反复执行上述过程,直至神经网络的输出语句满足预设条件。所述预设条件包括:所述神经网络的输出语句中属于自然界中存在的语句的占比达到预设阈值。To calculate the error term of a node, you need to first calculate the error term of each node of the next layer connected to it. This requires that the calculation sequence of the error term must start from the output layer, and then calculate the error term of each hidden layer in reverse order until the hidden layer connected to the input layer. This is also the meaning of the name of the backpropagation algorithm. After the error terms of all nodes are calculated, the weight parameters of each node of the neural network can be updated. Repeat the above process until the output sentence of the neural network meets the preset conditions. The preset condition includes: the proportion of sentences that exist in nature in the output sentences of the neural network reaches a preset threshold.

所述神经网络对接收的语句文本进行“分析”,得到可以使机器能够“理解”的输出语句,本申请一实施例中,可以预测所述输出语句在自然界中是否存在,可以通过标记自然界中存在的句子为“真句子”,标记自然界中不存在的句子为“假句子”来进行整体预测。可以根据网上公开的数据集作为真值参考,以预测输出语句是否为“真句子”。所述直至神经网络的输出语句满足预设条件的步骤之前还包括:判断所述输出语句是否为自然界中存在的语句;计算所述神经网络输出语句的总量为第一数量,计算其中属于自然界中存在的语句的输出语句的总量为第二数量;计算所述第二数量与所述第一数量的比值,判断所述比值是否达到预设阈值。根据所得的一批输出语句中,“真句子”所占的比例是否达到预设阈值(例如,90%等),判断所述神经网络是否训练到较佳的状态。The neural network "analyzes" the received sentence text to obtain an output sentence that can be "understood" by the machine. In an embodiment of the present application, it is possible to predict whether the output sentence exists in nature. Existing sentences are "true sentences", and sentences that do not exist in nature are marked as "fake sentences" for overall prediction. The data set publicly available on the Internet can be used as a true value reference to predict whether the output sentence is a "true sentence". The step until the output sentence of the neural network satisfies the preset condition further includes: judging whether the output sentence is a sentence existing in nature; calculating the total amount of the output sentence of the neural network as the first number, and calculating which belongs to the natural world The total number of output sentences of the sentences existing in the sentence is the second number; the ratio of the second number to the first number is calculated, and it is judged whether the ratio reaches a preset threshold. According to the obtained batch of output sentences, whether the proportion of "true sentences" reaches a preset threshold (for example, 90%, etc.), it is judged whether the neural network is trained to a better state.

本申请中,所述神经网络可以为深度神经网络,深度神经网络是一个多层神经网络,多层的好处是可以用较少的参数表示复杂的函数。建立多层神经网络的一个有效方法,简单的说,分为两步,一是每次训练一层网络,二是调优使原始表示x向上生成的高级表示r和该高级表示r向下生成的x'尽可能一致。方法是:In this application, the neural network may be a deep neural network, which is a multi-layer neural network, and the advantage of multi-layer is that it can express complex functions with fewer parameters. An effective method to build a multilayer neural network is simply divided into two steps. One is to train one layer of the network each time, and the other is to tune the high-level representation r generated from the original representation x upward and the high-level representation r generated downward The x'is as consistent as possible. the way is:

1)、首先逐层构建单层神经元,这样每次都是训练一个单层网络。1) First, build a single-layer neuron layer by layer, so that a single-layer network is trained every time.

2)、当所有层训练完后,使用Wake-Sleep算法进行调优。将除最顶层的其它层间的权重变为双向的,这样最顶层仍然是一个单层神经网络,而其它层则变为了图模型。向上的权重用于“认知”,向下的权重用于“生成”。然后使用Wake-Sleep算法调整所有的权重。让认知和生成达成一致,也就是保证生成的最顶层表示能够尽可能正确的复原底层的结点。比如顶层的一个结点表示人脸,那么所有人脸的图像应该激活这个结点,并且这个结 果向下生成的图像应该能够表现为一个大概的人脸图像。Wake-Sleep算法分为醒(Wake)和睡(Sleep)两个部分。2) After all layers are trained, use Wake-Sleep algorithm for tuning. The weights between the other layers except the top layer are changed to bidirectional, so that the top layer is still a single-layer neural network, and the other layers become a graph model. The upward weight is used for "cognition" and the downward weight is used for "generation". Then use the Wake-Sleep algorithm to adjust all the weights. Reaching agreement between cognition and generation is to ensure that the top-level representation of the generation can restore the underlying nodes as accurately as possible. For example, a node on the top layer represents a human face, then the image of all faces should activate this node, and the image generated downward from this result should be able to represent a rough face image. The Wake-Sleep algorithm is divided into two parts: Wake and Sleep.

2.1)、Wake阶段,认知过程,通过外界的特征和向上的权重(认知权重)产生每一层的抽象表示(结点状态),并且使用梯度下降修改层间的下行权重(生成权重)。也就是“如果现实跟我想像的不一样,改变我的权重使得我想像的东西就是这样的”。2.1), Wake stage, the cognitive process, through the characteristics of the outside world and upward weight (cognitive weight) to generate the abstract representation of each layer (node state), and use gradient descent to modify the downward weight between layers (generate weight) . That is, "If reality is different from what I imagined, changing my weight makes what I imagined is like this".

2.2)、Sleep阶段,生成过程,通过顶层表示(醒时学得的概念)和向下权重,生成底层的状态,同时修改层间向上的权重。也就是“如果梦中的景象不是我脑中的相应概念,改变我的认知权重使得这种景象在我看来就是这个概念”。2.2), Sleep stage, the generation process, through the top-level representation (the concept learned when waking up) and the downward weight, the state of the bottom layer is generated, and the upward weight between the layers is modified at the same time. That is, "If the scene in the dream is not the corresponding concept in my mind, change my cognitive weight so that this scene is the concept in my opinion."

本申请所提出的自然语言处理系统的构建方法,能够将接收的语句文本中提取的字词特征转换成D维度的文本向量,将所述文本向量传入神经网络,获取神经网络接收所述文本向量后的输出语句,通过反向传播算法计算所述神经网络的目标权重参数,根据所述目标权重参数调整所述神经网络各节点的权重参数,直至神经网络的输出语句满足预设条件,通过自动训练神经网络并达到较佳的处理效果,提高了构建自然语言处理系统的准确性以及便利性。The construction method of the natural language processing system proposed in this application can convert the word features extracted from the received sentence text into a D-dimensional text vector, pass the text vector into a neural network, and obtain the neural network to receive the text The output sentence after the vector is calculated by the backpropagation algorithm to calculate the target weight parameter of the neural network, and the weight parameter of each node of the neural network is adjusted according to the target weight parameter, until the output sentence of the neural network meets the preset condition, through Automatically train neural networks and achieve better processing results, which improves the accuracy and convenience of building natural language processing systems.

本申请进一步提供一种电子装置。参阅图7,是本申请一示例性实施例示出的电子装置20的程序模块示意图。The application further provides an electronic device. Refer to FIG. 7, which is a schematic diagram of program modules of the electronic device 20 according to an exemplary embodiment of the present application.

所述电子装置20包括:The electronic device 20 includes:

提取模块201,适于从接收的语句文本中提取若干字词特征;The extraction module 201 is adapted to extract several word features from the received sentence text;

转换模块202,适于将所述字词特征转换成D维度的文本向量,并将所述文本向量传入神经网络;The conversion module 202 is adapted to convert the word feature into a D-dimensional text vector, and pass the text vector into a neural network;

计算模块203,适于获取神经网络接收所述文本向量后的输出语句,通过反向传播算法计算所述神经网络的目标权重参数;及The calculation module 203 is adapted to obtain the output sentence after the neural network receives the text vector, and calculate the target weight parameter of the neural network through a back propagation algorithm; and

调整模块204,适于根据所述目标权重参数调整所述神经网络各节点的权重参数,直至神经网络的输出语句满足预设条件。The adjustment module 204 is adapted to adjust the weight parameter of each node of the neural network according to the target weight parameter until the output sentence of the neural network meets a preset condition.

进一步地,所述提取模块201包括:标注单元,适于标注语句文本中字词的词性;及分解单元,适于根据所述词性将所述语句文本分解成字词特征。Further, the extraction module 201 includes: a labeling unit adapted to label the part of speech of words in the sentence text; and a decomposition unit adapted to decompose the sentence text into word features according to the part of speech.

进一步地,所述转换模块202包括:匹配单元,适于根据相似性度量方式匹配与所述字词特征相关的D-1个词条;设置单元,适于根据所述字词特征与所述词条的相关程度设置D个词条权重;及向量生成单元,适于根据所述D个词条权重生成D维度的文本向量。Further, the conversion module 202 includes: a matching unit, adapted to match D-1 entries related to the word feature according to a similarity measure; a setting unit, adapted to match the word feature with the word feature according to the The degree of relevance of the term sets D term weights; and the vector generating unit is adapted to generate a D-dimensional text vector according to the D term weights.

进一步地,所述相似性度量方式包括余弦距离。Further, the similarity measurement method includes cosine distance.

进一步地,所述计算模块203还适于从神经网络的输出层开始,反向依次计算各隐藏层的误差项;及根据所述误差项计算隐藏层各节点的权重参数。Further, the calculation module 203 is further adapted to calculate the error term of each hidden layer in reverse order starting from the output layer of the neural network; and calculate the weight parameter of each node of the hidden layer according to the error term.

进一步地,所述预设条件包括:所述神经网络的输出语句中属于自然界中存在的语句的占比达到预设阈值。Further, the preset condition includes: the proportion of sentences that belong to the natural world in the output sentences of the neural network reaches a preset threshold.

进一步地,所述神经网络为深度神经网络。Further, the neural network is a deep neural network.

本申请所提出的电子装置20,能够将接收的语句文本中提取的字词特征转换成D维度的文本向量,将所述文本向量传入神经网络,获取神经网络接收所述文本向量后的输出语句,通过反向传播算法计算所述神经网络的目标权重参数,根据所述目标权重参数调整所述神经网络各节点的权重参数,直至神经网络的输出语句满足预设条件,通过自动训练神经网络并达到较佳的处理效果,提高了构建自然语言处理系统的准确性以及便利性。The electronic device 20 proposed in this application can convert the word features extracted from the received sentence text into a D-dimensional text vector, pass the text vector into a neural network, and obtain the output of the neural network after receiving the text vector Sentence, calculate the target weight parameter of the neural network through the backpropagation algorithm, adjust the weight parameter of each node of the neural network according to the target weight parameter, until the output sentence of the neural network meets the preset condition, through the automatic training of the neural network And achieve a better processing effect, improve the accuracy and convenience of building a natural language processing system.

为实现上述目的,本申请还提供一种计算机设备20,包括存储器21、处理器22以及存储在存储器21上并可在所述处理器22上运行的计算机可读指令,所述处理器22执行所述计算机可读指令时实现上述方法的步骤。可以将所述计算机可读指令存储于内存24中。To achieve the above objective, the present application also provides a computer device 20, including a memory 21, a processor 22, and computer-readable instructions stored on the memory 21 and running on the processor 22, and the processor 22 executes The computer-readable instructions implement the steps of the above method. The computer readable instructions can be stored in the memory 24.

为实现上述目的,本申请还提供非易失性计算机可读存储介质,其上存储有计算机可读指令,所述计算机可读指令被处理器执行时实现上述方法的步骤。To achieve the foregoing objective, the present application also provides a non-volatile computer-readable storage medium on which computer-readable instructions are stored, and the computer-readable instructions implement the steps of the foregoing method when executed by a processor.

本申请还提供一种计算机设备,如可以执行程序的智能手机、平板电脑、笔记本电脑、台式计算机、机架式服务器、刀片式服务器、塔式服务器或机柜式服务器(包括独立的服务器,或者多个服务器所组成的服务器集群)等。本实施例的计算机设备至少包括但不限于:可通过系统总线相互通信连接的存储器、处理器等。This application also provides a computer device, such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a rack server, a blade server, a tower server, or a cabinet server (including independent servers, or more) that can execute programs. A server cluster composed of two servers) and so on. The computer device in this embodiment at least includes but is not limited to: a memory, a processor, etc., which can be communicably connected to each other through a system bus.

本实施例还提供一种非易失性计算机可读存储介质,如闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘、服务器、App应用商城等等,其上存储有计算机可读指令,程序被处理器执行时实现相应功能。本实施例的非易失性计算机可读存储介质用于存储电子装置20,被处理器22执行时实现本申请的自然语言处理系统的构建方法。This embodiment also provides a non-volatile computer-readable storage medium, such as flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory ( SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disks, optical disks, servers, App application malls, etc., on which storage There are computer-readable instructions, and the corresponding functions are realized when the program is executed by the processor. The non-volatile computer-readable storage medium of this embodiment is used to store the electronic device 20, and when executed by the processor 22, realizes the construction method of the natural language processing system of the present application.

通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算 机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法。Through the description of the above implementation manners, those skilled in the art can clearly understand that the above-mentioned embodiment method can be implemented by means of software plus the necessary general hardware platform, of course, it can also be implemented by hardware, but in many cases the former is better.的实施方式。 Based on this understanding, the technical solution of this application essentially or the part that contributes to the existing technology can be embodied in the form of a software product, and the computer software product is stored in a storage medium (such as ROM/RAM, magnetic disk, The optical disc) includes several instructions to enable a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the method described in each embodiment of the present application.

以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。The above are only the preferred embodiments of the application, and do not limit the scope of the patent for this application. Any equivalent structure or equivalent process transformation made using the content of the description and drawings of the application, or directly or indirectly applied to other related technical fields , The same reason is included in the scope of patent protection of this application.

Claims (20)

一种自然语言处理系统的构建方法,所述方法包括步骤:A method for constructing a natural language processing system, the method comprising the steps: 从接收的语句文本中提取若干字词特征;Extract several word features from the received sentence text; 将所述字词特征转换成D维度的文本向量,并将所述文本向量传入神经网络;Converting the word feature into a D-dimensional text vector, and passing the text vector into a neural network; 获取神经网络接收所述文本向量后的输出语句,根据所述输出语句与所述文本向量的误差项通过反向传播算法计算所述神经网络的目标权重参数;及Obtain the output sentence after the neural network receives the text vector, and calculate the target weight parameter of the neural network by using a back propagation algorithm according to the error term between the output sentence and the text vector; and 根据所述目标权重参数调整所述神经网络各节点的权重参数,直至神经网络的输出语句满足预设条件,得到自然语言处理系统。Adjust the weight parameter of each node of the neural network according to the target weight parameter until the output sentence of the neural network meets a preset condition, and a natural language processing system is obtained. 如权利要求1所述的自然语言处理系统的构建方法,所述从接收的语句文本中提取若干字词特征的步骤还包括:8. The method for constructing a natural language processing system according to claim 1, wherein the step of extracting several word features from the received sentence text further comprises: 将语句文本按照语法分割成若干字词,根据词性标记集标注语句文本中字词的词性;及The sentence text is divided into several words according to the grammar, and the part of speech of the words in the sentence text is marked according to the part of speech tag set; and 根据所述词性将所述语句文本分解成字词特征。The sentence text is decomposed into word features according to the part of speech. 如权利要求1所述的自然语言处理系统的构建方法,所述将所述字词特征转换成D维度的文本向量的步骤还包括:8. The method for constructing a natural language processing system according to claim 1, wherein the step of converting the word feature into a D-dimensional text vector further comprises: 根据相似性度量方式匹配与所述字词特征相关的D-1个词条;Match D-1 entries related to the word feature according to the similarity measurement method; 根据所述字词特征与所述词条的相关程度设置D个词条权重;及Set D entry weights according to the degree of correlation between the character feature and the entry; and 根据所述D个词条权重生成D维度的文本向量。A D-dimensional text vector is generated according to the weights of the D entries. 如权利要求3所述的自然语言处理系统的构建方法,所述相似性度量方式包括余弦距离。8. The method for constructing a natural language processing system according to claim 3, wherein the similarity measurement method includes cosine distance. 如权利要求1所述的自然语言处理系统的构建方法,所述根据所述输出语句与所述文本向量的误差项通过反向传播算法计算所述神经网络的目标权重参数的步骤还包括:8. The method for constructing a natural language processing system according to claim 1, wherein the step of calculating the target weight parameter of the neural network through a back propagation algorithm according to the error term of the output sentence and the text vector further comprises: 从神经网络的输出层开始,反向依次计算各隐藏层的误差项;及Starting from the output layer of the neural network, calculate the error terms of each hidden layer in reverse order; and 根据所述误差项计算隐藏层各节点的权重参数。The weight parameter of each node of the hidden layer is calculated according to the error term. 如权利要求1所述的自然语言处理系统的构建方法,所述预设条件包括:所述神经网络的输出语句中属于自然界中存在的语句的占比达到预设阈值;所述直至神经网络的输出语句满足预设条件的步骤之前还包括:2. The method for constructing a natural language processing system according to claim 1, wherein the preset conditions include: the proportion of the sentences that exist in the natural world in the output sentences of the neural network reaches a preset threshold; Before the step that the output sentence meets the preset conditions, it also includes: 判断所述输出语句是否为自然界中存在的语句;Determine whether the output sentence is a sentence that exists in nature; 计算所述神经网络输出语句的总量为第一数量,计算其中属于自然界中存在的语句的 输出语句的总量为第二数量;Calculating the total number of output sentences of the neural network as the first number, and calculating the total number of output sentences belonging to the sentences existing in nature as the second number; 计算所述第二数量与所述第一数量的比值,判断所述比值是否达到预设阈值。Calculate the ratio of the second number to the first number, and determine whether the ratio reaches a preset threshold. 如权利要求1所述的自然语言处理系统的构建方法,所述神经网络为深度神经网络;The method for constructing a natural language processing system according to claim 1, wherein the neural network is a deep neural network; 所述将所述字词特征转换成D维度的文本向量,并将所述文本向量传入神经网络的步骤包括:The step of converting the word feature into a D-dimensional text vector and transmitting the text vector to a neural network includes: 通过word2vec算法和/或doc2vec算法将所述字词特征转换成D维度的文本向量;Converting the word feature into a D-dimensional text vector through the word2vec algorithm and/or the doc2vec algorithm; 将所述文本向量传入所述深度神经网络中,通过所述深度神经网络的隐藏层对所述文本向量进行处理。The text vector is passed into the deep neural network, and the text vector is processed through the hidden layer of the deep neural network. 一种电子装置,其包括:An electronic device, which includes: 提取模块,适于从接收的语句文本中提取若干字词特征;The extraction module is suitable for extracting several word features from the received sentence text; 转换模块,适于将所述字词特征转换成D维度的文本向量,并将所述文本向量传入神经网络;A conversion module, adapted to convert the word feature into a D-dimensional text vector, and pass the text vector into a neural network; 计算模块,适于获取神经网络接收所述文本向量后的输出语句,根据所述输出语句与所述文本向量的误差项通过反向传播算法计算所述神经网络的目标权重参数;及The calculation module is adapted to obtain the output sentence after the neural network receives the text vector, and calculate the target weight parameter of the neural network through the back propagation algorithm according to the error term between the output sentence and the text vector; and 调整模块,适于根据所述目标权重参数调整所述神经网络各节点的权重参数,直至神经网络的输出语句满足预设条件,得到自然语言处理系统。The adjustment module is adapted to adjust the weight parameter of each node of the neural network according to the target weight parameter, until the output sentence of the neural network meets a preset condition, and a natural language processing system is obtained. 一种计算机设备,包括存储器、处理器以及存储在存储器上并可在处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现自然语言处理系统的构建方法包括步骤:A computer device includes a memory, a processor, and computer-readable instructions stored in the memory and capable of running on the processor. The method for constructing a natural language processing system when the processor executes the computer-readable instructions includes the steps : 从接收的语句文本中提取若干字词特征;Extract several word features from the received sentence text; 将所述字词特征转换成D维度的文本向量,并将所述文本向量传入神经网络;Converting the word feature into a D-dimensional text vector, and passing the text vector into a neural network; 获取神经网络接收所述文本向量后的输出语句,根据所述输出语句与所述文本向量的误差项通过反向传播算法计算所述神经网络的目标权重参数;及Obtain the output sentence after the neural network receives the text vector, and calculate the target weight parameter of the neural network by using a back propagation algorithm according to the error term between the output sentence and the text vector; and 根据所述目标权重参数调整所述神经网络各节点的权重参数,直至神经网络的输出语句满足预设条件,得到自然语言处理系统。Adjust the weight parameter of each node of the neural network according to the target weight parameter until the output sentence of the neural network meets a preset condition, and a natural language processing system is obtained. 如权利要求9所述的计算机设备,所述从接收的语句文本中提取若干字词特征的步骤还包括:9. The computer device of claim 9, wherein the step of extracting several word features from the received sentence text further comprises: 将语句文本按照语法分割成若干字词,根据词性标记集标注语句文本中字词的词性;及The sentence text is divided into several words according to the grammar, and the part of speech of the words in the sentence text is marked according to the part of speech tag set; and 根据所述词性将所述语句文本分解成字词特征。The sentence text is decomposed into word features according to the part of speech. 如权利要求9所述的计算机设备,所述将所述字词特征转换成D维度的文本向量的步骤还包括:9. The computer device of claim 9, wherein the step of converting the word feature into a D-dimensional text vector further comprises: 根据相似性度量方式匹配与所述字词特征相关的D-1个词条;Match D-1 entries related to the word feature according to the similarity measurement method; 根据所述字词特征与所述词条的相关程度设置D个词条权重;及Set D entry weights according to the degree of correlation between the character feature and the entry; and 根据所述D个词条权重生成D维度的文本向量。A D-dimensional text vector is generated according to the weights of the D entries. 如权利要求11所述的计算机设备,所述相似性度量方式包括余弦距离。The computer device according to claim 11, wherein the similarity measurement method includes a cosine distance. 如权利要求9所述的计算机设备,所述根据所述输出语句与所述文本向量的误差项通过反向传播算法计算所述神经网络的目标权重参数的步骤还包括:9. The computer device according to claim 9, wherein the step of calculating the target weight parameter of the neural network through a backpropagation algorithm according to the error term between the output sentence and the text vector further comprises: 从神经网络的输出层开始,反向依次计算各隐藏层的误差项;及Starting from the output layer of the neural network, calculate the error terms of each hidden layer in reverse order; and 根据所述误差项计算隐藏层各节点的权重参数。The weight parameter of each node of the hidden layer is calculated according to the error term. 如权利要求9所述的计算机设备,所述预设条件包括:所述神经网络的输出语句中属于自然界中存在的语句的占比达到预设阈值;所述直至神经网络的输出语句满足预设条件的步骤之前还包括:9. The computer device according to claim 9, wherein the preset condition comprises: the proportion of the sentences in the natural world in the output sentences of the neural network reaches a preset threshold; and the output sentences up to the neural network meet the preset threshold Before the conditional step, it also includes: 判断所述输出语句是否为自然界中存在的语句;Determine whether the output sentence is a sentence that exists in nature; 计算所述神经网络输出语句的总量为第一数量,计算其中属于自然界中存在的语句的输出语句的总量为第二数量;Calculating the total number of output sentences of the neural network as the first number, and calculating the total number of output sentences belonging to the sentences existing in nature as the second number; 计算所述第二数量与所述第一数量的比值,判断所述比值是否达到预设阈值。Calculate the ratio of the second number to the first number, and determine whether the ratio reaches a preset threshold. 如权利要求9所述的计算机设备,所述神经网络为深度神经网络;9. The computer device of claim 9, wherein the neural network is a deep neural network; 所述将所述字词特征转换成D维度的文本向量,并将所述文本向量传入神经网络的步骤包括:The step of converting the word feature into a D-dimensional text vector and transmitting the text vector to a neural network includes: 通过word2vec算法和/或doc2vec算法将所述字词特征转换成D维度的文本向量;Converting the word feature into a D-dimensional text vector through the word2vec algorithm and/or the doc2vec algorithm; 将所述文本向量传入所述深度神经网络中,通过所述深度神经网络的隐藏层对所述文本向量进行处理。The text vector is passed into the deep neural network, and the text vector is processed through the hidden layer of the deep neural network. 一种非易失性计算机可读存储介质,其上存储有计算机可读指令,所述计算机可读指令被处理器执行时实现自然语言处理系统的构建方法包括步骤:A non-volatile computer-readable storage medium has computer-readable instructions stored thereon, and when the computer-readable instructions are executed by a processor, a method for constructing a natural language processing system is realized, including the following steps: 从接收的语句文本中提取若干字词特征;Extract several word features from the received sentence text; 将所述字词特征转换成D维度的文本向量,并将所述文本向量传入神经网络;Converting the word feature into a D-dimensional text vector, and passing the text vector into a neural network; 获取神经网络接收所述文本向量后的输出语句,根据所述输出语句与所述文本向量的误差项通过反向传播算法计算所述神经网络的目标权重参数;及Obtain the output sentence after the neural network receives the text vector, and calculate the target weight parameter of the neural network by using a back propagation algorithm according to the error term between the output sentence and the text vector; and 根据所述目标权重参数调整所述神经网络各节点的权重参数,直至神经网络的输出语 句满足预设条件,得到自然语言处理系统。Adjust the weight parameter of each node of the neural network according to the target weight parameter until the output sentence of the neural network meets the preset condition, and the natural language processing system is obtained. 如权利要求16所述的非易失性计算机可读存储介质,所述从接收的语句文本中提取若干字词特征的步骤还包括:15. The non-volatile computer-readable storage medium of claim 16, wherein the step of extracting several word features from the received sentence text further comprises: 将语句文本按照语法分割成若干字词,根据词性标记集标注语句文本中字词的词性;及The sentence text is divided into several words according to the grammar, and the part of speech of the words in the sentence text is marked according to the part of speech tag set; and 根据所述词性将所述语句文本分解成字词特征。The sentence text is decomposed into word features according to the part of speech. 如权利要求16所述的非易失性计算机可读存储介质,所述将所述字词特征转换成D维度的文本向量的步骤还包括:15. The non-volatile computer-readable storage medium of claim 16, wherein the step of converting the word feature into a D-dimensional text vector further comprises: 根据相似性度量方式匹配与所述字词特征相关的D-1个词条;Match D-1 entries related to the word feature according to the similarity measurement method; 根据所述字词特征与所述词条的相关程度设置D个词条权重;及Set D entry weights according to the degree of correlation between the character feature and the entry; and 根据所述D个词条权重生成D维度的文本向量。A D-dimensional text vector is generated according to the weights of the D entries. 如权利要求18所述的非易失性计算机可读存储介质,所述相似性度量方式包括余弦距离。The non-volatile computer-readable storage medium of claim 18, wherein the similarity measure includes cosine distance. 如权利要求16所述的非易失性计算机可读存储介质,所述根据所述输出语句与所述文本向量的误差项通过反向传播算法计算所述神经网络的目标权重参数的步骤还包括:The non-volatile computer-readable storage medium of claim 16, wherein the step of calculating the target weight parameter of the neural network through a backpropagation algorithm according to the error term between the output sentence and the text vector further comprises : 从神经网络的输出层开始,反向依次计算各隐藏层的误差项;及Starting from the output layer of the neural network, calculate the error terms of each hidden layer in reverse order; and 根据所述误差项计算隐藏层各节点的权重参数。The weight parameter of each node of the hidden layer is calculated according to the error term.
PCT/CN2019/118031 2019-09-17 2019-11-13 Method for constructing natural language processing system, electronic apparatus, and computer device Ceased WO2021051585A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910876792.1 2019-09-17
CN201910876792.1A CN110765243A (en) 2019-09-17 2019-09-17 Construction method, electronic device and computer equipment of natural language processing system

Publications (1)

Publication Number Publication Date
WO2021051585A1 true WO2021051585A1 (en) 2021-03-25

Family

ID=69329984

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/118031 Ceased WO2021051585A1 (en) 2019-09-17 2019-11-13 Method for constructing natural language processing system, electronic apparatus, and computer device

Country Status (2)

Country Link
CN (1) CN110765243A (en)
WO (1) WO2021051585A1 (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105868184A (en) * 2016-05-10 2016-08-17 大连理工大学 Chinese name recognition method based on recurrent neural network
CN107038480A (en) * 2017-05-12 2017-08-11 东华大学 A kind of text sentiment classification method based on convolutional neural networks
CN108566627A (en) * 2017-11-27 2018-09-21 浙江鹏信信息科技股份有限公司 A kind of method and system identifying fraud text message using deep learning
CN108763477A (en) * 2018-05-29 2018-11-06 厦门快商通信息技术有限公司 A kind of short text classification method and system
US20190073351A1 (en) * 2016-03-18 2019-03-07 Gogle Llc Generating dependency parses of text segments using neural networks

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP7072178B2 (en) * 2018-02-28 2022-05-20 日本電信電話株式会社 Equipment, methods and programs for natural language processing

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190073351A1 (en) * 2016-03-18 2019-03-07 Gogle Llc Generating dependency parses of text segments using neural networks
CN105868184A (en) * 2016-05-10 2016-08-17 大连理工大学 Chinese name recognition method based on recurrent neural network
CN107038480A (en) * 2017-05-12 2017-08-11 东华大学 A kind of text sentiment classification method based on convolutional neural networks
CN108566627A (en) * 2017-11-27 2018-09-21 浙江鹏信信息科技股份有限公司 A kind of method and system identifying fraud text message using deep learning
CN108763477A (en) * 2018-05-29 2018-11-06 厦门快商通信息技术有限公司 A kind of short text classification method and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
XU XINFENG: "The Research on Chinese Personal Name Recognition Based on Recurrent Neural Networks", INFORMATION SCIENCE AND TECHNOLOGY, CHINESE MASTER’S THESES FULL-TEXT DATABASE, 15 March 2017 (2017-03-15), XP055792216 *

Also Published As

Publication number Publication date
CN110765243A (en) 2020-02-07

Similar Documents

Publication Publication Date Title
US11816438B2 (en) Context saliency-based deictic parser for natural language processing
US9348809B1 (en) Modifying a tokenizer based on pseudo data for natural language processing
CN111984766B (en) Missing Semantic Completion Method and Device
US11580145B1 (en) Query rephrasing using encoder neural network and decoder neural network
US10176804B2 (en) Analyzing textual data
CN114830148A (en) Controlled benchmarked text generation
CN111694937B (en) Interview method, device, computer equipment and storage medium based on artificial intelligence
Wu et al. Research on business English translation framework based on speech recognition and wireless communication
CN110991181B (en) Method and apparatus for enhancing labeled samples
US9251141B1 (en) Entity identification model training
US7957968B2 (en) Automatic grammar generation using distributedly collected knowledge
US20220147719A1 (en) Dialogue management
CN118278543A (en) Answer evaluation model training method, evaluation method, device, equipment and medium
CN114840632B (en) A knowledge extraction method, system, device and storage medium
JP2024525173A (en) Multilingual Grammar Error Correction
Duşçu et al. Polarity classification of twitter messages using audio processing
Simske et al. Functional applications of text analytics systems
US20070005345A1 (en) Generating Chinese language couplets
Alqahtani Transcending ambiguities: Enhancing AI-driven Arabic to English translations with human expertise
Büyük et al. Learning from mistakes: Improving spelling correction performance with automatic generation of realistic misspellings
CN111680515B (en) Answer determination method and device based on AI (Artificial Intelligence) recognition, electronic equipment and medium
Palmer et al. Robust information extraction from automatically generated speech transcriptions
US20250190430A1 (en) Question-answering method and apparatus
Misu et al. Bayes risk-based dialogue management for document retrieval system with speech interface
US12468756B2 (en) Query evaluation for image retrieval and conditional image generation

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

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19945611

Country of ref document: EP

Kind code of ref document: A1