Project

TacTalk

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
.....
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Project Readme

TacTalk

Gem to create a chatbot with simple scripts. Can run in console, web or desktop applications.

Depends of:

Simple NLP with algorithms:

Installation

gem install TacTalk

How to use

You can create a chatbot with this lib and the usage is very simple. First, you need create a YAML file with these params:

- question: Who is the most richest man in the world?
  answer: Bill Gates.
- question: What is the more expensive car?
  answer: McLaren P1 GTR and cost $3.3M.
- question: What was the most popular programming language in 2015?
  answer: C, by Tiobe.
- question: Good night
  answer: Good night!

Now, you can ask for TacTalk:

require 'tactalk'

tac = TacTalk.new
tac.add_question_document  "/path/to/file.yaml"
tac.ask "Who is the richest guy?"

# -> Bill Gates.

How call a method with a question?

In our example, we created this class:

require 'net/http'
require 'uri'
require 'json'
require 'sanitize'

class GetWikipediaPage

  def initialize doc
    @doc = doc
  end

  # This method will call by TacTalk
  def run
    url = "http://en.wikipedia.org/w/api.php?format=json&action=parse&page=china"
    content = Net::HTTP.get(URI.parse(url))

    result = JSON.load content
    Sanitize.fragment result['parse']['text']['*']
  end
end

Now, you must add a question and call the param method in question YAML file.

Ex:

.
.
.
- question: China in wikipedia
  method: GetWikipediaPage

And run these lines:

require 'tactalk'

tac = TacTalk.new
tac.add_question_document  "/path/to/file.yaml"
tac.ask "I'd like to know about china in Wikipedia?"

# -> This article is about the People's Republic of China. For the Republic of China.......