機械翻訳の品質評価に NLTK の BLEU スコアを使用しようとしています。このコードを 2 つの同一の文でチェックしたかったのですが、コーパスではなく 2 つの文を比較しているため、ここでは method1 を平滑化関数として使用しています。4 グラムと重み 0.25 (1/4) を設定します。しかし、結果として、0.0088308 を取得しています。私は何を間違っていますか?2 つの同一の文は、スコア 1.0 を取得する必要があります。PyCharm の Python 3、Windows 7 でコーディングしています。
私のコード:
import nltk
from nltk import word_tokenize
from nltk.translate.bleu_score import SmoothingFunction
ref = 'You know that it would be untrue You know that I would be a liar If I was to say to you Girl, we couldnt get much higher.'
cand = 'You know that it would be untrue You know that I would be a liar If I was to say to you Girl, we couldnt get much higher.'
smoothie = SmoothingFunction().method1
reference = word_tokenize(ref)
candidate = word_tokenize(cand)
weights = (0.25, 0.25, 0.25, 0.25)
BLEUscore = nltk.translate.bleu_score.sentence_bleu(reference, candidate, weights, smoothing_function=smoothie)
print(BLEUscore)
私の結果:
0.008830895300928163
プロセスは終了コード 0 で終了しました