Fixed up sentiment api and updated docs

This commit is contained in:
Slater-Victoroff
2014-06-06 19:41:41 -04:00
parent 8d34b05d9b
commit b5ece3d51b
6 changed files with 19 additions and 11 deletions
+2 -1
View File
@@ -1,2 +1,3 @@
v0.2.8, Tue May 13 -- Added Description, Authors file, changelog. Cleaned up import paths and modified corresponding examples and tests
v0.2.9, Mon Jun 2 -- API now supports normalization, updating documentation to reflect this.
v0.2.10, Mon Jun 2 -- API now supports normalization, updating documentation to reflect this.
v0.2.11, Fri Jun 6 -- Switched sentiment api to more general version with much higher quality. updated docs to reflect this. Also changed unintuitive posneg to more intuitive Sentiment. Kept old posneg for backward compatibility.
+1
View File
@@ -1,5 +1,6 @@
JSON_HEADERS = {'Content-type': 'application/json', 'Accept': 'text/plain'}
from text.sentiment import political, spam, posneg
from text.sentiment import posneg as sentiment
from images.fer import fer
from images.features import facial_features
+6 -3
View File
@@ -25,7 +25,7 @@ Examples
```
>>> import numpy as np
>>> from IndicoIo import political, spam, posneg, fer, facial_features
>>> from IndicoIo import political, spam, sentiment, fer, facial_features
>>> political("Guns don't kill people. People kill people.")
{u'Libertarian': 0.22934946808893228, u'Liberal': 0.2025395008382684, u'Green': 0.0, u'Conservative': 1.0}
@@ -33,8 +33,11 @@ Examples
>>> spam("Free car!")
{u'Ham': 0.0, u'Spam': 1.0}
>>> posneg("Would not stay in this hotel ever again.")
{u'Positive': 0.0, u'Negative': 1.0}
>>> sentiment('Worst movie ever.')
{u'Sentiment': 0.07062467665597527}
>>> sentiment('Really enjoyed the movie.')
{u'Sentiment': 0.8105182526856075}
>>> test_face = np.linspace(0,50,48*48).reshape(48,48).tolist()
+6 -3
View File
@@ -25,7 +25,7 @@ Examples
```
>>> import numpy as np
>>> from IndicoIo import political, spam, posneg, fer, facial_features
>>> from IndicoIo import political, spam, sentiment, fer, facial_features
>>> political("Guns don't kill people. People kill people.")
{u'Libertarian': 0.22934946808893228, u'Liberal': 0.2025395008382684, u'Green': 0.0, u'Conservative': 1.0}
@@ -33,8 +33,11 @@ Examples
>>> spam("Free car!")
{u'Ham': 0.0, u'Spam': 1.0}
>>> posneg("Would not stay in this hotel ever again.")
{u'Positive': 0.0, u'Negative': 1.0}
>>> sentiment('Worst movie ever.')
{u'Sentiment': 0.07062467665597527}
>>> sentiment('Really enjoyed the movie.')
{u'Sentiment': 0.8105182526856075}
>>> test_face = np.linspace(0,50,48*48).reshape(48,48).tolist()
+1 -1
View File
@@ -5,7 +5,7 @@ except ImportError:
setup(
name = "IndicoIo",
version = '0.2.10',
version = '0.2.11',
packages = [
"IndicoIo",
"IndicoIo.text",
+3 -3
View File
@@ -2,7 +2,7 @@ import unittest
import numpy as np
from IndicoIo import political, spam, posneg, fer, facial_features
from IndicoIo import political, spam, sentiment, fer, facial_features
class FullAPIRun(unittest.TestCase):
@@ -24,9 +24,9 @@ class FullAPIRun(unittest.TestCase):
self.assertEqual(spam_set, set(response.keys()))
def test_posneg(self):
posneg_set = set(['Positive', 'Negative'])
posneg_set = set(['Sentiment'])
test_string = "Worst song ever."
response = posneg(test_string)
response = sentiment(test_string)
self.assertTrue(isinstance(response, dict))
self.assertEqual(posneg_set, set(response.keys()))