aimlunicode

AIML Unicode for Node.js which supports non-English language (now it is only Thai) based on aimlinterpreter and aimlparser. This is the upgrade version of aimlparser. There are some bugs appeared in the latest version of AIML Intepreter and AIML Parser bu

Usage no npm install needed!

<script type="module">
  import aimlunicode from 'https://cdn.skypack.dev/aimlunicode';
</script>

README

AIMLUnicode.js

AIMLUnicode is a module that allows you to parse AIML files and to find the correct answer to a given message (support non-English language)

Installation

$ npm install aimlunicode

Dependencies

fs
dom-js

Description
AIMLUnicode for Node.js which supports non-English language (now it is only Thai) based on aimlinterpreter and aimlparser. This is the upgrade version of aimlparser. There are some bugs appeared in the latest version of AIMLIntepreter and AIMLParser but already fixed in this npm package.

Latest AIMLIntepreter and AIMLParser bugs:
AIMLIntepreter appears a bug in condition AIML tag. AIMLParser appears a bug in non-English Language Reading.

About aimlinterpreter

About aimlparser

Example XML File:

<?xml version="1.0" encoding="UTF-8"?>
<aiml version="2.0">
    <category>
        <pattern>สวัสดี</pattern>
        <template>สบายดีไหม</template>
    </category>

    <category>
        <pattern>Hello</pattern>
        <template>How Are You</template>
    </category>
</aiml>

Example JS File:

AIMLUnicode = require('./AIMLUnicode');
var aimlUnicode = new AIMLUnicode({name:'AIMLUnicode', age:'21'});
AIMLUnicode.loadAIMlFile(['./test.aiml.xml']);

var callback = function(answer, wildCardArray, input){
    console.log(answer + ' | ' + wildCardArray + ' | ' + input);
};

AIMLUnicode.findAnswer('What is your name?', callback);
AIMLUnicode.findAnswer('My name is Ben.', callback);
AIMLUnicode.findAnswer('What is my name?', callback);

Supported AIML tags:

<bot name="NAME"/>
<get name="NAME"/>
<set name="NAME">TEXT</set>
<random><li>A</li><li>B</li><li>C</li></random>
<srai>PATTERN TEXT</srai>
<sr/>
<star/>
<that>TEXT</that>
<condition name="NAME" value="VALUE">TEXT</condition>
<condition><li name="NAME" value="VALUE">TEXT</li><li name="NAME" value="VALUE">TEXT</li><li>TEXT</li></condition>
<condition name="NAME"><li value="VALUE">TEXT</li><li value="VALUE">TEXT</li><li>TEXT</li></condition>