sentence2simvec
Vector-based sentence similarity (0.0 - 1.0) for Japanese & multilingual texts.
- 3-gram Jaccard surface similarity
- SBERT (MiniLM) semantic similarity
- Python API + CLI (
sentence2simvec) - Can output each sentence's embedding vector (numpy, 384-dim)
- Embedding vectors for each sentence can be obtained and saved as a NumPy array.
Install
# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
# 3.10, 3.11, 3.12, 3.13, ...
uv venv -p 3.10 .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
uv pip install -U sentence2simvec
or
uv pip install -e .
Usage
- CLI
sentence2simvec "Hello!" "Hello world!" --save-vecs ./vecs # Similarity: 0.7135 # • n-gram = 0.2727 # • cosine = 0.9024 # vecs/vec1.npy, vecs/vec2.npy written
- Python API
from sentence2simvec import similarity_score, sentence_vector # --- Similarity (with vectors) --------------------------- score, details, v1, v2 = similarity_score( "Hello!", "Hello world!", return_vectors=True ) print(score) # 0.87 print(details) # {'jaccard': 0.764…, 'cosine': 0.910…} print(v1.shape) # (384,) # --- Get a single sentence vector ------------------------ vec = sentence_vector("Hello") # ※ vec is L2 regularized (||vec||₂ = 1)
Development
uv venv -p 3.10 .venv && source .venv/bin/activate
uv pip install build twine pytest ipdb sentence-transformers numpy
# debug run
python sentence2simvec/core.py "Hello!" "Hello world!"
# tests
pytest
# build
python -m build
# upload PyPI
export TWINE_USERNAME="__token__"
export TWINE_PASSWORD="pypi-..."
twine upload dist/*
unset TWINE_USERNAME TWINE_PASSWORD
Metadata
Release files for sentence2simvec 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sentence2simvec-0.0.1.tar.gz | 8.9 kB | Without provenance | Details for sentence2simvec-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sentence2simvec-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for sentence2simvec-0.0.1-py3-none-any.whl |
Total release size: 18.9 kB
Release files / sentence2simvec-0.0.1.tar.gz
| Download URL | sentence2simvec-0.0.1.tar.gz |
|---|---|
| Size | 8.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
acb5b37f59b57ef3474b108f602bc348e2ba15f93817cfb78d87909bcc242ec7
|
|
BLAKE2b-256 checksum How to use checksums |
044ab095bf283e5a63738a5283769e1d08039031be0a83320accad3105a4fe8f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.10
|
Release files / sentence2simvec-0.0.1-py3-none-any.whl
| Download URL | sentence2simvec-0.0.1-py3-none-any.whl |
|---|---|
| Size | 9.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5ab06dd54e63b6b4ae098d2646238e1057eb7f074a01fb8495f73c2cbe2fd222
|
|
BLAKE2b-256 checksum How to use checksums |
dddef65d3e74199933fd45f5fb169392127b90fc35d5bdd1be1cadd8486d67b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.10
|
Security for sentence2simvec 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.