badcoder
badcoder

Reputation: 13

How to save a custom categorized corpus in NLTK

How can one 'save' a new corpus to NLTK corpora data?

In my case, after I created a new custom categorized corpus in NLTK just like in this page said: Creating a custom categorized corpus in NLTK and Python

I want to use it just like an already-installed corpora in NLTK (say movie_reviews). How can I do this? In other words, how can the new corpus I have read (say movie_reviews_0) can be called like this:

>>> import nltk
>>> from nltk.corpus import movie_reviews_0

Upvotes: 0

Views: 1330

Answers (1)

Jared
Jared

Reputation: 26397

You can add it to your own nltk_data/corpora folder which should be somewhere in your home directory. If you are on a Mac it would be in ~/nltk_data/corpora, for instance. And it looks like you also have to append your new corpus to the __init__.py within .../site-packages/nltk/corpus/.

Upvotes: 3

Related Questions