NLTK corpus: List down all the corpus names

NLTK corpus: Exercise-1 with Solution

Write a Python NLTK program to list down all the corpus names.

Sample Solution:

Python Code :

import nltk.corpus
print("\nAvailable corpus names:")

Sample Output:

Available corpus names:
['_LazyModule__lazymodule_globals', '_LazyModule__lazymodule_import', '_LazyModule__lazymodule_init', '_LazyModule__lazymodule_loaded', '_LazyModule__lazymodule_locals', '_LazyModule__lazymodule_name', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattr__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__name__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__']

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: NLTK Corpus Exercises Home.
Next: Write a Python NLTK program to get a list of common stop words in various languages in Python.

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.

Follow us on Facebook and Twitter for latest update.