Porter:一个好用的英文分词算法

By ego008 at 2013-01-23 23:09:04 • 2051次点击

The Porter Stemming Algorithm 已有多种语言实现

http://tartarus.org/~martin/PorterStemmer/ 21

python 实现
https://pypi.python.org/pypi/stemming/1.0 42 纯python
https://pypi.python.org/pypi/PorterStemmer 7 wrap c实现

porterstemmer 示例

from porterstemmer import Stemmer

stemmer = Stemmer()
print stemmer("foo")
print stemmer(u"foo")
print stemmer("er")
print stemmer(u"er")
print stemmer("")
print stemmer(u'')
try:
    stemmer()
except:
    print "exception raised."

try:
    stemmer(None)
except:
    print "exception raised."

porter, 英文, 算法


相关帖子:

登录 后发表评论