NLTK和语言检测 [英] NLTK and language detection

查看:177
本文介绍了NLTK和语言检测的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何检测使用NLTK编写的文字是什么语言?

How do I detect what language a text is written in using NLTK?

我看到的示例使用nltk.detect,但是当我将其安装在Mac上时,找不到此软件包.

The examples I've seen use nltk.detect, but when I've installed it on my mac, I cannot find this package.

推荐答案

您遇到以下代码片段了吗?

Have you come across the following code snippet?

english_vocab = set(w.lower() for w in nltk.corpus.words.words())
text_vocab = set(w.lower() for w in text if w.lower().isalpha())
unusual = text_vocab.difference(english_vocab) 

来自 http://groups .google.com/group/nltk-users/browse_thread/thread/a5f52af2cbc4cfeb?pli = 1& safe = active

还是以下演示文件?

查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆