silentrob / superscript-editor

NOT MAINTAINED - A Editor for authoring chatbots with SuperScript
MIT License
27 stars 16 forks source link

Question matching bug #17

Open mariusursache opened 9 years ago

mariusursache commented 9 years ago

From #14:

Question trigger works for "Any question" and has an interesting way of defining what a question is. "What is this" triggers it even without a question mark at the end. "Really?" is not considered a question. "How are you?" does not trigger it though...

This is indeed a bug. I went back and forth between building a bayes classifier and using rules. I found I could get better results with a rule based approach, but as you can tell it is not perfect. Take a peek at https://github.com/silentrob/qtypes (https://github.com/silentrob/qtypes/blob/master/lib/ruleClassify.js#L302-L321) to see how that works under the hood.

I think that maybe adding an extra rule that considers any trigger ending in ? as a question could solve the problem temporarily. So questions are all triggers matching the qtype rules, plus everything ending in ?.

silentrob commented 9 years ago

Interesting, so this is happening further up the stack.

var ra = require("../lib/ruleClassify.js");

new ra(function(q) {
  console.log(q.isQuestion("Really?")); 
  // true
  console.log(q.isQuestion("How are you?"));
  // true
});
silentrob commented 9 years ago

This is a caee where normalizer is being a little to greedy. Investigating further.

mariusursache commented 9 years ago

Any updates on this? Also, how can I specify in the editor the answer types, could not get it to work... :-(