SpaCy v1.0: Deep Learning with custom pipelines and Keras
explosion.ai
explosion.ai
When I want to do something, I always use Spacy first. It's the 95% solution - it does 95% of the things you are ever likely to do. The only downside is that I haven't worked out how to avoid the slow startup time.
NLTK has more stuff. Some of it is crap, but some is useful. For example, if you want WordNet then NTLK is an easy way to get it.
CoreNLP gives you high quality POS tagging and named entity extraction. It's a Java library (but can run as a REST service) so that is good if you are on the JVM.
OpenNLP.. has an Apache license.
Rosette is expensive, and tuned entirely differently to any other text processing library. Has great multi lingual support.
OpenIE is by far the best open information extraction toolkit.
Obviously this misses the 1000 pound gorilla: Syntax/Parsey McParseface. This isn't exactly trivial to run yet outside of Docker. Slowly getting my stuff together on this.
I'd appreciate a pull request with WordNet support for spaCy. I've thought about it at various points, and I already use WordNet data in spaCy's lemmatizer.
Support for more languages will come. The plan is to have a model store, so that you can buy data packs for additional languages.
Accuracy will improve when we translate over the bi-LSTM models.
In short: we'll keep chipping away at the remaining 5%. The library's only about 1 year old, and I haven't yet managed to do a good job of helping other developers contribute. There's plenty more to come.
Fun is lots of stuff. I have a question-answering thing which I'm slowly making progress on. I've written various (old) open source text things which still seem to be used. I do Kaggle. I wrote a contextual advertising server for a cycling website I ran (and ended up licensing some of the tech). I have a vague home research project trying to combine unstructured knowledge with structured knowledge graphs. Probably other stuff I've forgotten about.
Other than that, I find Spacy's philosophy of "one (best) way of doing everything" a bit stifling. I don't think there is a "best" parser or "best" named entity recognizer. A certain parser may perform very well in a domain (for example, Tweeboparser [1] performs well with tweets) and perform very badly in another. This is true for almost everything in NLP, and NLTK embraces this diversity quite well. This is why NLTK is my go to tool when I want to do something cutting edge in NLP.
[0] https://demos.explosion.ai/displacy/ [1] https://github.com/ikekonglp/TweeboParser
I think 99% of the time there's one best algorithm, and even one best implementation of it. It's the weights, and sometimes the features, that need to vary.
Finally — I love displaCy too. Ines does great work :). Have you seen that we open-sourced this recently? It's now very easy to run locally, and connect up to the model you're developing. You can use this with any other parser, too. https://explosion.ai/blog/displacy-js-nlp-visualizer
So I do a lot of work with Twitter data - to the point where I have (many) custom Word2Vec models for Twitter data.
Tweeboparser is good, and the NLTK has a basic Twitter tokenizer built in. But I still often end up using Space for stuff anyway. For example, I was building a custom distance metric to explore Tweet clusters, and the Spacy word vectors were fine to get that working.
It's true that I dropped down to using Gensim or Spark's Word2Vec model for some more complex models though.
Also, while NLTK's basic Twitter tokenizer is okay, I find that ARK's tokenizer [0] is much better. Similarly, for POS tagging of tweets, I am using the GATE POS tagger [1]. They have a Stanford model and I can hook it up with NLTK using the StanfordTagger class. In fact, this is the kind of integration that I am missing in Spacy.
[0] https://github.com/myleott/ark-twokenize-py [1] https://gate.ac.uk/wiki/twitter-postagger.html
I'm curious what type of feedback you've gotten from users that have migrated from NLTK to SpaCy.
While there are portions on NLTK that are useful, it suffers from having too many things under the hood and a lack of consistent maintenance. Many of them are superglued external libraries while others have not been maintained or have never been made to work well with other parts of NLTK.
The biggest example of this was that, for some time, it wasn't certain how the NLTK part of speech tagger was trained[2]. While that has been remedied, the remedy uses part of speech tagging code inspired via earlier work by the author of spaCy[3][4].
spaCy has been made from the ground up to support more modern deep learning features (easy integration of Keras is quite cool but I'm actually meaning the default inclusion of word vectors which has existed since early spaCy) while having a consistent and clean API that covers many sane use cases.
The API is highly Pythonic but the underlying performance critical components are written in Cython, meaning very few parsers are actually able to beat spaCy in speed (especially when using CPU and not GPU). Regarding speed, multi-threading is also a relatively trivial process - Cython releases the GIL around the syntactic parser. As a reference to speed, they used it to tag and parse every Reddit comment from 2015 to then generate "sense2vec"[5] at over 100,000 words per second using 4 threads.
Finally, and most importantly, spaCy compares to and remains competitive with state of the art results and all of it remains under an MIT license.
As you might have guessed, I'm a fan :)
Note: I was in the same NLP lab as Matthew Honnibal for my undergraduate so will admit positive bias ;) This was long before spaCy was a thing however - he was simply a fascinating and interesting guy for other reasons ^_^
[1]: https://explosion.ai/blog/dead-code-should-be-buried
[2]: https://github.com/nltk/nltk/issues/1063
[3]: https://github.com/nltk/nltk/pull/1143
[4]: https://explosion.ai/blog/part-of-speech-pos-tagger-in-pytho...
The biggest benefit you'll see right off the bat is speed. SpaCy is much faster than most other NLP tools out there.