Use fast UDPipe models directly in spaCy
spaCy + UDPipe
This package wraps the fast and efficient UDPipe language-agnostic NLP pipeline (via its Python bindings), so you can use UDPipe pre-trained models as a spaCy pipeline for 50+ languages out-of-the-box. Inspired by spacy-stanfordnlp, this package offers slightly less accurate models that are in turn much faster (see benchmarks for UDPipe and StanfordNLP).
Use the package manager pip to install spacy-udpipe.
pip install spacy-udpipe
After installation, use
spacy_udpipe.download(lang) to download the pre-trained model for the desired language.
import spacy_udpipe spacy_udpipe.download("en") # download English model text = "Wikipedia is a free online encyclopedia, created and edited by volunteers around the world." nlp = spacy_udpipe.load("en") doc = nlp(text) for token in doc: print(token.text, token.lemma_, token.pos_, token.dep_)
As all attributes are computed once and set in the custom
nlp.pipeline is empty.
Authors and acknowledgment
Created by Antonio Šajatović during an internship at Text Analysis and Knowledge Engineering Lab (TakeLab).
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
To start the tests, just run
pytest in the root source directory.
MIT © TakeLab
Maintained by Text Analysis and Knowledge Engineering Lab (TakeLab).
All available pre-trained models are licensed under CC BY-NC-SA 4.0.
All annotations match with Spacy's, except for token.tag_, which map from CoNLL XPOS tag (language-specific part-of-speech tag), defined for each language separately by the corresponding Universal Dependencies treebank.
Full list of supported languages and models is available in
This package exposes a
spacy_languagesentry point in its
setup.pyso full suport for serialization is enabled:
nlp = spacy_udpipe.load("en") nlp.to_disk("./udpipe-spacy-model")
To properly load a saved model, you must pass the
udpipe_modelargument when loading it:
udpipe_model = spacy_udpipe.UDPipeModel("en") nlp = spacy.load("./udpipe-spacy-model", udpipe_model=udpipe_model)
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size spacy_udpipe-0.0.4-py3-none-any.whl (11.6 kB)||File type Wheel||Python version py3||Upload date||Hashes View hashes|
|Filename, size spacy-udpipe-0.0.4.tar.gz (11.2 kB)||File type Source||Python version None||Upload date||Hashes View hashes|
Hashes for spacy_udpipe-0.0.4-py3-none-any.whl