Giter Site home page Giter Site logo

tariqksoliman / syllarhyme Goto Github PK

View Code? Open in Web Editor NEW
9.0 1.0 4.0 1.58 MB

An npm package for counting syllables and rhyming words.

License: MIT License

Python 3.11% JavaScript 94.39% HTML 2.50%
rhyme syllable rhymes syllables arpabet ipa pronunciation cmu-pronunciation-dictionary

syllarhyme's Introduction

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:

    <script src="SyllaRhyme/SyllaRhyme.js" charset="utf-8"></script>

Usage

var SyllaRhyme = require( 'syllarhyme' ); //if using Node  

SyllaRhyme( 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 transcriptions. If type is set to 'ipa', it'll return IPA transcriptions instead.

syllables( str )

  • Return an int indicating the number of syllables in word/sentence/string.

syllarhyme's People

Contributors

tariqksoliman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.