function for N-grams_from_text

The code is an implementation of a custom function for extracting ngrams from a corpus given the path to the corpus and a value for n

  • returns a dictionary with unique ngrams as the keys and its frequency in the corpus as the value
  • if ngrams of specified 'n' not present in the corpus, function return an empty dictionary