Methods for generating and manipulating ngrams (ngrams)

Classes

NgramModel([pre_order, post_order, …])

Class for operation upon sequences using ngrams models.

Functions

get_n_ngrams(sequence, order[, pad_symbol])

Build an iterator for collecting all ngrams of a given order.

get_all_ngrams_by_order(sequence[, orders, …])

Build an iterator for collecting all ngrams of a given set of orders.

get_skipngrams(sequence, order, max_gaps[, …])

Build an iterator for collecting all skip ngrams of a given length.

get_posngrams(sequence[, pre_order, …])

Build an iterator for collecting all positional ngrams of a sequence.

get_all_posngrams(sequence, pre_orders, …)

Build an iterator for collecting all positional ngrams of a sequence.

get_all_ngrams(sequence[, sort])

Function returns all possible n-grams of a given sequence.