Bug in class BestMatch(LogicAdapter)
I cannot understand why best match adapter works this way:
- It uses the "bigram" search to match entries from the database to the input statement.
- Then it uses Levenshtein distance, to get the closest match to the input statement.
So far, so good, we get something from the db with a confidence. If nothing is found in the db, we get the input statement.
And then: 3) A response is searched for the best match. The field 'search_in_response_to' is used.
But why? We have an exact "text" from the database with a confidence. Going back to bigrams throws away all job done by Levenshtein distance, and re-collects everything that Levenshtein distance filtered!
As a result, you get back irrelevant answers, especially for short questions.
- And then, the input statement is searched as an alternative. Right now, this will never be executed.
What I propose is before trying steps 3 & 4, to just do an exact search on 'in_response_to'.
And to split the "process" method in submethods, so subclassing should be easier :-)
Source: gunthercox/ChatterBot