【发布时间】:2018-09-19 12:13:00
【问题描述】:
有没有类似sklearn的golang库可以用来查找tf-idf?我似乎找不到任何有据可查的东西。我正在寻找给定一堆文本文件的 tf-idf,类似于提到的 python 版本here
from sklearn.feature_extraction.text import TfidfVectorizer
import numpy as np
from scipy.sparse.csr import csr_matrix #need this if you want to save tfidf_matrix
tf = TfidfVectorizer(input='filename', analyzer='word', ngram_range=(1,6),
min_df = 0, stop_words = 'english', sublinear_tf=True)
tfidf_matrix = tf.fit_transform(corpus)
【问题讨论】: