Views
No views yet
tfidf.py, svm.py and data_cleaning.py.
pip install nltk beautifulsoup4 scikit-learn pandas datasets fsspec huggingface_hub1import nltk
2nltk.download('stopwords')
3nltk.download('wordnet')
4nltk.download('omw-1.4')1from data_cleaning import clean
2import pandas as pd
3import nltk
4nltk.download('stopwords')pd.read_csv().1
2df = pd.read_csv("hf://datasets/CIS5190abcd/headlines_test/test_cleaned_headlines.csv")
3
4
5cleaned_df = clean(df)
61from tfidf import tfidf
2
3
4X_new_tfidf = tfidf.transform(cleaned_df['title'])
51
2from svm import svm_model
3git clone https://huggingface.co/CIS5190abcd/svmcd svmls to check the files inside svm folder. Make sure tfidf.py, svm.py and data_cleaning.py are existing in this directory. If not, run the folloing commands:git checkout origin/main -- tfidf.py
git checkout origin/main -- svm.py
git checkout origin/main -- data_cleaning.pyls, double check all the required files(tfidf.py, svm.py and data_cleaning.py) are existing. Should look like this:
pip install nltk beautifulsoup4 scikit-learn pandas datasets fsspec huggingface_hubpython1import nltk
2nltk.download('stopwords')
3nltk.download('wordnet')
4nltk.download('omw-1.4')1from data_cleaning import clean
2import pandas as pd
3import nltk
4nltk.download('stopwords')pd.read_csv().1
2df = pd.read_csv("hf://datasets/CIS5190abcd/headlines_test/test_cleaned_headlines.csv")
3
4
5cleaned_df = clean(df)
61from tfidf import tfidf
2
3
4X_new_tfidf = tfidf.transform(cleaned_df['title'])
51
2from svm import svm_model
3exit() if you want to leave python.cd ..if you want to exit svm directory.