Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Conversational bots in ruby

Conversational bots in ruby

Aboobacker MK

January 30, 2017
Tweet

More Decks by Aboobacker MK

Other Decks in Programming

Transcript

  1. My background • tachyons in internet • Ruby on rails

    developer at Red Panthers • Open source enthusiast and voulnteer and Swathanthra Malayalam Computing
  2. This talk is not about • Tutorial for building a

    chat bot in ruby • Live coding a bot
  3. Packed with lot of features • Can connect to any

    chat service • Simple installation and setup • Easily extendable with plugins • Data persistence with Redis • Built-in web server and routing • Event system for behavior triggered in response to arbitrary events • Support for outgoing HTTP requests • Group-based authorization • Internationalization • Configurable logging • Generators for creating new plugins
  4. Adapters An adapter is a plugin that allows Lita to

    connect to a particular chat service
  5. Handlers A handler is a plugin that adds new functionality

    to Lita at runtime Consist of route defnisions and call backs
  6. Extensions An extension is a plugin that adds new functionality

    to Lita's core in order to extend the capabilities of adapters and handlers Eg: • Confiramation • Dot env support • Wizards
  7. Classification aims to assign a document or piece of text

    to one or more classes or categories making it easier to manage or sort. require 'stuff-classifier' cls = StuffClassifier::TfIdf.new("Cats or Dogs") cls.ignore_words = [ 'the', 'my', 'i', 'dont' ] cls.train(:dog, "Dogs are awesome, cats too. I love my dog") cls.train(:cat, "Cats are more preferred by software developers. I never could stand cats. I have a dog") cls.train(:dog, "My dog's name is Willy. He likes to play with my wife's cat all day long. I love dogs") cls.train(:cat, "Cats are difficult animals, unlike dogs, really annoying, I hate them all") cls.train(:dog, "So which one should you choose? A dog, definitely.") cls.train(:cat, "The favorite food for cats is bird meat, although mice are good, but birds are a delicacy") cls.train(:dog, "A dog will eat anything, including birds or whatever meat") cls.train(:cat, "My cat's favorite place to purr is on my keyboard") cls.train(:dog, "My dog's favorite place to take a leak is the tree in front of our house") cls.classify("This test is about cats.") #=> :cat
  8. And lot of other stuffs like • Full text search

    • Keyword Ranking • Language Detection • Text similarity • Tokenizer
  9. So build one ! • Wrote ruby wrapper for luis

    (https://github.com/tachyons/luis) • Ruby version of microsoft's bot framework (https://github.com/tachyons/botframework-ruby) • Built a simple prototype using sinatra https://github.com/tachyons/stock-bot-ruby/blob/master/stock.rb
  10. DSL is the way to go • Using rack •

    Event driven ? BotFramework.configure do |connector| connector.app_id = ENV['MICROSOFT_APP_ID'] connector.app_secret = ENV['MICROSOFT_APP_SECRET'] End BotFramework::Bot.on :activity do |activity| # Activity.id , identifier of the activity # activity.timestamp # activity.channel_id # activity.from, sender # activity.conversation # and so on reply(activity,activity.text) end
  11. Revamp • Bots are the new apps • Lita provides

    framework for building • Natural Language processing and tools available in ruby • Natural Language processing as service • Demo