Python html 处理

标签 python text-processing nltk

我有一个带有俄文文本的 html 文件。我如何在没有 html 标签、特殊符号等的情况下获取文本中的所有单词?

示例:

<html>...<body>...<div id='text'>Foo bar! Foo, bar.</div></body></html>

我需要:

['foo','bar','Foo','bar']

我试过 nltk,但它不支持俄语单词。

最佳答案

一定要试试 BeautifulSoup , 它 supports Unicode .

关于Python html 处理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9230675/

相关文章:

python - Pandas 的 groupby 不处理 agg 函数中的分类列

python - 以简单的方式操作数组值

python - Pylint 使用 git-pylint-commit-hook 忽略文件

linux - 如何配置 'less'显示格式化的markdown文件?

ruby - 如何在 R 中复制 Ruby 的 StringScanner 的一些功能?

python - 在 Scala 中实现 'yield' 的首选方法是什么?

python - 在元组列表中查找特定类型的一个或多个字符串

python - Spyder 中的 Outline Explorer 是什么?

python - nltk python 3 如果用户输入中有名词,如何返回 true?

python - NLTK 创建带有句子边界的双字母组