Coder Social home page Coder Social logo

wordify's Introduction

Wordify

A set of utilities for authors to get meta data from content and generally to play with words.

Build status

Usage

var wordify = require('wordify');

list

Get a unique list of words from content.

var list = wordify.list("List of words to make unique. Returns array with lots of words. Did I say lots of words?");

Result:

["array", "did", "i", "list", "lots", "make", "of", "returns", "say", "to", "unique", "with", "words" ]

stats

Returns an object with words and occurrances

var words = wordify.stats("the the the the man man man sat on the the the cat cat cat cat");

Returns:

{
	the: { count: 7 }, 
	man: { count: 3 }, 
	sat: { count: 1 }, 
	on: { count: 1 }, 
	cat: { count: 4 }
}

chunk

Break copy up based on the number of words you want in each chunk. Pass in the copy to be chunked, and the number of words in each chunk. Returns an array of strings.

wordify.chunk("this should be in first element, this should be in second element", 6)

Returns:

["this should be in first element,", "this should be in second element"]

wave

Break copy up in varying lengths forming a "wave". Lengths are characters to break into chunks at lengths specified. The length is used to find the closest space. Sizes go up, and then down, and repeated.

wordify.wave("the cat sat on the mat. The cat sat on the mat", [3, 5, 10])

Returns:

["the", "cat sat", "on the mat"]

count

Count the number of words in a string, removing any HTML and punctuation

var count = wordify.count("<p>List of words</p>");

Returns:

3

charCount

Returns the length of characters in a string. It strips out html and punctuation marks.

charCountPunctuated

Returns the length of characters in a string including punctuation marks.

wordify's People

Contributors

cdimitroulas avatar roppa avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

wordify's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.