又一个短文本(基于liblinear的工具包)

yast的Python项目详细描述


#yast:又一个短文本分类工具包

[![构建状态](https://travis-ci.org/ailurus1991/yast.svg?branch=master)(https://travis ci.org/ailurus1991/yast)
[![文档状态](https://readthedocs.org/projects/yast-doc/badge/?版本=最新](http://yast-doc.readthedocs.io/en/latest/?徽章=最新)
[![PYPI版本](https://badge.fury.io/py/yast.svg)(https://badge.fury.io/py/yast)
[![覆盖状态](https://coveralls.io/repos/github/ailurus1991/yast/badge.svg?branch=master)(https://coveralls.io/github/ailurus1991/yast?branch=master)

yast,liblinear(http://www.csie.ntu.edu.tw/~cjlin/liblinear/)[jieba(https://github.com/fxsjy/jieba)和[jieba(http://www.csie.csie.ntu.entu.edu.tw/~cjlin/liblinear/)

《入门入门

!/usr/bin/env python的编码:utf-8



yast importyast

sample=yast('sample')


sample.train.train.train.train.train.train.train.train.train.train.train.track.train.track.stock.stock.stock.stock.stock.stock.stock.stock.stock.stock.stock.stock.train.train.train.train.train.train.train.train.train.stock.stock.stock.stock.stock.stock.stock.“,
('f1','2016丝绸之路拉力赛收官 标致道达尔汽车组夺冠'),
('f1','保时捷超级杯霍根海姆站 中国车手张大胜再出击'),
('basketball','林书豪透露生涯两低谷:效力湖人勇士令人失望'),
('basketball','后场双星合砍27分10助 开拓者全队发挥战胜爵士')])

print sample_2.predict_single('队内对抗曝光湖人新阵容 阿联或任内线主力替补').predicted_y
# basketball
print sample_2.predict_single('再出悲剧! 达喀尔拉力赛后勤车肇事致1死10伤').predicted_y
# f1

# customize 配置
configs={
“网格”:0,0,0,3,# 特征表达。0 为 Binary feature,1 为 word count,2 为词频,3 为TF-IDF。
'classifier': 0 # 分类器选择。0 为 Crammer and Singer SVM multiclass,1 为 L1 损失分类 one-vs-rest,2 为 L2损失分类 one-vs-rest,3 为逻辑回归 one-vs-rest。
}

another_sample = Yast('another_sample', configs)
# 人们对另一个样本序列('./train-file.txt')
另一个样本序列:标签文本,标签文本,标签文本,标签文本,标签文本,标签文本,标签文本,标签文本,标签文本。_sample.test('./test_file.txt')

another_sample.analyze('都说苹果的创新力越来越差了,根据您的了解,苹果有哪些外行看不到内行却深感振奋的黑科技?')
# 打印 query 的每个向量的权重,用作分析
```

## Features

- [x] 支持多种分类器
- [x] 支持多种特征表达
- [x] 支[公式](http://latex.codecogs.com/gif.latex?\伽玛)伽玛![公式](http://latex.codecogs.com/gif.latex?c)
-[x]自动获取标签

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java无法使用JAXB配置Moxy   java如何让我的简单Swing telnet客户端正确显示字符?   java中从可运行线程调用主线程的多线程处理   java数据源。EBJ3会话bean中的getConnection()   使用java和正则表达式从xml文件提取值时出现问题   java定制Jersy胡须Mvc   在Java中,“限制并发”是什么意思?   java有没有更干净的方法可以在这里使用Optional,而不在三个地方返回“NA”?   java Tomcat启动,然后崩溃,除非我打电话   java理解客户机和服务器   java时间戳将在视图对象>实体转换期间丢失   如何在java中返回布尔值(基元)?   java使用spring mvc设置日志记录,希望仅对我的代码进行跟踪/调试   用Jackson解析嵌套对象