AuroraNLP
专业级中文自然语言处理工具包
简介
AuroraNLP 是一个专业级的中文自然语言处理工具包,提供从分词、词性标注、命名实体识别、句法分析到企业级支持的全栈功能。
特性
🚀 核心功能
- 分词: 支持 HMM/CRF/感知机/词格/混合多种策略
- 词性标注: 基于统计模型和深度学习的词性标注
- 命名实体识别: 支持 PER/LOC/ORG 等实体类型,嵌套实体识别
- 句法分析: 依存分析(ArcEager算法)和成分分析(CFG)
- 关键词提取: TF-IDF/TextRank 算法
- 文本相似度: 余弦/Jaccard/编辑距离
- 新词发现: 互信息 + 左右熵
📚 丰富的词典资源
- 百万级通用中文词典
- 医疗/法律/电商/新闻等领域词库
- 人名词库、地名词库、机构名词库
- 搜狗细胞词库集成
- 开放词林(同义词/近义词)
🔬 深度学习支持
- BiLSTM-CRF 模型
- BERT 预训练模型集成
- 轻量级模型(ALBERT/DistilBERT)
- 模型微调、迁移学习、知识蒸馏
- 模型量化、ONNX 导出、热加载
🏗️ 企业级架构
- 类 spaCy 的 Pipeline 系统
- Doc/Span/Token 统一数据结构
- REST API / gRPC 接口
- 异步处理和流式处理
- 插件系统支持
⚡ 性能优化
- 对象池/内存池
- 批量处理
- 混合精度推理
- 内存映射文件
- 词典压缩
- 缓存机制
🏢 企业级功能
- 结构化日志系统
- 健康检查
- Prometheus 指标
- Docker & Kubernetes 支持
- 限流熔断
- 认证授权
- 配置管理
- 灰度发布
- 灾备方案
📦 轻量设计
- 纯 Python 实现,无强制外部依赖
- 零配置开箱即用
- Python 3.8+ 支持
安装
基本安装
pip install aurora-nlp
完整安装(包含深度学习支持)
pip install aurora-nlp[full]
开发安装
git clone https://github.com/AuroraNLP/AuroraNLP.git
cd AuroraNLP
pip install -e .[dev]
快速开始
基础分词
from AuroraNLP import Segmentor
# 初始化分词器
seg = Segmentor(use_hybrid=True)
# 分词
text = "人工智能正在改变世界"
words = seg.segment(text)
print(words) # ['人工智能', '正在', '改变', '世界']
# 词性标注
words_with_pos = seg.segment_with_pos(text)
print(words_with_pos)
# [('人工智能', 'n'), ('正在', 'd'), ('改变', 'v'), ('世界', 'n')]
命名实体识别
from AuroraNLP import NERRecognizer
ner = NERRecognizer(use_bert=True)
text = "张三在阿里巴巴位于杭州的总部工作"
entities = ner.recognize(text)
print(entities)
# [
# Entity(text='张三', type='PERSON', start=0, end=2),
# Entity(text='阿里巴巴', type='ORGANIZATION', start=3, end=7),
# Entity(text='杭州', type='LOCATION', start=9, end=11)
# ]
Pipeline 系统
from AuroraNLP import Pipeline, Segmentor, POSTagger, NERRecognizer
# 创建 Pipeline
nlp = Pipeline()
nlp.add_component(Segmentor())
nlp.add_component(POSTagger())
nlp.add_component(NERRecognizer())
# 处理文本
doc = nlp("中国北京是一座美丽的城市")
# 获取分词结果
print(doc.tokens)
# 获取词性标注
print([(token.text, token.pos) for token in doc.tokens])
# 获取命名实体
print(doc.ents)
使用领域词典
from AuroraNLP import Segmentor, DomainDictionaryManager
# 加载医疗领域词典
dict_manager = DomainDictionaryManager()
dict_manager.load_domain("medical")
seg = Segmentor(dictionary=dict_manager.combined_dictionary)
text = "患者出现发热咳嗽症状,医生建议做CT检查"
words = seg.segment(text)
print(words)
文档
示例
查看 examples/ 目录获取更多示例:
性能
| 功能 | 准确率 | 速度 |
|---|---|---|
| 分词 | ~93% | 50万字/秒 |
| 词性标注 | ~92% | 40万字/秒 |
| NER | ~88% | 30万字/秒 |
贡献指南
欢迎贡献!请查看 CONTRIBUTING.md 了解详情。
许可证
本项目采用 Apache 2.0 许可证 - 详见 LICENSE 文件。
致谢
- 参考项目:HanLP、spaCy、jieba、pkuseg、THULAC
- 数据资源:人民日报语料库、搜狗细胞词库、开放词林
联系方式
- GitHub: AuroraNLP/AuroraNLP
- Issues: GitHub Issues
- 讨论: GitHub Discussions
路线图
查看 ROADMAP.md 了解我们的发展计划。
项目统计
已完成 90/100 步(90%)
Metadata
Release files for auroranlp-core 1.0.0
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 |
|---|---|---|---|---|
| auroranlp_core-1.0.0.tar.gz | 260.3 kB | Without provenance | Details for auroranlp_core-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| auroranlp_core-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for auroranlp_core-1.0.0-py3-none-any.whl |
Total release size: 542.8 kB
Release files / auroranlp_core-1.0.0.tar.gz
| Download URL | auroranlp_core-1.0.0.tar.gz |
|---|---|
| Size | 260.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ac657ae1d1483037997c793b18f43a54a2e6dcbab974490f6b770f5f4249719b
|
|
BLAKE2b-256 checksum How to use checksums |
71c9f92620698dededa5ebcdb73903812a6530492d179e261780ae67344aef12
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.6
|
Release files / auroranlp_core-1.0.0-py3-none-any.whl
| Download URL | auroranlp_core-1.0.0-py3-none-any.whl |
|---|---|
| Size | 282.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
687ed2f3d8c00220394f1239c270ca4845134ec8508a920d8f77de98b8c4cc61
|
|
BLAKE2b-256 checksum How to use checksums |
6760bb6d1ca48d0180f9ba5ebe53fc29b332dc7d71a7ac47b34fa31375db0015
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.6
|
Security for auroranlp-core 1.0.0
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.