convenience scripts

This commit is contained in:
rjawor 2019-06-26 10:19:11 +02:00
parent 1178191180
commit 0a4a9b2ce8
2 changed files with 30 additions and 6 deletions

View File

@ -1,8 +1,5 @@
#!/bin/sh
#!/bin/bash
CORPUS_NAME=opensubtitles
CORPUS_PATH=../fast-aligner/corpora/$CORPUS_NAME
SRC_LANG_ID=1
TRG_LANG_ID=2
source corpus.cfg
./addFastAlignedTM.py $CORPUS_NAME $CORPUS_PATH/src_clean.txt $CORPUS_PATH/src_clean.lem $SRC_LANG_ID $CORPUS_PATH/trg_clean.txt $TRG_LANG_ID $CORPUS_PATH/alignments.txt $CORPUS_PATH/ids_clean.txt
./add_fast_aligned_TM.py $CORPUS_NAME $CORPUS_PATH/src_clean.txt $CORPUS_PATH/src_clean.lem $SRC_LANG_ID $CORPUS_PATH/trg_clean.txt $TRG_LANG_ID $CORPUS_PATH/alignments.txt $CORPUS_PATH/ids_clean.txt

View File

@ -0,0 +1,27 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
import json
import urllib2
import sys
import time
data = {
'operation': 'fullSearch',
'pattern':sys.argv[1],
'tmId':int(sys.argv[2]),
'limit':10,
'offset':0
}
address = 'http://127.0.0.1:10001'
start = time.time()
req = urllib2.Request(address)
req.add_header('Content-Type', 'application/json')
response = urllib2.urlopen(req, json.dumps(data)).read()
end = time.time()
print "Execution time: %.4f seconds." % (end-start)
print "Result: "
print response