What is an n-gram?
Instruction: Define an n-gram and provide examples of its use in NLP.
Context: This question checks the candidate's understanding of a basic concept in NLP that is crucial for tasks like text prediction and classification.
Updated
Example Answer
An n-gram is a contiguous sequence of n tokens, such as words or characters. A unigram has one token, a bigram has two, and a trigram has three.
N-grams are useful because they capture local context. For example, a bigram model distinguishes "New York" from the separate words "New" and "York." They are simple but still valuable in language modeling, search, feature engineering, and text classification.
Common Poor Answer
A weak answer defines n-grams as groups of words without explaining why sequence length and local context matter.