JP6712973B2 - Sentence generation device, sentence generation learning device, sentence generation method, and program - Google Patents

Sentence generation device, sentence generation learning device, sentence generation method, and program Download PDF

Info

Publication number
JP6712973B2
JP6712973B2 JP2017168934A JP2017168934A JP6712973B2 JP 6712973 B2 JP6712973 B2 JP 6712973B2 JP 2017168934 A JP2017168934 A JP 2017168934A JP 2017168934 A JP2017168934 A JP 2017168934A JP 6712973 B2 JP6712973 B2 JP 6712973B2
Authority
JP
Japan
Prior art keywords
word
fixed
unit
length vector
vector
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.)
Active
Application number
JP2017168934A
Other languages
Japanese (ja)
Other versions
JP2019046188A (en
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.)
Nippon Telegraph and Telephone Corp
Original Assignee
Nippon Telegraph and Telephone Corp
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 Nippon Telegraph and Telephone Corp filed Critical Nippon Telegraph and Telephone Corp
Priority to JP2017168934A priority Critical patent/JP6712973B2/en
Publication of JP2019046188A publication Critical patent/JP2019046188A/en
Application granted granted Critical
Publication of JP6712973B2 publication Critical patent/JP6712973B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Description

本発明は、文生成装置、文生成学習装置、文生成方法、及びプログラムに関し、特に、自然言語文を自動的に生成するための文生成装置、文生成学習装置、文生成方法、及びプログラムに関する。 The present invention relates to a sentence generation device, a sentence generation learning device, a sentence generation method, and a program, and more particularly to a sentence generation device, a sentence generation learning device, a sentence generation method, and a program for automatically generating a natural language sentence. ..

自然言語で書かれた文書を計算機が翻訳、あるいは要約するためには、自然言語文の解析だけではなく、計算機によって文を生成する技術がなくてはならない。また、機械と人とが対話を行う際にも、自然言語文を自動的に生成する必要がある。 In order for a computer to translate or summarize a document written in natural language, it is necessary not only to analyze a natural language sentence but also to have a technique of generating a sentence by a computer. In addition, it is necessary to automatically generate a natural language sentence when a machine and a person have a dialogue.

計算機による文の生成は、最初の単語を入力とし、次に出現する単語の確率を計算し、単語を生成する、その後、出力した単語を入力として、さらに次に出現する単語の確率を計算する、という処理を繰り返すことによって行う。 The computer generates sentences by inputting the first word, calculating the probability of the word that appears next, generating the word, and then using the output word as the input, calculating the probability of the word that appears next It is performed by repeating the process of.

近年、リカレントニューラルネットワーク(RNN)を用い、過去の全単語列を元に、単語の出現確率を計算する手法が主流になってきている(非特許文献1)。 In recent years, a method of calculating a word appearance probability based on all past word strings using a recurrent neural network (RNN) has become mainstream (Non-Patent Document 1).

この手法では、単語を各次元の要素が実数値の、固定長のベクトル(固定長ベクトルと呼ぶ)で表現し、単語間の組み合わせをベクトル同士の演算で表現する。これにより、似た意味の単語が似たベクトルとなり、組み合わせ計算におけるスパース性が減少するという利点がある。 In this method, a word is expressed by a fixed-length vector (called a fixed-length vector) in which each dimension element is a real value, and a combination between words is expressed by calculation of vectors. As a result, words having similar meanings become similar vectors, and there is an advantage that sparsity in combination calculation is reduced.

具体的には、RNNは、まず、最初の単語を入力として固定長ベクトルを計算し、次の単語を出力する。次に、出力した単語を入力として固定長ベクトルを計算する、という処理を繰り返すことにより、文を生成する(図8)。 Specifically, the RNN first calculates a fixed length vector with the first word as an input, and outputs the next word. Next, a sentence is generated by repeating the process of calculating a fixed length vector using the output word as an input (FIG. 8).

Wojciech Zaremba, Ilya Sutskever, and Oriol Vinyals. Recurrent Neural Network Regularization. Proceedings of the 2nd International Conference on Learning Representations (ICLR 2014), 2014.Wojciech Zaremba, Ilya Sutskever, and Oriol Vinyals. Recurrent Neural Network Regularization.Proceedings of the 2nd International Conference on Learning Representations (ICLR 2014), 2014.

RNNを用いた文生成システムは、過去に出力した全単語を考慮できるため、長期の依存関係を扱うことができる。一方で、似た意味の単語に同程度の確率を付与してしまうため、文法的に誤りを含む文や可読性の低い文を生成してしまう、という問題があった(図9)。 Since the sentence generation system using RNN can consider all the words output in the past, it can handle long-term dependency. On the other hand, since similar probabilities are given to words having similar meanings, there is a problem that a sentence including a grammatical error or a sentence having low readability is generated (FIG. 9).

本発明は、この課題を鑑みてなされたものであり、文法的誤りが少なく、かつ、可読性の高い文を生成することができる文生成装置、文生成方法、及びプログラムを提供することを目的とする。 The present invention has been made in view of this problem, and an object of the present invention is to provide a sentence generation device, a sentence generation method, and a program capable of generating a highly readable sentence with few grammatical errors. To do.

また、本発明は、文法的誤りが少なく、かつ、可読性の高い文を生成するためのニューラルネットワークを学習することができる文生成学習装置及びプログラムを提供することを目的とする。 It is another object of the present invention to provide a sentence generation learning device and a program capable of learning a neural network for generating a highly readable sentence with few grammatical errors.

上記目的を達成するために、本発明に係る文生成装置は、入力された単語を第1の固定長ベクトルに変換する入力変換部と、前記入力変換部で得た前記第1の固定長ベクトルと、過去に生成された第2の固定長ベクトルとから、次の単語を予測するための予め学習されたニューラルネットワークを用いて、第2の固定長ベクトルを生成する生成部と、前記入力変換部で得た前記第1の固定長ベクトルから、前記生成部で生成した前記第2の固定長ベクトルを補正するための予め学習されたニューラルネットワークを用いて、前記第2の固定長ベクトルを補正するための補正用ベクトルを生成する補正部と、前記生成部で生成した第2の固定長ベクトルと、前記補正部で得た前記補正用ベクトルとから、各単語の出現確率を表すベクトルを計算し、各単語の出現確率を表すベクトルに応じて選択される単語を、次の単語として出力する出力部とを含み、前記出力部が出力した単語を前記入力変換部の入力として、前記入力変換部、前記生成部、前記補正部、及び前記出力部での各処理を繰り返すことにより生成した単語を並べた単語列を候補文として生成するものであり、前記生成部は、前記入力変換部で得た第1の固定長ベクトルと、過去に生成された第2の固定長ベクトルである、前記単語列中の当該第1の固定長ベクトルに対応する単語の直前の単語までの単語列に対応する第2の固定長ベクトルとから、前記単語列中の当該第1の固定長ベクトルに対応する単語までの単語列に対応する第2の固定長ベクトルを生成するように構成される。 In order to achieve the above object, a sentence generation device according to the present invention includes an input conversion unit that converts an input word into a first fixed-length vector, and the first fixed-length vector obtained by the input conversion unit. And a second fixed-length vector generated in the past, using a pre-learned neural network for predicting the next word, a generation unit that generates a second fixed-length vector, and the input conversion. The second fixed length vector from the first fixed length vector obtained by the section using a pre-learned neural network for correcting the second fixed length vector generated by the generation section. Calculating a vector representing the appearance probability of each word from a correction unit that generates a correction vector for performing the correction, a second fixed-length vector generated by the generation unit, and the correction vector obtained by the correction unit. A word selected according to a vector representing the appearance probability of each word, and an output unit that outputs the next word, and the word output by the output unit is input to the input conversion unit, and the input conversion is performed. Unit, the generation unit, the correction unit, and the output unit to generate a word string in which the generated words are arranged by repeating each process as a candidate sentence, the generation unit, in the input conversion unit Corresponding to the obtained first fixed-length vector and the second fixed-length vector generated in the past, up to the word immediately preceding the word corresponding to the first fixed-length vector in the word string The second fixed length vector corresponding to the word string up to the word corresponding to the first fixed length vector in the word string is generated from the second fixed length vector.

また、本発明に係る文生成方法は、入力変換部が、入力された単語を第1の固定長ベクトルに変換し、生成部が、前記入力変換部で得た前記第1の固定長ベクトルと、過去に生成された第2の固定長ベクトルとから、次の単語を予測するための予め学習されたニューラルネットワークを用いて、第2の固定長ベクトルを生成し、補正部が、前記入力変換部で得た前記第1の固定長ベクトルから、前記生成部で生成した前記第2の固定長ベクトルを補正するための予め学習されたニューラルネットワークを用いて、前記第2の固定長ベクトルを補正するための補正用ベクトルを生成し、出力部が、前記生成部で生成した第2の固定長ベクトルと、前記補正部で得た前記補正用ベクトルとから、各単語の出現確率を表すベクトルを計算し、各単語の出現確率を表すベクトルに応じて選択される単語を、次の単語として出力することを含み、
前記出力部が出力した単語を前記入力変換部の入力として、前記入力変換部、前記生成部、前記補正部、及び前記出力部での各処理を繰り返すことにより生成した単語を並べた単語列を候補文として生成するものであり、前記生成部は、前記入力変換部で得た第1の固定長ベクトルと、過去に生成された第2の固定長ベクトルである、前記単語列中の当該第1の固定長ベクトルに対応する単語の直前の単語までの単語列に対応する第2の固定長ベクトルとから、前記単語列中の当該第1の固定長ベクトルに対応する単語までの単語列に対応する第2の固定長ベクトルを生成する。
Further, in the sentence generation method according to the present invention, the input conversion unit converts the input word into a first fixed-length vector, and the generation unit converts the input word into the first fixed-length vector obtained by the input conversion unit. , A second fixed-length vector generated in the past, using a pre-learned neural network for predicting the next word, generates a second fixed-length vector, and the correction unit performs the input conversion. The second fixed length vector from the first fixed length vector obtained by the section using a pre-learned neural network for correcting the second fixed length vector generated by the generation section. Generating a correction vector, and the output unit generates a vector representing the appearance probability of each word from the second fixed-length vector generated by the generation unit and the correction vector obtained by the correction unit. Calculating and outputting a word selected according to a vector representing the appearance probability of each word as the next word,
A word string in which words output by the output unit are input to the input conversion unit and words generated by repeating the processes of the input conversion unit, the generation unit, the correction unit, and the output unit are arranged. The candidate sentence is generated as a candidate sentence, and the generation unit includes the first fixed-length vector obtained by the input conversion unit and the second fixed-length vector generated in the past, the first fixed-length vector in the word string. From a second fixed-length vector corresponding to a word string up to the word immediately preceding the word corresponding to one fixed-length vector to a word string up to the word corresponding to the first fixed-length vector in the word string Generate a corresponding second fixed length vector.

本発明に係る文生成装置及び文生成方法によれば、入力変換部が、入力された単語を第1の固定長ベクトルに変換し、生成部が、前記入力変換部で得た前記第1の固定長ベクトルと、過去に生成された第2の固定長ベクトルとから、次の単語を予測するための予め学習されたニューラルネットワークを用いて、第2の固定長ベクトルを生成し、補正部が、前記入力変換部で得た前記第1の固定長ベクトルから、前記生成部で生成した前記第2の固定長ベクトルを補正するための予め学習されたニューラルネットワークを用いて、前記第2の固定長ベクトルを補正するための補正用ベクトルを生成し、出力部が、前記生成部で生成した第2の固定長ベクトルと、前記補正部で得た前記補正用ベクトルとから、各単語の出現確率を表すベクトルを計算し、各単語の出現確率を表すベクトルに応じて選択される単語を、次の単語として出力する。 According to the sentence generation device and the sentence generation method of the present invention, the input conversion unit converts the input word into a first fixed-length vector, and the generation unit acquires the first fixed length vector obtained by the input conversion unit. The second fixed-length vector is generated from the fixed-length vector and the second fixed-length vector generated in the past by using a pre-learned neural network for predicting the next word. The second fixed length vector is corrected using a pre-learned neural network for correcting the second fixed length vector generated by the generation unit from the first fixed length vector obtained by the input conversion unit. A correction vector for correcting the long vector is generated, and the output unit uses the second fixed-length vector generated by the generation unit and the correction vector obtained by the correction unit, and the appearance probability of each word. Is calculated, and the word selected according to the vector representing the appearance probability of each word is output as the next word.

そして、前記出力部が出力した単語を前記入力変換部の入力として、前記入力変換部、前記生成部、前記補正部、及び前記出力部での各処理を繰り返すことにより生成した単語を並べた単語列を候補文として生成するものであり、前記生成部が、前記入力変換部で得た第1の固定長ベクトルと、過去に生成された第2の固定長ベクトルである、前記単語列中の当該第1の固定長ベクトルに対応する単語の直前の単語までの単語列に対応する第2の固定長ベクトルとから、前記単語列中の当該第1の固定長ベクトルに対応する単語までの単語列に対応する第2の固定長ベクトルを生成する。 Then, the words output by the output unit are input to the input conversion unit, and words generated by arranging the words generated by repeating the processes in the input conversion unit, the generation unit, the correction unit, and the output unit are arranged. In the word string, the sequence is generated as a candidate sentence, and the generation unit is the first fixed-length vector obtained by the input conversion unit and the second fixed-length vector generated in the past. Words from the second fixed-length vector corresponding to the word string up to the word immediately preceding the word corresponding to the first fixed-length vector to the word corresponding to the first fixed-length vector in the word string Generate a second fixed length vector corresponding to the column.

このように、第2の固定長ベクトルを補正するための補正用ベクトルを生成し、第2の固定長ベクトルと、補正用ベクトルとを用いて、単語を出力し、出力した単語を並べた単語列を候補文として生成することにより、文法的誤りが少なく、かつ、可読性の高い文を生成することができる。 In this way, a correction vector for correcting the second fixed-length vector is generated, a word is output using the second fixed-length vector and the correction vector, and the output word is arranged. By generating a sequence as a candidate sentence, a sentence with few grammatical errors and high readability can be generated.

また、本発明に係る文生成学習装置は、学習データとして予め用意された正解文の単語を第1の固定長ベクトルに変換する学習データ変換部と、前記学習データ変換部で得た前記第1の固定長ベクトルと、過去に生成された第2の固定長ベクトルとから、次の単語を予測するためのニューラルネットワークを用いて、第2の固定長ベクトルを生成する生成部と、前記学習データ変換部で得た前記第1の固定長ベクトルから、前記生成部で生成した前記第2の固定長ベクトルを補正するためのニューラルネットワークを用いて、前記第2の固定長ベクトルを補正するための補正用ベクトルを生成する補正部と、前記生成部で生成した第2の固定長ベクトルと、前記補正部で得た前記補正用ベクトルとから、各単語の出現確率を表すベクトルを計算し、各単語の出現確率を表すベクトルに応じて選択される単語を、次の単語として出力する出力部と、前記出力部で得た単語が、前記正解文の単語の次の単語となるように、前記第2の固定長ベクトルを補正するためのニューラルネットワークを学習する学習部と、を含み、前記出力部が出力した単語を前記学習データ変換部の入力として、前記学習データ変換部、前記生成部、前記補正部、前記出力部、及び前記学習部での各処理を繰り返すように構成される。 The sentence generation/learning apparatus according to the present invention includes a learning data conversion unit that converts a word of a correct sentence prepared in advance as learning data into a first fixed-length vector, and the first learning data conversion unit that obtains the first fixed-length vector. And a learning unit for generating a second fixed-length vector from the fixed-length vector of No. 1 and a second fixed-length vector generated in the past by using a neural network for predicting the next word. A neural network for correcting the second fixed-length vector generated by the generating unit from the first fixed-length vector obtained by the converting unit is used to correct the second fixed-length vector. A vector representing the appearance probability of each word is calculated from a correction unit that generates a correction vector, a second fixed-length vector generated by the generation unit, and the correction vector obtained by the correction unit. A word selected according to a vector representing the appearance probability of a word, an output unit that outputs the next word, and the word obtained by the output unit is a word next to the word of the correct sentence, A learning unit that learns a neural network for correcting the second fixed-length vector, and the learning data conversion unit, the generation unit, and the word output by the output unit as an input of the learning data conversion unit. The correction unit, the output unit, and the learning unit are configured to be repeated.

本発明に係る文生成学習装置によれば、学習データ変換部が、学習データとして予め用意された正解文の単語を第1の固定長ベクトルに変換し、生成部が、前記学習データ変換部で得た前記第1の固定長ベクトルと、過去に生成された第2の固定長ベクトルとから、次の単語を予測するためのニューラルネットワークを用いて、第2の固定長ベクトルを生成し、補正部が、前記学習データ変換部で得た前記第1の固定長ベクトルから、前記生成部で生成した前記第2の固定長ベクトルを補正するためのニューラルネットワークを用いて、前記第2の固定長ベクトルを補正するための補正用ベクトルを生成する。 According to the sentence generation/learning apparatus of the present invention, the learning data conversion unit converts the word of the correct sentence prepared in advance as learning data into the first fixed-length vector, and the generation unit uses the learning data conversion unit. From the obtained first fixed-length vector and the second fixed-length vector generated in the past, a second fixed-length vector is generated and corrected using a neural network for predicting the next word. A second fixed length using a neural network for correcting the second fixed length vector generated by the generation unit from the first fixed length vector obtained by the learning data conversion unit. A correction vector for correcting the vector is generated.

そして、出力部が、前記生成部で生成した第2の固定長ベクトルと、前記補正部で得た前記補正用ベクトルとから、各単語の出現確率を表すベクトルを計算し、各単語の出現確率を表すベクトルに応じて選択される単語を、次の単語として出力し、前記出力部で得た単語が、前記正解文の単語の次の単語となるように、前記第2の固定長ベクトルを補正するためのニューラルネットワークを学習する学習部と、を含み、前記出力部が出力した単語を前記学習データ変換部の入力として、前記学習データ変換部、前記生成部、前記補正部、前記出力部、及び前記学習部での各処理を繰り返す。 Then, the output unit calculates a vector representing the appearance probability of each word from the second fixed-length vector generated by the generation unit and the correction vector obtained by the correction unit, and the appearance probability of each word is calculated. Is output as a next word, and the second fixed-length vector is set so that the word obtained by the output unit is the word next to the word of the correct sentence. A learning unit that learns a neural network for correction, and the learning data conversion unit, the generation unit, the correction unit, and the output unit using the word output by the output unit as an input of the learning data conversion unit. , And each processing in the learning unit is repeated.

このように、第2の固定長ベクトルを補正するためのニューラルネットワークを用いて、第2の固定長ベクトルを補正するための補正用ベクトルを生成し、第2の固定長ベクトルと、補正用ベクトルとから、各単語の出現確率を表すベクトルを計算し、各単語の出現確率を表すベクトルに応じて選択される単語を、次の単語として出力し、出力した単語が、正解文の単語の次の単語となるように、第2の固定長ベクトルを補正するためのニューラルネットワークを学習することにより、文法的誤りが少なく、かつ、可読性の高い文を生成するための文生成装置を学習することができる。 As described above, a correction vector for correcting the second fixed-length vector is generated by using the neural network for correcting the second fixed-length vector, and the second fixed-length vector and the correction vector are generated. From, the vector representing the appearance probability of each word is calculated, the word selected according to the vector representing the appearance probability of each word is output as the next word, and the output word is next to the word of the correct sentence. Learning a neural network for correcting the second fixed-length vector so that the word becomes a word, and learning a sentence generation device for generating a highly readable sentence with few grammatical errors. You can

また、本発明に係る文生成学習装置は、前記学習部は、前記出力部で得た単語が、前記正解文の単語の次の単語となるように、前記次の単語を予測するためのニューラルネットワーク、及び前記第2の固定長ベクトルを補正するためのニューラルネットワークを学習するようにすることができる。 Further, in the sentence generation/learning apparatus according to the present invention, the learning unit is a neural network for predicting the next word so that the word obtained by the output unit is a word next to the word of the correct sentence. A network and a neural network for correcting the second fixed length vector may be learned.

本発明に係るプログラムは、コンピュータを、上記の文生成装置又は文生成学習装置の各部として機能させるためのプログラムである。 A program according to the present invention is a program for causing a computer to function as each unit of the above sentence generation device or sentence generation learning device.

本発明の文生成装置、文生成方法、及びプログラムによれば、文法的誤りが少なく、かつ、可読性の高い文を生成することができる。 According to the sentence generation device, the sentence generation method, and the program of the present invention, it is possible to generate a sentence with few grammatical errors and high readability.

また、本発明の文生成学習装置及びプログラムによれば、文法的誤りが少なく、かつ、可読性の高い文を生成するためのニューラルネットワークを学習することができる。 Further, according to the sentence generation learning device and the program of the present invention, it is possible to learn a neural network for generating a highly readable sentence with few grammatical errors.

本発明の実施の形態に係る文生成装置の原理を示す図である。It is a figure which shows the principle of the sentence generation apparatus which concerns on embodiment of this invention. 本発明の実施の形態に係る文生成装置の構成の一例を示す概略図である。It is a schematic diagram showing an example of composition of a sentence generation device concerning an embodiment of the invention. 本発明の実施の形態に係る各単語の出現確率を表すベクトルの例を表す図である。It is a figure showing the example of the vector showing the appearance probability of each word concerning the embodiment of the invention. 本発明の実施の形態に係る生成された出力文の例を表す図である。It is a figure showing the example of the produced|generated output sentence which concerns on embodiment of this invention. 本発明の実施の形態に係る文生成装置の文生成処理ルーチンを示すフローチャートである。5 is a flowchart showing a sentence generation processing routine of the sentence generation device according to the exemplary embodiment of the present invention. 本発明の実施の形態に係る文生成学習装置の構成の一例を示す概略図である。It is a schematic diagram showing an example of composition of a sentence generation study device concerning an embodiment of the invention. 本発明の実施の形態に係る文生成学習装置の学習処理ルーチンを示すフローチャートである。It is a flowchart which shows the learning process routine of the sentence generation learning apparatus which concerns on embodiment of this invention. 従来の文生成手法の例を表す図である。It is a figure showing the example of the conventional sentence generation method. 文法的に誤りを含む文が生成されてしまう例を表す図である。FIG. 6 is a diagram illustrating an example in which a sentence including a grammatical error is generated.

以下、本発明の実施の形態について図面を用いて説明する。 Embodiments of the present invention will be described below with reference to the drawings.

<本発明の実施の形態に係る文生成装置の概要>
上述の課題は、過去の全単語をひとつのベクトルで表現しており、各単語が過去のどの地点に出現したかを明示的に扱えず、長期の依存関係と、直近の単語との依存関係の区別ができないことに起因する。
<Outline of sentence generation device according to embodiment of the present invention>
In the above problem, all past words are represented by one vector, and it is not possible to explicitly handle where each word appears in the past, and the long-term dependency and the dependency between the most recent word Due to the inability to distinguish between.

本実施形態は、上記問題を解決するため、直近の単語との文法的なつながりの正確性を上げ、文全体での可読性を高めるものである。 In the present embodiment, in order to solve the above problem, the accuracy of the grammatical connection with the latest word is increased and the readability of the entire sentence is increased.

本実施形態では、従来と同様(非特許文献1)、RNNを用いて、過去の全単語をひとつのベクトルで表現する。これに加え、入力単語に基づいてRNNの出力した確率を補正する補正部を新たに構築する(図1)。 In the present embodiment, as in the past (Non-Patent Document 1), all past words are expressed by one vector using RNN. In addition to this, a correction unit for correcting the probability output by the RNN based on the input word is newly constructed (FIG. 1).

この補正部を用いて、入力単語との関係が文法的に誤りである単語の出現確率を下げる。すなわち、出力候補から誤った単語を除き、文法的に正しい単語を出力する。 This correction unit is used to reduce the appearance probability of a word whose relation to the input word is grammatically incorrect. That is, erroneous words are removed from the output candidates and grammatically correct words are output.

このシステムを用いて単語を繰り返し生成し、最終的に、1文を出力する。ただし、文法的に誤りであるか否か(文法的な正しさ)の判定は、補正部を学習する際に用いる学習データに基づいて決定されるものとする。 Words are repeatedly generated using this system, and finally one sentence is output. However, it is assumed that whether or not there is a grammatical error (grammatical correctness) is determined based on learning data used when learning the correction unit.

この点、ネットワーク上での、入力と出力の距離を近づけるという手法は、下位の層の出力を1つ以上離れた上の層への入力とする、下記の参考文献1に近い。 In this respect, the method of reducing the distance between the input and the output on the network is close to Reference 1 below, in which the output of the lower layer is input to the upper layer separated by one or more.

[参考文献1]Deep Residual Learning for Image Recognition. Proceedings of the 29th IEEE Conference on Computer Vision and Pattern Recognition (CVPR 2016), 2016. [Reference 1] Deep Residual Learning for Image Recognition. Proceedings of the 29th IEEE Conference on Computer Vision and Pattern Recognition (CVPR 2016), 2016.

しかしながら、参考文献1では、下位の層の出力と上位の層の出力を足し合わせて単語の出力確率を計算する、すなわち、全単語をひとつのベクトルで表現するため、各単語が過去のどの地点に出現したかを明示的に扱えないという問題は解決できない。 However, in Reference Document 1, the output probability of a word is calculated by adding the output of the lower layer and the output of the upper layer, that is, all the words are expressed by one vector, and therefore, in which point each word is in the past We cannot solve the problem that we can't explicitly handle whether or not it appears in.

これに対し、本実施形態では、RNNを用いて計算した結果を補正部によって是正するという、二段階の計算を行うことで、直前の単語を陽に考慮することが可能となっている。 On the other hand, in the present embodiment, it is possible to explicitly consider the immediately preceding word by performing a two-step calculation in which the correction unit corrects the result calculated using the RNN.

本実施形態により、直前の単語を明示的に考慮した単語生成が可能となる。これにより、直前の単語と、文法的に正しい関係にある単語を生成するようになり、最終的な出力として、文法的誤りの少ない、可読性の高い文を出力可能となる。 According to this embodiment, it is possible to generate a word by explicitly considering the immediately preceding word. As a result, a word having a grammatically correct relationship with the immediately preceding word is generated, and a sentence with few grammatical errors and high readability can be output as the final output.

本実施形態は、翻訳や要約、対話システムなど、計算機による文生成が必要な、あらゆる場面に適用することが可能である。例えば、対話システムでは、システムが発話を生成する際に、本発明を用いて、誤りの少ない、より自然な発話を生成することが可能となる。 The present embodiment can be applied to all situations in which sentence generation by a computer is required, such as translation, summarization, and dialogue system. For example, in a dialogue system, the present invention can be used to generate more natural utterances with fewer errors when the system generates utterances.

以下では、対話システムにおいて、あるユーザ発話(ユーザ発話文X)に対し、システムが応答を返すべき発話(システム発話文Y)を生成するタスクを例にとって説明する。まず、学習済みのニューラルネットワークを用いてシステム発話の発話文を生成する文生成装置の実施例について説明し、その後、ニューラルネットワークを学習する文生成学習装置について説明する。 In the following, in the interactive system, a task of generating an utterance (system utterance sentence Y) for which the system should return a response to a certain user utterance (user utterance sentence X) will be described as an example. First, an embodiment of a sentence generation device that generates a utterance sentence of a system utterance using a learned neural network will be described, and then a sentence generation learning device that learns a neural network will be described.

<本発明の実施の形態に係る文生成装置の構成>
本発明の実施の形態に係る文生成装置の構成について説明する。図2は、本発明の実施の形態に係る文生成装置の構成を示す概略図である。
<Configuration of sentence generation device according to embodiment of the present invention>
The configuration of the sentence generation device according to the embodiment of the present invention will be described. FIG. 2 is a schematic diagram showing the configuration of the sentence generation device according to the embodiment of the present invention.

本発明の実施の形態に係る文生成装置10は、対話システムにおける文生成装置である。この文生成装置10は、CPUと、RAMと、後述する文生成処理ルーチンを実行するためのプログラムを記憶したROMとを備えたコンピュータで構成され、機能的には次に示すように構成されている。 The sentence generation device 10 according to the embodiment of the present invention is a sentence generation device in a dialogue system. The sentence generation device 10 is configured by a computer including a CPU, a RAM, and a ROM that stores a program for executing a sentence generation processing routine described later, and is functionally configured as shown below. There is.

図2に示すように、文生成装置10は、入力部100と、入力変換部110と、生成部120と、RNNパラメタ記憶部130と、補正部140と、補正パラメタ記憶部150と、出力部160とを備えて構成される。 As shown in FIG. 2, the sentence generation device 10 includes an input unit 100, an input conversion unit 110, a generation unit 120, an RNN parameter storage unit 130, a correction unit 140, a correction parameter storage unit 150, and an output unit. And 160.

文生成装置10は、入力された第2の固定長ベクトル、及び文の最初の単語から、当該単語に続く文を生成する。 The sentence generation device 10 generates a sentence following the word from the input second fixed-length vector and the first word of the sentence.

文生成装置10は、入力変換部110、生成部120、補正部140、及び出力部160による各処理を繰り返すことにより、最も確率の高い1文を生成する。 The sentence generation device 10 generates one sentence with the highest probability by repeating the processes of the input conversion unit 110, the generation unit 120, the correction unit 140, and the output unit 160.

入力部100は、既知のキーボード、記憶装置などの入力器により実現される。また、入力部100は、インターネット等のネットワークを介して観測データを入力するネットワークインターフェースでも良い。 The input unit 100 is realized by an input device such as a known keyboard or storage device. The input unit 100 may also be a network interface that inputs observation data via a network such as the Internet.

RNNパラメタ記憶部130及び補正パラメタ記憶部150は、それぞれニューラルネットワークの構造に対応したパラメタと、各パラメタの値を記憶する。各パラメタの値は、学習により更新される。 The RNN parameter storage unit 130 and the correction parameter storage unit 150 each store a parameter corresponding to the structure of the neural network and the value of each parameter. The value of each parameter is updated by learning.

出力部160は、ディスプレイ、プリンタ、磁気ディスクなどで実装される。 The output unit 160 is implemented by a display, a printer, a magnetic disk, or the like.

入力部100は、ユーザ発話文Xへの応答であるシステム発話文Yとして生成する文の最初の単語を入力として受け付ける。 The input unit 100 receives, as an input, the first word of the sentence generated as the system utterance sentence Y, which is a response to the user utterance sentence X.

例えば、生成する文の最初の単語として、返答する発話において文頭となる「Yes」や「No」などを入力として受け付ける。 For example, as the first word of the generated sentence, “Yes” or “No” that is the beginning of the sentence in the reply utterance is received as an input.

なお、入力される、文の最初の単語は、ルールベースや分類器などで決定することとする。すなわち、その入力を元にして続く文を生成する際に、本実施形態に係る文生成装置10を用いる。なお、文の最初の単語は、文の開始を示す「start」記号等でもよい。 The first word of the sentence to be input is determined by a rule base or a classifier. That is, when generating a subsequent sentence based on the input, the sentence generation device 10 according to the present embodiment is used. The first word of the sentence may be a "start" symbol indicating the start of the sentence.

入力変換部110は、単語を、当該単語を表す第1の固定長ベクトルに変換する。 The input conversion unit 110 converts a word into a first fixed-length vector representing the word.

具体的には、入力変換部110は、入力部100により入力された文の最初の単語、又は出力部160から渡された単語を入力とし、入力された単語を固定長ベクトル

(第1の固定長ベクトル)に変換する。
より具体的には、各単語にあらかじめ固定長ベクトルを割り振っておき、入力単語に対応する単語の固定長ベクトルを得る。この固定長ベクトルの次元数は任意の値Nとする。
Specifically, the input conversion unit 110 takes the first word of the sentence input by the input unit 100 or the word passed from the output unit 160 as an input, and sets the input word as a fixed-length vector.

(First fixed length vector).
More specifically, a fixed length vector is assigned to each word in advance, and the fixed length vector of the word corresponding to the input word is obtained. The number of dimensions of this fixed length vector is an arbitrary value N.

そして、入力変換部110は、変換した固定長ベクトル

を、生成部120及び補正部140へ渡す。
The input conversion unit 110 then converts the fixed-length vector

To the generation unit 120 and the correction unit 140.

生成部120は、入力変換部110により単語を変換した第1の固定長ベクトルと、当該単語までの単語の系列、又はユーザ発話を表す第2の固定長ベクトルとから、次の単語を予測するための予め学習されたニューラルネットワークを用いて、当該単語までの単語の系列を表す第2の固定長ベクトルを生成する。 The generation unit 120 predicts the next word from the first fixed-length vector obtained by converting the word by the input conversion unit 110 and the sequence of words up to the word or the second fixed-length vector representing the user's utterance. A second fixed length vector representing a series of words up to the word is generated using a pre-learned neural network for.

具体的には、まず、生成部120は、当該単語までの単語の系列を表す固定長ベクトル

(第2の固定長ベクトル)を生成する。
Specifically, first, the generation unit 120 generates a fixed-length vector representing a series of words up to the word.

(Second fixed length vector) is generated.

ここで、最初の単語を入力された際の

、すなわち、

は、任意の固定長ベクトルであり、本実施形態では、ユーザ発話文Xに対応した固定長ベクトルとするが、ゼロベクトル等でもよい。
Here, when you enter the first word

, That is,

Is an arbitrary fixed length vector, and in the present embodiment, is a fixed length vector corresponding to the user utterance sentence X, but may be a zero vector or the like.

また、生成部120は、最初の単語を入力された際に、文生成装置10が予め保持している

を入力とする。
Further, the generation unit 120 is held in advance by the sentence generation device 10 when the first word is input.

Is input.

ユーザ発話文Xに対応する固定長ベクトルは、システム発話文Yの第2の固定長ベクトルを生成するのと同様の手順により、ユーザ発話文Xを構成する単語を用いて予め生成したものとする。具体的には、入力変換部110及び生成部120と同様の処理を繰り返すことにより、ユーザ発話文Xに対応する固定長ベクトルを生成する。ただし、その際、入力変換部110は、出力部160から出力される単語の代わりに、ユーザ発話文Xを構成する単語を用いることとする。 It is assumed that the fixed length vector corresponding to the user utterance sentence X is generated in advance by using the words forming the user utterance sentence X by the same procedure as that for generating the second fixed length vector of the system utterance sentence Y. .. Specifically, the fixed length vector corresponding to the user utterance sentence X is generated by repeating the same processing as the input conversion unit 110 and the generation unit 120. However, at that time, the input conversion unit 110 uses the words forming the user utterance sentence X, instead of the words output from the output unit 160.

次に、生成部120は、RNNパラメタ記憶部130から次の単語を予測するための予め学習されたRNNのパラメタ



、及び

を取得し、入力変換部110が変換した単語を表す第1の固定長ベクトル

、及び第2の固定長ベクトル

を入力として、RNNの計算を行う。RNNにより、最初の単語から、現在の単語(t番目までの単語)までの単語列(系列)全体を表す第2の固定長ベクトル

を得る。第2の固定長ベクトルは、入力変換部110で得る第1の固定長ベクトル

と同じN次元とする。
Next, the generation unit 120 uses a pre-learned RNN parameter for predicting the next word from the RNN parameter storage unit 130.

,

,as well as

And a first fixed-length vector representing the word converted by the input conversion unit 110

, And the second fixed-length vector

Is input and the RNN is calculated. A second fixed-length vector representing the entire word string (sequence) from the first word to the current word (t-th word) by RNN

To get The second fixed-length vector is the first fixed-length vector obtained by the input conversion unit 110.

The same N dimension as

また、

はN×Nの次元数の行列、

はN×Nの次元数の行列、及び

は、N次元のベクトルである。
Also,

Is an N×N dimensional matrix,

Is an N×N dimensional matrix, and

Is an N-dimensional vector.

本実施形態では、RNNに関する制約はなく、長短期記憶メモリ(LSTM)など、任意のRNNを利用可能である。ここでは、例として、エルマン型のRNNによる計算について述べる。長さtの単語列w[1:t]について、終端地点tの単語(RNNへの入力単語)を表す第1の固定長ベクトルを

としたとき、単語列w[1:t]を表す第2の固定長ベクトル

は以下の式(1)を再帰的に計算することで得られる。
In this embodiment, there is no restriction on the RNN, and any RNN such as a long-term short-term memory (LSTM) can be used. Here, as an example, the calculation by the Ellman type RNN will be described. For a word string w[1:t] having a length t, a first fixed-length vector representing a word at the terminal point t (input word to RNN) is generated.

, The second fixed-length vector representing the word string w[1:t]

Is obtained by recursively calculating the following equation (1).

ここで、tanhは、固定長ベクトルの各次元にハイパボリックタンジェント関数を適用する関数である。 Here, tanh is a function that applies a hyperbolic tangent function to each dimension of a fixed length vector.

そして、生成部120は、生成した第2の固定長ベクトル

を出力部160に渡す。
Then, the generation unit 120 generates the generated second fixed-length vector

To the output unit 160.

RNNパラメタ記憶部130は、次の単語を予測するための予め学習されたRNNのパラメタを記憶している。
具体的には、RNNパラメタ記憶部130は、後述の文生成学習装置20によって予め学習されたニューラルネットワークのパラメタ



、及び

を記憶している。
The RNN parameter storage unit 130 stores pre-learned RNN parameters for predicting the next word.
Specifically, the RNN parameter storage unit 130 is a parameter of the neural network that is learned in advance by the sentence generation/learning apparatus 20 described later.

,

,as well as

I remember.

また、次の単語を予測するためのニューラルネットワークであるRNNの構造と、各パラメタの初期値は、学習前に任意の値に設定することができる。ただし、その際、入力層(入力変換部110への入力を受け取る部分に相当)と、出力層(出力部160で

を出力する部分に相当)とは、学習データに出現する単語(生成に用いる単語)の語彙数に対応した次元数(M次元)に設定するものとする。
Further, the structure of the RNN, which is a neural network for predicting the next word, and the initial value of each parameter can be set to arbitrary values before learning. However, at that time, an input layer (corresponding to a portion that receives an input to the input conversion unit 110) and an output layer (in the output unit 160,

Is the number of dimensions (M dimensions) corresponding to the number of vocabulary words (words used for generation) appearing in the learning data.

補正部140は、入力変換部110により得られた第1の固定長ベクトルから、第2の固定長ベクトルを補正するための予め学習されたニューラルネットワークを用いて、第2の固定長ベクトルを補正するための補正用ベクトルを生成する。 The correction unit 140 corrects the second fixed-length vector from the first fixed-length vector obtained by the input conversion unit 110 using a pre-learned neural network for correcting the second fixed-length vector. To generate a correction vector.

具体的には、補正部140は、まず、補正パラメタ記憶部150から第1の固定長ベクトル

を補正するための予め学習されたニューラルネットワークのパラメタ


及び

を取得する。
Specifically, the correction unit 140 first reads the first fixed length vector from the correction parameter storage unit 150.

Parameters of pre-learned neural network for correcting

,
as well as

To get

なお、第2の固定長ベクトルを補正するためのニューラルネットワークの構造は、RNNの構造に従って決定される。 The structure of the neural network for correcting the second fixed length vector is determined according to the structure of RNN.

また、

は、M×N次元の行列、

は、M次元のベクトルである。
Also,

Is an M×N dimensional matrix,

Is an M-dimensional vector.

次に、補正部140は、入力変換部110で得た第1の固定長ベクトル

を入力とし、RNNの出力である第2の固定長ベクトルを補正する補正用ベクトルを以下の式(2)により計算する。
Next, the correction unit 140 uses the first fixed-length vector obtained by the input conversion unit 110.

Is input and the correction vector for correcting the second fixed-length vector that is the output of the RNN is calculated by the following equation (2).

ここで、

は固定長ベクトルの各次元にシグモイド関数を適用する関数である。つまり、補正用ベクトル

は各次元の値が0から1までの実数値を取るベクトルであり、補正用ベクトル

の各次元は、学習データに出現する単語に対応する。
here,

Is a function that applies a sigmoid function to each dimension of a fixed length vector. That is, the correction vector

Is a vector in which the value of each dimension takes a real value from 0 to 1, and is a correction vector

Each dimension of corresponds to a word that appears in the learning data.

すなわち、補正部140は、入力変換部110で得た単語を表す第1の固定長ベクトル

を入力とする、順伝播型のニューラルネットワークとする。ただし、RNNや、CNN等、他のニューラルネットワークでもよい。
That is, the correction unit 140 uses the first fixed-length vector representing the word obtained by the input conversion unit 110.

It is a forward-propagation type neural network with input as. However, other neural networks such as RNN and CNN may be used.

そして、補正部140は、生成した補正用ベクトル

を出力部160に渡す。
Then, the correction unit 140 uses the generated correction vector.

To the output unit 160.

補正パラメタ記憶部150は、第2の固定長ベクトルを補正するための予め学習されたニューラルネットワークのパラメタを記憶している。 The correction parameter storage unit 150 stores the parameters of the previously learned neural network for correcting the second fixed length vector.

具体的には、第1の固定長ベクトル

を入力とし、第2の固定長ベクトルを補正するための、後述の文生成学習装置20によって予め学習されたニューラルネットワークのパラメタ


及び

を記憶している。
Specifically, the first fixed-length vector

Parameter of the neural network, which is pre-learned by the sentence generation/learning device 20 described later, for correcting the second fixed-length vector

,
as well as

I remember.

出力部160は、第2の固定長ベクトルと、補正用ベクトルとに基づいて、第2の固定長ベクトルを補正した上で、各単語の出現確率を表すベクトルを計算し、各単語の出現確率を表すベクトルに応じて選択される単語を、次の単語として出力する。 The output unit 160 corrects the second fixed-length vector based on the second fixed-length vector and the correction vector and then calculates a vector representing the appearance probability of each word to calculate the appearance probability of each word. The word selected according to the vector representing is output as the next word.

具体的には、出力部160は、生成部120から取得したRNNの出力である第2の固定長ベクトル

と、補正部140から取得した補正用ベクトル

とを用い、各単語が生成される確率を示した確率分布

を以下の式(3)で計算する。
Specifically, the output unit 160 outputs the second fixed-length vector that is the output of the RNN acquired from the generation unit 120.

And the correction vector acquired from the correction unit 140

Probability distribution showing the probability that each word will be generated using and

Is calculated by the following equation (3).

ここで、

は、RNNの出力した第2の固定長ベクトル

から、RNNのパラメタである行列

とベクトル

によって変換した、各次元が学習データに出現する単語に対応するベクトル、

は、ベクトルの次元同士の積を計算する演算子、softmax(・)は、与えられたベクトルの各次元の値を0から1までの値に変換するソフトマックス関数である。
here,

Is the second fixed-length vector output by RNN

From, the matrix that is the parameter of RNN

And vector

A vector corresponding to the word in which each dimension appears in the training data, converted by

Is an operator that calculates the product of the dimensions of a vector, and softmax(·) is a softmax function that converts the value of each dimension of a given vector into a value from 0 to 1.

また、

は、M×Nの次元数である行列、

は、M次元のベクトルである。
Also,

Is a matrix of M×N dimensions,

Is an M-dimensional vector.

すなわち、本実施形態では、RNNの出力である第2の固定長ベクトル

と、補正部140で生成した補正用ベクトル

とに基づいて、各単語の出現確率を表すベクトル

を計算する。
That is, in this embodiment, the second fixed-length vector that is the output of the RNN is

And the correction vector generated by the correction unit 140

A vector representing the probability of each word occurrence, based on and

To calculate.

そして、出力部160は、各単語の出現確率を表すベクトル

に基づいて、最も確率の高い次元に対応する単語をt+1番目の出力単語として得る(図3)。
Then, the output unit 160 outputs a vector representing the appearance probability of each word.

, The word corresponding to the dimension with the highest probability is obtained as the (t+1)th output word (FIG. 3).

そして、出力部160は、出力単語が文末を表す記号(終了記号)でなければ、出力単語を次の単語として、入力変換部110に渡す。 Then, the output unit 160 passes the output word to the input conversion unit 110 as the next word unless the output word is a symbol (end symbol) indicating the end of a sentence.

一方、出力部160は、出力単語が終了記号であれば、出力部160が順次出力した単語を用いて、文を生成する。 On the other hand, if the output word is the end symbol, the output unit 160 uses the words sequentially output by the output unit 160 to generate a sentence.

具体的には、出力部160は、最初の入力単語とこれまでに出力部160が出力した単語列(w1とw[2:t+1])を用いて、システム発話文Yを生成する。 Specifically, the output unit 160 uses the first input word and the word string (w1 and w[2:t+1]) output by the output unit 160 so far to generate the system utterance sentence Y.

図4に、Yesを文の最初の単語として入力した場合の、生成された出力文の例を示す。 FIG. 4 shows an example of the generated output sentence when Yes is input as the first word of the sentence.

なお、出力部160では、毎回の出力において、確率の最も高い単語を選び、文を生成するだけでなく、確率の高い単語をいくつか最終出力の候補として出力することも可能である。 In addition, in the output unit 160, it is possible not only to select the word with the highest probability in each output and generate a sentence, but also to output some words with high probability as candidates for final output.

この場合、候補単語の数を予め定めておくか、確率の高さに閾値を設ける等して、最終出力となる候補単語を複数生成し、複数の文を生成するようにしてもよい。また、出力部160は、生成された複数の文から、確率の高い複数の文を最終出力として出力するようにしてもよい。 In this case, the number of candidate words may be determined in advance, or a threshold may be set for the high probability to generate a plurality of candidate words to be the final output and generate a plurality of sentences. The output unit 160 may output a plurality of highly probable sentences as final outputs from the generated plurality of sentences.

また、対話システムにおいては、前の対話と矛盾しないかを選択するルールや分類器を別途用意し、生成された複数の文から1文を選択するようにしてもよい。 Further, in the dialogue system, a rule or a classifier for selecting whether or not it is consistent with the previous dialogue may be separately prepared, and one sentence may be selected from a plurality of generated sentences.

そして、出力部160は、生成した文を出力部160に渡す。 Then, the output unit 160 passes the generated sentence to the output unit 160.

出力部160は、出力部160が生成した文を出力する。 The output unit 160 outputs the sentence generated by the output unit 160.

<本発明の実施の形態に係る文生成装置の作用>
図5は、本発明の実施の形態に係る文生成処理ルーチンを示すフローチャートである。
<Operation of the sentence generation device according to the embodiment of the present invention>
FIG. 5 is a flowchart showing a sentence generation processing routine according to the embodiment of the present invention.

入力部100にユーザ発話文Xへの応答であるシステム発話文Yとして生成する文の最初の単語が入力されると、文生成装置10において、図5に示す文生成処理ルーチンが実行される。 When the first word of the sentence generated as the system utterance sentence Y, which is a response to the user utterance sentence X, is input to the input unit 100, the sentence generation device 10 executes the sentence generation processing routine shown in FIG.

まず、ステップS100において、入力変換部110は、入力された最初の単語、又は後述するステップS140で選択された単語を、単語を表す第1の固定長ベクトルに変換する。 First, in step S100, the input conversion unit 110 converts the input first word or the word selected in step S140 described below into a first fixed-length vector representing the word.

次に、ステップS110において、生成部120は、上記ステップS100で単語を変換した第1の固定長ベクトルと、当該単語までの単語の系列を表す第2の固定長ベクトル、又はユーザ発話文Xを表す第2の固定長ベクトルとから、次の単語を予測するための予め学習されたニューラルネットワークを用いて、当該単語までの単語の系列を表す第2の固定長ベクトルを生成する。 Next, in step S110, the generation unit 120 outputs the first fixed-length vector obtained by converting the word in step S100, the second fixed-length vector representing a series of words up to the word, or the user utterance sentence X. A second fixed-length vector representing a series of words up to the word is generated using a pre-learned neural network for predicting the next word from the second fixed-length vector represented.

ステップS120において、補正部140は、上記ステップS100で得られた第1の固定長ベクトルから、第2の固定長ベクトルを補正するための予め学習されたニューラルネットワークを用いて、第2の固定長ベクトルを補正するための補正用ベクトルを生成する。 In step S120, the correction unit 140 uses the pre-learned neural network for correcting the second fixed-length vector from the first fixed-length vector obtained in step S100 to obtain the second fixed-length vector. A correction vector for correcting the vector is generated.

ステップS130において、出力部160は、上記ステップS110で得られた第2の固定長ベクトルと、上記ステップS120で得られた補正用ベクトルとに基づいて、第2の固定長ベクトルを補正した上で、各単語の出現確率を表すベクトルを計算する。 In step S130, the output unit 160 corrects the second fixed-length vector based on the second fixed-length vector obtained in step S110 and the correction vector obtained in step S120. , Calculate a vector that represents the appearance probability of each word.

ステップS140において、出力部160は、各単語の出現確率を表すベクトルに応じて選択される単語を、次の単語として出力する。 In step S140, the output unit 160 outputs the word selected according to the vector indicating the appearance probability of each word as the next word.

ステップS150において、出力部160は、上記ステップS140で選択された単語が、終了記号か否かを判断する。 In step S150, the output unit 160 determines whether the word selected in step S140 is the end symbol.

選択された単語が終了記号でない場合(ステップS150のNO)、上記ステップS100に戻り、選択された単語を入力変換部110に入力して、入力変換部110による変換、生成部120による生成、補正部140による生成、及び出力部160による出力(ステップS100〜ステップS140)を繰り返す。 When the selected word is not the end symbol (NO in step S150), the process returns to step S100, the selected word is input to the input conversion unit 110, converted by the input conversion unit 110, generated by the generation unit 120, and corrected. The generation by the unit 140 and the output by the output unit 160 (steps S100 to S140) are repeated.

一方、選択された単語が終了記号である場合(ステップS150のYES)、ステップS160において、出力部160は、上記ステップS140で選択された各単語を用いて文を生成し、出力部160が、当該生成された文を出力して、文生成処理ルーチンを終了する。 On the other hand, when the selected word is the end symbol (YES in step S150), in step S160, the output unit 160 generates a sentence using each word selected in step S140, and the output unit 160 outputs the sentence. The generated sentence is output, and the sentence generation processing routine ends.

以上説明したように、本実施形態に係る文生成装置によれば、第2の固定長ベクトルを補正するための補正用ベクトルを生成し、第2の固定長ベクトルと、補正用ベクトルとに基づいて、各単語の出現確率を表すベクトルを計算し、各単語の出現確率を表すベクトルに応じて選択される単語を、次の単語として出力することにより、文法的誤りが少なく、かつ、可読性の高い文を生成することができる。 As described above, according to the sentence generation device of the present embodiment, a correction vector for correcting the second fixed length vector is generated, and based on the second fixed length vector and the correction vector. Then, by calculating a vector representing the appearance probability of each word and outputting the word selected according to the vector representing the appearance probability of each word as the next word, there are few grammatical errors and the readability is improved. Can generate high sentences.

<本発明の実施の形態に係る文生成学習装置の概要>
次に、本発明の実施の形態に係る文生成装置の概要について説明する。
<Outline of sentence generation learning device according to embodiment of the present invention>
Next, an outline of the sentence generation device according to the embodiment of the present invention will be described.

RNNと補正部内のパラメタは、タスクに応じた学習データを用いて決定される。 The parameters in the RNN and the correction unit are determined using learning data according to the task.

例えば、対話システムにおいては、英語のみや日本語のみのような、単一の言語で生成された対話履歴を学習データとして用いる。なお、新聞などの文書データを学習データとして用いてもよい。RNNと補正部内のパラメタ学習には同一のデータを用いる。 For example, in a dialogue system, dialogue history generated in a single language such as only English or Japanese is used as learning data. Note that document data such as newspapers may be used as learning data. The same data is used for parameter learning in the RNN and the correction unit.

学習後、パラメタは固定される。このパラメタが文生成の精度を決定する。 After learning, the parameters are fixed. This parameter determines the accuracy of sentence generation.

RNNと補正部内のパラメタは同時に学習することも、一方のみを学習することも可能である。例えば、一方を学習済みの値で固定し、もう一方をさらに学習することも可能である。 The RNN and the parameter in the correction unit can be learned at the same time, or only one of them can be learned. For example, it is possible to fix one with a learned value and learn the other further.

パラメタは、学習データ中の文を生成できるように学習する。 The parameter is learned so that the sentence in the learning data can be generated.

<本発明の実施の形態に係る文生成学習装置の構成>
次に、本発明の実施の形態に係る文生成装置の構成について説明する。図6は、本発明の実施の形態に係る文生成学習装置の構成を示す概略図である。
<Configuration of sentence generation learning device according to embodiment of the present invention>
Next, the configuration of the sentence generation device according to the embodiment of the present invention will be described. FIG. 6 is a schematic diagram showing the configuration of the sentence generation/learning apparatus according to the embodiment of the present invention.

文生成学習装置20は、入力された学習データ30から、ニューラルネットワークにより出力される各単語の出現確率を表すベクトルにおいて、次の単語に対応する正解文の単語の確率が高くなるように、次の単語を予測するためのニューラルネットワークであるRNN、及び第2の固定長ベクトルを補正するためのニューラルネットワークを学習する。 From the input learning data 30, the sentence generation/learning apparatus 20 calculates the probability that the word of the correct sentence corresponding to the next word in the vector representing the appearance probability of each word output by the neural network becomes higher. RNN, which is a neural network for predicting the word, and a neural network for correcting the second fixed-length vector are learned.

文生成学習装置20は、CPUと、RAMと、後述する文生成学習処理ルーチンを実行するためのプログラムを記憶したROMとを備えたコンピュータで構成され、機能的には次に示すように構成されている。 The sentence generation/learning apparatus 20 is configured by a computer including a CPU, a RAM, and a ROM that stores a program for executing a sentence generation/learning processing routine described later, and is functionally configured as shown below. ing.

図6に示すように、文生成学習装置20は、入力部200と、学習データ変換部210と、生成部220と、RNNパラメタ記憶部230と、補正部240と、補正パラメタ記憶部250と、出力部260と、学習部270とを含んで構成される。 As shown in FIG. 6, the sentence generation/learning apparatus 20 includes an input unit 200, a learning data conversion unit 210, a generation unit 220, an RNN parameter storage unit 230, a correction unit 240, and a correction parameter storage unit 250. The output unit 260 and the learning unit 270 are included.

文生成学習装置20は、学習データ変換部210、生成部220、補正部240、出力部260、及び学習部270による各処理を繰り返すことにより、次の単語を予測するためのニューラルネットワークであるRNN、及び第2の固定長ベクトルを補正するためのニューラルネットワークを学習する。 The sentence generation/learning apparatus 20 is an RNN that is a neural network for predicting the next word by repeating the processes of the learning data conversion unit 210, the generation unit 220, the correction unit 240, the output unit 260, and the learning unit 270. , And a neural network for correcting the second fixed-length vector.

入力部200は、既知のキーボード、記憶装置などの入力器により実現される。また、入力部200は、インターネット等のネットワークを介して観測データを入力するネットワークインターフェースでも良い。 The input unit 200 is realized by an input device such as a known keyboard and storage device. The input unit 200 may be a network interface that inputs observation data via a network such as the Internet.

入力部200は、学習データ30の入力を受け付ける。 The input unit 200 receives the input of the learning data 30.

ここで、学習データ30は、ユーザ発話文と、当該ユーザ発話文に対するシステム発話文(正解文)の対を、少なくとも1組以上含んで構成される。ただし、前記学習データは、実際にユーザまたはシステムが発話したものである必要はなく、2人のユーザ間(またはシステム間)の対話における1人の発話をユーザ発話文とし、もう1人の発話をシステム発話文として用いてもよい。 Here, the learning data 30 is configured to include at least one pair of a user utterance sentence and a system utterance sentence (correct answer sentence) for the user utterance sentence. However, the learning data does not need to be actually uttered by the user or the system, and one utterance in a dialogue between two users (or between systems) is used as a user utterance sentence and another utterance is uttered. May be used as the system utterance sentence.

学習データ変換部210は、学習データとして予め用意された各文の単語を、単語を表す第1の固定長ベクトルに変換する。 The learning data conversion unit 210 converts a word of each sentence prepared in advance as learning data into a first fixed length vector representing the word.

具体的には、学習データ変換部210は、まず、学習データのユーザ発話文の最初の単語を入力として、最初の単語を第1の固定長ベクトルに変換する。 Specifically, the learning data conversion unit 210 first receives the first word of the user utterance sentence of the learning data and converts the first word into a first fixed-length vector.

また、学習データ変換部210は、学習部270から現在の単語の処理が終了した旨の通知を受けると、正解文の次の単語を入力として、文生成装置10における入力変換部110と同様に、次の単語を第1の固定長ベクトルに変換する。 When the learning data conversion unit 210 receives a notification from the learning unit 270 that the processing of the current word is completed, the learning data conversion unit 210 takes the next word of the correct sentence as an input, similarly to the input conversion unit 110 in the sentence generation device 10. , The next word is converted to a first fixed length vector.

そして、学習データ変換部210は、変換した第1の固定長ベクトル

を、生成部220及び補正部240へ渡す。
Then, the learning data converter 210 converts the converted first fixed-length vector

To the generation unit 220 and the correction unit 240.

また、学習データ変換部210は、学習データのシステム発話文の各単語を入力として、同様に、第1の固定長ベクトルに変換する。 Further, the learning data conversion unit 210 similarly inputs each word of the system utterance sentence of the learning data into a first fixed length vector.

生成部220は、学習データ変換部210により単語を変換した第1の固定長ベクトルと、当該単語までの単語の系列を表す第2の固定長ベクトルとから、次の単語を予測するためのニューラルネットワークであるRNNを用いて、当該単語の次の単語までの単語の系列を表す第2の固定長ベクトルを生成する。 The generation unit 220 uses a learning data conversion unit 210 to convert a word into a first fixed-length vector and a second fixed-length vector representing a series of words up to the word, and a neural network for predicting the next word. Using the network RNN, a second fixed-length vector representing a series of words up to the next word of the word is generated.

具体的には、まず、生成部220は、文生成装置10における生成部120と同様に、当該単語までの単語の系列を表す第2の固定長ベクトル

を入力とする。
Specifically, first, the generation unit 220, like the generation unit 120 in the sentence generation device 10, outputs a second fixed-length vector representing a series of words up to the word.

Is input.

また、生成部220は、最初の単語を入力された際には、文生成学習装置20が予め保持している

を入力とする。
Further, the generation unit 220 is held in the sentence generation/learning apparatus 20 in advance when the first word is input.

Is input.

次に、生成部220は、RNNパラメタ記憶部230から次の単語を予測するためのRNNのパラメタ



、及び

を取得し、学習データ変換部210が変換した第1の固定長ベクトル

、及び第2の固定長ベクトル

を入力として、RNNの計算を行う。RNNにより、最初の単語から、次の単語(t番目の単語)までの単語列(系列)全体を表す第2の固定長ベクトル

を上述の式(1)を用いて計算して得る。
Next, the generation unit 220 uses the RNN parameter for predicting the next word from the RNN parameter storage unit 230.

,

,as well as

And the first fixed-length vector converted by the learning data conversion unit 210

, And the second fixed-length vector

Is input and the RNN is calculated. A second fixed-length vector representing the entire word string (series) from the first word to the next word (t-th word) by RNN

Is calculated using Equation (1) above.

そして、生成部220は、生成した第2の固定長ベクトル

を出力部260に渡す。
The generation unit 220 then generates the generated second fixed-length vector.

To the output unit 260.

RNNパラメタ記憶部230は、次の単語を予測するためのRNNのパラメタ

と、

と、

とを記憶している。
The RNN parameter storage unit 230 is a parameter of the RNN for predicting the next word.

When,

When,

I remember and.

補正部240は、学習データ変換部により得られた第1の固定長ベクトルから、第2の固定長ベクトルを補正するためのニューラルネットワークを用いて、第2の固定長ベクトルを補正するための補正用ベクトルを生成する。 The correction unit 240 uses the neural network for correcting the second fixed-length vector from the first fixed-length vector obtained by the learning data conversion unit and uses the neural network for correction to correct the second fixed-length vector. Generate a vector for use.

具体的には、補正部240は、まず、補正パラメタ記憶部250から第1の固定長ベクトル

を補正するためのニューラルネットワークのパラメタ


及び

を取得する。
Specifically, the correction unit 240 first reads the first fixed-length vector from the correction parameter storage unit 250.

Parameters of neural network to correct

,
as well as

To get

次に、補正部240は、文生成装置10における補正部140と同様に、学習データ変換部210で得た第1の固定長ベクトル

を入力とし、RNNの出力である第2の固定長ベクトルを補正する補正用ベクトルを上述の式(2)により計算する。
Next, the correction unit 240, like the correction unit 140 in the sentence generation device 10, receives the first fixed-length vector obtained by the learning data conversion unit 210.

Is input, and a correction vector for correcting the second fixed-length vector that is the output of the RNN is calculated by the above-mentioned formula (2).

そして、補正部240は、生成した補正用ベクトル

を出力部260に渡す。
Then, the correction unit 240 uses the generated correction vector.

To the output unit 260.

補正パラメタ記憶部250は、第2の固定長ベクトルを補正するためのニューラルネットワークのパラメタ

と、

とを記憶している。
The correction parameter storage unit 250 is a neural network parameter for correcting the second fixed-length vector.

When,

I remember and.

出力部260は、第2の固定長ベクトルと、補正用ベクトルとに基づいて、第2の固定長ベクトルを補正した上で、各単語の出現確率を表すベクトルを計算し、各単語の出現確率を表すベクトルに応じて選択される単語を、次の単語として出力する。 The output unit 260 corrects the second fixed-length vector based on the second fixed-length vector and the correction vector, and then calculates a vector representing the appearance probability of each word to calculate the appearance probability of each word. The word selected according to the vector representing is output as the next word.

具体的には、出力部260は、文生成装置10における出力部160と同様に、生成部220から取得したRNNの出力である第2の固定長ベクトル

と、補正部240で生成した補正用ベクトル

とに基づいて、各単語の出現確率を表すベクトル

を、上述の式(3)により計算する。
Specifically, the output unit 260, like the output unit 160 in the sentence generation device 10, is the second fixed-length vector that is the output of the RNN acquired from the generation unit 220.

And the correction vector generated by the correction unit 240

A vector representing the probability of each word occurrence, based on and

Is calculated by the above equation (3).

そして、出力部160は、各単語の出現確率を表すベクトル

を学習部270に渡す。
Then, the output unit 160 outputs a vector representing the appearance probability of each word.

To the learning unit 270.

学習部270は、現在の単語がユーザ発話文に含まれるものであった場合、学習データ変換部210に、現在の単語の処理が終了した旨を通知する。現在の単語が、正解文であるシステム発話文に含まれるものであった場合、出力部160により計算された各単語の出現確率を表すベクトルにおいて、次の単語に対応する正解文の単語の確率が高くなるように、次の単語を予測するためのニューラルネットワークであるRNN、及び第2の固定長ベクトルを補正するためのニューラルネットワークを学習する。 When the current word is included in the user's utterance, the learning unit 270 notifies the learning data conversion unit 210 that the processing of the current word is completed. When the current word is included in the system utterance sentence that is the correct sentence, in the vector representing the appearance probability of each word calculated by the output unit 160, the probability of the word of the correct sentence corresponding to the next word RNN, which is a neural network for predicting the next word, and a neural network for correcting the second fixed-length vector, are learned so that

具体的には、学習部270は、各単語の出現確率を表すベクトル

について、学習データの正解文中で次に出現している単語の確率が高くなるよう、誤差逆伝播を用いて、RNN、及び第1の固定長ベクトル

を補正するためのニューラルネットワークを学習する。
Specifically, the learning unit 270 uses a vector representing the appearance probability of each word.

About the RNN and the first fixed-length vector using error backpropagation so that the probability of the word that appears next in the correct sentence of the learning data is high.

Learn a neural network to correct.

そして、学習部270は、RNNパラメタ記憶部230に記憶されている、次の単語を予測するためのRNNのパラメタ

と、

と、

と、

と、

と、補正パラメタ記憶部250に記憶されている、第1の固定長ベクトル

を補正するためのニューラルネットワークのパラメタ

と、

とを更新する。
Then, the learning unit 270 stores the RNN parameter for predicting the next word stored in the RNN parameter storage unit 230.

When,

When,

When,

When,

And the first fixed-length vector stored in the correction parameter storage unit 250.

Parameters of neural network to correct

When,

And update.

そして、学習部270は、学習データ変換部210に、現在の単語の処理が終了した旨を通知する。 Then, the learning unit 270 notifies the learning data conversion unit 210 that the processing of the current word is completed.

学習データ変換部210は、次の単語である2単語目を入力とする。また、上述したように、学習データ変換部210による変換、生成部220による生成、補正部240による生成、出力部260による出力、及び学習部270による学習を繰り返すことにより、正解文であるシステム発話文の各単語について、当該単語の出力確率が高くなるように、次の単語を予測するためのニューラルネットワークであるRNN、及び第1の固定長ベクトルを補正するためのニューラルネットワークを学習し、各パラメタを更新する。 The learning data conversion unit 210 receives the second word, which is the next word, as an input. Further, as described above, by repeating the conversion by the learning data conversion unit 210, the generation by the generation unit 220, the generation by the correction unit 240, the output by the output unit 260, and the learning by the learning unit 270, the system utterance that is a correct sentence is uttered. For each word of the sentence, RNN, which is a neural network for predicting the next word, and a neural network for correcting the first fixed-length vector are learned so that the output probability of the word is high, and Update the parameters.

また、学習データの、ユーザ発話文とシステム発話文とからなる1組を用いた学習が終わった時点で、第2の固定長ベクトル

をゼロベクトルにリセットし、次のユーザ発話文とシステム発話文とからなる1組を用いた学習を行う。
In addition, at the time when learning using a set of the user utterance sentence and the system utterance sentence of the learning data is completed, the second fixed-length vector

Is reset to a zero vector, and learning is performed using a set of the next user utterance sentence and system utterance sentence.

また、学習データ30中の最後のユーザ発話文とシステム発話文とからなる1組を用いた学習が終了した場合、最初の1組に戻り、再び学習を行う。そして、学習データ30中の各組の生成確率が十分高くなるまで、この手続きを繰り返し、次の単語を予測するためのニューラルネットワークであるRNN、及び第1の固定長ベクトルを補正するためのニューラルネットワークのパラメタを更新する。 Further, when the learning using the last set of the user utterance sentence and the system utterance sentence in the learning data 30 is completed, the process returns to the first one set and the learning is performed again. Then, this procedure is repeated until the generation probability of each set in the learning data 30 is sufficiently high, and the neural network for correcting the first fixed-length vector and the RNN, which is a neural network for predicting the next word. Update network parameters.

<本発明の実施の形態に係る文生成学習装置の作用>
図7は、本発明の実施の形態に係る文生成学習処理ルーチンを示すフローチャートである。
<Operation of sentence generation learning device according to embodiment of the present invention>
FIG. 7 is a flowchart showing a sentence generation learning processing routine according to the embodiment of the present invention.

入力部200に学習データが入力されると、文生成学習装置20において、図7に示す文生成学習処理ルーチンが実行される。 When the learning data is input to the input unit 200, the sentence generation/learning apparatus 20 executes the sentence generation/learning processing routine shown in FIG. 7.

まず、ステップS170において、学習データ変換部210は、学習データのユーザ発話文の単語を、単語を表す第1の固定長ベクトルに変換する。 First, in step S170, the learning data conversion unit 210 converts a word of the user utterance sentence of the learning data into a first fixed-length vector representing the word.

次に、ステップS180において、生成部220は、上記ステップS170で単語を変換した第1の固定長ベクトルと、初期化された第2の固定長ベクトル、又はユーザ発話文の当該単語までの単語の系列を表す第2の固定長ベクトルとから、次の単語を予測するためのニューラルネットワークであるRNNを用いて、当該単語の次の単語までの単語の系列を表す第2の固定長ベクトルを生成する。 Next, in step S180, the generation unit 220 generates the first fixed-length vector obtained by converting the word in step S170 and the initialized second fixed-length vector, or the words up to the word of the user utterance sentence. A second fixed-length vector representing a sequence of words up to the next word is generated from the second fixed-length vector representing the sequence by using RNN, which is a neural network for predicting the next word. To do.

ステップS190において、ユーザ発話文の全ての単語について上記ステップS170〜ステップS180の処理を行ったか否かを判定し、上記ステップS170〜ステップS180の処理を行っていない単語が存在する場合(ステップS190のNO)には、上記ステップS170へ戻り、当該単語について第1の固定長ベクトルに変換する。 In step S190, it is determined whether or not the processing in steps S170 to S180 has been performed for all the words in the user's utterance, and there is a word for which the processing in steps S170 to S180 has not been performed (step S190: If NO, the process returns to step S170, and the word is converted into the first fixed-length vector.

一方、ユーザ発話文の全ての単語について上記ステップS170〜ステップS180の処理を行った場合(ステップS190のYES)には、ステップS200へ移行する。 On the other hand, when the processes of steps S170 to S180 are performed for all the words in the user's utterance (YES in step S190), the process proceeds to step S200.

ステップS200において、学習データ変換部210は、学習データとして予め用意された正解文の単語を、単語を表す第1の固定長ベクトルに変換する。 In step S200, the learning data conversion unit 210 converts a word of the correct sentence prepared in advance as learning data into a first fixed-length vector representing the word.

ステップS210において、生成部220は、上記ステップS200で単語を変換した第1の固定長ベクトルと、学習データに含まれる当該正解文と組とされた第2の固定長ベクトル、又は正解文の当該単語までの単語の系列を表す第2の固定長ベクトルとから、次の単語を予測するためのニューラルネットワークであるRNNを用いて、当該単語の次の単語までの単語の系列を表す第2の固定長ベクトルを生成する。 In step S210, the generation unit 220 causes the first fixed-length vector obtained by converting the word in step S200 and the second fixed-length vector paired with the correct answer sentence included in the learning data, or the correct answer sentence of the correct answer sentence. A second fixed-length vector representing a series of words up to a word and a second series representing a series of words up to the next word of the word are used by using RNN which is a neural network for predicting the next word. Generate a fixed length vector.

ステップS220において、補正部240は、上記ステップS200で得られた第1の固定長ベクトルから、第2の固定長ベクトルを補正するためのニューラルネットワークを用いて、第2の固定長ベクトルを補正するための補正用ベクトルを生成する。 In step S220, the correction unit 240 corrects the second fixed-length vector from the first fixed-length vector obtained in step S200 using a neural network for correcting the second fixed-length vector. A correction vector for is generated.

ステップS230において、出力部260は、上記ステップS210で得られた第2の固定長ベクトルと、上記ステップS220で得られた補正用ベクトルとに基づいて、第2の固定長ベクトルを補正した上で、各単語の出現確率を表すベクトルを計算する。 In step S230, the output unit 260 corrects the second fixed-length vector based on the second fixed-length vector obtained in step S210 and the correction vector obtained in step S220. , Calculate a vector that represents the appearance probability of each word.

ステップS240において、学習部270は、上記ステップS230で計算された各単語の出現確率を表すベクトルにおいて、次の単語に対応する正解文の単語の確率が高くなるように、次の単語を予測するためのニューラルネットワークであるRNN、及び第2の固定長ベクトルを補正するためのニューラルネットワークを学習する。 In step S240, the learning unit 270 predicts the next word so that the probability of the correct word corresponding to the next word in the vector representing the appearance probability of each word calculated in step S230 is high. A neural network for correcting the second fixed-length vector is learned.

ステップS250において、正解文の全ての単語について上記ステップS200〜ステップS240の処理を行ったか否かを判定し、上記ステップS200〜ステップS240の処理を行っていない単語が存在する場合(ステップS250のNO)には、上記ステップS200へ戻り、当該単語について第1の固定長ベクトルに変換する。 In step S250, it is determined whether or not the steps S200 to S240 have been performed on all the words in the correct sentence, and if there is a word that has not been subjected to the steps S200 to S240 (NO in step S250). ), the process returns to step S200, and the word is converted into the first fixed-length vector.

一方、正解文の全ての単語について上記ステップS200〜ステップS240の処理を行った場合(ステップS250のYES)には、ステップS260へ移行する。 On the other hand, when the process of steps S200 to S240 is performed for all the words in the correct sentence (YES in step S250), the process proceeds to step S260.

ステップS260では、全ての学習データについて、上記ステップS170〜ステップS250の処理を行ったか否かを判定し、上記ステップS200〜ステップS250の処理を行っていない学習データが存在する場合(ステップS260のNO)には、上記ステップS170へ戻り、当該学習データのユーザ発話文の最初の単語について第1の固定長ベクトルに変換する。 In step S260, it is determined whether or not the processes of steps S170 to S250 have been performed for all learning data, and if there is learning data that has not been subjected to the processes of steps S200 to S250 (NO in step S260). ), the process returns to step S170, and the first word of the user utterance sentence of the learning data is converted into the first fixed-length vector.

一方、全ての学習データについて上記ステップS170〜ステップS250の処理を行った場合(ステップS260のYES)には、ステップS270へ移行する。 On the other hand, when the processes of steps S170 to S250 have been performed on all learning data (YES in step S260), the process proceeds to step S270.

ステップS270において、学習部270は、学習が収束したか否かを判定する。具体的には、学習データ30中の各正解文の生成確率が十分高くなったか否かを判断し、学習データ30中の各正解文の生成確率が十分高くなったと判断された場合には、学習が収束したと判定し、学習データ30中の各正解文の生成確率が十分高くなっていないと判断された場合には、学習が収束していないと判定する。 In step S270, the learning unit 270 determines whether learning has converged. Specifically, it is determined whether or not the generation probability of each correct answer sentence in the learning data 30 is sufficiently high, and when it is determined that the generation probability of each correct answer sentence in the learning data 30 is sufficiently high, When it is determined that the learning has converged, and it is determined that the generation probability of each correct sentence in the learning data 30 is not sufficiently high, it is determined that the learning has not converged.

学習が収束していない場合(ステップS270のNO)、上記ステップS170へ戻り、最初の学習データのユーザ発話文の最初の単語について第1の固定長ベクトルに変換する。 If the learning has not converged (NO in step S270), the process returns to step S170, and the first word of the user utterance sentence of the first learning data is converted into the first fixed-length vector.

一方、学習が収束していた場合(ステップS270のYES)、文生成学習処理ルーチンを終了する。 On the other hand, if the learning has converged (YES in step S270), the sentence generation learning processing routine ends.

以上説明したように、本実施形態に係る文生成学習装置によれば、第2の固定長ベクトルを補正するためのニューラルネットワークを用いて、第2の固定長ベクトルを補正するための補正用ベクトルを生成し、第2の固定長ベクトルと、補正用ベクトルとに基づいて、各単語の出現確率を表すベクトルを計算し、各単語の出現確率を表すベクトルに応じて選択される単語を、次の単語として出力し、次の単語に対応する前記正解文の単語の確率が高くなるように、第2の固定長ベクトルを補正するためのニューラルネットワークを学習することにより、文法的誤りが少なく、かつ、可読性の高い文を生成するための文生成装置を学習することができる。 As described above, according to the sentence generation/learning apparatus of the present embodiment, the correction vector for correcting the second fixed-length vector is corrected by using the neural network for correcting the second fixed-length vector. Is generated, a vector representing the appearance probability of each word is calculated based on the second fixed-length vector and the correction vector, and the word selected according to the vector representing the appearance probability of each word is By outputting the word as a word, and learning the neural network for correcting the second fixed-length vector so that the probability of the word of the correct sentence corresponding to the next word is high, there are few grammatical errors, Moreover, it is possible to learn a sentence generation device for generating a highly readable sentence.

なお、本発明は、上述した実施の形態に限定されるものではなく、この発明の要旨を逸脱しない範囲内で様々な変形や応用が可能である。 The present invention is not limited to the above-described embodiments, and various modifications and applications are possible without departing from the scope of the present invention.

本実施形態では、対話システムにおける例を用いて説明したが、翻訳や要約など、計算機による文生成が必要な、あらゆる場面に適用することが可能である。この場合には、翻訳したい文や要約したい文書を表す第2の固定長ベクトルと、最初の単語とを入力とすればよい。また、入力される第2の固定長ベクトルが、ゼロベクトル(各次元の値がゼロのベクトル)であってもよい。 Although the present embodiment has been described using the example of the dialogue system, the present invention can be applied to all situations in which sentence generation by a computer is required, such as translation and abstract. In this case, a second fixed-length vector representing a sentence to be translated or a document to be summarized and the first word may be input. The second fixed-length vector that is input may be a zero vector (a vector whose value in each dimension is zero).

また、本実施形態では、文生成学習装置はRNNと補正部内のパラメタを同時に学習する場合について説明したが、一方のみを学習することも可能である。例えば、一方を学習済みのパラメタで固定し、もう一方をさらに学習することも可能である。 Further, in the present embodiment, the sentence generation learning device has described the case of learning the RNN and the parameter in the correction unit at the same time, but it is also possible to learn only one of them. For example, it is possible to fix one with a learned parameter and learn the other further.

また、本願明細書中において、プログラムが予めインストールされている実施形態として説明したが、当該プログラムを、コンピュータ読み取り可能な記録媒体に格納して提供することも可能である。 Further, in the specification of the present application, the embodiment in which the program is pre-installed has been described, but the program can be stored in a computer-readable recording medium and provided.

10 文生成装置
20 文生成学習装置
30 学習データ
100 入力部
110 入力変換部
120 生成部
130 パラメタ記憶部
140 補正部
150 補正パラメタ記憶部
160 出力部
200 入力部
210 学習データ変換部
220 生成部
230 パラメタ記憶部
240 補正部
250 補正パラメタ記憶部
260 出力部
270 学習部
10 sentence generation device 20 sentence generation learning device 30 learning data 100 input unit 110 input conversion unit 120 generation unit 130 parameter storage unit 140 correction unit 150 correction parameter storage unit 160 output unit 200 input unit 210 learning data conversion unit 220 generation unit 230 parameter Storage unit 240 Correction unit 250 Correction parameter storage unit 260 Output unit 270 Learning unit

Claims (5)

入力された単語を第1の固定長ベクトルに変換する入力変換部と、
前記入力変換部で得た前記第1の固定長ベクトルと、過去に生成された第2の固定長ベクトルとから、次の単語を予測するための予め学習されたニューラルネットワークを用いて、第2の固定長ベクトルを生成する生成部と、
前記入力変換部で得た前記第1の固定長ベクトルから、前記生成部で生成した前記第2の固定長ベクトルを補正するための予め学習されたニューラルネットワークを用いて、前記第2の固定長ベクトルを補正するための補正用ベクトルを生成する補正部と、
前記生成部で生成した第2の固定長ベクトルと、前記補正部で得た前記補正用ベクトルとから、各単語の出現確率を表すベクトルを計算し、各単語の出現確率を表すベクトルに応じて選択される単語を、次の単語として出力する出力部と
を含み、
前記出力部が出力した単語を前記入力変換部の入力として、前記入力変換部、前記生成部、前記補正部、及び前記出力部での各処理を繰り返すことにより生成した単語を並べた単語列を候補文として生成するものであり、
前記生成部は、前記入力変換部で得た第1の固定長ベクトルと、過去に生成された第2の固定長ベクトルである、前記単語列中の当該第1の固定長ベクトルに対応する単語の直前の単語までの単語列に対応する第2の固定長ベクトルとから、前記単語列中の当該第1の固定長ベクトルに対応する単語までの単語列に対応する第2の固定長ベクトルを生成する
文生成装置。
An input conversion unit for converting the input word into a first fixed-length vector,
The second fixed length vector obtained by the input conversion unit and the second fixed length vector generated in the past are used to generate a second word using a pre-learned neural network for predicting the next word. A generator for generating a fixed-length vector of
From the first fixed-length vector obtained by the input converter, a second learned fixed-length vector is generated by using a pre-learned neural network for correcting the second fixed-length vector generated by the generator. A correction unit that generates a correction vector for correcting the vector,
A vector representing the appearance probability of each word is calculated from the second fixed-length vector generated by the generation unit and the correction vector obtained by the correction unit, and according to the vector representing the appearance probability of each word. An output unit that outputs the selected word as the next word,
A word string in which the words output by the output unit are input to the input conversion unit and the words generated by repeating the processes of the input conversion unit, the generation unit, the correction unit, and the output unit are arranged. Is generated as a candidate sentence,
The generation unit is a first fixed-length vector obtained by the input conversion unit and a second fixed-length vector generated in the past, which is a word corresponding to the first fixed-length vector in the word string. From the second fixed-length vector corresponding to the word string up to the word immediately before the second fixed-length vector corresponding to the word string up to the word corresponding to the first fixed-length vector in the word string, Sentence generator to generate.
学習データとして予め用意された正解文の単語を第1の固定長ベクトルに変換する学習データ変換部と、
前記学習データ変換部で得た前記第1の固定長ベクトルと、過去に生成された第2の固定長ベクトルとから、次の単語を予測するためのニューラルネットワークを用いて、第2の固定長ベクトルを生成する生成部と、
前記学習データ変換部で得た前記第1の固定長ベクトルから、前記生成部で生成した前記第2の固定長ベクトルを補正するためのニューラルネットワークを用いて、前記第2の固定長ベクトルを補正するための補正用ベクトルを生成する補正部と、
前記生成部で生成した第2の固定長ベクトルと、前記補正部で得た前記補正用ベクトルとから、各単語の出現確率を表すベクトルを計算し、各単語の出現確率を表すベクトルに応じて選択される単語を、次の単語として出力する出力部と、
前記出力部で得た単語が、前記正解文の単語の次の単語となるように、前記第2の固定長ベクトルを補正するためのニューラルネットワークを学習する学習部と、
を含み、
前記出力部が出力した単語を前記学習データ変換部の入力として、前記学習データ変換部、前記生成部、前記補正部、前記出力部、及び前記学習部での各処理を繰り返す
文生成学習装置。
A learning data conversion unit that converts a word of a correct sentence prepared in advance as learning data into a first fixed-length vector;
A second fixed length vector is obtained by using a neural network for predicting the next word from the first fixed length vector obtained by the learning data conversion section and the second fixed length vector generated in the past. A generator for generating a vector,
Correct the second fixed-length vector from the first fixed-length vector obtained by the learning data conversion unit using a neural network for correcting the second fixed-length vector generated by the generation unit. A correction unit for generating a correction vector for
A vector representing the appearance probability of each word is calculated from the second fixed-length vector generated by the generation unit and the correction vector obtained by the correction unit, and according to the vector representing the appearance probability of each word. An output unit that outputs the selected word as the next word,
A learning unit that learns a neural network for correcting the second fixed-length vector so that the word obtained by the output unit is a word next to the word of the correct sentence;
Including,
A sentence generation learning device that repeats each process in the learning data conversion unit, the generation unit, the correction unit, the output unit, and the learning unit by using the word output by the output unit as an input of the learning data conversion unit.
前記学習部は、前記出力部で得た単語が、前記正解文の単語の次の単語となるように、前記次の単語を予測するためのニューラルネットワーク、及び前記第2の固定長ベクトルを補正するためのニューラルネットワークを学習する請求項2記載の文生成学習装置。 The learning unit corrects the neural network for predicting the next word and the second fixed-length vector so that the word obtained by the output unit becomes the next word after the word of the correct sentence. The sentence generation/learning apparatus according to claim 2, wherein the neural network for learning is learned. 入力変換部が、入力された単語を第1の固定長ベクトルに変換し、
生成部が、前記入力変換部で得た前記第1の固定長ベクトルと、過去に生成された第2の固定長ベクトルとから、次の単語を予測するための予め学習されたニューラルネットワークを用いて、第2の固定長ベクトルを生成し、
補正部が、前記入力変換部で得た前記第1の固定長ベクトルから、前記生成部で生成した前記第2の固定長ベクトルを補正するための予め学習されたニューラルネットワークを用いて、前記第2の固定長ベクトルを補正するための補正用ベクトルを生成し、
出力部が、前記生成部で生成した第2の固定長ベクトルと、前記補正部で得た前記補正用ベクトルとから、各単語の出現確率を表すベクトルを計算し、各単語の出現確率を表すベクトルに応じて選択される単語を、次の単語として出力することを含み、
前記出力部が出力した単語を前記入力変換部の入力として、前記入力変換部、前記生成部、前記補正部、及び前記出力部での各処理を繰り返すことにより生成した単語を並べた単語列を候補文として生成するものであり、
前記生成部は、前記入力変換部で得た第1の固定長ベクトルと、過去に生成された第2の固定長ベクトルである、前記単語列中の当該第1の固定長ベクトルに対応する単語の直前の単語までの単語列に対応する第2の固定長ベクトルとから、前記単語列中の当該第1の固定長ベクトルに対応する単語までの単語列に対応する第2の固定長ベクトルを生成する
文生成方法。
The input conversion unit converts the input word into a first fixed-length vector,
A generation unit uses a pre-learned neural network for predicting the next word from the first fixed-length vector obtained by the input conversion unit and the second fixed-length vector generated in the past. To generate a second fixed-length vector,
The correction unit uses the pre-learned neural network for correcting the second fixed-length vector generated by the generation unit from the first fixed-length vector obtained by the input conversion unit, Generate a correction vector for correcting the fixed length vector of 2,
The output unit calculates a vector representing the appearance probability of each word from the second fixed-length vector generated by the generation unit and the correction vector obtained by the correction unit, and represents the appearance probability of each word. Including outputting the word selected according to the vector as the next word,
A word string in which words output by the output unit are input to the input conversion unit and words generated by repeating the processes of the input conversion unit, the generation unit, the correction unit, and the output unit are arranged. Is generated as a candidate sentence,
The generation unit is a first fixed-length vector obtained by the input conversion unit and a second fixed-length vector generated in the past, which is a word corresponding to the first fixed-length vector in the word string. From the second fixed-length vector corresponding to the word string up to the word immediately before the second fixed-length vector corresponding to the word string up to the word corresponding to the first fixed-length vector in the word string, The statement generation method to generate.
コンピュータを、請求項1記載の文生成装置の各部として機能させるためのプログラム。 A program for causing a computer to function as each unit of the sentence generation device according to claim 1.
JP2017168934A 2017-09-01 2017-09-01 Sentence generation device, sentence generation learning device, sentence generation method, and program Active JP6712973B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2017168934A JP6712973B2 (en) 2017-09-01 2017-09-01 Sentence generation device, sentence generation learning device, sentence generation method, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2017168934A JP6712973B2 (en) 2017-09-01 2017-09-01 Sentence generation device, sentence generation learning device, sentence generation method, and program

Publications (2)

Publication Number Publication Date
JP2019046188A JP2019046188A (en) 2019-03-22
JP6712973B2 true JP6712973B2 (en) 2020-06-24

Family

ID=65815739

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2017168934A Active JP6712973B2 (en) 2017-09-01 2017-09-01 Sentence generation device, sentence generation learning device, sentence generation method, and program

Country Status (1)

Country Link
JP (1) JP6712973B2 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110162783A (en) * 2019-04-17 2019-08-23 腾讯科技(深圳)有限公司 Generation method and device for hidden state in the Recognition with Recurrent Neural Network of Language Processing
CN111539199B (en) * 2020-04-17 2023-08-18 中移(杭州)信息技术有限公司 Text error correction method, device, terminal and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6222821B2 (en) * 2013-10-10 2017-11-01 日本放送協会 Error correction model learning device and program
JP2017016384A (en) * 2015-07-01 2017-01-19 日本放送協会 Mixed coefficient parameter learning device, mixed occurrence probability calculation device, and programs thereof
US11010550B2 (en) * 2015-09-29 2021-05-18 Apple Inc. Unified language modeling framework for word prediction, auto-completion and auto-correction

Also Published As

Publication number Publication date
JP2019046188A (en) 2019-03-22

Similar Documents

Publication Publication Date Title
CN108021705B (en) Answer generation method and device
JP6222821B2 (en) Error correction model learning device and program
JP3998668B2 (en) Morphological analyzer, method and program
CN111310443A (en) Text error correction method and system
CN112906392B (en) Text enhancement method, text classification method and related device
US20240005093A1 (en) Device, method and program for natural language processing
CN111985213A (en) Method and device for correcting voice customer service text
CN111401084A (en) Method and device for machine translation and computer readable storage medium
JP6830602B2 (en) Phrase structure learning device, phrase structure analysis device, method, and program
KR102143745B1 (en) Method and system for error correction of korean using vector based on syllable
JP5809381B1 (en) Natural language processing system, natural language processing method, and natural language processing program
CN112329476A (en) Text error correction method and device, equipment and storage medium
JP6312467B2 (en) Information processing apparatus, information processing method, and program
RU2712101C2 (en) Prediction of probability of occurrence of line using sequence of vectors
JP6712973B2 (en) Sentence generation device, sentence generation learning device, sentence generation method, and program
US10643028B1 (en) Transliteration of text entry across scripts
US10394960B2 (en) Transliteration decoding using a tree structure
JP6145059B2 (en) Model learning device, morphological analysis device, and method
CN113806645A (en) Label classification system and training system of label classification model
US20210342529A1 (en) Word coding device, analysis device, language model learning device, method, and program
JP6291440B2 (en) Parameter learning method, apparatus, and program
WO2019163752A1 (en) Morpheme analysis learning device, morpheme analysis device, method, and program
JP6633999B2 (en) Encoder learning device, conversion device, method, and program
US10810380B2 (en) Transliteration using machine translation pipeline
JP2018077677A (en) Character string converting device, model learning device, method, and program

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20190826

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20200424

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20200526

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20200602

R150 Certificate of patent or registration of utility model

Ref document number: 6712973

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150