又一个短文本(基于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]自动获取标签
[![构建状态](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]自动获取标签