new script
This commit is contained in:
parent
28cf9f94a1
commit
2bc4f8b336
@ -27,25 +27,10 @@ def add_data(data):
|
|||||||
json.loads(urllib2.urlopen(req, json.dumps(data)).read())
|
json.loads(urllib2.urlopen(req, json.dumps(data)).read())
|
||||||
|
|
||||||
sourceFile = sys.argv[1]
|
sourceFile = sys.argv[1]
|
||||||
soURCeLangId = int(sys.argv[2])
|
tmId = int(sys.argv[2])
|
||||||
targetLangId = int(sys.argv[3])
|
|
||||||
name = sys.argv[4]
|
|
||||||
|
|
||||||
totalLines = file_len(sourceFile)
|
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 = {
|
data = {
|
||||||
'operation': 'addAlignedSentences',
|
'operation': 'addAlignedSentences',
|
||||||
'tmId':tmId
|
'tmId':tmId
|
||||||
@ -93,6 +78,3 @@ urllib2.urlopen(req, json.dumps(data)).read()
|
|||||||
|
|
||||||
end = time.time()
|
end = time.time()
|
||||||
print "Index regeneration complete. The operation took %.4f s" % (end - start)
|
print "Index regeneration complete. The operation took %.4f s" % (end - start)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user