Skip to main content

gensim – Topic Modelling in Python

Travis Wheel

Gensim is a Python library for topic modelling, document indexing and similarity retrieval with large corpora. Target audience is the natural language processing (NLP) and information retrieval (IR) community.

Features

  • All algorithms are memory-independent w.r.t. the corpus size (can process input larger than RAM, streamed, out-of-core)

  • Intuitive interfaces

    • easy to plug in your own input corpus/datastream (simple streaming API)

    • easy to extend with other Vector Space algorithms (simple transformation API)

  • Efficient multicore implementations of popular algorithms, such as online Latent Semantic Analysis (LSA/LSI/SVD), Latent Dirichlet Allocation (LDA), Random Projections (RP), Hierarchical Dirichlet Process (HDP) or word2vec deep learning.

  • Distributed computing: can run Latent Semantic Analysis and Latent Dirichlet Allocation on a cluster of computers.

  • Extensive documentation and Jupyter Notebook tutorials.

If this feature list left you scratching your head, you can first read more about the Vector Space Model and unsupervised document analysis on Wikipedia.

Installation

This software depends on NumPy and Scipy, two Python packages for scientific computing. You must have them installed prior to installing gensim.

It is also recommended you install a fast BLAS library before installing NumPy. This is optional, but using an optimized BLAS such as ATLAS or OpenBLAS is known to improve performance by as much as an order of magnitude. On OS X, NumPy picks up the BLAS that comes with it automatically, so you don’t need to do anything special.

Install the latest version of gensim:

pip install --upgrade gensim

Or, if you have instead downloaded and unzipped the source tar.gz package:

python setup.py install

For alternative modes of installation, see the documentation.

Gensim is being continuously tested under Python 3.6, 3.7 and 3.8. Support for Python 2.7 was dropped in gensim 4.0.0 – install gensim 3.8.3 if you must use Python 2.7.

How come gensim is so fast and memory efficient? Isn’t it pure Python, and isn’t Python slow and greedy?

Many scientific algorithms can be expressed in terms of large matrix operations (see the BLAS note above). Gensim taps into these low-level BLAS libraries, by means of its dependency on NumPy. So while gensim-the-top-level-code is pure Python, it actually executes highly optimized Fortran/C under the hood, including multithreading (if your BLAS is so configured).

Memory-wise, gensim makes heavy use of Python’s built-in generators and iterators for streamed data processing. Memory efficiency was one of gensim’s design goals, and is a central feature of gensim, rather than something bolted on as an afterthought.

Documentation

Citing gensim

When citing gensim in academic papers and theses, please use this BibTeX entry:

@inproceedings{rehurek_lrec,
      title = {{Software Framework for Topic Modelling with Large Corpora}},
      author = {Radim {\v R}eh{\r u}{\v r}ek and Petr Sojka},
      booktitle = {{Proceedings of the LREC 2010 Workshop on New
           Challenges for NLP Frameworks}},
      pages = {45--50},
      year = 2010,
      month = May,
      day = 22,
      publisher = {ELRA},
      address = {Valletta, Malta},
      language={English}
}

Gensim is open source software released under the GNU LGPLv2.1 license. Copyright (c) 2009-now Radim Rehurek

Analytics

Metadata

Release files for gensim 4.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gensim 4.0.1
File Size Uploaded
gensim-4.0.1.tar.gz 23.1 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for gensim 4.0.1
File
gensim-4.0.1-cp38-cp38-win_amd64.whl CPython 3.8 CPython 3.8 Windows x86-64 Details
gensim-4.0.1-cp38-cp38-manylinux1_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.5+ x86-64 Details
gensim-4.0.1-cp38-cp38-macosx_10_9_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.9+ x86-64 Details
gensim-4.0.1-cp37-cp37m-win_amd64.whl CPython 3.7 CPython 3.7 pymalloc Windows x86-64 Details
gensim-4.0.1-cp37-cp37m-manylinux1_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64 Details
gensim-4.0.1-cp37-cp37m-macosx_10_9_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.9+ x86-64 Details
gensim-4.0.1-cp36-cp36m-win_amd64.whl CPython 3.6 CPython 3.6 pymalloc Windows x86-64 Details
gensim-4.0.1-cp36-cp36m-manylinux1_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 Details
gensim-4.0.1-cp36-cp36m-macosx_10_9_x86_64.whl CPython 3.6 CPython 3.6 pymalloc macOS 10.9+ x86-64 Details

Total release size: 238.1 MB

Release files / gensim-4.0.1.tar.gz

Download URL gensim-4.0.1.tar.gz
Size 23.1 MB
Tags Source
SHA-256 checksum
How to use checksums
b4d0b9562796968684028e06635e0f7aff39ffb33719057fd1667754ea09a6e4
BLAKE2b-256 checksum
How to use checksums
1f6c363d00aa23642f42b27b908c6474ab981c75882eefc084210d5b8ce8cd8e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.7

Release files / gensim-4.0.1-cp38-cp38-win_amd64.whl

Download URL gensim-4.0.1-cp38-cp38-win_amd64.whl
Size 23.9 MB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
c748b77082125ada8ccbf7b1de9e60b7c726b5371a17f207234fee66fb32da05
BLAKE2b-256 checksum
How to use checksums
63d0d46407c21c8f22ed2a654e0b9cdb7d6db803f03cfe92a2b696a633570b22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.7

Release files / gensim-4.0.1-cp38-cp38-manylinux1_x86_64.whl

Download URL gensim-4.0.1-cp38-cp38-manylinux1_x86_64.whl
Size 23.9 MB
Tags CPython 3.8 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
5c0cb64d8c6df7e61497cc9d23fdbf552eb18d6d39341271b647d2e84d970e00
BLAKE2b-256 checksum
How to use checksums
cf2a32fc28ec0f0b58589cb899cb8617d2a124bd31305e8dfd77045e952f0636
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.7

Release files / gensim-4.0.1-cp38-cp38-macosx_10_9_x86_64.whl

Download URL gensim-4.0.1-cp38-cp38-macosx_10_9_x86_64.whl
Size 23.9 MB
Tags CPython 3.8 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
a78e9f51ec87930a7a621c6536c20aac41d35aea52f6b0eae165254dc908ff1b
BLAKE2b-256 checksum
How to use checksums
95020ab2d25a8d65e04f7beff899c401bea3ffc45f9f0d3cd488e8c76aa255c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.7

Release files / gensim-4.0.1-cp37-cp37m-win_amd64.whl

Download URL gensim-4.0.1-cp37-cp37m-win_amd64.whl
Size 23.9 MB
Tags CPython 3.7 CPython 3.7 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
3691ddda33113a713453a9601ae2b21d297a5c197073eef641ae15d6968a92c1
BLAKE2b-256 checksum
How to use checksums
1589b785d557e3c806abc8beaae664571d71e8c4eb736a2c32b69aba9932cbd1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.7

Release files / gensim-4.0.1-cp37-cp37m-manylinux1_x86_64.whl

Download URL gensim-4.0.1-cp37-cp37m-manylinux1_x86_64.whl
Size 23.9 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
f1200f3cc6449fc4d90c052911cee8876178adc4afbf756a77207b8ee5fb3967
BLAKE2b-256 checksum
How to use checksums
4452f1417772965652d4ca6f901515debcd9d6c5430969e8c02ee7737e6de61c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.7

Release files / gensim-4.0.1-cp37-cp37m-macosx_10_9_x86_64.whl

Download URL gensim-4.0.1-cp37-cp37m-macosx_10_9_x86_64.whl
Size 23.9 MB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
ac146eadb15c197eed99280d91ddaed44f3bac099cb32f790476922b203deefd
BLAKE2b-256 checksum
How to use checksums
5374b43358520b6bc2f5175bd648eba27f78808ed1f5d0854f38c8c17d3261b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.7

Release files / gensim-4.0.1-cp36-cp36m-win_amd64.whl

Download URL gensim-4.0.1-cp36-cp36m-win_amd64.whl
Size 23.9 MB
Tags CPython 3.6 CPython 3.6 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
fd23b1e19bf0cfaf37ce635b5a91d8ae4e3be7886e04bfb57e61d044995c6ed8
BLAKE2b-256 checksum
How to use checksums
1d9a071a3172bc3383e3132b8fd009d82bc96d4718043f2b654bbb2c65640094
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.7

Release files / gensim-4.0.1-cp36-cp36m-manylinux1_x86_64.whl

Download URL gensim-4.0.1-cp36-cp36m-manylinux1_x86_64.whl
Size 23.9 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
4cb1761a76338abd6c9345cfacdb75173961e238e01258e0c0e599341d397016
BLAKE2b-256 checksum
How to use checksums
1692787d4c9050d4669f9103d37081b34b06c277b3997f440e53a80ef8128082
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.7

Release files / gensim-4.0.1-cp36-cp36m-macosx_10_9_x86_64.whl

Download URL gensim-4.0.1-cp36-cp36m-macosx_10_9_x86_64.whl
Size 23.9 MB
Tags CPython 3.6 CPython 3.6 pymalloc macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
17375b33685d0b36646ff6cec5c9e54c7384d3a7c583cbb4480a8ceb9d811221
BLAKE2b-256 checksum
How to use checksums
eb5a1574985e83d270b26b29a259675829c6ad5b966cdf7093187d2850cec0a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.7

Release history Release notifications | RSS feed

4.4.0

26 release files

4.3.3

26 release files

4.3.2

21 release files

4.3.1

24 release files

4.3.0

17 release files

4.1.2

17 release files

4.1.1

13 release files

4.1.0

17 release files

This release

4.0.1 This release

10 release files

4.0.0

10 release files

3.8.2

22 release files

3.8.1

31 release files

3.7.2

15 release files

3.7.1

31 release files

3.7.0

25 release files

3.6.0

24 release files

3.1.0

7 release files

3.0.0

16 release files

2.3.0

16 release files

2.2.0

16 release files

2.1.0

12 release files

2.0.0

12 release files

1.0.0

9 release files

0.13.4

9 release files

0.13.2

9 release files

0.13.0

1 release file

0.12.2

2 release files

0.12.1

2 release files

0.11.1

2 release files

0.10.3

2 release files

0.10.2

2 release files

0.10.1

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.9

2 release files

0.8.8

2 release files

0.8.7

1 release file

0.8.6

2 release files

0.8.5

2 release files

0.8.4

2 release files

0.8.3

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.8

2 release files

0.7.7

2 release files

0.7.6

2 release files

0.7.5

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4

2 release files

0.3.0

2 release files

0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page