{"id":27450,"library":"textacy","title":"textacy","description":"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.","status":"active","version":"0.13.0","language":"python","source_language":"en","source_url":"https://github.com/chartbeat-labs/textacy","tags":["nlp","spacy","text-processing","topic-modeling"],"install":[{"cmd":"pip install textacy","lang":"bash","label":"Install textacy"},{"cmd":"pip install textacy[lang]","lang":"bash","label":"Install with language models"}],"dependencies":[{"reason":"Core dependency; textacy wraps spaCy's Doc objects.","package":"spacy>=3.0.0","optional":false}],"imports":[{"note":"Older versions used `Doc` from `textacy.doc`, but in 0.13.0 the class is `TextDoc` imported directly from `textacy`.","wrong":"from textacy.doc import Doc","symbol":"TextDoc","correct":"from textacy import TextDoc"},{"note":"","wrong":"","symbol":"Corpus","correct":"from textacy import Corpus"}],"quickstart":{"code":"import spacy\nimport textacy\n\n# Load spaCy model\nnlp = spacy.load('en_core_web_sm')\n\n# Create TextDoc from text\ntext = \"The quick brown fox jumps over the lazy dog.\"\ndoc = textacy.make_spacy_doc(text, nlp)  # returns spacy.tokens.Doc\ntext_doc = textacy.TextDoc(doc)\n\n# Extract noun chunks\nchunks = list(text_doc.noun_chunks)\nprint(chunks[:2])","lang":"python","description":"Basic usage: create a TextDoc from a spaCy Doc and extract noun chunks."},"warnings":[{"fix":"Replace old imports: e.g., `from textacy.extract import ngrams` instead of `textacy.extract.ngrams`.","message":"textacy 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`.","severity":"breaking","affected_versions":">=0.13.0"},{"fix":"Use `text_doc.preprocess_text(...)` or `text_doc.replace(...)`.","message":"`textacy.preprocess` module is deprecated in favor of `TextDoc` methods for text cleaning.","severity":"deprecated","affected_versions":">=0.13.0"},{"fix":"Always pass a loaded nlp pipeline: `make_spacy_doc(text, nlp)`.","message":"`make_spacy_doc` requires a spaCy `Language` object, not a raw model name. Passing a string will raise TypeError.","severity":"gotcha","affected_versions":"all"},{"fix":"Create a Doc first: `doc = nlp(text)` then `TextDoc(doc)`.","message":"`TextDoc` constructor expects a `spacy.tokens.Doc`, not raw text. You must call `nlp(text)` or `make_spacy_doc(text, nlp)` first.","severity":"gotcha","affected_versions":">=0.13.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use `from textacy.extract import ngrams` instead of `from textacy import extract`.","cause":"In textacy 0.13.0, the extract module moved to `textacy.extract.ngrams` etc.","error":"ModuleNotFoundError: No module named 'textacy.extract'"},{"fix":"Load model first: `nlp = spacy.load('en_core_web_sm')`, then `make_spacy_doc(text, nlp)`.","cause":"Passed a string model name instead of a loaded spaCy Language object.","error":"TypeError: make_spacy_doc() missing 1 required positional argument: 'nlp'"},{"fix":"Create a TextDoc from a spaCy Doc: `doc = nlp(text); text_doc = TextDoc(doc)`.","cause":"Attempting to call noun_chunks on raw string; TextDoc not used.","error":"AttributeError: 'str' object has no attribute 'noun_chunks'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}