import numpy as np
import math
import json
import jieba
class TF_IDF(object):
def __init__(self):
self.allPath = [r'计算机专业.txt',r'自动化专业.txt',r'合成生物学.txt']
self.mySlotPath = r'my_slot.json'
self.numDoc = len(self.allPath)
self.stopWords = [',','。','《','》','?',';','‘','’',':','“','”','!','、','的','',' ','\n']
def get_slot(self):
allDocStr = ''
for path in self.allPath:
with open(path,'r',encoding='utf-8') as f_obj:
allDocStr += f_obj