mirror of
https://github.com/wassname/IndicoIo-python.git
synced 2026-06-27 16:10:34 +08:00
18 lines
559 B
Python
18 lines
559 B
Python
import requests
|
|
import json
|
|
|
|
from indicoio import JSON_HEADERS
|
|
from indicoio.utils import normalize
|
|
|
|
base_url = lambda c: "http://api.indico.io/%s" % c
|
|
|
|
def political(test_text):
|
|
data_dict = json.dumps({'text': test_text})
|
|
response = requests.post(base_url("political"), data=data_dict, headers=JSON_HEADERS)
|
|
return json.loads(response.content)
|
|
|
|
def posneg(test_text):
|
|
data_dict = json.dumps({'text': test_text})
|
|
response = requests.post(base_url("sentiment"), data=data_dict, headers=JSON_HEADERS)
|
|
return json.loads(response.content)
|