<jupyter_start><jupyter_text>**Import Brown Corpus and Access Data**<jupyter_code>import nltk
nltk.download('brown')
from nltk.corpus import brown
brown.words(categories='adventure')[:10]
brown.categories()<jupyter_output><empty_output><jupyter_text>**Import inaugural corpus and access data**<jupyter_code>nltk.download('inaugural')
from nltk.corpus import inaugural
inaugural.fileids()
inaugural.words(fileids='2017-Trump.txt')[:50]<jupyter_output><empty_output><jupyter_text>**frequency distribution of words in a text**<jupyter_code>textsample1='Experts on constitutional and political affairs say sovereignty vested in the people, limited government, the principle of separation of powers, independent judiciary, human rights and fundamental rights and inclusive governance system are the components of constitutionalism. The breach of any of these components means an attack on constitutionalism.'

fd=nltk.FreqDist(textsample1.split())
fd<jupyter_output><empty_output><jupyter_text>**Conditional frequency distribution of words in a text**<jupyter_code>from nltk.probability import ConditionalFreqDist
cfd=ConditionalFreqDist((len(word),word) for word in textsample1.split())
cfd[4]
cfd[10]

cfd[8]

cfd[6]
cfd[3]<jupyter_output><empty_output><jupyter_text>**Frequency Distribution in Inagural Address**<jupyter_code>sampletext2=inaugural.words(fileids='2017-Trump.txt')
fd1=nltk.FreqDist(inaugural.words(fileids='2017-Trump.txt'))
fd1

from nltk.probability import ConditionalFreqDist
cfc=ConditionalFreqDist((len(word),word) for word in sampletext2)
cfc[5]
cfc[3]

from nltk.probability import ConditionalFreqDist

cfd=ConditionalFreqDist((len(word),word)for word in inaugural.words(fileids= '2017-Trump.txt'))
cfd<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10781517398745008, 'fraction_numerical': 0.019965772960638905, 'mean_word_length': 9.894409937888199, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '17449', 'license': 'MIT', 'n_tokens_mistral': 614, 'n_tokens_neox': 578, 'n_words': 127, 'path': 'Task1.ipynb', 'repo_name': 'sushangautam/Natural-Language-Processing-Practice', 'size': '1753'}