如何在NLTK中使用西班牙语Wordnet? [英] How to use the Spanish Wordnet in NLTK?

查看:88
本文介绍了如何在NLTK中使用西班牙语Wordnet?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚从项目 GRIAL 下载了西班牙语Wordnet,格式为XML.如何在Python NLTK中使用它?

I just downloaded a Spanish Wordnet from the project GRIAL, the format is XML. How can I use it in Python NLTK?

此外,您可以在同一页面上下载西班牙语标记的语料库.我如何也可以将其合并?

Besides that, in the same page you can download a tagged corpus in Spanish. How can I incorporate it as well?

推荐答案

使用XMLCorpusReader将XML数据作为语料库加载

Use XMLCorpusReader to load XML data as corpus

这是执行此操作的代码

from nltk.corpus.reader import XMLCorpusReader
reader = XMLCorpusReader(dir, file)

此处给出了一个使用XMLCorpusReader的完整示例.

这篇关于如何在NLTK中使用西班牙语Wordnet?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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