【Github】TextCluster:短文本聚类预处理模块 Short text cluster

2019 年 12 月 1 日 AINLP

推荐Github上一个NLP相关的项目:RandyPen/TextCluster

项目地址,阅读原文可以直达,欢迎参与和Star:
https://github.com/RandyPen/TextCluster

这个项目的作者是AINLP交流群里的昭鸣同学,该项目开源了一个短文本聚类工具,内存友好,速度不错,还不用尝试隐变量个数,欢迎使用。



以下来自该项目介绍页,点击阅读原文可以直达相关资源链接。





短文本聚类

项目介绍

短文本聚类是常用的文本预处理步骤,可以用于洞察文本常见模式、分析设计语义解析规范等。本项目实现了内存友好的短文本聚类方法。

依赖库

pip install tqdm jieba

使用方法

python cluster.py --infile ./data/infile \
--output ./data/output

具体参数设置可以参考cluster.py文件内_get_parser()函数参数说明,包含设置分词词典、停用词、匹配采样数、匹配度阈值等。

文件路径

TextCluster
| README.md
| LICENSE
| cluster.py 主要执行程序
|
|------utils 公共功能模块
| | __init__.py
| | segmentor.py 分词器封装
| | similar.py 相似度计算函数
| | utils.py 文件处理模块
|
|------data
| | infile 默认输入文本路径,用于测试中文模式
| | infile_en 默认输入文本路径,用于测试英文模式
| | seg_dict 默认分词词典
| | stop_words 默认停用词路径

注:本方法仅面向短文本,长文本聚类可根据需求选用SimHashLDA等其他算法。

Text Cluster

Introduction

Text cluster is a normal preprocess method to analysis text feature. This project implements a memory friendly method for short text cluster. For long text, it will be preferable to choose SimHash or LDA or others according to demand.

Requirements

pip install tqdm spacy

Usage

python cluster.py --infile ./data/infile_en \
--output ./data/output \
--lang en

File Structure

TextCluster
| README.md
| LICENSE
| cluster.py main excutable function
|
|------utils utilities
| | __init__.py
| | segmentor.py tokenizer wrapper
| | similar.py similarity calculator
| | utils.py file process module
|
|------data
| | infile default input file path, to test Chinese mode
| | infile_en default input file path, to test English mode
| | seg_dict default tokenizer dict path
| | stop_words default stop words path

Other Language

For other specific language, modify tokenizer wrapper in ./utils/segmentor.py.




推荐阅读


BERT 的演进和应用


BERT系列文章汇总导读


BERT 瘦身之路:Distillation,Quantization,Pruning


BERT论文笔记


关于AINLP


AINLP 是一个有趣有AI的自然语言处理社区,专注于 AI、NLP、机器学习、深度学习、推荐算法等相关技术的分享,主题包括文本摘要、智能问答、聊天机器人、机器翻译、自动生成、知识图谱、预训练模型、推荐系统、计算广告、招聘信息、求职经验分享等,欢迎关注!加技术交流群请添加AINLP君微信(id:AINLP2),备注工作/研究方向+加群目的。


登录查看更多
5

相关内容

文本聚类(Text Clustering)任务则是根据文档之间的内容或主题相似度,将文档集合划分成若干个子集,每个子集内部的文档相似度较高,而子集之间的相似度较低。
Linux导论,Introduction to Linux,96页ppt
专知会员服务
75+阅读 · 2020年7月26日
Python图像处理,366页pdf,Image Operators Image Processing in Python
Transformer文本分类代码
专知会员服务
116+阅读 · 2020年2月3日
【强化学习资源集合】Awesome Reinforcement Learning
专知会员服务
93+阅读 · 2019年12月23日
机器学习入门的经验与建议
专知会员服务
90+阅读 · 2019年10月10日
计算机视觉最佳实践、代码示例和相关文档
专知会员服务
17+阅读 · 2019年10月9日
基于PyTorch/TorchText的自然语言处理库
专知
27+阅读 · 2019年4月22日
Github项目推荐 | gensim - Python中的主题建模
AI研习社
15+阅读 · 2019年3月16日
【干货】--基于Python的文本情感分类
R语言中文社区
5+阅读 · 2018年1月5日
深度文本匹配开源工具(MatchZoo)
机器学习研究会
10+阅读 · 2017年12月5日
NLP自然语言处理(一)——jieba分词(R vs. python)
乐享数据DataScientists
6+阅读 · 2017年1月15日
Arxiv
5+阅读 · 2019年10月11日
Clustered Object Detection in Aerial Images
Arxiv
5+阅读 · 2019年8月27日
An Analysis of Object Embeddings for Image Retrieval
Arxiv
4+阅读 · 2019年5月28日
Arxiv
5+阅读 · 2018年3月6日
Arxiv
8+阅读 · 2018年1月19日
Arxiv
5+阅读 · 2017年7月23日
VIP会员
相关VIP内容
Linux导论,Introduction to Linux,96页ppt
专知会员服务
75+阅读 · 2020年7月26日
Python图像处理,366页pdf,Image Operators Image Processing in Python
Transformer文本分类代码
专知会员服务
116+阅读 · 2020年2月3日
【强化学习资源集合】Awesome Reinforcement Learning
专知会员服务
93+阅读 · 2019年12月23日
机器学习入门的经验与建议
专知会员服务
90+阅读 · 2019年10月10日
计算机视觉最佳实践、代码示例和相关文档
专知会员服务
17+阅读 · 2019年10月9日
相关资讯
基于PyTorch/TorchText的自然语言处理库
专知
27+阅读 · 2019年4月22日
Github项目推荐 | gensim - Python中的主题建模
AI研习社
15+阅读 · 2019年3月16日
【干货】--基于Python的文本情感分类
R语言中文社区
5+阅读 · 2018年1月5日
深度文本匹配开源工具(MatchZoo)
机器学习研究会
10+阅读 · 2017年12月5日
NLP自然语言处理(一)——jieba分词(R vs. python)
乐享数据DataScientists
6+阅读 · 2017年1月15日
相关论文
Top
微信扫码咨询专知VIP会员