def fileNameOptions(self, eval_type,
				srctotarget_file, targettosrc_file, output_file):
		options = load_arguments(['', eval_type, '--srctotarget', '-'])
		options['srctotarget'] = srctotarget_file
		options['targettosrc'] = targettosrc_file
		options['output-src'] = output_file + '-s'
		options['output-target'] = output_file + '-t'
		options['verbosity'] = 0
		return options
 def fileNameOptions(self, eval_type, filter_type, srctotarget_file,
                     targettosrc_file, output_file):
     options = load_arguments(['', eval_type,\
      '--filter', filter_type,\
      '--srctotarget', '-'])
     options['srctotarget'] = srctotarget_file
     options['targettosrc'] = targettosrc_file
     options['output-src'] = output_file + '-good-s'
     options['output-target'] = output_file + '-good-t'
     options['output-src-bad'] = output_file + '-bad-s'
     options['output-target-bad'] = output_file + '-bad-t'
     options['verbosity'] = 0
     if filter_type == 'articles':
         options['filterthreshold'] = 50
     return options
	def fileNameOptions(self, eval_type, filter_type,
				srctotarget_file, targettosrc_file, output_file):
		options = load_arguments(['', eval_type,\
			'--filter', filter_type,\
			'--srctotarget', '-'])
		options['srctotarget'] = srctotarget_file
		options['targettosrc'] = targettosrc_file
		options['output-src'] = output_file + '-good-s'
		options['output-target'] = output_file + '-good-t'
		options['output-src-bad'] = output_file + '-bad-s'
		options['output-target-bad'] = output_file + '-bad-t'
		options['verbosity'] = 0
		if filter_type == 'articles':
			options['filterthreshold'] = 50
		return options
	def test_gale_church(self):
		test_dir = os.path.dirname(os.path.abspath(__file__))
		result_dir = os.path.join(test_dir, 'result')
		refer_dir = os.path.join(test_dir, 'refer')
		bleualign.log = lambda a, b:None
		compare_files = []
		for test_set, test_argument in [('eval1957', '-d'), ('eval1989', '-e')]:
			options = load_arguments(['', test_argument, '--srctotarget', '-'])
			output_file = test_set + '-galechurch'
			output_path = os.path.join(result_dir , output_file)
# 			options['output'] = output_path
			a = Aligner(options)
			a.mainloop()
			output_src, output_target = a.results()
			refer_path = os.path.join(refer_dir , output_file)
			compare_files.append((output_path + '-s', refer_path + '-s', output_src))
			compare_files.append((output_path + '-t', refer_path + '-t', output_target))
		# compare result with data in refer
		for result_path, refer_path, output_object in compare_files:
			self.cmp_files(result_path, refer_path, output_object)
Beispiel #5
0
 def test_gale_church(self):
     test_dir = os.path.dirname(os.path.abspath(__file__))
     result_dir = os.path.join(test_dir, 'result')
     refer_dir = os.path.join(test_dir, 'refer')
     bleualign.log = lambda a, b: None
     compare_files = []
     for test_set, test_argument in [('eval1957', '-d'),
                                     ('eval1989', '-e')]:
         options = load_arguments(['', test_argument, '--srctotarget', '-'])
         output_file = test_set + '-galechurch'
         output_path = os.path.join(result_dir, output_file)
         # 			options['output'] = output_path
         a = Aligner(options)
         a.mainloop()
         output_src, output_target = a.results()
         refer_path = os.path.join(refer_dir, output_file)
         compare_files.append(
             (output_path + '-s', refer_path + '-s', output_src))
         compare_files.append(
             (output_path + '-t', refer_path + '-t', output_target))
     # compare result with data in refer
     for result_path, refer_path, output_object in compare_files:
         self.cmp_files(result_path, refer_path, output_object)
Beispiel #6
0
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright © 2010 University of Zürich
# Author: Rico Sennrich <*****@*****.**>
# For licensing information, see LICENSE

import sys
from command_utils import load_arguments
from bleualign.align import Aligner

if __name__ == '__main__':
    options = load_arguments(sys.argv)

    a = Aligner(options)
    a.mainloop()