예제 #1
0
파일: reg_test.py 프로젝트: goavki/patcher
	s1 = file1.readline().rstrip()
	t1 = file1.readline().rstrip()

	if not (s and s1 and t and t1):
		break

	wer = []
	no_of_patches = 0.0
	if mode == 'compare':
		wer2 = []
		no_of_patches2 = 0.0

	tgt_sentences = t1.lower()
	
	patcher = Patcher(apertium, s, s1, t, use_caching, cache_db_file)
	patches = patcher.patch(min_len, max_len, grounded, lp_dir)
	best_patch = patcher.get_best_patch()
	best_patch_with_cam = patcher.get_best_patch(True) #Best patched result covering all mismatches
	
	if best_patch:
		patches.append(best_patch)

	all_patches = patches[:]
	
	if not grounded:
		unpatched = patches[0]
		all_patches.pop(0)
	else:
		unpatched = (t1,)

	if best_only: