R 中的基本词干提取代替根词干提取

2024-02-29

有没有什么方法可以在 R 中使用 NLP 来获取词干而不是根词?

Code:

> #Loading libraries
> library(tm)
> library(slam)
> 
> #Vector
> Vec=c("happyness happies happys","sky skies")
> 
> #Creating Corpus
> Txt=Corpus(VectorSource(Vec))
> 
> #Stemming
> Txt=tm_map(Txt, stemDocument)
> 
> #Checking result
> inspect(Txt)
A corpus with 2 text documents

The metadata consists of 2 tag-value pairs and a data frame
Available tags are:
  create_date creator 
Available variables in the data frame are:
  MetaID 

[[1]]
happi happi happi

[[2]]
sky sky

> 

我可以使用 R 获得“幸福快乐”的基本词“happy”(基本词)而不是“happy”(根词)吗?


您可能正在寻找词干分析器。 这里有一些词干来自CRAN 任务视图:自然语言处理 http://cran.r-project.org/web/views/NaturalLanguageProcessing.html:

  • RWeka http://cran.r-project.org/web/packages/RWeka/index.html是 Weka 的接口,Weka 是用 Java 编写的用于数据挖掘任务的机器学习算法的集合。在自然语言处理环境中特别有用的是其标记化和词干提取功能。

  • Snowball http://cran.r-project.org/web/packages/Snowball/index.html提供 Snowball 词干分析器,其中包含 Porter 词干分析器和其他几种针对不同语言的词干分析器。有关详细信息,请参阅 Snowball 网页。

  • Rstem http://cran.r-project.org/web/packages/Rstem/index.html是波特词干算法的 C 版本的替代接口。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

R 中的基本词干提取代替根词干提取 的相关文章

随机推荐