N-gram 2026-11-05
An n-gram is a contiguous ordered sequence of units under a specified segmentation, commonly words or characters. A one-unit sequence is a unigram and a two-unit sequence a bigram. In a text corpus, counting n-grams retains local ordering that individual-word totals discard.[ref]
Google Books Ngram Viewer information. What does the Ngram Viewer do?, unigram/bigram examples and normalization
For the word sequence
red boat red boat, the three bigram occurrences are red boat, boat red and red boat. Thus red boat accounts for of these bigram windows, although the same sequence occurs twice. For units and , the number of unpadded windows is .The units and denominator are part of the definition of a measured rate. Character bigrams differ from word bigrams, and word segmentation, capitalization and sentence boundaries can change the count. A reproducible analysis states those choices before comparing time series or language varieties.
Word segmentation 2026-11-05
Word segmentation identifies the units treated as words in a particular linguistic analysis. Written spaces provide one possible cue, but an orthographic unit need not correspond to one syntactic unit. The boundary convention must therefore be stated before counting words or assigning syntactic dependencies.[ref]
Tokenization and Word Segmentation in Universal Dependencies. orthographic tokens versus syntactic words; documented contraction examples
The Universal Dependencies guidelines analyze the written item
au as corresponding to two syntactic words, à and le. Extending that example to au village, an orthographic count gives two units, while the syntactic analysis gives three. With no added boundary symbols, their word-bigram counts are respectively and .This is a change in representation, not evidence that the utterance became longer. Word segmentation affects n-gram counts, lemma assignment and linguistic annotation. A reproducible text corpus records how boundaries were chosen and how original written forms map to the analyzed units.