相关疑难解决方法(0)

什么是n Gram?

我在SO上发现了上一个问题:N-gram:解释+ 2个应用程序.OP给出了这个例子并询问它是否正确:

Sentence: "I live in NY."

word level bigrams (2 for n): "# I', "I live", "live in", "in NY", 'NY #'
character level bigrams (2 for n): "#I", "I#", "#l", "li", "iv", "ve", "e#", "#i", "in", "n#", "#N", "NY", "Y#"

When you have this array of n-gram-parts, you drop the duplicate ones and add a counter for each part giving the frequency:

word level bigrams: [1, 1, 1, 1, 1]
character level bigrams: [2, 1, 1, …
Run Code Online (Sandbox Code Playgroud)

sentiment-analysis

24
推荐指数
2
解决办法
3万
查看次数

字节与字符与单词 - n-gram的粒度?

至少可以考虑使用3种类型的n-gram来表示文本文档:

  • 字节级n-gram
  • 字符级n-gram
  • 字级n-gram

我不清楚哪一个应该用于给定的任务(聚类,分类等).我在某处读到,当文字包含拼写错误时,字符级别的n-gram优于字级n-gram,因此"Mary loves dogs"仍然类似于"Mary lpves dogs".

选择"正确"表示还有其他标准需要考虑吗?

nlp data-mining text-mining n-gram

7
推荐指数
1
解决办法
1857
查看次数