วันจันทร์ที่ 30 มีนาคม พ.ศ. 2569

N-gram

N-gram is a sequence of n words: a 2-gram (which we'll call bigram) is a two-word sequence of words like The water, or water of, and a 3- gram (a trigram) is a three-word sequence of words like The water of, or water of Walden.

  • Types & Examples: Based on the phrase "learning is fun":
    • Unigram (
      ):
       "learning", "is", "fun".
    • Bigram (
      ):
       "learning is", "is fun".
    • Trigram (
      ):
       "learning is fun".
  • Applications:
    • Predictive Text & Autocomplete: Suggesting the next word in mobile keyboards.
    • Speech Recognition: Predicting likely word sequences.
    • Search Engines & SEO: Identifying common search queries and phrase frequency.
    • Sentiment Analysis: Detecting patterns in text.