new script

This commit is contained in:
rjawor 2017-01-22 22:04:35 +01:00
parent 28cf9f94a1
commit 2bc4f8b336

View File

@ -27,25 +27,10 @@ def add_data(data):
json.loads(urllib2.urlopen(req, json.dumps(data)).read())
sourceFile = sys.argv[1]
soURCeLangId = int(sys.argv[2])
targetLangId = int(sys.argv[3])
name = sys.argv[4]
tmId = int(sys.argv[2])
totalLines = file_len(sourceFile)
data = {
'operation': 'addTm',
'sourceLangId':sourceLangId,
'targetLangId':targetLangId,
'name':name
}
req = urllib2.Request(address)
req.add_header('Content-Type', 'application/json')
response = json.loads(urllib2.urlopen(req, json.dumps(data)).read())
tmId = int(response['newTmId'])
print "Added new tm: %d" % tmId
data = {
'operation': 'addAlignedSentences',
'tmId':tmId
@ -93,6 +78,3 @@ urllib2.urlopen(req, json.dumps(data)).read()
end = time.time()
print "Index regeneration complete. The operation took %.4f s" % (end - start)