3 ms·
https://github.com/explosion/spaCy/blob/develop/examples/training/train_textcat.py https://github.com/explosion/spaCy/blob/develop/examples/tra... You'll need
by syllogism 9y ago
https://github.com/explosion/spaCy/blob/develop/examples/training/train_textcat.py https://github.com/explosion/spaCy/blob/develop/examples/tra...
You'll need to `pip install spacy-nightly` -- it uses spaCy 2 alpha. Until spaCy 2 stabilises it'll be a bit unstable, and unfortunately it's not in the docs yet.
You'll likely get better results by running `spacy download en_vectors_web_lg` and doing `nlp = spacy.load('en_vectors_web_lg')`. This will download word vectors, trained on an enormous web dump by Stanford NLP using their GloVe algorithm.
Once the model is trained you can do `nlp.to_disk(output_directory)`, and then run `spacy package <model directory> <package directory>`. This will setup the model data as a Python package, so that you can run `setup.py sdist`. You'll then get a self-contained Python package that exposes a `load()` function, to give you back the `nlp` object. (Note that if you do base the model on the GloVe vectors the package will be enormous, like 1GB. Shrug?)
If you're starting one step back and don't have the data annotated yet, you might be interested in our annotation tool Prodigy. There's a demo video of the text classification workflow here: https://www.youtube.com/watch?time_continue=638&v=5di0KlKl0fE https://www.youtube.com/watch?time_continue=638&v=5di0KlKl0f...