FastNgram v1.0.0 FastNgram View Source

A fast and unicode aware letter N-gram library written in Elixir.

Link to this section Summary

Functions

Returns a list of letter N-grams from the given string.

Link to this section Functions

Link to this function

letter_ngrams(string, n)

View Source
letter_ngrams(String.t(), non_neg_integer()) :: list()

Returns a list of letter N-grams from the given string.

Example

iex> FastNgram.letter_ngrams("¥ · € · $", 3)
["¥ ·", " · ", "· €", " € ", "€ ·", " · ", "· $"]
iex> FastNgram.letter_ngrams("", 2)
[]
iex> FastNgram.letter_ngrams("abcd", 1)
["a", "b", "c", "d"]
iex> FastNgram.letter_ngrams("abcde", 2)
["ab", "bc", "cd", "de"]