
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
text-preprocessor
Advanced tools
Normalizing texts before any natural language processing
Using Yarn:
yarn add text-preprocessor
Or using NPM:
npm i --save text-preprocessor
const preprocessor = require('text-preprocessor');
const text = preprocessor(' that`s great! \n \t & but don’t take too long okay? \n bjŏȒk—Ɏó ');
text.clean()
.toLowerCase()
.unescape()
.killUnicode()
.normalizeSingleCurlyQuotes()
.expandContractions();
console.log(text.toString());
// OUTPUT: "that is great! & but do not take too long okay? bjork-yo"
TextPreprocessor
Constructs a TextPreprocessor instance
Param | Type |
---|---|
text | String |
Normalizing texts before any natural language processing
Param | Type |
---|---|
text | string |
and strips extra whitespace from all documents, leaving only at most one whitespace between any two other characters.
Kind: instance method of TextPreprocessor
Converts the HTML entities &, <, >, ", and ' in string to their corresponding characters.
Kind: instance method of TextPreprocessor
Converts all the alphabetic characters in a string to lowercase.
Kind: instance method of TextPreprocessor
returns the result of chains so far
Kind: instance method of TextPreprocessor
Replaces all occuring English contractions by their expanded equivalents, e.g. "don't" is changed to "do not".
Kind: instance method of TextPreprocessor
Replaces hugely-ignorant, and widely subjective transliteration of latin, cryllic, greek unicode characters with english ascii.
Kind: instance method of TextPreprocessor
Replaces any occurrence of the given expression with the givven string
Kind: instance method of TextPreprocessor
Param | Type |
---|---|
regexp | RegExp |
value | String |
Removes any occurrence of the given expression
Kind: instance method of TextPreprocessor
Param | Type |
---|---|
regexp | RegExp |
Removes #tags, @mentions from start of the text
Kind: instance method of TextPreprocessor
Removes all special charachters
Kind: instance method of TextPreprocessor
Removes Urls and emails
Kind: instance method of TextPreprocessor
Remove brackets and parentheses contents.
Kind: instance method of TextPreprocessor
Example
`Hello, this is Mike (example)` to `Hello, this is Mike `
Removes punctuation from end of the text
Kind: instance method of TextPreprocessor
Coerce single curly quotes. don’t
to don't
Kind: instance method of TextPreprocessor
Coerce double curly quotes. it is «Khorzu”
to it is "Khorzu"
Kind: instance method of TextPreprocessor
clean
,toLowerCase
,unescape
,killUnicode
and normalizeSingleCurlyQuotes
Kind: instance method of TextPreprocessor
Executes chain of givven method names
Kind: instance method of TextPreprocessor
TextPreprocessor
Normalizing texts before any natural language processing
Kind: global function
Param | Type |
---|---|
text | String |
FAQs
Normalizing texts before any natural language processing
The npm package text-preprocessor receives a total of 30 weekly downloads. As such, text-preprocessor popularity was classified as not popular.
We found that text-preprocessor demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.