| |
>>> br_tw = nltk.corpus.brown.tagged_words(categories='mystery')
>>> br_tw[:30]
[('There', 'EX'), ('were', 'BED'), ('thirty-eight', 'CD'), ('patients', 'NNS'), ('on', 'IN'),
('the', 'AT'), ('bus', 'NN'), ('the', 'AT'), ('morning', 'NN'), ('I', 'PPSS'), ('left', 'VBD'),
('for', 'IN'), ('Hanover', 'NP'), (',', ','), ('most', 'AP'), ('of', 'IN'), ('them', 'PPO'),
('disturbed', 'VBN'), ('and', 'CC'), ('hallucinating', 'VBG'), ('.', '.'), ('An', 'AT'),
('interne', 'NN'), (',', ','), ('a', 'AT'), ('nurse', 'NN'), ('and', 'CC'), ('two', 'CD'),
('attendants', 'NNS'), ('were', 'BED')]
>>> [w for (w,t) in br_tw[:30]]
['There', 'were', 'thirty-eight', 'patients', 'on', 'the', 'bus', 'the', 'morning', 'I', 'left',
'for', 'Hanover', ',', 'most', 'of', 'them', 'disturbed', 'and', 'hallucinating', '.', 'An',
'interne', ',', 'a', 'nurse', 'and', 'two', 'attendants', 'were']
>>> [t for (w,t) in br_tw[:30]]
['EX', 'BED', 'CD', 'NNS', 'IN', 'AT', 'NN', 'AT', 'NN', 'PPSS', 'VBD', 'IN', 'NP', ',', 'AP',
'IN', 'PPO', 'VBN', 'CC', 'VBG', '.', 'AT', 'NN', ',', 'AT', 'NN', 'CC', 'CD', 'NNS', 'BED']
>>>
>>> br_ts = nltk.corpus.brown.tagged_sents(categories='mystery')
>>> br_ts[0]
[('There', 'EX'), ('were', 'BED'), ('thirty-eight', 'CD'), ('patients', 'NNS'), ('on', 'IN'),
('the', 'AT'), ('bus', 'NN'), ('the', 'AT'), ('morning', 'NN'), ('I', 'PPSS'), ('left', 'VBD'),
('for', 'IN'), ('Hanover', 'NP'), (',', ','), ('most', 'AP'), ('of', 'IN'), ('them', 'PPO'),
('disturbed', 'VBN'), ('and', 'CC'), ('hallucinating', 'VBG'), ('.', '.')]
>>> br_ts[1]
[('An', 'AT'), ('interne', 'NN'), (',', ','), ('a', 'AT'), ('nurse', 'NN'), ('and', 'CC'),
('two', 'CD'), ('attendants', 'NNS'), ('were', 'BED'), ('in', 'IN'), ('charge', 'NN'),
('of', 'IN'), ('us', 'PPO'), ('.', '.')]
>>>
|