metrica-verso
v1.0.2
Published
Analyzes the metric of a verse in Spanish
Downloads
13
Maintainers
Readme
metrica-verso
Analyzes the meter of a verse in Spanish
It takes into account the synalepha and the diereis (I will soon add a function that predicts the hiatus based on a given metric).
Install
npm install metrica-verso
Usage 1
ES6
import * as metrica from "metrica-verso";
OR
const metrica = require("metrica-verso");
console.log(metrica.analyze("Un soneto me manda hacer Violante"));
Result
{
metricaSilabas: 11,
totalSilabas: 12,
palabras: [ 'un', 'soneto', 'me', 'manda', 'hacer', 'violante' ],
silabasPorPalabra: [
[ 1, 'un' ],
[ 3, 'soneto' ],
[ 1, 'me' ],
[ 2, 'manda' ],
[ 2, 'hacer' ],
[ 3, 'violante' ]
],
sinalefa: [ [ 'manda', 'hacer' ] ],
dieresis: [],
posibleDieresis: [ 'violante' ],
posibleSineresis: [],
posibleHiato: [],
ultimaPalabra: {
palabra: 'violante',
rimaConsonante: 'ante',
rimaAsonante: 'ae',
tonica: 2,
acentuacion: 'Grave (Llana)',
silabas: [ 'vio', 'lan', 'te' ]
}
}
Values Definitions
metricaSilabas: number
number of syllables taking into account the synalepha and the dieresis.
totalSilabas: number
number of syllables without taking into account any kind of poetic license (real number of syllables).
palabras: string[]
list of words entered.
silabasPorPalabra: [number, string][]
number of syllables per word.
sinalefa: [string, string][]
indicates between which two words there is sinalefa (count one less syllable per synalepha).
dieresis: string[]
indicates if any of the words with hiatus has a dieresis added (one less syllable is counted per dieresis).
posibleDieresis: string[]
show words that have a hiatus and therefore could be used with dieresis.
posibleSineresis: string[]
shows words that have a diphthong and therefore can be broken to get one more syllable.
posibleHiato: [string, string][]
shows where you could break the synalepha to get one more syllable in the verse.
ultimaPalabra: object
contains information about the last word.
palabra: string
last word.
rimaConsonante: string
last word ending from the stressed syllable taking into account consonants and vowels.
rimaAsonante: string
last word ending from the stressed syllable taking into account only vowels.
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.
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. (Aguda -> +1 syllable || Esdrujula -> -1 syllable).
silabas: string[]
last word separated by syllables.
Related
Maybe you may be interested in this other library that tells you if two words rhyme and more: RIMAM
HELP ME IMPROVE THIS LIBRARY BY REPORTING BUGS IN GITHUB