Presentation is loading. Please wait.

Presentation is loading. Please wait.

Phrase-base Statistical Machine Translation

Similar presentations


Presentation on theme: "Phrase-base Statistical Machine Translation"— Presentation transcript:

1 Phrase-base Statistical Machine Translation
2008年8月29日 勉強会 D2 中澤 敏明

2 参考文献 “Statistical Phrase-Based Translation”, Koehn et al., HLT/NAACL 2003 Statistical Machine Translation: the basic, the novel, and the speculative, Philipp Koehn, Tutorial at EACL 2006 SMT講習会の資料 by 山本幹雄先生

3 今日話すこと Training MERT (Minimum Error Rate Training) Decoding
対象化単語アライメント フレーズ抽出 フレーズ翻訳確率などの計算(Log-linear Model) MERT (Minimum Error Rate Training) Decoding Decoding Process Multistack Beam-search

4 実習 Phrase-based SMTのツールキット、mosesを実際に動かしてみる(英日翻訳実験) 言語モデルの構築 翻訳モデルの構築
チューニング(MERT) 翻訳 翻訳結果の評価

5 注意 orchidで動かしてください 混んでいるノードで動かすのはやめましょう orchid[[01-40]]を使いましょう
64bitマシン以外では動かない設定になっています 混んでいるノードで動かすのはやめましょう できれば全員別々のノードで orchid[[01-40]]を使いましょう orchidに負荷をかけるのはやめましょう

6 実習 言語モデルの構築 srilmというツールを利用 http://www.speech.sri.com/projects/srilm/
ngram-count -order 5 -interpolate -kndiscount -text /avocado3/moses/data/train_lm.ja -lm 1M.ja.lm

7 統計翻訳の気持ち(1/2) ある原言語文fが与えられたとき、 を最大とするような目的言語文eがfの翻訳
ここでBayes Ruleを適用すると、 ^ 言語モデル 翻訳モデル ※ Noisy Channel Model と呼ばれる

8 統計翻訳の気持ち(2/2) を使って翻訳する場合、かなり良いモデルを作る必要がある
     を使って翻訳する場合、かなり良いモデルを作る必要がある Bayes Ruleを使っていくつかのモデルに分けることにより、各モデルがある程度良いものであれば、それらが相補的に働く 言語モデルと翻訳モデルをより良いものにしていき、精度を向上させよう!

9 実習 翻訳モデルの構築 双方向でのGIZA++から翻訳モデルの構築まで train-factored-phrase-model.perl
-scripts-root-dir /avocado3/moses/scripts -corpus ../data/train -f en -e ja -alignment grow-diag-final-and -reordering msd-bidirectional-fe -lm 0:5:/avocado3/moses/lm/1M.ja.lm:0 -factor-delimiter ‘|||’

10 今日話すこと Training MERT (Minimum Error Rate Training) Decoding
対象化単語アライメント フレーズ抽出 フレーズ翻訳確率などの計算(Log-linear Model) MERT (Minimum Error Rate Training) Decoding Decoding Process Multistack Beam-search

11 Training 対称化単語アライメントを生成 単語アライメントに無矛盾なphraseペアを抽出
GIZA++を双方向に実行し、ヒューリスティックスにより統合 単語アライメントに無矛盾なphraseペアを抽出 全ての無矛盾な単語列ペアをphraseとする フレーズ翻訳確率、lexicalized-reorderingモデルなどを計算・生成 抽出されたphraseから計算

12 対称化単語アライメント MosesはGIZA++による単語アライメント結果を利用

13 対称化単語アライメント Intersection Union Precision High Low Recall Low High

14 対称化ヒューリスティックス 基本4種 最終処理3種(未対応の単語に関する処理) intersection union grow
grow-diag 最終処理3種(未対応の単語に関する処理) なし final final-and 両方向ともにある対応点のみ 各方向の対応点すべて intersectionからスタートして拡張 grow=縦・横 grow-diag=縦・横・対角 少なくとも片方の言語で対応がない 両言語ともに対応がない

15 intersection

16 grow-diag-final

17 abstract code diag

18 Phraseペアの抽出 対称化単語アライメント結果を元に、矛盾しないphraseペアを全て抽出
「矛盾しない」とは・・・

19 Phraseペアの抽出

20 Log-linear Model Feature functions(moses default: 14 params)
language model (1 param) phrase translation table (5 params) reordering model (7 params) word penalty (1 param)

21 phrase translation table
5 parameters phrase translation probability lexical weighting phrase penalty

22 lexical weighting phraseペアの質を評価するための重み

23 lexicalized reordering
MSD vs monotonicity monotone, swap, discontinuous monotone, non-monotone f vs fe model is conditioned on f vs both f and e unidirectional vs bidirectional For each phrase, the ordering of itself in respect to the previous is considered. For bidirectional models, also the ordering of the next phrase in respect to the currect phrase is modeled.

24 reordering model 7 parameters (msd-bidirectional-fe)
simple distance-base model

25 Log-linear Model Feature functions language model (1 param) 0.5
phrase translation table (5 params) 0.2 reordering model (7 params) 0.3 word penalty (1 param) -1

26 今日話すこと Training MERT (Minimum Error Rate Training) Decoding
対象化単語アライメント フレーズ抽出 フレーズ翻訳確率などの計算(Log-linear Model) MERT (Minimum Error Rate Training) Decoding Decoding Process Multistack Beam-search

27 実習 チューニング(MERT) development setを用いてlog-linear modelのλをBLEUが向上するように調整
mert-moses.pl --rootdir /avocado3/moses/scripts --working-dir . ../data/dev.en ../data/dev.ja /share/usr-x86_64/bin/moses ../tm/model/moses.ini

28 Minimum Error Rate Training
[Och, 2003]  がよくなるように  を調整 Developmentセットを利用して、評価関数を最大にするような翻訳結果が選択されるように調整 Developmentセットは1000文程度 評価関数はBLEUを用いるのが一般的 各文についてn-bestの翻訳候補を出力し、正解と比較してよりよい候補が上位に来るように調整 10~20回程度繰り返して重みを徐々に変化 データサイズにもよるが、終わるまで数日かかることも・・・

29 Param Default 1 2 3 6 9 12 13 BLEU --- 14.0 14.4 17.5 21.5 22.1 LM 0.5 0.039 0.038 0.104 0.047 0.052 0.051 TM1 0.2 0.3 0.011 0.010 0.042 0.012 TM2 0.020 0.031 TM3 0.049 0.030 0.008 0.034 TM4 0.016 0.068 0.018 TM5 0.003 -0.055 0.115 0.114 D1 -0.001 0.017 -0.004 0.005 D2 -0.065 -0.061 0.087 0.045 0.044 D3 -0.191 -0.186 0.058 -0.032 0.109 0.108 D4 0.055 0.133 0.383 0.215 D5 -0.010 0.025 0.123 D6 0.062 0.122 -0.007 -0.009 D7 0.072 0.130 0.085 0.134 W -1 -0.438 -0.428 -0.181 -0.084 -0.074

30 今日話すこと Training MERT (Minimum Error Rate Training) Decoding
対象化単語アライメント フレーズ抽出 フレーズ翻訳確率などの計算(Log-linear Model) MERT (Minimum Error Rate Training) Decoding Decoding Process Multistack Beam-search

31 実習 翻訳 MERTによって調整されたλを用いて翻訳
phrase table全てを読み込むとメモリが足らなくなるので、翻訳する文に必要なphrase tableのみをあらかじめfiltering filter-model-given-input.pl filterd ../tune/moses.ini ../data/test.ja filteringされたphrase tableを用いて翻訳 moses -f filterd/moses.ini < ../data/test.en

32 Decoding 翻訳文は左側(先頭)から順に生成 Multistack Beam-searchで最適な翻訳を探索
翻訳が完了している単語数ごとにstackを用意し、それぞれのstackで上位n個のみを保持

33 Decoding Input sentence: Maria no dio una bofetada a la bruja verde
Mary did not slap the green witch Output sentence:

34 Translation Options 翻訳するphraseの順番や、そのphraseの翻訳候補はたくさんある 全てを探索することは不可能

35 Multistack Beam-search
翻訳が完了している単語数ごとにstackを用意し、それぞれのstackで確率上位n個の「仮説」のみを保持 確率は、その時点までの翻訳確率と、未翻訳部の推定翻訳確率とから求める

36

37 Future Cost 全てのtranslation optionについて、phrase翻訳確率とphrase内言語モデル確率を掛け算
reordering(訳す順序)は考慮しない ほんとは正しい翻訳仮説がn-bestから外れる可能性がある あらかじめ全ての部分についてfuture costを計算しておけるので、decode時はfuture cost tableを引くだけでよい

38 実習 翻訳結果の評価 mtevalというツールを使ってBLEU(NIST)を計算
mteval.pl -s src.sgm -r ref.sgm -t tst.sgm BLEUのみ、NISTのみ計算するオプションや、文ごとのBLEUを出すオプションなどがある multi referenceのときにバグがあるという噂・・・


Download ppt "Phrase-base Statistical Machine Translation"

Similar presentations


Ads by Google