s_intentions
v1.2.0
Published
Detect user intentions!
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
Detect Method
import { detect } from 's_intentions';
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 }
] */
//You can also limit the numbers of results using the limit parameter
const limit = 2;
const limitedResults = detect(stringToDetect, possibleIntentions,limit);
console.log(results);
/*
RETURNS:
[
{ intenction: 'Elon Musk', probability: 0.8888888888888888 },
{ intenction: 'Tony Stark', probability: 0.30000000000000004 },
] */
Get Most Likely Method
import { getMostLikely } from 's_intentions';
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"
*/