This project involves training a neural network to perform sentiment analysis on a dataset of labeled product reviews, classifying them as positive or negative. The trained model is integrated into a web application for real-time sentiment analysis using FastAPI for the backend and a simple JavaScript page for entering reviews and displaying results.
Before you begin, make sure you have the following installed:
- Python 3.7 or higher
- pip (Python package installer)
git clone https://github.com/sergey-chek/sentiment-analysis-isy503.git
cd sentiment-analysis-isy503
python3 -m venv venv
In some cases it could be
python -m venv venv
- Windows:
.\venv\Scripts\activate
- MacOS and Linux:
source venv/bin/activate
pip install -r requirements.txt
The following command will start the FastAPI server on http://127.0.0.1:8000/
by default.
uvicorn main:app --reload
Note
If you use a different port for the server, make sure to update the API_ENDPOINT
variable in static/script.js
to match the correct port.
Open your web browser and navigate to http://127.0.0.1:8000/
(or to your custom endpoint).
- Ensure that the training data files are placed in the
model/import-data
folder. - To prepare a combined .csv file and perform spelling correction, run the
model.prepare
module using command:
python3 -m model.prepare
- For subsequent data cleaning, run the
model.clean
module using command:
python3 -m model.clean
- For model training, run the
model.train
module using command:
python3 -m model.train
The trained model will be saved in the model/trained-model
directory.
This project is licensed under the MIT License.
This project was developed as part of the ISY503 Intelligent Systems course at Torrens University of Australia.