Skip to content

CamBurrows/Python-NLP-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

NLP Word Analyzer

A full-stack natural language processing application that provides comprehensive word analysis using Vue.js frontend and Python Flask backend with NLTK.

NLP Word Analyzer Vue.js Python Flask Vuetify

πŸš€ Features

πŸ” Comprehensive Word Analysis

  • Part of Speech Identification - Accurate grammatical categorization
  • Synonyms & Antonyms - Extensive word relationship mapping
  • Definitions - Clear, contextual word meanings
  • Example Sentences - Real-world usage demonstrations

🎨 Beautiful User Interface

  • Material Design - Clean, modern Vuetify-based UI
  • Responsive Layout - Perfect on desktop, tablet, and mobile
  • Dark/Light Themes - Seamless theme switching
  • Smooth Animations - Polished user experience
  • Real-time Feedback - Instant loading states and error handling

πŸ›  Technical Excellence

  • RESTful API - Clean, documented endpoints
  • Error Handling - Comprehensive error management
  • Input Validation - Robust client and server-side validation
  • CORS Support - Cross-origin resource sharing enabled
  • Health Monitoring - API status tracking

πŸ“‹ Prerequisites

  • Python 3.13 with pip
  • Node.js 16+ with npm
  • Git (for cloning)

⚑ Quick Start

Local Development

1. Clone the Repository

git clone <repository-url>
cd nlp-app

2. Backend Setup (Python Flask + NLTK)

cd backend
pip install -r requirements.txt
python app.py

Backend will start at http://localhost:5000

3. Frontend Setup (Vue.js + Vuetify)

cd ../frontend
npm install
npm run serve

Frontend will start at http://localhost:8080

4. Open Your Browser

Navigate to http://localhost:8080 and start analyzing words!

πŸ— Project Structure

nlp-app/
β”œβ”€β”€ backend/                 # Python Flask API
β”‚   β”œβ”€β”€ app.py              # Main Flask application
β”‚   β”œβ”€β”€ requirements.txt    # Python dependencies
β”‚   └── README.md          # Backend documentation
β”‚
β”œβ”€β”€ frontend/               # Vue.js Application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/     # Vue components
β”‚   β”‚   β”‚   β”œβ”€β”€ WordInput.vue
β”‚   β”‚   β”‚   └── AnalysisResult.vue
β”‚   β”‚   β”œβ”€β”€ services/       # API services
β”‚   β”‚   β”‚   └── nlpService.js
β”‚   β”‚   β”œβ”€β”€ plugins/        # Vue plugins
β”‚   β”‚   β”‚   └── vuetify.js
β”‚   β”‚   β”œβ”€β”€ App.vue         # Root component
β”‚   β”‚   └── main.js         # App entry point
β”‚   β”œβ”€β”€ public/             # Static assets
β”‚   β”œβ”€β”€ package.json        # Node dependencies
β”‚   └── README.md          # Frontend documentation
β”‚
└── README.md              # This file

πŸ”§ API Endpoints

POST /api/analyze

Analyze a word and return comprehensive linguistic information.

Request:

{
    "word": "beautiful"
}

Response:

{
    "word": "beautiful",
    "partOfSpeech": "Adjective",
    "definition": "delighting the senses or exciting intellectual or emotional admiration",
    "synonyms": ["lovely", "attractive", "gorgeous", "stunning"],
    "antonyms": ["ugly", "hideous", "unattractive"],
    "exampleSentence": "The weather is very beautiful today.",
    "success": true
}

GET /api/health

Check API health status.

Response:

{
    "status": "healthy",
    "message": "NLP API is running"
}

🎯 Usage Examples

  1. Basic Word Analysis:

    • Enter "happy" β†’ Get part of speech, synonyms like "joyful", "cheerful"
    • Enter "run" β†’ See verb forms, related words, example usage
  2. Complex Words:

    • Enter "serendipitous" β†’ Discover meaning, sophisticated synonyms
    • Enter "ephemeral" β†’ Learn definition, find related concepts
  3. Different Parts of Speech:

    • Nouns: "freedom", "innovation", "symphony"
    • Verbs: "create", "analyze", "discover"
    • Adjectives: "magnificent", "intricate", "luminous"
    • Adverbs: "gracefully", "thoroughly", "efficiently"

πŸ›  Development

Backend Development

  • Framework: Flask with CORS support
  • NLP Library: NLTK for comprehensive text processing
  • Data Sources: WordNet for definitions, synonyms, antonyms
  • API Design: RESTful with JSON responses

Frontend Development

  • Framework: Vue.js 3 with Composition API
  • UI Library: Vuetify 3 (Material Design)
  • HTTP Client: Axios for API communication
  • Styling: Material Design Icons, custom CSS

Key Dependencies

Backend:

  • flask - Web framework
  • nltk - Natural language processing
  • flask-cors - Cross-origin resource sharing

Frontend:

  • vue - JavaScript framework
  • vuetify - Material Design components
  • axios - HTTP client
  • @mdi/font - Material Design Icons

🎨 Design Philosophy

User Experience

  • Simplicity First: Clean, uncluttered interface
  • Immediate Feedback: Real-time loading and error states
  • Visual Hierarchy: Clear information organization
  • Accessibility: Proper contrast, keyboard navigation

Technical Approach

  • Separation of Concerns: Independent frontend and backend
  • Scalable Architecture: Modular component design
  • Error Resilience: Graceful error handling and recovery
  • Performance: Optimized API calls and rendering

πŸš€ Production Deployment

Backend Deployment

# Using Gunicorn (recommended)
pip install gunicorn
gunicorn -w 4 -b 0.0.0.0:5000 app:app

# Or using Flask development server (not for production)
python app.py

Frontend Deployment

# Build for production
npm run build

# Serve static files with your preferred web server
# (nginx, Apache, or any static hosting service)

☁️ AWS Cloud Deployment

This application is designed to be deployed on AWS using serverless architecture:

Backend Deployment (AWS Lambda + API Gateway)

cd backend

# Create NLTK data layer
./create_nltk_layer.sh  # Linux/Mac
# or
create_nltk_layer.bat   # Windows

# Deploy with SAM CLI
sam build
sam deploy --guided

See backend/DEPLOYMENT.md for detailed instructions.

Frontend Deployment (AWS Amplify)

  1. Update frontend/.env.production with your Lambda API URL
  2. Deploy via AWS Amplify Console by connecting your Git repository
  3. Amplify will automatically use the amplify.yml configuration

See frontend/AMPLIFY_DEPLOYMENT.md for detailed instructions.

Environment Variables

  • Backend: FRONTEND_URL for CORS configuration
  • Frontend: VUE_APP_API_URL for API endpoint

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • NLTK Team - Comprehensive natural language processing toolkit
  • Vue.js Community - Excellent frontend framework
  • Vuetify Team - Beautiful Material Design components
  • WordNet - Lexical database for English language

Built with ❀️ using Vue.js, Python, and Natural Language Processing

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published