Registry / ai-ml / textacy

textacy

JSON →
library0.13.0pypypiunverified

textacy is a Python library for NLP pre- and post-processing built on top of spaCy. Version 0.13.0, requires Python >=3.9. Released irregularly, with focuses on text extraction, tokenization, similarity, and topic modeling.

pip install textacy
INSTALL
IMPORT
SIG · TEXTACY
T
textacy
ai-mlpythonv0.13.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

TextDoc
from textacy import TextDoc
from textacy import TextDoc

Basic usage: create a TextDoc from a spaCy Doc and extract noun chunks.

import spacy import textacy # Load spaCy model nlp = spacy.load('en_core_web_sm') # Create TextDoc from text text = "The quick brown fox jumps over the lazy dog." doc = textacy.make_spacy_doc(text, nlp) # returns spacy.tokens.Doc text_doc = textacy.TextDoc(doc) # Extract noun chunks chunks = list(text_doc.noun_chunks) print(chunks[:2])
Debug
Known issues
breakingtextacy 0.13.0 removed many top-level API functions (e.g., `textacy.extract.*`, `textacy.io.*`). Use `TextDoc` methods or dedicated submodules like `textacy.extract.ngrams`.
fix
Replace old imports: e.g., `from textacy.extract import ngrams` instead of `textacy.extract.ngrams`.
affects: >=0.13.0
deprecated`textacy.preprocess` module is deprecated in favor of `TextDoc` methods for text cleaning.
fix
Use `text_doc.preprocess_text(...)` or `text_doc.replace(...)`.
affects: >=0.13.0
gotcha`make_spacy_doc` requires a spaCy `Language` object, not a raw model name. Passing a string will raise TypeError.
fix
Always pass a loaded nlp pipeline: `make_spacy_doc(text, nlp)`.
affects: all
gotcha`TextDoc` constructor expects a `spacy.tokens.Doc`, not raw text. You must call `nlp(text)` or `make_spacy_doc(text, nlp)` first.
fix
Create a Doc first: `doc = nlp(text)` then `TextDoc(doc)`.
affects: >=0.13.0
Upgrade
Version history
0.13.0latest on PyPI · released Apr 2, 2023
Audit
Dependencies
spacy>=3.0.0requiredCore dependency; textacy wraps spaCy's Doc objects.
Agent activity
20 hits · last 30 days
node
16
OpenAI (training)
1
Resources