Easily clean text for analysis
npm install text-cleanerA small tool for easily cleaning text.


```
npm install text-cleaner --save
`javascript
const TextCleaner = require('text-cleaner');
TextCleaner('Some TEXT to Clean').stripHtml().condense().toLowerCase().valueOf();
// some text to clean
`
javascript
const cleanString = TextCleaner('string');
`
Returns an object, with the following methods:$3
Returns the current working value of the string being cleaned
`javascript
TextCleaner('STRING').valueOf()
// "STRING"
TextCleaner('STRING').toString()
// "STRING"
`$3
`javascript
TextCleaner('string').length
// 6
`$3
`javascript
TextCleaner('string').remove('tr').valueOf()
// "sing"
`$3
`javascript
TextCleaner('string').replace('tr', 'l').valueOf()
// "sling"
`$3
`javascript
TextCleaner(' string ').trim().valueOf()
// "string"
`$3
`javascript
TextCleaner('STRING').toLowerCase().valueOf()
// "string"
`$3
`javascript
TextCleaner('string').toUpperCase().valueOf()
// "STRING"
`$3
`javascript
TextCleaner('a long string').truncate(6).valueOf()
// "a long"
`$3
Condenses all white space to a single space
`javascript
TextCleaner('s \t t \nr i n g').condense().valueOf()
// "s t r i n g"
`$3
`javascript
TextCleaner('Email me at: me@here.com').stripEmails().valueOf()
// "Email me at: "
`$3
`javascript
TextCleaner('string').stripHtml().valueOf()
// "string"
`$3
Remove all non-alpha characters, including numbers. Only letters, white space and characters specified in the exclude option will not be removed.Options (object):
- replaceWith (default: "") Character to replace matched characters with. Allows for characters to be replaced by a space, preventing words from merging on character removal.
- exclude: (default: "") String of characters to exclude. These are added to a regular expression; e.g. "0-9" would exclude numbers from replacement
`javascript
TextCleaner('~string1!').removeChars({ exclude: '!' }).valueOf()
// "string!"
`$3
Remove apostrophes from the text, but leave other single quotes in the text.
`javascript
TextCleaner("a quote: 'he didn't'").removeApostrophes().valueOf()
// "a quote: 'he didnt'"
`
Allows words containing apostrophes to be treated separately to removeChars(), such as when replacing characters with a space with removeChars({ replaceWith: ' ' }), preserving the word.`javascript
/ undesired behaviour /
TextCleaner("don't(text)").removeChars({ replaceWith: ' ' }).trim().valueOf()
// "don t text"/ desired behaviour /
TextCleaner("don't(text)").removeApostrophes().removeChars({ replaceWith: ' ' }).trim().valueOf()
// "dont text"
`$3
Remove common stop words from the text for textual/sentiment anlysis. Uses stopword.`javascript
TextCleaner("the test string with some words").removeStopWords().valueOf()
// "test string words"
``