def trans(self): if self.isHangul(self.tb1.get('1.0', 'end')): f = open("src.txt", 'w', encoding="utf-8") f.write(self.tb1.get('1.0', 'end')) f.close() main() f = open("pred.txt", 'r') line = f.read() f.close() self.tb2.delete('1.0', 'end') self.tb2.insert(1.0, line) else: tkinter.messagebox.showwarning("입력", "한글이 아닌 문자가 입력되었습니다.\n다시 입력하세요")
def trans(self): if self.isChar(): with open("data/demo/input.txt", "w+", encoding='utf-8') as f: f.write(self.tb1.get('1.0', 'end')) with open("data/demo/input.txt", "r", encoding='utf-8') as f: line=f.readlines() token = Korean_tokenizer(line) with open("data/demo/KoreanTokenInput.txt", "w", encoding='utf-8') as f: for row in token: if row == '': pass else: f.write(row) f.write('\n') main() f = open("data/demo/EnglishTokenOutput.txt", 'r', encoding="utf-8") line = f.read() print(line) f.close() self.tb2.delete('1.0', 'end') self.tb2.insert(1.0, line)
#!/usr/bin/env python from onmt.bin.translate import main if __name__ == "__main__": main()