mirror of
https://github.com/wassname/IndicoIo-python.git
synced 2026-08-13 11:50:15 +08:00
ADD: Twitter Engagement
This commit is contained in:
@@ -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)
|
||||
Reference in New Issue
Block a user