Code Monkey home page Code Monkey logo

srbot's Introduction

Serbian Chatbot

Serbian Chatbot is project of writing first multi-purpose chatbot for Serbian-speaking users.

Rocket

Rocket is AIML generator written in Ruby for faster prototyping of AIML chatbots. Files generated by Rocket could be used independently of programming language in which chatbot is written, but Rocket requires Ruby to convert Ruby files to AIML ones.

But tags are easier!

Tags are easier for beginners but for bigger projects it's pretty hard to write everything in tags. That's the reason why I made Rocket.

Installation

If Ruby is already installed on your system, install pretty-xml gem, clone this repository and require core file.

require_relative "lib/core.rb"

Usage

To start writing in Rocket, define new specification:

bot = Bot.new("botname")

You can define options for specification:

bot.options({
	debug: false,	# define as true if you want to get logs from translation (helpful on bigger projects)
	pretty: true	# define as true if you want to get nicely formatted code
})

Simple routes

# Patterns are automatically uppercased
# when conversion begins
bot.on "How are you" => "I'm fine, thanks!"
<category>
	<pattern>HOW ARE YOU</pattern>
	<template>I'm fine, thanks!</template>
</category>

Random responses

bot.on "*" => rand([
	"I don't understand you!",
	"Write clearly!"
])
<category>
	<pattern>*</pattern>
	<template>
		<random>
			<li>I don't understand you!</li>
			<li>Write clearly!</li>
		</random>
	</template>
</category>

Conditions

# You can chain multiple conditions
# using + operator
on "My name is *" =>
set({"name" => "#{star}"}) +
cond({"name" => "Mia"}, "Hi darling!") +
cond({"name" => "Gordon"}, "Nice to meet you Gordon!"})
<category>
	<pattern>MY NAME IS *</pattern>
	<template>
		<set name="name"><star/></set>
		<condition name="name" value="Mia">
			Hi darling!
		</condition>
		<condition name="name" value="Gordon">
			Nice to meet you Gordon!
		</condition>
	</template>
</category>

AIML content

All generated code is available via get_content method for each Bot instance:

bot = Bot.new("chatbot")
# ... code ...

# Output: code converted to AIML
puts bot.get_content

srbot's People

Contributors

panther99 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.