Alignment

Report a typo

Note that this task assumes nltk version 3.8.1. Don't forget to download the required corpora:
import nltk
nltk.download('punkt')
nltk.download('wordnet')

Given a reference—prediction pair, find the alignment by applying exact match, stemmed match and the Wordnet synonym match (all of which is done with the align_words()). The starter code is

from nltk.translate.meteor_score import align_words
# Your imports here

prediction = 'The lush rainforest was home to many exotic plants'
reference = 'The tropical rainforest was home to many exotic plants'

# Your code here

The answer should contain the result of the align_words() call on the provided reference-prediction pair.

Enter a short text

Create a free account to access the full topic