一个为Python设计的极简、优雅的自然语言处理(NLP)工具包。
Project description
ZenLP - NLP工具包
大道至简,返璞归真。
ZenLP 是一个为Python设计的极简、优雅的自然语言处理(NLP)工具包。
在大语言模型(LLM)席卷业界的今天,我们常常被其复杂的结构和高昂的资源需求所困扰。
ZenLP 回归初心,专注于那些历久弥新、效果稳健且具有高度可解释性的经典NLP算法。
我们相信,优雅的工程实现能让这些经典算法在现代NLP工作流中焕发新的光彩。
本项目旨在为每个算法提供:
- 清晰、完备的文档和注释。
- 符合直觉、易于使用的API。
- 生产就绪的性能和稳定性。
欢迎来到ZenNLP的世界,在这里,我们用最少的代码,解决最核心的问题。
✨ 特性
- 极简设计: 摒弃繁杂的依赖和配置,每个模块都力求小而美,专注做好一件事。
- 无监督与自适应: 核心算法多为无监督实现,能自动从原始文本中学习,轻松适应不同领域。
- 生产就绪: 所有代码均经过严格测试,并提供类型提示,确保在生产环境中的稳定性和可维护性。
- 教育友好: 不仅是工具,更是学习经典NLP算法的优秀参考资料。每一行代码、每一篇文档都在传递算法的精髓。
🚀 快速开始
1. 安装
通过 pip 可以轻松安装 ZenLP:
pip install zenlp
2. 使用示例:发现新词
只需几行代码,即可从您的语料中发现新词。
from zenlp import discover
from pprint import pprint
corpus = [
"大语言模型正在引领新一轮的技术革命。",
"生成式AI的快速发展对内容创作产生了深远影响。",
"遥遥领先的技术优势使得这家公司备受瞩目。",
"赛博朋克风格的艺术作品充满了对未来的想象。",
"这家公司的遥遥领先,得益于其强大的自研芯片。",
"许多人对生成式AI的未来既期待又担忧。",
"赛博朋克不仅仅是一种美学,更是一种文化现象。",
]
# 调用 discover 函数
# min_freq: 词语出现的最小频率
# min_pmi: 最小凝聚度 (内部关联性)
# min_entropy: 最小自由度 (外部多样性)
new_words = discover(
corpus_source=corpus,
min_freq=2,
min_pmi=1.0,
min_entropy=0.5
)
pprint(new_words)
📖 功能模块
ZenLP 将会逐步涵盖NLP中的多个核心领域,每个模块都遵循“禅”的设计哲学。
- ✅
zenlp.discovery- 新词发现- 功能: 基于
PMI + 左右熵的无监督新词发现。 - 状态: 已完成。
- 功能: 基于
🤝 贡献 (Contributing)
我们热烈欢迎任何形式的贡献!无论您是想修复一个Bug、增加一个新功能,还是改进文档,都请不要犹豫。
请在提交前确保您的代码通过了测试,并遵循了项目的编码风格。
📜 许可证 (License)
本项目采用 MIT License 授权。
Made with ❤️ and Zenlp.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zenlp-0.1.0.tar.gz.
File metadata
- Download URL: zenlp-0.1.0.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0a1a3f1331403b219d41b94c69fb9e7f7ae603ec4cf41d8f33eeb1ee4e52f0a
|
|
| MD5 |
d6e3eaa837f9dc1ec50e236ffcdcfd26
|
|
| BLAKE2b-256 |
7e5e1a9e58557990859f2463fa190b9f6bed97f4e1c753895484596325d0ae26
|
Provenance
The following attestation bundles were made for zenlp-0.1.0.tar.gz:
Publisher:
ci-cd.yml on Hellohistory/Zenlp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zenlp-0.1.0.tar.gz -
Subject digest:
e0a1a3f1331403b219d41b94c69fb9e7f7ae603ec4cf41d8f33eeb1ee4e52f0a - Sigstore transparency entry: 293515682
- Sigstore integration time:
-
Permalink:
Hellohistory/Zenlp@8d56dc13e6c0e7e763bcd9326575f90ce8800b26 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Hellohistory
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci-cd.yml@8d56dc13e6c0e7e763bcd9326575f90ce8800b26 -
Trigger Event:
release
-
Statement type:
File details
Details for the file zenlp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: zenlp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0ae106afb64cafc40296095dd44ecd5590fab1ca2fce8198d54c84a2e465f66
|
|
| MD5 |
be0f3ea72bd29d4e18848658a132209a
|
|
| BLAKE2b-256 |
33a19cefe8e562446a3c8d4e16d358d073fe81f9d08dc8590705e029e1148557
|
Provenance
The following attestation bundles were made for zenlp-0.1.0-py3-none-any.whl:
Publisher:
ci-cd.yml on Hellohistory/Zenlp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zenlp-0.1.0-py3-none-any.whl -
Subject digest:
b0ae106afb64cafc40296095dd44ecd5590fab1ca2fce8198d54c84a2e465f66 - Sigstore transparency entry: 293515697
- Sigstore integration time:
-
Permalink:
Hellohistory/Zenlp@8d56dc13e6c0e7e763bcd9326575f90ce8800b26 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Hellohistory
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci-cd.yml@8d56dc13e6c0e7e763bcd9326575f90ce8800b26 -
Trigger Event:
release
-
Statement type: