Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork4.6k
💫 Industrial-strength Natural Language Processing (NLP) in Python
License
explosion/spaCy
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
spaCy is a library foradvanced Natural Language Processing in Python andCython. It's built on the very latest research, and was designed from day one tobe used in real products.
spaCy comes withpretrained pipelines and currentlysupports tokenization and training for70+ languages. It featuresstate-of-the-art speed andneural network models for tagging, parsing,named entity recognition,text classification and more, multi-tasklearning with pretrainedtransformers like BERT, as well as aproduction-readytraining system and easymodel packaging, deployment and workflow management. spaCy is commercialopen-source software, released under theMIT license.
💫Version 3.8 out now!Check out the release notes here.
Documentation | |
---|---|
⭐️spaCy 101 | New to spaCy? Here's everything you need to know! |
📚Usage Guides | How to use spaCy and its features. |
🚀New in v3.0 | New features, backwards incompatibilities and migration guide. |
🪐Project Templates | End-to-end workflows you can clone, modify and run. |
🎛API Reference | The detailed reference for spaCy's API. |
⏩GPU Processing | Use spaCy with CUDA-compatible GPU processing. |
📦Models | Download trained pipelines for spaCy. |
🦙Large Language Models | Integrate LLMs into spaCy pipelines. |
🌌Universe | Plugins, extensions, demos and books from the spaCy ecosystem. |
⚙️spaCy VS Code Extension | Additional tooling and features for working with spaCy's config files. |
👩🏫Online Course | Learn spaCy in this free and interactive online course. |
📰Blog | Read about current spaCy and Prodigy development, releases, talks and more from Explosion. |
📺Videos | Our YouTube channel with video tutorials, talks and more. |
🔴Live Stream | Join Matt as he works on spaCy and chat about NLP, live every week. |
🛠Changelog | Changes and version history. |
💝Contribute | How to contribute to the spaCy project and code base. |
👕Swag | Support us and our work with unique, custom-designed swag! |
![]() | Custom NLP consulting, implementation and strategic advice by spaCy’s core development team. Streamlined, production-ready, predictable and maintainable. Send us an email or take our 5-minute questionnaire, and well'be in touch!Learn more → |
The spaCy project is maintained by thespaCy team.Please understand that we won't be able to provide individual support via email.We also believe that help is much more valuable if it's shared publicly, so thatmore people can benefit from it.
Type | Platforms |
---|---|
🚨Bug Reports | GitHub Issue Tracker |
🎁Feature Requests & Ideas | GitHub Discussions ·Live Stream |
👩💻Usage Questions | GitHub Discussions ·Stack Overflow |
🗯General Discussion | GitHub Discussions ·Live Stream |
- Support for70+ languages
- Trained pipelines for different languages and tasks
- Multi-task learning with pretrainedtransformers like BERT
- Support for pretrainedword vectors and embeddings
- State-of-the-art speed
- Production-readytraining system
- Linguistically-motivatedtokenization
- Components for namedentity recognition, part-of-speech-tagging,dependency parsing, sentence segmentation,text classification,lemmatization, morphological analysis, entity linking and more
- Easily extensible withcustom components and attributes
- Support for custom models inPyTorch,TensorFlow and other frameworks
- Built invisualizers for syntax and NER
- Easymodel packaging, deployment and workflow management
- Robust, rigorously evaluated accuracy
📖For more details, see thefacts, figures and benchmarks.
For detailed installation instructions, see thedocumentation.
- Operating system: macOS / OS X · Linux · Windows (Cygwin, MinGW, VisualStudio)
- Python version: Python >=3.7, <3.13 (only 64 bit)
- Package managers:pip ·conda (via
conda-forge
)
Using pip, spaCy releases are available as source packages and binary wheels.Before you install spaCy and its dependencies, make sure that yourpip
,setuptools
andwheel
are up to date.
pip install -U pip setuptools wheelpip install spacy
To install additional data tables for lemmatization and normalization you canrunpip install spacy[lookups]
or installspacy-lookups-data
separately. The lookups package is needed to create blank models withlemmatization data, and to lemmatize in languages that don't yet come withpretrained models and aren't powered by third-party libraries.
When using pip it is generally recommended to install packages in a virtualenvironment to avoid modifying system state:
python -m venv .envsource .env/bin/activatepip install -U pip setuptools wheelpip install spacy
You can also install spaCy fromconda
via theconda-forge
channel. For thefeedstock including the build recipe and configuration, check outthis repository.
conda install -c conda-forge spacy
Some updates to spaCy may require downloading new statistical models. If you'rerunning spaCy v2.0 or higher, you can use thevalidate
command to check ifyour installed models are compatible and if not, print details on how to updatethem:
pip install -U spacypython -m spacy validate
If you've trained your own models, keep in mind that your training and runtimeinputs must match. After updating spaCy, we recommendretraining your modelswith the new version.
📖For details on upgrading from spaCy 2.x to spaCy 3.x, see themigration guide.
Trained pipelines for spaCy can be installed asPython packages. This meansthat they're a component of your application, just like any other module. Modelscan be installed using spaCy'sdownload
command, or manually by pointing pip to a path or URL.
Documentation | |
---|---|
Available Pipelines | Detailed pipeline descriptions, accuracy figures and benchmarks. |
Models Documentation | Detailed usage and installation instructions. |
Training | How to train your own pipelines on your data. |
# Download best-matching version of specific model for your spaCy installationpython -m spacy download en_core_web_sm# pip install .tar.gz archive or .whl from path or URLpip install /Users/you/en_core_web_sm-3.0.0.tar.gzpip install /Users/you/en_core_web_sm-3.0.0-py3-none-any.whlpip install https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.0.0/en_core_web_sm-3.0.0.tar.gz
To load a model, usespacy.load()
with the model name or a path to the model data directory.
importspacynlp=spacy.load("en_core_web_sm")doc=nlp("This is a sentence.")
You can alsoimport
a model directly via its full name and then call itsload()
method with no arguments.
importspacyimporten_core_web_smnlp=en_core_web_sm.load()doc=nlp("This is a sentence.")
📖For more info and examples, check out themodels documentation.
The other way to install spaCy is to clone itsGitHub repository and build it fromsource. That is the common way if you want to make changes to the code base.You'll need to make sure that you have a development environment consisting of aPython distribution including header files, a compiler,pip,virtualenv andgit installed. The compiler part is the trickiest. How todo that depends on your system.
Platform | |
---|---|
Ubuntu | Install system-level dependencies viaapt-get :sudo apt-get install build-essential python-dev git . |
Mac | Install a recent version ofXCode, including the so-called "Command Line Tools". macOS and OS X ship with Python and git preinstalled. |
Windows | Install a version of theVisual C++ Build Tools orVisual Studio Express that matches the version that was used to compile your Python interpreter. |
For more details and instructions, see the documentation oncompiling spaCy from source and thequickstart widget to get the rightcommands for your platform and Python version.
git clone https://github.com/explosion/spaCycd spaCypython -m venv .envsource .env/bin/activate# make sure you are using the latest pippython -m pip install -U pip setuptools wheelpip install -r requirements.txtpip install --no-build-isolation --editable.
To install with extras:
pip install --no-build-isolation --editable .[lookups,cuda102]
spaCy comes with anextensive test suite. In order to run thetests, you'll usually want to clone the repository and build spaCy from source.This will also install the required development dependencies and test utilitiesdefined in therequirements.txt
.
Alternatively, you can runpytest
on the tests from within the installedspacy
package. Don't forget to also install the test utilities via spaCy'srequirements.txt
:
pip install -r requirements.txtpython -m pytest --pyargs spacy
About
💫 Industrial-strength Natural Language Processing (NLP) in Python
Topics
Resources
License
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.