简体   繁体   English

斯坦福 Java NLP 选区标签缩写

[英]Stanford Java NLP Constituency labels abbreviations

Using the Stanford Java CoreNLP library, I have this:使用斯坦福 Java CoreNLP 库,我有这个:

            String text = "My name is Anthony";
            CoreDocument doc = new CoreDocument(text);
            pipeline.annotate(doc);
            for(Tree t : doc.sentences().get(0).constituencyParse()) {
                String tmp = "";
                for(Word w : t.yieldWords()) {
                    tmp = tmp + " " + w.word();
                }
                System.out.println(t.label().toString() + " - " + WordParts.getValue(t.label().toString()) + " - " + tmp);

Right now, the program outputs this:现在,程序输出如下:

ROOT - INVALID -  My name is Anthony
S - INVALID -  My name is Anthony
NP - INVALID -  My name
PRP$ - Possessive pronoun -  My
My-1 - INVALID -  My
NN - Singular noun -  name
name-2 - INVALID -  name
VP - INVALID -  is Anthony
VBZ - 3rd person singular present verb -  is
Subject:  Anthony
is-3 - INVALID -  is
NP - INVALID -  Anthony
NNP - Proper singular noun -  Anthony
Anthony-4 - INVALID -  Anthony

The WordParts.java abbreviations come from this post ( Java Stanford NLP: Part of Speech labels? ) and the class file can be found here: ( https://github.com/AJ4real/References/blob/master/WordParts.java ) I know that the labels are not Parts of Speech because some of the values return INVALID , so how can I find the full terms for the abbreviations that come from t.label().toString() ? WordParts.java缩写来自这篇文章( Java Stanford NLP: Part of Speech labels? ),类文件可以在这里找到:( https://github.com/AJ4real/References/blob/master/WordParts.java )我知道标签不是Parts of Speech因为某些值返回INVALID ,那么我如何找到来自t.label().toString()的缩写的完整术语?

The rest are Penn Treebank phrase categories.其余的是 Penn Treebank 短语类别。 Eg, see here:例如,请参见此处:

https://gist.github.com/nlothian/9240750 https://gist.github.com/nlothian/9240750

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM