Project

doll

0.0
No commit activity in last 3 years
No release in over 3 years
Doll is a chat bot framework.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.13
~> 10.0
~> 3.0
 Project Readme

Doll Gem Version Build Status Coverage Status Code Climate

The Chatbot Framework written in Ruby

Installation

Add this line to your application's Gemfile:

gem 'doll'

And then execute:

$ bundle

Or install it yourself as:

$ gem install doll

Requirement

  • Ruby 2.3+

Usage

Prepare your Rack (config.ru)

require 'doll'

require './config'
require './converse'

run Doll.server

Configure your chatbot (config.rb)

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)

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

# 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
# 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

$ puma -C config.ru

Now, you can access your chatbot via https://example.com/facebook

Rails Integrate

Mount doll routes

mount Doll.server => '/doll'

Add configuration and converse to config/initializes/doll.rb

Doll.configurate do
  adapter # ...
end

Doll.converse do
  match # ...
  intent # ...
end

Add dialog classes into app/bot

# app/bot/hello/start_dialog.rb

module Hello
  class StartDialog < Doll::Dialog
    def process
      # ...
    end
  end
end

Roadmap

  • Workable Chatbot
  • Converse
    • Regexp Matcher
    • NLP intent
    • Routing options
    • Improved routing
  • Session
    • Store
      • Memory-based
      • Redis
    • Converse Management
  • Dialog
    • Response Builder
    • Parameter
  • Adaptetr
    • Facebook
      • Text Message
      • Image Message
    • LINE
      • Text Message
      • Image Message
  • Middleware
    • NLP
      • 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.