riman

checks if two words rhymes in spanish and more.

Usage no npm install needed!

<script type="module">
  import riman from 'https://cdn.skypack.dev/riman';
</script>

README

riman

Check if two words rhyme in Spanish

It also provides you with relevant infromation about words such as assonace rhyme, consonant rhyme, syllables, stressed syllable...

Here is a DEMO so you can try some rhymes.

Installation

npm install riman

Usage 1

ES6

import * as riman from "riman";

OR

const riman = require("riman");
console.log(riman.analyze("maravilloso", "espantoso"));

Result 1

{
  riman: true,
  tipoRima: 'consonante', // consonante | asonante
  palabraUno: {
    palabra: 'maravilloso',
    rimaConsonante: 'oso',
    rimaAsonante: 'oo',
    longitudPalabra: 11,
    numSilabas: 5,
    silabas: [ 'ma', 'ra', 'vi', 'llo', 'so' ],
    acentuacion: 'Grave (Llana)', // Aguda | Grave (Llana) | Esdrujula
    tonica: 4,
    EsPrimeraVocal: false,
    EsUltimaVocal: true,
    EsPrimeraVocalTonica: false,
    hiato: [], // For example 'a-e' or 'i-a'
    diptongo: [], // For example ui or au
    triptongo: [] // For example uey
  },
  palabraDos: {
    palabra: 'espantoso',
    rimaConsonante: 'oso',
    rimaAsonante: 'oo',
    longitudPalabra: 9,
    numSilabas: 4,
    silabas: [ 'es', 'pan', 'to', 'so' ],
    acentuacion: 'Grave (Llana)', // Aguda | Grave (Llana) | Esdrujula
    tonica: 3,
    EsPrimeraVocal: true,
    EsUltimaVocal: true,
    EsPrimeraVocalTonica: false,
    hiato: [], // For example 'a-e' or 'i-a'
    diptongo: [], // For example ui or au
    triptongo: [] // For example uey
  }
}

Usage 2

ES6

import * as riman from "riman";

OR

const riman = require("riman");
console.log(riman.analyzeWord("aguacate"));

Result 2

{
  palabra: 'aguacate',
  rimaConsonante: 'ate',
  rimaAsonante: 'ae',
  longitudPalabra: 8,
  numSilabas: 4,
  silabas: [ 'a', 'gua', 'ca', 'te' ],
  acentuacion: 'Grave (Llana)', // Aguda | Grave (Llana) | Esdrujula
  tonica: 3,
  EsPrimeraVocal: true,
  EsUltimaVocal: true,
  EsPrimeraVocalTonica: false,
  hiato: [], // For example 'a-e' or 'i-a'
  diptongo: [ 'ua' ], // For example ui or au
  triptongo: [] // For example uey
}

Values Definitions

CHECK GITHUB FOR SPANISH/ENGLISH README

riman: boolean identify whether the two words entered rhyme.

tipoRima:string if both vowels and consonants rhyme from the stressed syllable it is consonant rhyme, if only vowels rhyme it is assonance rhyme.

palabraUno y palabraDos: object they contain the information of the two words.

palabra:string the word entered in lowercase.

rimaConsonante:string word ending from the stressed syllable taking into account consonants and vowels.

rimaAsonante:string word ending from the stressed syllable taking into account only vowels.

longitudPalabra:number number of letters in the word.

numSilabas:number number of syllables in the word.

silabas:array word separated by syllables.

acentuacion:string indicates if the word is Aguda, LLana or Esdrujula. words stressed on the last syllable are Aguda, the penultimate syllable are Llana, and the antepenultimate syllable are Esdrujula.

tonica:number indicates syllable position that has the accent of the word, but does not necessarily have an accent mark. That is to say the stressed syllable.

EsPrimeraVocal:boolean indicates if the first letter of the word is a vowel (useful for verse metrics)

EsUltimaVocal:boolean indicates if the last letter of the word is a vowel (useful for verse metrics)

EsPrimeraVocalTonica:boolean indicates if the first letter of the word is vowel and tonic or stressed (useful for the metric of verses)

hiato:array shows if there are two vowels in a row that are in different syllables (hiatus).

diptongo:array shows if there are two vowels in a row on the same syllable (diphthong).

triptongo:array shows if there are three vowels in a row on the same syllable (triphthong).

Related

I have used two npm modules, rimador and silabea. Both libraries are old, nobody maintains them and they have errors. I have redone some of its functionalities and improved them.

HELP ME IMPROVE THIS LIBRARY BY REPORTING BUGS IN GITHUB