person

先说一下为什么写这篇文章,很简单,论文的摘要需要提取关键字。废话不多说,直接进入正题。

结巴分词下载

pip install jieba

代码

# -*- coding:UTF-8 -*-
from jieba.analyse import *

with open('sample.txt') as f:
    data = f.read()

for keyword, weight in extract_tags(data, withWeight=True):
    print('%s %s' % (keyword, weight))

新评论