用于indico的python包装器。使用预先构建的最先进的机器学习算法和一行代码。
IndicoIo的Python项目详细描述
indico API的包装。
Indico API是免费使用的,不需要任何培训数据。
安装
来自PYPI:
pip install indicoio
来源:
git clone https://github.com/IndicoDataSolutions/IndicoIo-python.git python setup.py install
API键+设置
对于api密钥注册和设置,请签出我们的quickstart guide。
完整文档
详细的文档和进一步的代码示例可在 indico.io/docs。
支持的API:
- 积极/消极情绪分析
- 政治情绪分析
- 图像特征提取
- 面部情绪识别
- 面部特征提取
- 语言检测
- 文本主题标记
示例
>>>fromindicoioimportpolitical,sentiment,language,text_tags,keywords,fer,facial_features,image_features>>>indicoio.config.api_key="YOUR_API_KEY">>>political("Guns don't kill people. People kill people."){u'Libertarian':0.47740164630834825,u'Green':0.08454409540443657,u'Liberal':0.16617097211030055,u'Conservative':0.2718832861769146}>>>sentiment('Worst movie ever.')0.07062467665597527>>>sentiment('Really enjoyed the movie.')0.8105182526856075>>>text_tags("Facebook blog posts about Android tech make better journalism than most news outlets.")>>>text_tags(test_text,threshold=0.1)# return only keys with value > 0.1{u'startups_and_entrepreneurship':0.21888586688354486}>>>text_tags(test_text,top_n=1)# return only keys with top_n values{u'startups_and_entrepreneurship':0.21888586688354486}>>>importnumpyasnp>>>test_face=np.linspace(0,50,48*48).reshape(48,48)>>>fer(test_face){u'Angry':0.08843749137458341,u'Sad':0.39091163159204684,u'Neutral':0.1947947999669361,u'Surprise':0.03443785859010413,u'Fear':0.17574534848440568,u'Happy':0.11567286999192382}>>>facial_features(test_face)[0.0,-0.02568680526917187,0.21645604230056517,...,3.0342637531932777]>>>language('Quis custodiet ipsos custodes'){u'Swedish':0.00033330636691921914,u'Lithuanian':0.007328693814717631,u'Vietnamese':0.0002686116137658802,u'Romanian':8.133913804076592e-06,...}>>>keywords("Facebook blog posts about Android tech make better journalism than most news outlets.",top_n=3){u'android':0.10602030910588661,u'journalism':0.13466866170166855,u'outlets':0.13930405357808642}
批处理API
每个indicoio函数都可以用一个 请求。只需传入输入列表并接收结果列表 作为回报。
>>>fromindicoioimportsentiment>>>sentiment(['Best day ever','Worst day ever'])[0.9899001220871786,0.005709885173415242]