From 797ca596a575b5569664127c97ebad0be7ee2169 Mon Sep 17 00:00:00 2001 From: Liam Rae Date: Wed, 19 Aug 2015 15:50:07 +0100 Subject: [PATCH] Added usage examples to README --- README.md | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 09213ba..27a778d 100644 --- a/README.md +++ b/README.md @@ -3,13 +3,36 @@ TextStatistics.js JavaScript port of [TextStatistics.php](https://github.com/DaveChild/Text-Statistics)! -I've done what I think is a reasonably faithful port. Documentation incoming! -I removed a lot of the original comments during the port, but seeing as the API remained largely the same, I'll add them in shortly. - -Same goes for a test suite - I'll get something working in node in a bit. :) ## Installation -Run this in the browser using a simple ```` + +Using NPM + +```npm install text-statistics``` + +## Usage + +```javascript +var stat = new textstatistics(); +``` + +Measuring Readability + +```javascript +var text = "The quick brown fox jumped over the lazy dog."; + +stat.fleschKincaidReadingEase(text); // 108.7 +``` + +Counting Letters and Syllables + +```javascript +stat.letterCount('I ate a banana'); // 11 +stat.syllableCount('banana'); // 3 +``` **[Famous! As seen in Time!](http://time.com/2958650/twitter-reading-level/)** (heh.)