高中物理的题库里提取所有物理关键词
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 29 18:41:47 2018
@author: loka
"""
import jieba
from jieba import analyse
import codecs
# 引入TF-IDF關(guān)鍵詞抽取接口
tfidf = analyse.extract_tags
#添加用戶自定義詞
jieba.load_userdict("D:\\software\\development\\anaconda\\dictronary\\gzwl.txt")
#添加停用詞
stoplist = [line.strip() for line in codecs.open("D:\\software\\development\\anaconda\\dictronary\\stopword.txt",encoding='utf-8')]
#數(shù)據(jù)預(yù)處理
def is_ustr(in_str):
out_str=''
for i in range(len(in_str)):
if is_uchar(in_str[i]):
out_str=out_str+in_str[i]
else:
out_str=out_str+' '
return out_str
def is_uchar(uchar):
"""判斷一個(gè)unicode是否是漢字"""
if uchar >= u'\u4e00'
總結(jié)
以上是生活随笔為你收集整理的高中物理的题库里提取所有物理关键词的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 如何通过SW Manage实现工程变更申
- 下一篇: 夏季日剧