Commit 938d97a2 authored by Pruthwik's avatar Pruthwik

API Access

parent 46dae466
"""Run Sampark shallow parser."""
# Language codes for passing onto the API, 3 lettered language identifier.
# Kannada - kan, Punjabi - pan, Urdu - urd, Telugu - tel, Hindi - hin
# if requests package is not there, do pip install requests
import requests
import json
url = "https://ssmt.iiit.ac.in/indic_shallow_parser_v1"
def main():
"""Pass arguments and call functions here."""
text = "भारतीय भाषा अनुवाद प्रणाली।\nभारतीय भाषा अनुवाद प्रणाली।"
# for multiple sentences, just join them by \n
out = {"language":"hin", "text": text}
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
r = requests.post(url, data=json.dumps(out), headers=headers)
json_output = r.json()
ssf_sent = json_output['data']
print(ssf_sent)
if __name__ == '__main__':
main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment