Skip to main content

pyUnit-NewWord

无监督训练文本词库

安装

pip install pyunit-newword

注意事项

该算法采用Hash字典存储,大量消耗内存。100M的纯中文文本需要12G以上的内存,不然耗时太严重。

更新说明

新增加自动识别新词模型,无需手动设置参数

训练代码非模型(文本是UTF-8格式)

from pyunit_newword import NewWords

if __name__ == '__main__':
    nw = NewWords(filter_cond=10, filter_free=2)
    nw.add_text(r'C:\Users\Administrator\Desktop\微博数据.txt')
    nw.analysis_data()
    with open('分析结果.txt', 'w', encoding='utf-8')as f:
        for word in nw.get_words():
            print(word)
            f.write(word[0] + '\n')

无监督训练新词模型

from pyunit_newword import NewWords

if __name__ == '__main__':
    nw = NewWords(accuracy=0.01)
    nw.add_text(r'C:\Users\Administrator\Desktop\微博数据.txt')
    nw.analysis_data()
    with open('分析结果.txt', 'w', encoding='utf-8')as f:
        for word in nw.get_words():
            print(word)
            f.write(word[0] + '\n')

微博数据下载

点击下载微博数据

爬虫的微博数据一部分截图(大概100M纯文本)

微博数据

训练微博数据后的结果

5个词语

训练后得到的词语视频

词语视频

算法实现来源

基于改进互信息和邻接熵的微博新词发现方法


Metadata

Release files for pyunit-newword 2020.2.12

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

Built distribution (wheel)

Table of built distributions (wheels) for pyunit-newword 2020.2.12
File Interpreter ABI Platform Actions
pyunit_newword-2020.2.12-py3-none-any.whl Python 3 none any Details for pyunit_newword-2020.2.12-py3-none-any.whl

Release files / pyunit_newword-2020.2.12-py3-none-any.whl

Download URL pyunit_newword-2020.2.12-py3-none-any.whl
Size 26.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1971c5d9a704960a97e6086122ca67addfb8b28cd0d79636f6fbf745729a44c1
BLAKE2b-256 checksum
How to use checksums
69145fb694951f95c006e616184d467c219db4887a14c6eca7d30b0fafebdfed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.4

Security for pyunit-newword 2020.2.12

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

2020.2.12 This release

1 release file 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