在 C 中集成给定的 Porter 词干分析器
我看到以下内容有 C 的波特词干分析器 http://tartarus.org/martin/PorterStemmer/
然而,尽管我已经尝试了几次,但我无法将其集成到我的代码中。有人可以告诉我应该如何调用下载的文件以及应该传递给它什么才能阻止字符串。
换句话说,我有一个程序需要对字符串进行词干处理,并且我需要一个 porter 词干分析器。我正在考虑使用上述内容,但我不知道如何使用下载的文件。请举例
I saw the following has a porter stemmer implementation for C http://tartarus.org/martin/PorterStemmer/
However, though I have tried several times, I cannot integrate it in my code. Can someone tell me how I should call the downloaded file and what I should pass to it in order to stem a string.
In other words, i have a program that requires to stem strings and i need a porter stemmer for that . I am thinking of using the above but i dont know how to use the downloaded file. Please give example
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
c 代码提供了该函数:
这就是您应该调用的函数。它修改原始字符串,并返回结果的长度。典型用法在函数stem_file()中演示,该函数的作用如下:
我不知道第二个和第三个参数的确切含义。查一下。
The c code supplies the function:
That is the one you should call. It modifies the original string, and returns the length of the result.The typical usage is demonstrated in the function stem_file(), which does something like:
I don't know what the 2nd and 3rd parameters mean exactly. Look it up.
该代码有两部分。
有一部分标志着Stemmer定义的结束。在此之前,他们已经展示了波特算法规定的主要 5 个步骤。
接下来的部分处理文件处理部分,将字符转换为小写。 Stem 函数处理初始化部分。 j 被视为初始字长。
正确地过一遍。这不太容易理解。
The code has two parts.
There is a part that marks the Stemmer definition ending. Before this, they have shown the major 5 steps that the porter's algorithm states.
The part after that deals with the file handling part, converts the characters into lower cases. stem function deals with the initialization part. j is considered as the initial word length.
Go through it properly once. It isn't very easy to understand.