Coder Social home page Coder Social logo

libaiml-1's Introduction

AIML

libAIML by Varol Okan:

This repository continues the work of the C++ AIML parser from V01D.
It is based off of version 0.6.1 of libaiml.
I also include the source of std_utils-0.7.5 in here to make it easier to compile the code

BUILD:

./rebuild.sh

This script will do the following
cd std_utils
./configure
cd ..

autoreconf -i
./configure --enable-caiml --enable-pcrecpp --enable-javascript --with-v8-path=/path/to/v8
make

Note: --enable-javascript: You need to make sure that the library files are either in the search path ( I.e. ise LDFLAGS, and LIBS ) or you can specify the path to v8's top source directory with --with-v8-path=/path/to/v8/ Please let me know if you run into issues with the libs. You can modify configure.in and run autoconf afterwards and try again ./configure ...

RUN:

This should build std_util, libaiml, and the test_app.

cd test_app
cp libaiml.xml.dist libaiml.xml
./test_app

Once you have grown tired of chatting you can simply type

quit

JAVASCRIPT

JavaScript is handled natively through v8.
Please follow the instructions on https://developers.google.com/v8/build to build the libraries.

Since JS is not well specified in the AIML spec, I added test_app/aiml/TestJavaScript.aiml file to deonstrate how to use it with libAIML.
Note that the CDATA construct is required for libxml2 to properly read in the JS code.

Also please note that you will have access to the aiml - object in JavaScript.

  var aiml = { 
    user : "name",
    star : "star",
    that : "that",
    topic: "topic",
    bot  : {
      someBotVars ...
    }
  }

to test the JS categories you can enter
You: test something
or
You: test aiml

<category>
  <pattern>TEST *</pattern>
  <template>
    This is cool <star/>.
    <javascript><![CDATA[
      print ( "   Testing JavaScript integration. Working !!! " + JSON.stringify ( aiml ) );
      var t;
      for ( var t=0; t<10; t++ )  {
        print ( "t=" + t );
      }
    ]]></javascript>
  </template>
</category>

<category>
  <pattern>TEST AIML</pattern>
  <template>
    <javascript><![CDATA[
      function objFields ( obj )  {
        for ( var key in obj )  {
         var val = obj[key];
         print ( "  Key[" +key+ "] = " + val );
        }
      }
      print ( "------------------ aiml - object ------------------" );
      objFields ( aiml );
      print ( "------------------ aiml.bot ------------------" );
      objFields ( aiml.bot );
    ]]></javascript>
  </template>
</category>

libaiml-1's People

Contributors

varolokan avatar

Watchers

 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.