mirror of
https://github.com/wassname/IndicoIo-python.git
synced 2026-09-11 11:51:01 +08:00
language detection added
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import requests
|
||||
import json
|
||||
|
||||
from IndicoIo import JSON_HEADERS
|
||||
|
||||
base_url = lambda c: "http://api.indico.io/%s" % c
|
||||
|
||||
def language(test_text):
|
||||
data_dict = json.dumps({'text': test_text})
|
||||
response = requests.post(base_url("language"), data=data_dict, headers=JSON_HEADERS)
|
||||
return json.loads(response.content)
|
||||
@@ -4,18 +4,13 @@ import json
|
||||
from IndicoIo import JSON_HEADERS
|
||||
from IndicoIo.utils import normalize
|
||||
|
||||
base_url = lambda c: "http://indico.io/api/%s" % c
|
||||
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 spam(test_text):
|
||||
data_dict = json.dumps({'text': test_text})
|
||||
response = requests.post(base_url("spam"), 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)
|
||||
|
||||
Reference in New Issue
Block a user