Anshul-ydv/sentiment-analysis-of-rare-metals
Sentiment analysis tool that classifies financial news headlines related to rare elements as Positive, Negative, or Neutral using machine learning and NLP.
๐ Sentiment Analysis of Rare Elements in News Headlines
This project performs sentiment analysis on financial news headlines related to rare elements using Natural Language Processing (NLP) techniques. The goal is to classify the sentiment (Positive, Negative, Neutral) of headlines and understand how news sentiment can affect the market performance of rare elements.
๐ Project Structure
sentimentofrarelements.ipynb # Main Jupyter Notebook with full pipeline
requirements.txt # List of dependencies
README.md # Project overview and setup guide
๐ Features
-
Real-time scraping of financial news headlines using
newsapi -
Text preprocessing and cleaning
-
Sentiment labeling using TextBlob
-
Model training using:
- Logistic Regression
- Random Forest
- Support Vector Machine
-
Model evaluation using accuracy and confusion matrix
-
Sentiment prediction for new/unseen headlines
๐ฆ Installation
- Clone the repository:
git clone https://github.com/Anshul-ydv/sentiment-analysis-of-rare-metals.git
cd sentimentofrarelements- Install dependencies:
pip install -r requirements.txt๐ง Usage
-
Run the notebook:
- Open
sentimentofrarelements.ipynbin Jupyter Notebook or Google Colab. - Execute each cell sequentially.
- Open
-
To test new headlines:
- Replace the example headlines in the input cell with your own.
- Run the prediction cell to see the sentiment.
๐ Example Output
| Headline | Predicted Sentiment |
|---|---|
| "Rare earth prices surge amid supply concerns" | Positive |
| "Demand for rare metals declines in Q1" | Negative |
๐ ๏ธ Technologies Used
- Python
- Pandas, NumPy
- Scikit-learn
- TextBlob
- Matplotlib / Seaborn
- NewsAPI
๐งช Future Work
- Use more advanced models like BERT or RoBERTa
- Integrate a live dashboard for sentiment tracking
- Analyze correlation with market prices of rare elements
๐ License
This project is licensed under the MIT License.