Trigrams are a special case of the n-gram, where n is 3. They are often used in natural language processing for doing statistical analysis of texts.
Contents
Frequency
A typical cryptanalytic frequency analysis finds that the 16 most common character-level trigrams in English are:
Because encrypted messages sent by telegraph often omit punctuation and spaces, cryptographic frequency analysis of such messages includes trigrams that straddle word boundaries. This causes trigrams such as "edt" to occur frequently, even though it may never occur in any one word of those messages.
Examples
The sentence "the quick red fox jumps over the lazy brown dog" has the following word level trigrams:
the quick redquick red foxred fox jumpsfox jumps overjumps over theover the lazythe lazy brownlazy brown dogAnd the word-level trigram "the quick red" has the following character-level trigrams (where an underscore "_" marks a space):
the he_ e_q_qu qui uicick ck_ k_r_re red