我歸納出讀論文的三大痛點:
import googletrans
translator = googletrans.Translator()
txt_file_path = r"test.txt"
with open(txt_file_path) as f:
content = f.read()
content = content.replace("\n"," ")
lines = content.split('. ')
for num,line in enumerate(lines):
print("(%s)" % num)
print("EN:\n"+line+".")
print("TW:\n"+translator.translate(line,src="en",dest='zh-tw').text)
print("PS:")
print("\n")
可以愉快的看論文啦(我是分段障礙者)