Skip to main content

zysl

English | 中文

文本相似度:字符 shingle 的 Jaccard 与归一化编辑距离。

安装

pip install zysl

用法

from zysl import jaccard, levenshtein, similarity

jaccard("hello", "hallo")             # 0.3333...
levenshtein("kitten", "sitting")      # 3
similarity("kitten", "sitting")      # 0.5714...

说明

jaccard 按 n-gram 集合求交并比,对词序敏感度低;levenshtein 用两行滚动数组,长文本也只占 O(n) 内存;similarity 把编辑距离归一化到 0~1,两条都空视为完全相似。

许可证

MIT


English

Text similarity: Jaccard over character shingles plus normalized edit distance.

Install

pip install zysl

Usage

from zysl import jaccard, levenshtein, similarity

jaccard("hello", "hallo")             # 0.3333...
levenshtein("kitten", "sitting")      # 3
similarity("kitten", "sitting")      # 0.5714...

Notes

jaccard compares n-gram sets, so it tolerates reordering; levenshtein keeps two rolling rows, so memory stays O(n) on long input; similarity normalizes the distance to 0..1 and treats two empty strings as identical.

License

MIT

Metadata

Release files for zysl 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 zysl 0.0.2
File Size Uploaded Provenance
zysl-0.0.2.tar.gz 3.3 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 6.9 kB

Release files / zysl-0.0.2.tar.gz

Download URL zysl-0.0.2.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
aeefe932dd5145dad67e4e9075c9bae6996f2aff8f14f0243ad1e164df37bfe6
BLAKE2b-256 checksum
How to use checksums
cd5bc7f655dcbff0de0c6a21690c57c3d3f860afaafb2026f8d65c565e9129db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.11

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

Download URL zysl-0.0.2-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5f58f28dfd50322cc75ca673a3b324920c483b01c0d45ecafc29305a30ca0a30
BLAKE2b-256 checksum
How to use checksums
72548881daa77341a8487dd288a0a56110f985454a578722d94ae13ccbd22100
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.11

Security for zysl 0.0.2

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.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

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