An open API service indexing awesome lists of open source software.

https://github.com/foobar404/rhyme.js

Rhyme.js is a small javascript library that can detect different rhyming styles between 2 words.
https://github.com/foobar404/rhyme.js

javascript library rhymes rhyming

Last synced: about 1 month ago
JSON representation

Rhyme.js is a small javascript library that can detect different rhyming styles between 2 words.

Awesome Lists containing this project

README

          

# Rhyme.js
small javascript library for testing if 2 words rhyme

Installation


CDN

```html

```

Local file


download /js/rhyme.js and include it in your project

Example

```javascript
let r = new Rhyme();
let result = r.rhymesWith("can","man");

if(result.rhymes)
alert("these words rhyme");
```

Docs

Functions



  • rhymesWith(word1, word2, options(optional))


    • word1 & word2 are the strings you want to compare

    • options is a object with optinal properties


      • mode


        • strict : only match rhyme schemes with obvious rhymes(default)

        • loose : match all known rhyming patterns



    • return value is a object with two properties


      • types : an array of the types of rhymes that matched

      • rhymes : a boolean value thats true if a rhyme was found



  • assonant(word1,word2)


    • this is the rhyming of vowels in words but with different consonants

    • return value is a boolean, retuns true if match was found


  • consonant(word1,word2)


    • this is the rhyming of consonants but not vowels

    • return value is a boolean, retuns true if match was found


  • eye(word1,word2)


    • the rhyming in this type is based on spelling and not sound

    • return value is a boolean, retuns true if match was found


  • feminine(word1,word2)


    • also referred to as double, triple, multiple, extra-syllable, extended, this has different beginnings of the words, but rhymes latter syllables

    • return value is a boolean, retuns true if match was found


  • head(word1,word2)


    • also called alliteration or initial rhyme, this has the same initial consonant at the beginning of the words

    • return value is a boolean, retuns true if match was found


  • identical(word1,word2)


    • this is rhyming a word with itself, but often refers to a different meaning

    • return value is a boolean, retuns true if match was found


  • near(word1,word2)


    • also referred to as half, slant, approximate, off, and oblique, this rhymes the final consonants but not the vowels or initial consonants

    • return value is a boolean, retuns true if match was found


  • syllabic(word1,word2)


    • rhyming the last syllable, this is also called tail or end rhyme

    • return value is a boolean, retuns true if match was found


  • masculine(word1,word2)


    • in this rhyme, the stress in on the final syllable in both words

    • return value is a boolean, retuns true if match was found


  • perfect(word1,word2)


    • sometimes called exact, full or true, this rhyme is the typical rhyme where the ending sounds match

    • return value is a boolean, retuns true if match was found


Utility functions



  • getSyllables(word)

    • return value is an array of the word seperated into syllables (90% accuracy)