1.0.0 • Published 5 months ago

shazi-chatter v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

Shazibot

Shazibot is a Node module that generates responses based on a given input using a dataset.

Table of Contents

Installation

To install Shazibot, use the following command: npm install shazibot

Usage

To use Shazibot, follow these steps:

  1. Import the module:

    const { generateResponse } = require("shazibot");
  2. Define your input and dataset:

    let input = "How are you?";
    let dataset = {
      Hello: ["Hi", "Hello", "Hey"],
      "How are you?": ["I'm good", "I'm fine", "I'm okay"],
      Goodbye: ["Bye", "Goodbye", "See you later"],
    };
    let unMatchedResponse = [
      "I'm sorry, I don't understand",
      "I don't know",
      "Huh?",
      "Sorry, I didn't get that",
      "Can you repeat that?",
    ];
    let defaultResponse = ["Hello"];
  3. Generate a response using the generateResponse function:

    let response = generateResponse(
      input,
      dataset,
      unMatchedResponse,
      defaultResponse
    );
  4. Print the response:

    console.log(response);

API Reference

generateResponse(input, dataset, unMatchedResponse, defaultResponse)

This function generates a response based on the given input and dataset.

  • input (string): The input for which a response needs to be generated.
  • dataset (object): The dataset containing input-response mappings.
  • unMatchedResponse (array): An array of responses to be used when no match is found in the dataset.
  • defaultResponse (array): An array of default responses to be used when the input is empty or undefined.

Returns the generated response.

1.0.0

5 months ago