背单词的时候为了不看原文意思,就把pdf里面有详细解释的单词提取出来了
附上python程序
from pdfminer.high_level import extract_text
from io import StringIO
import re
i = 0
file = open("./output/worlds.txt","w")
while(True):
one_Page = extract_text("./pdf_files/test.pdf",
page_numbers=[i])
i = i+1
if len(one_Page)==0:
file.close()
break
buf = StringIO(one_Page)
words = buf.read().split("\n")
for word in words:
result = re.match(r"^[a-z][a-z]*[a-z]$|^[a-z][a-z]* $",word)
if (result is not None):
file.write(result.group()+"\n")