1.2.0 • Published 11 months ago

find-best-match v1.2.0

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

find-best-match ✔

A module for finding the best match based on Jaccard similarity.

Installation ⬇

npm install find-best-match

Usage 🚀

const findBestMatch = require("npm install find-best-match");

const data = [
  {
    test3: "Salam Alaikum",
    test4: "Hi there, and walaikum asSalam, whats up! 😊",
  },
  {
    test3: "are you fine",
    test4: "I am fine, thank you for asking",
  },
  {
    test3: "what should I call you",
    test4: "You can call me chatbot",
  },
  {
    test3: "how are your uncle?",
    test4: "My uncle is fine!",
  },
];

const X = data.map((entry) => entry.test3); // Array of texts
const y = data.map((entry) => entry.test4); // Array of corresponding responses

const inputText = "how are your uncle?";

const bestResponse = findBestMatch(X, y, inputText);
console.log(bestResponse); // Outputs: My uncle is fine!

License ©

MIT

Author 👩‍💻

Sharjeel Baig

1.2.0

11 months ago

1.1.0

11 months ago

1.0.0

1 year ago