s_intentions
v1.1.1
Published
Detect user intentions!
Downloads
84
Maintainers
Readme
s_intentions
It's a free dependencies Node.js package that provides a module for detecting user intentions while typing a string, comparing it against a list of possible intentions built by Sìntropia.
Key Features:
- Intent Detection: Determines the likelihood that an input string matches each of the provided possible intentions.
- String Permutations: Utilizes permutation algorithms to explore possible variants of strings, enhancing the robustness of intent detection.
- Edit Distance: Calculates the edit distance between permutations of the input string and permutations of possible intentions.
Installation
npm install s_intentions
Usage
import { detect, getMostLikely } from 's_intentions';
-------- USING THE DETECT METHOD --------
const stringToDetect = 'Elon Mudk';
const possibleIntentions = ['Elon Musk', 'Tony Stark', 'Peter Parker'];
const results = detect(stringToDetect, possibleIntentions);
console.log(results);
/*
RETURNS:
[
{ intenction: 'Elon Musk', probability: 0.8888888888888888 },
{ intenction: 'Tony Stark', probability: 0.30000000000000004 },
{ intenction: 'Peter Parker', probability: 0.25 }
] */
-------- USING THE GETMOSTLIKELY METHOD --------
const stringToDetect = 'Elon Mudk';
const possibleIntentions = ['Elon Musk', 'Tony Stark', 'Peter Parker'];
const minimumThresholdNeeded = 0.8;
const results = getMostLikely(stringToDetect, possibleIntentions, minimumThresholdNeeded);
console.log(results);
/*
RETURNS:
"Elon Musk"
*/