JP7555702B2 - Text processing apparatus, method, device and computer-readable recording medium - Google Patents
Text processing apparatus, method, device and computer-readable recording medium Download PDFInfo
- Publication number
- JP7555702B2 JP7555702B2 JP2019209175A JP2019209175A JP7555702B2 JP 7555702 B2 JP7555702 B2 JP 7555702B2 JP 2019209175 A JP2019209175 A JP 2019209175A JP 2019209175 A JP2019209175 A JP 2019209175A JP 7555702 B2 JP7555702 B2 JP 7555702B2
- Authority
- JP
- Japan
- Prior art keywords
- attention
- word
- text
- source text
- external information
- 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
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/044—Recurrent networks, e.g. Hopfield networks
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Health & Medical Sciences (AREA)
- Computing Systems (AREA)
- Biomedical Technology (AREA)
- Biophysics (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Evolutionary Computation (AREA)
- Life Sciences & Earth Sciences (AREA)
- Molecular Biology (AREA)
- Artificial Intelligence (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Health & Medical Sciences (AREA)
- Machine Translation (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Description
本開示はテキスト処理分野に関し、より具体的には、テキスト処理装置、方法、デバイス及びコンピュータ読み取り可能な記録媒体に関する。 The present disclosure relates to the field of text processing, and more specifically to a text processing apparatus, method, device, and computer-readable recording medium.
従来のテキスト処理では、テキスト変換、テキスト生成等のプロセスにおいて、入力されたソーステキストを処理することで最終的なテキスト処理結果を取得することができる。 In conventional text processing, the final text processing result can be obtained by processing the input source text in processes such as text conversion and text generation.
いくつかの場合には、さらに理想的な結果が得られるように、ユーザはテキスト処理プロセスのために何らかの外部情報を指定することができる。このような外部情報は、ユーザが指定したテキストにおける重要な情報であってもよいし、ソーステキストに関連付けられる他のテキスト情報であってもよい。このような外部情報がテキスト処理結果に表れる可能性をより高くするためには、テキスト処理プロセスにおいて外部情報を十分に考慮したテキスト処理方法が必要となる。 In some cases, the user can specify some external information for the text processing process to obtain more ideal results. Such external information may be important information in the text specified by the user, or other text information associated with the source text. To increase the possibility that such external information will appear in the text processing results, a text processing method is required that fully takes the external information into account in the text processing process.
テキスト処理プロセスにおいて外部情報を十分に考慮するために、本開示では、テキスト処理方法、装置、デバイス及びコンピュータ読み取り可能な記録媒体を提供する。 To fully take external information into account in the text processing process, the present disclosure provides a text processing method, apparatus, device, and computer-readable recording medium.
本開示の一態様によれば、ソーステキスト符号化隠れ状態を取得するためにソーステキストを符号化するように構成される符号化部と、復号化隠れ状態を決定するように構成される復号化部と、外部情報、前記ソーステキスト隠れ状態及び前記復号化隠れ状態に基づいて現在タイムステップのアテンション分布を決定するように構成されるアテンション生成部と、出力単語を決定するために、前記アテンション分布、前記ソーステキスト隠れ状態、前記復号化隠れ状態に基づいて出力単語確率分布を決定するように構成される出力部とを含むテキスト処理装置が提供される。 According to one aspect of the present disclosure, there is provided a text processing device including an encoding unit configured to encode a source text to obtain a source text encoded hidden state, a decoding unit configured to determine a decoded hidden state, an attention generation unit configured to determine an attention distribution for a current time step based on external information, the source text hidden state, and the decoded hidden state, and an output unit configured to determine an output word probability distribution based on the attention distribution, the source text hidden state, and the decoded hidden state to determine an output word.
一部の実施例において、前記アテンション生成部は、前記ソーステキスト符号化隠れ状態及び前記復号化隠れ状態に基づいて前記ソーステキストの符号化アテンション分布を決定し、前記外部情報に基づいて、前記ソーステキストに対する、前記ソーステキストにおける各単語用の選択確率を含む選択確率分布を決定し、前記アテンション分布を取得するために、前記ソーステキストにおける各単語に対して、当該単語の選択確率に基づいて当該単語のアテンションを決定するように構成される。 In some embodiments, the attention generation unit is configured to determine an encoding attention distribution for the source text based on the source text encoding hidden state and the decoded hidden state, determine a selection probability distribution for the source text based on the external information, the selection probability including a selection probability for each word in the source text, and determine, for each word in the source text, attention for the word based on the selection probability of the word to obtain the attention distribution.
一部の実施例において、前記外部情報に基づいて前記ソーステキストの選択確率を決定することは、前記ソーステキストにおける、前記外部情報に含まれる少なくとも1つの単語に対して、当該少なくとも1つの単語の選択確率を少なくとも予め定義された確率値として決定することを含む。 In some embodiments, determining a selection probability of the source text based on the external information comprises determining, for at least one word in the source text that is included in the external information, a selection probability of the at least one word as at least a predefined probability value.
一部の実施例において、前記ソーステキストにおける各単語に対して、当該単語の選択確率に基づいて当該単語のアテンションを決定することは、当該単語の選択確率が所定の選択確率閾値より小さい場合、前記現在タイムステップのアテンション分布における当該単語のアテンションを0と決定し、当該単語の選択確率が所定の選択確率閾値以上である場合、前記現在タイムステップのアテンション分布における当該単語用のアテンションをソーステキストの符号化アテンション分布における当該単語のアテンションとして決定することを含む。 In some embodiments, for each word in the source text, determining the attention for the word based on the selection probability of the word includes determining the attention for the word in the attention distribution for the current time step to be 0 if the selection probability of the word is less than a predetermined selection probability threshold, and determining the attention for the word in the attention distribution for the current time step as the attention for the word in the encoded attention distribution of the source text if the selection probability of the word is greater than or equal to the predetermined selection probability threshold.
一部の実施例において、前記アテンション分布は、前記外部情報の符号化アテンション分布と、ソーステキストの符号化アテンション分布とを含み、前記符号化部は、さらに、外部情報符号化隠れ状態を取得するために前記外部情報を符号化するように構成され、前記アテンション生成部は、前記外部情報符号化隠れ状態と前記復号化隠れ状態とに基づいて前記外部情報の符号化アテンション分布を決定し、前記ソーステキスト符号化隠れ状態及び前記復号化隠れ状態に基づいて前記ソーステキストのアテンション分布を決定するように構成され、前記出力部は、前記ソーステキスト符号化隠れ状態、前記復号化隠れ状態、前記外部情報の符号化アテンション分布及び前記ソーステキストの符号化アテンション分布に基づいて前記出力単語確率分布を決定するように構成される。 In some embodiments, the attention distribution includes an encoded attention distribution of the external information and an encoded attention distribution of the source text, the encoding unit is further configured to encode the external information to obtain an external information encoded hidden state, the attention generation unit is configured to determine the encoded attention distribution of the external information based on the external information encoded hidden state and the decoded hidden state, and to determine the attention distribution of the source text based on the source text encoded hidden state and the decoded hidden state, and the output unit is configured to determine the output word probability distribution based on the source text encoded hidden state, the decoded hidden state, the encoded attention distribution of the external information, and the encoded attention distribution of the source text.
一部の実施例において、前記出力部は、前記ソーステキスト符号化隠れ状態と前記復号化隠れ状態とに基づいて生成確率分布を決定し、前記外部情報アテンション分布に基づいて前記生成確率分布、前記符号化アテンション分布及び前記外部情報アテンション分布用の重み係数を決定し、前記出力単語確率分布を決定するために、前記重み係数に基づいて前記生成確率分布、前記符号化アテンション分布及び前記外部情報アテンション分布を加算するように構成される。 In some embodiments, the output unit is configured to determine a generation probability distribution based on the source text encoded hidden state and the decoded hidden state, determine weighting factors for the generation probability distribution, the encoding attention distribution, and the extrinsic information attention distribution based on the extrinsic information attention distribution, and add the generation probability distribution, the encoding attention distribution, and the extrinsic information attention distribution based on the weighting factors to determine the output word probability distribution.
一部の実施例において、前記符号化部、前記アテンション生成部及び前記復号化部は、トレーニングソーステキスト符号化隠れ状態を取得するためにトレーニングソーステキストを符号化するステップと、トレーニング復号化隠れ状態を決定するステップと、前記外部情報、前記トレーニングソーステキスト符号化隠れ状態及び前記トレーニング復号化隠れ状態に基づいて現在タイムステップのトレーニングアテンション分布を決定するステップと、トレーニング出力単語を決定するために、前記トレーニングアテンション分布、前記トレーニングソーステキスト符号化隠れ状態、前記トレーニング復号化隠れ状態に基づいてトレーニング出力単語確率分布を決定するステップと、前記トレーニング出力単語と前記外部情報に含まれる単語との間の差異が最小となるように、前記符号化部、前記アテンション生成部、前記復号化部におけるパラメータを調整するステップとによってトレーニングされる。 In some embodiments, the encoding unit, the attention generation unit, and the decoding unit are trained by the steps of: encoding a training source text to obtain a training source text encoding hidden state; determining a training decoding hidden state; determining a training attention distribution for a current time step based on the external information, the training source text encoding hidden state, and the training decoding hidden state; determining a training output word probability distribution based on the training attention distribution, the training source text encoding hidden state, and the training decoding hidden state to determine training output words; and adjusting parameters in the encoding unit, the attention generation unit, and the decoding unit so that the difference between the training output words and the words included in the external information is minimized.
本開示の他の態様によれば、ソーステキスト符号化隠れ状態を取得するために、ソーステキストを符号化するステップと、復号化隠れ状態を決定するステップと、前記外部情報、前記ソーステキスト隠れ状態及び前記復号化隠れ状態に基づいて現在タイムステップのアテンション分布を決定するステップと、出力単語を決定するために、前記アテンション分布、前記ソーステキスト隠れ状態、前記復号化隠れ状態に基づいて出力単語確率分布を決定するステップとを含むテキスト処理方法が提供される。 According to another aspect of the present disclosure, there is provided a text processing method including the steps of: encoding a source text to obtain a source text encoded hidden state; determining a decoded hidden state; determining an attention distribution for a current time step based on the external information, the source text hidden state, and the decoded hidden state; and determining an output word probability distribution based on the attention distribution, the source text hidden state, and the decoded hidden state to determine an output word.
一部の実施例において、前記外部情報、前記ソーステキスト符号化隠れ状態及び前記復号化隠れ状態に基づいて現在タイムステップのアテンション分布を決定するステップは、前記ソーステキスト符号化隠れ状態と前記復号化隠れ状態とに基づいて前記ソーステキストの符号化アテンション分布を決定するステップと、前記外部情報に基づいて前記ソーステキストに対する、前記ソーステキストにおける各単語用の選択確率を含む選択確率分布を決定するステップと、前記アテンション分布を取得するために、前記ソーステキストにおける各単語に対して、当該単語の選択確率に基づいて当該単語のアテンションを決定するステップとを含む。 In some embodiments, determining an attention distribution for the current time step based on the external information, the source text coding hidden state, and the decoded hidden state includes determining an encoding attention distribution for the source text based on the source text coding hidden state and the decoded hidden state, determining a selection probability distribution for the source text based on the external information, the selection probability including a selection probability for each word in the source text, and determining, for each word in the source text, an attention for the word based on the selection probability of the word to obtain the attention distribution.
一部の実施例において、前記外部情報に基づいて前記ソーステキストの選択確率を決定するステップは、前記ソーステキストにおける、前記外部情報に含まれる少なくとも1つの単語に対して、当該少なくとも1つの単語の選択確率を少なくとも予め定義された確率値として決定するステップを含む。 In some embodiments, determining the selection probability of the source text based on the external information comprises determining, for at least one word in the source text that is included in the external information, a selection probability of the at least one word as at least a predefined probability value.
一部の実施例において、前記ソーステキストにおける各単語に対して、当該単語の選択確率に基づいて当該単語のアテンションを決定するステップは、当該単語の選択確率が所定の選択確率閾値より小さい場合、前記現在タイムステップのアテンション分布における当該単語のアテンションを0と決定するステップと、当該単語の選択確率が所定の選択確率閾値以上である場合、前記現在タイムステップのアテンション分布における当該単語用のアテンションをソーステキストの符号化アテンション分布における当該単語のアテンションとして決定するステップとを含む。 In some embodiments, for each word in the source text, determining the attention of the word based on the selection probability of the word includes determining the attention of the word in the attention distribution of the current time step as 0 if the selection probability of the word is less than a predetermined selection probability threshold, and determining the attention for the word in the attention distribution of the current time step as the attention of the word in the encoded attention distribution of the source text if the selection probability of the word is greater than or equal to the predetermined selection probability threshold.
一部の実施例において、前記アテンション分布は、外部情報の符号化アテンション分布とソーステキストの符号化アテンション分布とを含み、前記符号化は、さらに、外部情報符号化隠れ状態を取得するために前記外部情報を符号化するステップを含み、前記外部情報、前記ソーステキスト符号化隠れ状態及び前記復号化隠れ状態に基づいて現在タイムステップのアテンションを決定するステップは、前記外部情報符号化隠れ状態と前記復号化隠れ状態とに基づいて前記外部情報の符号化アテンション分布を決定し、前記ソーステキスト符号化隠れ状態と前記復号化隠れ状態とに基づいて前記ソーステキストのアテンション分布を決定するステップと、前記ソーステキスト符号化隠れ状態、前記復号化隠れ状態、前記外部情報の符号化アテンション分布及び前記ソーステキストの符号化アテンション分布に基づいて前記出力単語確率分布を決定するステップとを含む。 In some embodiments, the attention distribution includes an encoded attention distribution of extrinsic information and an encoded attention distribution of source text, and the encoding further includes encoding the extrinsic information to obtain an extrinsic information encoded hidden state, and determining the attention for the current time step based on the extrinsic information, the source text encoded hidden state, and the decoded hidden state includes determining the encoded attention distribution of the extrinsic information based on the extrinsic information encoded hidden state and the decoded hidden state, determining the attention distribution of the source text based on the source text encoded hidden state and the decoded hidden state, and determining the output word probability distribution based on the source text encoded hidden state, the decoded hidden state, the encoded attention distribution of the extrinsic information, and the encoded attention distribution of the source text.
一部の実施例において、出力単語を決定するために、前記アテンション分布、前記ソーステキスト符号化隠れ状態及び前記復号化隠れ状態に基づいて単語確率分布を決定するステップは、前記ソーステキスト符号化隠れ状態と前記復号化隠れ状態とに基づいて生成確率分布を決定するステップと、前記外部情報アテンション分布に基づいて前記生成確率分布、前記符号化アテンション分布及び前記外部情報アテンション分布用の重み係数を決定するステップと、前記出力単語確率分布を決定するために、前記重み係数に基づいて前記生成確率分布、前記符号化アテンション分布及び前記外部情報アテンション分布を加算するステップとを含む。 In some embodiments, determining a word probability distribution based on the attention distribution, the source text coding hidden state, and the decoded hidden state to determine an output word includes determining a generation probability distribution based on the source text coding hidden state and the decoded hidden state, determining weighting factors for the generation probability distribution, the coding attention distribution, and the extrinsic information attention distribution based on the extrinsic information attention distribution, and adding the generation probability distribution, the coding attention distribution, and the extrinsic information attention distribution based on the weighting factors to determine the output word probability distribution.
本開示のまた別の一態様によれば、プロセッサと、コンピュータ読み取り可能なプログラミングコマンドを記憶したメモリと、を含み、前記コンピュータ読み取り可能なプログラミングコマンドが前記プロセッサによって実行される場合、前記のようなテキスト処理方法を実行するテキスト処理デバイスが提供される。 According to yet another aspect of the present disclosure, there is provided a text processing device including a processor and a memory storing computer-readable programming commands, the text processing device performing the above-described text processing method when the computer-readable programming commands are executed by the processor.
本開示のさらに別の一態様によれば、コンピュータによって実行される場合、前記コンピュータが前記のようなテキスト処理方法を実行するコンピュータ読み取り可能なコマンドが記録されるコンピュータ読み取り可能な記録媒体が提供される。 According to yet another aspect of the present disclosure, there is provided a computer-readable recording medium having recorded thereon computer-readable commands that, when executed by a computer, cause the computer to perform the text processing method as described above.
本開示にかかるテキスト処理方法、装置、デバイス及びコンピュータ読み取り可能な記録媒体を利用することにより、テキストの生成プロセスにおいて、外部情報を利用して現在タイムステップのアテンション分布を決定する、及び/又は外部情報に基づいて現在タイムステップの出力単語を決定することで、テキスト処理プロセスにおいて外部情報の内容を効果的に考慮し、テキスト生成プロセスにおいて外部情報を生成する確率を向上させることができ、外部情報を考慮した場合、テキストを生成する効果を向上させることができる。 By utilizing the text processing method, apparatus, device, and computer-readable recording medium disclosed herein, in the text generation process, the attention distribution for the current time step is determined using external information, and/or the output words for the current time step are determined based on the external information, thereby effectively taking the content of the external information into account in the text processing process, improving the probability of generating the external information in the text generation process, and improving the effectiveness of generating text when the external information is taken into account.
図面を参照して本開示の実施例についてより詳細に説明する。本開示の上記及びその他の目的、特徴及び利点がさらに明らかになる。図面は本開示の実施例に対する理解をさらに深めるためのものであって、明細書の一部として本開示実施例とともに本開示を解釈するために用いられ、本開示を制限するものではない。図面において、同一の符号は通常同じ部品又はステップを示している。 The embodiments of the present disclosure will be described in more detail with reference to the drawings. The above and other objects, features and advantages of the present disclosure will become more apparent. The drawings are intended to provide a deeper understanding of the embodiments of the present disclosure, and are used to interpret the present disclosure together with the embodiments of the present disclosure as part of the specification, and are not intended to limit the present disclosure. In the drawings, the same reference numerals generally indicate the same parts or steps.
以下、本開示実施例における図面を参照して、本開示実施例の技術案について明確に、かつ全面的に説明する。記載される実施例が本開示の一部の実施例において、全部の実施例ではないことは明らかである。本開示における実施例に基づいて、当業者が創造的な労働をせずに取得したすべての他の実施例は、本開示の保護範囲に含まれる。 The technical solutions of the embodiments of the present disclosure will be described below clearly and comprehensively with reference to the drawings in the embodiments of the present disclosure. It is clear that the described embodiments are only some of the embodiments of the present disclosure, and not all of the embodiments. All other embodiments obtained by a person skilled in the art based on the embodiments of the present disclosure without creative labor are included in the scope of protection of the present disclosure.
特に定義されない限り、ここで使用される技術的用語又は科学的用語は当業者が理解する通常の意味である。本願で使用される「第一」、「第二」及びそれに類似する単語は何らかの順序、数又は重要性を示すわけではなく、単に異なる構成部分を区別するためのものである。同様に、「含む」や「含まれる」等、それに類似する単語は、当該単語の前に現れる部品或いはものは、当該単語の後に挙げられる部品或いはもの、及びその均等物を含むことを指し、他の部品或いはものを排除しない。「接続する」や「互いに接続する」等、それに類似する単語は、物理的或いは機械的な接続に限定されず、直接的か間接的かを問わず、電気的接続をも含む。「上」、「下」、「左」、「右」等は、単に相対的な位置関係を示すために用いられ、説明対象の絶対的な位置が変わった後、当該相対的な位置もそれに応じて変更される可能性がある。 Unless otherwise defined, technical or scientific terms used herein have the ordinary meaning that one skilled in the art would understand. The words "first", "second" and similar words used herein do not indicate any order, number or importance, but are merely used to distinguish different components. Similarly, words such as "comprise" and "include" and similar words refer to the part or thing that appears before the word including the part or thing listed after the word and its equivalents, and do not exclude other parts or things. Words such as "connect" and "connect to each other" and similar words are not limited to physical or mechanical connections, but also include electrical connections, whether direct or indirect. Words such as "upper", "lower", "left", "right" and the like are used merely to indicate relative positional relationships, and after the absolute position of the described object is changed, the relative positions may be changed accordingly.
以下、テキスト要約の生成を例として本開示の原理について説明する。しかしながら、本開示の原理から逸脱しない限り、本開示によって提供される方法は、例えば、テキスト変換プロセス、機械翻訳プロセス等、他のテキスト処理プロセスに適用されてもよいことは、当業者が理解しうる。 Below, the principles of the present disclosure are described using the generation of a text summary as an example. However, those skilled in the art will appreciate that the method provided by the present disclosure may be applied to other text processing processes, such as, for example, a text conversion process, a machine translation process, etc., without departing from the principles of the present disclosure.
図1は、本開示にかかるテキスト処理装置の概略的なブロック図を示している。図1に示すように、テキスト処理装置100は、符号化部110と、復号化部120と、アテンション生成部130と、出力部140と、を含んでもよい。テキスト処理装置100は、ソーステキストIに対してテキスト処理を行って、対応するテキスト処理結果を生成することができる。例えば、テキスト処理装置100を利用してソーステキストI用の要約を生成してもよい。ソーステキストIは、少なくとも1つの文を含んでもよく、各文は少なくとも1つの単語を含む。
FIG. 1 shows a schematic block diagram of a text processing device according to the present disclosure. As shown in FIG. 1, the
本開示によって提供されるテキスト処理装置100は、外部情報を受信し、外部情報に基づいてソーステキストに対するテキスト処理プロセスを実行することができる。一部の実施例において、外部情報とは、予め定義された、ソーステキストの処理結果として期待されるテキスト情報を指す。一部の例において、外部情報は、ソーステキストにおける少なくとも1つの単語又は文である。他の一部の例において、外部情報は、ソーステキストにおける、所定位置の単語又は文であり、例えば、ソーステキストの先頭の文、最後の文、又は任意の他の指定位置のテキスト情報である。また他の一部の例において、外部情報はソーステキストに関連付けられる追加テキストである。例えば、ソーステキストのタイトルである。ある実現形態において、外部情報は、ユーザの入力に基づいて決定される追加テキストであってもよい。本願はここで外部情報の決定方法について限定しない。実際には、テキスト処理プロセスに使用する外部情報をいかなる可能な方法で決定してもよい。
The
テキスト処理装置100を利用してソーステキストを処理する場合、テキスト処理の各段階で外部情報を考慮することで、外部情報がテキスト処理結果に表れる確率を高めることができる。例えば、ソーステキストにおける文章のタイトルが外部情報として決定された場合、本願によって提供されるテキスト処理装置100から出力されるソーステキストの要約に、文章タイトルにおける単語及び/又は文が必ず現れるか又は現れる可能性が極めて高い。
When processing source text using the
コンピュータでテキスト処理方法を実行する場合、コンピュータは、往々にしてテキストデータを直接に処理できないため、ソーステキスト及び/又は外部情報を処理するとき、まずソーステキストを数値データに変換する必要がある。 When performing text processing methods on a computer, the computer often cannot process text data directly, so when processing source text and/or external information, the source text must first be converted into numerical data.
一部の実施例において、ソーステキストIは自然言語の形で実装される。この場合、テキスト処理装置100は、前処理部(図示せず)をさらに含んでもよい。前処理部は、ソーステキストが符号化部に入力される前にソーステキストを数値データに変換するために用いられてもよい。例えば、ソーステキストIにおける各文に対して単語分割処理を実行することで、各文を複数の単語に分割してもよい。その後、例えば、単語埋め込み(word embedding)の方法で単語分割処理によって得られた複数の単語をそれぞれ特定次元の単語ベクトルに変換してもよい。
In some embodiments, the source text I is implemented in the form of a natural language. In this case, the
同様に、外部情報に対応する少なくとも1つの単語ベクトルを取得してその後のテキスト処理に用いるために、外部情報を変換してもよい。 Similarly, the external information may be transformed to obtain at least one word vector corresponding to the external information for subsequent text processing.
一部の実施例において、本開示にかかるソーステキストIは、数値データの形で実現されてもよく、例えば、少なくとも1つの単語ベクトルでソーステキストIを示してもよい。この場合、符号化部110でソーステキストIを直接処理してもよい。テキスト処理装置100から独立して設けられる前処理装置で自然言語に対して前処理を行ってもよい。
In some embodiments, the source text I according to the present disclosure may be realized in the form of numerical data, for example, the source text I may be represented by at least one word vector. In this case, the source text I may be directly processed by the
以下は、外部情報とソーステキストとが自然言語の形であるか、又は数値データの形であるかを区別せず、コンピュータを利用して自然言語の形の外部情報及び/又はソーステキストを処理する必要がある場合、当業者は、必要に応じて自然言語の形の外部情報及び/又はソーステキストを数値データに変換してもよい。 In the following, no distinction is made between whether the external information and the source text are in the form of natural language or in the form of numerical data, and when it is necessary to process the external information and/or the source text in the form of natural language using a computer, a person skilled in the art may convert the external information and/or the source text in the form of natural language into numerical data as necessary.
符号化部110は、ソーステキスト符号化隠れ状態hを取得するために、処理対象であるソーステキストIを符号化するように構成されてもよい。
The
一部の実施例において、符号化部110は符号化ネットワークとして実装されてもよい。例示的な符号化ネットワークは、長・短期記憶(LSTM)ネットワークを含み、LSTMネットワークシステムは、例えば、機械翻訳、テキスト要約生成等のタスクに適用されてもよい。なお、符号化ネットワークは、単語ベクトルを符号化可能ないかなる機械学習モデルとして実装されてもよい。
In some embodiments, the
例えば、ソーステキストIに対応する少なくとも1つの単語ベクトルを入力とする場合、符号化部は、各単語ベクトルx1、x2、x3…にそれぞれ対応するソーステキスト符号化隠れ状態h1、h2、h3…を出力してもよい。ソーステキスト符号化隠れ状態の数とソーステキストの単語ベクトルの数は同じであってもよいし、異なってもよい。例えば、ソーステキストIに基づいてk個の単語ベクトルを生成する場合、符号化部は、k個の対応するソーステキスト符号化隠れ状態を生成するために、これらk個の単語ベクトルを処理してもよい。kは1より大きい整数である。 For example, given at least one word vector corresponding to a source text I as input, the encoder may output source text encoded hidden states h1 , h2, h3... corresponding to each word vector x1, x2 , x3 ... respectively . The number of source text encoded hidden states and the number of source text word vectors may be the same or different. For example, to generate k word vectors based on a source text I, the encoder may process these k word vectors to generate k corresponding source text encoded hidden states, where k is an integer greater than 1.
復号化部120は、復号化隠れ状態sを決定するために用いられてもよい。一部の実施例において、復号化部120は、現在タイムステップの復号化隠れ状態stを取得するために、直前のタイムステップt-1の復号化隠れ状態st-1、及び直前のタイムステップでテキスト処理装置が取得した出力単語xtを受信し、st-1とxtとを処理してもよい。先頭のタイムステップの処理において、s0及びx1がデフォルトの初期値として決定されてもよい。復号化隠れ状態sはソーステキストIに対応する複数の復号化隠れ状態s1、s2、s3…を含んでもよい。
The
一部の実施例において、復号化部120は、復号化ネットワークとして実装されてもよい。例示的な復号化ネットワークは長・短期記憶ネットワークを含む。なお、復号化ネットワークは、符号化ネットワークの出力を復号化可能ないかなる機械学習モデルとして実装されてもよい。
In some embodiments, the
一部の実施例において、前期符号化ネットワーク及び復号化ネットワークは、シーケンス・ツー・シーケンスモデル(Sequence to Sequence, Seq2Seq)で示すことができ、1つの入力系列、(例えば、入力テキストとしての)例えば「WXYZ」をもう1つの出力系列、(例えば、テキスト要約としての)例えば「AXY」に変換することを実現するために用いられてもよい。 In some embodiments, the encoding and decoding networks may be represented as a sequence to sequence (Seq2Seq) model, which may be used to convert one input sequence, e.g., "WXYZ" (e.g., as input text), to another output sequence, e.g., "AXY" (e.g., as a text summary).
アテンション生成部130は、前記ソーステキスト符号化隠れ状態hと前記復号化隠れ状態sとに基づいてアテンション分布Aを決定し、現在タイムステップの後続のテキスト処理プロセスのためのアテンション分布Aを出力するように構成されてもよい。
The
一部の実施例において、現在タイムステップtのアテンション分布Atは、ソーステキストの符号化アテンション分布であってもよい。 In some implementations, the attention distribution A t at the current time step t may be the encoded attention distribution of the source text.
一部の実装形態において、各タイムステップ(time step)tで現在タイムステップのソーステキスト符号化隠れ状態htと復号化隠れ状態stとを利用して現在タイムステップのソーステキストの符号化アテンション分布atを決定してよい。例えば、式(1)、(2)を利用してソーステキストの符号化アテンション分布atを決定してもよい。
at=softmax(et) (1)
tは現在タイムステップを示し、softmaxは正規化指数関数を示し、etは式(2)によって下記のように決定される。
at = softmax( et ) (1)
t denotes the current time step, softmax denotes the normalized exponential function, and e t is determined by equation (2) as follows:
他の一部の実施例において、アテンション生成部130は、外部情報及び式(1)によって決定されるソーステキストのアテンション分布atに基づいて、外部情報を含む現在タイムステップのアテンション分布Atを決定し、後続の各部の処理プロセスのための、外部情報を含むアテンション分布Atを出力してもよい。
In some other embodiments, the
一部の実装形態において、外部情報を含む現在タイムステップのアテンション分布Atは、外部情報を利用してソーステキストのアテンション分布atを調整した後に決定されるものであってもよい。 In some implementations, the attention distribution A t for the current time step including external information may be determined after adjusting the attention distribution a t for the source text using the external information.
他の一部の実施方法において、外部情報を含む現在タイムステップのアテンション分布Atは、ソーステキストのアテンション分布atと外部情報のアテンション分布a’tの双方を含んでもよい。 In some other implementations, the attention distribution A t of the current time step including external information may include both the attention distribution a t of the source text and the attention distribution a′ t of the external information.
以下、図3A、図3B及び図4を参照して外部情報を含むアテンション分布Atの決定プロセスについて説明するため、ここでは詳しく説明しない。 The process of determining the attention distribution A t including external information will be described below with reference to FIGS. 3A, 3B, and 4, and will not be described in detail here.
出力部140は、現在タイムステップの出力単語Oを決定するために、前記アテンション分布A、前記ソーステキスト符号化隠れ状態h、前記復号化隠れ状態sに基づいて出力単語確率分布を決定するように構成されてもよい。 The output unit 140 may be configured to determine an output word probability distribution based on the attention distribution A, the source text encoding hidden state h, and the decoding hidden state s to determine an output word O for the current time step.
出力単語確率分布は、生成確率分布Pvocabを含んでもよい。式(3)及び式(4)によって生成確率分布Pvocabを決定してもよい。
一部の実施例において、出力単語確率分布はアテンション生成部130から出力されるアテンション分布Atを含んでもよい。
In some implementations, the output word probability distribution may include the attention distribution A t output from the
例えば、前記生成確率分布と前記アテンション分布Aとを重み付け加算することで出力単語確率分布を決定してもよい。 For example, the output word probability distribution may be determined by weighting the generated probability distribution and the attention distribution A.
一部の実装形態において、現在タイムステップのソーステキスト符号化隠れ状態、復号化隠れ状態、アテンション分布及び現在タイムステップの復号化部の入力xtに基づいて生成確率分布及びアテンション分布用の重み係数Pgenを決定してもよい。 In some implementations, weighting factors Pgen for the generating probability distributions and attention distributions may be determined based on the source text encoded hidden state of the current time step, the decoded hidden state, the attention distribution and the decoder input xt of the current time step.
例えば、前記生成確率分布及び前記アテンション分布に対して重み付け加算を行うための重み係数Pgenは、式(5)によって示されてもよい。
アテンション分布Atにソーステキストのアテンション分布atと外部情報のアテンション分布a’tの双方が含まれる場合、ソーステキストのアテンション分布atと外部情報のアテンション分布a’tとの重み係数パラメータは同じであってもよく、異なってもよい。以下、図4を参照して、生成確率分布Pvocab、ソーステキストのアテンション分布at及び外部情報のアテンション分布a’tの重み係数パラメータをそれぞれ決定する方法について説明するため、ここでは詳しく説明しない。 When the attention distribution A t includes both the attention distribution a t of the source text and the attention distribution a′ t of the external information, the weighting coefficient parameters of the attention distribution a t of the source text and the attention distribution a′ t of the external information may be the same or different. Hereinafter, the method of determining the weighting coefficient parameters of the generation probability distribution P vocab , the attention distribution a t of the source text, and the attention distribution a′ t of the external information will be described with reference to FIG. 4, and will not be described in detail here.
一部の実施例において、出力部140は、出力単語確率分布における確率の最も高い単語を現在タイムステップの出力単語に決定してもよい。 In some embodiments, the output unit 140 may determine the word with the highest probability in the output word probability distribution as the output word for the current time step.
他の一部の実施例において、出力部140は、外部情報に基づいて単語確率分布を決定して出力し、現在タイムステップの出力単語を決定してもよい。 In some other embodiments, the output unit 140 may determine and output a word probability distribution based on external information to determine the output word for the current time step.
一部の実装形態において、出力部140は、前記外部情報に基づいて、前記候補出力単語のうち、確率が出力確率閾値以上でありかつ前記外部情報に含まれる単語を現在タイムステップの候補出力単語として決定する。一部の例において、出力部140は、ビームサーチの原則を利用して前記候補出力単語を決定してもよい。 In some implementations, the output unit 140 determines, based on the external information, among the candidate output words, a word whose probability is equal to or greater than an output probability threshold and is included in the external information as a candidate output word for the current time step. In some examples, the output unit 140 may determine the candidate output word by using a beam search principle.
例えば、出力部140は、各タイムステップで少なくとも2つの単語を現在タイムステップの候補出力単語として決定し、その後、候補出力単語を次のタイムステップのテキスト処理プロセスにおいて使用するようにしてもよい。同様に、次のタイムステップにおいても出力部140は少なくとも2つの候補出力単語を決定してもよい。 For example, the output unit 140 may determine at least two words at each time step as candidate output words for the current time step, and then use the candidate output words in the text processing process for the next time step. Similarly, the output unit 140 may determine at least two candidate output words for the next time step.
具体的には、候補出力単語の数が2であることを例として、タイムステップtで2つの候補出力単語a、bを出力することができる。その後、候補出力単語a、bを次のタイムステップのテキスト処理プロセスに使用し、タイムステップt+1の候補出力単語c、dを決定することができる。 Specifically, for example, taking the number of candidate output words as two, two candidate output words a and b can be output at time step t. Then, the candidate output words a and b can be used in the text processing process of the next time step to determine the candidate output words c and d at time step t+1.
図2A及び図2Bでは、本願の実施例にかかる出力確率分布に基づいて候補出力単語を決定する例示的な実施例を示している。 2A and 2B show an example embodiment of determining candidate output words based on an output probability distribution according to an embodiment of the present application.
一部の実施例において、各タイムステップの候補出力単語を決定する場合、出力確率分布における出力確率の最も高い所定数のM個(上記の例では、Mは2である)の単語を候補出力単語として決定する。Mは2以上の整数である。 In some embodiments, when determining candidate output words for each time step, a predetermined number M (in the above example, M is 2) of words with the highest output probability in the output probability distribution are determined as candidate output words. M is an integer equal to or greater than 2.
図2Aに示している出力単語確率分布で出力確率の最も高い2つの単語はw3とw11であり、そのためw3とw11を候補出力単語として決定する。 The two words with the highest output probabilities in the output word probability distribution shown in Figure 2A are w3 and w11, so w3 and w11 are determined as candidate output words.
他の一部の実施例において、各タイムステップの候補出力単語を決定する場合、事前定義の方法で出力確率分布における出力確率の最も高いN個の単語を選出して決定し、これらN個の単語のうちM個の単語を候補出力単語として決定する。NはMより大きい整数である。一部の実装形態において、事前にNの数値を特定してもよい。 In some other embodiments, when determining candidate output words for each time step, N words with the highest output probability in the output probability distribution are selected and determined in a predefined manner, and M words out of these N words are determined as candidate output words. N is an integer greater than M. In some implementations, the value of N may be specified in advance.
他の一部の実施方法において、事前に出力確率閾値を決定し、かつ出力確率が前記出力確率閾値より大きいN個の単語のうちM個の単語を候補出力単語として決定してもよい。 In some other implementation methods, an output probability threshold may be determined in advance, and M words out of N words whose output probabilities are greater than the output probability threshold may be determined as candidate output words.
出力確率の最も高いN個の単語のうち外部情報に含まれる単語が存在しない場合、これらのN個の単語のうち出力確率の最も高いM個の単語を候補出力単語として決定してもよい。 If there is no word included in the external information among the N words with the highest output probabilities, the M words with the highest output probabilities among these N words may be determined as candidate output words.
出力確率の最も高いN個の単語のうち外部情報に含まれる単語が存在する場合、これらのN個の単語に存在する、外部情報に含まれる単語数nがM以上であれば、これらのN個の単語のうち出力確率の最も高くかつ外部情報に含まれるM個の単語を候補出力単語として決定し、N個の単語に存在する、外部情報に含まれる単語数nが所定数Mより小さいであれば、N個の単語のうち外部情報に含まれる単語、及び残りのN-n個の単語のうち出力確率の最も高いM-n個の単語を候補出力単語として決定する。 When there is a word included in the external information among the N words with the highest output probability, if the number n of words included in the external information that are present in these N words is M or more, the M words included in the external information that have the highest output probability among these N words are determined as candidate output words, and if the number n of words included in the external information that are present in the N words is smaller than a predetermined number M, the word included in the external information among the N words and the M-n words with the highest output probability among the remaining N-n words are determined as candidate output words.
図2Bに示すように、出力単語確率分布における最も高い2個の単語はw3とw11であり、出力確率が予め設定した出力確率閾値より大きい単語にはw3、w7及びw11が含まれ、w2とw7は、外部情報に含まれる。 As shown in FIG. 2B, the two highest words in the output word probability distribution are w3 and w11, and the words with output probabilities greater than the preset output probability threshold include w3, w7, and w11, and w2 and w7 are included in the external information.
この場合、w7が外部情報に含まれかつw7の出力確率が出力確率閾値より大きいため、出力確率がより高いw3を選択するのではなく、w7とw11を候補出力単語として選択する。 In this case, since w7 is included in the external information and the output probability of w7 is greater than the output probability threshold, w7 and w11 are selected as candidate output words rather than selecting w3, which has a higher output probability.
このような方法で外部情報における単語が出力単語として決定される確率を高めることができる。 In this way, the probability that a word in the external information will be determined as the output word can be increased.
タイムステップtに出力した候補出力単語a、bとタイムステップt+1の候補出力単語c、dとを利用して少なくとも4個の出力候補系列ac、ad、bc、bdを決定でき、同時確率の方法で各出力候補系列の出力確率を決定し、4個の出力系列ac、ad、bc、bd候補のうち出力確率の最も高い2つをタイムステップt+1の後の候補テキストとして決定する。 At least four output candidate sequences ac, ad, bc, bd can be determined using the candidate output words a, b output at time step t and the candidate output words c, d at time step t+1, and the output probability of each output candidate sequence is determined using a joint probability method, and the two with the highest output probabilities among the four output sequence candidates ac, ad, bc, bd are determined as candidate texts after time step t+1.
例えば、候補出力単語a、b、c、dの出力確率はそれぞれPa、Pb、Pc及びPdで示すことができる。出力候補系列ac、ad、bc、bdはそれぞれPac=Pa*Pc、Pad=Pa*Pd、Pbc=Pb*Pc、及びPbd=Pb*Pdで示すことができる。Pac>Pad>Pbc>Pbdである場合、タイムステップt+1で出力系列ac、adを後続のテキスト処理に使用する。 For example, the output probabilities of candidate output words a, b, c, d can be denoted as Pa , Pb , Pc , and Pd , respectively. The output candidate sequences ac, ad, bc, bd can be denoted as Pa = Pa * Pc , Pa = Pa * Pd , Pbc = Pb * Pc , and Pbd = Pb * Pd, respectively. If Pa > Pa > Pb > Pbd , the output sequences ac, ad are used for subsequent text processing at time step t+1.
一部の実施例において、さらに外部情報に基づいて出力候補系列を決定してもよい。例えば、式(6)を利用して出力候補系列のペナルティ値を決定できる。式(6)によって決定されるペナルティ値は、出力候補系列の同時出力確率を調整することができる。
一実装形態において、いかなる可能なテキスト類似度アルゴリズムでタイムステップtの前に生成した候補テキスト系列と外部情報との間の類似度を決定してもよい。例えば、コサイン類似度の方法を使用してタイムステップtの前に生成した候補テキスト系列と外部情報との間の類似度を決定することができる。 In one implementation, any possible text similarity algorithm may be used to determine the similarity between the candidate text sequences generated before time step t and the external information. For example, a cosine similarity method may be used to determine the similarity between the candidate text sequences generated before time step t and the external information.
上記式(6)を利用して、タイムステップtの前に生成された候補テキスト系列と外部情報との間の類似度が高いほど、ペナルティ値は、出力候補系列の出力確率を増やすために用いられる。一部の実装形態において、ペナルティ値s(x,y)と出力候補系列における出力確率とを乗算又は加算し、タイムステップtの前に生成された候補テキスト系列と外部情報との間の類似度に基づいて出力候補系列を決定する効果を実現することができる。 Using the above formula (6), the higher the similarity between the candidate text sequence generated before time step t and the external information, the more the penalty value is used to increase the output probability of the output candidate sequence. In some implementations, the penalty value s(x,y) can be multiplied or added to the output probability in the output candidate sequence to achieve the effect of determining the output candidate sequence based on the similarity between the candidate text sequence generated before time step t and the external information.
即ち、外部情報に基づいて上記出力候補系列に使用されるペナルティ値を決定することにより、外部情報が候補テキスト系列に現れる確率を高めることができる。それによって、外部情報が最終的に出力されるテキスト処理結果に表れる確率を高めることができる。 That is, by determining the penalty value to be used for the output candidate sequence based on external information, the probability that the external information will appear in the candidate text sequence can be increased, thereby increasing the probability that the external information will appear in the final output text processing result.
他の実装形態において、前記出力部は、さらに外部情報と前記ソーステキスト符号化隠れ状態との間の類似度を決定し、外部情報と前記ソーステキスト符号化隠れ状態との間の類似度に基づいて現在タイムステップで出力しようとする単語を決定するように構成されてもよい。 In another implementation, the output unit may be further configured to determine a similarity between the external information and the source text coding hidden state, and to determine a word to be output at the current time step based on the similarity between the external information and the source text coding hidden state.
例えば、符号化部110を利用して前記外部情報を符号化して、外部情報符号化隠れ状態を取得するようにしてもよい。
For example, the external information may be encoded using the
出力部140は、前記外部情報符号化隠れ状態と前記復号化隠れ状態の類似度を決定するように構成されてもよい。外部情報符号化隠れ状態と前記復号化隠れ状態の類似度が事前定義された類似度閾値以上である場合、前記出力部は、前記外部情報を出力して現在タイムステップの出力とする。 The output unit 140 may be configured to determine a similarity between the extrinsic information encoded hidden state and the decoded hidden state. If the similarity between the extrinsic information encoded hidden state and the decoded hidden state is equal to or greater than a predefined similarity threshold, the output unit outputs the extrinsic information as the output for the current time step.
前記外部情報が単語である場合、前記外部情報を現在タイムステップの単語として出力してもよい。前記外部情報が文である場合、前記外部情報を直接現在タイムステップtの前に生成されたテキスト系列の後に挿入してもよい。 If the extrinsic information is a word, the extrinsic information may be output as the word of the current time step. If the extrinsic information is a sentence, the extrinsic information may be inserted directly after the text sequence generated before the current time step t.
なお、現在タイムステップtの前に既に生成されたテキスト系列は、前記出力確率分布における確率の最も高い単語に基づいて生成されてもよく、出力確率分布における確率の最も高いいくつかの候補出力単語に基づいて生成されてもよい。前記実装方法で説明したプロセスを採用して候補出力単語を決定してもよく、ここでは、詳しく説明しない。 Note that the text sequence already generated before the current time step t may be generated based on the most probable word in the output probability distribution, or may be generated based on some candidate output words with the most probabilities in the output probability distribution. The process described in the implementation method may be adopted to determine the candidate output words, and will not be described in detail here.
外部情報符号化隠れ状態と前記復号化隠れ状態との類似度が事前定義の類似度閾値より小さい場合、前記出力部は復号化部及びアテンション生成部から出力される結果に基づいて現在タイムステップの出力単語確率分布を決定し、現在タイムステップの出力単語確率分布に基づいて現在タイムステップの出力単語を決定する。 If the similarity between the external information encoded hidden state and the decoded hidden state is less than a predefined similarity threshold, the output unit determines an output word probability distribution for the current time step based on the results output from the decoding unit and the attention generation unit, and determines an output word for the current time step based on the output word probability distribution for the current time step.
上記方法を利用して、復号化部から出力される結果と外部情報との間の類似度が比較的高い場合、直接外部情報で復号化部から出力される結果を置き換えてもよい。即ち、この場合、現在タイムステップの出力後に決定したテキスト系列の結果は直前のタイムステップの出力後に決定したテキスト系列の後に外部情報を挿入して得られた結果である。 Using the above method, if the similarity between the result output from the decoding unit and the external information is relatively high, the result output from the decoding unit may be directly replaced with the external information. That is, in this case, the result of the text sequence determined after the output of the current time step is the result obtained by inserting the external information after the text sequence determined after the output of the previous time step.
その後、次のタイムステップの処理を行う場合、復号化部を利用して外部情報を符号化して次のタイムステップの復号化隠れ状態を得て、後続の復号化プロセスが外部情報の結果を利用できるようにすることで、後の復号化で得られた結果と挿入した外部情報との間のセマンティック一貫性を保証することができる。 Then, when processing the next time step, the decoder can use the extrinsic information to encode the extrinsic information to obtain the decoded hidden state of the next time step, so that the subsequent decoding process can use the results of the extrinsic information, thereby ensuring semantic consistency between the results obtained in the subsequent decoding and the inserted extrinsic information.
外部情報が単語である場合、直前のタイムステップの復号化隠れ状態と外部情報を利用して復号化部の入力として処理を行い、現在タイムステップの復号化隠れ状態を取得することができる。 When the external information is a word, the decoded hidden state of the previous time step and the external information are used as input to the decoding unit, and the decoded hidden state of the current time step can be obtained.
外部情報に複数の単語を含む場合、復号化部で数回のループ処理を行う。第1個目のループにおける復号化部の入力は直前のタイムステップの復号化隠れ状態と外部情報の第1個目の単語であり、その後のループにおける復号化部の入力は前回ループで得られた復号化隠れ状態と外部情報の次の単語である。数回のループにより外部情報における単語毎に処理することができ、全ての外部情報を含む復号化隠れ状態を取得して現在タイムステップの復号化隠れ状態とする。 When the external information contains multiple words, the decoding unit performs several loop processes. The inputs to the decoding unit in the first loop are the decoded hidden state of the previous time step and the first word of the external information, and the inputs to the decoding unit in subsequent loops are the decoded hidden state obtained in the previous loop and the next word of the external information. By performing several loops, it is possible to process each word in the external information, and a decoded hidden state containing all the external information is obtained and used as the decoded hidden state for the current time step.
一部の実装形態において、既に外部情報で復号化部から出力される結果を置き換えてテキスト処理結果に挿入した後は、上記外部情報符号化隠れ状態と前記復号化隠れ状態との類似度比較を実行しない。 In some implementations, after the external information has already replaced the result output by the decoding unit and been inserted into the text processing result, the similarity comparison between the external information encoded hidden state and the decoded hidden state is not performed.
一部の例において、上記類似度閾値は所定のタイムステップtに関する関数によって実装されてもよい。 In some examples, the similarity threshold may be implemented as a function with respect to a given time step t.
前述したように、外部情報符号化隠れ状態と前記復号化隠れ状態の類似度が事前定義された類似度閾値より小さい場合、上記外部情報で復号化部出力を置き換えて出力にする動作を実行せず、出力単語確率分布に基づいて出力結果を決定する。この場合、外部情報が最終のテキスト処理結果に表れる確率を高めるために、前記現在タイムステップの類似度閾値を調整することで調整後の類似度閾値を決定し、前記調整後の類似度閾値は、前記現在タイムステップの類似度閾値より小さく、かつ前記調整後の類似度閾値は次のタイムステップの類似度閾値として使用される。 As described above, if the similarity between the external information encoded hidden state and the decoded hidden state is smaller than a predefined similarity threshold, the operation of replacing the decoder output with the external information and outputting it is not performed, and the output result is determined based on the output word probability distribution. In this case, in order to increase the probability that the external information appears in the final text processing result, the similarity threshold of the current time step is adjusted to determine an adjusted similarity threshold, which is smaller than the similarity threshold of the current time step, and which is used as the similarity threshold of the next time step.
例えば、式(7)を利用して類似度閾値を調整する。
上記方法を利用して、タイムステップ毎に類似度閾値について単調減少の調整を実行することで、外部情報と復号化部の出力結果間の類似度がテキスト処理プロセスにて類似度閾値がより低いレベルまで低減されるため、外部情報と復号化部の出力結果間の類似度が現在タイムステップの類似度閾値より大きくなる確率が増えるようになる。即ち、外部情報が最終のテキスト処理結果に現れる確率が増えるようになる。 By using the above method to perform a monotonically decreasing adjustment of the similarity threshold for each time step, the similarity between the external information and the output result of the decoding unit is reduced to a lower level in the text processing process, increasing the probability that the similarity between the external information and the output result of the decoding unit will be greater than the similarity threshold for the current time step. In other words, the probability that the external information will appear in the final text processing result increases.
本願によって提供されるテキスト処理装置100はテキスト要約の生成プロセスにおいて、外部情報を利用して現在タイムステップのアテンション分布を決定すると同時に/又は、外部情報に基づいて現在タイムステップの出力単語を決定することで、テキスト処理のプロセス有効に外部情報の内容を考慮することができ、テキスト生成のプロセスにおいて外部情報を生成する確率を高め、外部情報を考慮する場合のテキスト生成の効果が改善できるようになる。
The
本願によって提供されるテキスト処理装置100を実装する場合、当業者は上記技術案に対して任意の組み合わせをしてもよい。例えば、テキスト処理装置100でソーステキストについてテキスト処理を行うプロセスにおいて、アテンション生成部だけを利用して外部情報に基づいて外部情報を含むアテンション分布を生成し後続のテキスト処理で使用するようにし、かつ後続のテキスト処理プロセスにおいては、外部情報を考慮しないようにしてもよい。例えば、出力部だけを利用して外部情報に基づいて現在タイムステップで出力しようとする単語を決定し、その前の符号化、復号化とアテンション生成プロセスにおいては、外部情報を考慮しないようにしてもよい。さらに、アテンション生成部で、現在タイムステップのアテンション分布を生成する、及び出力部で、現在タイムステップで出力しようとする単語を決定するプロセスにおいて外部情報を考慮することで、テキスト処理結果に外部情報を含む可能性をさらに増やすようにしてもよい。
When implementing the
図3Aで本開示の実施例にかかるアテンション生成部の概略的なブロック図を示している。図3Aに示すアテンション生成部300を利用して、外部情報に基づいてソーステキストのアテンション分布atを調整し、かつ外部情報を含むアテンション分布A’を決定することができる。
3A shows a schematic block diagram of an attention generation unit according to an embodiment of the present disclosure. The
図3Aに示すように、アテンション生成部300には、ソーステキストアテンション決定部310、コンテンツ選択部320が含まれる。
As shown in FIG. 3A, the
ソーステキストアテンション決定部310は、前記ソーステキスト符号化隠れ状態と前記復号化隠れ状態に基づいて前記ソーステキストの符号化アテンション分布atを決定するために用いられる。一部の実施例において、前記式(1)を利用してソーステキストの符号化アテンション分布atを決定することができる。 The source text attention determiner 310 is used to determine the coding attention distribution a t of the source text based on the source text coding hidden state and the decoded hidden state. In some embodiments, the coding attention distribution a t of the source text can be determined using Equation (1).
コンテンツ選択部320は、ソーステキストにおける単語毎の選択確率を決定するのに使用されてもよい。一部の実施例において、コンテンツ選択部320は、外部情報に基づいて前記ソーステキストに対する選択確率分布を決定するのに使用されてもよく、前記選択確率分布には、前記ソーステキストに対する単語毎の選択確率が含まれる。
The
一部の実施例において、コンテンツ選択部220コンテンツ選択ネットワーク(例えばLSTMネットワーク)を利用してソーステキストIを処理し前記ソーステキストにおける単語毎の第一選択確率を決定するようにしてもよい。 In some embodiments, the content selector 220 may use a content selection network (e.g., an LSTM network) to process the source text I and determine a first selection probability for each word in the source text.
参考となるテキスト処理結果ref(即ち予め決定されるトレーニングデータのテキスト処理結果)を利用して使用するコンテンツ選択ネットワークに対してトレーニングを行う。コンテンツ選択ネットワークのトレーニングプロセスにおいて、ソーステキストIと参考となるテキスト処理結果refとに基づいて生成したタグ付け系列をコンテンツ選択ネットワークに入力して処理を行う。タグ付け系列とソーステキストIの単語系列の長さは同じであり、タグ付け系列の第i個要素の値は、ソーステキストIの第i個の単語が参考となるテキスト処理結果refに含まれているか否かを識別する内容である。上記方法を利用してコンテンツ選択ネットワークについてトレーニングすることでコンテンツ選択ネットワークは、ソーステキストIを処理しかつ前記ソーステキストにおける単語毎の第一選択確率の結果を出力することができ、第一選択確率はコンテンツ選択ネットワークに基づいてソーステキストIにおけるこの単語が選択され最終のテキスト処理結果に表れる確率を示している。 A reference text processing result ref (i.e., a text processing result of a predetermined training data) is used to train the content selection network used. In the training process of the content selection network, a tagging sequence generated based on a source text I and the reference text processing result ref is input to the content selection network for processing. The tagging sequence and the word sequence of the source text I have the same length, and the value of the i-th element of the tagging sequence identifies whether the i-th word of the source text I is included in the reference text processing result ref. By using the above method to train the content selection network, the content selection network can process the source text I and output a first selection probability result for each word in the source text, where the first selection probability indicates the probability that this word in the source text I will be selected based on the content selection network and appear in the final text processing result.
一部の実施例において、前記ソーステキストにおける外部情報に含まれる少なくとも1つの単語に対して、当該少なくとも1つの単語の選択確率を少なくとも事前定義された確率値λに決定してもよい。例えば、ソーステキストにおける各外部情報に含まれる単語の第二選択確率を事前定義された確率値λに決定し、外部情報に含まれていない他の単語の第二選択確率を0に決定する。 In some embodiments, for at least one word included in the external information in the source text, a selection probability of the at least one word may be determined to be at least a predefined probability value λ, for example, a second selection probability of each word included in the external information in the source text is determined to be a predefined probability value λ, and a second selection probability of other words not included in the external information is determined to be 0.
上記第一選択確率と第二選択確率に基づいてソーステキストにおける単語毎の選択確率を決定してもよい。例えば、ソーステキストにおける単語毎の選択確率を第一選択確率と第二選択確率の和に決定してもよい。上記からわかるように、外部情報に含まれる単語に対してその選択確率は事前定義された確率値λ以上である。 A selection probability for each word in the source text may be determined based on the first selection probability and the second selection probability. For example, the selection probability for each word in the source text may be determined as the sum of the first selection probability and the second selection probability. As can be seen from the above, the selection probability for the words included in the external information is equal to or greater than a predefined probability value λ.
前記選択確率分布に基づいて、コンテンツ選択部220は、前記ソーステキストにおける単語毎に対して、当該単語の選択確率によって当該単語のアテンションが決定できアテンション分布Aが得られるために用いられる。一部の実施例において、コンテンツ選択部220は当該単語の選択確率が所定の選択確率閾値εより低い場合、現在タイムステップのアテンション分布において当該単語に使用されるアテンションをゼロとして決定するように構成されてもよい。また、コンテンツ選択部220は当該単語の選択確率が所定の選択確率閾値ε以上である場合、現在タイムステップのアテンション分布において当該単語に使用されるアテンションをソーステキストの符号化アテンション分布atにおける当該単語のアテンションとして決定するように構成されてもよい。 Based on the selection probability distribution, the content selection unit 220 is used to determine, for each word in the source text, the attention of the word according to the selection probability of the word, to obtain an attention distribution A. In some embodiments, the content selection unit 220 may be configured to determine the attention used for the word in the attention distribution of the current time step as zero if the selection probability of the word is lower than a predetermined selection probability threshold ε. Also, the content selection unit 220 may be configured to determine the attention used for the word in the attention distribution of the current time step as the attention of the word in the encoding attention distribution a t of the source text if the selection probability of the word is equal to or greater than a predetermined selection probability threshold ε.
上記アテンション生成部を利用することで、ソーステキストにおける単語毎に選択確率が生成でき、即ち、単語毎のアテンションを決定する時、少なくとも式(1)を利用して計算したアテンションの大きさと当該単語の選択確率との双方を考慮すべきである。当該単語の選択確率が所定の選択閾値より低い場合は、当該単語が現在タイムステップに現れる確率が低いと見なしてよく、そのため、後続のテキスト処理プロセスにおいては当該単語のアテンションを考慮しなくてもよい。 By using the attention generation unit, a selection probability can be generated for each word in the source text; that is, when determining the attention for each word, at least both the magnitude of attention calculated using formula (1) and the selection probability of the word should be considered. If the selection probability of the word is lower than a predetermined selection threshold, it can be considered that the word has a low probability of appearing in the current time step, and therefore the attention of the word does not need to be considered in the subsequent text processing process.
式(9)でコンテンツ選択部を利用して決定したアテンション分布の結果を示してもよい。
外部情報に含まれた単語の選択確率を少なくとも事前定義された確率値λに設定することで、事前定義された確率値が所定の選択確率閾値εより大きいと、外部情報における単語がコンテンツ選択のステップにフィルタリングされるのを防止でき、外部情報における単語が後続のテキスト処理プロセスに入ることを保証し、これによって外部情報における単語がテキスト処理結果に現れる確率を高めることができる。なお、一部の実装形態において、事前定義された確率値λは所定の選択確率閾値ε以下に設定してもよい。この場合では、単語毎の選択確率を上記第一選択確率と第二選択確率の和に決定することで、外部情報における単語の選択確率を高めることができ、かつ外部情報における単語がテキスト処理結果に現れる確率を高める効果が実装できる。 By setting the selection probability of a word included in the external information to at least a predefined probability value λ, if the predefined probability value is greater than a predetermined selection probability threshold ε, the word in the external information can be prevented from being filtered out in the content selection step, ensuring that the word in the external information enters the subsequent text processing process, thereby increasing the probability that the word in the external information will appear in the text processing results. Note that in some implementations, the predefined probability value λ may be set to be equal to or less than the predetermined selection probability threshold ε. In this case, by determining the selection probability for each word to be the sum of the first selection probability and the second selection probability, the selection probability of the word in the external information can be increased, and the effect of increasing the probability that the word in the external information will appear in the text processing results can be implemented.
図3Bで図3Aに示すアテンション生成部を利用して現在タイムステップのアテンション分布を決定する例示的プロセスを示している。 Figure 3B shows an example process for determining the attention distribution for the current time step using the attention generator shown in Figure 3A.
図3Bに示すように、ソーステキストにおける四つの単語を例とし、コンテンツ選択ネットワークを利用して第一、三項目の単語のアテンションを選択し、後続のテキスト処理プロセスにおいて使用する。 As shown in FIG. 3B, taking four words in the source text as an example, the content selection network is used to select the attention of the first and third words for use in the subsequent text processing process.
図4では本願の実施例のアテンション生成部を利用する他の概略的なブロック図を示している。図4に示すように、アテンション生成部400は、ソーステキストアテンション決定部410と外部情報アテンション決定部420を含んでもよい。図4に示しているアテンション生成部を利用して決定したアテンション分布Aは、ソーステキストのアテンション分布atと外部情報のアテンション分布a’tとの双方を含む。
Fig. 4 shows another schematic block diagram of the attention generation unit of the embodiment of the present application. As shown in Fig. 4, the
一部の実施例において、ソーステキストアテンション決定部410は式(2)を利用して現在タイムステップのソーステキスト符号化隠れ状態と現在タイムステップの復号化隠れ状態とに基づいてソーステキストにおける単語毎の符号化アテンションパラメータei
tを決定する。
In some implementations, the source
外部情報アテンション決定部420は、前記ソーステキストにおける単語毎の外部アテンションパラメータを決定するのに使用され、外部情報に含まれる単語の外部アテンションパラメータは所定の第一外部アテンションパラメータに決定され、外部情報に含まれていない単語の外部アテンションパラメータは所定の第二外部アテンションパラメータに決定される。一部の実装形態において、第一外部アテンションパラメータはλ’として設置され、第二外部アテンションパラメータは0に設置されてもよく、λ’は0より大きい値である。
The external information
前記符号化アテンションパラメータと外部アテンションパラメータとに基づいて前記ソーステキストに使用される単語毎のアテンションパラメータを決定する。例えば、単語毎の符号化アテンションパラメータと外部アテンションパラメータとの和を計算すること当該単語のアテンションパラメータe’i tを求めることができる。 Determine a word-by-word attention parameter to be used for the source text based on the coded attention parameter and the external attention parameter, for example, calculate the sum of the coded attention parameter for each word and the external attention parameter to obtain the attention parameter e'i ' of the word.
その後、アテンションパラメータe’i tに基づいてソーステキストの現在タイムステップのアテンション分布を決定する。例えば、アテンションパラメータe’i tに対してsoftmax関数を運用することで、ソーステキストに使用される単語毎の現在タイムステップのアテンションを取得することができる。 Then, the attention distribution of the current time step of the source text is determined based on the attention parameter e'i t . For example, the attention of the current time step for each word used in the source text can be obtained by applying a softmax function to the attention parameter e'i t .
上記方法を利用して、事前定義された外部アテンションパラメータで、ソーステキストにおける外部情報に含まれる単語のアテンションパラメータを調整でき、外部情報に含まれる単語アテンションに対する調整を実装することができる。なお、第一外部アテンションパラメータが0より大きいハイパーパラメータλ’で、第二外部アテンションパラメータが0に設置された場合、外部情報に基づいてソーステキストの単語毎のアテンション分布を調整することで、外部情報に含まれる単語のアテンションがさらに重要になるようにすることができる。 Using the above method, the attention parameter of the words included in the external information in the source text can be adjusted with the predefined external attention parameter, and the adjustment for the attention of the words included in the external information can be implemented. Note that, when the first external attention parameter is a hyperparameter λ' that is greater than 0 and the second external attention parameter is set to 0, the attention distribution of each word in the source text can be adjusted based on the external information, so that the attention of the words included in the external information becomes more important.
上記の例では、第一外部アテンションパラメータをλ’に、第二外部アテンションパラメータを0の場合を例として本願の原理を説明したが、本願の範囲がそれに限られるわけではない。当業者は実際状況に基づいてソーステキストに使用される単語毎の外部アテンションのパラメータを設置してよく、最終的に外部情報に含まれる単語のアテンションがさらに重要になる効果だけを実装できればよい。例えば、第一外部アテンションwpパラメータλ1’と設置し、第二外部アテンションをパラメータλ2’と設置し、λ1’、λ2’はいかなる実数であり、λ1’>λ2’だけ満足すればよい。 In the above example, the principle of the present application is described by taking the first external attention parameter as λ' and the second external attention parameter as 0 as an example, but the scope of the present application is not limited thereto. Those skilled in the art may set the parameters of the external attention for each word used in the source text based on the actual situation, and only the effect of making the attention of the words included in the external information more important can be finally implemented. For example, the first external attention wp parameter is set as λ 1 ', and the second external attention parameter is set as λ 2 ', where λ 1 ' and λ 2 ' are any real numbers, and only λ 1 '>λ 2 ' is satisfied.
一部の実施例において、ソーステキストアテンション決定部410は、前記式(1)、(2)を利用してソーステキストの符号化アテンション分布atを決定するのに使用されてもよい。外部情報アテンション決定部420は、前記外部情報の符号化アテンション分布a’tを決定するのに使用されてもよい。
In some embodiments, the source
この場合、図1で示している符号化部110を利用して前記外部情報を符号化して外部情報符号化隠れ状態h’を取得する。外部情報アテンション部420は、外部情報符号化隠れ状態h’と復号化隠れ状態sとに基づいて外部情報の符号化アテンション分布を決定する。
In this case, the extrinsic information is encoded using the
例えば、上記式(1)、(2)を利用して外部情報の符号化アテンション分布a’tを決定し、式(1)、(2)におけるソーステキスト符号化隠れ状態hは、外部情報符号化隠れ状態h’に置き換えられるべきである。 For example, the above equations (1) and (2) are used to determine the extrinsic information coding attention distribution a′ t , and the source text coding hidden state h in equations (1) and (2) should be replaced with the extrinsic information coding hidden state h′.
一部の実装形態において、それぞれ外部情報の符号化アテンション分布a’tとソーステキストの符号化アテンション分布atを計算する時、シェアパラメータの式(1)、(2)で計算し、即ち、外部情報の符号化アテンション分布a’tとソーステキストの符号化アテンション分布atを計算する時に使用するパラメータvT、Wh、WS、battnは同じであってもよい。他の一部の実施方法において、外部情報の符号化アテンション分布a’tとソーステキストの符号化アテンション分布atとを計算するために用いられるトレーニングパラメータに対してそれぞれトレーニングしてもよく、即ち、外部情報の符号化アテンション分布a’tとソーステキストの符号化アテンション分布atを計算する時に使用するパラメータvT、Wh、WS、battnは異なってもよい。 In some implementations, the external information coding attention distribution a't and the source text coding attention distribution a't are calculated using the share parameter formulas (1) and (2), i.e., the parameters vT , Wh , Ws , and battn used to calculate the external information coding attention distribution a't and the source text coding attention distribution at may be the same. In other implementations, the external information coding attention distribution a't and the source text coding attention distribution at may be trained on the training parameters used to calculate the external information coding attention distribution a't and the source text coding attention distribution at, i.e., the parameters vT , Wh , Ws , and battn used to calculate the external information coding attention distribution a't and the source text coding attention distribution at may be different.
図4で示しているアテンション生成部400で外部情報の符号化アテンション分布a’tとソーステキストの符号化アテンション分布atを生成し、図1で示している出力部で外部情報の符号化アテンション分布a’tとソーステキストの符号化アテンション分布atに対して更なる処理を行い、現在タイムステップの出力単語確率分布を決定する。
The
アテンション分布Atにソーステキストのアテンション分布atと外部情報のアテンション分布a’tとの双方を含む場合、出力単語確率分布は、生成確率分布、ソーステキストのアテンション分布atと外部情報のアテンション分布a’tの加重平均で示されてもよい。 When the attention distribution A t includes both the attention distribution a t of the source text and the attention distribution a′ t of the external information, the output word probability distribution may be represented as a weighted average of the generation probability distribution, the attention distribution a t of the source text and the attention distribution a′ t of the external information.
一部の実施例において、式(10)で出力単語確率分布を決定してもよい。
一部の実装形態において、現在タイムステップtのソーステキストの符号化隠れ状態、復号化隠れ状態、外部情報の符号化アテンション分布及び直前のタイムステップt-1の出力部の出力に基づいてPgenerator、Ppointer、及びPTを決定してもよい。 In some implementations, P generator , P pointer , and P T may be determined based on the encoded hidden state of the source text at the current time step t, the decoded hidden state, the encoded attention distribution of the extrinsic information, and the output of the output unit at the previous time step t −1.
例えば、式(11)に基づいてPgenerator、Ppointer、及びPTを決定できる。
一部の実施例において、出力部が出力単語確率分布を決定する時、他の方法で決定される確率分布結果を考慮してもよい。例えば、ソーステキストIにおける単語ベクトルの形成した複数の文ベクトル間の相関性を考慮してソーステキストIにおける各単語のソーステキストにおける重要度を決定してもよい。出力単語確率分布は、さらに上記重要度によって形成した単語確率分布を含んでもよい。当業者にとって、出力単語確率分布の生成方式はこれに限られなく、本開示原理を逸脱しない状況で、出力単語確率分布は各種形の単語確率分布を含んでもよい。 In some embodiments, when the output unit determines the output word probability distribution, it may take into account probability distribution results determined by other methods. For example, the importance of each word in the source text I may be determined by considering the correlation between multiple sentence vectors formed by word vectors in the source text I. The output word probability distribution may further include a word probability distribution formed by the above importance. For those skilled in the art, the method of generating the output word probability distribution is not limited to this, and the output word probability distribution may include various forms of word probability distributions without departing from the principles of the present disclosure.
上記方式を利用して、アテンション生成部400で外部情報の現在タイムステップでのアテンション分布a’tを決定し、かつ外部情報の現在タイムステップでのアテンション分布a’tを現在タイムステップの出力確率分布を決定してもよい。本開示によって提供される実施例において、外部情報の特徴ではなく外部情報のアテンション分布を利用して現在タイムステップの出力確率分布を決定することで、外部情報の特徴における無効情報が現在タイムステップの出力確率分布に与える影響を避けることができる。
Using the above method, the
図5は本願の実施例にかかるテキスト処理装置の他の例示的な一実施例を示している。 Figure 5 shows another exemplary embodiment of a text processing device according to an embodiment of the present application.
図5に示すように、テキスト処理装置500は符号化部510、復号化部520、アテンション生成部530、出力部540及び後処理部550を含んでもよい。符号化部510、復号化部520、アテンション生成部530、出力部540は、図1~図3で説明している符号化部110、復号化部120、アテンション生成部130と出力部140で実装すればよく、ここでは、詳しく説明しない。
As shown in FIG. 5, the
後処理部550は、外部情報に基づいて前記候補テキストに対して後処理を行うことで、外部情報を含む出力テキストを決定するように構成されてもよい。
The
前述のように、符号化部510、復号化部520、アテンション生成部530、出力部540が図1~図3で説明している符号化部110、復号化部120、アテンション生成部130と出力部140に合わせて実装できるので、出力部540は、外部情報を含むテキスト処理結果を出力できる。
As described above, the
出力部540から出力される結果に既に外部情報を含む場合は、出力部540から出力される結果を直接テキスト処理の結果としてもよい。
If the results output from the
出力部540から出力される結果に外部情報を含まない場合は、出力部540から出力される結果を候補テキストとし、後処理部550により外部情報に基づいて前記候補テキストについて後処理を行い、外部情報を含む出力テキストを決定するようにする。
If the result output from the
一部の実施例において、外部情報は予め指定された情報を含んでもよい。例えば、外部情報は予め指定された文であり、又は予め指定された単語を含むソーステキストにおける文であってもよい。 In some embodiments, the external information may include pre-specified information. For example, the external information may be a pre-specified sentence, or a sentence in the source text that includes a pre-specified word.
前記予め指定された外部情報が文である場合、後処理部550は、前記候補テキストにおける文と前記外部情報の類似度を決定するように構成されてもよい。前記類似度が所定の候補類似度閾値より大きい場合、前記候補テキストにおける前記文を前記外部情報に置き換えてもよい。
If the pre-specified external information is a sentence, the
事前決定される外部情報が単語である場合、後処理部550は、前記候補テキストにおける文と前記外部情報の類似度を決定し、前記類似度が所定の候補類似度閾値より大きい場合、前記候補テキストにおける前記文を前記外部情報に置き換えるように構成されてもよい。
If the pre-determined external information is a word, the
一部の実装形態において、前記類似度が所定の候補類似度閾値より大きい場合、後処理部550は、前記候補テキストにおける前記文を削除し、外部情報としての文又は、外部情報としての単語を含む文で削除された候補テキストにおける文に置き換えるように構成されてもよい。
In some implementations, if the similarity is greater than a predefined candidate similarity threshold, the
一部の例において、ソーステキストにおける外部情報と候補テキストにおける余剰情報のソーステキストにおける相関性に基づいて前記残りの情報に外部情報を挿入する。例えば、外部情報と候補テキストにおける余剰情報がソーステキストに現れる順番に基づいて外部情報を候補テキストの余剰情報に挿入する。 In some examples, the external information is inserted into the remaining information based on a correlation in the source text between the external information in the source text and the redundant information in the candidate text. For example, the external information is inserted into the redundant information of the candidate text based on the order in which the external information and the redundant information in the candidate text appear in the source text.
他の一部の実施方法において、前記類似度が所定の候補類似度閾値より小さい場合、後処理部550は、前記外部情報と前記候補テキストにおける文の前記ソーステキストにおける相関性に基づいて、前記候補テキストに外部情報を挿入する。
In some other implementations, if the similarity is less than a predefined candidate similarity threshold, the
前記外部情報と前記候補テキストにおける各文の間の類似度を比較してもよい。前記外部情報と前記候補テキストにおける各文の類似度とも所定の候補類似度閾値より小さい場合、生成したテキスト処理結果に外部情報に類似する情報が含まれてないことを意味する。この場合、外部情報と候補テキストについて直接つづり合いを行い、最終のテキスト処理結果を決定してもよい。 The similarity between the external information and each sentence in the candidate text may be compared. If the similarity between the external information and each sentence in the candidate text is smaller than a predetermined candidate similarity threshold, this means that the generated text processing result does not contain information similar to the external information. In this case, a direct spelling match may be performed between the external information and the candidate text to determine the final text processing result.
例えば、外部情報と候補テキストにおける文がソーステキストに現れる順番に従って、外部情報を候補テキストに挿入することで、最終のテキスト処理結果を決定してもよい。 For example, the final text processing result may be determined by inserting external information into the candidate text according to the order in which the external information and sentences in the candidate text appear in the source text.
本願にかかる上記テキスト処理装置を利用して、効果的にテキスト処理結果に外部情報の内容を追加することができ、テキスト処理結果に期待する外部情報の内容を追加することが保証できる。 By using the text processing device according to the present application, it is possible to effectively add external information to the text processing results, and it is possible to ensure that the expected external information is added to the text processing results.
前記に示すように、図1~図3を参照して示しているテキスト処理装置における符号化部110、復号化部120、アテンション生成部130にはすべてトレーニングする必要のあるパラメータを含んでいる。そのため、機械学習を利用して符号化部110、復号化部120、アテンション生成部130における少なくとも1つに対してトレーニングを行う必要がある。
As described above, the
一部の実施例において、所定のソーステキストトレーニングセットを利用して前記符号化部、前記アテンション生成部、前記復号化部に対してトレーニングを行う。前記ソーステキストトレーニングセットは複数のトレーニングソーステキストを含む。 In some embodiments, the encoding unit, the attention generating unit, and the decoding unit are trained using a predefined source text training set. The source text training set includes a plurality of training source texts.
図1で示しているテキスト処理装置を利用してトレーニングソーステキストについて処理を行い、トレーニングソーステキストに対するトレーニングテキスト処理結果を取得することができる。例えば、符号化部を利用してトレーニングソーステキストを符号化してトレーニングソーステキスト符号化隠れ状態を取得することができる。その後、復号化部を利用してトレーニング復号化隠れ状態を決定することができる。またその後、アテンション生成部を利用して前記外部情報、前記トレーニングソーステキスト符号化隠れ状態と前記トレーニング復号化隠れ状態に基づいて現在タイムステップのトレーニングアテンション分布を決定することができる。出力部を利用して、前記トレーニングアテンション分布、前記トレーニングソーステキスト符号化隠れ状態、前記トレーニング復号化隠れ状態に基づいてトレーニング出力単語確率分布を決定することで、トレーニング出力単語を決定することができる。 The text processing device shown in FIG. 1 can be used to process the training source text and obtain a training text processing result for the training source text. For example, an encoding unit can be used to encode the training source text to obtain a training source text encoding hidden state. Then, a decoding unit can be used to determine a training decoded hidden state. Then, an attention generation unit can be used to determine a training attention distribution for the current time step based on the external information, the training source text encoding hidden state, and the training decoded hidden state. An output unit can be used to determine a training output word probability distribution based on the training attention distribution, the training source text encoding hidden state, and the training decoded hidden state, thereby determining the training output words.
前記符号化部、前記アテンション生成部、前記復号化部におけるパラメータを調整することで、トレーニングプロセスにおいて使用する損失関数を最小化し、前記符号化部、前記アテンション生成部、前記復号化部に対するトレーニングを実装するようにする。 By adjusting the parameters in the encoding unit, the attention generation unit, and the decoding unit, the loss function used in the training process is minimized, and training is implemented for the encoding unit, the attention generation unit, and the decoding unit.
一部の例において、トレーニングプロセスにおいて使用する損失関数lossは下記の式(12)として実装されてもよい。
他の例において、トレーニングプロセスにおいて使用する損失関数lossは下記式(13)、(14)によって実装することができる。
図6は本願のテキスト処理方法による例示的フローチャートを示している。図6に示すように、ステップS602において、前記ソーステキストに対して符号化を行い、ソーステキスト符号化隠れ状態を取得することができる。一部の実施例において、符号化ネットワークを利用してソーステキストについて符号化を行ってもよい。例示的符号化ネットワークには長・短期記憶(LSTM)ネットワークを含み、LSTMネットワークベースのシステムは例えば機械翻訳、テキスト要約生成等のタスクに適用される。ここからわかるように、符号化ネットワークは単語ベクトルに対して符号化を行ういかなる機械学習モデルとして実装されてもよい。 FIG. 6 illustrates an exemplary flow chart of the text processing method of the present application. As shown in FIG. 6, in step S602, the source text may be encoded to obtain a source text encoding hidden state. In some embodiments, the source text may be encoded using an encoding network. Exemplary encoding networks include long short-term memory (LSTM) networks, and LSTM network-based systems are applied to tasks such as machine translation, text summary generation, etc. As can be seen, the encoding network may be implemented as any machine learning model that encodes word vectors.
例えば、ソーステキストIに対応する少なくとも1つの単語ベクトルを入力とする場合、符号化ネットワークは各単語ベクトルx1、x2、x3…にそれぞれ対応するソーステキスト符号化隠れ状態h1、h2、h3…を出力する。ソーステキスト符号化隠れ状態の数とソーステキストの単語ベクトルの数は同じでもよいし、異なってもよい。例えば、ソーステキストIに基づいてk個の単語ベクトルを生成する場合、符号化ネットワークはこのk個の単語ベクトルを処理してk個の対応するソーステキスト符号化隠れ状態を生成する。Kは1より大きい整数である。 For example, when at least one word vector corresponding to a source text I is input, the encoding network outputs source text encoded hidden states h1 , h2, h3... corresponding to each word vector x1, x2 , x3 ... respectively . The number of source text encoded hidden states and the number of source text word vectors may be the same or different. For example, when generating k word vectors based on a source text I, the encoding network processes the k word vectors to generate k corresponding source text encoded hidden states, where K is an integer greater than 1.
ステップS604において、復号化隠れ状態を決定できる。一部の実施例において、復号化部120は直前のタイムステップt-1の復号化隠れ状態st-1及び直前のタイムステップテキスト処理装置で得られた出力単語xtを受信し、かつst-1とxtとを処理することで現在タイムステップの復号化隠れ状態stを取得する。最初のタイムステップの処理でs0とx1はデフォルトの初期値として決定される。復号化隠れ状態sは、ソーステキストSに対応する複数の復号化隠れ状態s1、s2、s3…を含んでもよい。例示的な復号化ネットワークは長・短期記憶ネットワークを含む。なお、復号化ネットワークは符号化ネットワークの出力に対して復号化を行ういかなる機械学習モデルによって実装されてもよい。
In step S604, a decoded hidden state can be determined. In some embodiments, the
ステップS606において、外部情報、前記ソーステキスト符号化隠れ状態と前記復号化隠れ状態に基づいて現在タイムステップのアテンション分布を決定してもよい。 In step S606, an attention distribution for the current time step may be determined based on external information, the source text encoded hidden state, and the decoded hidden state.
一部の実施例において、現在タイムステップtのアテンション分布Atは、ソーステキストの符号化アテンション分布である。例えば、式(1)、(2)を利用してソーステキストの符号化アテンション分布atを決定することができる。 In some implementations, the attention distribution A t at the current time step t is the coded attention distribution of the source text. For example, the coded attention distribution a t of the source text can be determined using equations (1) and (2).
他の一部の実施例において、外部情報及び式(1)に基づいて決定したソーステキストのアテンション分布atに基づいて外部情報を含む現在タイムステップのアテンション分布Atを決定し、かつ外部情報を含むアテンション分布Atを出力し、後続のテキスト処理プロセスにおいて使用する。 In some other embodiments, an attention distribution A t for the current time step including the external information is determined based on the external information and the attention distribution a t of the source text determined based on Equation (1), and the attention distribution A t including the external information is output for use in subsequent text processing processes.
図7で本願の実施例にかかる外部情報に基づいて現在タイムステップのアテンション分布を決定する例示的フローチャートを示している。 Figure 7 shows an exemplary flowchart for determining the attention distribution for the current time step based on external information according to an embodiment of the present application.
ステップS702において、前記ソーステキスト符号化隠れ状態と前記復号化隠れ状態に基づいて前記ソーステキストの符号化アテンション分布を決定する。一部の実施例において、前記式(1)を利用してソーステキストの符号化アテンション分布atを決定することができる。 In step S702, a coding attention distribution of the source text is determined based on the source text coding hidden state and the decoded hidden state. In some embodiments, the coding attention distribution of the source text, a t, can be determined using Equation (1).
ステップS704において、外部情報に基づいて前記ソーステキストに対する選択確率分布を決定し、前記選択確率分布は、前記ソーステキストにおける単語毎に使用される選択確率を含む。 In step S704, a selection probability distribution for the source text is determined based on external information, the selection probability distribution including a selection probability used for each word in the source text.
一部の実施例において、コンテンツ選択ネットワーク(例えばLSTMネットワーク)を利用してソーステキストIについて処理を行うことで、前記ソーステキストにおける単語毎の第一選択確率を決定する。 In some embodiments, a content selection network (e.g., an LSTM network) is used to process the source text I to determine a first selection probability for each word in the source text.
コンテンツ選択ネットワークは、ソーステキストIについて処理を行い前記ソーステキストにおける単語毎の第一選択確率の結果を出力し、第一選択確率はコンテンツ選択ネットワークに基づいてソーステキストIにおけるこの単語が選択され最終のテキスト処理結果に現れる確率を表示する。 The content selection network processes the source text I and outputs a first selection probability result for each word in the source text, where the first selection probability represents the probability that this word in the source text I will be selected based on the content selection network and appear in the final text processing result.
一部の実施例において、前記ソーステキストにおける外部情報に含まれる少なくとも1つの単語について、当該少なくとも1つの単語の選択確率を少なくとも事前定義した確率値λに決定する。例えば、ソーステキストにおける各外部情報に含まれる単語の第二選択確率を事前定義した確率値λに決定し、外部情報に含まれる他の単語の第二選択確率を0に決定する。 In some embodiments, for at least one word included in the external information in the source text, a selection probability of the at least one word is determined to be at least a predefined probability value λ, for example, a second selection probability of each word included in the external information in the source text is determined to be a predefined probability value λ, and the second selection probability of other words included in the external information is determined to be 0.
上記第一選択確率と第二選択確率に基づいてソーステキストにおける単語毎の選択確率を決定する。例えば、ソーステキストにおける単語毎の選択確率を第一選択確率と第二選択確率の合計に決定することができる。わかるように、外部情報に含まれる単語に対して、その選択確率は事前定義した確率値λ以上である。 Based on the first and second selection probabilities, a selection probability of each word in the source text is determined. For example, the selection probability of each word in the source text can be determined as the sum of the first and second selection probabilities. As can be seen, for words included in the external information, the selection probability is equal to or greater than a predefined probability value λ.
ステップS706において、前記ソーステキストにおける各単語に対して当該単語の選択確率に基づいて当該単語のアテンションを決定することで前記アテンション分布を取得することができる。 In step S706, the attention distribution can be obtained by determining the attention for each word in the source text based on the selection probability of the word.
前記選択確率分布に基づいて、ステップS706は、前記ソーステキストにおける各単語に対して当該単語の選択確率に基づいて当該単語のアテンションを決定しアテンション分布Aを取得することを含んでもよい。一部の実施例において、ステップS706は当該単語の選択確率が所定の選択確率閾値εより小さい時、現在タイムステップのアテンション分布における当該単語に使用されるアテンションを0と決定することを含んでもよい。また、ステップS706は当該単語の選択確率が所定の選択確率閾値ε以上である時、現在タイムステップのアテンション分布における当該単語に使用されるアテンションをソーステキストの符号化アテンション分布atにおける当該単語のアテンションに決定することを含んでもよい。 Based on the selection probability distribution, step S706 may include, for each word in the source text, determining an attention for the word based on the selection probability of the word to obtain an attention distribution A. In some embodiments, step S706 may include determining an attention to be used for the word in the attention distribution of the current time step as 0 when the selection probability of the word is less than a predetermined selection probability threshold ε. Also, step S706 may include determining an attention to be used for the word in the attention distribution of the current time step as an attention for the word in the encoding attention distribution a t of the source text when the selection probability of the word is equal to or greater than a predetermined selection probability threshold ε.
上記アテンション生成の方法を利用して、ソーステキストにおける単語毎に選択確率を生成することができ、即ち、単語毎のアテンションを決定する時、少なくとも式(1)を利用して計算したアテンションの大きさ及び当該単語の選択確率の双方を考慮するべきである。当該単語の選択確率が所定の選択閾値より低い時、当該単語が現在タイムステップに現れる確率が非常に低いと判断できるため、後続のテキスト処理プロセスにおいて当該単語のアテンションを考慮しなくてもよい。 Using the above attention generation method, a selection probability can be generated for each word in the source text; that is, when determining the attention for each word, at least both the magnitude of attention calculated using formula (1) and the selection probability of the word should be considered. When the selection probability of the word is lower than a predetermined selection threshold, it can be determined that the probability of the word appearing in the current time step is very low, so the attention of the word does not need to be considered in the subsequent text processing process.
外部情報に含まれた単語の選択確率を少なくとも事前定義された確率値λに設置し、事前定義された確率値が所定の選択確率閾値εより大きい場合は、外部情報における単語がコンテンツ選択のステップでフィルタリングされないように保証することで、外部情報における単語が後続のテキスト処理プロセスにおいて処理されることを保証し、それによって外部情報における単語がテキスト処理結果に現れる確率を高めることができる。なお、一部の実装形態において、事前定義された確率値λを所定の選択確率閾値ε以下に設置してもよい。この場合、単語毎の選択確率を上記第一選択確率と第二選択確率との合計に決定することで、外部情報における単語の選択確率を増やすことが実装でき、外部情報における単語がテキスト処理結果に現れる確率を高める効果が実装できる。 The selection probability of a word included in the external information is set to at least a predefined probability value λ, and if the predefined probability value is greater than a predetermined selection probability threshold ε, the word in the external information is guaranteed not to be filtered in the content selection step, thereby ensuring that the word in the external information is processed in the subsequent text processing process, thereby increasing the probability that the word in the external information will appear in the text processing results. Note that in some implementations, the predefined probability value λ may be set to be equal to or less than the predetermined selection probability threshold ε. In this case, the selection probability of each word is determined to be the sum of the first selection probability and the second selection probability, thereby implementing the effect of increasing the selection probability of the word in the external information and increasing the probability that the word in the external information will appear in the text processing results.
図8では、本願の実施例にかかる外部情報に基づいて現在タイムステップのアテンション分布を決定するステップの他の一例示的なフローチャートを示している。 Figure 8 shows another exemplary flowchart of steps for determining the attention distribution for the current time step based on external information according to an embodiment of the present application.
ステップS802において、現在タイムステップのソーステキストの符号化アテンションを決定できる。 In step S802, the coding attention of the source text for the current time step can be determined.
一部の実施例において、式(2)を利用して現在タイムステップのソーステキスト符号化隠れ状態と現在タイムステップの復号化隠れ状態に基づいてソーステキストにおける単語毎の符号化アテンションパラメータei tを決定することができる。その後、前記式(1)、(2)を利用してソーステキストの符号化アテンション分布atを決定する。 In some embodiments, the coding attention parameter e i t for each word in the source text can be determined based on the source text coding hidden state of the current time step and the decoded hidden state of the current time step using equation (2), and then the coding attention distribution a t for the source text is determined using equations (1) and (2).
ステップS804において、現在タイムステップの外部情報符号化アテンションを決定できる。 In step S804, the extrinsic information coding attention for the current time step can be determined.
一部の実施例において、前記ソーステキストにおける単語毎の外部アテンションパラメータが決定でき、外部情報に含まれる単語の外部アテンションパラメータは所定の第一外部アテンションパラメータに決定され、外部情報に含まれていない単語の外部アテンションパラメータは所定の第二外部アテンションパラメータに決定される。一部の実装形態において、第一外部アテンションパラメータはλ’に設置され、第二外部アテンションパラメータは0に設置され、λ’は0より大きい値である。 In some embodiments, an external attention parameter for each word in the source text can be determined, where the external attention parameter for words included in the external information is determined to a first predetermined external attention parameter, and the external attention parameter for words not included in the external information is determined to a second predetermined external attention parameter. In some implementations, the first external attention parameter is set to λ′ and the second external attention parameter is set to 0, where λ′ is a value greater than 0.
ステップS802で決定される前記符号化アテンションパラメータと上記外部アテンションパラメータに基づいて前記ソーステキストにおける単語毎に使用されるアテンションパラメータを決定できる。例えば、単語毎の符号化アテンションパラメータと外部アテンションパラメータの合計を求めることで当該単語のアテンションパラメータe’i tを決定してもよい。 Based on the coded attention parameter determined in step S802 and the external attention parameter, the attention parameter to be used for each word in the source text can be determined. For example, the attention parameter e′ i t for a word may be determined by calculating the sum of the coded attention parameter and the external attention parameter for that word.
その後、アテンションパラメータe’i tに基づいてソーステキストの現在タイムステップのアテンション分布を決定してもよい。例えば、アテンションパラメータe’i tにsoftmax関数を適用することで、ソーステキストの単語毎に使用される現在タイムステップのアテンションを決定することができる。 An attention distribution for the current time step of the source text may then be determined based on the attention parameter e'i't . For example, a softmax function may be applied to the attention parameter e'i't to determine the attention for the current time step to be used for each word of the source text.
上記方法を利用して、事前定義された外部アテンションパラメータを利用してソーステキストにおける外部情報に含まれる単語のアテンションパラメータを調整することができ、外部情報に含まれる単語アテンションの調整を実装することができる。なお、第一外部アテンションパラメータは0より大きいハイパーパラメータλ’に設置され、第二外部アテンションパラメータは0に設置された場合、外部情報に基づいてソーステキストの単語毎のアテンション分布を調整し、外部情報に含まれる単語のアテンションがさらに重要になるようにできる。 Using the above method, the attention parameter of the words included in the external information in the source text can be adjusted using a predefined external attention parameter, and the adjustment of the attention of the words included in the external information can be implemented. Note that, when the first external attention parameter is set to a hyperparameter λ' greater than 0 and the second external attention parameter is set to 0, the attention distribution of each word in the source text can be adjusted based on the external information, so that the attention of the words included in the external information is more important.
一部の実施例において、前記外部情報を符号化することで外部情報符号化隠れ状態h’を取得することができる。また上記式(1)、(2)を利用して外部情報の符号化アテンション分布a’tを決定することができ、式(1)、(2)におけるソーステキスト符号化隠れ状態hは、外部情報符号化隠れ状態h’に置き換えられるべきである。 In some embodiments, the extrinsic information can be encoded to obtain an extrinsic information encoded hidden state h', and the extrinsic information encoded attention distribution a't can be determined using the above formulas (1) and (2), and the source text encoded hidden state h in formulas (1) and (2) should be replaced with the extrinsic information encoded hidden state h'.
一部の実装形態において、外部情報の符号化アテンション分布a’tとソーステキストの符号化アテンション分布atとをそれぞれ計算する時、シェアパラメータを利用して式(1)、(2)の計算を行い、即ち外部情報の符号化アテンション分布a’tとソーステキストの符号化アテンション分布atを計算する時に使用するパラメータvT、Wh、WS、battnは同じであってもよい。他の一部の実施方法において、外部情報の符号化アテンション分布a’tとソーステキスト的符号化アテンション分布atとを計算するためのトレーニングパラメータをそれぞれトレーニングし、即ち、外部情報の符号化アテンション分布a’tとソーステキストの符号化アテンション分布atを計算する時に使用するパラメータvT、Wh、WS、battnは異なってもよい。 In some implementations, when calculating the external information coding attention distribution a't and the source text coding attention distribution a't , respectively, the share parameters are used to calculate Equations (1) and (2), i.e., the parameters vT , Wh , Ws , and battn used when calculating the external information coding attention distribution a't and the source text coding attention distribution at may be the same. In other implementations, training parameters for calculating the external information coding attention distribution a't and the source text coding attention distribution at are trained, respectively, i.e., the parameters vT , Wh , Ws , and battn used when calculating the external information coding attention distribution a't and the source text coding attention distribution at may be different.
図6に戻り参照すると、ステップS608において前記アテンション分布、前記ソーステキスト符号化隠れ状態、前記復号化隠れ状態に基づいて出力単語確率分布を決定してもよい。 Referring back to FIG. 6, in step S608, an output word probability distribution may be determined based on the attention distribution, the source text encoding hidden state, and the decoding hidden state.
出力単語確率分布は、生成確率分布Pvocabを含んでもよい。式(3)と式(4)を利用して生成確率分布Pvocabを決定できる。 The output word probability distribution may include a generation probability distribution P vocab . Equations (3) and (4) can be used to determine the generation probability distribution P vocab .
一部の実施例において、出力単語確率分布は現在タイムステップのアテンション分布Atを含んでもよい。 In some implementations, the output word probability distribution may include the attention distribution A t for the current timestep.
例えば、前記生成確率分布と前記アテンション分布Aについて重み付け加算を行うことで、出力単語確率分布を決定できる。 For example, the output word probability distribution can be determined by performing a weighted addition of the generated probability distribution and the attention distribution A.
一部の実装形態において、現在タイムステップのソーステキスト符号化隠れ状態、ソーステキスト復号化隠れ状態、アテンション分布及び直前のタイムステップ復号化ネットワークの出力に基づいて生成確率分布とアテンション分布用の重み係数Pgenを決定する。 In some implementations, the weighting factors Pgen for the generation probability distribution and the attention distribution are determined based on the source text encoding hidden state of the current time step, the source text decoding hidden state, the attention distribution and the output of the previous time step decoding network.
例えば、前記生成確率分布及び前記アテンション分布について重み付け加算を行う重み係数Pgenは式(5)のように示すことができる。 For example, the weighting coefficient P gen for performing weighted addition on the generated probability distribution and the attention distribution can be expressed as in Equation (5).
アテンション分布Atにソーステキストのアテンション分布atと外部情報のアテンション分布a’tの双方を含む場合、ソーステキストのアテンション分布atと外部情報のアテンション分布a’tの重み係数パラメータは同じであってもよく、異なってもよい。 When the attention distribution A t includes both the attention distribution a t of the source text and the attention distribution a′ t of the external information, the weighting coefficient parameters of the attention distribution a t of the source text and the attention distribution a′ t of the external information may be the same or different.
アテンション分布Atにソーステキストのアテンション分布atと外部情報のアテンション分布a’tとの双方を含む場合、出力単語確率分布は、生成確率分布、ソーステキストのアテンション分布atと外部情報のアテンション分布a’tとの加重平均で示すことができる。 When the attention distribution A t includes both the attention distribution a t of the source text and the attention distribution a′ t of the external information, the output word probability distribution can be expressed as a weighted average of the generation probability distribution, the attention distribution a t of the source text and the attention distribution a′ t of the external information.
一部の実施例において、式(10)を利用して出力単語確率分布を決定してもよい。 In some implementations, equation (10) may be used to determine the output word probability distribution.
一部の実装形態において、現在タイムステップtのソーステキスト符号化隠れ状態、ソーステキストの復号化隠れ状態、外部情報の符号化アテンション分布及び直前のタイムステップt-1の復号化ネットワークの出力に基づいてPgenerator、Ppointer、及びPTを決定してもよい。例えば、式(11)を利用してPgenerator、Ppointer、及びPTを決定する。 In some implementations, P generator , P pointer , and P T may be determined based on the source text encoded hidden state at the current time step t, the source text decoded hidden state, the extrinsic information encoded attention distribution , and the output of the decoding network at the previous time step t - 1. For example, Equation (11) is used to determine P generator , P pointer , and P T.
一部の実施例において、ステップS608は、出力単語確率分布における確率の最も高い単語を現在タイムステップの出力単語に決定することを含んでもよい。 In some implementations, step S608 may include determining the most probable word in the output word probability distribution as the output word for the current time step.
図9は本願の実施例にかかるあるテキスト処理方法の例示的フローチャートを示している。 Figure 9 shows an exemplary flowchart of a text processing method according to an embodiment of the present application.
図9に示すように、ステップS902において、前記ソーステキストについて符号化を行うことでソーステキスト符号化隠れ状態を取得することができる。 As shown in FIG. 9, in step S902, the source text is encoded to obtain a hidden source text encoding state.
ステップS904において、復号化隠れ状態を決定することができる。一部の実施例において、図6に示すステップS604を利用して復号化隠れ状態を決定することができ、は繰り返して説明しない。 In step S904, the decoded hidden state can be determined. In some embodiments, the decoded hidden state can be determined using step S604 shown in FIG. 6, which will not be described again.
ステップS906において、外部情報、前記ソーステキスト符号化隠れ状態、前記復号化隠れ状態に基づいて出力単語確率分布を決定し、出力単語を決定する。 In step S906, an output word probability distribution is determined based on the external information, the source text encoding hidden state, and the decoded hidden state, and an output word is determined.
他の一部の実施例において、ステップS906は、さらに外部情報に基づいて単語確率分布を決定かつ出力することで現在タイムステップの出力単語を決定してもよい。 In some other embodiments, step S906 may further determine and output a word probability distribution based on external information to determine the output word for the current time step.
一実装形態において、ステップS906は、前記外部情報に基づいて、前記候補出力単語において確率が出力確率閾値以上でありかつ前記外部情報に含まれる単語を現在タイムステップの候補出力単語に決定することを含んでもよい。 In one implementation, step S906 may include determining, based on the external information, a word whose probability in the candidate output word is equal to or greater than an output probability threshold and is included in the external information as a candidate output word for the current time step.
例えば、各タイムステップ毎に少なくとも2つの単語を現在タイムステップの候補出力単語と決定し、その後、候補出力単語は次のタイムステップのテキスト処理プロセスにおいて使用される。同様に、次のタイムステップにおいても、少なくとも2つの候補出力単語を決定してもよい。 For example, at least two words may be determined as candidate output words for the current time step at each time step, and then the candidate output words may be used in the text processing process for the next time step. Similarly, at least two candidate output words may be determined for the next time step.
具体的に候補出力単語の数が2の場合を例として、タイムステップtにおいて2つの候補出力単語a、bを決定することができる。その後、候補出力単語a、bは次のタイムステップのテキスト処理プロセスに利用され、タイムステップt+1の候補出力単語c、dを決定することができる。 Specifically, for example, when the number of candidate output words is two, two candidate output words a and b can be determined at time step t. Then, the candidate output words a and b can be used in the text processing process of the next time step to determine candidate output words c and d at time step t+1.
一部の実施例において、各タイムステップ毎の候補出力単語を決定する時、出力確率分布における出力確率が最も高い所定数のM個(上記の例では、Mは2である)の単語を候補出力単語として決定する。Mは2以上の整数である。 In some embodiments, when determining candidate output words for each time step, a predetermined number M (in the above example, M is 2) of words with the highest output probability in the output probability distribution are determined as candidate output words. M is an integer equal to or greater than 2.
他の一部の実施例において、各タイムステップ毎の候補出力単語を決定する時、事前定義された方法に基づいて出力確率分布における選択出力確率が最も高いN個の単語を決定し、かつこれらのN個の単語のうちM個の単語を候補出力単語として決定してもよい。NはMより大きい整数である。一部の実装形態において、予めNの数値を指定してもよい。 In some other embodiments, when determining candidate output words for each time step, N words with the highest selection output probability in the output probability distribution may be determined based on a predefined method, and M words out of these N words may be determined as candidate output words. N is an integer greater than M. In some implementations, the value of N may be specified in advance.
他の一部の実施方法において、出力確率閾値を事前に決定し、出力確率が前記出力確率閾値より大きいN個の単語の中からM個の単語を候補出力単語として決定してもよい。 In some other implementations, an output probability threshold may be determined in advance, and M words from among N words whose output probabilities are greater than the output probability threshold may be determined as candidate output words.
出力確率の最も高いN個の単語のうち外部情報に含まれる単語が存在しない場合、これらのN個の単語のうち出力確率の最も高いM個の単語を候補出力単語として決定する。 If there is no word included in the external information among the N words with the highest output probability, the M words with the highest output probability among these N words are determined as candidate output words.
出力確率の最も高いN個の単語のうち外部情報に含まれる単語が存在する場合、これらのN個の単語に存在する、外部情報に含まれる単語の数nがM以上であるとこれらのN個の単語における出力確率の最も高いかつ外部情報に含まれるM個の単語を候補出力単語として決定する。これらのN個の単語に存在する、外部情報に含まれる単語数nが所定数Mより小さいと、これらのN個の単語における外部情報に含まれる単語と残りのN-n個の単語における出力確率の最も高いM-n個の単語を候補出力単語として決定する。 When there is a word included in the external information among the N words with the highest output probability, if the number n of words included in the external information that are present in these N words is M or more, the M words included in the external information that have the highest output probability among these N words are determined as candidate output words. If the number n of words included in the external information that are present in these N words is less than a predetermined number M, the words included in the external information among these N words and the M-n words with the highest output probability among the remaining N-n words are determined as candidate output words.
タイムステップtに出力した候補出力単語a、bとタイムステップt+1の候補出力単語c、dとを利用して少なくとも4個の出力候補系列ac、ad、bc、bdが決定でき、同時確率の方法で各出力候補系列の出力確率を決定し、4個の出力系列ac、ad、bc、bd候補のうち出力確率の最も高い2つをタイムステップt+1後の候補テキストとして決定する。 At least four output candidate sequences ac, ad, bc, bd can be determined using the candidate output words a, b output at time step t and the candidate output words c, d at time step t+1. The output probability of each output candidate sequence is determined using a joint probability method, and the two with the highest output probabilities among the four output sequence candidates ac, ad, bc, bd are determined as the candidate text after time step t+1.
例えば、候補出力単語a、b、c、dの出力確率はそれぞれPa、Pb、Pc及びPdで示すことができる。出力候補系列ac、ad、bc、bdはそれぞれPac=Pa*Pc、Pad=Pa*Pd、Pbc=Pb*Pc、及びPbd=Pb*Pdで示すことができる。Pac>Pad>Pbc>Pbdである場合、タイムステップt+1で出力系列ac、adを後続のテキスト処理に使用する。 For example, the output probabilities of candidate output words a, b, c, d can be denoted as Pa , Pb , Pc , and Pd , respectively. The output candidate sequences ac, ad, bc, bd can be denoted as Pa = Pa * Pc , Pa = Pa * Pd , Pbc = Pb * Pc , and Pbd = Pb * Pd, respectively. If Pa > Pa > Pb > Pbd , the output sequences ac, ad are used for subsequent text processing at time step t+1.
一部の実施例において、また外部情報に基づいて出力候補系列を決定してもよい。例えば、式(6)を利用して出力候補系列のペナルティ値を決定できる。 In some embodiments, the output candidate sequence may also be determined based on external information. For example, the penalty value for the output candidate sequence may be determined using equation (6).
一実装形態において、いかなる可能なテキスト類似度アルゴリズムでタイムステップtの前に生成した候補テキスト系列と外部情報との間の類似度を決定してもよい。例えば、コサイン類似度の方法を使用してタイムステップtの前に生成した候補テキスト系列と外部情報との間の類似度を決定することができる。 In one implementation, any possible text similarity algorithm may be used to determine the similarity between the candidate text sequences generated before time step t and the external information. For example, a cosine similarity method may be used to determine the similarity between the candidate text sequences generated before time step t and the external information.
上記式(6)を利用して、タイムステップtの前に生成された候補テキスト系列と外部情報との間の類似度が高いほど、ペナルティ値は、出力候補系列の出力確率を増やすために用いられる。一部の実装形態において、ペナルティ値s(x,y)と出力候補系列における出力確率とを乗算又は加算し、タイムステップtの前に生成された候補テキスト系列と外部情報との間の類似度に基づいて出力候補系列を決定する効果を実現することができる。 Using the above formula (6), the higher the similarity between the candidate text sequence generated before time step t and the external information, the more the penalty value is used to increase the output probability of the output candidate sequence. In some implementations, the penalty value s(x,y) can be multiplied or added to the output probability in the output candidate sequence to achieve the effect of determining the output candidate sequence based on the similarity between the candidate text sequence generated before time step t and the external information.
即ち、外部情報に基づいて上記出力候補系列に使用されるペナルティ値を決定することにより、外部情報が候補テキスト系列に現れる確率を高めることができる。それによって、外部情報が最終的に出力されるテキスト処理結果に表れる確率を高めることができる。 That is, by determining the penalty value to be used for the output candidate sequence based on external information, the probability that the external information will appear in the candidate text sequence can be increased, thereby increasing the probability that the external information will appear in the final output text processing result.
他の実装形態において、ステップS906は部情報と前記ソーステキスト符号化隠れ状態との間の類似度を決定し、外部情報と前記ソーステキスト符号化隠れ状態との間の類似度に基づいて現在タイムステップで出力しようとする単語を決定することを含んでもよい。 In another implementation, step S906 may include determining a similarity between the external information and the source text coding hidden state, and determining a word to be output at the current time step based on the similarity between the external information and the source text coding hidden state.
例えば、符号化ネットワークを利用して前記外部情報を符号化して外部情報符号化隠れ状態を得てもよい。 For example, the extrinsic information may be encoded using a coding network to obtain an extrinsic information encoded hidden state.
ステップS906は、前記外部情報符号化隠れ状態と前記復号化隠れ状態の類似度を決定することを含んでもよい。外部情報符号化隠れ状態と前記復号化隠れ状態との類似度が事前定義された類似度閾値以上である場合、前記外部情報を出力して現在タイムステップの出力としてもよい。 Step S906 may include determining a similarity between the extrinsic information encoded hidden state and the decoded hidden state. If the similarity between the extrinsic information encoded hidden state and the decoded hidden state is greater than or equal to a predefined similarity threshold, the extrinsic information may be output as the output for the current time step.
前記外部情報が単語である場合、前記外部情報を現在タイムステップの単語として出力してもよい。前記外部情報が文である場合、前記外部情報を直接現在タイムステップtの前に生成されたテキスト系列の後に挿入してもよい。 If the extrinsic information is a word, the extrinsic information may be output as the word of the current time step. If the extrinsic information is a sentence, the extrinsic information may be inserted directly after the text sequence generated before the current time step t.
なお、現在タイムステップtの前に既に生成されたテキスト系列は、前記出力確率分布における確率の最も高い単語に基づいて生成されたのであってもよく、出力確率分布における確率の最も高いいくつかの候補出力単語に基づいて生成されてもよい。前記実装方法において説明したプロセスによって採用候補出力単語を決定すればよく、ここでは、詳しく説明しない。 Note that the text sequence already generated before the current time step t may have been generated based on the most probable word in the output probability distribution, or may be generated based on some of the most probable candidate output words in the output probability distribution. The candidate output words to be adopted may be determined by the process described in the implementation method, and will not be described in detail here.
外部情報符号化隠れ状態と前記復号化隠れ状態との類似度が事前定義の類似度閾値より小さい場合、前記復号化ネットワークから出力される結果に基づいて現在タイムステップの出力単語確率分布を決定し、現在タイムステップの出力単語確率分布に基づいて現在タイムステップの出力単語を決定する。 If the similarity between the extrinsic information encoded hidden state and the decoded hidden state is less than a predefined similarity threshold, an output word probability distribution for the current time step is determined based on the results output from the decoding network, and an output word for the current time step is determined based on the output word probability distribution for the current time step.
上記方法を利用して、復号化ネットワークから出力される結果と外部情報との間の類似度がより高い時、直接外部情報で復号化ネットワークから出力される結果を置き換えてもよい。即ち、この場合、現在タイムステップの出力後に決定したテキスト系列の結果は直前のタイムステップの出力後に決定したテキスト系列の後に外部情報を挿入して得られた結果である。 Using the above method, when the similarity between the result output from the decoding network and the external information is higher, the result output from the decoding network may be directly replaced with the external information. That is, in this case, the result of the text sequence determined after the output of the current time step is the result obtained by inserting the external information after the text sequence determined after the output of the previous time step.
その後、次のタイムステップの処理を行う時、復号化ネットワークを利用して外部情報を符号化して次のタイムステップの復号化隠れ状態を得て、後の復号化プロセスが外部情報の結果を利用できるようにすることで、後の復号化で得られた結果と挿入した外部情報との間のセマンティック一貫性を保証することができる。 Then, when processing the next time step, we use the decoding network to encode the extrinsic information to obtain the decoded hidden state of the next time step, so that the later decoding process can use the results of the extrinsic information, thereby ensuring semantic consistency between the results obtained in the later decoding and the inserted extrinsic information.
外部情報が単語である場合、直前のタイムステップの復号化隠れ状態と外部情報を利用して復号化ネットワークの入力として処理を行い、現在タイムステップの復号化隠れ状態を取得することができる。 When the external information is a word, the decoded hidden state of the previous time step and the external information can be used to process it as the input of the decoding network to obtain the decoded hidden state of the current time step.
外部情報に複数の単語を含む場合、復号化ネットワークで数回のループ処理を行う。第1個目のループにおける復号化ネットワークの入力は直前のタイムステップの復号化隠れ状態と外部情報の第1個目の単語であり、その後のループにおける復号化ネットワークの入力は前回ループで得られた復号化隠れ状態と外部情報の次の単語である。数回のループにより外部情報における単語毎に処理することができ、全ての外部情報を含む復号化隠れ状態を取得して現在タイムステップの復号化隠れ状態とする。 When the external information contains multiple words, the decoding network performs several loop processes. The inputs to the decoding network in the first loop are the decoded hidden state of the previous time step and the first word of the external information, and the inputs to the decoding network in subsequent loops are the decoded hidden state obtained in the previous loop and the next word of the external information. By performing several loops, it is possible to process each word in the external information, and a decoded hidden state containing all the external information is obtained, which becomes the decoded hidden state of the current time step.
一部の実装形態において、既に外部情報で復号化ネットワークから出力される結果に置き換えテキスト処理結果に挿入した後は、上記外部情報符号化隠れ状態と前記復号化隠れ状態との類似度比較を実行しない。 In some implementations, after the external information has already been substituted into the results output by the decoding network and inserted into the text processing results, a similarity comparison between the external information encoded hidden state and the decoded hidden state is not performed.
一部の例において、上記類似度閾値は所定のタイムステップtに関する関数によって実装されてもよい。 In some examples, the similarity threshold may be implemented as a function with respect to a given time step t.
前述したように、外部情報符号化隠れ状態と前記復号化隠れ状態の類似度が事前定義された類似度閾値より小さい場合、上記外部情報で復号化ネットワークの出力を置き換えて出力にする動作を実行せず、出力単語確率分布に基づいて出力結果を決定する。この場合、外部情報が最終のテキスト処理結果に表れる確率を高めるために、前記現在タイムステップの類似度閾値を調整することで調整後の類似度閾値を決定し、前記調整後の類似度閾値は、前記現在タイムステップの類似度閾値より小さく、かつ前記調整後の類似度閾値は次のタイムステップの類似度閾値として使用される。 As described above, if the similarity between the external information encoded hidden state and the decoded hidden state is smaller than a predefined similarity threshold, the operation of replacing the output of the decoding network with the external information is not performed, and the output result is determined based on the output word probability distribution. In this case, in order to increase the probability that the external information appears in the final text processing result, an adjusted similarity threshold is determined by adjusting the similarity threshold of the current time step, the adjusted similarity threshold is smaller than the similarity threshold of the current time step, and the adjusted similarity threshold is used as the similarity threshold of the next time step.
例えば、式(7)を利用して類似度閾値を調整する。 For example, adjust the similarity threshold using equation (7).
各タイムステップ毎に類似度閾値について単調減少の調整を実行することで、外部情報と復号化部の出力結果間の類似度がテキスト処理プロセスにて類似度閾値がより低いレベルまで低減されるため、外部情報と復号化ネットワークの出力結果間の類似度が現在タイムステップの類似度閾値より大きくなる確率が増えるようになる。即ち、外部情報が最終のテキスト処理結果に現れる確率が増えるようになる。 By performing a monotonically decreasing adjustment of the similarity threshold for each time step, the similarity between the external information and the output result of the decoding unit is reduced to a lower level in the text processing process, so that the probability that the similarity between the external information and the output result of the decoding network will be greater than the similarity threshold for the current time step increases. In other words, the probability that the external information will appear in the final text processing result increases.
図10で本願の実施例にかかるあるテキスト処理方法の例示的フローチャートを示している。 Figure 10 shows an exemplary flowchart of a text processing method according to an embodiment of the present application.
ステップS1002において、前記ソーステキスト符号化隠れ状態を取得するためにソーステキストを符号化する。 In step S1002, the source text is encoded to obtain the source text encoded hidden state.
ステップS1004において、復号化隠れ状態を決定する。 In step S1004, the decoded hidden state is determined.
ステップS1006において、前記ソーステキスト符号化隠れ状態と前記復号化隠れ状態とに基づいて各タイムステップ毎の出力単語を決定し、候補テキストを決定する。 In step S1006, output words are determined for each time step based on the source text encoded hidden state and the decoded hidden state, and candidate texts are determined.
ステップS1008において、外部情報に基づいて前記候補テキストに対して後処理を行い、外部情報を含む出力テキストを決定する。 In step S1008, post-processing is performed on the candidate text based on the external information to determine an output text that includes the external information.
ステップS1006から出力される結果に外部情報を含まない場合、ステップS1006から出力される結果を候補テキストとし、外部情報に基づいて前記候補テキストに対して後処理を行い、外部情報を含む出力テキストを決定する。 If the result output from step S1006 does not include external information, the result output from step S1006 is set as candidate text, and post-processing is performed on the candidate text based on the external information to determine an output text that includes external information.
一部の実施例において、外部情報は予め指定された情報を含んでもよい。例えば、外部情報は予め指定された文であってもよく、予め指定された単語を含むソーステキストにおける文であってもよい。 In some implementations, the external information may include pre-specified information. For example, the external information may be a pre-specified sentence, or a sentence in the source text that includes a pre-specified word.
前記予め指定された外部情報が文である場合、前記候補テキストにおける文と前記外部情報の類似度を決定してもよい。前記類似度が所定の候補類似度閾値より大きい場合、前記候補テキストにおける前記文を前記外部情報に置き換えてもよい。 If the pre-specified external information is a sentence, a similarity between the sentence in the candidate text and the external information may be determined. If the similarity is greater than a pre-defined candidate similarity threshold, the sentence in the candidate text may be replaced with the external information.
事前決定される外部情報が単語である場合、前記候補テキストにおける文と前記外部情報の類似度を決定し、前記類似度が所定の候補類似度閾値より大きい場合、前記候補テキストにおける前記文を前記外部情報に置き換えてもよい。 If the predetermined external information is a word, a similarity between a sentence in the candidate text and the external information may be determined, and if the similarity is greater than a predetermined candidate similarity threshold, the sentence in the candidate text may be replaced with the external information.
一部の実装形態において、前記類似度が所定の候補類似度閾値より大きい場合、前記候補テキストにおける前記文を削除し、外部情報としての文又は、外部情報としての単語を含む文で削除された候補テキストにおける文に置き換えてもよい。 In some implementations, if the similarity is greater than a predefined candidate similarity threshold, the sentence in the candidate text may be deleted and replaced with an external sentence or a sentence containing the external word in the deleted candidate text.
一部の例において、ソーステキストにおける外部情報と候補テキストにおける余剰情報のソーステキストにおける相関性に基づいて前記残りの情報に外部情報を挿入する。例えば、外部情報と候補テキストにおける余剰情報がソーステキストに現れる順番に基づいて外部情報を候補テキストの余剰情報に挿入する。 In some examples, the external information is inserted into the remaining information based on a correlation in the source text between the external information in the source text and the redundant information in the candidate text. For example, the external information is inserted into the redundant information of the candidate text based on the order in which the external information and the redundant information in the candidate text appear in the source text.
他の一部の実施方法において、前記類似度が所定の候補類似度閾値より小さい場合、前記外部情報と前記候補テキストにおける文の前記ソーステキストにおける相関性に基づいて、前記候補テキストに外部情報を挿入する。 In some other implementations, if the similarity is less than a predefined candidate similarity threshold, external information is inserted into the candidate text based on correlations in the source text between the external information and sentences in the candidate text.
前記外部情報と前記候補テキストにおける各文の間の類似度を比較してもよい。前記外部情報と前記候補テキストにおける各文の類似度とも所定の候補類似度閾値より小さい場合、生成したテキスト処理結果に外部情報に類似する情報が含まれてないことを意味する。この場合、外部情報と候補テキストについて直接つづり合いを行い、最終のテキスト処理結果を決定してもよい。 The similarity between the external information and each sentence in the candidate text may be compared. If the similarity between the external information and each sentence in the candidate text is smaller than a predetermined candidate similarity threshold, this means that the generated text processing result does not contain information similar to the external information. In this case, a direct spelling match may be performed between the external information and the candidate text to determine the final text processing result.
例えば、外部情報と候補テキストにおける文がソーステキストに現れる順番に従って、外部情報を候補テキストに挿入することで、最終のテキスト処理結果を決定してもよい。 For example, the final text processing result may be determined by inserting external information into the candidate text according to the order in which the external information and sentences in the candidate text appear in the source text.
本願にかかる上記テキスト処理方法を利用して、効果的にテキスト処理結果に外部情報の内容を追加することができ、テキスト処理結果に期待する外部情報の内容を追加することが保証できる。 By utilizing the above text processing method according to the present application, it is possible to effectively add external information content to the text processing results, and it is possible to ensure that the expected external information content is added to the text processing results.
本願にかかるテキスト処理方法を利用して、テキストの生成プロセスにおいて、外部情報を利用して現在タイムステップのアテンション分布を決定すること及び/又は、外部情報に基づいて現在タイムステップの出力単語を決定することで、テキスト処理のプロセスにおいて外部情報の内容を有効に考慮でき、テキスト生成のプロセスにおいて外部情報を生成する確率を高め、外部情報を考慮する場合にテキストを生成する效果を改善することができる。 By using the text processing method of the present application, in the text generation process, the content of the external information can be effectively taken into account in the text processing process by determining the attention distribution of the current time step using external information and/or determining the output words of the current time step based on the external information, thereby increasing the probability of generating external information in the text generation process and improving the effect of generating text when external information is taken into account.
また、本願の実施例にかかる方法又は装置は、図11に示す計算デバイスの構造によって実装されてもよい。図11で当該計算デバイスの構造を示している。図11に示すように、計算デバイス1100はバス1110、1つ又は少なくとも2つのCPU1120、読み取り専用メモリ(ROM)1130、ランダムアクセスメモリ(RAM)1140、ネットワークに接続された通信ポート1150、入力/出力部品1160、ハードディスク1170等を含んでもよい。計算デバイス1100におけるメモリデバイス、例えばROM1130又はハードディスク1170は本願によって提供されるビデオにおいて目標を検出ための方法の処理及び/又は通信で使用する各種データ又はファイル及びCPUの実行するプログラミングコマンドを記録してもよい。計算デバイス1100はユーザインタフェース1180を含んでもよい。当然のことながら、図11に示す構造は例示的なものであって、異なるデバイスを実装する場合、実際のニーズに応じて図11に示す計算デバイスにおける1つ以上の部品を省略してもよい。
The method or apparatus according to the embodiment of the present application may also be implemented by the structure of a computing device shown in FIG. 11. FIG. 11 shows the structure of the computing device. As shown in FIG. 11, the
本願の実施例は、さらにコンピュータ読み取り可能な記録媒体によって実装されてもよい。本願の実施例のコンピュータ読み取り可能な記録媒体にコンピュータ読み取り可能なコマンドが記録されている。前記コンピュータ読み取り可能なコマンドはプロセッサによって実行される場合、上記図面で説明している本願の実施例の方法を参照して実行してよい。前記コンピュータ読み取り可能な記録媒体は例えば揮発性メモリ及び/又は非揮発性メモリを含んでもよいがこれに限られない。前記揮発性メモリは例えばランダムアクセスメモリ(RAM)及び/又はキャッシュ(cache)等を含んでもよい。前記非発揮性メモリは例えば読み取り専用メモリ(ROM)、ハードディスク、フラッシュメモリ等を含んでもよい。 The embodiments of the present application may further be implemented by a computer-readable recording medium. Computer-readable commands are recorded on the computer-readable recording medium of the embodiments of the present application. When the computer-readable commands are executed by a processor, they may be executed with reference to the methods of the embodiments of the present application described in the above drawings. The computer-readable recording medium may include, but is not limited to, volatile memory and/or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and/or cache. The non-volatile memory may include, for example, read-only memory (ROM), a hard disk, flash memory, etc.
当業者が理解できるように、本願に記載される内容は各種の変形及び改善ができる。例えば、上記で説明した各種デバイス又は部品はハードウェアによって実装されてもよく、ソフトウェア、ファームウェア、又はそれらのうち、一部又は全部の組み合わせで実装されもよい。 As will be understood by those skilled in the art, the contents described herein may be modified and improved in various ways. For example, the various devices or components described above may be implemented in hardware, software, firmware, or a combination of some or all of these.
また、本願及び特許請求の範囲に示すように、文脈で例外のケースが明確に示される場合以外、「一」、「一個」、「一種」及び/又は「当該」等単語は単数形を指すわけではなく、複数形を含んでもよい。一般的には、「含む」や「含まれる」は、単に既に明確に符合をつけたステップ及び要素を含むことを示すだけで、これらのステップ及び要素は、網羅的なものではなく、方法又はデバイスは、他のステップ又は要素を含む可能性もある。 Also, as shown in the present application and the claims, unless the context clearly indicates an exception case, words such as "a," "one," "a kind," and/or "the" do not refer to the singular but may include the plural. In general, "comprise" or "comprises" merely indicates the inclusion of steps and elements already clearly labeled, but these steps and elements are not exhaustive and the method or device may include other steps or elements.
また、本願では、本願の実施例にかかるシステムにおける一部のユニットに対して各種の援用をしているが、任意の数の異なるユニットは、ユーザ側及び/又はサーバ側に使用され、実行されうる。前記ユニットは説明的なものであって、前記システムと方法の異なる態様は異なるユニットを使用してもよい。 In addition, although the present application makes various references to some of the units in the systems according to the embodiments of the present application, any number of different units may be used and executed on the user side and/or the server side. The units are illustrative, and different aspects of the systems and methods may use different units.
なお、本願では、フローチャートで本願の実施例にかかるシステムが実行する動作について説明している。なお、前の、又は後の動作は順番で実行されなくてもよい。逆に、逆の順序で、又は同時に各ステップを処理してもよい。それとともに、ほかの動作をこれらのプロセスに追加してもよく、又はこれらのプロセスから、あるステップ又は複数のステップを省略してもよい。 Note that in this application, the operations performed by the system according to the embodiment of the application are described using flowcharts. Note that the previous or subsequent operations do not have to be performed in order. Conversely, each step may be processed in the reverse order or simultaneously. Additionally, other operations may be added to these processes, or a step or multiple steps may be omitted from these processes.
特に定義されない限り、ここで使用される全ての用語(技術及び科学的用語を含む)は、当業者が一般的に理解する意味と同じ意味を有している。なお、特に定義されない限り、例えば、通常辞書によって定義される用語は、それらの関連技術の文脈での意味と一致する意味を有し、理想化又は形式上の意味で解釈するものではない。 Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art. Unless otherwise defined, for example, terms normally defined by dictionaries have meanings consistent with their meaning in the context of their related art and are not to be construed in an idealized or formal sense.
以上は本発明についての説明であり、本発明を制限するものではない。本発明の複数の例示的な実施例について説明したが、本発明の斬新の教示及び利点から背離しない限り、上記例示的な実施例に対して各種の修正を行ってもよいことは、当業者が理解しうる。したがって、これらの修正意図は請求項で限定する本発明の範囲に含まれるものである。なお、上記は本発明についての説明であり、開示された特定の実施例に限られるものではなく、開示された実施例及び他の実施例に対する修正意図も添付の特許請求の範囲に含まれる。本発明は特許請求の範囲及びその均等物に限定されるものである。 The above is a description of the present invention, but is not intended to limit the present invention. Although several exemplary embodiments of the present invention have been described, those skilled in the art will understand that various modifications may be made to the exemplary embodiments without departing from the novel teachings and advantages of the present invention. Therefore, these modifications are intended to be included within the scope of the present invention, which is defined by the claims. Note that the above is a description of the present invention, and is not limited to the specific embodiments disclosed, and modifications to the disclosed embodiments and other embodiments are also intended to be included within the scope of the appended claims. The present invention is limited to the claims and their equivalents.
Claims (7)
ソーステキスト符号化隠れ状態を取得するために、符号化ネットワークによってソーステキストの単語ベクトルを符号化するように構成される符号化部と、
復号化ネットワークによって前記符号化部の出力を復号化して復号化隠れ状態を決定するように構成される復号化部と、
ソーステキストアテンション決定部を含むように構成されるアテンション生成部であって、前記ソーステキストアテンション決定部は、各タイムステップにおいて、現在タイムステップの前記ソーステキスト符号化隠れ状態と前記復号化隠れ状態とを利用して前記ソーステキストにおける単語毎の符号化アテンションパラメータを計算し、前記ソーステキストのうちの各単語の前記符号化アテンションパラメータにsoftmax関数を運用して前記ソーステキストのうちの各単語のアテンションを含む前記ソーステキストの符号化アテンション分布を計算し、前記ソーステキストのうちの各単語が外部情報に含まれているかどうかに基づいて該当単語のアテンションを調整することで前記符号化アテンション分布を調整し、調整した符号化アテンション分布を現在タイムステップのアテンション分布として出力する、アテンション生成部と、
現在タイムステップの前記アテンション分布及び前記ソーステキスト符号化隠れ状態に基づいてコンテキストベクトルを取得し、前記コンテキストベクトル及び前記復号化隠れ状態に基づいて生成確率分布を計算し、前記生成確率分布と前記アテンション分布とを重み付け加算することで出力単語確率分布を計算し、前記出力単語確率分布のうち確率の最も高い単語を現在タイムステップの出力単語として決定する、出力部と、を含み、
前記外部情報は、予め定義された、前記ソーステキストの処理結果として期待されるテキスト情報である、テキスト処理装置。 A text processing device that processes word vectors of a source text based on a sequence-to-sequence model while taking into account external information, comprising:
an encoding unit configured to encode the word vectors of the source text by a coding network to obtain a source text encoded hidden state;
a decoding unit configured to decode an output of the encoding unit by a decoding network to determine a decoded hidden state;
an attention generation unit configured to include a source text attention determination unit, the source text attention determination unit calculating, at each time step, an encoding attention parameter for each word in the source text using the source text encoding hidden state and the decoded hidden state of a current time step, calculating an encoding attention distribution of the source text including attention of each word in the source text by applying a softmax function to the encoding attention parameter of each word in the source text, adjusting the encoding attention distribution by adjusting the attention of the corresponding word based on whether each word in the source text is included in external information, and outputting the adjusted encoding attention distribution as an attention distribution of a current time step ;
an output unit that obtains a context vector based on the attention distribution and the source text encoding hidden state of a current time step, calculates a generation probability distribution based on the context vector and the decoded hidden state, calculates an output word probability distribution by weighting and adding the generation probability distribution and the attention distribution, and determines a word with the highest probability in the output word probability distribution as an output word of the current time step ;
A text processing device, wherein the external information is predefined text information expected as a result of processing the source text.
外部情報アテンション決定部をさらに含み、
前記ソーステキストにおける各単語の外部アテンションパラメータを決定し、外部情報に含まれる単語の外部アテンションパラメータは所定の第一外部アテンションパラメータに決定され、外部情報に含まれていない単語の外部アテンションパラメータは所定の第二外部アテンションパラメータに決定され、前記第一外部アテンションパラメータは前記第二外部アテンションパラメータより大きく、
前記アテンション生成部は、前記符号化アテンションパラメータと外部アテンションパラメータとの和に基づいて前記ソーステキストにおける各単語用のアテンションパラメータを決定し、
softmax関数を運用することで、前記アテンションパラメータに基づいて前記ソーステキスト用の現在タイムステップのアテンション分布を決定するように構成される請求項1に記載のテキスト処理装置。 The attention generation unit,
Further comprising an external information attention determining unit,
determining an external attention parameter for each word in the source text, the external attention parameter of the word included in the external information being determined to be a predetermined first external attention parameter, the external attention parameter of the word not included in the external information being determined to be a predetermined second external attention parameter, the first external attention parameter being greater than the second external attention parameter;
the attention generator determines an attention parameter for each word in the source text based on a sum of the encoded attention parameter and an external attention parameter;
The text processing device according to claim 1 , configured to determine an attention distribution for a current time step for the source text based on the attention parameters by operating a softmax function.
前記外部情報に基づいて、前記ソーステキストに対する、前記ソーステキストにおける各単語用の選択確率を含む選択確率分布を決定し、
前記ソーステキストにおける、前記外部情報に含まれる少なくとも1つの単語に対して、当該少なくとも1つの単語の選択確率を少なくとも予め定義された確率値として決定し、
前記アテンション分布を取得するために、前記ソーステキストにおける各単語に対して、当該単語の選択確率に基づいて当該単語のアテンションを決定するように構成される請求項1に記載のテキスト処理装置。 The attention generation unit is
determining a selection probability distribution for the source text based on the external information, the selection probability distribution including a selection probability for each word in the source text;
determining, for at least one word in the source text included in the external information, a selection probability of the at least one word as at least a predefined probability value;
The text processing apparatus according to claim 1 , configured to determine, for each word in the source text, attention for the word based on a selection probability of the word, in order to obtain the attention distribution.
当該単語の選択確率が所定の選択確率閾値より小さい場合、前記現在タイムステップのアテンション分布における当該単語のアテンションを0と決定し、
当該単語の選択確率が所定の選択確率閾値以上である場合、前記現在タイムステップのアテンション分布における当該単語用のアテンションをソーステキストの符号化アテンション分布における当該単語のアテンションとして決定することを含む請求項3に記載のテキスト処理装置。 determining, for each word in the source text, attention for the word based on a selection probability of the word,
If the selection probability of the word is less than a predetermined selection probability threshold, determine the attention of the word in the attention distribution of the current time step as 0;
The text processing device of claim 3 , further comprising: determining, if the selection probability of the word is greater than or equal to a predetermined selection probability threshold, the attention for the word in the attention distribution of the current time step as the attention for the word in the encoded attention distribution of the source text.
前記符号化部において、トレーニングソーステキスト符号化隠れ状態を取得するために符号化ネットワークによってトレーニングソーステキストの単語ベクトルを符号化するステップと、
前記復号化部において、復号化ネットワークによって前記符号化部の出力を復号化してトレーニング復号化隠れ状態を決定するステップと、
前記アテンション生成部において、前記外部情報、前記トレーニングソーステキスト符号化隠れ状態及び前記トレーニング復号化隠れ状態に基づいて現在タイムステップのトレーニングアテンション分布を決定するステップと、
トレーニング出力単語を決定するために、前記トレーニングアテンション分布、前記トレーニングソーステキスト符号化隠れ状態、前記トレーニング復号化隠れ状態に基づいてトレーニング出力単語確率分布を決定するステップと、
前記トレーニング出力単語と前記外部情報に含まれる単語との間の差異が最小となるように、前記符号化部、前記アテンション生成部、前記復号化部におけるパラメータを調整するステップとによってトレーニングされる請求項1から4のいずれかに記載のテキスト処理装置。 The encoding unit, the attention generating unit, and the decoding unit
In the encoding unit, encoding the word vectors of the training source text by an encoding network to obtain a training source text encoding hidden state;
in said decoding unit , decoding the output of said encoding unit by a decoding network to determine training decoded hidden states;
determining a training attention distribution for a current time step based on the external information, the training source text encoded hidden state, and the training decoded hidden state in the attention generation unit;
determining a training output word probability distribution based on the training attention distribution, the training source text encoded hidden states, and the training decoded hidden states to determine training output words;
A text processing device as described in any one of claims 1 to 4, which is trained by a step of adjusting parameters in the encoding unit, the attention generation unit, and the decoding unit so that differences between the training output words and words contained in the external information are minimized.
ソーステキスト符号化隠れ状態を取得するために、符号化ネットワークによってソーステキストの単語ベクトルを符号化するステップと、
復号化ネットワークによって符号化ネットワークの出力を復号化して復号化隠れ状態を決定するステップと、
各タイムステップにおいて、現在タイムステップの前記ソーステキスト符号化隠れ状態と前記復号化隠れ状態とを利用して前記ソーステキストにおける単語毎の符号化アテンションパラメータを計算し、前記ソーステキストのうちの各単語の前記符号化アテンションパラメータにsoftmax関数を運用して前記ソーステキストのうちの各単語のアテンションを含む前記ソーステキストの符号化アテンション分布を計算し、前記ソーステキストのうちの各単語が外部情報に含まれているかどうかに基づいて該当単語のアテンションを調整することで前記符号化アテンション分布を調整し、調整した符号化アテンション分布を現在タイムステップのアテンション分布として出力するステップと、
現在タイムステップの前記アテンション分布及び前記ソーステキスト符号化隠れ状態に基づいてコンテキストベクトルを取得し、前記コンテキストベクトル及び前記復号化隠れ状態に基づいて生成確率分布を計算し、前記生成確率分布と前記アテンション分布とを重み付け加算することで出力単語確率分布を計算し、前記出力単語確率分布のうち確率の最も高い単語を現在タイムステップの出力単語として決定するステップと、を含み、
前記外部情報は、予め定義された、前記ソーステキストの処理結果として期待されるテキスト情報である、テキスト処理装置に基づくテキスト処理方法。 A text processing method for performing processing on word vectors of a source text based on a sequence-to-sequence model while taking into account external information, comprising:
encoding the word vectors of the source text by an encoding network to obtain a source text encoding hidden state;
Decoding the output of the encoding network by a decoding network to determine a decoded hidden state;
In each time step, calculating an encoding attention parameter for each word in the source text using the source text encoding hidden state and the decoded hidden state of a current time step , calculating an encoding attention distribution of the source text including attention of each word in the source text by applying a softmax function to the encoding attention parameter of each word in the source text, adjusting the attention of the corresponding word based on whether each word in the source text is included in external information, and outputting the adjusted encoding attention distribution as an attention distribution of a current time step ;
obtaining a context vector based on the attention distribution and the source text encoding hidden state of a current time step, calculating a generation probability distribution based on the context vector and the decoded hidden state, calculating an output word probability distribution by weightedly adding the generation probability distribution and the attention distribution, and determining a word with the highest probability in the output word probability distribution as an output word of the current time step ;
A text processing method based on a text processing apparatus, wherein the external information is predefined text information expected as a result of processing the source text.
コンピュータ読み取り可能なプログラミングコマンドを記憶したメモリと、を含み、
前記コンピュータ読み取り可能なプログラミングコマンドが前記プロセッサによって実行される場合、請求項6に記載のテキスト処理方法を実行するテキスト処理デバイス。 A processor;
a memory having computer readable programming commands stored therein;
A text processing device which performs the text processing method of claim 6 when the computer readable programming instructions are executed by the processor.
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201910894221.0 | 2019-09-20 | ||
| CN201910894221.0A CN112541325A (en) | 2019-09-20 | 2019-09-20 | Text processing device, method, apparatus, and computer-readable storage medium |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JP2021051710A JP2021051710A (en) | 2021-04-01 |
| JP7555702B2 true JP7555702B2 (en) | 2024-09-25 |
Family
ID=75012672
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2019209175A Active JP7555702B2 (en) | 2019-09-20 | 2019-11-19 | Text processing apparatus, method, device and computer-readable recording medium |
Country Status (2)
| Country | Link |
|---|---|
| JP (1) | JP7555702B2 (en) |
| CN (1) | CN112541325A (en) |
Families Citing this family (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN114491004B (en) * | 2021-12-31 | 2025-02-21 | 北京五八赶集信息技术有限公司 | Title generation method, device, electronic device and storage medium |
| CN116030468A (en) * | 2022-12-27 | 2023-04-28 | 科大讯飞股份有限公司 | Method and device for determining reading order, electronic device and storage medium |
Family Cites Families (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108509413A (en) * | 2018-03-08 | 2018-09-07 | 平安科技(深圳)有限公司 | Digest extraction method, device, computer equipment and storage medium |
| CN109190091B (en) * | 2018-08-02 | 2023-03-24 | 义语智能科技(上海)有限公司 | Encoding and decoding method and device |
| CN109670035B (en) * | 2018-12-03 | 2021-03-23 | 科大讯飞股份有限公司 | Text abstract generating method |
| CN110188348B (en) * | 2019-05-07 | 2023-05-19 | 南京邮电大学 | Chinese language processing model and method based on deep neural network |
| CN110188167B (en) * | 2019-05-17 | 2021-03-30 | 北京邮电大学 | An end-to-end dialogue method and system incorporating external knowledge |
-
2019
- 2019-09-20 CN CN201910894221.0A patent/CN112541325A/en active Pending
- 2019-11-19 JP JP2019209175A patent/JP7555702B2/en active Active
Non-Patent Citations (1)
| Title |
|---|
| 石垣達也 他4名,コピー機構を用いたクエリ指向ニューラル生成型要約,情報処理学会研究報告,日本,情報処理学会,2019年06月06日,Vol.2019-NL-240 No.3 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN112541325A (en) | 2021-03-23 |
| JP2021051710A (en) | 2021-04-01 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN110347799B (en) | Language model training method and device and computer equipment | |
| JP7555701B2 (en) | Text processing apparatus, method, device and computer-readable recording medium | |
| KR102382499B1 (en) | Translation method, target information determination method, related apparatus and storage medium | |
| JP7346788B2 (en) | Speech recognition model training methods, devices, equipment, and storage media | |
| US11972365B2 (en) | Question responding apparatus, question responding method and program | |
| CN109344413B (en) | Translation processing method, translation processing device, computer equipment and computer readable storage medium | |
| CN110795912B (en) | Method, device, equipment and storage medium for encoding text based on neural network | |
| CN111651573B (en) | A method, device and electronic device for generating intelligent customer service dialogue reply | |
| CN113268996B (en) | Method for expanding corpus and training method and product for translation model | |
| CN113655893B (en) | A word and sentence generation method, model training method and related equipment | |
| CN111368531B (en) | Translation text processing method and device, computer equipment and storage medium | |
| CN112487136B (en) | Text processing methods, apparatus, devices, and computer-readable storage media | |
| KR20210044559A (en) | Method and device for determining output token | |
| US20200042547A1 (en) | Unsupervised text simplification using autoencoders with a constrained decoder | |
| US12368938B2 (en) | Method for coherent, unsupervised, transcript-based, extractive summarisation of long videos of spoken content | |
| CN112446211A (en) | Text processing device, method, apparatus, and computer-readable storage medium | |
| JP7555702B2 (en) | Text processing apparatus, method, device and computer-readable recording medium | |
| US20210097144A1 (en) | Neural machine translation adaptation | |
| Hori et al. | Adversarial training and decoding strategies for end-to-end neural conversation models | |
| Tran et al. | VaeDiff-DocRE: End-to-end Data Augmentation Framework for Document-level Relation Extraction | |
| CN110913229B (en) | RNN-based decoder hidden state determination method, device and storage medium | |
| JP2021051711A (en) | Text processing apparatus, method, device, and computer-readable recording medium | |
| EP4468194A1 (en) | Method for generating summary and system thereof | |
| CN112836526A (en) | Multi-language neural machine translation method and device based on gating mechanism | |
| CN113268997B (en) | Text translation method, device, computer equipment and storage medium |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20221116 |
|
| A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20230825 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20230905 |
|
| A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20231106 |
|
| RD03 | Notification of appointment of power of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7423 Effective date: 20231106 |
|
| A02 | Decision of refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A02 Effective date: 20240130 |
|
| A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20240425 |
|
| A911 | Transfer to examiner for re-examination before appeal (zenchi) |
Free format text: JAPANESE INTERMEDIATE CODE: A911 Effective date: 20240502 |
|
| 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: 20240827 |
|
| A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20240911 |
|
| R150 | Certificate of patent or registration of utility model |
Ref document number: 7555702 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |