gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 10:52:20 25 4
gpt4 key购买 nike

在 R 中使用 NLP 进行词干提取时,有什么方法可以获取基本词而不是根词吗?

代码:

> #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 获得“happyness happies happys”的基本词“happy”(基本词)而不是“happi”(根词)吗?

最佳答案

您可能正在寻找词干分析器。以下是来自 CRAN Task View: Natural Language Processing 的一些词干提取器:

  • RWeka是 Weka 的接口(interface),Weka 是用 Java 编写的用于数据挖掘任务的机器学习算法的集合。在自然语言处理环境中特别有用的是其标记化和词干提取功能。

  • Snowball提供 Snowball 词干分析器,其中包含 Porter 词干分析器和其他几种针对不同语言的词干分析器。有关详细信息,请参阅 Snowball 网页。

  • Rstem是波特词干算法的 C 版本的替代接口(interface)。

关于r - R 中的基本词干提取代替根词干提取,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6664556/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com