What is an N-Gram?
items from a sample of text or speech. The N-Gram could be comprised of large blocks of words, or smaller sets of syllables. N-Grams are used as the basis for functioning N-Gram models, which are instrumental in natural language processing as a way of predicting upcoming text or speech.
As mentioned above, N-Gram models are used to aid in prediction of speech and/or text. They utilize the stochastic properties of N-Gram, and sometimes incorporate elements of the Markov model. N-Gram models, and the algorithms that use them, benefit from their relative simplicity and scalability, enabling smaller experiments to scale up from largerN sets.
How does an N-Gram model work?
N-Gram models work by taking a sequence of items, and predicting upcoming items. For example, imagine a string of letters used for DNA sequencing (i.e. GATC). An N-Gram model will analyze the sequence of letters and, utilizing training data, creates a probability distribution for the likelihood of upcoming values. Each possible value will be assigned a probability (e.g. .0004) and the sum total of all probabilities will be 1.
Applications of N-Gram
The example used above is in fact a common use of N-Gram models. From predictions in DNA sequencing, to implementation for better text prediction within neural networks, N-Gram models, have a wide range of applicability.
N-Gram models are uses in natural language processing as a tool for modeling probable upcoming sequences of characters, also known as trigrams or 3-grams. An example is the phrase, "Good Afternoon," which breaks down to the trigrams "Goo","d A", "fte", etc. In machine translation models, however, N-Gram models are usually used in conjunction with Bayesian inference, leading to a more accurate prediction.