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 (trivial streaming API)

    • easy to extend with other Vector Space algorithms (trivial 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.

The simple way to install gensim is:

pip install -U gensim

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

python setup.py test
python setup.py install

For alternative modes of installation (without root privileges, development installation, optional install features), see the install documentation.

This version has been tested under Python 2.7, 3.5 and 3.6. Support for Python 2.6, 3.3 and 3.4 was dropped in gensim 1.0.0. Install gensim 0.13.4 if you must use Python 2.6, 3.3 or 3.4. Support for Python 2.5 was dropped in gensim 0.10.0; install gensim 0.9.1 if you must use Python 2.5). Gensim’s github repo is hooked against Travis CI for automated testing on every commit push and pull request.

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 Rehurek 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 2.1.0

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 2.1.0
File Size Uploaded
gensim-2.1.0.tar.gz 15.1 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for gensim 2.1.0
File
gensim-2.1.0.win-amd64-py3.5.exe Details
gensim-2.1.0.win-amd64-py2.7.exe Details
gensim-2.1.0.win32-py3.5.exe Details
gensim-2.1.0.win32-py2.7.exe Details
gensim-2.1.0-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl CPython 3.6 CPython 3.6 pymalloc macOS 10.9+ Intel (x86-64, i386), macOS 10.10+ x86-64, macOS 10.10+ Intel (x86-64, i386), macOS 10.9+ x86-64, macOS 10.6+ Intel (x86-64, i386) Details
gensim-2.1.0-cp35-cp35m-win_amd64.whl CPython 3.5 CPython 3.5 pymalloc Windows x86-64 Details
gensim-2.1.0-cp35-cp35m-win32.whl CPython 3.5 CPython 3.5 pymalloc Windows x86-32 Details
gensim-2.1.0-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl CPython 3.5 CPython 3.5 pymalloc macOS 10.6+ Intel (x86-64, i386), macOS 10.10+ x86-64, macOS 10.9+ Intel (x86-64, i386), macOS 10.10+ Intel (x86-64, i386), macOS 10.9+ x86-64 Details
gensim-2.1.0-cp27-cp27m-win_amd64.whl CPython 2.7 CPython 2.7 pymalloc Windows x86-64 Details
gensim-2.1.0-cp27-cp27m-win32.whl CPython 2.7 CPython 2.7 pymalloc Windows x86-32 Details
gensim-2.1.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl CPython 2.7 CPython 2.7 pymalloc macOS 10.6+ Intel (x86-64, i386), macOS 10.10+ x86-64, macOS 10.9+ Intel (x86-64, i386), macOS 10.10+ Intel (x86-64, i386), macOS 10.9+ x86-64 Details

Total release size: 76.8 MB

Release files / gensim-2.1.0.tar.gz

Download URL gensim-2.1.0.tar.gz
Size 15.1 MB
Tags Source
SHA-256 checksum
How to use checksums
6c8a6a3b4dc26521c7b8a4137199c9b27d4e1b5007d6f77cb01ca095a25cc7f2
BLAKE2b-256 checksum
How to use checksums
0c350e2dbd6ff005d021ab89bcb35baeeff19bf7a3f30f75f98820f1d2876b39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / gensim-2.1.0.win-amd64-py3.5.exe

Download URL gensim-2.1.0.win-amd64-py3.5.exe
Size 6.0 MB
Tags Source
SHA-256 checksum
How to use checksums
2d1952915c2123f201410614aacf0fb578b2cf46068267a4f2abbdcda810d38e
BLAKE2b-256 checksum
How to use checksums
514638ace6f57ab15c9f0655df654e9b046ce4e0c501b670089a462be6a798a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / gensim-2.1.0.win-amd64-py2.7.exe

Download URL gensim-2.1.0.win-amd64-py2.7.exe
Size 5.7 MB
Tags Source
SHA-256 checksum
How to use checksums
8b59f053ae778ee2311244e0e530e0a66d34b74fd65b4ea10ffe4b45f9cdb593
BLAKE2b-256 checksum
How to use checksums
5126eeff143beee10bbe9c77c4f2408367877b203ac2e32ac903ffe9f48be5ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / gensim-2.1.0.win32-py3.5.exe

Download URL gensim-2.1.0.win32-py3.5.exe
Size 5.9 MB
Tags Source
SHA-256 checksum
How to use checksums
41f6492b297865e55163ba61795cfb63eb512b3c043744137512d186fd48b281
BLAKE2b-256 checksum
How to use checksums
8c192376e40572dc81d2744c457271185f17492b0c736428235f26c81c358c0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / gensim-2.1.0.win32-py2.7.exe

Download URL gensim-2.1.0.win32-py2.7.exe
Size 5.6 MB
Tags Source
SHA-256 checksum
How to use checksums
cafdf59d0bf56a461995d9ce26f6be372370e5d927a3308d0f547be686523171
BLAKE2b-256 checksum
How to use checksums
ff0d4eb236c2dfc2a620fe0b1360d4185a98d1b184ca4f03322703838acd0d89
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / gensim-2.1.0-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl

Download URL gensim-2.1.0-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Size 5.6 MB
Tags CPython 3.6 CPython 3.6 pymalloc macOS 10.10+ Intel (x86-64, i386) macOS 10.10+ x86-64 macOS 10.6+ Intel (x86-64, i386) macOS 10.9+ Intel (x86-64, i386) macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
246b53cc7eccb09ba2711e852e3d5bd5eb007d433dbfa7c33493e45edcac5ac3
BLAKE2b-256 checksum
How to use checksums
28d1e10886df055ab1e83af00dca9b3d4ffbdff49f5c35820341101ec0e9ea08
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / gensim-2.1.0-cp35-cp35m-win_amd64.whl

Download URL gensim-2.1.0-cp35-cp35m-win_amd64.whl
Size 5.5 MB
Tags CPython 3.5 CPython 3.5 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
f84b48e474257ffca61bc6f56b5293b0ce58ca1b9491d0080a0af5216d1d174f
BLAKE2b-256 checksum
How to use checksums
17e9a0c8cc8c4a70a70171fd6e3f049376818570d65718bc262164e3617f5be0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / gensim-2.1.0-cp35-cp35m-win32.whl

Download URL gensim-2.1.0-cp35-cp35m-win32.whl
Size 5.4 MB
Tags CPython 3.5 CPython 3.5 pymalloc Windows x86-32
SHA-256 checksum
How to use checksums
b17b46ee2959d21818d6ae428462ce86a20c61b5f7c9bc623da99ae295c2e7c0
BLAKE2b-256 checksum
How to use checksums
3cb0be8ba6d22baf6983467b4e33f1e8a5234c766de39057839b33b5f1a1b891
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / gensim-2.1.0-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl

Download URL gensim-2.1.0-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Size 5.6 MB
Tags CPython 3.5 CPython 3.5 pymalloc macOS 10.10+ Intel (x86-64, i386) macOS 10.10+ x86-64 macOS 10.6+ Intel (x86-64, i386) macOS 10.9+ Intel (x86-64, i386) macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
f4ddfdbc3536c73b21c45bc3479f9891a89019adbe257b444a57c65576a56d9f
BLAKE2b-256 checksum
How to use checksums
bd747df5b741b02aa9e74fa2d9688b2faf783bc888b8b6962de453dce03ca6fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / gensim-2.1.0-cp27-cp27m-win_amd64.whl

Download URL gensim-2.1.0-cp27-cp27m-win_amd64.whl
Size 5.5 MB
Tags CPython 2.7 CPython 2.7 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
fdf5d9ab2fc08a26912a45a5cedb01a608afd6d792f57911fa6123fa3aea811c
BLAKE2b-256 checksum
How to use checksums
c349c29452a344caac83e4948eb43efd2f0308dc469a0cd531aa97058b416a4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / gensim-2.1.0-cp27-cp27m-win32.whl

Download URL gensim-2.1.0-cp27-cp27m-win32.whl
Size 5.4 MB
Tags CPython 2.7 CPython 2.7 pymalloc Windows x86-32
SHA-256 checksum
How to use checksums
5fb37cc7e92cb440bd42d8582faf512fa41967c111cbdf7928168f16239cb63d
BLAKE2b-256 checksum
How to use checksums
4b021a0a332fcdeb904d181c3a2d69ddef9909197febaa987ee155d8f811967f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / gensim-2.1.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl

Download URL gensim-2.1.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Size 5.6 MB
Tags CPython 2.7 CPython 2.7 pymalloc macOS 10.10+ Intel (x86-64, i386) macOS 10.10+ x86-64 macOS 10.6+ Intel (x86-64, i386) macOS 10.9+ Intel (x86-64, i386) macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
b6c0ee15ee17b5a3723695d04bce7934d0bc03692c939196f65195e86e811c4f
BLAKE2b-256 checksum
How to use checksums
8603d18e9581031daa0c033f3a30eb74bd48208fb64233120f7630b7637fa2cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

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

This release

2.1.0 This release

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