divide by zero error in ReaderCorrector._suggestions

scyclops avatarscyclops 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

    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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.