dropsuit-bow v1.0.8
Overview of DropSuit NLP and the bow Function
DropSuit NLP is an open-source JavaScript and Node.js library offering diverse functions for natural language processing and data manipulation. The bow function is one of its modules, designed for generating a bag of words from input text and data requests. It returns an array of 'bag of words'. It is available under the Apache License 2.0.
DropSuit NLP Method: bow - A JavaScript and Node.js function for generating a bag of words from input and data requests
The bow function is a part of the DropSuit NLP library, it's a JavaScript and Node.js function that generates a bag of words from input text and data requests, it returns an array of 'bag of words'. It's open-source and available under the Apache License 2.0.
Installation
Add the library function by installing it via npm:
npm install dropsuit-bow
Usage
Import the library in your project:
const dropsuit_bow = require("dropsuit-bow");
Process intents.json using 'jsonIntStrct' function:
const json_data = require("bow/jsobj.js");
let intentData = json_data.jsonIntStrct("assets/json/intents.json");
Or provide test 'inputArray' and set boolean parameter (true/false) argument value to display console log processing results output information in terminal:
let inputArray = [
"John likes to watch movies. Mary likes movies too.",
"Mary also likes to watch football games.",
];
let dsbow = new dropsuit_bow(inputArray, true);
bow(input: string|null, stemInput: boolean, stemData: boolean)
- input: Input sentence string, or keep as null to process constructor 'input'. Processes default object instance key value (req_arr: requests).
- stemInput: (true/false) Enable or disable stemming for input string tokens.
- stemData: (true/false) Enable or disable stemming for data tokens.
let input = "John likes to watch movies. Mary likes movies too.";
let out = dsbow.bow(input, false, false);
console.log(out);
Processing output:
Input:
Sentence words ( 9 ) stemming ( false ) number ( 9 ):
[
'john', 'likes',
'to', 'watch',
'movies', 'mary',
'likes', 'movies',
'too'
]
Data tokens ( 10 ) stemming ( false ) number ( 10 ):
[
'john', 'likes',
'to', 'watch',
'movies', 'mary',
'too', 'also',
'football', 'games'
]
Output:
[
1, 2, 1, 1, 2,
1, 1, 0, 0, 0
]
Links
Supporting DropSuit
DropSuit is an open-source library and I am dedicated to ensuring its continued development and improvement. If you have any questions, feedback, or encounter any issues, please reach out through the support via PayPal, and read more about support details.
Your support is crucial for the library's success. You can also contribute to the project by submitting bug reports, feature requests, or by providing feedback. Sharing the library with others who may find it useful and giving it a star on GitHub are also great ways to show your support. Thank you for using DropSuit!