Registry / ai-ml / keyphrase-vectorizers

keyphrase-vectorizers

JSON →
library0.0.13pypypi✓ verified 84d ago

Set of vectorizers that extract keyphrases with part-of-speech patterns from a collection of text documents and convert them into a document-keyphrase matrix. Current version 0.0.13, requires Python >=3.7 and spaCy. Releases are intermittent.

pip install keyphrase-vectorizers
INSTALL
IMPORT
SIG · KEYPHRASE-VECTORIZ
K
keyphrase-vectorizers
ai-mlpythonv0.0.13
Install
79.8s avg
Import
14890ms
Disk
5427MB
Pass rate
1/ 10
Env Coverage1 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.0.13 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
✕ timeout
py 3.11
✕ build_error
✕ timeout
py 3.12
✕ build_error
✓ 79.8s
py 3.13
✕ build_error
✕ build_error
py 3.9
✕ build_error
✕ build_error
5427MB installed
● package 5427MB
Code
Verified usage

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

KeyphraseCountVectorizer
from keyphrase_vectorizers import KeyphraseCountVectorizer
from keyphrase_vectorizers.KeyphraseVectorizers import KeyphraseCountVectorizer
The correct import is directly from the package; nested module import fails.
KeyphraseTfidfVectorizer
from keyphrase_vectorizers import KeyphraseTfidfVectorizer
from keyphrase_vectorizers.KeyphraseVectorizer import KeyphraseTfidfVectorizer
Common typo in class name; there is no 'KeyphraseVectorizer' class.

Basic usage: load spaCy model, create vectorizer, fit on documents, and inspect extracted keyphrases.

import spacy from keyphrase_vectorizers import KeyphraseCountVectorizer # Download spaCy model if not already present # spacy.cli.download('en_core_web_sm') nlp = spacy.load('en_core_web_sm') docs = [ "Natural language processing enables computers to understand human language.", "Machine learning is a subset of artificial intelligence." ] vectorizer = KeyphraseCountVectorizer(spacy_pipeline=nlp) X = vectorizer.fit_transform(docs) print(vectorizer.get_feature_names_out()) print(X.toarray())
Debug
Known issues
gotchaThe `spacy_pipeline` parameter expects a spaCy Language object (from spacy.load) or a string (e.g., 'en_core_web_sm'). Passing a string will cause spaCy to load the pipeline each time, leading to performance issues.
fix
Always load the model once and pass the nlp object: `nlp = spacy.load('en_core_web_sm'); vectorizer = KeyphraseCountVectorizer(spacy_pipeline=nlp)`
affects: >=0.0.11
deprecatedThe parameter `multiprocessing` was renamed to `workers` in v0.0.6. Using `multiprocessing` will raise a TypeError.
fix
Use `workers` instead of `multiprocessing` when specifying the number of parallel processes.
affects: >=0.0.6
breakingIn v0.0.9, the default exclusion of certain spaCy pipeline components was removed. This can slow down keyphrase extraction but ensures compatibility with all spaCy pipelines, especially transformer-based ones.
fix
If performance degrades, explicitly disable unnecessary pipeline components via the `spacy_exclude` parameter.
affects: >=0.0.9
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'keyphrase_vectorizers'
The package is not installed or installed under a different name.
fix
Run `pip install keyphrase-vectorizers` to install.
ValueError: The 'spacy_pipeline' parameter must be a string or spacy Language object.
Passed an unsupported type (e.g., integer) as `spacy_pipeline`.
fix
Pass either a preloaded spaCy Language object or a valid spaCy model name string, e.g., 'en_core_web_sm'.
OSError: [E050] Can't find model 'en_core_web_sm'. It doesn't seem to be a Python package or a valid path to a data directory.
The required spaCy model is not installed.
fix
Run `python -m spacy download en_core_web_sm` (or the equivalent for your language).
Upgrade
Version history
0.0.13latest on PyPI · released May 2, 2024
Audit
Dependencies
spacyrequiredRequired for POS tagging and keyphrase extraction; must install a language model (e.g., en_core_web_sm).
scikit-learnrequiredUsed for vectorization and matrix operations.
Agent activity
4 hits · last 30 days
node
4
Resources
keyphrase-vectorizers — pip install keyphrase-vectorizers · libregistry