https://github.com/elct9620/doll
The Chatbot Framework written in Ruby
https://github.com/elct9620/doll
chatbot ruby
Last synced: 6 months ago
JSON representation
The Chatbot Framework written in Ruby
- Host: GitHub
- URL: https://github.com/elct9620/doll
- Owner: elct9620
- Created: 2016-12-27T05:38:47.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-09-12T08:49:56.000Z (about 8 years ago)
- Last Synced: 2025-04-14T21:37:27.396Z (7 months ago)
- Topics: chatbot, ruby
- Language: Ruby
- Homepage:
- Size: 38.1 KB
- Stars: 10
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Doll [](https://badge.fury.io/rb/doll) [](https://travis-ci.org/elct9620/doll) [](https://coveralls.io/github/elct9620/doll?branch=master) [](https://codeclimate.com/github/elct9620/doll)
===
The Chatbot Framework written in Ruby
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'doll'
```
And then execute:
$ bundle
Or install it yourself as:
$ gem install doll
# Requirement
* Ruby 2.3+
## Usage
Prepare your Rack (`config.ru`)
```ruby
require 'doll'
require './config'
require './converse'
run Doll.server
```
Configure your chatbot (`config.rb`)
```ruby
Doll.configure do
# Support Adapters
adapter Doll::Adapter::Plain.new
adapter Doll::Adapter::Facebook.new(
'ACCESS_TOKEN',
'SECRET_TOKEN',
'VERIFY_TOKEN'
)
# NLP Support
use Doll::NLP::Wit.new('API_TOKEN')
end
```
Configure your chatbot converse rules (`converse.rb`)
```ruby
Doll.converse do
match /[Hh]ello/, to: :hello
# Current only support `intent` as predict entity for Wit.ai
intent :buy
not_found { 'I cannot figure out what you say....' }
end
```
Create your dialog classes
```ruby
# TODO: Namespace and Class name can be improved
module Hello
# Initialize Dialog
class StartDialog
def process
# TODO: View-like helper comming soon
Doll::Message::Text.new('Hi, Human!')
end
end
end
```
```ruby
# TODO: Namespace and Class name can be improved
module Buy
# Initialize Dialog
class StartDialog
def process
# TODO: View-like helper comming soon
Doll::Message::Text.new('Ok, I know you want buy something')
end
end
end
```
Start your server
```bash
$ puma -C config.ru
```
Now, you can access your chatbot via `https://example.com/facebook`
### Rails Integrate
Mount doll routes
```ruby
mount Doll.server => '/doll'
```
Add configuration and converse to `config/initializes/doll.rb`
```ruby
Doll.configurate do
adapter # ...
end
Doll.converse do
match # ...
intent # ...
end
```
Add dialog classes into `app/bot`
```ruby
# app/bot/hello/start_dialog.rb
module Hello
class StartDialog < Doll::Dialog
def process
# ...
end
end
end
```
## Roadmap
* [x] Workable Chatbot
* [ ] Converse
* [x] Regexp Matcher
* [x] NLP intent
* [ ] Routing options
* [ ] Improved routing
* [ ] Session
* [ ] Store
* [ ] Memory-based
* [ ] Redis
* [ ] Converse Management
* [ ] Dialog
* [ ] Response Builder
* [ ] Parameter
* [ ] Adaptetr
* [ ] Facebook
* [x] Text Message
* [ ] Image Message
* [ ] LINE
* [ ] Text Message
* [ ] Image Message
* [ ] Middleware
* [ ] NLP
* [x] Wit.ai
* [ ] LUIS.ai
## Development
TODO: Write development guide
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/elct9620/doll.