setup.py 文件源码

python
阅读 16 收藏 0 点赞 0 评论 0

项目:PyStanfordNLP 作者: banyh 项目源码 文件源码
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')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号