Skip to main content

lawa

“法阿”中文分词:做最好的 Python 法律中文分词组件

“lawa” (Law-a) Chinese text segmentation: built to be the best Python Chinese word segmentation module.

完整文档见 README.md

GitHub: https://github.com/ShenDezhou/lawa

特点

  • 支持三种分词模式:

    • 精确模式,试图将句子最精确地切开,适合文本分析;

    • 全模式,把句子中所有的可以成词的词语都扫描出来, 速度非常快,但是不能解决歧义;

    • 搜索引擎模式,在精确模式的基础上,对长词再次切分,提高召回率,适合用于搜索引擎分词。

  • 支持繁体分词

  • 支持自定义词典

  • MIT 授权协议

在线演示: ShenDezhou

安装说明

代码对 Python 2/3 均兼容

  • 全自动安装: easy_install lawa 或者 pip install lawa / pip3 install lawa

  • 半自动安装:先下载 https://pypi.python.org/pypi/lawa/ ,解压后运行 python setup.py install

  • 手动安装:将 lawa 目录放置于当前目录或者 site-packages 目录

  • 通过 import lawa 来引用

词典介绍

  • law_doc.dic和law_term.dic是使用了法规、期刊以及案例标题统计的文档频和词频字典。

  • case_doc.dic和case_term.dic是案例全文统计的文档频和词频字典。

  • lawa_doc.dic和lawa_term.dic是融合和法规、案例和期刊全部特征统计的文档频和词频字典,默认使用`lawa_doc.dic`作为词典加载。

中文全角字符

  • 对于全角字符同样看作ASCII字符(英文字符)进行处理:
    • 例:“—6000元” 分成 -, -, -, 6000, 元

新增网络词典

  • 从中文维基和百度百科收集了一些互联网词语对法律语料进行了扩充,默认新词典改为`wiki_baike_law_doc.dic`。词典共7627641个词,其中法律词231316个,其余为网络词。

持久化

  • 用joblib替换marshal做持久化

Metadata

Release files for lawa 1.2.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lawa 1.2.6
File Size Uploaded Provenance Actions
lawa-1.2.6.tar.gz 64.2 MB Without provenance Details for lawa-1.2.6.tar.gz

Release files / lawa-1.2.6.tar.gz

Download URL lawa-1.2.6.tar.gz
Size 64.2 MB
Tags Source
SHA-256 checksum
How to use checksums
73f4e111dc6655eba9cf410fd3d24ff1c1e1b667d734952f42631402470e2bde
BLAKE2b-256 checksum
How to use checksums
70ac12bcb77ed84dbfb7b8742f4fdc20fcf64158d3f7dc2c9b17a03e9cd1a316
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.7

Security for lawa 1.2.6

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.

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