Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tariqksoliman/syllarhyme
An npm package for counting syllables and rhyming words.
https://github.com/tariqksoliman/syllarhyme
arpabet cmu-pronunciation-dictionary ipa pronunciation rhyme rhymes syllable syllables
Last synced: 3 days ago
JSON representation
An npm package for counting syllables and rhyming words.
- Host: GitHub
- URL: https://github.com/tariqksoliman/syllarhyme
- Owner: tariqksoliman
- License: mit
- Created: 2017-03-31T20:33:51.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-04-03T01:41:57.000Z (over 7 years ago)
- Last Synced: 2024-10-31T19:54:33.114Z (8 days ago)
- Topics: arpabet, cmu-pronunciation-dictionary, ipa, pronunciation, rhyme, rhymes, syllable, syllables
- Language: JavaScript
- Size: 1.54 MB
- Stars: 9
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SyllaRhyme
An npm package for counting syllables and rhyming words.## Installation
```npm install syllarhyme```
### Nodeless
If you want it working straight in a browser:* Copy the contents of the ```nodeless/SyllaRhyme``` folder.
* Make sure the file paths at the top of ```SyllaRhyme.js``` point correctly.
* Then just include the script with UTF-8 encoding:``````
## Usage
```javascript
var SyllaRhyme = require( 'syllarhyme' ); //if using NodeSyllaRhyme( function( sr ) {
console.log( sr.rhymes( 'rhymes' ) );
//["chimes", "dime's", "dimes", "heims", "himes", "hymes", "imes", "kimes", "climbs", "climes", "limes", "grimes", "crime's", "crimes", "crymes", "prime's", "primes", "rimes", "simes", "symes", "sometimes", "time's", "times", "times'"]
console.log( sr.rhymesWith( 'rhymes', 'with' ) );
//false
console.log( sr.pronunciation( 'pronunciation' ) );
//["P R OW0 N AH2 N S IY0 EY1 SH AH0 N", "P R AH0 N AH2 N S IY0 EY1 SH AH0 N"]
console.log( sr.pronunciation( 'pronunciation', 'ipa' ) );
//["p r oʊ n ʌ n s i eɪ ʃ ə n", "p r ə n ʌ n s i eɪ ʃ ə n"]
console.log( sr.syllables( 'syllables' ) );
//3
} );
```
## Functions### rhymes( word )
* Returns a string array of all matching rhyming words (excluding itself).### rhymesWith( word1, word2 )
* Returns a boolean of whether the words rhyme (true if words are the same).### pronunciation( word, type *optional* )
* Returns a string array of possible pronunciations with space separated phonemes. By default it returns [Arpabet](https://en.wikipedia.org/wiki/Arpabet) transcriptions. If ```type``` is set to ```'ipa'```, it'll return [IPA](https://en.wikipedia.org/wiki/Help:IPA_for_English) transcriptions instead.### syllables( str )
* Return an int indicating the number of syllables in word/sentence/string.