mirror of
https://github.com/wassname/IndicoIo-python.git
synced 2026-06-27 16:10:34 +08:00
67d53d25d81a611cf52b9b1fef2afab515608fd5
IndicoIo-python
A wrapper for a series of APIs made by Indico Data Solutions.
Check out the main site on:
Current APIs
Right now this wrapper supports the following apps:
- Political Sentiment Analysis
- Spam Detection
- Positive/Negative Sentiment Analysis
- Facial Emotion Recognition
- Facial Feature Extraction
Examples
>>> import numpy as np
>>> from IndicoIo.text.sentiment import political, spam, posneg
>>> from IndicoIo.images.fer import fer
>>> from IndicoIo.images.facial_features import facial
>>> political("Guns don't kill people, people kill people")
{u'Libertarian': 1.000094905588269, u'Liberal': 1.000194776694221, u'Green': 1.0000989185747784, u'Conservative': 1.000114308739228}
>>> spam("Buy a new car!!")
{u'Ham': 1.0001470818000544, u'Spam': 1.0003137966593707}
>>> posneg("Would not stay in this hotel ever again.")
{u'Positive': 1.0002370406887562, u'Negative': 1.0002938352112363}
>>> test_face = np.linspace(0,50,48*48).reshape(48,48).tolist()
>>> 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(test_face)
{u'feature_vector': u'[0.0, -0.02568680526917187, 0.21645604230056517, -0.1519435786033145, -0.5648621854611555, 3.0607368045577226, 0.11434321880792693, -0.02163810928547493, -0.44224330594186484, 0.3024315632285246, -2.6068048934495276, 2.497798330306638, 3.040558335205844, 0.741045340525325, 0.37198135618478817, -0.33132377802172325, -0.9804190889833034, 0.5046575784709395, -0.5609132323152847, 1.679107064439151, 0.6825037853544341, -1.5977176226648016, 1.8959464303080562, -0.7812860715595836, -2.998394007543733, -0.22637273967347724, -0.9642457010679496, 1.4557274834236749, 2.412244419186633, 2.3151771738421965, 0.7881483386786367, 1.6622850935863422, 0.1304768990234367, 1.9344501393866649, 3.1271558035162914, -0.10250886439220543, 1.4921395116492966, 2.761645355670677, 1.6903473594991179, 1.009209807271491, 0.07273926986120445, -1.4941708135718021, -2.082786362439631, 1.0160924044870847, 2.5326580674673895, -0.8328208491083264, 2.0390177029762935, 3.0342637531932777]'}
Languages
Python
100%