wiki_to_txt.py 文件源码

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

项目:word2vec-tutorial 作者: zake7749 项目源码 文件源码
def main():

    if len(sys.argv) != 2:
        print("Usage: python3 " + sys.argv[0] + " wiki_data_path")
        exit()

    logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
    wiki_corpus = WikiCorpus(sys.argv[1], dictionary={})
    texts_num = 0

    with open("wiki_texts.txt",'w',encoding='utf-8') as output:
        for text in wiki_corpus.get_texts():
            output.write(' '.join(text) + '\n')
            texts_num += 1
            if texts_num % 10000 == 0:
                logging.info("??? %d ???" % texts_num)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号