npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

metrica-verso

v1.0.2

Published

Analyzes the metric of a verse in Spanish

Downloads

13

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