Skip to content
Back to skills

Gensim

ASecurity

"Guides Gensim topic modelling, document indexing, embeddings,

  • 247 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 8, 2026
ai-agentspythonbashbackendperformancedocumentation

Works with

  • cli

Security analysis

A92/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 20 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill gensim --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Gensim?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Gensim
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-gensim/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-gensim)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: gensim
description: "Guides Gensim topic modelling, document indexing, embeddings,
  similarity retrieval, downloader, and script workflows for Python NLP and IR
  tasks."
disable-model-invocation: true
metadata:
  disco-role: operating
license: LGPL 2.1
---

# Gensim Repo Skill

Use this skill when a task needs Gensim for streaming corpora, vector-space models,
topic modelling, word/document embeddings, document similarity, gensim-data
resources, or package-provided conversion/Wikipedia utilities.

Gensim is a CPU-oriented Python package for topic modelling, document indexing,
and similarity retrieval. It is optimized around streaming corpora and NumPy/SciPy
linear algebra rather than GPU backends.

## First checks

1. Confirm the package is importable in the target environment:

   ```bash
   python - <<'PY'
   import gensim
   from gensim import corpora, models, similarities
   print(gensim.__version__)
   print(corpora.Dictionary, models.TfidfModel, similarities.MatrixSimilarity)
   PY
   ```

2. For a privacy-safe diagnostic, run or adapt [`scripts/check_gensim_environment.py`](scripts/check_gensim_environment.py).
3. For an end-to-end sanity check across core concepts, run [`scripts/core_workflow_smoke.py`](scripts/core_workflow_smoke.py).
4. Read [`references/repo-provenance.md`](references/repo-provenance.md) before deciding whether this skill is current for a checkout.

## Installation notes

- Public install: `python -m pip install --upgrade gensim`.
- Local checkout inspection/development: `python -m pip install -e .` from the checkout root.
- Gensim 4.4.0 metadata requires Python `>=3.9` and runtime dependencies `numpy`, `scipy`, and `smart_open`.
- Optional surfaces are not part of the minimum install: `Pyro4` for distributed LDA/LSI, `annoy` or `nmslib` for approximate-neighbor helpers, POT/import name `ot` for WMD, NLTK/scikit/pandas/statsmodels for some documentation examples, and Visdom for selected callbacks.
- Performance depends heavily on the BLAS/LAPACK libraries used by NumPy/SciPy. GPU hardware is not required for the workflows covered here.

## Route map

| If the task is about... | Read |
| --- | --- |
| Documents, tokens, dictionaries, bag-of-words vectors, streaming corpora, Matrix Market/SVMlight/Blei/UCI/Mallet formats, `TextCorpus`, `WikiCorpus` | [`sub-skills/corpora-and-vector-spaces/SKILL.md`](sub-skills/corpora-and-vector-spaces/SKILL.md) |
| TF-IDF, BM25, LSI/LSA, LDA/LdaMulticore, HDP, NMF, topic coherence, model transforms and persistence | [`sub-skills/topic-modeling-and-transformations/SKILL.md`](sub-skills/topic-modeling-and-transformations/SKILL.md) |
| Word2Vec, FastText, Doc2Vec, KeyedVectors, phrase detection, embedding persistence and vector formats | [`sub-skills/embeddings-and-phrases/SKILL.md`](sub-skills/embeddings-and-phrases/SKILL.md) |
| MatrixSimilarity, SparseMatrixSimilarity, sharded Similarity, Soft Cosine, WMD, term-similarity matrices, Annoy/NMSLIB optional indexes | [`sub-skills/similarity-and-search/SKILL.md`](sub-skills/similarity-and-search/SKILL.md) |
| `gensim.downloader`, `GENSIM_DATA_DIR`, GloVe/word2vec/TensorBoard conversions, package diagnostics, Wikipedia dump helper CLIs | [`sub-skills/data-and-cli-utilities/SKILL.md`](sub-skills/data-and-cli-utilities/SKILL.md) |

For a compact package map and cross-workflow dependencies, read
[`references/package-overview.md`](references/package-overview.md). For install,
import, optional dependency, cache, and data-size failures, read
[`references/troubleshooting.md`](references/troubleshooting.md).

## Common workflow order

1. Start with raw text documents or an existing vector corpus.
2. Use `corpora.Dictionary` and `doc2bow` (or a streaming corpus class) to build a consistent feature space.
3. Train a transformation/model such as `TfidfModel`, `LsiModel`, or `LdaModel` on that same feature space.
4. Save models/corpora with `.save()`, `.load()`, or corpus-specific `serialize()` helpers.
5. Build an index with `MatrixSimilarity`, `SparseMatrixSimilarity`, or `Similarity` only after choosing the transformed vector space and `num_features`.
6. Use embeddings (`Word2Vec`, `FastText`, `Doc2Vec`, `KeyedVectors`) when the task needs token/document embeddings instead of bag-of-words topic models.

## Decision shortcuts

- Use `Dictionary.doc2bow(tokens)` only with token lists, never a raw string.
- Use streaming iterators when a corpus may not fit in memory.
- Use `TfidfModel` as a lightweight weighting transform before LSI or similarity.
- Use `LdaMulticore` for CPU multicore LDA on one machine; optional distributed LDA/LSI requires `Pyro4` and separate worker/dispatcher setup.
- Use `FastText` rather than `Word2Vec` when out-of-vocabulary word vectors are required.
- Use `KeyedVectors` when you only need stored vectors and similarity operations, not continued training.
- Use `Similarity` rather than `MatrixSimilarity` when the indexed vectors do not fit in memory.
- Check optional dependencies before selecting Annoy, NMSLIB, WMD/POT, Pyro4 distributed, or Visdom callback flows.

## Runtime boundaries

The guidance and bundled scripts in this skill are self-contained. Do not require
future agents to open the original repository docs, examples, tests, scripts, or
notebooks to complete normal Gensim tasks. Treat original repo files only as
provenance evidence unless this skill has bundled an adapted helper or reference.

Files in this skill

  • SKILL.md5.3 KB
  • references/package-overview.md4.7 KB
  • references/repo-provenance.md2.4 KB
  • references/repo-routing-metadata.json508 B
  • references/troubleshooting.md4.7 KB
  • scripts/check_gensim_environment.py3 KB
  • scripts/core_workflow_smoke.py2.2 KB
  • sub-skills/corpora-and-vector-spaces/SKILL.md4.3 KB
  • sub-skills/corpora-and-vector-spaces/references/api-reference.md3.7 KB
  • sub-skills/corpora-and-vector-spaces/references/data-formats.md2.4 KB
  • sub-skills/corpora-and-vector-spaces/references/troubleshooting.md1.9 KB
  • sub-skills/corpora-and-vector-spaces/references/workflows.md2.8 KB
  • sub-skills/corpora-and-vector-spaces/scripts/corpus_io_smoke.py2 KB
  • sub-skills/data-and-cli-utilities/SKILL.md3.7 KB
  • sub-skills/data-and-cli-utilities/references/cli-reference.md1.7 KB
  • sub-skills/data-and-cli-utilities/references/downloader-and-data.md1.5 KB
  • sub-skills/data-and-cli-utilities/references/troubleshooting.md2.1 KB
  • sub-skills/data-and-cli-utilities/references/wiki-workflows.md1.6 KB
  • sub-skills/data-and-cli-utilities/scripts/convert_glove_to_word2vec.py1.5 KB
  • sub-skills/data-and-cli-utilities/scripts/segment_wiki_tiny.py3 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.