{
  "id": 2007365,
  "title": "\"Did you mean...?\" — autocomplete and spelling correction in pure Python (no external services)",
  "url": "https://urgent.news/2026/08/19/did-you-mean-autocomplete-and-spelling-correction-in-pure-python-no",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-08-19T19:36:49.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/priyasundaram/did-you-mean-autocomplete-and-spelling-correction-in-pure-python-no-external-services-17i5"
  },
  "original_language": "en",
  "account": "Autocomplete and spelling correction are essential features for search boxes that automatically suggest what the user is typing and correct misspelled words. Instead of relying on external services like Elasticsearch or hosted APIs, these features can be implemented using a pure Python library called Whoosh.\n\nWhoosh is a full-text search library that works without compiled extensions or server components, making it suitable for small-to-medium-sized applications. To use Whoosh for autocomplete and spelling correction, you first create an index with an inverted index and enable the spelling feature for specific fields.\n\nFor spelling correction, Whoosh creates a word graph for each field, allowing it to suggest real words from the index that will likely return results. By calling the corrector on a query term, you can get suggestions limited to three options. These suggestions are drawn from indexed terms and ranked by edit distance and term frequency.\n\nTo implement autocomplete, Whoosh can walk the term list for a field starting at a given prefix, ranking the results by frequency. This allows the library to suggest the most common completions first, providing a seamless user experience without the need for external services.",
  "summary": "Search boxes that only match exactly what you typed feel broken. Type pythn and get nothing; forget the last two letters of a word and get nothing. The two features that fix this — autocomplete (suggest as you type) and \"did you mean?\" spelling correction — are usually where people reach for Elasticsearch or a hosted API. You don't need either for a small-to-medium app. Both fall out of an…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}