Implement language models to perform sentence completion, i.e. given a sentence with a missing word to choose the correct one from a list of candidate words -- 3

Job ID: 31605344

Budget: ₹1,500 – ₹12,500 INR

The goal of this assignment is to implement three language models to perform
sentence completion, i.e. given a sentence with a missing word to choose the
correct one from a list of candidate words. The way to use a language model
for this problem is to consider a possible candidate word for the sentence at a
time and then ask the language model which version of the sentence is the most
probable one.
The sentences to be completed together with the candidate words are in this
file: questions.txt. The word to be completed is denoted with ‘’ while the
pair of candidate words is at the end of the line (e.g. weather/whether). The
character ‘:’ between the sentence and the candidates is not part of the sentence.
To apply a language model on a sentence for a given candidate word, you just
need to replace ‘’ with the candidate word.
The texts to train your language models are in this file: news-corpus-500k.txt
(70MB), which is a small subset of the 1 Billion Word Benchmark. The text has
already been tokenized and split into sentences (each line represents a sentence).
You will implement three language models for this task:
• unigram
• bigram
• bigram with add-1 smoothing, i.e. Laplace
Related categories: Python Natural Language