Skip to content

About

Semantic knowledge retrieval platform powered by a custom TF-IDF search engine with fuzzy matching, synonym expansion, confidence scoring, and explainable search results.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

AnswerFlow

A blazing-fast, client-side semantic retrieval engine for AI/ML and software engineering knowledge.

AnswerFlow Hero

React Vite Tailwind CSS

Overview

AnswerFlow is a semantic knowledge retrieval platform that performs intelligent, client-side search over a curated technical knowledge base.

Unlike many modern applications that lean heavily on expensive API calls and LLM inference, AnswerFlow relies purely on classical Information Retrieval (IR) and Natural Language Processing (NLP) techniques running entirely in the browser. Its core strength lies in explainable search and instant client-side performance, demonstrating expertise in search engineering, ranking systems, and frontend optimization.

Features

  • Hybrid TF-IDF Retrieval: Combines statistical Term Frequency-Inverse Document Frequency matching with intelligent phrase scoring.
  • Synonym Expansion: Dynamically maps concepts like repo -> repository or ml -> machine learning to improve contextual matches.
  • Fuzzy Typo Correction: Utilizes the Damerau-Levenshtein distance algorithm to silently correct misspelled queries.
  • Phrase Matching: Performs intelligent n-gram overlap and substring matching on user queries without being derailed by stop words.
  • Confidence Scoring: Mathematically calibrates raw search scores into absolute, human-readable confidence percentages.
  • Low-Confidence Detection: Suggests query rephrasings and alternative topics when search results fall below confidence thresholds.
  • Search History & Analytics: Tracks recent searches and visualizes usage inside an analytics dashboard.
  • Category Filtering: Allows users to filter knowledge by precise domains (e.g., Cloud, Cyber, Databases).
  • Offline-First Architecture: Runs 100% within the client browser without external network dependencies.
  • Accessible & Responsive UI: Optimized for all devices with full keyboard navigation and semantic screen-reader support.

Search Engine Architecture

AnswerFlow utilizes a completely bespoke, zero-dependency Javascript search engine.

       [ User Query ]
             │
             ▼
    (1) Normalization
   (Removes punctuation, lowers case, strips stop words)
             │
             ▼
   (2) Synonym Expansion
   (Maps abbreviations and domain terms to canonical concepts)
             │
             ▼
   (3) Fuzzy Correction
   (Damerau-Levenshtein distance corrects typos up to edit distance 2)
             │
             ▼
   (4) Phrase Matching
   (Calculates n-gram coverage across question/answer documents)
             │
             ▼
    (5) TF-IDF Ranking
   (Cosine similarity against precomputed document magnitudes)
             │
             ▼
  (6) Confidence Calibration
   (Maps mathematical raw scores to intuitive 0-100% ranges)
             │
             ▼
 [ Best Match Selection ]

Why AnswerFlow?

Many platforms default to using LLMs for search, which introduces significant latency, hallucination risks, and API costs. AnswerFlow proves the efficacy of purpose-built retrieval systems:

  • No API Costs: Queries are processed locally on the user's machine.
  • No LLM Latency: Results are generated in single-digit milliseconds.
  • No Database: The entire corpus is bundled securely in the client logic.
  • Works Offline: Users have instant access even without an internet connection.
  • Explainable: The exact reasons why a match surfaced are visible, deterministic, and traceable directly from the UI.

Performance

Through deliberate algorithmic optimization—such as precomputing document magnitude vectors rather than dynamically calculating them inside the cosineSim inner loop—AnswerFlow executes queries instantly.

Verified Benchmarks:

  • TF-IDF Optimization: $O(N)$ execution reduction via a static magB vector cache.
  • Query Latency: Global query latency was reduced by ~24%, achieving response times of ~6.1ms to 13.3ms per full-text search query.
  • Confidence Calibration Stability: Maintains consistent 80%+ absolute confidence on high-intent matches regardless of corpus scale.

Tech Stack

  • Framework: React 19
  • Bundler: Vite 8
  • Styling: Tailwind CSS v4
  • Animations: Framer Motion
  • Language: JavaScript (ES6+)

Project Structure

answerflow/
├── public/                 # Static assets
├── src/
│   ├── assets/             # Images and design assets
│   ├── components/         # React UI components (SearchBar, BestAnswer, etc.)
│   ├── data/               # knowledgeBase.js (Search corpus)
│   ├── engine/             # search.js (Custom NLP & retrieval engine)
│   ├── hooks/              # Custom React hooks (useSearch)
│   ├── App.jsx             # Main application shell
│   ├── index.css           # Tailwind design system tokens
│   └── main.jsx            # Entry point
├── benchmark.js            # Node script for latency benchmarking
├── eslint.config.js        # Linter configuration
├── netlify.toml            # Netlify deployment configuration
├── package.json            # Project dependencies
└── vite.config.js          # Build configuration

Installation

# Clone the repository
git clone https://github.com/yourusername/answerflow.git
cd answerflow

# Install dependencies
npm install

# Start local development server
npm run dev

Production Build

# Generate highly optimized static build bundle
npm run build

# Preview production build locally
npm run preview

Deployment

AnswerFlow generates entirely static assets making it incredibly versatile for edge networks:

  • Netlify: Verified support natively configured via netlify.toml
  • Vercel: Fully compatible via static Vite export
  • GitHub Pages: Fully compatible

Accessibility

The AnswerFlow interface adheres to stringent a11y standards:

  • Semantic HTML: Utilizes proper <main>, <header>, and <article> landmark roles.
  • Keyboard Navigation: Implements custom tabIndex, role="tab", and explicit aria-selected toggles for robust keyboard flow.
  • Screen Reader Support: Critical UI badges utilize sr-only visually hidden tags to ensure contextual announcements without cluttering the visual UI.

Future Improvements

  • Larger Knowledge Base: Expanding the dataset dynamically with Web Workers.
  • Embedding-Assisted Retrieval: Investigating WebGPU/ONNX.js to run localized vector embeddings in the browser.
  • Analytics Dashboard Expansion: Adding persistent, cross-session user trend tracking.
  • Knowledge Graph: Visualizing concept relationships within the BestAnswer UI component.

Screenshots

UI search interface and analytics dashboard examples.

Search View

Analytics View

Author

Senior Software Engineer & NLP Director
Specializing in Information Retrieval, Frontend Architecture, and User Experience Design.

About

Semantic knowledge retrieval platform powered by a custom TF-IDF search engine with fuzzy matching, synonym expansion, confidence scoring, and explainable search results.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages