小编ikj*_*ikj的帖子

NLTK for Persian

如何使用NLTK for Persian的功能?

例如:'concordance'.当我使用'concordance'时,答案是"不匹配",但在我的文本中有一致的参数.

输入非常简单.它包含"helloسلام".当'concordance'的参数为'hello'时,答案是正确的,但是,如果它是'سلام',答案是'不匹配'.我的预期输出是'显示1的1匹配'.

    import nltk
    from urllib import urlopen
    url = "file:///home/.../1.html"
    raw = urlopen(url).read()
    raw = nltk.clean_html(raw)
    tokens = nltk.word_tokenize(raw)
    tokens = tokens[:12]
    text = nltk.Text(tokens)
    print text.concordance('????')
Run Code Online (Sandbox Code Playgroud)

python nlp nltk

13
推荐指数
1
解决办法
4100
查看次数

标签 统计

nlp ×1

nltk ×1

python ×1