ADD: Twitter Engagement

This commit is contained in:
Chris Lee
2015-07-29 08:41:19 -04:00
parent b51e374efa
commit ffaa09fc44
4 changed files with 43 additions and 2 deletions
+22
View File
@@ -0,0 +1,22 @@
from indicoio.utils.api import api_handler
import indicoio.config as config
def twitter_engagement(text, cloud=None, batch=False, api_key=None, **kwargs):
"""
Given input text, returns an engagment score between 0 and 1
Example usage:
.. code-block:: python
>>> import indicoio
>>> import numpy as np
>>> text = 'Monday: Delightful with mostly sunny skies. Highs in the low 70s.'
>>> engagement = indicoio.twitter_engagement(text)
:param text: The text to be analyzed.
:type text: str or unicode
:rtype: Float of engagement between 0 and 1
"""
url_params = {"batch": batch, "api_key": api_key}
return api_handler(text, cloud=cloud, api="twitterengagement", url_params=url_params, **kwargs)