SPAR: Semantic Projection with Active Retrieval
Project description
Overview
SPAR is a Python NLP package that enables interactive measurement of text. With SPAR, you can quantify short documents (e.g., social media posts) using latent, continuous scales such as creativity
, collaboration
, danger
, by measuring their semantic similarity with a set of example (seed) documents, for example: 'encourage new ways of thinking'
, 'working together to weather the storm'
, 'we are facing a deadly virus.'
Main features:
- conducts domain-adaptive and few-shots measurements, without requiring any model training or fine-tuning. It is combines the idea of semantic projection with active semantic search (Grand et al. 2022, Blinded Authors 2023), which allows users to find the most relevant, context-specific documents to define the scales.
- supports multiple state-of-the-arts text embedding methods, such as Sentence Transformers or OpenAI Text Embeddings API.
- comes with a user-friendly web interface that makes defining scales and conducting measurements intuitive and accessible.
If you find SPAR useful in your work, please cite the following paper:
- Blinded Authors (2023), A Computational Framework for Understanding Firm Communication During Disasters, Under Review at Information Systems Research.
Installation and Quick Start
Simply click the following button and run the code in the notebook to launch SPAR in Google Colab for quick testing:
You can also install SPAR on your own machine. It is recommended to use a virtual environment and upgrade pip first with pip install -U pip
. SPAR can be installed via pip:
pip install -U spar-measure
To launch SPAR on your own machine, use the following command in the terminal:
python -m spar_measure.gui
And open the interactive app in your browser at http://localhost:7860/
.
If a CUDA GPU is available, SPAR will use it to speed up embedding. If you choose not to use a GPU, you can set the CUDA_VISIBLE_DEVICES environment variable to an empty string:
CUDA_VISIBLE_DEVICES="" python -m spar_measure.gui
Additional Details
For additional details and information, please refer to the project's GitHub Repository.
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 spar_measure-0.1.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b5d981ca9db09287bd5be776c355a17840848df0f0872c6eb662930d8d6690f |
|
MD5 | bbcb33f1968fae3c8bba6f00b9d1bab5 |
|
BLAKE2b-256 | aadf3f9a61302a948f417541a785d1c4d4331f674dc2776d06eb7a2489b24f13 |