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
TF-IDF向量的计算 - Python实现
最新推荐文章于 2024-06-17 21:12:11 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)