Coder Social home page Coder Social logo

takahi-i / dialoguefirm Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 2.92 MB

Tiny chat bot engine for Unity

Home Page: https://github.com/takahi-i/DialogueFirm/blob/master/Assets/DialogFirm/Doc/main.adoc

License: GNU General Public License v3.0

C# 99.51% Shell 0.22% Makefile 0.27%
alexa unity chatbot bot

dialoguefirm's Introduction

DialogueFirm

DialogFirm is a simple chat bot engine for the Unity platform. Given input sentences, DialogFirm detects the intent and then returns the the sentence for reply. DialogueFirm provides an Amazon Alexa styled JSON configuration. In addition, functions for practical applications such as state transitions or slot type matching are provided.

The following image shows the an image of the state transitions. In the image, we can see the state of guide changed by input sentence from users.

state transition

Features

  • Simple configuration with JSON (AWS Alexa style)
  • Support state transistions

demo

Basic Configuration

This section starts from the simple DialogFirm configuration. DialogFirm has a JSON formatted configuration file. The following is a tiny example.

{
  "intents": [
    {
      "name": "repeat",
      "match": {
        "type": "verbatim",
        "expressions": [ "repeat", "pardon me?" ]
      }
    }
  ],
  "responders":
  {
    "repeat": [
      {
        "responds": [ "Go straight." ],
      }
    ],
    "default": [{
      "target": "default",
      "responds": [ "Sorry I do not understand what you mean." ]
    }]
  }
}

For more details, see the DialoguFirm docuement.

Basic Usage

DialogFirm has BotEngine which manages the dialogue with the user following specified configuration file. We can create a BotEngine specifying a configuration file. The following is a sample of creating a BotEngine object.

void CreateBot()
{
    string settingFilePath = Application.dataPath + "/DialogFirm/Scenes/simple-bot-conf.json";
    string setting = File.ReadAllText(settingFilePath);
    this.bot = new BotEngine(setting);
}

This example reads configuration stored in file Application.dataPath + "/DialogFirm/Scenes/simple-bot-conf.json" and then load the settings to a string setting. Then it creates the BotEngine object.

NOTE: configuration files of BotEngine are stored as Streaming Assets. Details of Streaming Assets, please see the document.

After we create a BotEngine instance, the instance is ready to get input sentence. Adding input sentence (string type), BotEngine returns the reply sentence following the given setting file.

public void RespondToInput(string input)
{
    var reply = this.bot.ReplySentence(input);
    text.text = reply;
    inputField.text = "";
}

In the following sections, we learn the configurations and practical usage of the DialogFirm framework.

License

GNU GENERAL PUBLIC LICENSE Version 3

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.