Skip to content

Add query typo correction with a Settings toggle - #137

Draft
arjunj05 wants to merge 1 commit into
georgia-tech-db:mainfrom
arjunj05:feature/typo-correction
Draft

arjunj05 wants to merge 1 commit into
georgia-tech-db:mainfrom
arjunj05:feature/typo-correction

Conversation

@arjunj05

Copy link
Copy Markdown

Builds a per-material vocabulary of high-frequency textbook words at index time and uses it to repair likely typos in retrieval queries. Off by default; controlled by Settings > Advanced > Typo Correction.

Comment thread python_engine/tokensmith_engine.py Outdated
return None, "The installed embedding model did not match the collection index."
return embed_text, None

# Fallback: a legacy/imported collection whose stored key digest does not line

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears unrelated to typo correction. Could you clarify why it is included in this PR? If it is not required for this feature, could we move it to a separate PR?

for material_id in material_ids:
vocab = None if VOCAB_FORCE_REBUILD else load_vocabulary(user_data_path, material_id)
if vocab is None:
texts = iter_chunk_texts(user_data_path, [material_id])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For an already-indexed large material, the first search after enabling this feature loads all stored chunks and builds its vocabulary before retrieval can continue. This could surprise users, who may interpret the delay as slower search rather than one-time setup.

Could we build the vocabulary when the feature is enabled, ideally with progress feedback, or at least tell users that the first search may have a one-time setup delay?

Indexing records a per-material list of high-frequency textbook words,
and retrieval repairs likely typos in a query against it before
searching, so a misspelled term still reaches the right passages.

Off by default, controlled by Settings > Advanced > Typo Correction.
Enabling it builds any missing vocabularies up front rather than leaving
the first search to pay for the build; retrieval still builds one on
demand for materials added later.
@arjunj05
arjunj05 force-pushed the feature/typo-correction branch from ca724c8 to c98abae Compare September 23, 2026 00:54
@arjunj05
arjunj05 marked this pull request as draft September 23, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants