From 4fe2952df45c26392f36acd8b43391dfc50e140b Mon Sep 17 00:00:00 2001 From: Slater-Victoroff Date: Fri, 1 Aug 2014 15:29:36 -0400 Subject: [PATCH] updated language example, changes module name to lowercase --- CHANGES.txt | 4 +++- README | 11 ++++++++--- README.md | 11 ++++++++--- {IndicoIo => indicoio}/__init__.py | 3 ++- {IndicoIo => indicoio}/examples/__init__.py | 0 {IndicoIo => indicoio}/images/__init__.py | 0 {IndicoIo => indicoio}/images/features.py | 2 +- {IndicoIo => indicoio}/images/fer.py | 2 +- {IndicoIo => indicoio}/speech/__init__.py | 0 {IndicoIo => indicoio}/text/__init__.py | 0 {IndicoIo => indicoio}/text/lang.py | 2 +- {IndicoIo => indicoio}/text/sentiment.py | 4 ++-- {IndicoIo => indicoio}/utils/__init__.py | 0 setup.py | 16 ++++++++-------- tests/test_run.py | 2 +- 15 files changed, 35 insertions(+), 22 deletions(-) rename {IndicoIo => indicoio}/__init__.py (82%) rename {IndicoIo => indicoio}/examples/__init__.py (100%) rename {IndicoIo => indicoio}/images/__init__.py (100%) rename {IndicoIo => indicoio}/images/features.py (91%) rename {IndicoIo => indicoio}/images/fer.py (88%) rename {IndicoIo => indicoio}/speech/__init__.py (100%) rename {IndicoIo => indicoio}/text/__init__.py (100%) rename {IndicoIo => indicoio}/text/lang.py (89%) rename {IndicoIo => indicoio}/text/sentiment.py (87%) rename {IndicoIo => indicoio}/utils/__init__.py (100%) diff --git a/CHANGES.txt b/CHANGES.txt index 1954ddf..5b45b70 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -4,4 +4,6 @@ v0.2.11, Fri Jun 6 -- Switched sentiment api to more general version with much h v0.3.0, Mon Jul 21 -- Switched api over to new high-volume version, using api.indico.io instead v0.3.1, Mon Jul 21 -- Added __version__ to module v0.3.2, Tue Jul 22 -- Removed spam detection due to instability -v0.3.3, Fri Aug 1 -- Added language detection api \ No newline at end of file +v0.3.3, Fri Aug 1 -- Added language detection api +v0.4.0, Fri Aug 1 -- Changed api import to lowercase, added language example +v0.4.1, Fri Aug 1 -- Updated __version__ variable to be accurate \ No newline at end of file diff --git a/README b/README index 0165d1d..ac12da9 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -IndicoIo-python +indicoio-python =============== A wrapper for a series of APIs made by Indico Data Solutions. @@ -25,7 +25,7 @@ Examples ``` >>> import numpy as np ->>> from IndicoIo import political, sentiment, fer, facial_features, language +>>> from indicoio import political, sentiment, fer, facial_features, language >>> 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} @@ -44,7 +44,12 @@ Examples >>> facial_features(test_face) [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] ->>> language('Clearly an english phrase') +>>> language_dict = language('Quis custodiet ipsos custodes') +>>> language_dict +{u'Swedish': 0.00033330636691921914, u'Lithuanian': 0.007328693814717631, u'Vietnamese': 0.0002686116137658802, u'Romanian': 8.133913804076592e-06, u'Dutch': 0.09380619821813883, u'Korean': 0.00272046505489883, u'Danish': 0.0012556466207667206, u'Indonesian': 6.623391878530033e-07, u'Latin': 0.8230599921384231, u'Hungarian': 0.0012793617391960567, u'Persian (Farsi)': 0.0019848504383980473, u'Turkish': 0.0004606965429738638, u'French': 0.00016792646226101638, u'Norwegian': 0.0009179030069742254, u'Russian': 0.0002643396088456642, u'Thai': 7.746466749651003e-05, u'Finnish': 0.0026367338676522643, u'Spanish': 0.011844579596827902, u'Bulgarian': 3.746416283126873e-05, u'Greek': 0.027456554742563633, u'Tagalog': 0.0005143018200605518, u'English': 0.00013517846159760138, u'Esperanto': 0.0002599482830232367, u'Italian': 2.650711180999111e-06, u'Portuguese': 0.013193681336032896, u'Chinese': 0.008818957727120736, u'German': 0.00011732494215411359, u'Japanese': 0.0005885208894664065, u'Czech': 9.916434007248934e-05, u'Slovak': 8.869445598583308e-05, u'Hebrew': 3.70933525938127e-05, u'Polish': 9.900290296255447e-05, u'Arabic': 0.00013589586110619373} + +>>> sorted(language_dict.keys(), key=lambda x: language_dict[x], reverse=True) +[u'Latin', u'Dutch', u'Greek', u'Portuguese', u'Spanish', u'Chinese', u'Lithuanian', u'Korean', u'Finnish', u'Persian (Farsi)', u'Hungarian', u'Danish', u'Norwegian', u'Japanese', u'Tagalog', u'Turkish', u'Swedish', u'Vietnamese', u'Russian', u'Esperanto', u'French', u'Arabic', u'English', u'German', u'Czech', u'Polish', u'Slovak', u'Thai', u'Bulgarian', u'Hebrew', u'Romanian', u'Italian', u'Indonesian'] ``` diff --git a/README.md b/README.md index 0165d1d..ac12da9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -IndicoIo-python +indicoio-python =============== A wrapper for a series of APIs made by Indico Data Solutions. @@ -25,7 +25,7 @@ Examples ``` >>> import numpy as np ->>> from IndicoIo import political, sentiment, fer, facial_features, language +>>> from indicoio import political, sentiment, fer, facial_features, language >>> 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} @@ -44,7 +44,12 @@ Examples >>> facial_features(test_face) [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] ->>> language('Clearly an english phrase') +>>> language_dict = language('Quis custodiet ipsos custodes') +>>> language_dict +{u'Swedish': 0.00033330636691921914, u'Lithuanian': 0.007328693814717631, u'Vietnamese': 0.0002686116137658802, u'Romanian': 8.133913804076592e-06, u'Dutch': 0.09380619821813883, u'Korean': 0.00272046505489883, u'Danish': 0.0012556466207667206, u'Indonesian': 6.623391878530033e-07, u'Latin': 0.8230599921384231, u'Hungarian': 0.0012793617391960567, u'Persian (Farsi)': 0.0019848504383980473, u'Turkish': 0.0004606965429738638, u'French': 0.00016792646226101638, u'Norwegian': 0.0009179030069742254, u'Russian': 0.0002643396088456642, u'Thai': 7.746466749651003e-05, u'Finnish': 0.0026367338676522643, u'Spanish': 0.011844579596827902, u'Bulgarian': 3.746416283126873e-05, u'Greek': 0.027456554742563633, u'Tagalog': 0.0005143018200605518, u'English': 0.00013517846159760138, u'Esperanto': 0.0002599482830232367, u'Italian': 2.650711180999111e-06, u'Portuguese': 0.013193681336032896, u'Chinese': 0.008818957727120736, u'German': 0.00011732494215411359, u'Japanese': 0.0005885208894664065, u'Czech': 9.916434007248934e-05, u'Slovak': 8.869445598583308e-05, u'Hebrew': 3.70933525938127e-05, u'Polish': 9.900290296255447e-05, u'Arabic': 0.00013589586110619373} + +>>> sorted(language_dict.keys(), key=lambda x: language_dict[x], reverse=True) +[u'Latin', u'Dutch', u'Greek', u'Portuguese', u'Spanish', u'Chinese', u'Lithuanian', u'Korean', u'Finnish', u'Persian (Farsi)', u'Hungarian', u'Danish', u'Norwegian', u'Japanese', u'Tagalog', u'Turkish', u'Swedish', u'Vietnamese', u'Russian', u'Esperanto', u'French', u'Arabic', u'English', u'German', u'Czech', u'Polish', u'Slovak', u'Thai', u'Bulgarian', u'Hebrew', u'Romanian', u'Italian', u'Indonesian'] ``` diff --git a/IndicoIo/__init__.py b/indicoio/__init__.py similarity index 82% rename from IndicoIo/__init__.py rename to indicoio/__init__.py index 1a0470c..bd584c0 100644 --- a/IndicoIo/__init__.py +++ b/indicoio/__init__.py @@ -1,5 +1,6 @@ JSON_HEADERS = {'Content-type': 'application/json', 'Accept': 'text/plain'} -__version__ = '0.3.3' + +Version, version, __version__, VERSION = ('0.4.1',) * 4 from text.sentiment import political, posneg from text.sentiment import posneg as sentiment diff --git a/IndicoIo/examples/__init__.py b/indicoio/examples/__init__.py similarity index 100% rename from IndicoIo/examples/__init__.py rename to indicoio/examples/__init__.py diff --git a/IndicoIo/images/__init__.py b/indicoio/images/__init__.py similarity index 100% rename from IndicoIo/images/__init__.py rename to indicoio/images/__init__.py diff --git a/IndicoIo/images/features.py b/indicoio/images/features.py similarity index 91% rename from IndicoIo/images/features.py rename to indicoio/images/features.py index cd5269f..dffc88f 100644 --- a/IndicoIo/images/features.py +++ b/indicoio/images/features.py @@ -3,7 +3,7 @@ import json import requests import numpy as np -from IndicoIo import JSON_HEADERS +from indicoio import JSON_HEADERS base_url = lambda c: "http://api.indico.io/%s" % c diff --git a/IndicoIo/images/fer.py b/indicoio/images/fer.py similarity index 88% rename from IndicoIo/images/fer.py rename to indicoio/images/fer.py index 2279755..2968661 100644 --- a/IndicoIo/images/fer.py +++ b/indicoio/images/fer.py @@ -2,7 +2,7 @@ import json import requests import numpy as np -from IndicoIo import JSON_HEADERS +from indicoio import JSON_HEADERS base_url = "http://api.indico.io/fer" diff --git a/IndicoIo/speech/__init__.py b/indicoio/speech/__init__.py similarity index 100% rename from IndicoIo/speech/__init__.py rename to indicoio/speech/__init__.py diff --git a/IndicoIo/text/__init__.py b/indicoio/text/__init__.py similarity index 100% rename from IndicoIo/text/__init__.py rename to indicoio/text/__init__.py diff --git a/IndicoIo/text/lang.py b/indicoio/text/lang.py similarity index 89% rename from IndicoIo/text/lang.py rename to indicoio/text/lang.py index 3d6add4..522ed4c 100644 --- a/IndicoIo/text/lang.py +++ b/indicoio/text/lang.py @@ -1,7 +1,7 @@ import requests import json -from IndicoIo import JSON_HEADERS +from indicoio import JSON_HEADERS base_url = lambda c: "http://api.indico.io/%s" % c diff --git a/IndicoIo/text/sentiment.py b/indicoio/text/sentiment.py similarity index 87% rename from IndicoIo/text/sentiment.py rename to indicoio/text/sentiment.py index cbed1f7..69e77c3 100644 --- a/IndicoIo/text/sentiment.py +++ b/indicoio/text/sentiment.py @@ -1,8 +1,8 @@ import requests import json -from IndicoIo import JSON_HEADERS -from IndicoIo.utils import normalize +from indicoio import JSON_HEADERS +from indicoio.utils import normalize base_url = lambda c: "http://api.indico.io/%s" % c diff --git a/IndicoIo/utils/__init__.py b/indicoio/utils/__init__.py similarity index 100% rename from IndicoIo/utils/__init__.py rename to indicoio/utils/__init__.py diff --git a/setup.py b/setup.py index 92a2a09..95debae 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,5 @@ """ -Setup for indicoio apis +Setup for indico apis """ try: from setuptools import setup @@ -8,21 +8,21 @@ except ImportError: setup( name="IndicoIo", - version='0.3.3', + version='0.4.1', packages=[ - "IndicoIo", - "IndicoIo.text", - "IndicoIo.images", - "IndicoIo.utils", + "indicoio", + "indicoio.text", + "indicoio.images", + "indicoio.utils", "tests", ], description=""" - A Python Wrapper for IndicoIo. + A Python Wrapper for indico. Use pre-built state of the art machine learning algorithms with a single line of code. """, license="MIT License (See LICENSE)", long_description=open("README").read(), - url="https://github.com/IndicoDataSolutions/IndicoIo-python", + url="https://github.com/IndicoDataSolutions/indicoio-python", author="Alec Radford, Slater Victoroff, Aidan McLaughlin", author_email=""" Alec Radford , diff --git a/tests/test_run.py b/tests/test_run.py index 8a0b5d1..d2a3bad 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, sentiment, fer, facial_features, language +from indicoio import political, sentiment, fer, facial_features, language class FullAPIRun(unittest.TestCase):