このリンクをたどって文レベルを見つけていますbleu score
NLTK: コーパス レベルの BLEU とセンテンス レベルの BLEU スコア
この例を実行すると:
import nltk
hypothesis = ['This', 'is', 'cat']
reference = ['This', 'is', 'a', 'cat']
references = [reference]
nltk.translate.bleu_score.sentence_bleu(references, hypothesis)
出力:
8.987727354491445e-155
出力は0
警告:
/home/mac/.local/lib/python3.6/site-packages/nltk/translate/bleu_score.py:516: UserWarning:
The hypothesis contains 0 counts of 3-gram overlaps.
Therefore the BLEU score evaluates to 0, independently of
how many N-gram overlaps of lower order it contains.
Consider using lower n-gram order or use SmoothingFunction()
warnings.warn(_msg)
/home/mac/.local/lib/python3.6/site-packages/nltk/translate/bleu_score.py:516: UserWarning:
The hypothesis contains 0 counts of 4-gram overlaps.
Therefore the BLEU score evaluates to 0, independently of
how many N-gram overlaps of lower order it contains.
Consider using lower n-gram order or use SmoothingFunction()
warnings.warn(_msg)
を持つ文に対して同じ関数を実行するにはどうすればよいn-gram
for n<4
ですか?
また、内部で渡すことができるすべてのパラメーターnltk.translate.bleu_score.sentence_bleu()
は何ですか?