def run(self):
install.run(self)
sys.path.reverse()
# ----------- install segmenter ------------
import stanford_segmenter
pwd = stanford_segmenter.__path__[0]
if not isdir(join(pwd, 'seg')):
print('Start downloading stanford-segmenter-2015-12-09.zip...')
urlretrieve('http://nlp.stanford.edu/software/stanford-segmenter-2015-12-09.zip', 'seg.zip', report)
with zipfile.ZipFile('seg.zip', 'r') as z:
z.extractall(pwd)
rename(join(pwd, 'stanford-segmenter-2015-12-09'), join(pwd, 'seg'))
unlink('seg.zip')
# ----------- install postagger ------------
import stanford_postagger
pwd = stanford_postagger.__path__[0]
if not isdir(join(pwd, 'pos')):
print('Start downloading stanford-postagger-full-2015-12-09.zip...')
urlretrieve('http://nlp.stanford.edu/software/stanford-postagger-full-2015-12-09.zip', 'pos.zip', report)
with zipfile.ZipFile('pos.zip', 'r') as z:
z.extractall(pwd)
rename(join(pwd, 'stanford-postagger-full-2015-12-09'), join(pwd, 'pos'))
unlink('pos.zip')
评论列表
文章目录