NNPS
NLTK brown corpus 中标记为的标签似乎存在一些问题NPS
(可能 NLTK 标签集是一个更新/过时的标签,不同于https://www.ling.upenn.edu/courses/Fall_2003/ling001/penn_treebank_pos .html )
这是一个例子plural proper nouns
:
>>> from nltk.corpus import brown
>>> for sent in brown.tagged_sents():
... if any(pos for word, pos in sent if pos == 'NPS'):
... print sent
... break
...
[(u'Georgia', u'NP'), (u'Republicans', u'NPS'), (u'are', u'BER'), (u'getting', u'VBG'), (u'strong', u'JJ'), (u'encouragement', u'NN'), (u'to', u'TO'), (u'enter', u'VB'), (u'a', u'AT'), (u'candidate', u'NN'), (u'in', u'IN'), (u'the', u'AT'), (u'1962', u'CD'), (u"governor's", u'NN$'), (u'race', u'NN'), (u',', u','), (u'a', u'AT'), (u'top', u'JJS'), (u'official', u'NN'), (u'said', u'VBD'), (u'Wednesday', u'NR'), (u'.', u'.')]
但如果你用 标记nltk.pos_tag
,你会得到NNPS
:
>>> for sent in brown.tagged_sents():
... if any(pos for word, pos in sent if pos == 'NPS'):
... print " ".join([word for word, pos in sent])
... break
...
Georgia Republicans are getting strong encouragement to enter a candidate in the 1962 governor's race , a top official said Wednesday .
>>> from nltk import pos_tag
>>> pos_tag("Georgia Republicans are getting strong encouragement to enter a candidate in the 1962 governor's race , a top official said Wednesday .".split())
[('Georgia', 'NNP'), ('Republicans', 'NNPS'), ('are', 'VBP'), ('getting', 'VBG'), ('strong', 'JJ'), ('encouragement', 'NN'), ('to', 'TO'), ('enter', 'VB'), ('a', 'DT'), ('candidate', 'NN'), ('in', 'IN'), ('the', 'DT'), ('1962', 'CD'), ("governor's", 'NNS'), ('race', 'NN'), (',', ','), ('a', 'DT'), ('top', 'JJ'), ('official', 'NN'), ('said', 'VBD'), ('Wednesday', 'NNP'), ('.', '.')]