如何POS_TAG法语句子? [英] How to POS_TAG a french sentence?

查看:193
本文介绍了如何POS_TAG法语句子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找将pos_tag法语句子(如以下代码)用于英语句子的方法:

I'm looking for a way to pos_tag a French sentence like the following code is used for English sentences:

def pos_tagging(sentence):
    var = sentence
    exampleArray = [var]
    for item in exampleArray:
        tokenized = nltk.word_tokenize(item)
        tagged = nltk.pos_tag(tokenized)
        return tagged

推荐答案

NLTK没有附带法语的预建资源.我建议使用 Stanford标记器,它带有经过培训的法语模型. 此代码显示了如何设置要使用的nltk斯坦福大学的法国POS标记器.请注意,该代码已经过时(并且适用于Python 2),但是您可以将其用作起点.

The NLTK doesn't come with pre-built resources for French. I recommend using the Stanford tagger, which comes with a trained French model. This code shows how you might set up the nltk for use with Stanford's French POS tagger. Note that the code is outdated (and for Python 2), but you could use it as a starting point.

或者,NLTK使在带标记的语料库上训练自己的POS标记器变得非常容易,并将其保存以备后用.如果您可以访问(足够大的)法语语料库,则可以按照

Alternately, the NLTK makes it very easy to train your own POS tagger on a tagged corpus, and save it for later use. If you have access to a (sufficiently large) French corpus, you can follow the instructions in the nltk book and simply use your corpus in place of the Brown corpus. You're unlikely to match the performance of the Stanford tagger (unless you can train a tagger for your specific domain), but you won't have to install anything.

这篇关于如何POS_TAG法语句子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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