COURSE / REAL PRACTICE
Search your own documents
Build and evaluate a local Python search engine: stable document IDs, Unicode tokens, inverted indexes, ranked results and retrieval metrics.
Read the explanation and diagrams, then work through the practice. Your browser profile supplies your saved progress.
What you’ll work toward
Build a complete searchable-notes CLI with explicit tokenization, an inverted index, deterministic TF–IDF-style ranking, bounded plain-text snippets and a reproducible relevance evaluation.
Read an explanation, inspect the diagrams and work through the available checks, debugging exercises and builds. Feedback and prerequisite links guide the next step.
Before you start
This course builds on these skills:
Individual lessons can add prerequisites. Your lesson progress shows your actual readiness.
A look inside the first lesson
Document identity and a reproducible corpus
ids = ['A', 'a', 'A']
print(len(ids), len(set(ids)))
print(' a ' == 'a')Your lesson sequence
Follow the same units and lessons in either view. Prerequisite links and your practice progress stay with each lesson.
Documents, terms and postings
- LESSON 01.01
Document identity and a reproducible corpus
Validate a small document corpus, keep opaque IDs separate from searchable text, and preserve a stable snapshot for evaluation.
Open lesson - LESSON 01.02
One token policy for documents and queries
Apply explicit Unicode normalization and case folding, preserve token multiplicity, and use the same boundaries for queries and documents.
Open lesson - LESSON 01.03
An inverted index with counts and document lengths
Map each term to the documents that contain it, count occurrences per document, and retain empty documents in corpus statistics.
Open lesson
Ranking, presentation and measurement
- LESSON 02.01
Rank matches with frequency and rarity
Combine length-normalized term frequency with a stated smoothed rarity weight, deduplicate query terms, and order ties by document ID.
Open lesson - LESSON 02.02
Stable result records and bounded plain-text snippets
Join ranked IDs back to the corpus, preserve their order, and build compact plain-text previews without treating document text as HTML.
Open lesson - LESSON 02.03
Evaluate retrieval with labeled queries
Measure precision at a stated cutoff, recall and reciprocal rank against independent relevance labels, including empty and incomplete-result cases.
Open lesson