-
Notifications
You must be signed in to change notification settings - Fork 3
REPL
To start a REPL, type
$ wit
You need either the WIT_ACCESS_TOKEN
environmental variable set or to specify a token (-t TOKEN
).
wit_bot will then load into a REPL:
$ wit
Starting Wit REPL:
wit>
You can type something, and wit_bot will respond with what it understands (with color):
$ wit
Starting Wit REPL:
wit> This is a cool test.
Click to see the entire output - it's somewhat long
If it's more your style, you can get a JSON output.
$ wit -j
Starting Wit REPL:
wit:> This is a cool test.
{
"_text": "This is a cool test.",
"confidence": 0.571,
"intent": "Test",
"entities": {
"word": [
{
"type": "value",
"value": "This"
}
],
"adjective": [
{
"type": "value",
"value": "cool"
}
],
"thing": [
{
"type": "value",
"value": "test"
}
]
}
}
You can also read have wit_bot read from stdin:
$ echo "This is a cool test." | wit -i -j
{"_text":"This is a cool test.","confidence":0.571,"intent":"Test","entities":{"word":[{"type":"value","value":"This"}],"adjective":[{"type":"value","value":"cool"}],"thing":[{"type":"value","value":"test"}]}}
It will take each line, process it, and return a JSON object until CMDD is pressed (EOD is sent).
While using the REPL, you can access the last message by typing !
. You can access the outcome by typing !!
. Anything after the exclamation point is evaluated as code:
wit > !
> message
...
wit > !!
> message.outcome
...
wit > !!intent
> message.outcome.intent
...
For more information on usage, type
$ wit --help
Down here?
Cool.
I should add something somewhat interesting for you to read...
Here's how to get started with wit_bot in 3 steps:
- Learn how to use wit.ai
- Learn how to setup the gem
- Learn how to send a message
- Learn how to use message threads
- Learn how to use context
- Learn how to use conversations
- Learn to use the REPL
- Learn how to use conversations
- Learn how to use participants
- Learn how to use bots