如何使用Stanford CoreNLP进行NER和POS标记预标记文本? [英] How to NER and POS tag a pre-tokenized text with Stanford CoreNLP?

查看:691
本文介绍了如何使用Stanford CoreNLP进行NER和POS标记预标记文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中使用了斯坦福大学的CoreNLP命名实体识别器(NER)和词性(POS)标记器.问题是我的代码预先将文本标记化,然后我需要对每个标记进行NER和POS标记.但是,我只能使用命令行选项来找出方法,而不能通过编程来找到.

I'm using the Stanford's CoreNLP Named Entity Recognizer (NER) and Part-of-Speech (POS) tagger in my application. The problem is that my code tokenizes the text beforehand and then I need to NER and POS tag each token. However I was only able to find out how to do that using the command line options but not programmatically.

有人可以告诉我如何使用斯坦福大学的CoreNLP以编程方式对预先标记的文本进行NER和POS标签吗?

Can someone please tell me how programmatically can I NER and POS tag pretokenized text using Stanford's CoreNLP?

我实际上是在使用单独的NER和POS指令.因此,我的代码是按照斯坦福大学NER和POS软件包中提供的教程中的说明编写的.但是我的类路径中有CoreNLP.因此,我在类路径中有CoreNLP,但使用了NER和POS软件包中的教程.

I'm actually using the individual NER and POS instructions. So my code was written as instructed in the tutorials given in the Stanford's NER and POS packages. But I have CoreNLP in my classpath. So I have the CoreNLP in my classpath but using the tutorials in the NER and POS packages.

我刚刚发现这里有说明,说明如何设置CoreNLP的属性 http://nlp.stanford.edu/software/corenlp.shtml ,但我希望是否有一种快速的方法来利用Stanford NER和POS标记器来做我想做的事,所以我不必重新编码所有内容!

I just found that there are instructions as how one can set the properties for CoreNLP here http://nlp.stanford.edu/software/corenlp.shtml but I wish if there was a quick way to do what I want with Stanford NER and POS taggers so I don't have to recode everything!

推荐答案

如果设置了属性:

tokenize.whitespace = true

然后,CoreNLP管道将在空白上标记化,而不是默认的PTB标记化.您可能还需要设置:

then the CoreNLP pipeline will tokenize on whitespace rather than the default PTB tokenization. You may also want to set:

ssplit.eolonly = true

以便您仅在换行符上分割句子.

so that you only split sentences on newline characters.

这篇关于如何使用Stanford CoreNLP进行NER和POS标记预标记文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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