{"id":13696207,"url":"https://github.com/WZBSocialScienceCenter/tmtoolkit","last_synced_at":"2025-05-03T17:30:52.055Z","repository":{"id":42425225,"uuid":"109812180","full_name":"WZBSocialScienceCenter/tmtoolkit","owner":"WZBSocialScienceCenter","description":"Text Mining and Topic Modeling Toolkit for Python with parallel processing power","archived":true,"fork":false,"pushed_at":"2023-05-03T09:35:04.000Z","size":81937,"stargazers_count":190,"open_issues_count":0,"forks_count":27,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-02-22T16:21:52.328Z","etag":null,"topics":["evaluation","nlp","parallel-processing","python","socialscience","text-processing","topic-modeling"],"latest_commit_sha":null,"homepage":"https://tmtoolkit.readthedocs.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WZBSocialScienceCenter.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.md","dei":null}},"created_at":"2017-11-07T09:11:54.000Z","updated_at":"2025-02-09T18:10:55.000Z","dependencies_parsed_at":"2024-04-08T03:03:00.761Z","dependency_job_id":null,"html_url":"https://github.com/WZBSocialScienceCenter/tmtoolkit","commit_stats":{"total_commits":879,"total_committers":6,"mean_commits":146.5,"dds":"0.020477815699658675","last_synced_commit":"759e3066b2b15fa58207f939f96b95177297e22d"},"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WZBSocialScienceCenter%2Ftmtoolkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WZBSocialScienceCenter%2Ftmtoolkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WZBSocialScienceCenter%2Ftmtoolkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WZBSocialScienceCenter%2Ftmtoolkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WZBSocialScienceCenter","download_url":"https://codeload.github.com/WZBSocialScienceCenter/tmtoolkit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252226621,"owners_count":21714834,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["evaluation","nlp","parallel-processing","python","socialscience","text-processing","topic-modeling"],"created_at":"2024-08-02T18:00:37.306Z","updated_at":"2025-05-03T17:30:52.038Z","avatar_url":"https://github.com/WZBSocialScienceCenter.png","language":"Python","readme":"**This repository is archived. Further development of tmtoolkit has moved to https://github.com/internaut/tmtoolkit.**\n\n------------\n\n\ntmtoolkit: Text mining and topic modeling toolkit\n=================================================\n\n*tmtoolkit* is a set of tools for text mining and topic modeling with Python developed especially for the use in the\nsocial sciences, in journalism or related disciplines. It aims for easy installation, extensive documentation\nand a clear programming interface while offering good performance on large datasets by the means of vectorized\noperations (via NumPy) and parallel computation (using Python's *multiprocessing* module and the\n`loky \u003chttps://loky.readthedocs.io/\u003e`_ package). The basis of tmtoolkit's text mining capabilities are built around\n`SpaCy \u003chttps://spacy.io/\u003e`_, which offers a `many language models \u003chttps://spacy.io/models\u003e`_.\n\nThe documentation for tmtoolkit is available on `tmtoolkit.readthedocs.org \u003chttps://tmtoolkit.readthedocs.org\u003e`_ and\nthe GitHub code repository is on\n`github.com/WZBSocialScienceCenter/tmtoolkit \u003chttps://github.com/WZBSocialScienceCenter/tmtoolkit\u003e`_.\n\n**Upgrade note:**\n\nSince Feb 8 2022, the newest version 0.11.0 of tmtoolkit is available on PyPI. This version features a new API\nfor text processing and mining which is incompatible with prior versions. It's advisable to first read the\nfirst three chapters of the `tutorial \u003chttps://tmtoolkit.readthedocs.io/en/latest/getting_started.html\u003e`_\nto get used to the new API. You should also re-install tmtoolkit in a new virtual environment or completely\nremove the old version prior to upgrading. See the\n`installation instructions \u003chttps://tmtoolkit.readthedocs.io/en/latest/install.html\u003e`_.\n\nRequirements and installation\n-----------------------------\n\n**tmtoolkit works with Python 3.8 or newer (tested up to Python 3.10).**\n\nThe tmtoolkit package is highly modular and tries to install as few dependencies as possible. For requirements and\ninstallation procedures, please have a look at the\n`installation section in the documentation \u003chttps://tmtoolkit.readthedocs.io/en/latest/install.html\u003e`_. For short,\nthe recommended way of installing tmtoolkit is to create and activate a\n`Python Virtual Environment (\"venv\") \u003chttps://docs.python.org/3/tutorial/venv.html\u003e`_ and then install tmtoolkit with\na recommended set of dependencies and a list of language models via the following:\n\n.. code-block:: text\n\n    pip install -U \"tmtoolkit[recommended]\"\n    # add or remove language codes in the list for installing the models that you need;\n    # don't use spaces in the list of languages\n    python -m tmtoolkit setup en,de\n\nAgain, you should have a look at the detailed\n`installation instructions \u003chttps://tmtoolkit.readthedocs.io/en/latest/install.html\u003e`_ in order to install additional\npackages that enable more features such as topic modeling.\n\nFeatures\n--------\n\nText preprocessing\n^^^^^^^^^^^^^^^^^^\n\nThe tmtoolkit package offers several text preprocessing and text mining methods, including:\n\n- `tokenization, sentence segmentation, part-of-speech (POS) tagging, named-entity recognition (NER) \u003chttps://tmtoolkit.readthedocs.io/en/latest/text_corpora.html#Configuring-the-NLP-pipeline,-parallel-processing-and-more-via-Corpus-parameters\u003e`_ (via SpaCy)\n- `lemmatization and token normalization \u003chttps://tmtoolkit.readthedocs.io/en/latest/preprocessing.html#Lemmatization-and-token-normalization\u003e`_\n- extensive `pattern matching capabilities \u003chttps://tmtoolkit.readthedocs.io/en/latest/preprocessing.html#Common-parameters-for-pattern-matching-functions\u003e`_\n  (exact matching, regular expressions or \"glob\" patterns) to be used in many\n  methods of the package, e.g. for filtering on token or document level, or for\n  `keywords-in-context (KWIC) \u003chttps://tmtoolkit.readthedocs.io/en/latest/preprocessing.html#Keywords-in-context-(KWIC)-and-general-filtering-methods\u003e`_\n- adding and managing\n  `custom document and token attributes \u003chttps://tmtoolkit.readthedocs.io/en/latest/preprocessing.html#Working-with-document-and-token-attributes\u003e`_\n- accessing text corpora along with their\n  `document and token attributes as dataframes \u003chttps://tmtoolkit.readthedocs.io/en/latest/preprocessing.html#Accessing-tokens-and-token-attributes\u003e`_\n- calculating and `visualizing corpus summary statistics \u003chttps://tmtoolkit.readthedocs.io/en/latest/preprocessing.html#Visualizing-corpus-summary-statistics\u003e`_\n- finding out and joining `collocations \u003chttps://tmtoolkit.readthedocs.io/en/latest/preprocessing.html#Identifying-and-joining-token-collocations\u003e`_\n- `splitting and sampling corpora \u003chttps://tmtoolkit.readthedocs.io/en/latest/text_corpora.html#Corpus-functions-for-document-management\u003e`_\n- generating `n-grams \u003chttps://tmtoolkit.readthedocs.io/en/latest/preprocessing.html#Generating-n-grams\u003e`_\n- generating `sparse document-term matrices \u003chttps://tmtoolkit.readthedocs.io/en/latest/preprocessing.html#Generating-a-sparse-document-term-matrix-(DTM)\u003e`_\n\nWherever possible and useful, these methods can operate in parallel to speed up computations with large datasets.\n\nTopic modeling\n^^^^^^^^^^^^^^\n\n* `model computation in parallel \u003chttps://tmtoolkit.readthedocs.io/en/latest/topic_modeling.html#Computing-topic-models-in-parallel\u003e`_ for different copora\n  and/or parameter sets\n* support for `lda \u003chttp://pythonhosted.org/lda/\u003e`_,\n  `scikit-learn \u003chttp://scikit-learn.org/stable/modules/generated/sklearn.decomposition.LatentDirichletAllocation.html\u003e`_\n  and `gensim \u003chttps://radimrehurek.com/gensim/\u003e`_ topic modeling backends\n* `evaluation of topic models \u003chttps://tmtoolkit.readthedocs.io/en/latest/topic_modeling.html#Evaluation-of-topic-models\u003e`_ (e.g. in order to an optimal number\n  of topics for a given dataset) using several implemented metrics:\n\n   * model coherence (`Mimno et al. 2011 \u003chttps://dl.acm.org/citation.cfm?id=2145462\u003e`_) or with\n     `metrics implemented in Gensim \u003chttps://radimrehurek.com/gensim/models/coherencemodel.html\u003e`_)\n   * KL divergence method (`Arun et al. 2010 \u003chttp://doi.org/10.1007/978-3-642-13657-3_43\u003e`_)\n   * probability of held-out documents (`Wallach et al. 2009 \u003chttps://doi.org/10.1145/1553374.1553515\u003e`_)\n   * pair-wise cosine distance method (`Cao Juan et al. 2009 \u003chttp://doi.org/10.1016/j.neucom.2008.06.011\u003e`_)\n   * harmonic mean method (`Griffiths, Steyvers 2004 \u003chttp://doi.org/10.1073/pnas.0307752101\u003e`_)\n   * the loglikelihood or perplexity methods natively implemented in lda, sklearn or gensim\n\n* `plotting of evaluation results \u003chttps://tmtoolkit.readthedocs.io/en/latest/topic_modeling.html#Evaluation-of-topic-models\u003e`_\n* `common statistics for topic models \u003chttps://tmtoolkit.readthedocs.io/en/latest/topic_modeling.html#Common-statistics-and-tools-for-topic-models\u003e`_ such as\n  word saliency and distinctiveness (`Chuang et al. 2012 \u003chttps://dl.acm.org/citation.cfm?id=2254572\u003e`_), topic-word\n  relevance (`Sievert and Shirley 2014 \u003chttps://www.aclweb.org/anthology/W14-3110\u003e`_)\n* `finding / filtering topics with pattern matching \u003chttps://tmtoolkit.readthedocs.io/en/latest/topic_modeling.html#Filtering-topics\u003e`_\n* `export estimated document-topic and topic-word distributions to Excel\n  \u003chttps://tmtoolkit.readthedocs.io/en/latest/topic_modeling.html#Displaying-and-exporting-topic-modeling-results\u003e`_\n* `visualize topic-word distributions and document-topic distributions \u003chttps://tmtoolkit.readthedocs.io/en/latest/topic_modeling.html#Visualizing-topic-models\u003e`_\n  as word clouds or heatmaps\n* model coherence (`Mimno et al. 2011 \u003chttps://dl.acm.org/citation.cfm?id=2145462\u003e`_) for individual topics\n* integrate `PyLDAVis \u003chttps://pyldavis.readthedocs.io/en/latest/\u003e`_ to visualize results\n\nOther features\n^^^^^^^^^^^^^^\n\n- loading and cleaning of raw text from\n  `text files, tabular files (CSV or Excel), ZIP files or folders \u003chttps://tmtoolkit.readthedocs.io/en/latest/text_corpora.html#Loading-text-data\u003e`_\n- `splitting and joining documents \u003chttps://tmtoolkit.readthedocs.io/en/latest/text_corpora.html#Corpus-functions-for-document-management\u003e`_\n- `common statistics and transformations for document-term matrices \u003chttps://tmtoolkit.readthedocs.io/en/latest/bow.html\u003e`_ like word cooccurrence and *tf-idf*\n\nLimits\n------\n\n* all languages are supported, for which `SpaCy language models \u003chttps://spacy.io/models\u003e`_ are available\n* all data must reside in memory, i.e. no streaming of large data from the hard disk (which for example\n  `Gensim \u003chttps://radimrehurek.com/gensim/\u003e`_ supports)\n\n\nContribute\n----------\n\nIf you'd like to contribute, please read the `developer documentation \u003chttps://tmtoolkit.readthedocs.io/en/latest/development.html\u003e`_ first.\n\n\nLicense\n-------\n\nCode licensed under `Apache License 2.0 \u003chttps://www.apache.org/licenses/LICENSE-2.0\u003e`_.\nSee `LICENSE \u003chttps://github.com/WZBSocialScienceCenter/tmtoolkit/blob/master/LICENSE\u003e`_ file.\n\n.. |pypi| image:: https://badge.fury.io/py/tmtoolkit.svg\n    :target: https://badge.fury.io/py/tmtoolkit\n    :alt: PyPI Version\n\n.. |pypi_downloads| image:: https://img.shields.io/pypi/dm/tmtoolkit\n    :target: https://pypi.org/project/tmtoolkit/\n    :alt: Downloads from PyPI\n\n.. |runtests| image:: https://github.com/WZBSocialScienceCenter/tmtoolkit/actions/workflows/runtests.yml/badge.svg\n    :target: https://github.com/WZBSocialScienceCenter/tmtoolkit/actions/workflows/runtests.yml\n    :alt: GitHub Actions CI Build Status\n\n.. |coverage| image:: https://raw.githubusercontent.com/WZBSocialScienceCenter/tmtoolkit/master/coverage.svg?sanitize=true\n    :target: https://github.com/WZBSocialScienceCenter/tmtoolkit/tree/master/tests\n    :alt: Coverage status\n\n.. |rtd| image:: https://readthedocs.org/projects/tmtoolkit/badge/?version=latest\n    :target: https://tmtoolkit.readthedocs.io/en/latest/?badge=latest\n    :alt: Documentation Status\n\n.. |zenodo| image:: https://zenodo.org/badge/109812180.svg\n    :target: https://zenodo.org/badge/latestdoi/109812180\n    :alt: Citable Zenodo DOI\n","funding_links":[],"categories":["Libraries \u0026 Toolkits"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWZBSocialScienceCenter%2Ftmtoolkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FWZBSocialScienceCenter%2Ftmtoolkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWZBSocialScienceCenter%2Ftmtoolkit/lists"}