Algorithm · Square · Medium
This machine learning engineer screen is run in CoderPad and works with a small toy text corpus. It is broken into four parts that build on one another. Part 1: Given a single input word, predict which word comes next. Base the prediction on how often each word follows the input word in the corpus, i.e. a Markov chain built from following-word counts. Part 2: Given a starting word and a target length, generate a sentence of that length. Part 3: Modify the generator so that…