Coder Social home page Coder Social logo

smarteng / tf-idf-keyword Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gaussic/tf-idf-keyword

0.0 1.0 0.0 16.47 MB

Keyword extraction based on TF-IDF on specific corpus. 基于特定语料库的TF-IDF的中文关键词提取

License: MIT License

Python 100.00%

tf-idf-keyword's Introduction

基于TF-IDF的中文关键词提取

requirements

默认环境python3,需要结巴分词器的支持

$ pip install jieba

IDF(逆文档频率)生成

用法:

$ python gen_idf.py -i <inputdir> -o <outputfile>
  • -i <inputdir> : 语料库目录,程序会扫描目录下的所有文件
  • -o <outputfile> : 保存idf到指定文件

TF-IDF关键词提取

用法:

$ python tfidf.py -i <idffile> -d <document> -t <topK>
  • -i <idffile> : idf文件路径
  • -d <document> : 所需处理文档路径
  • -t <topK> : 返回topK结果

示例

$ python tfidf.py -i idf.txt -d test.txt -t 20

返回结果:

核
处理器
服务器
系统核心
封装
系列
插槽
核心
主频
产品
伊斯坦布尔
英特尔
功耗
多处理器
低仅
折合
浮点运算
性能
构建
吹起

注:该repo中提供的idf.txt由清华NLP组的新闻数据集训练获得。

tf-idf-keyword's People

Contributors

gaussic avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.