string-punctuation-tokenizer

2.2.0 • Public • Published

npm npm

string-punctuation-tokenizer

Small library that provides functions to tokenize a string into an array of words with or without punctuation

Setup

npm install string-punctuation-tokenizer

Usage

var stringTokenizer = require('string-punctuation-tokenizer');

or ES6

import {tokenize} from 'string-punctuation-tokenizer';

Tokenize with punctuation

import {tokenize} from './src/tokenizers'; // use the import from above instead of this
let words = tokenize({text: 'Hello world, my name is Manny!', includePunctuation: true});
// words = ["Hello", "world", ",", "my", "name", "is", "Manny", "!"]

Tokenize without punctuation

import {tokenize} from './src/tokenizers'; // use the import from above instead of this
let words = tokenize({text: 'Hello world, my name is Manny!'});
// words = ["Hello", "world", "my", "name", "is", "Manny"]

Documentation

See detailed documentation and live WYSIWYG playground here: https://string-punctuation-tokenizer.netlify.app/#/Tokenize

/string-punctuation-tokenizer/

    Package Sidebar

    Install

    npm i string-punctuation-tokenizer

    Weekly Downloads

    399

    Version

    2.2.0

    License

    MIT

    Unpacked Size

    83.9 kB

    Total Files

    30

    Last publish

    Collaborators

    • abelpz
    • larsgson
    • jakobaleksandrovich
    • neutrinog
    • klappy
    • photo-nomad
    • richmahn
    • mandolyte
    • jag3773
    • mvahowe
    • macolon