silentrob / superscript-editor

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

Editor vs. raw scripting limitations. #14

Closed mariusursache closed 9 years ago

mariusursache commented 9 years ago

I've installed the editor trying to figure out how to get the same functionality, now that SS script files are not supported anymore. Unfortunately I ran into trouble, anyone figured the details out?

Let me know if you want any of the following reported as a separate issue.

So:

  1. Basic trigger/reply works, including alternate replies if included.
  2. The generic wildcard * in triggers works.
  3. A trigger like hello * with a Hello human! reply will also trigger if you input "hey", "hi", "hola".
  4. Triggers are prioritized in order they are listed in the topic. For example, if you create the universal * trigger first, it will be used always if on top of the topics list.
  5. Triggers with variable/fixed length wildcards work (also capturing them and referring them in a reply).
  6. A blank wildcard in a trigger like hello *~2 will be output in replies with <cap1> as "undefined".
  7. Alternates work in triggers and are captured by in replies.
  8. Optionals work in triggers.
  9. 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...
  10. No idea how to make Answer Types work (ABBR, NUM, DESC etc.)
  11. Wordnet expansion works (I ~like ~sport) including capturing terms
  12. New line character ^ in replies does not work.
  13. Not sure how to use @redirects, since they seem to require only one word, and most of my triggers are phrases
  14. Tested ^hasName(true) functions. Works (but must have ^ character in function field).
  15. Created a system topic, but the bot jumped into it from 'random' topic. I thought that system topics were called only specifically.
  16. Not sure how to edit the pre/post of a topic.

PS—If you need help writing the docs for this, I'm willing to put in the blood & sweat. :-)

PS2—I find the scripting much more powerful and easy to manage, than the editor (which can be useful for less-techy people). Is there any way to still use it at this stage/in the future?

silentrob commented 9 years ago

Wow, thank you for the feedback and really kicking the tires. We defiantly have not reached parity between the two interfaces, and while I originally considered deprecating the scripting interface I can still see its value. Also this project is more than what I want, it has become a community project with more than my voice and opinion - this includes you!

I will spend some time this evening testing and reviewing each of your points. Some things may be bugs, others are lagging docs.

If you are interested in pitching in, or providing suggestions / improvements that would be more than welcome. And that goes for any of these code bases.

mariusursache commented 9 years ago

Will definitely do that, will put some of the thoughts in a document soon, after playing around with things.

A quick thought would be to allow editing the raw script for gambits in the editor (as a secondary option), although I am not sure how this works since the data is stored differently now (stuck my nose in the JSONs).

silentrob commented 9 years ago

Ya the JSON data structure was the primary model for a while, however moving it to mongo opened up all kinds of new ideas and concepts.

I was thinking of supporting both import and export to JSON to allow back and forth, but that seemed like a fair bit of work and I wasn't sure who wanted it.

My only major beef was using the scripting files for larger projects (1000+ gambits) things slow down both on authoring and debugging.

silentrob commented 9 years ago

Okay, I re-read your list and it isn't nearly as bad as I thought - looking at a wall of text. So everything that works is great :) and I will focus on some of the odd stuff.

A trigger like hello * with a Hello human! reply will also trigger if you input "hey", "hi", "hola". This is because we normalize hello, hey, hi, hola, cheers, etc to ~emohello see https://github.com/silentrob/normalizer/blob/master/data/interjections.txt for the full list of words that are changed to ~emohello (and other changes to text in general)

Triggers are prioritized in order they are listed in the topic. For example, if you create the universal * trigger first, it will be used always if on top of the topics list. This is indeed a bug / issue. There is a sort trigger/gambit button but that should just happen automatically (or allow the author to manually position the gambit where they want it to fire) Maybe drag to re-order. The general idea with sorting is the most greedy trigger gets placed last.

A blank wildcard in a trigger like hello *~2 will be output in replies with <cap1> as "undefined". Variable length wildcards should not capture data at all. Perhaps displaying undefinedis a bug. This functionality is by design, and is documented in the docs. The workaround is to use (*~2) This is also the same for open wildcards * anything that can be zero is skipped.

Optionals work in triggers. Fun fact, options also work in replies too!

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.

Answer types should work the same as in the scripting interface.

?:HUM:ind * Should match "Who is ..."

New line character ^ in replies does not work. This behaviour didn't make sense in the editor so it is not included.

Not sure how to use @redirects, since they seem to require only one word, and most of my triggers are phrases Redirects really need to be re-imagined for the editor as well. The metaphor breaks down when we introduce a id.

Created a system topic, but the bot jumped into it from 'random' topic. I thought that system topics were called only specifically. This is a bug and you are right. System topics should be unreachable.

Not sure how to edit the pre/post of a topic. Edit how? You should be able to add gambits to them. What else would you like to edit?

I hope this helps clarify a few things. I will create issues for the bugs and dig into those in the coming days.

mariusursache commented 9 years ago

Thanks a lot for taking the time to reply. I added some of the comments in the wiki Documentation page, created some issues for bugs/clarifications/new features, but still have a few unclear things:

  1. How to add gambits to pre/post from the editor? I could not figure it out.
  2. Optionals don't work in replies, but alternates do.
  3. A line break (either '^' or '\n' like in Rivescript, or simply allowing a text area for input) would be useful. Then these can be interpreted differently as <br>, or </p><p> or end-of-line character, depending on the client displaying the message. This would help in creating an interface which is more human-like.

Me and my team are more than willing to contributing to fixing some of the issues, writing some of the new documentation, and sharing new things as we continue developing stuff for our own use (such as a function to include delays between messages, which could make the rhythm of the converstion better. Could be probably worth having a common conversation soon, to understand more the underlying philosophy so that we can contribute in the right direction. :smile:

silentrob commented 9 years ago
  1. This is done with __pre__ or __post__ as set the system bit. I can see how that would be confusing. Do you think I should auto create those on init or solve it with documentation?
  2. I miss spoke and you are right. Alternates work in replies. Options do not - do you think we need that behaviour?
  3. I agree we need a way to break up the reply line. Ill create an enhancement for that.

I'm happy to chat more offline or on https://gitter.im/silentrob/superscript / slack / skype /gh or phone.

mariusursache commented 9 years ago

Closing, most of the things are referrenced in new issues.