Git Product home page Git Product logo

aice.js's Introduction

AIce.js

codecov CircleCI Contributions welcome Commits npm

FeaturesHow To installUsages exampleNLX syntaxContributingMore

Artificial Intelligence Conversational Engine (AICE)

AIce is an opensource Javascript natural language processing (NLP) and conversational framework without any dependencies.

Vision

We want to build a sustainable solution able to guess several languages, to understand the intention of the user, to give the best response in order to satisfy the user's intent. Also, we hope for providing both text-based conversational interface as well as form-based conversational interface. We desire to give a flexible NLP API to better fit various use case.

Features

  • NLX syntax based
  • Streams transformers Tokens based architecture, so it can handle input streams
  • Intents resolvers For the moment, we only have kind of ExactScoring methods to detect the intent match.
  • Outputs renderers For the moment, we only have SimpleRenderer that handle callables, conditions and the rendering/generation of the answer.
  • Many comparators with a varieties of strategies (hamming, levenshtein, damerau-levenshtein...)
  • Named Entity Recognition, accepting similar strings for Enum Entities.
  • Rule based Named Entities. Conception WIP
  • And more !

How to install

It can be installed directly from NPM to be integrated in node.js application.

npm install aice.js

Usages example

How to import

const { AICE } = from 'aice.js';
const { AICE } = require('aice.js');

Simple use case

const aice = new AICE();

aice.addInput('en', 'hello', 'Hello');

aice.addOutput('en', 'hello', "Hello. What's up ?");

aice.train();

// now you can use process to get the answer
const response = await aice.process('Hello', {}, 'en');
{
  "answer":"Hello. What's up ?",
  "score":1,
  "intent":"hello",
  "context":{}
}

Conditions use case

const nlp = new AICE();

nlp.addInput('en', 'test.conditions', 'Test conditions');

nlp.addOutput(
  'en',
  'test.conditions',
  "This is a test of the conditions",
  undefined,
  [{
      type: 'LeftRightExpression',
      operande: 'eq',
      Lvalue: { type: 'VARIABLE', value: 'state' },
      Rvalue: 'STATE_0',
   }]);

nlp.train();

// now you can use process to get the answer
const response = await aice.process('Test condition', { state: 'STATE_0'}, 'en');
{
  "answer":"This is a test of the conditions",
  "score":1,
  "intent":"test.conditions",
  "context":{"state":"STATE_0"}
}

Callable use case

const nlp = new AICE();

// Add an input to the intent 'match.email'
nlp.addInput('en', 'match.email', '{{userEmail=@email}}');

// Add an output to the intent 'match.email'
nlp.addOutput('en', 'match.email', "Thanks for your email. I'll send you some thing", undefined, undefined,
  async context => {
    const { userEmail } = context;
    const text = 'Example of email body';
    const mail = {
      to: userEmail,
      subject: 'Example of send mail',
      text,
      html: text,
    };
    await emailSender.sendMessage(mail);
    return {};
  });

  nlp.train();

This will send a mail to userEmail catched by the entity @email. In this example the service emailSender as been created using node-mailer.

NLX syntax

INPUT

TEXT            I'm a text
INLINE_CODE     {{ }}           // Expression syntax

SET             namevar=@entityName
SET             namevar=*
SET             namevar=^

ANY             *
ANYORNOTHING    ^
ENTITY          @name           // modify currentContext as entityName=@entityName

OUTPUT

INLINE_CODE     {{ }}           // rendered
CODE            << >>           // not rendered

SET             namevar='value'
SET             namevar=varName
GET             namevar

Contributing

Please, see the CONTRIBUTING.md file.

Contributor Code of Conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. See CODE_OF_CONDUCT.md file.

More

This project is developed by Opla.

It is still a WIP, but you could contribute, test, report bugs.

How to pronounce it ? "A-Ice" /eɪ/ /ʌɪs/

aice.js's People

Contributors

thenkei avatar jeffladiray avatar

Stargazers

LouisClisson avatar

Forkers

jeffladiray

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.