JP7200154B2 - Program, device and method for inferring response sentences to received sentences - Google Patents
Program, device and method for inferring response sentences to received sentences Download PDFInfo
- Publication number
- JP7200154B2 JP7200154B2 JP2020023845A JP2020023845A JP7200154B2 JP 7200154 B2 JP7200154 B2 JP 7200154B2 JP 2020023845 A JP2020023845 A JP 2020023845A JP 2020023845 A JP2020023845 A JP 2020023845A JP 7200154 B2 JP7200154 B2 JP 7200154B2
- Authority
- JP
- Japan
- Prior art keywords
- encoder
- bilingual
- context vector
- sentence
- decoder
- 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
Links
Images
Landscapes
- Machine Translation (AREA)
Description
本発明は、受話文に対する応答文を推論する対話生成システムの技術に関する。 The present invention relates to technology of a dialog generation system that infers a response sentence to a received sentence.
従来、深層学習を用いた対話生成システムの技術がある(例えば非特許文献1参照)。この技術によれば、学習モデル自体がブラックボックスとなっており、シーケンスからシーケンスへ(sequence-to-sequence)の系列変換モデルとして学習する。用途として、マイクロブログや映画の字幕、トラブルシューティングデスクの問答集など多様な発話状況を含む対話コーパスを用いて、雑談のように特定の目的を伴わない対話(非タスク指向型対話)を実現する。
Conventionally, there is a technology of a dialog generation system using deep learning (see Non-Patent
図1は、従来技術における推論装置の機能構成図である。 FIG. 1 is a functional configuration diagram of an inference device in the prior art.
図1によれば、訓練段階及び運用段階からなり、各段階はそれぞれ、エンコーダ-デコーダモデルとして構成されている。エンコーダ及びデコーダはそれぞれ、次の単語の出現確率を出力するLSTM(Long short-term memory)に基づくものである。LSTMは、RNN(Recurrent Neural Network)の拡張として、時系列データ(sequential data)に対して長期記憶(Long term memory)及び短期記憶(Short term memory)によって構成された学習モデルである。 According to FIG. 1, it consists of a training phase and an operational phase, each of which is structured as an encoder-decoder model. The encoder and decoder are each based on a long short-term memory (LSTM) that outputs the probability of occurrence of the next word. LSTM is an extension of RNN (Recurrent Neural Network) and is a learning model composed of long term memory and short term memory for sequential data.
<訓練段階>
学習データベースは、単語列のセットからなる学習用受話文及び学習用応答文を対応付けて記憶している。
エンコーダは、学習用受話文からコンテキストベクトルを生成し、デコーダは、当該コンテキストベクトルから学習用応答文を生成する、ように学習する。
図1によれば、例えば以下のように、学習用受話文及び学習用応答文を対応付けて学習している。
(1)学習用受話文「最近、英会話を習い始めました」
学習用応答文「英会話が出来ないのですか?」
(2)学習用受話文「山登りが趣味です」
学習用応答文「どの山に登りましたか?」
<運用段階>
エンコーダは、対象受話文からコンテキストベクトルを生成し、デコーダは、当該コンテキストベクトルから応答文を生成する。
<Training stage>
The learning database associates and stores learning received sentences and learning response sentences each including a set of word strings.
The encoder learns to generate a context vector from the learning received sentence, and the decoder generates a learning response sentence from the context vector.
According to FIG. 1, for example, learning received sentences and learning response sentences are associated and learned as follows.
(1) Sentence for learning "Recently, I started learning English conversation"
Learning answer sentence "Can't you speak English?"
(2) Learning received sentence “My hobby is mountain climbing”
Response sentence for learning "Which mountain did you climb?"
<Operation stage>
The encoder generates a context vector from the target received sentence, and the decoder generates a response sentence from the context vector.
前述した非特許文献1に記載の技術によれば、系列変換モデルのみを用いるために、対話文の文脈までは学習していない。そのために、対話が破綻する場合があった。
According to the technique described in Non-Patent
対話の破綻は、例えば以下の4つの事例に分類されている(例えば非特許文献2参照)。
(事例1)発話の破綻
発話そのものが破綻している場合がある。例えば、構文が崩れていて、そもそも日本語として成立していない場合がある。
(事例2)応答の破綻
日本語としては正しいが、相手の発言に対する応答が破綻している場合がある。例えば、受話文「それでは、趣味はなんですか?」に対して、応答文「最後に旅行されたのはいつですか?」を返答する場合がある。
(事例3)文脈の破綻
1回のやりとりとしては成立しているものの、既に話した内容とかみ合わない場合がある。例えば、10秒前には応答文「お菓子が好き」と返答したにも拘わらず、直ぐに応答文「お菓子が嫌い」と返答する場合がある。
(事例4)環境の破綻
社会的(常識的)に不適切な発言をしてしまう場合がある。例えば、米国のMicrosoft社が公開した人工知能bot「Tay」(登録商標)のように、急に人種差別的な発言をする場合がある。
一般的に、事例2の破綻が約5割、事例3の破綻が約3割、事例1の破綻が1割強で、事例4の破綻が少数程度、発生すると認識されている。
Dialogue breakdowns are classified into, for example, the following four cases (see, for example, Non-Patent Document 2).
(Case 1) Broken speech There are cases where the speech itself is broken. For example, there are cases where the syntax is broken and the language is not established as Japanese in the first place.
(Case 2) Corruption of response Although the Japanese is correct, there are cases where the response to the other party's statement is broken. For example, there is a case where a response sentence "When was the last time you traveled?"
(Case 3) Collapse of context Although it is established as a single exchange, there are cases where it does not mesh with what has already been said. For example, although the response text "I like sweets" was answered 10 seconds ago, the response text "I hate sweets" may be immediately returned.
(Case 4) Collapse of the environment Socially (common sense) inappropriate remarks may be made. For example, the artificial intelligence bot “Tay” (registered trademark) published by Microsoft in the United States may suddenly make racist remarks.
Generally, it is recognized that about 50% of bankruptcies in
ここで、事例2の応答の破綻について、その原因としては、エンコーダの注意機構が重要視した単語が不適切であることが考えられる。
また、事例1の発話の破綻について、その原因としては、デコーダの精度不足が考えられる。
Here, the failure of the response in
Further, the failure of speech in
近年のニューラルネットワークを用いた自然言語処理では、文として自然であることを過度に優先することのないよう、エンコーダが「注意機構(Attention)」を備えている。
注意機構とは、新たに「デコーダで生成しようとしているi番目のtargetの単語翻訳時の内部状態」と、「エンコーダでの各単語の隠れ層」とを用いて計算されるコンテキストベクトルを、デコーダの推論時に用いるものである。そのために、注意機構を含むモデルでは、i番目の単語を出力するときに、入力として(1)1つ前の翻訳単語結果と、(2)デコーダの内部状態と、(3)注意機構によって算出されたコンテキストベクトルとが与えられ、それを用いてi番目の単語を推論する。
このように、注意機構によって重要視すべき単語や語句が指定されるために、適切な自然言語処理が可能となる。
In recent years, in natural language processing using neural networks, the encoder is equipped with an "attention mechanism" so as not to give too much priority to natural sentences.
The attention mechanism is a new context vector calculated using the ``internal state at the time of word translation of the i-th target to be generated by the decoder'' and the ``hidden layer of each word in the encoder''. It is used when inferring Therefore, in the model including the attention mechanism, when outputting the i-th word, (1) the previous translated word result, (2) the internal state of the decoder, and (3) the attention mechanism calculated given a context vector and use it to infer the ith word.
In this way, since the attention mechanism designates words and phrases to be emphasized, appropriate natural language processing becomes possible.
しかしながら、LSTMを用いたデコーダの場合、注意機構が学習用受話文及び学習用応答文に過学習を起こす場合があるために、受話文の文脈に対してではなく、注意機構が不適切な単語を重要視してしまうという課題がある。 However, in the case of decoders using LSTM, the attention mechanism may overfit training received sentences and training response sentences. There is a problem of placing importance on
図1によれば、運用段階で、例えば以下のように、対象受話文がエンコーダに入力され、その応答文がデコーダから出力されている。
対象受話文「最近、山登りを始めました」
応答文 「山登りが出来ないのですか?」
ここで、応答文は日本語として問題は無いが、一般的に「山登りが出来ない」場合は限られており、受話文に対する応答文の文脈に不自然さや違和感を生じる。
これは、例えば訓練段階について、エンコーダが、例えば「~を始めました」を重要視したことによって、応答文「~が出来ないのですか?」の優先度が高まったものと考えられる。
このように、図1の例によれば、エンコーダの注意機構が重要視した単語が不適切であること(事例2の応答の破綻)や、デコーダの精度不足(事例1の発話の破綻)が考えられる。
According to FIG. 1, in the operation stage, for example, a target received speech sentence is input to the encoder and a response sentence is output from the decoder as follows.
Target received sentence "Recently, I started mountain climbing"
Response: "Can't you climb mountains?"
Here, although the response sentence is Japanese, there is no problem, but in general, there are limited cases where the response sentence is "cannot climb a mountain", and the context of the response sentence to the received sentence is unnatural and uncomfortable.
This is probably because, for example, in the training phase, the encoder emphasized, for example, "I started ~", and thus the priority of the response sentence "Can't you do ~?"
Thus, according to the example of FIG. 1, the inappropriateness of the word emphasized by the attention mechanism of the encoder (corruption of response in case 2) and the lack of accuracy of the decoder (corruption of speech in case 1) Conceivable.
そこで、本発明は、応答の破綻や発話の破綻に陥らないように、受話文に対する応答文を推論するプログラム、装置及び方法を提供することを目的とする。 SUMMARY OF THE INVENTION Accordingly, it is an object of the present invention to provide a program, an apparatus, and a method for inferring a response sentence to a received sentence so as not to fall into a broken response or a broken speech.
本発明によれば、受話文に対する応答文を推論する装置に搭載されたコンピュータを機能させるプログラムにおいて、
訓練段階として、
エンコーダ-デコーダモデルとして、第1の言語の第1のコーパステキストからコンテキストベクトルを生成する対訳エンコーダと、当該コンテキストベクトルから第1のコーパステキストの対訳となる第2の言語の第2のコーパステキストを出力する対訳デコーダとを学習し、
エンコーダ-デコーダモデルとして、学習用受話文から対訳エンコーダによって生成されたコンテキストベクトルを入力した際に、当該学習用受話文の対話となる学習用応答文から対訳エンコーダによって生成されたコンテキストベクトルを出力するようにニューラルネットワークを学習し、
運用段階として、
対象の受話文から対訳エンコーダによって第1のコンテキストベクトルを生成し、
第1のコンテキストベクトルからニューラルネットワークによって第2のコンテキストベクトルを生成し、
第2のコンテキストベクトルから対訳デコーダによって応答文を推論する
ようにコンピュータを機能させることを特徴とする。
According to the present invention, in a program that causes a computer installed in a device for inferring a response sentence to a received sentence to function,
As a training step,
The encoder-decoder model is a parallel encoder that generates a context vector from a first corpus text in a first language, and a second corpus text in a second language that is a parallel translation of the first corpus text from the context vector. Learn the bilingual decoder to output,
As an encoder-decoder model, when a context vector generated by a bilingual encoder from a received training sentence is input, a context vector generated by a bilingual encoder is output from a learning response sentence that is a dialogue of the received training sentence. train the neural network as
As an operational stage,
generating a first context vector from the target received sentence by a bilingual encoder;
generating a second context vector from the first context vector by a neural network;
The computer is operable to infer a response sentence from the second context vector by the parallel decoder.
本発明のプログラムにおける他の実施形態によれば、
対訳エンコーダは、注意(attention)機構を有しており、
対訳エンコーダから生成される第1のコンテキストベクトルと、ニューラルネットワークから生成される第2のコンテキストベクトルとは、潜在的に注意機構を含む
ようにコンピュータを機能させることも好ましい。
According to another embodiment of the program of the present invention,
The bilingual encoder has an attention mechanism,
It is also preferred to have the computer function such that the first context vector generated from the bilingual encoder and the second context vector generated from the neural network potentially contain an attention mechanism.
本発明のプログラムにおける他の実施形態によれば、
対訳エンコーダ及び対訳デコーダはそれぞれ、異なる言語数に応じて複数有し、
対訳エンコーダは、異なる言語の複数のコーパステキストをそれぞれ入力し、1つのコンテキストベクトルを生成し、及び/又は、
対訳デコーダは、1つのコンテキストベクトルを入力し、異なる言語の複数のコーパステキストをそれぞれ出力する
べく学習したものとなるようにコンピュータを機能させることも好ましい。
According to another embodiment of the program of the present invention,
The bilingual encoder and the bilingual decoder each have a plurality according to the number of different languages,
A bilingual encoder receives multiple corpus texts in different languages, respectively, and generates a context vector; and/or
The bilingual decoder also preferably causes the computer to be trained to input one context vector and output multiple corpus texts in different languages, respectively.
本発明のプログラムにおける他の実施形態によれば、
対訳エンコーダ及び対訳デコーダは、系列変換モデル(sequence-to-sequence)のニューラルネットワークに基づくものであり、
対訳エンコーダは、埋め込み層及び再帰層から構成され、
対訳デコーダは、埋め込み層、再帰層及び出力層から構成される
ようにコンピュータを機能させることも好ましい。
According to another embodiment of the program of the present invention,
The bilingual encoder and bilingual decoder are based on sequence-to-sequence neural networks,
A bilingual encoder consists of an embedding layer and a recurrence layer,
It is also preferred to have the computer function such that the parallel decoder consists of an embedding layer, a recursion layer and an output layer.
本発明によれば、受話文に対する応答文を推論する推論装置において、
訓練段階として、
エンコーダ-デコーダモデルとして、第1の言語の第1のコーパステキストからコンテキストベクトルを生成する対訳エンコーダと、当該コンテキストベクトルから第1のコーパステキストの対訳となる第2の言語の第2のコーパステキストを出力する対訳デコーダとを学習し、
エンコーダ-デコーダモデルとして、学習用受話文から対訳エンコーダによって生成されたコンテキストベクトルを入力した際に、当該学習用受話文の対話となる学習用応答文から対訳エンコーダによって生成されたコンテキストベクトルを出力するようにニューラルネットワークを学習し、
運用段階として、
対象の受話文から対訳エンコーダによって第1のコンテキストベクトルを生成し、
第1のコンテキストベクトルからニューラルネットワークによって第2のコンテキストベクトルを生成し、
第2のコンテキストベクトルから対訳デコーダによって応答文を推論する
ことを特徴とする。
According to the present invention, an inference device for inferring a response sentence to a received sentence:
As a training step,
The encoder-decoder model is a parallel encoder that generates a context vector from a first corpus text in a first language, and a second corpus text in a second language that is a parallel translation of the first corpus text from the context vector. Learn the bilingual decoder to output,
As an encoder-decoder model, when a context vector generated by a bilingual encoder from a received training sentence is input, a context vector generated by a bilingual encoder is output from a learning response sentence that is a dialogue of the received training sentence. train the neural network as
As an operational stage,
generating a first context vector from the target received sentence by a bilingual encoder;
generating a second context vector from the first context vector by a neural network;
A response sentence is inferred by a parallel decoder from the second context vector.
本発明によれば、受話文に対する応答文を推論する装置の推論方法において、
装置は、
訓練段階として、
エンコーダ-デコーダモデルとして、第1の言語の第1のコーパステキストからコンテキストベクトルを生成する対訳エンコーダと、当該コンテキストベクトルから第1のコーパステキストの対訳となる第2の言語の第2のコーパステキストを出力する対訳デコーダとを学習し、
エンコーダ-デコーダモデルとして、学習用受話文から対訳エンコーダによって生成されたコンテキストベクトルを入力した際に、当該学習用受話文の対話となる学習用応答文から対訳エンコーダによって生成されたコンテキストベクトルを出力するようにニューラルネットワークを学習し、
運用段階として、
対象の受話文から対訳エンコーダによって第1のコンテキストベクトルを生成し、
第1のコンテキストベクトルからニューラルネットワークによって第2のコンテキストベクトルを生成し、
第2のコンテキストベクトルから対訳デコーダによって応答文を推論する
ように実行することを特徴とする。
According to the present invention, in an inference method for a device that infers a response sentence to a received sentence,
The device
As a training step,
The encoder-decoder model is a parallel encoder that generates a context vector from a first corpus text in a first language, and a second corpus text in a second language that is a parallel translation of the first corpus text from the context vector. Learn the bilingual decoder to output,
As an encoder-decoder model, when a context vector generated by a bilingual encoder from a received training sentence is input, a context vector generated by a bilingual encoder is output from a learning response sentence that is a dialogue of the received training sentence. train the neural network as
As an operational stage,
generating a first context vector from the target received sentence by a bilingual encoder;
generating a second context vector from the first context vector by a neural network;
It is characterized by performing so as to infer a response sentence by a bilingual decoder from the second context vector.
本発明のプログラム、装置及び方法によれば、応答の破綻や発話の破綻に陥らないように、受話文に対する応答文を推論することができる。 According to the program, apparatus, and method of the present invention, it is possible to infer a response sentence to a received sentence without falling into a failure of response or failure of utterance.
以下、本発明の実施の形態について、図面を用いて詳細に説明する。 BEST MODE FOR CARRYING OUT THE INVENTION Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings.
図2は、本発明における推論装置の訓練段階の機能構成図である。 FIG. 2 is a functional configuration diagram of the training stage of the inference device in the present invention.
図2によれば、推論装置1は、訓練段階として、対訳コーパスデータベース101と、学習データベース102と、対訳エンコーダ111と、対訳デコーダ112と、ニューラルネットワーク12とを有する。これら機能構成図は、装置に搭載されたコンピュータを機能させるプログラムを実行することによって実現される。また、これら機能構成部の処理の流れは、装置の推論方法における訓練段階としても理解できる。
ここで、訓練は、第1の訓練段階と第2の訓練段階とに区分される。各訓練段階とも、エンコーダ-デコーダモデルとして、コンテキストベクトルを介して構成される。
According to FIG. 2, the
Here, training is divided into a first training phase and a second training phase. Each training stage is constructed via a context vector as an encoder-decoder model.
<<第1の訓練段階>>
第1の訓練段階では、対訳コーパスデータベース101に基づいて、対訳エンコーダ111及び対訳デコーダ112が訓練される。
<<First training stage>>
In the first training stage, the
[対訳コーパスデータベース101]
対訳コーパスデータベース101は、異なる言語間で対訳となるコーパステキスト(corpus text)を蓄積したものである。これは、対訳エンコーダ111に入力すべき第1の言語のコーパステキストと、対訳デコーダ112で出力されるべき第2の言語のコーパステキストとを対応付けたものである。
コーパステキストは、例えばニューラル機械翻訳における多言語の対訳コーパスであってもよい。即ち、同じ意味を表す異なる言語を、対訳として用意する。
日本語:「私はあなたを愛している。」
英語 :「I love you.」
独語 :「Ich liebe dich.」
中国語:「我愛弥」
[Parallel corpus database 101]
The
The corpus text may be, for example, a multilingual parallel corpus in neural machine translation. That is, different languages expressing the same meaning are prepared as parallel translations.
Japanese: "I love you."
English: "I love you."
German: "Ich liebe dich."
Chinese: "I love you"
[対訳エンコーダ111・対訳デコーダ112]
対訳エンコーダ111及び対訳デコーダ112は、対訳となる第1の言語のコーパステキスト及び第2の言語のコーパステキストを対応付けて入力し、エンコーダ-デコーダモデルとして学習する。
対訳エンコーダ111は、対訳コーパスデータベース101から入力した第1の言語のコーパステキストからコンテキストベクトルを生成する、ように学習する。ここで、対訳エンコーダは、注意(attention)機構を有する。
対訳デコーダ112は、当該コンテキストベクトルから、第2の言語のコーパステキストを出力する、ように学習する。
[Parallel
The
The
対訳エンコーダ111及び対訳デコーダ112は、エンコーダ-デコーダモデルとして、一方の系列(sequence)から他方の系列へ変換する確率をモデル化した、ニューラルネットワークに基づく「系列変換モデル(sequence-to-sequence / seq2seq)」として構成されたものである(例えば非特許文献3参照)。即ち、系列Xが入力されたときの、ある系列Yが出力される条件付き確率P(Y|X)を、モデル化したものである。
系列変換モデルは、系列Xを入力し、固定長の「コンテキストベクトル」を生成する対訳エンコーダ111と、その固定長のコンテキストベクトルから系列Yを出力する対訳デコーダ112とから構成される。
The
The sequence conversion model is composed of a
ここで、本発明によれば、最も注目すべき点として、受話文と応答文とは同一言語であるにも拘わらず、異なる言語間の対訳コーパスを用いることにある。
一般的に、受話文及び応答文が同一言語であれば、訓練段階及び運用段階も同一言語を用いる。当然、受話文及び応答文が日本語であれば、その他の言語間の対訳コーパスなど必要としない。もし、エンコーダ-デコーダのモデルで、日本語同士の対話のコーパスを用いたとしても、単なる恒等変換にしかならない。そのために、受話文及び応答文が同一言語であれば、対訳コーパステキストを用いることは全く想定されない。
これに対し、本発明によれば、あえて、受話文及び応答文が異なる言語となる「対訳コーパス」を用いて学習している。これによって、対訳エンコーダが生成するコンテキストベクトルに内在する注意機構の過学習を防ぐことができる。特に、対訳の言語種別が多いほど、個々の言語モデルの影響を受けないコンテキストベクトルの生成が可能となる。最終的に生成される応答文は、既存の言語モデルの影響をできる限り受けないものとなることが期待される。
Here, according to the present invention, the most notable point is to use a bilingual corpus between different languages, even though the received sentence and the response sentence are in the same language.
In general, if the received sentence and the response sentence are in the same language, the same language is used in the training stage and the operation stage. Naturally, if the received sentence and the response sentence are in Japanese, there is no need for a bilingual corpus for other languages. If the encoder-decoder model were to use a corpus of Japanese-Japanese dialogues, it would be nothing more than a simple identity transformation. Therefore, if the received sentence and the response sentence are in the same language, it is not assumed that the bilingual corpus text is used.
In contrast, according to the present invention, learning is performed using a "parallel translation corpus" in which received sentences and response sentences are in different languages. This prevents over-training of the attention mechanism inherent in the context vectors generated by the bilingual encoder. In particular, the greater the number of parallel translation language types, the more it becomes possible to generate a context vector that is not affected by individual language models. It is expected that the finally generated response sentence will be influenced as little as possible by the existing language model.
図3は、対訳デコーダ及び対訳エンコーダの訓練を表す第1の実施形態の説明図である。 FIG. 3 is an illustration of a first embodiment representing training of a parallel decoder and a parallel encoder.
図3によれば、対訳エンコーダ111には、第1の言語のコーパステキストに基づく形態素系列が入力される。
日本語:「あなた/を/愛し/て/いる/<EOS>」
対訳デコーダ112には、第2の言語のコーパステキストに基づく形態素系列が入力される。
英語:「<BOS>/I/love/you/<EOS>」
第1の言語のコーパステキスト、第2の言語のコーパステキストとは、異なる言語であるが、同義文である。
According to FIG. 3, the
Japanese: "You/to/love/to/be/<EOS>"
A morpheme sequence based on the corpus text of the second language is input to the
English: "<BOS>/I/love/you/<EOS>"
The corpus text of the first language and the corpus text of the second language are synonymous sentences although they are in different languages.
また、図3によれば、対訳エンコーダ111には、例えば以下の日本語文が入力されている。
「幕府は、1639年、ポルトガル人を追放し、大名には沿岸の警備を命じた。」
これに対し、対訳デコーダ112は、コンテキストベクトルから、以下のような英語文を出力するように、対訳エンコーダ111及び対訳デコーダ112を学習する。
「The shogunate banished Portuguese in 1639, ordered Daimyo to guard
the coast.」
同様に、図3によれば、対訳エンコーダ111には、例えば以下の日本語文が入力されている。
「1639年、ポルトガル人は追放され、幕府は大名から沿岸の警備を命じられた。」
これに対し、対訳デコーダ112は、コンテキストベクトルから、以下のような英語文を出力するように、対訳エンコーダ111及び対訳デコーダ112を学習する。
「In 1639, the Portuguese were expelled, and the shogunate was ordered
to protect the coast from Daimyo.」
Further, according to FIG. 3, the following Japanese sentence is input to the
``The shogunate expelled the Portuguese in 1639 and ordered the feudal lords to guard the coast.''
On the other hand, the
"The shogunate banished Portuguese in 1639, ordered Daimyo to guard
the coast."
Similarly, according to FIG. 3, the following Japanese sentence is input to the
"In 1639 the Portuguese were expelled and the shogunate was ordered by the feudal lords to guard the coast."
On the other hand, the
"In 1639, the Portuguese were expelled, and the shogunate was ordered
to protect the coast from Daimyo."
図3によれば、対訳エンコーダ111は、埋め込み層及び再帰層から構成され、第1の言語のコーパステキストからコンテキストベクトルを出力するように学習する。
埋め込み層は、入力テキストXの各単語xを、埋め込みベクトル(embedding vector)の分散表現(distribute representation)に変換する。
次に、再帰層は、埋め込みベクトルを入力し、コンテキストベクトルを出力するように、再帰型ニューラルネットワークとして機能する。
According to FIG. 3, the
The embedding layer transforms each word x of the input text X into a distributed representation of an embedding vector.
The recurrent layer then functions as a recurrent neural network, inputting the embedding vector and outputting the context vector.
これに対し、デコーダ12は、埋め込み層、再帰層及び出力層から構成され、コンテキストベクトルを入力し、第2の言語のコーパステキストを出力するように学習する。
埋め込み層は、出力テキストYの各単語yを、埋め込みベクトルの分散表現に変換する。
次に、再帰層は、埋め込みベクトルとコンテキストベクトルとを入力し、再帰型ニューラルネットワークとして機能する。
出力層は、再帰層から出力された出力系列Yの単語yに対応する隠れ層状態ベクトルを入力し、テキストを出力する。
On the other hand, the
The embedding layer transforms each word y of the output text Y into a distributed representation of embedding vectors.
Next, the recurrent layer receives the embedding vector and the context vector and functions as a recurrent neural network.
The output layer receives a hidden layer state vector corresponding to the word y in the output sequence Y output from the recursive layer, and outputs text.
図4は、対訳デコーダ及び対訳エンコーダの訓練を表す第2の実施形態の説明図である。 FIG. 4 is an illustration of a second embodiment representing the training of the parallel decoder and encoder.
図4によれば、4つの異なる言語のコーパステキストを対応付けると共に、2つの対訳エンコーダ111と、2つの対訳デコーダ112とから、コンテキストベクトルが生成されている。即ち、2つの対訳エンコーダ111と2つの対訳デコーダ112とによって構成している。
図4によれば、日本語に対応する対訳エンコーダ111と、中国語に対応する対訳エンコーダ111とからの出力となるコンテキストベクトルを、英語に対応する対訳デコーダ112と、独語に対応する対訳デコーダ112とに入力して学習している。これによって、4つの異なる言語について、同義文となる対訳コーパスに共通するコンテキストベクトルが生成されることとなる。
According to FIG. 4, context vectors are generated from two
According to FIG. 4, the context vectors output from the
勿論、更なる実施形態として、対訳エンコーダ111及び対訳デコーダ112を、1対2、2対1と異なるように構成してもよい。
例えば、日本語に対応する対訳エンコーダ111とからの出力となるコンテキストベクトルを、英語に対応する対訳デコーダ112と、独語に対応する対訳デコーダ112とに入力して学習するものであってもよい。
また、例えば、日本語に対応する対訳エンコーダ111と、中国語に対応する対訳エンコーダ111とからの出力となるコンテキストベクトルを、英語に対応する対訳デコーダ112に入力して学習するものであってもよい。
Of course, in further embodiments, the
For example, context vectors output from the
Further, for example, even if context vectors output from the
<<第2の訓練段階>>
図2に戻って、第2の訓練段階では、学習データベース102と、2つの対訳エンコーダ111と、ニューラルネットワーク12とによって訓練される。
<<Second training stage>>
Returning to FIG. 2 , in the second training stage, the
[学習データベース102]
学習データベース102は、学習用受話文及び学習用応答文を対応付けて蓄積したものである。これは、従来技術としての図1における学習データベースと同様のものである。
[Learning database 102]
The
[2つの対訳エンコーダ111]
2つの対訳エンコーダ111は、第1の訓練段階で学習された対訳エンコーダ111をそのまま用いている。一方の対訳エンコーダ111は、対話となる学習用受話文を入力して、その学習用受話文からコンテキストベクトルを生成し、そのコンテキストベクトルをニューラルネットワーク12へ入力する。他方の対訳エンコーダ111は、対話となる学習用応答文を入力し、その学習用応答文からコンテキストベクトルを生成し、そのコンテキストベクトルをニューラルネットワーク12の出力側へ入力する。
[Two Parallel Encoders 111]
The two
例えば前述した図1と同様に、以下のように、学習用受話文及び学習用応答文を対応付けて学習している。
(1)学習用受話文「最近、英会話を習い始めました」
学習用応答文「英会話が出来ないのですか?」
(2)学習用受話文「山登りが趣味です」
学習用応答文「どの山に登りましたか?」
For example, similar to FIG. 1 described above, learned received sentences for learning and response sentences for learning are associated and learned as follows.
(1) Sentence for learning "Recently, I started learning English conversation"
Learning answer sentence "Can't you speak English?"
(2) Learning received sentence “My hobby is mountain climbing”
Response sentence for learning "Which mountain did you climb?"
[ニューラルネットワーク12]
ニューラルネットワーク12は、エンコーダ-デコーダモデルとして、学習用受話文から対訳エンコーダによって生成されたコンテキストベクトルを入力した際に、当該学習用受話文の対話となる学習用応答文から対訳エンコーダによって生成されたコンテキストベクトルを出力する、ように学習する。
ニューラルネットワーク12は、例えば畳み込みニューラルネットワークであるのが好ましい。
[Neural network 12]
The
注目すべき点は、対訳エンコーダ111及び対訳デコーダ112を学習させるものではない、ことにある。
また、2つの対訳エンコーダ111によって生成されたそれぞれのコンテキストベクトルは、潜在的に注意機構を含むこととなる。
本発明によれば、対訳コーパスデータベース101を用いることによって、対訳エンコーダ111の注意機構は、言語の種別に影響されず、意味的に重要な単語を重要視するようになるため、応答文の破綻を抑制することができる。ここで、複数の異なる言語の対訳コーパスを用いて対訳デコーダ112を訓練することによって、性能が改善し、応答文の破綻を更に抑制することができる。
The point to be noted is that the
Also, each context vector generated by the two
According to the present invention, by using the
<<運用段階>>
図5は、本発明における推論装置の運用段階の機能構成図である。
<<Operation stage>>
FIG. 5 is a functional configuration diagram of the inference device in the operational stage of the present invention.
推論装置1は、対象受話文に対する応答文を推論する。
図5によれば、運用段階では、対訳エンコーダ111と、ニューラルネットワーク12と、対訳デコーダ112とからなるエンコーダ-デコーダモデルによって推論される。対訳エンコーダ111及び対訳デコーダ112は、第1の訓練段階で訓練されたものであり、ニューラルネットワーク12は、第2の訓練段階で訓練されたものである。
The
According to FIG. 5 , in the operational stage, it is inferred by an encoder-decoder model consisting of a
対訳エンコーダ111は、対象の受話文から第1のコンテキストベクトルを生成する。
次に、ニューラルネットワーク12は、第1のコンテキストベクトルから第2のコンテキストベクトルを生成する。
そして、対訳デコーダ112は、第2のコンテキストベクトルから応答文を生成する。
ここで、第1のコンテキストベクトル及び第2のコンテキストベクトルは、潜在的に注意機構を含むこととなる。
The
The
Here, the first context vector and the second context vector potentially contain the attention mechanism.
図5によれば、運用段階で、例えば以下のように、対象受話文が対訳エンコーダ111に入力され、その応答文が対訳デコーダ112から出力されている。
対象受話文「最近、山登りを始めました」
応答文 「どの山に登りましたか?」
ここで、応答文は、日本語として問題は無いだけでなく、文脈に不自然さや違和感も生じない。これは、エンコーダ-デコーダモデルのコンテキストベクトルに内在する注意機構が過学習を起こしていないことに基づくものである。この点で、従来技術における前述した図1と異なっている。
According to FIG. 5, during the operation stage, for example, a target received sentence is input to the
Target received sentence "Recently, I started mountain climbing"
Response: "Which mountain did you climb?"
Here, the response sentence does not have any problem as Japanese, and the context does not cause unnaturalness or discomfort. This is based on the fact that the attention mechanisms inherent in the context vector of the encoder-decoder model are not overfitting. In this point, it is different from the above-described FIG. 1 in the prior art.
本発明によれば、対訳コーパスデータベース101を用いて対訳エンコーダ111を訓練しているために、「(英会話を)習い始めました」と「(山登りを)始めました」とを明確に区別して学習している。そのために、対訳エンコーダ111の注意機構は、「始めました」以外(例えば「山登り」)を重要視し、最終的には、正しい応答文を推論することとなる。
特に、深層学習が不得手とする「対話文生成」が可能となり、そのニューラルネットワークの適用範囲を広げることができる。
According to the present invention, since the
In particular, "dialogue generation," which is a weak point of deep learning, becomes possible, and the application range of the neural network can be expanded.
以上、詳細に説明したように、本発明のプログラム、装置及び方法によれば、応答の破綻や発話の破綻に陥らないように、受話文に対する応答文を推論することができる。 As described in detail above, according to the program, apparatus, and method of the present invention, it is possible to infer a response sentence to a received sentence without falling into a failure of response or speech.
前述した本発明の種々の実施形態について、本発明の技術思想及び見地の範囲の種々の変更、修正及び省略は、当業者によれば容易に行うことができる。前述の説明はあくまで例であって、何ら制約しようとするものではない。本発明は、特許請求の範囲及びその均等物として限定するものにのみ制約される。 For the various embodiments of the present invention described above, various changes, modifications and omissions within the spirit and scope of the present invention can be easily made by those skilled in the art. The foregoing description is exemplary only and is not intended to be limiting. The invention is to be limited only as limited by the claims and the equivalents thereof.
1 推論装置
101 対訳コーパスデータベース
102 学習データベース
111 対訳エンコーダ
112 対訳デコーダ
12 ニューラルネットワーク
Claims (6)
訓練段階として、
エンコーダ-デコーダモデルとして、第1の言語の第1のコーパステキストからコンテキストベクトルを生成する対訳エンコーダと、当該コンテキストベクトルから第1のコーパステキストの対訳となる第2の言語の第2のコーパステキストを出力する対訳デコーダとを学習し、
エンコーダ-デコーダモデルとして、学習用受話文から対訳エンコーダによって生成されたコンテキストベクトルを入力した際に、当該学習用受話文の対話となる学習用応答文から対訳エンコーダによって生成されたコンテキストベクトルを出力するようにニューラルネットワークを学習し、
運用段階として、
対象の受話文から対訳エンコーダによって第1のコンテキストベクトルを生成し、
第1のコンテキストベクトルからニューラルネットワークによって第2のコンテキストベクトルを生成し、
第2のコンテキストベクトルから対訳デコーダによって応答文を推論する
ようにコンピュータを機能させることを特徴とするプログラム。 In a program that operates a computer installed in a device that infers a response sentence to a received sentence,
As a training step,
The encoder-decoder model is a parallel encoder that generates a context vector from a first corpus text in a first language, and a second corpus text in a second language that is a parallel translation of the first corpus text from the context vector. Learn the bilingual decoder to output,
As an encoder-decoder model, when a context vector generated by a bilingual encoder from a received training sentence is input, a context vector generated by a bilingual encoder is output from a learning response sentence that is a dialogue of the received training sentence. train the neural network as
As an operational stage,
generating a first context vector from the target received sentence by a bilingual encoder;
generating a second context vector from the first context vector by a neural network;
A program characterized by causing a computer to infer a response sentence from a second context vector by a parallel decoder.
対訳エンコーダから生成される第1のコンテキストベクトルと、ニューラルネットワークから生成される第2のコンテキストベクトルとは、潜在的に注意機構を含む
ようにコンピュータを機能させることを特徴とする請求項1に記載のプログラム。 The bilingual encoder has an attention mechanism,
2. The method of claim 1, wherein the first context vector generated from the bilingual encoder and the second context vector generated from the neural network potentially cause a computer to include an attention mechanism. program.
対訳エンコーダは、異なる言語の複数のコーパステキストをそれぞれ入力し、1つのコンテキストベクトルを生成し、及び/又は、
対訳デコーダは、1つのコンテキストベクトルを入力し、異なる言語の複数のコーパステキストをそれぞれ出力する
べく学習したものとなるようにコンピュータを機能させることを特徴とする請求項1又は2に記載のプログラム。 The bilingual encoder and the bilingual decoder each have a plurality according to the number of different languages,
A bilingual encoder receives multiple corpus texts in different languages, respectively, and generates a context vector; and/or
3. The program according to claim 1 or 2, wherein the bilingual decoder inputs one context vector and causes the computer to function so as to be trained to output multiple corpus texts in different languages respectively.
対訳エンコーダは、埋め込み層及び再帰層から構成され、
対訳デコーダは、埋め込み層、再帰層及び出力層から構成される
ようにコンピュータを機能させることを特徴とする請求項1から3のいずれか1項に記載のプログラム。 The bilingual encoder and bilingual decoder are based on sequence-to-sequence neural networks,
A bilingual encoder consists of an embedding layer and a recurrence layer,
4. The program according to any one of claims 1 to 3, wherein the bilingual decoder causes the computer to function so as to consist of an embedding layer, a recurrence layer and an output layer.
訓練段階として、
エンコーダ-デコーダモデルとして、第1の言語の第1のコーパステキストからコンテキストベクトルを生成する対訳エンコーダと、当該コンテキストベクトルから第1のコーパステキストの対訳となる第2の言語の第2のコーパステキストを出力する対訳デコーダとを学習し、
エンコーダ-デコーダモデルとして、学習用受話文から対訳エンコーダによって生成されたコンテキストベクトルを入力した際に、当該学習用受話文の対話となる学習用応答文から対訳エンコーダによって生成されたコンテキストベクトルを出力するようにニューラルネットワークを学習し、
運用段階として、
対象の受話文から対訳エンコーダによって第1のコンテキストベクトルを生成し、
第1のコンテキストベクトルからニューラルネットワークによって第2のコンテキストベクトルを生成し、
第2のコンテキストベクトルから対訳デコーダによって応答文を推論する
ことを特徴とする推論装置。 In an inference device that infers a response sentence to a received sentence,
As a training step,
The encoder-decoder model is a parallel encoder that generates a context vector from a first corpus text in a first language, and a second corpus text in a second language that is a parallel translation of the first corpus text from the context vector. Learn the bilingual decoder to output,
As an encoder-decoder model, when a context vector generated by a bilingual encoder from a received training sentence is input, a context vector generated by a bilingual encoder is output from a learning response sentence that is a dialogue of the received training sentence. train the neural network as
As an operational stage,
generating a first context vector from the target received sentence by a bilingual encoder;
generating a second context vector from the first context vector by a neural network;
An inference device that infers a response sentence from a second context vector by a bilingual decoder.
装置は、
訓練段階として、
エンコーダ-デコーダモデルとして、第1の言語の第1のコーパステキストからコンテキストベクトルを生成する対訳エンコーダと、当該コンテキストベクトルから第1のコーパステキストの対訳となる第2の言語の第2のコーパステキストを出力する対訳デコーダとを学習し、
エンコーダ-デコーダモデルとして、学習用受話文から対訳エンコーダによって生成されたコンテキストベクトルを入力した際に、当該学習用受話文の対話となる学習用応答文から対訳エンコーダによって生成されたコンテキストベクトルを出力するようにニューラルネットワークを学習し、
運用段階として、
対象の受話文から対訳エンコーダによって第1のコンテキストベクトルを生成し、
第1のコンテキストベクトルからニューラルネットワークによって第2のコンテキストベクトルを生成し、
第2のコンテキストベクトルから対訳デコーダによって応答文を推論する
ように実行することを特徴とする推論方法。
In an inference method for a device that infers a response sentence to a received sentence,
The device
As a training step,
The encoder-decoder model is a parallel encoder that generates a context vector from a first corpus text in a first language, and a second corpus text in a second language that is a parallel translation of the first corpus text from the context vector. Learn the bilingual decoder to output,
As an encoder-decoder model, when a context vector generated by a bilingual encoder from a received training sentence is input, a context vector generated by a bilingual encoder is output from a learning response sentence that is a dialogue of the received training sentence. train the neural network as
As an operational stage,
generating a first context vector from the target received sentence by a bilingual encoder;
generating a second context vector from the first context vector by a neural network;
A method of inference, comprising inferring a response sentence by a parallel decoder from the second context vector.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2020023845A JP7200154B2 (en) | 2020-02-14 | 2020-02-14 | Program, device and method for inferring response sentences to received sentences |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2020023845A JP7200154B2 (en) | 2020-02-14 | 2020-02-14 | Program, device and method for inferring response sentences to received sentences |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2021128637A JP2021128637A (en) | 2021-09-02 |
JP7200154B2 true JP7200154B2 (en) | 2023-01-06 |
Family
ID=77488846
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2020023845A Active JP7200154B2 (en) | 2020-02-14 | 2020-02-14 | Program, device and method for inferring response sentences to received sentences |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP7200154B2 (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2018028752A (en) | 2016-08-16 | 2018-02-22 | 国立研究開発法人情報通信研究機構 | Dialog system and computer program therefor |
JP2019020893A (en) | 2017-07-13 | 2019-02-07 | 国立研究開発法人情報通信研究機構 | Non-factoid type question answering machine |
-
2020
- 2020-02-14 JP JP2020023845A patent/JP7200154B2/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2018028752A (en) | 2016-08-16 | 2018-02-22 | 国立研究開発法人情報通信研究機構 | Dialog system and computer program therefor |
JP2019020893A (en) | 2017-07-13 | 2019-02-07 | 国立研究開発法人情報通信研究機構 | Non-factoid type question answering machine |
Also Published As
Publication number | Publication date |
---|---|
JP2021128637A (en) | 2021-09-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP6726800B2 (en) | Method and apparatus for human-machine interaction based on artificial intelligence | |
US10878817B2 (en) | Systems and methods for generating comedy | |
US8935163B2 (en) | Automatic conversation system and conversation scenario editing device | |
Milhorat et al. | Building the next generation of personal digital assistants | |
US20190272317A1 (en) | System and method for detecting undesirable and potentially harmful online behavior | |
US10950223B2 (en) | System and method for analyzing partial utterances | |
KR20220124295A (en) | Tailoring an interactive dialog application based on creator provided content | |
US11270082B2 (en) | Hybrid natural language understanding | |
Tarek et al. | Towards highly adaptive edu-chatbot | |
Pichl et al. | Alquist: The alexa prize socialbot | |
KR20190127708A (en) | Talk system and computer program for it | |
Mathur et al. | A scaled‐down neural conversational model for chatbots | |
JP7200154B2 (en) | Program, device and method for inferring response sentences to received sentences | |
Dzakwan et al. | Comparative study of topology and feature variants for non-task-oriented chatbot using sequence to sequence learning | |
KR20100029917A (en) | A converting apparatus and a method for a literary style, a storage means and a service system and a method for automatic chatting | |
JP2022119430A (en) | Program, device and method for inferring sentence in consideration of unknown words | |
JP7191054B2 (en) | Program, device and method for inferring text from multimedia data | |
Nguyen et al. | Natural language generation from Universal Dependencies using data augmentation and pre-trained language models | |
Alam et al. | Adding emotional tag to augment context-awareness in social network services | |
Solanki et al. | Emotion Driven Chatbot Using Natural Language Generation Techniques | |
Sutandijo et al. | Artificial Intelligence Based Automatic Live Stream Chat Machine Translator | |
US11769007B2 (en) | Treebank synthesis for training production parsers | |
Yu et al. | Towards zero-shot functional compositionality of language models | |
Mazza et al. | Behavioural simulator for professional training based on natural language interaction | |
Гирин | Humanization tendencies in Present-day English grammar |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20220118 |
|
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: 20221216 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20221216 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20221221 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 7200154 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |