NGrams

finalfusion.subword.ngrams.ngrams(unicode word, uint32_t min_n=3, uint32_t max_n=6, bracket=True)

File: src/finalfusion/subword/ngrams.pyx (starting at line 7)

Get the ngrams for the given word.

Parameters
  • word (str) – The string to extract n-grams from

  • min_n (int) – Inclusive lower bound of n-gram range. Must be greater than zero and smaller or equal to max_n

  • max_n (int) – Inclusive upper bound of n-gram range. Must be greater than zero and greater or equal to min_n

  • bracket (bool) – Toggles bracketing the input string with < and >

Returns

ngrams – List of n-grams.

Return type

list

Raises