Skip to main content

Semantic String Similarity CLI

simil is a CLI interface to spacy's string similarity engine. It uses the en_vectors_web_lg dataset to compare strings for their English semantic similarity. Given two words, phrases, or sentences, simil will tell you how similar their meanings are.

Installation

First install simil itself:

$ pip3 install --user -U simil

Now install one of spacy's web_vector models:

$ python3 -m spacy download en_vectors_web_lg

You can choose between en_vectors_web_lg, en_core_web_lg, and en_core_web_md, (en_core_web_sm don't include word vectors at all, and can't be used with simil.) simil will use the largest model that you have installed, with preference for the vectors model over a core model.

I suggest using the large vectors model (en_vectors_web_lg), but you might want to use a smaller model in order to save on disk space or memory usage.

Usage:

$ sim first_file.txt second_file.txt # compare two files
$ sim -s "first string" "second string" # compare two strings

The output is a number between 0 and 1, representing how similar the two strings are.

Details:

simil uses Spacy's word vector models trained with GLoVe, such as en_vectors_web_lg.

This can be a large dataset, which makes for long startup times. So simil spins off a process in the background to hold the model, and works under a client-server model with it. This means that if you run simil a number of times in a row, only the first run is slow.

This background process does take up a fair bit of memory, typically around 2GB (for the en_vectors_web_lg model). After 10 minutes of inactivity it will automatically be killed, in order not to take up memory indefinitely. You can change the length of this timeout with the --timeout flag.

Release files for simil 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simil 0.0.2
File Size Uploaded
simil-0.0.2.tar.gz 4.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for simil 0.0.2
File Interpreter ABI Platform
simil-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 22.3 kB

Release files / simil-0.0.2.tar.gz

Download URL simil-0.0.2.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f001b1ed3332904252ca0a51b08238fa38e79f6722550cf13ff145813d4f53b6
BLAKE2b-256 checksum
How to use checksums
4a9eb058d2c36d06710884ef25242b556a6cd66012ecc3c7173856e9723ed3e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8

Release files / simil-0.0.2-py3-none-any.whl

Download URL simil-0.0.2-py3-none-any.whl
Size 17.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a669ec1ee83d7d582b701685d0d6cc905e215ddc519b6b21c770343e4b21638b
BLAKE2b-256 checksum
How to use checksums
def555385babcb872c97c4a42f4231d422a60c9d4f8d4fbad65e8248f0032d7a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.8

Release history Release notifications | RSS feed

This release

0.0.2 This release

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