Text Mining and Topic Modeling Toolkit
Project description
tmtookit: Text mining and topic modeling toolkit
tmtoolkit is a set of tools for text mining and topic modeling with Python developed especially for the use in the social sciences. It aims for easy installation, extensive documentation and a clear programming interface while offering good performance on large datasets by the means of vectorized operations (via NumPy) and parallel computation (using Python’s multiprocessing module). It combines several known and well-tested packages such as SpaCy and SciPy.
At the moment, tmtoolkit focuses on methods around the Bag-of-words model, but word vectors (word embeddings) can also be generated.
The documentation for tmtoolkit is available on tmtoolkit.readthedocs.org and the GitHub code repository is on github.com/WZBSocialScienceCenter/tmtoolkit.
Features
Text preprocessing
tmtoolkit implements or provides convenient wrappers for several preprocessing methods, including:
tokenization and part-of-speech (POS) tagging (via SpaCy)
extensive pattern matching capabilities (exact matching, regular expressions or “glob” patterns) to be used in many methods of the package, e.g. for filtering on token, document or document label level, or for keywords-in-context (KWIC)
adding and managing custom token metadata
accessing word vectors (word embeddings)
generating n-grams
generating sparse document-term matrices
expanding compound words and “gluing” of specified subsequent tokens, e.g. ["White", "House"] becomes ["White_House"]
All text preprocessing methods can operate in parallel to speed up computations with large datasets.
Topic modeling
model computation in parallel for different copora and/or parameter sets
support for lda, scikit-learn and gensim topic modeling backends
evaluation of topic models (e.g. in order to an optimal number of topics for a given dataset) using several implemented metrics:
model coherence (Mimno et al. 2011) or with metrics implemented in Gensim)
KL divergence method (Arun et al. 2010)
probability of held-out documents (Wallach et al. 2009)
pair-wise cosine distance method (Cao Juan et al. 2009)
harmonic mean method (Griffiths, Steyvers 2004)
the loglikelihood or perplexity methods natively implemented in lda, sklearn or gensim
common statistics for topic models such as word saliency and distinctiveness (Chuang et al. 2012), topic-word relevance (Sievert and Shirley 2014)
export estimated document-topic and topic-word distributions to Excel
visualize topic-word distributions and document-topic distributions as word clouds or heatmaps
model coherence (Mimno et al. 2011) for individual topics
integrate PyLDAVis to visualize results
Other features
Limits
all languages are supported, for which SpaCy language models are available
all data must reside in memory, i.e. no streaming of large data from the hard disk (which for example Gensim supports)
Requirements and installation
For requirements and installation procedures, please have a look at the installation section in the documentation.
License
Code licensed under Apache License 2.0. See LICENSE file.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for tmtoolkit-0.10.0rc1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48f40902b776fd1a740b507ecd55ab182bf1cd54c279b6e0f6422af1142b4451 |
|
MD5 | 228c95b12f1bd050e111319b4dae7521 |
|
BLAKE2b-256 | fc747ac47b42e4b5eca4a9c0dcd1c333ab0f5b07ccc1b438106a4085329161a2 |