1. Matt Chaput
  2. whoosh
  3. Issues
Issue #218 open

divide by zero error in ReaderCorrector._suggestions

Andrew T
created an issue

when the call to freq returns 0, it causes a divide by zero error in the score calculation

i solved this by taking the max of the freq result and 0.1 but i'm not sure if that's the most appropriate solution

Comments (4)

  1. Matt Chaput repo owner

    Sorry for the delay in replying. If the frequency call returns 0, it's a bug, since that would indicate a mis-match between what's in the index and what's in the word graph. In the code in the repo I inserted an "assert" statement for this so at least the error message will be slightly clearer.

  2. Log in to comment