betty
betty copied to clipboard
'Did you mean' style improvement
It would be cool if when Betty didn't understand, and you tried again and got it right, Betty lets you automatically add an alternative matcher so she knows what you mean next time.
Also, if you can't get Betty to do what you want, it would be cool if she opened up your editor with the boilerplate to make a new command.
These learnings can be shared via github pull requests.
This is a good idea. I agree that there should be better ways for Betty to learn than simply relying on pull requests with new regular expressions. The first implementation of Betty was just a bunch of regexes because that's all I needed personally. It's outgrown that super fast.
nice idea!
betty learn last command
last= history | tail -n2 | head -n1
puts "which phrases should invoke #{last}?"
...
The big question is: what should happen with these patterns?
- generate ruby file(s) ?
- put them in yml/xml/sqlite/cloud/... db ?
- ... ?
"These learnings can be shared via github pull requests." Independent of the format being used, this is the best idea for having a safe cloud mechanism! We would not want bash commands to be delivered through some in-transparent cloud database.
The format should be very git friendly, therefore sqlite would not be a good choice.
See https://github.com/github/hub#git-pull-request for streamlined pull-requests (?)
The other day I was also thinking about a learn method. This would be huge.
betty learn last command
is awesome!
Could local commands be implemented as JSON and saved to ~/.betty_local_commands
?
Sample interaction:
$ apt-get -s upgrade | awk '/[0-9]+ upgraded,/ {print $1 " package updates are available"}'
7 package updates are available
$ betty learn last command
Betty: how do you want to call this command? Note that you can type multiple phrases by separating them with a colon (,)
betty are there any updates, how many updates are available
Betty: Ok! I saved this command to you ~/.betty_local_commands
Betty: May I anonymously send this to my developers for inclusion in my DNA?
Note 1: user phrases should get starting betty
dropped
Note 2: Should something like local commands get implemented someday I think that betty should always check them first and then fall back to normal behavior if no local command is found.
I think that having super cool configuration to read would be awesome, but I think the simplest approach at first would be allowing the user to edit the existing code or create the boilerplate ruby code.
Then they can commit it and submit a pull request, maybe using betty if we get that far.
I think the regexes are a great start. I think that as people start adding new commands and wanting to change the existing ones, a parser with some shared capabilities might evolve organically.
Since probably very few users will create a git fork, the easiest approach would be to upload all commands to a dev database, to be included into common code after community approval.
curl -xPOST our-command-database.com -d$LEARNED_COMMAND.
and yes, keep it in a local configuration in the meantime.
This is kind of the killer feature to make this project grow even faster. Figuring out the right way to save those commands 'properly' would be helpful but is not necessary;}
I just though of something else to add to the brainstorming:
What if each Module could extend a main Betty.learn method and thus she would know what questions to ask and how to use the answers stored locally.
That could be really useful, she could keep a log of user preferences.
It would also be cool if you could tell betty you want to do something, but not in the usual way and have her re-ask the questions.
Or say I want to see the git log for a specific file, and have her ask 'what file would you like to see a git log for?'
Instead of command line arguments you would end up with a tree of natural language questions that can store defaults. This is a really cool idea!
That is the second time I accidentally closed an issue trying to clear the input field today... you are supposed to be a shining example of good ux @github
I am willing to tackle this, but I don't have a ton of time to devote. My goal will be to break this epic into manage-able chunks.