Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IMDB data fetcher #410

Merged
merged 1 commit into from
Jan 22, 2019
Merged

Add IMDB data fetcher #410

merged 1 commit into from
Jan 22, 2019

Conversation

stefan-it
Copy link
Member

Hi,

this PR adds a data fetcher that downloads and processes the IMDB dataset.

Additionally, the training corpus for a text classification task is downsampled, when no development dataset was specified.

To test the new IMDB data fetcher, just use:

from flair.data_fetcher import NLPTaskDataFetcher, NLPTask, TaggedCorpus

# Download IMDB corpus
NLPTaskDataFetcher.download_dataset(NLPTask.IMDB)

corpus: TaggedCorpus = NLPTaskDataFetcher.load_corpus(NLPTask.IMDB)

print(corpus.obtain_statistics())

The output of the corpus statistics:

{
    "TRAIN": {
        "dataset": "TRAIN",
        "total_number_of_documents": 22500,
        "number_of_documents_per_class": {
            "pos": 11191,
            "neg": 11309
        },
        "number_of_tokens_per_tag": {},
        "number_of_tokens": {
            "total": 6168036,
            "min": 10,
            "max": 2786,
            "avg": 274.1349333333333
        }
    },
    "TEST": {
        "dataset": "TEST",
        "total_number_of_documents": 25000,
        "number_of_documents_per_class": {
            "pos": 12500,
            "neg": 12500
        },
        "number_of_tokens_per_tag": {},
        "number_of_tokens": {
            "total": 6714408,
            "min": 7,
            "max": 2768,
            "avg": 268.57632
        }
    },
    "DEV": {
        "dataset": "DEV",
        "total_number_of_documents": 2500,
        "number_of_documents_per_class": {
            "pos": 1309,
            "neg": 1191
        },
        "number_of_tokens_per_tag": {},
        "number_of_tokens": {
            "total": 700278,
            "min": 17,
            "max": 2003,
            "avg": 280.1112
        }
    }
}

… training corpus for text classification, when no development dataset is specified
@alanakbik
Copy link
Collaborator

Hi @stefan-it this is great, thanks - This will make it much easier for people to get started with text classification experiments!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants