Checking Speller

Open-source projects (whose source code is, by definition, open to anyone) are commonly stored on sites like GitHub, where other programmers can not only view the code but also open “issues” to report problems (or request features). Suppose, in fact, that @dmalan has recently pushed his implementation of Speller, in Python, to the GitHub repository at But he’s already noticed some issues with his own code, per

For each of the issues below, explain how resolve it in no more than three sentences, citing line numbers and proposing new lines of code as appropriate. Take care not to introduce any bugs!

  1. (2 points.) File is never closed in load function
  1. (2 points.) Capitalized words are always considered misspelled
  1. (2 points.) Implementation of check is longer than it needs to be
  1. (2 points.) Determining size of dictionary always takes linear time
  1. (2 points.) Checking words always takes linear time

If you’d like to download the repository’s code into your codespace, execute, e.g.:


If you’d like to run the (buggy) code, execute, e.g.:

cd speller-main
python dictionaries/large texts/lalaland.txt