In python try the following.

Problem 1

Below are examples of how to access your corpus

ExampleDescription
fileids()the files of the corpus
fileids([categories])the files of the corpus corresponding to these categories
categories()the categories of the corpus
categories([fileids])the categories of the corpus corresponding to these files
raw()the raw content of the corpus
raw(fileids=[f1,f2,f3])the raw content of the specified files
raw(categories=[c1,c2])the raw content of the specified categories
words()the words of the whole corpus
words(fileids=[f1,f2,f3])the words of the specified fileids
words(categories=[c1,c2])the words of the specified categories
sents()the sentences of the whole corpus
sents(fileids=[f1,f2,f3])the sentences of the specified fileids
sents(categories=[c1,c2])the sentences of the specified categories
abspath(fileid)the location of the given file on disk
encoding(fileid)the encoding of the file (if known)
open(fileid)open a stream for reading the given corpus file
rootif the path to the root of locally installed corpus
readme()the contents of the README file of the corpus

Answer the following:

  1. How many categories are in your corpus?
  2. How many sentences are in the corpus?
  3. How many sentences are in each category?

For instance for brown you can import it by

from nltk.corpus import brown
brown.[function] 
brown.raw()

Problem 2)

first: pip install matplotlib

import nltk
from nltk.corpus import inaugural
word1='country'
word2='city'
cfd = nltk.ConditionalFreqDist((target, fileid[:4])for fileid in inaugural.fileids()for w in inaugural.words(fileid)for target in [word1, word2] if w.lower().startswith(target))
cfd.plot()

Try finding two words to replace country and city. Find one word that is becoming more popular in recent years (2009) and one that was popular but is not longer.

NOTE: You only need to attach 1 page to answer these 2 problems in a Word.doc

Do you have a similar assignment and would want someone to complete it for you? Click on the ORDER NOW option to get instant services at essayloop.com. We assure you of a well written and plagiarism free papers delivered within your specified deadline.