concordia-server/tests/lemmatizeSentences.py
2019-02-04 15:27:56 +01:00

30 lines
656 B
Python
Executable File

#!/usr/bin/python
# -*- coding: utf-8 -*-
import unittest
import json
import urllib2
import sys
import time
import host
data = {
'operation': 'lemmatizeAll',
'languageCode':sys.argv[1],
'sentences':["ona poszła do sklepu", "powiedziałem to Tomkowi"]
}
address = 'http://'+host.concordia_host
if len(host.concordia_port) > 0:
address += ':'+host.concordia_port
start = time.time()
req = urllib2.Request(address)
req.add_header('Content-Type', 'application/json')
response = json.loads(urllib2.urlopen(req, json.dumps(data)).read())
end = time.time()
print "Execution time: %.4f seconds." % (end-start)
print "Result: "
print response