# devashi-choudhary/automated-chatbot-for-college-queries architecture

> Architecture diagram of the GitHub repository devashi-choudhary/automated-chatbot-for-college-queries, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/devashi-choudhary/automated-chatbot-for-college-queries
- Repository: https://github.com/devashi-choudhary/automated-chatbot-for-college-queries

## Overview

##### Project Type & Purpose
- This is an NLP research/tool repository for an automated chatbot that answers college-related questions by computing semantic similarity between user queries and a private QA dataset.
- There is no web frontend or service layer – it’s a CLI/python-script toolkit that loads data, cleans it, vectorizes text with multiple embedding models, computes similarity scores, and returns the most relevant answer.

##### File Structure Analysis
– Top-level scripts each implement one similarity approach:
- Cosine_Similarity.py
- doc2vec.py
- fasttext+wmdistance.py
- glove.py
- word2vec+wm distance.py
– README.md holds project description, dataset details, dependencies, and execution instructions.
– No subdirectories or service/config files – it’s a single-module pipeline per script.

##### Key Architectural Insights from README
– Data Collection & Cleaning stages precede modeling.
– Each script loads the same cleaned Q-A dataset.
– Multiple NLP libraries (NLTK, gensim, glove, pyemd, scikit-learn) supply tokenization, embedding, and distance functions.
– The outcome of each script is a similarity ranking between an input question and candidate answers.

a. Main Components
1. Input Interface (CLI argument or prompt)
2. Data Loader & Preprocessor
– Cleans text (removes slang, non-alphanumeric chars)
3. Embedding Modules
– Word2Vec
– GloVe
– FastText
– Doc2Vec
– TF-IDF Vectorizer
4. Similarity Computation
– Cosine similarity
– Word Mover’s Distance (via pyemd)
5. Result Aggregator & Selector
6. Output (console print of best answer)
7. External: Private dataset store
b. Relationships & Data Flow
– Loader → Preprocessor → each Embedding Module
– Each Embedding Module → Similarity Computation
– All similarity scores → Aggregator → Output
– The dataset store → Loader
c. Architectural Patterns & Principles
– Modular “one-script-per-model” design for easy comparison/extension
– Shared preprocessor to enforce consistency across models
– Separation of concerns: data, embedding, similarity, aggregation
d. Technologies & Libraries
– Python 3.6+
– NLTK (tokenization, stopwords)
– gensim (Word2Vec, Doc2Vec, FastText)
– glove-python or similar wrapper
– scikit-learn (TfidfVectorizer)
– pyemd (Word Mover’s Distance)
– numpy, pandas for data handling

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Data Store
    Dataset["Private QA Dataset"]:::external
    click Dataset "https://github.com/devashi-choudhary/automated-chatbot-for-college-queries/blob/master/README.md"

    %% Data / IO Layer
    subgraph "Data / IO" 
        direction TB
        Input["Input Interface\n(CLI)"]:::dataio
        click Input "https://github.com/devashi-choudhary/automated-chatbot-for-college-queries/blob/master/Cosine_Similarity.py"
        click Input "https://github.com/devashi-choudhary/automated-chatbot-for-college-queries/blob/master/doc2vec.py"
        click Input "https://github.com/devashi-choudhary/automated-chatbot-for-college-queries/blob/master/fasttext+wmdistance.py"
        click Input "https://github.com/devashi-choudhary/automated-chatbot-for-college-queries/blob/master/glove.py"
        click Input "https://github.com/devashi-choudhary/automated-chatbot-for-college-queries/blob/master/word2vec+wm distance.py"

        Loader["Data Loader & Preprocessor"]:::preprocess
        click Loader "https://github.com/devashi-choudhary/automated-chatbot-for-college-queries/blob/master/Cosine_Similarity.py"
        click Loader "https://github.com/devashi-choudhary/automated-chatbot-for-college-queries/blob/master/doc2vec.py"
        click Loader "https://github.com/devashi-choudhary/automated-chatbot-for-college-queries/blob/master/fasttext+wmdistance.py"
        click Loader "https://github.com/devashi-choudhary/automated-chatbot-for-college-queries/blob/master/glove.py"
        click Loader "https://github.com/devashi-choudhary/automated-chatbot-for-college-queries/blob/master/word2vec+wm distance.py"
    end

    %% Embedding Modules
    subgraph "Embedding Modules" 
        direction TB
        TFIDF["TF-IDF Vectorizer"]:::embedding
        click TFIDF "https://github.com/devashi-choudhary/automated-chatbot-for-college-queries/blob/master/Cosine_Similarity.py"

        Doc2Vec["Doc2Vec"]:::embedding
        click Doc2Vec "https://github.com/devashi-choudhary/automated-chatbot-for-college-queries/blob/master/doc2vec.py"

        FastText["FastText"]:::embedding
        click FastText "https://github.com/devashi-choudhary/automated-chatbot-for-college-queries/blob/master/fasttext+wmdistance.py"

        GloVe["GloVe"]:::embedding
        click GloVe "https://github.com/devashi-choudhary/automated-chatbot-for-college-queries/blob/master/glove.py"

        Word2Vec["Word2Vec"]:::embedding
        click Word2Vec "https://github.com/devashi-choudhary/automated-chatbot-for-college-queries/blob/master/word2vec+wm distance.py"
    end

    %% Similarity Computation
    subgraph "Similarity Computation"
        direction TB
        CosSim["Cosine Similarity"]:::similarity
        click CosSim "https://github.com/devashi-choudhary/automated-chatbot-for-college-queries/blob/master/Cosine_Similarity.py"

        WMD["Word Mover’s Distance"]:::similarity
        click WMD "https://github.com/devashi-choudhary/automated-chatbot-for-college-queries/blob/master/fasttext+wmdistance.py"
        click WMD "https://github.com/devashi-choudhary/automated-chatbot-for-college-queries/blob/master/word2vec+wm distance.py"
    end

    %% Aggregation & Output
    subgraph "Result & Output"
        direction TB
        Aggregator["Result Aggregator & Selector"]:::output
        click Aggregator "https://github.com/devashi-choudhary/automated-chatbot-for-college-queries/blob/master/Cosine_Similarity.py"
        click Aggregator "https://github.com/devashi-choudhary/automated-chatbot-for-college-queries/blob/master/doc2vec.py"
        click Aggregator "https://github.com/devashi-choudhary/automated-chatbot-for-college-queries/blob/master/fasttext+wmdistance.py"
        click Aggregator "https://github.com/devashi-choudhary/automated-chatbot-for-college-queries/blob/master/glove.py"
        click Aggregator "https://github.com/devashi-choudhary/automated-chatbot-for-college-queries/blob/master/word2vec+wm distance.py"

        Output["Output (Console Print)"]:::output
        click Output "https://github.com/devashi-choudhary/automated-chatbot-for-college-queries/blob/master/Cosine_Similarity.py"
        click Output "https://github.com/devashi-choudhary/automated-chatbot-for-college-queries/blob/master/doc2vec.py"
        click Output "https://github.com/devashi-choudhary/automated-chatbot-for-college-queries/blob/master/fasttext+wmdistance.py"
        click Output "https://github.com/devashi-choudhary/automated-chatbot-for-college-queries/blob/master/glove.py"
        click Output "https://github.com/devashi-choudhary/automated-chatbot-for-college-queries/blob/master/word2vec+wm distance.py"
    end

    %% Data Flow Connections
    Dataset -->|“raw Q-A data”| Loader
    Input -->|“user question”| Loader
    Loader -->|“clean tokens”| TFIDF
    Loader -->|“clean tokens”| Doc2Vec
    Loader -->|“clean tokens”| FastText
    Loader -->|“clean tokens”| GloVe
    Loader -->|“clean tokens”| Word2Vec

    TFIDF -->|“vectors”| CosSim
    Doc2Vec -->|“vectors”| CosSim
    FastText -->|“vectors”| WMD
    Word2Vec -->|“vectors”| WMD
    GloVe -->|“vectors”| CosSim

    CosSim -->|“cosine scores”| Aggregator
    WMD -->|“WMD scores”| Aggregator

    Aggregator -->|“best answer”| Output

    %% Styles
    classDef dataio fill:#D0E6F8,stroke:#0366D6,color:#0366D6;
    classDef preprocess fill:#FFE6CC,stroke:#E69500,color:#E69500;
    classDef embedding fill:#DFF2DD,stroke:#2C8F2C,color:#2C8F2C;
    classDef similarity fill:#E8DFF8,stroke:#872C8F,color:#872C8F;
    classDef output fill:#F0F0F0,stroke:#606060,color:#606060;
    classDef external fill:#CCE5FF,stroke:#3399FF,color:#3399FF;
```
