Skip to content
This repository was archived by the owner on Sep 21, 2021. It is now read-only.

Added usage examples to README #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 28 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<script>` include - or you can install for node with `npm install text-statistics`.
Using a simple script include

```<script src="text-statistics.js"></script>```

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.)