Skip to content
This repository has been archived by the owner on Dec 31, 2023. It is now read-only.

Rahuletto/chatbot

Repository files navigation

A Friendly human-like chatbot to be with you, forever

This template powers our system at Simply API


Instructions

This branch is for javascript. Go to typescript branch if you need the typescript project

(This is a much complex system to work with !)

  • Provide your chatbot's details in the .env.example file
  • Change the input as you like in index.js
  • Run the project and you are ready to go

Make it yours

  • Train your AI in the corpus.json file
  • Run javascript/dynamic response using pipelines.md for specific intent (type)
  • DO NOT edit the conf.json file !!
  • Use the response anywhere ! You can make an API or use in your application

Warning

This is an CPU intensive task !!

  • NLP (Natural Language Processing) is an CPU and RAM intensive system.
  • Training the ML model is the most computationally intensive task
  • DO NOT run this project on a potato !

How to train the AI ?

It is your job to train the AI. The more you train, the more smarter it gets.

You can train the ai in two ways

  • The easy one

Using the nlpjs module, you can train the system with functions

You can get the manager from the train(nlp) function in index.js

// ------------------------------------
// These should be in a async function !
// ------------------------------------

// Training the input-type relation (user.testing is the type here)
manager.addDocument(
    'en',
    'im testing you',
    'user.testing'
  ); 

// Response for the type of the input (user.testing is the type here)
manager.addAnswer( 
     'en', 
     'user.testing', 
     'I hope to pass the tests. Feel free to test me often' 
   );

await manager.train();
  • The hard one

You can directly edit the corpus.json to train it. (Prone to more errors)

Template

{
  "intent": "user.testing", // Initializing the type
  "utterances": [ // Training the input-type relation (user.testing is the type here)
    "im testing you",
    "thats a test"
  ],
  "answers": [ // Array of Response for the type of the input (user.testing is the type here)
    "I hope to pass your tests. Feel free to test me often",
    "Test me often.",
  ]
}
  • Extras

You need to send a dynamic URL for a specific type of input. But how ?

Its via using pipelines.md !

Template

First,

you need to train the input-type relation in corpus.json

{
  "intent": "doubt.qna",
  "utterances": [
    "What is wikipedia",
    "What is Ferrari",
    "What is an atom",
    "What is curtain",
    "What is github"
  ]
}

where

  • the doubt.qna is the type of input
  • the utterances are the inputs to define its type

Second,

you need to dynamically respond via pipelines.md

# onIntent(doubt.qna)
// compiler=javascript

{ The JS code }

where

  • the doubt.qna is the type of input
  • the { The JS code } is your Javascript code for dynamic response

About

An open source, friendly human-like chatbot to be with you, forever [DEPRECATED] Look at chatable repo

Topics

Resources

License

Stars

Watchers

Forks