Session Ready
Exercise

Autocomplete sentences

Now you know how to generate the most probable next character in current iteration using the generated character from the last iteration. You can continue this process in a loop until the end token is found or the maximum length of the suffix sequence is reached. A function generate_suffix_sentence() is available for you which does exactly this. It takes a prefix sentence as input, generates the suffix sentence character by character and returns it.

Also, a model trained for 20 epochs on a bigger dataset is loaded in the environment to demonstrate how this simple architecture can be used for sentence auto-completion. A more complex architecture with more hidden layers will produce more accurate results.

Instructions 1/2
undefined XP
  • 1
  • 2
  • Iterate 10 times to generate 10 suffix sentences in a loop:
  • Generate the suffix sentence.