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.3

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.3
File Size Uploaded Provenance
zysl-0.0.3.tar.gz 3.3 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 6.9 kB

Release files / zysl-0.0.3.tar.gz

Download URL zysl-0.0.3.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f5049a464c2514ce7ff2b3fa5e1a5ea454491c47da279069ecdf1aea1035a097
BLAKE2b-256 checksum
How to use checksums
3641a06a73a85c32a1546df35185b94f896add472e85bcc5911a1f7fbb851486
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.3-py3-none-any.whl

Download URL zysl-0.0.3-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
84e17d0c2880ddd4b8c78702e67ad69eb066e460940fdaa69f44b5366099a541
BLAKE2b-256 checksum
How to use checksums
2f51572d28dca2c3a928658dea5fcc149add905632f9da1ab313add57e37eb18
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.3

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.

Release history Release notifications | RSS feed

This release

0.0.3 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