#TODO:Check lines are equal in SLFs and TLFs. #Command line params cache = args.c lp_dir = args.d verbose = args.v mode = args.mode.lower() assertion(mode in ['all', 'cam', 'compare'], "Mode couldn't be identified.") grounded = args.go best_only = args.bo min_fms = float(args.min_fms) min_len = int(args.min_len) max_len = int(args.max_len) warning(min_len > 1 & grounded, "min_len should be greater than 1") cache_db_file = None if cache != '': cache_db_file = cache use_caching = True if cache_db_file else False apertium = Apertium(lps[0], lps[1]) (out, err) = apertium.check_installations(lp_dir) assertion(out, err) #Reopen new file file1 = open(args.out) #Global values
assertion(s1_sentence != "", "S1 should not be blank. See -h for help") assertion(len(lps) == 2, "LP should be of type a-b, eg, 'en-eo'") #Read optional params cache = args.c lp_dir = args.d verbose = args.v show_traces = args.t cover_all = args.cam grounded = args.go best_only = args.bo min_fms = float(args.min_fms) min_len = int(args.min_len) max_len = int(args.max_len) if args.max_len else max(len(s_sentence.split()), len(s1_sentence.split())) warning(min_len > 1 & grounded, "min_len should be greater than 1") if cache != '': cache_db_file = cache use_caching = True if cache_db_file else False #Initiate and check Apertium apertium = Apertium(lps[0], lps[1]) (out, err) = apertium.check_installations(lp_dir) assertion(out, err) #Calculate FMS between S and S1. fms = FMS(s_sentence, s1_sentence).calculate_using_wagner_fischer() #Exit if low FMS.