wit
wit-crystal
Supports Wit.ai API version 20160516
.
Runs on Crystal >= 0.17.2
.
Installation
Add this to your application's shard.yml
:
dependencies:
wit:
github: spalladino/wit-crystal
Examples
Understand
A query to the /message
endpoint can be issued by running:
crystal examples/understand.cr <access-token> In Buenos Aires
> Extracted entities from 'In Buenos Aires'
> location=[{"confidence" => 0.957859, "type" => "value", "value" => "Buenos Aires", "suggested" => true}]
Context
Shows how using a context changes how message entities are understood, by processing message Last week both with and without a reference time.
crystal examples/context.cr <access-token>
> Understanding message 'Last week'
> Without context: 2016-05-09T00:00:00.000-07:00
> Ref 2012-03-08: 2012-02-27T00:00:00.000Z
Quickstart
The code for the quickstart weather application can be executed by running:
crystal examples/quickstart.cr <access-token>
Usage
wit-crystal
provides a Wit::App
class with the following methods:
message
- the Wit message APIconverse
- the low-level Wit converse APIrun_actions
- a higher-level method to the Wit converse APIinteractive
- starts an interactive conversation with your bot
Refer to the examples folder for sample usage.
TODOs
- Generate and upload documentation
- Add more specs using webmock or similar tool
Acknowledgements
- The Wit.ai team for building such an awesome tool
- The developers of the Ruby SDK for Wit.ai, on which this library is heavily inspired
Contributors
- spalladino Santiago Palladino - creator, maintainer