--- name: ask-hormozi slug: ask-hormozi --- # ask-hormozi Build a searchable, cited Q&A index from any text corpus. Query with semantic relevance scoring and automatic source citations. ## What It Does **ask-hormozi** is a local-first citation tool that turns books, podcasts, articles, and transcripts into a searchable knowledge base. You provide text files (or `.vtt` video transcripts), build an index, then query it with natural language. Every answer comes with the exact source, page/chunk, and excerpt. - No API calls, no vendor lock-in, no rate limits - TF-IDF semantic search finds the most relevant passages - Automatic citations: every result shows source file, type, and location - Plain Python + scikit-learn, runs entirely offline ## Use Cases - Quote books and podcasts accurately with sources - Build a FAQ/knowledge index from documentation - Create a research tool for your personal learning library - Cite video transcripts in writing projects - Search through your own content libraries ## Install 1. **Get the repo** — Clone or download the repository files (`build_index.py`, `query.py`) 2. **Install dependencies** ```bash pip install scikit-learn numpy ``` 3. **Prepare your transcripts** — Create a `transcripts/` folder and add `.txt` (plain text) or `.vtt` (video captions) files ```bash mkdir transcripts/ # Copy your source files here ``` 4. **Build the index** ```bash python3 build_index.py --transcript-dir ./transcripts # Creates: index.json ``` ## Usage ```bash python3 query.py "your question here" ``` Results show the top 5 most relevant passages with relevance score and exact source. ### Custom Index Location ```bash python3 query.py --index-file my_index.json "what was the key insight?" ``` ### Rebuild After Adding Transcripts ```bash python3 build_index.py --transcript-dir ./transcripts --chunk-size 400 ``` Flags: - `--chunk-size N` — Words per chunk (default 500). Lower = more specific, higher = more context. ## How It Works 1. **Index building** reads `.txt` files and `.vtt` transcripts, chunks the text (~500 words per chunk by default), and builds a searchable index with TF-IDF vectors 2. **Search** converts your query to a TF-IDF vector and scores each chunk by cosine similarity 3. **Results** show top matches ranked by relevance (0–1 score), with the source file, chunk number, and excerpt ## Example ```bash $ python3 query.py "what are the key phases of pricing strategy" Searching for: "what are the key phases of pricing strategy" ====================================================================== 1. [Text] Chapter 5 - Pricing Strategy (chunk 3) Score: 0.834 The first phase involves understanding your baseline costs. The second phase focuses on market positioning relative to competitors. The third phase tests... 2. [Video] Podcast Episode 42 - Pricing (Video - chunk 7) Score: 0.721 Pricing in three steps: understand costs, know your market, test relentlessly... ====================================================================== Found 2 relevant passages. Use these cited excerpts in your research. ``` ## Input Formats - **`.txt`** — Plain text transcripts (UTF-8) - **`.vtt`** — WebVTT video transcripts (YouTube captions format) Filenames become source titles automatically. ## Performance - Indexing: ~10–100 MB of text in <5 seconds - Queries: ~0.1–1 second per search - Index size: ~20–30% of original text ## Limits & Tips - Works best with Latin-script text (English, Spanish, French, etc.) - TF-IDF may miss synonyms ("expensive" vs "costly") — for advanced semantic search, upgrade to sentence embeddings - Large indexes (>100k chunks) slow down search — consider splitting into multiple indexes - Chunk size balances specificity vs. context — start at 500 words, adjust based on your use case ## No Copyright Built In This tool is **generic and format-agnostic**. You provide your own transcripts, content, and materials. It ships with zero copyrighted content. Use only with: - Books/audiobooks you own or have rights to analyze - Your own podcasts, videos, or articles - Public-domain or licensed content - Transcripts you created ## License MIT. Free to use, modify, share.