ADD: Twitter Engagement

This commit is contained in:
Chris Lee committed 2015-07-29 08:41:19 -04:00
1 parent b51e374efa
commit ffaa09fc44
4 files changed
+43 -2

No files matched your search

+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)