0
0
NLPml~10 mins

BLEU score evaluation in NLP - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the BLEU score function from nltk.

NLP
from nltk.translate.bleu_score import [1]
Drag options to blanks, or click blank then click option'
Ableu_score
Bsentence_bleu
Ccorpus_bleu
Dbleu
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'bleu_score' which is the module, not the function.
Using 'corpus_bleu' which is for multiple sentences.
2fill in blank
medium

Complete the code to define the reference translations list for BLEU score calculation.

NLP
references = [[[1]]]
Drag options to blanks, or click blank then click option'
A['test', 'a', 'is', 'this']
B['this is a test']
C['This', 'is', 'a', 'test']
D['this', 'is', 'a', 'test']
Attempts:
3 left
💡 Hint
Common Mistakes
Using a single string instead of a list of tokens.
Not nesting the list inside another list.
3fill in blank
hard

Fix the error in the candidate sentence tokenization for BLEU score calculation.

NLP
candidate = [1]
Drag options to blanks, or click blank then click option'
A['this is a test']
B'this is a test'
C['this', 'is', 'a', 'test']
D['This', 'is', 'a', 'test']
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the candidate as a string instead of a list.
Passing a list with one string element instead of tokenized words.
4fill in blank
hard

Fill both blanks to calculate the BLEU score for the candidate against references.

NLP
score = sentence_bleu([1], [2])
Drag options to blanks, or click blank then click option'
Areferences
Bcandidate
C[candidate]
Dreferences[0]
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the order of references and candidate.
Passing candidate inside a list instead of directly.
5fill in blank
hard

Fill all three blanks to print the BLEU score rounded to 2 decimals with a message.

NLP
print(f"BLEU score: [1]([2], 2)[3]")
Drag options to blanks, or click blank then click option'
Around
Bscore
C+
D*
Attempts:
3 left
💡 Hint
Common Mistakes
Using * instead of + for string concatenation.
Not rounding the score before printing.