Spaces:
No application file
No application file
File size: 326 Bytes
916ac73 | 1 2 3 4 5 6 7 | from sklearn.feature_extraction.text import TfidfVectorizer
class FeatureCosine:
def compute_matrix(self, df):
vectorizer = TfidfVectorizer(stop_words='english')
tfidf_matrix = vectorizer.fit_transform(df['processed_summary'])
return tfidf_matrix, vectorizer # Return the vectorizer for later use |