Fix searching issues with classifier-reborn #77
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request should handle issues #64 and #75, mostly by throwing up human-readable error messages. Error messages aren't cool, but they're more graceful than programs crashing.
Issue #64 is caused by adding "invalid" documents beforehand, and we resolve this by rejecting those "invalid" documents before they could cause problems later on for the end-user. If you try to search a corpus of documents that include "invalid" documents, the program will crash. If you try to find related phrases, it won't crash and you'll still get results. However, I would still recommend rejecting "invalid" documents outright because these invalid documents adds noise that can narrowly impact the LSI's results.
Issue #75 is caused by attempting to search through a corpus for a term that does not exist within the corpus. We resolve this issue by rejecting the search term outright. The user here knows that no document has the search term in question, and will be able to move on with their lives. This bug fix only works if you have GSL...otherwise, you just get the built-in "Cannot Normalize Zero Vector" error (which isn't a user-friendly error message, but it does stop invalid searches).
Let me know if these changes are appropriate or if you have your own suggestions.