What is N-gram?
A sequence of n items from a given text or speech
N-gram explained in plain English
An N-gram is a way to break down language into smaller parts, like words or sounds, and look at how they appear together in a sequence. It's used in natural language processing to understand patterns and relationships in language.
Analogy
Think of an N-gram like a sliding window that moves over a sentence, looking at a few words at a time. For example, in the sentence 'the cat sat on the mat', a 3-gram would look at sequences like 'the cat sat' and 'cat sat on'.
Example
Virtual assistants like Siri or Alexa use N-grams to understand what you're saying and respond accordingly. For example, if you say 'what's the weather like', the assistant uses N-grams to recognize the sequence of words and respond with the current weather.
How is N-gram used?
N-grams are used in language modeling, text classification, and speech recognition to predict what word comes next in a sequence, or to identify the topic of a piece of text.
Common misconceptions about N-gram
Some people think N-grams are only used for language translation, but they have a broader range of applications, including text summarization and sentiment analysis.
History
The concept of N-grams dates back to the 1950s, but it wasn't until the 1990s that they became widely used in natural language processing.
People also read
- automatic evaluation
The use of algorithms and statistical models to assess the performance of AI systems
- bag of words
A representation of text as a collection of individual words, ignoring grammar and word order
- BERT
A pre-trained language model developed by Google
- bigram
A sequence of two items from a string of tokens
- BLEU
A metric for evaluating the quality of machine translation
- BLEURT
A metric used to evaluate the quality of text generated by language models
- Character N-gram F-score
A measure of the accuracy of text generation models
- constituency parsing
A process in natural language processing to analyze the syntactic structure of sentences
- crash blossom
A phrase or sentence that is ambiguous or open to multiple interpretations due to its grammatical structure
- decoder
A component of a neural network that generates output from encoded input