daily pastebin goal
1%
SHARE
TWEET

Untitled

a guest Feb 13th, 2018 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. >>> from nltk.corpus import brown
  2. >>> brown_tagged_sents = brown.tagged_sents(categories='news')
  3. >>> brown_sents = brown.sents(categories='news')
  4. >>> unigram_tagger = nltk.UnigramTagger(brown_tagged_sents)
  5. >>> unigram_tagger.tag(brown_sents[2007])
  6. [('Various', 'JJ'), ('of', 'IN'), ('the', 'AT'), ('apartments', 'NNS'),
  7. ('are', 'BER'), ('of', 'IN'), ('the', 'AT'), ('terrace', 'NN'), ('type', 'NN'),
  8. (',', ','), ('being', 'BEG'), ('on', 'IN'), ('the', 'AT'), ('ground', 'NN'),
  9. ('floor', 'NN'), ('so', 'QL'), ('that', 'CS'), ('entrance', 'NN'), ('is', 'BEZ'),
  10. ('direct', 'JJ'), ('.', '.')]
  11. >>> unigram_tagger.evaluate(brown_tagged_sents)
  12. 0.9349006503968017
RAW Paste Data
Top