A web application that analyzes the emotional content of poetry using Natural Language Processing (NLP) techniques.
- Sentiment Analysis: Analyze poems to detect six emotional categories (Anger, Disgust, Fear, Joy, Neutral, Sadness)
- Visualization: View the breakdown of different emotions detected in the text
- NLP Processing: Uses tokenization, stemming, and TF-IDF for text analysis
- User-Friendly Interface: Simple UI for entering poems and viewing results
- Next.js 14 with App Router
- TypeScript
- TailwindCSS for styling
- Natural.js for NLP functionality
- TF-IDF for feature extraction
- Node.js 18 or later
- npm or yarn
- Clone the repository
- Install the dependencies:
npm install
# or
yarn install
- Run the development server:
npm run dev
# or
yarn dev
- Open http://localhost:3000 in your browser
app/
: Next.js app directorycomponents/
: UI componentsdata/
: Sample training data for sentiment analysislib/
: Sentiment analysis algorithmsapi/
: API routes for poem analysis
The sentiment analyzer uses a combination of techniques to determine the emotional content of poetry:
- Preprocessing: The text is tokenized, stopwords are removed, and tokens are stemmed.
- Feature Extraction: TF-IDF is used to identify important words in the text.
- Classification: The preprocessed text is compared against feature words for each emotion.
- Scoring: Scores are calculated for each emotional category, and the dominant emotion is identified.
To improve the sentiment analysis model:
- Increase the training dataset size with more examples of each emotion
- Implement more sophisticated ML models (e.g., neural networks)
- Add additional features like n-grams or word embeddings
- Integrate with external NLP APIs for more robust analysis
MIT