ngrams.icn: Procedures to produce n-grams

procedure ngrams:          n-grams with count
procedure ngramset:        n-grams set

link ngrams
March 20, 1998; Ralph E. Griswold
This file is in the public domain.

   The procedure ngrams(s, n, c, t) generates a tabulation of the n-grams
in the specified string.  If c is non-null, it is used as the set of
characters from which n-grams are taken (other characters break n-grams).
The default for c is the upper- and lowercase letters.  If t is non-null,
the tabulation is given in order of frequency; otherwise in alphabetical
order of n-grams.

   For backward compatibility, the first argument may be a file, in
which case, it is read to provide the string.

Source code | Program Library Page | Icon Home Page