1.2.0 • Published 4 years ago

extractwords v1.2.0

Weekly downloads
11
License
MIT
Repository
github
Last release
4 years ago

extractwords Build Status

Install

$ npm install extractwords

Usage

const extractwords = require('extractwords');

extractwords('Good Morning, how are you?');
//=> ['Good', 'Morning', 'how', 'are', 'you']

extractwords("He didn't pay for his meal m'aam");
//=> ['He', "didn't", 'pay', 'for', 'his', 'meal', "m'aam"]

extractwords("17651Hello*&!(*2I'm_++`~gOOd 2");
//=> ['Hello', "I'm", 'gOOd']

extractwords('Good morning, how are you?', {lowercase: true});
//=> ['good', 'morning', 'how', 'are', 'you']

extractwords('Good Morning. how are you?', {punctuation: true});
//=> ['Good', 'Morning.', 'how', 'are', 'you?']

extractwords('I . am ... go0d 2', {punctuation: true});
//=> ['I', '.', 'am', '...', 'go0d', '2']

API

extractwords(str, options)

str

Type: string

Text containing words to be extracted.

options

Type: object

lowercase

Type: boolean Default: false

If true, all words returned are lowercased.

punctuation

Type: boolean Default: false

If true, all punctuation is retained.