diff --git a/CHANGES.txt b/CHANGES.txt index 2a75d3f..e7ef582 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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. diff --git a/IndicoIo/__init__.py b/IndicoIo/__init__.py index 7c12b12..5977d83 100644 --- a/IndicoIo/__init__.py +++ b/IndicoIo/__init__.py @@ -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 diff --git a/README b/README index 41c6290..902c0c0 100644 --- a/README +++ b/README @@ -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() diff --git a/README.md b/README.md index 41c6290..902c0c0 100644 --- a/README.md +++ b/README.md @@ -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() diff --git a/setup.py b/setup.py index 771eb91..f5a2bfa 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ except ImportError: setup( name = "IndicoIo", - version = '0.2.10', + version = '0.2.11', packages = [ "IndicoIo", "IndicoIo.text", diff --git a/tests/test_run.py b/tests/test_run.py index 47d624a..ce7be9c 100644 --- a/tests/test_run.py +++ b/tests/test_run.py @@ -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()))