npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

aice.js

v0.3.6

Published

Artificial Intelligence Conversational Engine

Downloads

18

Readme

codecov CircleCI Contributions welcome Commits npm

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

import { 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/