Built Logistic regression, SVM, Naive Bayes, RandomForest, KNN for text classification on scrapped news data. Built Text rank, LDA and K-means clustering for text summarization.
Classifying the news articles into 4 categories namely Health, Business, Entertainment, Technology using the following ML models:
Summarize the news articles using Extractive text summarization ( selecting top sentences from the article)
Scrapped news articles from urls provided by UCI Machine Learning repository link
For scrapping the news articles, Newspaper3k
library built in Python was used. The library contains nlp()
method using which keywords and summary of the news article can be extracted.
Article’s content and summary have been scrapped to create the data for the project. Code
The following libraries of Python have to be installed: pandas
, sklearn
, ntlk
, newspaper3k
Run the following command to installpip install -r requirements.txt
Raw text has unwanted characters (\n,\t,$ etc) and contains stop words (a, an, the) which has to removed before generating the vector representation. The following text preprocessing techniques have been used:
S.no | Model | Accuracy in % (BoW) | Accuracy in % (Tf-idf) |
---|---|---|---|
1. | Logistic regression | 95.2 | 94.7 |
2. | SVM | 94.8 | 95.2 |
3. | Naive Bayes | 94.69 | 94.54 |
4. | Random forest | 92.2 | 92.05 |
5. | K-NN | 94.3 | 94.59 |
S.no | Model | Rouge-1 |
---|---|---|
1. | Text rank | 59.2 |
2. | K-means clustering | 54.7 |
3. | Latent semantic analysis | 52.1 |