Skip to content

Commit

Permalink
Update README for DropSuit NLP's decor function
Browse files Browse the repository at this point in the history
  • Loading branch information
ladooniani committed Mar 10, 2023
1 parent 1042a20 commit 20ae9b9
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 307 deletions.
18 changes: 7 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
[<img alt="TAI Lab." width="59px" src="https://github.com/ladooniani/tailab/blob/master/assets/tai_lab_terbinari_cbm_project_logo.png" />](https://github.com/ladooniani/dropsuit#readme)

<!--
[![npm version](https://img.shields.io/npm/v/dropsuit-decor.svg?style=flat)](https://www.npmjs.com/package/dropsuit-decor) [![npm](https://img.shields.io/npm/dt/dropsuit-decor.svg?style=flat-square)](https://www.npmjs.com/package/dropsuit-decor) [![License](https://img.shields.io/npm/l/dropsuit-decor.svg)](https://www.npmjs.com/package/dropsuit-decor)
-->
# DropSuit NLP: Decor Function for Formatting and Styling Text Strings

# Overview of [DropSuit](https://github.com/ladooniani/dropsuit#readme) NLP and the decor Function

[DropSuit](https://github.com/ladooniani/dropsuit#readme) NLP is an open-source JavaScript and Node.js library offering diverse functions for natural language processing and data manipulation. The decor function is one of its modules, designed for formatting and styling text strings. It is available under the Apache License 2.0.

## DropSuit NLP Method: decor - A JavaScript and Node.js function for formatting and styling text strings

The decor function is a part of the DropSuit NLP library, it's a JavaScript and Node.js function that formats and stylizes text strings. It's open-source and available under the Apache License 2.0.
[DropSuit](https://github.com/ladooniani/dropsuit#readme) NLP is an open-source JavaScript and Node.js library that provides various functions for natural language processing and data manipulation. The decor function is one of the library's modules and is used for formatting and styling text strings. The decor function is open-source and available under the Apache License 2.0.

### Installation

Expand Down Expand Up @@ -77,11 +73,11 @@ let output6 = dsbdes.bow(input).design("camel"); // theCamelWalksThroughTheHotDe
let output7 = dsbdes.bow(input).design("camel-", " @"); // the @Camel @Walks @Through @Hot @Desert
```

<!--
## Links
- npm: https://www.npmjs.com/package/dropsuit-bow

- npm: https://www.npmjs.com/package/dropsuit-decor
-->
## 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](https://www.paypal.com/paypalme/dropsuit?country.x=GE&locale.x=en_US), and read more about [support details](https://github.com/ladooniani/dropsuit/blob/main/Support.md).
Expand Down
64 changes: 11 additions & 53 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,14 @@ function Constructor(dsout) {

//#endregion

//#region bow
//#region decor

/**
* Constructs a new instance of the 'Bag of Words' (BOW) processing object.
* This function can process an input sentence or word, or use the default input specified in the constructor.
* Formatting and Styling Text Strings
* @constructor
* @param {string|null} [input=null] - The input sentence or word to be processed.
* Leave as `null` to use the default input specified in the constructor.
* @returns {object} - A 'Bag of Words' object, with a method to retrieve the processed array.
* @returns {object} - Formatting and Styling Text Strings
*/

Constructor.prototype.decor = function (inputData) {
Expand All @@ -53,7 +52,7 @@ Constructor.prototype.decor = function (inputData) {

//#endregion

//#region bow_f
//#region decor_f

const dropsuit_clnstr = require("../dropsuit-clnstr/index.js");
var ds_clnstr = new dropsuit_clnstr(null, false);
Expand All @@ -62,12 +61,11 @@ const dropsuit_tok = require("../dropsuit-tok/index.js");
let dstok = new dropsuit_tok(null, false);

/**
* Constructs a Bag of Words (BOW) object.
*
* Constructs a Formatting and Styling Text Strings
* @function
* @constructor
* @description Creates a BOW object with optional input sentence or word and display options.
* @param {string|null} [inputsent=null] - Optional input sentence or word to be processed. If not provided, the constructor's input will be used.
* @description Formatting and Styling Text Strings.
* @param {string|null} [inputsent=null] - Optional input sentence or word to be processed.
* @param {boolean} [dispout=false] - Display processing output results in the terminal.
* @returns {object} - A BOW object with a bag of words and accessory options.
* @example
Expand All @@ -91,7 +89,6 @@ function bowsObj(tokenWords, inputsent) {
tokens: function () {
return this.tokenized;
},

design: function (type, delimiter) {
return designTypes(type, delimiter, tokenWords, inputsent);
},
Expand All @@ -102,7 +99,8 @@ function bowsObj(tokenWords, inputsent) {
function designTypes(type, delimiter, tokenWords, inputsent) {
inputsent = inputsent.split(" ");
if (type == undefined) {
//return str;
inputsent = dstok.tok(inputsent, 0).tokStr();
return inputsent;
} else {
if (type != "") {
type = ds_clnstr.clnstr(type).pnc();
Expand All @@ -118,7 +116,8 @@ function designTypes(type, delimiter, tokenWords, inputsent) {
} else if (type == "") {
return set(tokenWords, delimiter);
} else {
// return cont_str;
inputsent = dstok.tok(inputsent, 0).tokStr();
return inputsent;
}
}
}
Expand Down Expand Up @@ -163,47 +162,6 @@ function capitalize(input) {
return output;
}

function arrStrChecker(inputdtwords) {
let isArray = arrChecker(inputdtwords);
var isString = stringChecker(inputdtwords);
if (isString == true) {
return "string";
} else if (isArray == true) {
return "array";
}
}

function arrChecker(array) {
const result = Array.isArray(array);
if (result) {
return true;
} else {
return false;
}
}

function stringChecker(string) {
if (typeof string === "string") {
return true;
} else {
return false;
}
}

function arrToStr(input, aos, cond) {
let out;
if (aos == "array") {
if (cond == 1) {
out = input.join(" ").replace(/\s/g, "");
} else if (cond == 2) {
out = input.join(" ");
}
return out;
} else {
return input;
}
}

//#endregion

//#region console log
Expand Down
5 changes: 1 addition & 4 deletions infodt.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ function displayInfoData() {
decor(string)
Input: String.
Output:
tagsbt(): Bag of words array.
bowtbt(): Tags IDx value sequence arrays.
Output: Formatting and Styling Text Strings.
${divider}`;

const displayInfoData = {
Expand Down
Loading

0 comments on commit 20ae9b9

Please sign in to comment.