How findtharun/railway_bot works
Project Type and Purpose
• This is an AI/NLP prototype chatbot built in Python (Jupyter notebooks), intended to handle railway‐ticket booking queries via text or speech.
• Major features: intent classification (TensorFlow), speech recognition, sentiment analysis, custom thresholding, and a feedback loop.
File Structure
Top level:
• Chatbot use cases..pdf – design/use‐case documentation
• RailwayBot.ipynb – main chatbot pipeline (input → model → response)
• RailwayBot_SpeechRecognition.ipynb – notebook extension showing speech→text integration
• sentiment Analysis.ipynb – notebook demonstrating feedback sentiment module
• intents.json – the corpus of user intents/patterns + responses
• feedback.xlsx – storage for user feedback data
Key Architecture Components
a. User Interface Layer
• Text input (CLI or GUI)
• Speech input (microphone) → Speech Recognition module (e.g., Python speech_recognition)
b. Preprocessing / NLU Layer
• Punkt Sentence Tokenizer (NLTK)
• Text Normalization: lowercasing, punctuation removal
• Stemming & Lemmatization (NLTK or custom)
• Vocabulary & feature engineering (TF‑IDF from scratch)
c. Intent Classification Module
• Features → Neural Network (TensorFlow)
• Custom thresholding to filter low‑confidence predictions
• intents.json as knowledge base (patterns → intent tags → responses)
d. Response Generation
• Predicted intent to canned response templates
• Optionally slot‑fill or prompt for missing info (source, destination, date)
e. Feedback & Sentiment Analysis
• User feedback post‑conversation → store in feedback.xlsx
• Sentiment Analysis notebook (NLTK/Vader or custom) to gauge satisfaction
• Sentiment scores feed back into model re‑training or threshold adjustment
f. Model Training / Offline Batch
• Shuffle & vectorize documents → np.array features
• Train TensorFlow model using gradient descent
• Export trained model weights for runtime inference
Architectural Patterns & Tech Stack
• Pipeline pattern: a linear sequence of processing stages
• Batch training vs. real‑time inference separation
• Key libraries: TensorFlow, NLTK, speech_recognition, JSON for intents, pandas/xlsx for feedback
Essential Elements
• Data stores: intents.json (knowledge base), feedback.xlsx
• Clear labels and notes (e.g., “Threshold filter applied here,” “TensorFlow neural network”)