Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

💫 Industrial-strength Natural Language Processing (NLP) in Python

License

NotificationsYou must be signed in to change notification settings

explosion/spaCy

Repository files navigation

spaCy: Industrial-strength NLP

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.

testsCurrent Release Versionpypi Versionconda VersionPython wheelsCode style: black
PyPi downloadsConda downloads

📖 Documentation

Documentation
⭐️spaCy 101New to spaCy? Here's everything you need to know!
📚Usage GuidesHow to use spaCy and its features.
🚀New in v3.0New features, backwards incompatibilities and migration guide.
🪐Project TemplatesEnd-to-end workflows you can clone, modify and run.
🎛API ReferenceThe detailed reference for spaCy's API.
GPU ProcessingUse spaCy with CUDA-compatible GPU processing.
📦ModelsDownload trained pipelines for spaCy.
🦙Large Language ModelsIntegrate LLMs into spaCy pipelines.
🌌UniversePlugins, extensions, demos and books from the spaCy ecosystem.
⚙️spaCy VS Code ExtensionAdditional tooling and features for working with spaCy's config files.
👩‍🏫Online CourseLearn spaCy in this free and interactive online course.
📰BlogRead about current spaCy and Prodigy development, releases, talks and more from Explosion.
📺VideosOur YouTube channel with video tutorials, talks and more.
🔴Live StreamJoin Matt as he works on spaCy and chat about NLP, live every week.
🛠ChangelogChanges and version history.
💝ContributeHow to contribute to the spaCy project and code base.
👕SwagSupport us and our work with unique, custom-designed swag!
Tailored SolutionsCustom 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 →

💬 Where to ask questions

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.

TypePlatforms
🚨Bug ReportsGitHub Issue Tracker
🎁Feature Requests & IdeasGitHub Discussions ·Live Stream
👩‍💻Usage QuestionsGitHub Discussions ·Stack Overflow
🗯General DiscussionGitHub Discussions ·Live Stream

Features

  • 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.

⏳ Install spaCy

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 (viaconda-forge)

pip

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-dataseparately. 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

conda

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

Updating 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.

📦 Download model packages

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'sdownloadcommand, or manually by pointing pip to a path or URL.

Documentation
Available PipelinesDetailed pipeline descriptions, accuracy figures and benchmarks.
Models DocumentationDetailed usage and installation instructions.
TrainingHow 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

Loading and using models

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.

⚒ Compile from source

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
UbuntuInstall system-level dependencies viaapt-get:sudo apt-get install build-essential python-dev git .
MacInstall a recent version ofXCode, including the so-called "Command Line Tools". macOS and OS X ship with Python and git preinstalled.
WindowsInstall 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]

🚦 Run tests

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

Sponsor this project

    Contributors684


    [8]ページ先頭

    ©2009-2025 Movatter.jp