Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.
Ben edited this page Mar 14, 2016 · 13 revisions

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 Output

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

Getting Started

Here's how to get started with wit_bot in 3 steps:

  1. Learn how to use wit.ai
  2. Learn how to setup the gem
  3. Learn how to send a message

Dive Deeper

Create Bots

Integrate it

Clone this wiki locally