modelname = sys.argv[2] syllable_length = int(sys.argv[3]) merged_yn = sys.argv[4] ignore_case_yn = sys.argv[5] threshold = float(sys.argv[6]) filename = sys.argv[7] functype = sys.argv[8] merged_use = False if merged_yn != 'yes' and merged_yn != 'no': print_usage() exit() if merged_yn == 'yes': merged_use = True try: sbd = MaxentBasedSBD(dictpath) sbd.set(modelname, threshold, filename) document = sbd.get(filename) line = '' lineno = 1 for id in range(document.length()): prev = document.prev(id) curr = document.token(id) next = document.next(id) eos = False if True: # 2008.10.13 문장경계후보를 모든위치로 변경 curr.isEoe(): eos = sbd.eval(document, id, prev, curr, next, syllable_length, merged_use) else: assert(False == curr.isEos()) eos = False if eos == None: continue; # null field found
print "seg: segmenting" print "eval: evaluation" def exit(): sys.exit() if __name__ == '__main__': argc = len(sys.argv) if argc != 3: print_usage() exit() filename = sys.argv[1] functype = sys.argv[2] try: sbd = RuleBasedSBD() sbd.set(filename) document = sbd.get(filename) line = '' lineno = 1 for id in range(document.length()): curr = document.token(id) prev = document.prev(id) next = document.next(id) if curr.isEoe(): eos = sbd.eval(document, prev, curr, next) else: eos = False if functype == 'seg': line += curr.value