mirror of
https://github.com/wassname/IndicoIo-python.git
synced 2026-06-27 16:10:34 +08:00
23 lines
763 B
Python
23 lines
763 B
Python
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)
|