前提是你安裝好了python3 以及nltk這個庫。(自行百度)
打開automator,新建app,

Paste_Image.png
Py文件內(nèi)容,把corpus_root='/Users/noneback/protoncorpus'改成你存放txt文本的位置。把要分析的txt文本存在這里即可。
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from nltk.corpus import PlaintextCorpusReader
corpus_root='/Users/noneback/protoncorpus'
wordlists=PlaintextCorpusReader(corpus_root,'.*')
def getcb():
#從文本中提取單詞列表
cb=[]
for x in wordlists.fileids():
if x.endswith('.txt'):
print (x)
cb.extend(wordlists.words(x))
return cb
def nocfcb():
#去掉單詞列表中重復的單詞
s=getcb()
print (len(s))
s1=set(s)
s2=sorted([w for w in s1 if w.isalpha() and w.islower()])
for x in s2:
print (x)
if __name__=='__main__':
nocfcb()
效果如圖

Paste_Image.png
ps:安裝nltk庫非常麻煩,要有耐心。
沒耐心的去這個網(wǎng)站、http://tools.eflclub.me/VocabularyAnalyzer