wink-nlp-utils
Advanced tools
Comparing version 1.9.1 to 2.0.0
@@ -36,3 +36,3 @@ # Contributing to Wink | ||
### Linting | ||
Well defined linting rules helps us in making code more consistent and avoid bugs. [ESLint](https://eslint.org) and [JSHint](http://jshint.com/) enforces these rules via their configuration files. These files are in the root of each repository. | ||
Well defined linting rules helps us in making code more consistent and avoid bugs. [ESLint](https://eslint.org) enforces these rules via its configuration file. This file is located in the root of each repository. | ||
@@ -39,0 +39,0 @@ |
{ | ||
"name": "wink-nlp-utils", | ||
"version": "1.9.1", | ||
"version": "2.0.0", | ||
"description": "NLP Functions for amplifying negations, managing elisions, creating ngrams, stems, phonetic codes to tokens and more.", | ||
@@ -11,2 +11,3 @@ "keywords": [ | ||
"Phonetize", | ||
"Soundex", | ||
"Stop Words", | ||
@@ -20,8 +21,7 @@ "Sentence Breaking", | ||
"scripts": { | ||
"pretest": "npm run lint && npm run hint && npm run docs", | ||
"pretest": "npm run lint && npm run docs", | ||
"test": "istanbul cover _mocha ./test/", | ||
"coveralls": "istanbul cover _mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage", | ||
"sourcedocs": "docker -i src -o ./sourcedocs --sidebar no", | ||
"docs": "documentation build src/** -f html -o docs -c docs-toc.yml", | ||
"hint": "jshint ./src/*.js ./test/*.js ./runkit/*.js", | ||
"docs": "jsdoc src/*.js -c .jsdoc.json", | ||
"lint": "eslint ./src/*.js ./test/*.js ./runkit/*.js" | ||
@@ -34,3 +34,3 @@ }, | ||
"author": "Sanjaya Kumar Saxena", | ||
"license": "AGPL-3.0-only", | ||
"license": "MIT", | ||
"bugs": { | ||
@@ -41,9 +41,9 @@ "url": "https://github.com/winkjs/wink-nlp-utils/issues" | ||
"devDependencies": { | ||
"chai": "^4.1.2", | ||
"chai": "^4.2.0", | ||
"coveralls": "^3.0.2", | ||
"docdash": "^1.0.0", | ||
"docker": "^1.0.0", | ||
"documentation": "^8.1.2", | ||
"eslint": "^5.4.0", | ||
"eslint": "^5.8.0", | ||
"istanbul": "^0.4.5", | ||
"jshint": "^2.9.6", | ||
"jsdoc": "^3.5.5", | ||
"mocha": "^5.2.0", | ||
@@ -53,6 +53,7 @@ "mocha-lcov-reporter": "^1.3.0" | ||
"dependencies": { | ||
"wink-helpers": "^1.5.0", | ||
"wink-porter2-stemmer": "^1.0.8", | ||
"wink-tokenizer": "^4.1.0" | ||
"wink-distance": "^2.0.0", | ||
"wink-helpers": "^2.0.0", | ||
"wink-porter2-stemmer": "^2.0.0", | ||
"wink-tokenizer": "^5.0.0" | ||
} | ||
} |
@@ -10,7 +10,5 @@ | ||
Prepare raw text for Natural Language Processing (NLP) using **`wink-nlp-utils`**. It is a part of [wink](http://wink.org.in/) — a growing family of high quality packages for Statistical Analysis, Natural Language Processing and Machine Learning in NodeJS. | ||
Prepare raw text for Natural Language Processing (NLP) using **`wink-nlp-utils`**. It offers a set of [APIs](http://wink.org.in/wink-nlp-utils/) to work on [strings](http://wink.org.in/wink-nlp-utils/#string) such as names, sentences, paragraphs and [tokens](http://wink.org.in/wink-nlp-utils/#tokens) represented as an array of strings/words. They perform the required pre-processing for many ML tasks such as [semantic search](https://www.npmjs.com/package/wink-bm25-text-search), and [classification](https://www.npmjs.com/package/wink-naive-bayes-text-classifier). | ||
It offers a set of [APIs](http://wink.org.in/wink-nlp-utils/) to work on [strings](http://wink.org.in/wink-nlp-utils/#string) such as names, sentences, paragraphs and [tokens](http://wink.org.in/wink-nlp-utils/#tokens) represented as an array of strings/words. They perform the required pre-processing for many ML tasks such as [semantic search](https://www.npmjs.com/package/wink-bm25-text-search), and [classification](https://www.npmjs.com/package/wink-naive-bayes-text-classifier). | ||
## Installation | ||
@@ -78,7 +76,9 @@ Use [npm](https://www.npmjs.com/package/wink-nlp-utils) to install: | ||
### About wink | ||
[Wink](http://winkjs.org/) is a family of open source packages for **Statistical Analysis**, **Natural Language Processing** and **Machine Learning** in NodeJS. The code is **thoroughly documented** for easy human comprehension and has a **test coverage of ~100%** for reliability to build production grade solutions. | ||
## Copyright & License | ||
**wink-nlp-utils** is copyright 2017-18 [GRAYPE Systems Private Limited](http://graype.in/). | ||
It is licensed under the under the terms of the GNU Affero General Public License as published by the Free | ||
Software Foundation, version 3 of the License. | ||
It is licensed under the terms of the MIT License. |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -40,3 +43,3 @@ // | ||
* | ||
* @name helper.returnIndexer | ||
* @memberof helper | ||
* @return {indexer} used to build and access the index. | ||
@@ -43,0 +46,0 @@ * @example |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -37,5 +40,5 @@ // | ||
* | ||
* @name helper.returnQuotedTextExtractor | ||
* @param {string} [lq='"'] — the left quote character. | ||
* @param {string} [rq='"'] — the right quote character. | ||
* @memberof helper | ||
* @param {string} [lq='"'] the left quote character. | ||
* @param {string} [rq='"'] the right quote character. | ||
* @return {function} that will accept an input string argument and return an | ||
@@ -42,0 +45,0 @@ * array of all substrings that are quoted between `lq` and `rq`. |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -44,5 +47,5 @@ // | ||
* | ||
* @name helper.returnWordsFilter | ||
* @param {string[]} words — that can be filtered using the returned wordsFilter. | ||
* @param {function[]} [mappers=undefined] — optionally used to map each word before creating | ||
* @memberof helper | ||
* @param {string[]} words that can be filtered using the returned wordsFilter. | ||
* @param {function[]} [mappers=undefined] optionally used to map each word before creating | ||
* the wordsFilter. | ||
@@ -49,0 +52,0 @@ * @return {wordsFilter} object containg `set()` and `exclude()` functions for `words`. |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -25,0 +28,0 @@ // |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -25,0 +28,0 @@ // |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -36,4 +39,4 @@ // | ||
* | ||
* @name string.amplifyNotElision | ||
* @param {string} str — the input string. | ||
* @memberof string | ||
* @param {string} str the input string. | ||
* @return {string} input string after not elision amplification. | ||
@@ -40,0 +43,0 @@ * @example |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -29,3 +32,3 @@ // | ||
// ### bong | ||
// ### bagOfNGrams | ||
/** | ||
@@ -37,10 +40,10 @@ * | ||
* | ||
* @name string.bagOfNGrams | ||
* @param {string} str — the input string. | ||
* @param {number} [size=2] — ngram size. | ||
* @param {function} [ifn=undefined] — a function to build index; it is called for | ||
* @memberof string | ||
* @param {string} str the input string. | ||
* @param {number} [size=2] ngram size. | ||
* @param {function} [ifn=undefined] a function to build index; it is called for | ||
* every **unique occurrence of ngram** of `str`; and it receives the ngram and the `idx` | ||
* as input arguments. The `build()` function of [helper.returnIndexer](#helperreturnindexer) | ||
* may be used as `ifn`. If `undefined` then index is not built. | ||
* @param {number} [idx=undefined] — the index; passed as the second argument to the `ifn` | ||
* @param {number} [idx=undefined] the index; passed as the second argument to the `ifn` | ||
* function. | ||
@@ -54,3 +57,3 @@ * @return {object} bag of ngrams of `size` from `str`. | ||
*/ | ||
var bong = function ( str, size, ifn, idx ) { | ||
var bagOfNGrams = function ( str, size, ifn, idx ) { | ||
var ng = ( size || 2 ), | ||
@@ -75,2 +78,2 @@ ngBOW = Object.create( null ), | ||
module.exports = bong; | ||
module.exports = bagOfNGrams; |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -43,4 +46,4 @@ // | ||
* | ||
* @name string.composeCorpus | ||
* @param {string} str — the input string. | ||
* @memberof string | ||
* @param {string} str the input string. | ||
* @return {string[]} of all possible sentences. | ||
@@ -47,0 +50,0 @@ * @example |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -34,12 +37,12 @@ // | ||
* | ||
* @name string.edgeNGrams | ||
* @param {string} str — the input string. | ||
* @param {number} [min=2] — size of ngram generated. | ||
* @param {number} [max=8] — size of ngram is generated. | ||
* @param {number} [delta=2] — edge ngrams are generated in increments of this value. | ||
* @param {function} [ifn=undefined] — a function to build index; it is called for | ||
* @memberof string | ||
* @param {string} str the input string. | ||
* @param {number} [min=2] size of ngram generated. | ||
* @param {number} [max=8] size of ngram is generated. | ||
* @param {number} [delta=2] edge ngrams are generated in increments of this value. | ||
* @param {function} [ifn=undefined] a function to build index; it is called for | ||
* every edge ngram of `str`; and it receives the edge ngram and the `idx` | ||
* as input arguments. The `build()` function of [helper.returnIndexer](#helperreturnindexer) | ||
* may be used as `ifn`. If `undefined` then index is not built. | ||
* @param {number} [idx=undefined] — the index; passed as the second argument to the `ifn` | ||
* @param {number} [idx=undefined] the index; passed as the second argument to the `ifn` | ||
* function. | ||
@@ -46,0 +49,0 @@ * @return {string[]} of edge ngrams. |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -39,4 +42,4 @@ // | ||
* | ||
* @name string.extractPersonsName | ||
* @param {string} str — the input string. | ||
* @memberof string | ||
* @param {string} str the input string. | ||
* @return {string} extracted name. | ||
@@ -43,0 +46,0 @@ * @example |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -36,4 +39,4 @@ // | ||
* | ||
* @name string.extractRunOfCapitalWords | ||
* @param {string} str — the input string. | ||
* @memberof string | ||
* @param {string} str the input string. | ||
* @return {string[]} of text appearing in Title Case or in ALL CAPS; if no such | ||
@@ -40,0 +43,0 @@ * text is found then `null` is returned. |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -34,4 +37,4 @@ // | ||
* | ||
* @name string.lowerCase | ||
* @param {string} str — the input string. | ||
* @memberof string | ||
* @param {string} str the input string. | ||
* @return {string} input string in lower case. | ||
@@ -38,0 +41,0 @@ * @example |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -37,4 +40,4 @@ // | ||
* | ||
* @name string.marker | ||
* @param {string} str — the input string. | ||
* @memberof string | ||
* @param {string} str the input string. | ||
* @return {string} the marker. | ||
@@ -41,0 +44,0 @@ * @example |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -35,5 +38,5 @@ // | ||
* | ||
* @name string.ngram | ||
* @param {string} str — the input string. | ||
* @param {number} [size=2] — ngram's size. | ||
* @memberof string | ||
* @param {string} str the input string. | ||
* @param {number} [size=2] ngram's size. | ||
* @return {string[]} ngrams of `size` from `str`. | ||
@@ -40,0 +43,0 @@ * @example |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -37,4 +40,4 @@ // | ||
* | ||
* @name string.phonetize | ||
* @param {string} word — the input word. | ||
* @memberof string | ||
* @param {string} word the input word. | ||
* @return {string} phonetic code of `word`. | ||
@@ -41,0 +44,0 @@ * @example |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -37,4 +40,4 @@ // | ||
* | ||
* @name string.removeElisions | ||
* @param {string} str — the input string. | ||
* @memberof string | ||
* @param {string} str the input string. | ||
* @return {string} input string after removal of elisions. | ||
@@ -41,0 +44,0 @@ * @example |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -36,4 +39,4 @@ // | ||
* | ||
* @name string.removeExtraSpaces | ||
* @param {string} str — the input string. | ||
* @memberof string | ||
* @param {string} str the input string. | ||
* @return {string} input string after removal of leading, trailing and extra | ||
@@ -40,0 +43,0 @@ * whitespaces. |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -38,4 +41,4 @@ // | ||
* | ||
* @name string.removeHTMLTags | ||
* @param {string} str — the input string. | ||
* @memberof string | ||
* @param {string} str the input string. | ||
* @return {string} input string after removal of HTML tags. | ||
@@ -42,0 +45,0 @@ * @example |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -39,4 +42,4 @@ // | ||
* | ||
* @name string.removePunctuations | ||
* @param {string} str — the input string. | ||
* @memberof string | ||
* @param {string} str the input string. | ||
* @return {string} input string after removal of punctuations. | ||
@@ -43,0 +46,0 @@ * @example |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -39,4 +42,4 @@ // | ||
* | ||
* @name string.removeSplChars | ||
* @param {string} str — the input string. | ||
* @memberof string | ||
* @param {string} str the input string. | ||
* @return {string} input string after removal of special characters. | ||
@@ -43,0 +46,0 @@ * @example |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -37,4 +40,4 @@ // | ||
* | ||
* @name string.retainAlphaNums | ||
* @param {string} str — the input string. | ||
* @memberof string | ||
* @param {string} str the input string. | ||
* @return {string} input string after removal of non-alphanumeric characters, | ||
@@ -41,0 +44,0 @@ * leading, trailing and extra whitespaces. |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -69,4 +72,4 @@ // | ||
* | ||
* @name string.sentences | ||
* @param {string} paragraph — the input string. | ||
* @memberof string | ||
* @param {string} paragraph the input string. | ||
* @return {string[]} of sentences. | ||
@@ -73,0 +76,0 @@ * @example |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -29,3 +32,3 @@ // | ||
// ### soc | ||
// ### setOfChars | ||
/** | ||
@@ -37,9 +40,9 @@ * | ||
* | ||
* @name string.setOfChars | ||
* @param {string} str — the input string. | ||
* @param {function} [ifn=undefined] — a function to build index; it receives the first | ||
* @memberof string | ||
* @param {string} str the input string. | ||
* @param {function} [ifn=undefined] a function to build index; it receives the first | ||
* character of `str` and the `idx` as input arguments. The `build()` function of | ||
* [helper.returnIndexer](#helperreturnindexer) may be used as `ifn`. If `undefined` | ||
* then index is not built. | ||
* @param {number} [idx=undefined] — the index; passed as the second argument to the `ifn` | ||
* @param {number} [idx=undefined] the index; passed as the second argument to the `ifn` | ||
* function. | ||
@@ -51,3 +54,3 @@ * @return {string} the soc. | ||
*/ | ||
var soc = function ( str, ifn, idx ) { | ||
var setOfChars = function ( str, ifn, idx ) { | ||
var cset = new Set( str ); | ||
@@ -60,2 +63,2 @@ if ( typeof ifn === 'function' ) { | ||
module.exports = soc; | ||
module.exports = setOfChars; |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -29,3 +32,3 @@ // | ||
// ### song | ||
// ### setOfNGrams | ||
/** | ||
@@ -37,10 +40,10 @@ * | ||
* | ||
* @name string.setOfNGrams | ||
* @param {string} str — the input string. | ||
* @param {number} [size=2] — ngram size. | ||
* @param {function} [ifn=undefined] — a function to build index; it is called for | ||
* @memberof string | ||
* @param {string} str the input string. | ||
* @param {number} [size=2] ngram size. | ||
* @param {function} [ifn=undefined] a function to build index; it is called for | ||
* every **unique occurrence of ngram** of `str`; and it receives the ngram and the `idx` | ||
* as input arguments. The `build()` function of [helper.returnIndexer](#helperreturnindexer) | ||
* may be used as `ifn`. If `undefined` then index is not built. | ||
* @param {number} [idx=undefined] — the index; passed as the second argument to the `ifn` | ||
* @param {number} [idx=undefined] the index; passed as the second argument to the `ifn` | ||
* function. | ||
@@ -54,3 +57,3 @@ * @return {set} of ngrams of `size` of `str`. | ||
*/ | ||
var song = function ( str, size, ifn, idx ) { | ||
var setOfNGrams = function ( str, size, ifn, idx ) { | ||
var ng = ( size || 2 ), | ||
@@ -71,2 +74,2 @@ ngSet = new Set(), | ||
module.exports = song; | ||
module.exports = setOfNGrams; |
@@ -9,29 +9,22 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
// | ||
// Soundex Code for alphabets. | ||
/* eslint-disable object-property-newline */ | ||
var soundexMap = { | ||
A: 0, E: 0, I: 0, O: 0, U: 0, Y: 0, | ||
B: 1, F: 1, P: 1, V: 1, | ||
C: 2, G: 2, J: 2, K: 2, Q: 2, S: 2, X: 2, Z: 2, | ||
D: 3, T: 3, | ||
L: 4, | ||
M: 5, N: 5, | ||
R: 6 | ||
}; | ||
var sndx = require( 'wink-distance/src/soundex.js' ); | ||
@@ -45,5 +38,5 @@ // ## string | ||
* | ||
* @name string.soundex | ||
* @param {string} word — the input word. | ||
* @param {number} [maxLength=4] — of soundex code to be returned. | ||
* @memberof string | ||
* @param {string} word the input word. | ||
* @param {number} [maxLength=4] of soundex code to be returned. | ||
* @return {string} soundex code of `word`. | ||
@@ -57,44 +50,5 @@ * @example | ||
var soundex = function ( word, maxLength ) { | ||
// Upper case right in the begining. | ||
var s = ( word.length ) ? word.toUpperCase() : '?'; | ||
var i, | ||
imax = s.length; | ||
// Soundex code builds here. | ||
var sound = []; | ||
// Helpers - `ch` is a char from `s` and `code/prevCode` are sondex codes | ||
// for consonants. | ||
var ch, code, | ||
prevCode = 9; | ||
// Use default of 4. | ||
var maxLen = maxLength || 4; | ||
// Iterate through every character. | ||
for ( i = 0; i < imax; i += 1 ) { | ||
ch = s[ i ]; | ||
code = soundexMap[ ch ]; | ||
if ( i ) { | ||
// Means i is > 0. | ||
// `code` is either (a) `undefined` if an unknown character is | ||
// encountered including `h & w`, or (b) `0` if it is vowel, or | ||
// (c) the soundex code for a consonant. | ||
if ( code && code !== prevCode ) { | ||
// Consonant and not adjecant duplicates! | ||
sound.push( code ); | ||
} else if ( code !== 0 ) { | ||
// Means `h or w` or an unknown character: ensure `prevCode` is | ||
// remembered so that adjecant duplicates can be handled! | ||
code = prevCode; | ||
} | ||
} else { | ||
// Retain the first letter | ||
sound.push( ch ); | ||
} | ||
prevCode = code; | ||
} | ||
s = sound.join( '' ); | ||
// Always ensure minimum length of 4 characters for maxLength > 4. | ||
if ( s.length < 4 ) s += '000'; | ||
// Return the required length. | ||
return s.substr( 0, maxLen ); | ||
return sndx( word, maxLength ); | ||
}; // soundex() | ||
module.exports = soundex; |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -37,4 +40,4 @@ // | ||
* | ||
* @name string.splitElisions | ||
* @param {string} str — the input string. | ||
* @memberof string | ||
* @param {string} str the input string. | ||
* @return {string} input string after splitting of elisions. | ||
@@ -41,0 +44,0 @@ * @example |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -35,4 +38,4 @@ // | ||
* | ||
* @name string.stem | ||
* @param {string} word — to be stemmed. | ||
* @memberof string | ||
* @param {string} word to be stemmed. | ||
* @return {string} the stemmed word. | ||
@@ -39,0 +42,0 @@ * |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -40,5 +43,5 @@ // | ||
* | ||
* @name string.tokenize | ||
* @param {string} sentence — the input string. | ||
* @param {boolean} [detailed=false] — if true, each token is a object cotaining | ||
* @memberof string | ||
* @param {string} sentence the input string. | ||
* @param {boolean} [detailed=false] if true, each token is a object cotaining | ||
* `value` and `tag` of each token; otherwise each token is a string. It's default | ||
@@ -45,0 +48,0 @@ * value of **false** ensures compatibility with previous version. |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -40,4 +43,4 @@ // | ||
* | ||
* @name string.tokenize0 | ||
* @param {string} str — the input string. | ||
* @memberof string | ||
* @param {string} str the input string. | ||
* @return {string[]} of tokens. | ||
@@ -44,0 +47,0 @@ * @example |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -34,4 +37,4 @@ // | ||
* | ||
* @name string.trim | ||
* @param {string} str — the input string. | ||
* @memberof string | ||
* @param {string} str the input string. | ||
* @return {string} input string with leading & trailing whitespaces removed. | ||
@@ -38,0 +41,0 @@ * @example |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -34,4 +37,4 @@ // | ||
* | ||
* @name string.upperCase | ||
* @param {string} str — the input string. | ||
* @memberof string | ||
* @param {string} str the input string. | ||
* @return {string} input string in upper case. | ||
@@ -38,0 +41,0 @@ * @example |
@@ -5,20 +5,23 @@ // wink-nlp-utils | ||
// | ||
// Copyright (C) 2017-18 GRAYPE SyappendBigramss Private Limited | ||
// Copyright (C) 2017-18 GRAYPE Systems Private Limited | ||
// | ||
// This file is part of “wink-nlp-utils”. | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -34,4 +37,4 @@ // | ||
* | ||
* @name tokens.appendBigrams | ||
* @param {string[]} tokens — the input tokens. | ||
* @memberof tokens | ||
* @param {string[]} tokens the input tokens. | ||
* @return {string[]} the input tokens appended with their bigrams. | ||
@@ -38,0 +41,0 @@ * @example |
@@ -5,20 +5,23 @@ // wink-nlp-utils | ||
// | ||
// Copyright (C) 2017-18 GRAYPE Sybigramss Private Limited | ||
// Copyright (C) 2017-18 GRAYPE Systems Private Limited | ||
// | ||
// This file is part of “wink-nlp-utils”. | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -34,4 +37,4 @@ // | ||
* | ||
* @name tokens.bigrams | ||
* @param {string[]} tokens — the input tokens. | ||
* @memberof tokens | ||
* @param {string[]} tokens the input tokens. | ||
* @return {string[]} the bigrams. | ||
@@ -38,0 +41,0 @@ * @example |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -29,3 +32,3 @@ // | ||
// ### bow | ||
// ### bagOfWords | ||
/** | ||
@@ -37,11 +40,11 @@ * | ||
* | ||
* @name tokens.bagOfWords | ||
* @param {string[]} tokens — the input tokens. | ||
* @param {number} [logCounts=false] — a true value flags the use of `log2( word count + 1 )` | ||
* @memberof tokens | ||
* @param {string[]} tokens the input tokens. | ||
* @param {number} [logCounts=false] a true value flags the use of `log2( word count + 1 )` | ||
* instead of just `word count` as frequency. | ||
* @param {function} [ifn=undefined] — a function to build index; it is called for | ||
* @param {function} [ifn=undefined] a function to build index; it is called for | ||
* every **unique occurrence of word** in `tokens`; and it receives the word and the `idx` | ||
* as input arguments. The `build()` function of [helper.returnIndexer](#helperreturnindexer) | ||
* may be used as `ifn`. If `undefined` then index is not built. | ||
* @param {number} [idx=undefined] — the index; passed as the second argument to the `ifn` | ||
* @param {number} [idx=undefined] the index; passed as the second argument to the `ifn` | ||
* function. | ||
@@ -55,3 +58,3 @@ * @return {object} bag of words from tokens. | ||
*/ | ||
var bow = function ( tokens, logCounts, ifn, idx ) { | ||
var bagOfWords = function ( tokens, logCounts, ifn, idx ) { | ||
var bow1 = Object.create( null ), | ||
@@ -77,2 +80,2 @@ i, imax, | ||
module.exports = bow; | ||
module.exports = bagOfWords; |
@@ -5,20 +5,23 @@ // wink-nlp-utils | ||
// | ||
// Copyright (C) 2017-18 GRAYPE Syphonetizes Private Limited | ||
// Copyright (C) 2017-18 GRAYPE Systems Private Limited | ||
// | ||
// This file is part of “wink-nlp-utils”. | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -35,4 +38,4 @@ // | ||
* | ||
* @name tokens.phonetize | ||
* @param {string[]} tokens — the input tokens. | ||
* @memberof tokens | ||
* @param {string[]} tokens the input tokens. | ||
* @return {string[]} phonetized tokens. | ||
@@ -39,0 +42,0 @@ * @example |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -38,5 +41,5 @@ // | ||
* | ||
* @name tokens.propagateNegations | ||
* @param {string[]} tokens — the input tokens. | ||
* @param {number} [upto=2] — number of tokens to be negated after the negation | ||
* @memberof tokens | ||
* @param {string[]} tokens the input tokens. | ||
* @param {number} [upto=2] number of tokens to be negated after the negation | ||
* token. Note, tokens are only negated either `upto` tokens or up to the token | ||
@@ -43,0 +46,0 @@ * preceeding the **`, . ; : ! ?`** punctuations. |
@@ -5,20 +5,23 @@ // wink-nlp-utils | ||
// | ||
// Copyright (C) 2017-18 GRAYPE Syphonetizes Private Limited | ||
// Copyright (C) 2017-18 GRAYPE Systems Private Limited | ||
// | ||
// This file is part of “wink-nlp-utils”. | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -38,5 +41,5 @@ // | ||
* | ||
* @name tokens.removeWords | ||
* @param {string[]} tokens — the input tokens. | ||
* @param {wordsFilter} [stopWords=defaultStopWords] — default stop words are | ||
* @memberof tokens | ||
* @param {string[]} tokens the input tokens. | ||
* @param {wordsFilter} [stopWords=defaultStopWords] default stop words are | ||
* loaded from `stop_words.json` located under the `src/dictionaries/` directory. | ||
@@ -43,0 +46,0 @@ * Custom stop words can be created using [helper.returnWordsFilter ](#helperreturnwordsfilter). |
@@ -5,20 +5,23 @@ // wink-nlp-utils | ||
// | ||
// Copyright (C) 2017-18 GRAYPE Syphonetizes Private Limited | ||
// Copyright (C) 2017-18 GRAYPE Systems Private Limited | ||
// | ||
// This file is part of “wink-nlp-utils”. | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -35,4 +38,4 @@ // | ||
* | ||
* @name tokens.soundex | ||
* @param {string[]} tokens — the input tokens. | ||
* @memberof tokens | ||
* @param {string[]} tokens the input tokens. | ||
* @return {string[]} soundex coded tokens. | ||
@@ -39,0 +42,0 @@ * @example |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -29,14 +32,14 @@ // | ||
// ### bow | ||
// ### setOfWords | ||
/** | ||
* | ||
* Generates the set of words from the input string. It also has an alias **`setOfWords()`**. | ||
* Generates the set of words from the input string. It also has an alias **`sow()`**. | ||
* | ||
* @name tokens.setOfWords | ||
* @param {string[]} tokens — the input tokens. | ||
* @param {function} [ifn=undefined] — a function to build index; it is called for | ||
* @memberof tokens | ||
* @param {string[]} tokens the input tokens. | ||
* @param {function} [ifn=undefined] a function to build index; it is called for | ||
* every **member word of the set **; and it receives the word and the `idx` | ||
* as input arguments. The `build()` function of [helper.returnIndexer](#helperreturnindexer) | ||
* may be used as `ifn`. If `undefined` then index is not built. | ||
* @param {number} [idx=undefined] — the index; passed as the second argument to the `ifn` | ||
* @param {number} [idx=undefined] the index; passed as the second argument to the `ifn` | ||
* function. | ||
@@ -48,3 +51,3 @@ * @return {set} of words from tokens. | ||
*/ | ||
var sow = function ( tokens, ifn, idx ) { | ||
var setOfWords = function ( tokens, ifn, idx ) { | ||
var tset = new Set( tokens ); | ||
@@ -59,2 +62,2 @@ if ( typeof ifn === 'function' ) { | ||
module.exports = sow; | ||
module.exports = setOfWords; |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -35,4 +38,4 @@ // | ||
* | ||
* @name tokens.stem | ||
* @param {string[]} tokens — the input tokens. | ||
* @memberof tokens | ||
* @param {string[]} tokens the input tokens. | ||
* @return {string[]} stemmed tokens. | ||
@@ -39,0 +42,0 @@ * @example |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -25,0 +28,0 @@ // |
@@ -9,16 +9,19 @@ // wink-nlp-utils | ||
// | ||
// “wink-nlp-utils” is free software: you can redistribute it | ||
// and/or modify it under the terms of the GNU Affero | ||
// General Public License as published by the Free | ||
// Software Foundation, version 3 of the License. | ||
// Permission is hereby granted, free of charge, to any person obtaining a | ||
// copy of this software and associated documentation files (the "Software"), | ||
// to deal in the Software without restriction, including without limitation | ||
// the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
// and/or sell copies of the Software, and to permit persons to whom the | ||
// Software is furnished to do so, subject to the following conditions: | ||
// | ||
// “wink-nlp-utils” is distributed in the hope that it will | ||
// be useful, but WITHOUT ANY WARRANTY; without even | ||
// the implied warranty of MERCHANTABILITY or FITNESS | ||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General | ||
// Public License for more details. | ||
// The above copyright notice and this permission notice shall be included | ||
// in all copies or substantial portions of the Software. | ||
// | ||
// You should have received a copy of the GNU Affero | ||
// General Public License along with “wink-nlp-utils”. | ||
// If not, see <http://www.gnu.org/licenses/>. | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
// DEALINGS IN THE SOFTWARE. | ||
@@ -33,11 +36,13 @@ // | ||
// ### Prepare.Helper name space | ||
// Create prepare.helper name space. | ||
/** | ||
* Helper | ||
* @namespace helper | ||
*/ | ||
prepare.helper = Object.create( null ); | ||
// Words | ||
prepare.helper.words = require( './helper-return-words-filter.js' ); | ||
prepare.helper.returnWordsFilter = require( './helper-return-words-filter.js' ); | ||
prepare.helper.words = prepare.helper.returnWordsFilter; | ||
// Make better **alias** name for the `word()` function. | ||
prepare.helper.returnWordsFilter = prepare.helper.words; | ||
// Index | ||
@@ -51,5 +56,6 @@ prepare.helper.index = require( './helper-return-indexer.js' ); | ||
// ### Prepare.String Name Space | ||
// Create prepare.string name space. | ||
/** | ||
* String | ||
* @namespace string | ||
*/ | ||
prepare.string = Object.create( null ); | ||
@@ -113,5 +119,6 @@ | ||
// ### Prepare.Tokens Name Space | ||
// Create prepare.tokens name space. | ||
/** | ||
* Tokens | ||
* @namespace tokens | ||
*/ | ||
prepare.tokens = Object.create( null ); | ||
@@ -118,0 +125,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Copyleft License
License(Experimental) Copyleft license information was found.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
0
100
2807
131035
4
+ Addedwink-distance@^2.0.0
+ Addedemoji-regex@9.2.2(transitive)
+ Addedwink-distance@2.0.2(transitive)
+ Addedwink-helpers@2.0.0(transitive)
+ Addedwink-jaro-distance@2.0.0(transitive)
+ Addedwink-porter2-stemmer@2.0.1(transitive)
+ Addedwink-tokenizer@5.3.0(transitive)
- Removedwink-helpers@1.5.0(transitive)
- Removedwink-porter2-stemmer@1.0.8(transitive)
- Removedwink-tokenizer@4.1.0(transitive)
Updatedwink-helpers@^2.0.0
Updatedwink-porter2-stemmer@^2.0.0
Updatedwink-tokenizer@^5.0.0