Giter Club home page Giter Club logo

newsclassifier's Introduction

NewsClassifier

Classify documents using Sougou corpus(http://www.sogou.com/labs/dl/c.html)

该工具主要对文档进行分类,给文章加上行业类别标签。目前支持一下几种行业:

  • 汽车
  • 财经
  • IT
  • 健康
  • 体育
  • 旅游
  • 教育
  • 招聘
  • 文化
  • 军事

使用方法

对外主要提供classify_text方法, 接受text参数,返回行业的类别。

from classifier import classify_text

if __name__ == '__main__':
    text = '''
    哈马斯火箭袭击引战端 以军出兵报复
    此轮巴以大规模冲突的导火索,早在数月前就已埋下。4月23日,阿巴斯领导的法塔赫与哈马斯达成和解。此后,巴以龃龉不断。从年初至3月中旬,哈马斯先后向以境内发射至少60枚火箭(注:参见附表),忍无可忍的以色列遂于6月11日空袭加沙北部,造成多名巴勒斯坦人伤亡,双方报复行动由此螺旋式升级。
    6月12日晚,3名犹太神学院学生在以南部希伯伦附近搭便车时失踪。6月14日,以总理内塔尼亚胡宣布失踪青少年“遭恐怖组织绑架”,当晚,以军战机向加沙多个目标发起空袭。次日晨,以军又大举出动,抓捕了包括哈马斯重要领导人哈桑•优素福在内的约150名巴勒斯坦人,地区局势骤然紧张,哈马斯则继续向以境内发射火箭,巴以新一轮冲突的大幕就此拉开。
    6月30日,以方发现了失踪青少年的遗体。从7月1日开始,以陆海空三军齐上阵,对加沙实施攻击。7月8日,以方发起“防务之刃”军事行动。7月17日晚,以军大批地面部队开进加沙,巴以冲突步入短兵相接的白热化阶段。
    哈马斯殴打加沙平民 强迫充当“人盾”
    以色列发动地面战之际,恰值MH17航班在乌克兰东部坠毁,后者无形中掩护了以军行动。虽然以军在空袭或进攻前会散发传单,或打电话、发短信通知巴平民提前撤离,但据外媒7月25日报道,哈马斯殴打、恐吓那些试图离开战区的居民,迫使他们回到住处充当“人体盾牌”,并将火箭发射器藏在人口稠密的居民区、医院、学校和清真寺里。“敌人希望我们向这些目标开火,并伤害无辜旁观者,从而让我们承受国际压力”,以军发言人德洛尔少校说。
    战火毕竟无情,截至8月2日,加沙已有超过1600名巴勒斯坦人丧生,9000多人受伤,其中70%是平民,以方则有63名士兵、3名平民死亡或失踪,超过160人受伤。虽然埃及已允许巴方伤员前往埃及医院救治,外部援助和医生也可经该国进入加沙,但加沙居民生活仍很艰难,部分城镇断水,每天停电20小时,超过46万人逃离家园,其中约半数暂避在联合国修建的61处庇护所内。
    '''
    print(classify_text(text))

output: 军事

newsclassifier's People

Contributors

keithyue 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.