This article needs additional citations for verification. (December 2009) (Learn how and when to remove this template message)
Trigrams are a special case of the n-gram, where n is 3. They are often used in natural language processing for performing statistical analysis of texts and in cryptography for control and use of ciphers and codes.
Context is very important, varying analysis rankings and percentages are easily derived by drawing from different sample sizes, different authors; or different document types: poetry, science-fiction, technology documentation; and writing levels: stories for children versus adults, military orders, and recipes.
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.
The sentence "the quick red fox jumps over the lazy brown dog" has the following word-level trigrams:
the quick red quick red fox red fox jumps fox jumps over jumps over the over the lazy the lazy brown lazy brown dog
And 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 uic ick ck_ k_r _re red
- Lewand, Robert (2000). Cryptological Mathematics. The Mathematical Association of America. p. 37. ISBN 978-0-88385-719-9.
- Linton, Tom (2001). "Relative Frequencies of Letters in General English Plain text". Central College. Cryptography (Spring ed.). Archived from the original on January 22, 2007.
- "English Letter Frequencies". Practical Cryptography.