Spaces:
No application file
No application file
Download src/code/feature_engineering_cosine.py from Dashpreetsinghofficial/Flytxt_Assignment: direct link, hf CLI and curl.
- Browser
- Download file 326 Bytes
-
https://huggingface.co/spaces/Dashpreetsinghofficial/Flytxt_Assignment/resolve/main/src/code/feature_engineering_cosine.py
- Command line
-
hf download hf://spaces/Dashpreetsinghofficial/Flytxt_Assignment/src/code/feature_engineering_cosine.py
-
curl -L -o feature_engineering_cosine.py https://huggingface.co/spaces/Dashpreetsinghofficial/Flytxt_Assignment/resolve/main/src/code/feature_engineering_cosine.py
326 Bytes
| 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 |