ADD: Versioning

This commit is contained in:
Chris Lee
2015-09-01 09:06:34 -04:00
parent ce7f97699f
commit 80760ba26b
13 changed files with 63 additions and 38 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
from indicoio.utils.api import api_handler
import indicoio.config as config
def keywords(text, cloud=None, batch=False, api_key=None, **kwargs):
def keywords(text, cloud=None, batch=False, api_key=None, version=None, **kwargs):
"""
Given input text, returns series of keywords and associated scores
+2 -2
View File
@@ -1,7 +1,7 @@
from indicoio.utils.api import api_handler
import indicoio.config as config
def language(text, cloud=None, batch=False, api_key=None, **kwargs):
def language(text, cloud=None, batch=False, api_key=None, version=None, **kwargs):
"""
Given input text, returns a probability distribution over 33 possible
languages of what language the text was written in.
@@ -23,5 +23,5 @@ def language(text, cloud=None, batch=False, api_key=None, **kwargs):
:type text: str or unicode
:rtype: Dictionary of language probability pairs
"""
url_params = {"batch": batch, "api_key": api_key}
url_params = {"batch": batch, "api_key": api_key, "version": version}
return api_handler(text, cloud=cloud, api="language", url_params=url_params, **kwargs)
+2 -2
View File
@@ -1,7 +1,7 @@
from indicoio.utils.api import api_handler
import indicoio.config as config
def named_entities(text, cloud=None, batch=False, api_key=None, **kwargs):
def named_entities(text, cloud=None, batch=False, api_key=None, version=None, **kwargs):
"""
Given input text, returns named entities (proper nouns) found in the text
@@ -26,5 +26,5 @@ def named_entities(text, cloud=None, batch=False, api_key=None, **kwargs):
:type text: str or unicode
:rtype: Dictionary of language probability pairs
"""
url_params = {"batch": batch, "api_key": api_key}
url_params = {"batch": batch, "api_key": api_key, "version": version}
return api_handler(text, cloud=cloud, api="namedentities", url_params=url_params, **kwargs)
+6 -6
View File
@@ -1,6 +1,6 @@
from indicoio.utils.api import api_handler
def political(text, cloud=None, batch=False, api_key=None, **kwargs):
def political(text, cloud=None, batch=False, api_key=None, version=None, **kwargs):
"""
Given input text, returns a probability distribution over the political alignment of the speaker.
@@ -25,10 +25,10 @@ def political(text, cloud=None, batch=False, api_key=None, **kwargs):
:type text: str or unicode
:rtype: Dictionary of party probability pairs
"""
url_params = {"batch": batch, "api_key": api_key}
url_params = {"batch": batch, "api_key": api_key, "version": version}
return api_handler(text, cloud=cloud, api="political", url_params=url_params, **kwargs)
def posneg(text, cloud=None, batch=False, api_key=None, **kwargs):
def posneg(text, cloud=None, batch=False, api_key=None, version=None, **kwargs):
"""
Given input text, returns a scalar estimate of the sentiment of that text.
Values are roughly in the range 0 to 1 with 0.5 indicating neutral sentiment.
@@ -48,10 +48,10 @@ def posneg(text, cloud=None, batch=False, api_key=None, **kwargs):
:type text: str or unicode
:rtype: Float
"""
url_params = {"batch": batch, "api_key": api_key}
url_params = {"batch": batch, "api_key": api_key, "version": version}
return api_handler(text, cloud=cloud, api="sentiment", url_params=url_params, **kwargs)
def sentiment_hq(text, cloud=None, batch=False, api_key=None, **kwargs):
def sentiment_hq(text, cloud=None, batch=False, api_key=None, version=None, **kwargs):
"""
Given input text, returns a scalar estimate of the sentiment of that text.
Values are roughly in the range 0 to 1 with 0.5 indicating neutral sentiment.
@@ -71,5 +71,5 @@ def sentiment_hq(text, cloud=None, batch=False, api_key=None, **kwargs):
:type text: str or unicode
:rtype: Float
"""
url_params = {"batch": batch, "api_key": api_key}
url_params = {"batch": batch, "api_key": api_key, "version": version}
return api_handler(text, cloud=cloud, api="sentimenthq", url_params=url_params, **kwargs)
+2 -2
View File
@@ -1,7 +1,7 @@
from indicoio.utils.api import api_handler
import indicoio.config as config
def text_tags(text, cloud=None, batch=False, api_key=None, **kwargs):
def text_tags(text, cloud=None, batch=False, api_key=None, version=None, **kwargs):
"""
Given input text, returns a probability distribution over 100 document categories
@@ -22,5 +22,5 @@ def text_tags(text, cloud=None, batch=False, api_key=None, **kwargs):
:type text: str or unicode
:rtype: Dictionary of class probability pairs
"""
url_params = {"batch": batch, "api_key": api_key}
url_params = {"batch": batch, "api_key": api_key, "version": version}
return api_handler(text, cloud=cloud, api="texttags", url_params=url_params, **kwargs)
+2 -2
View File
@@ -1,7 +1,7 @@
from indicoio.utils.api import api_handler
import indicoio.config as config
def twitter_engagement(text, cloud=None, batch=False, api_key=None, **kwargs):
def twitter_engagement(text, cloud=None, batch=False, api_key=None, version=None, **kwargs):
"""
Given input text, returns an engagment score between 0 and 1
@@ -18,5 +18,5 @@ def twitter_engagement(text, cloud=None, batch=False, api_key=None, **kwargs):
:type text: str or unicode
:rtype: Float of engagement between 0 and 1
"""
url_params = {"batch": batch, "api_key": api_key}
url_params = {"batch": batch, "api_key": api_key, "version": version}
return api_handler(text, cloud=cloud, api="twitterengagement", url_params=url_params, **kwargs)