1.0.0 • Published 8 years ago

sylb-haiku v1.0.0

Weekly downloads
2
License
ISC
Repository
-
Last release
8 years ago

sylb-haiku

The Syllable Sorter for the Modern Age. ( with haiku generation. )

What does it do?

sylb sorts your words by syllable, and lets you work your magic. sylb also powers this Twitter bot.

Installation

npm install --save sylb

Then, in your code:

var sylb = require('sylb')

Now you're good to go.


Functions

.massSort(array)

  • Sorts a lot of words into their respective arrays.

.singleSort(string)

  • Sorts a single word into its respective array.

.count(string)

  • Returns the syllable count of a string.

.printDBWords()

  • Shows you the words in each syllable array.

printDBCount()

  • Shows you how many words you have in each syllable array.

haiku()

  • Generates a potentially incomplete haiku using words from your database. Used for testing.

trueHaiku()

  • Generates a complete haiku using words from your database, no matter what.

##Variable Exports

var sylb = require('sylb');
	
console.log(sylb.I) 	// one syllable array
console.log(sylb.II) 	// two syllable array
console.log(sylb.III) 	// three syllable array
console.log(sylb.IV) 	// four syllable array
console.log(sylb.V) 	// five syllable array
console.log(sylb.VI) 	// six syllable array
console.log(sylb.VII) 	// seven syllable array
console.log(sylb.VIII) 	// eight syllable array
console.log(sylb.IX) 	// nine syllable array
console.log(sylb.X) 	// ten syllable array
console.log(sylb.XI) 	// eleven syllable array

console.log(sylb.unsortable) // things sylb couldn't sort. things with no vowels go in here.

console.log(sylb.sylbArrays) // all of the above

Mass Sort Example

const sylb = require('sylb')
const fs = require('fs')

var corpus = fs.readFileSync('words.txt', 'utf8')
corpus = corpus.split(' ')
	
sylb.massSort(corpus)

sylb.printDBCount()