Text.Ngram (Text v0.6.1)

Copy Markdown View Source

Compute ngrams and their counts from a given UTF8 string.

Computes ngrams for n in 2..7

Summary

Functions

Returns a map of n-grams for a given text and n-gram size.

Types

ngram_range()

@type ngram_range() :: 2..7

Functions

ngram(string, n \\ 2)

@spec ngram(String.t(), ngram_range()) :: %{required(list()) => integer()}

Returns a map of n-grams for a given text and n-gram size.

The n-gram size is a minimum of 2 and a maximum of 7 with a default of 2.

ngram(arg1, n, acc)