operator: ngrams

    description:
        ngrams[str, k1, k2, ..., kn] ket
        ssplit the ket using "str", create ngrams of specified sizes, then smerge back to kets using "str"
        the result is multiplied by the coefficient of the ket
        for example, ngrams["", k1, k2, ..., kn] is the same as letter-ngrams[k1, k2, ..., kn]
        and ngrams[" ", k1, k2, ..., kn] is the same as word-ngrams[k1, k2, ..., kn]
        (though word-ngrams casts everything to lower-case and strips all punctuation)
        Yeah, pretty much deprecates letter-ngrams and word-ngrams.

    examples:
        ngrams["", 1] |fish>
            |f> + |i> + |s> + |h>

        ngrams["", 1, 2, 3] |happy>
            |h> + |a> + 2|p> + |y> + |ha> + |ap> + |pp> + |py> + |hap> + |app> + |ppy>

    see also:
        letter-ngrams, word-ngrams
        

Home