Machine Learning Resources

What is an n-gram model?

Bookmark this question

An n-gram model builds upon the bag of words approach by considering n consecutive tokens in addition to the individual tokens of a document. For example, a bigram (n=2) would create features from each pair of consecutive tokens in the text. If a document consists of the sentence “It is sunny and 75 degrees”, in addition to the individual words, an n-gram of size 2 would consist of the pairs [“It is”, “is sunny”, “sunny and”, “and 75”, “75 degrees”].

Leave your Comments and Suggestions below:

Please Login or Sign Up to leave a comment

Partner Ad  

Find out all the ways
that you can