Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Install

theoryminer needs Python 3.10 or newer.

From PyPI

pip install theoryminer

The install includes UMAP (for clusterer(..., umap={...})) and tmsr-doi-downloader, an extra download source. On Python 3.10, pip leaves out tmsr-doi-downloader. The default download sources work on every version.

The newest code

To get the code on GitHub before the next release:

pip install "theoryminer @ git+https://github.com/rasoulnorouzi/theoryminer.git"

In a notebook

In Google Colab or Jupyter, put this line at the start of the first cell:

%pip install theoryminer

The tutorial notebook does this for you.

The models

The package downloads two models on first use. It keeps them in the Hugging Face cache, so later runs use the local copy.

ModelFirst used bySize
rasoultilburg/SocioCausaNetcausenet()about 430 MB
sentence-transformers/all-mpnet-base-v2the grouping and naming functionsabout 420 MB

Without a network, set the environment variable HF_HUB_OFFLINE=1. The models must already be in the cache.

The GPU

You do not need to set anything. causenet() uses device="auto": an NVIDIA GPU when PyTorch sees one, else the GPU of an Apple Silicon Mac, else the CPU.

SystemWhat to do
Google ColabChoose a GPU runtime: Runtime → Change runtime type → T4 GPU.
Linux with an NVIDIA GPUNothing. The PyTorch from pip supports the GPU.
Windows with an NVIDIA GPUInstall PyTorch from pytorch.org first, then theoryminer. The PyTorch from pip uses only the CPU on Windows.
Apple Silicon MacNothing. When the model fails on the Apple GPU, the run moves to the CPU.

The caches

WhatWhereChange it with
The text of each PDF page<pdf>.pages.json beside each PDFharvest(..., cache=False)
The thesaurus vectors~/.cache/theoryminer/taxonomythe environment variable THEORYMINER_CACHE_DIR
The modelsthe Hugging Face cachethe environment variable HF_HOME

When the package cannot write a cache folder, the functions still work. They compute the vectors again in the next session.