GithubHelp home page GithubHelp logo

weiwei / silabacion Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 0.0 3.32 MB

Convert Spanish words into syllables

Home Page: https://www.npmjs.com/package/silabacion

License: MIT License

TypeScript 100.00%
text-processing spanish syllabification word

silabacion's Introduction

Silabación

Separate Spanish words into syllables.

build-test codecov

Installation

As with any other NPM package, you can install it with npm or yarn.

Usage

import { Word, Stress } from 'silabacion';

const word = new Word('hispanófilo');
console.log(word.word); // hispanófilo
console.log(word.length); // 11
console.log(word.syllables.length); // 5
console.log(word.syllables[0]); // { onset: 'h', nucleus: 'i', coda: 's' }
console.log(Stress[word.stress]); // Proparoxytone
console.log(word.rhyme); // ófilo
console.log(word.tonic); // { onset: 'f', nucleus: 'i', coda: '' }

const word = new Word('aéreo');
console.log(word.hiatuses);
// [
//   { syllableIndex: 0, composite: 'aé', type: 1 },
//   { syllableIndex: 2, composite: 'eo', type: 0 }
// ]
console.log(word.diphthongs);
// []
console.log(word.triphthongs);
// []

// Note: diphthongs and hiatuses have a enum type attribute
export enum HiatusType {
  Simple,
  Acentual,
}

export enum DiphthongType {
  Creciente,
  Decreciente,
  Homogéneo,
}

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Compare

  • silabas.js only separates syllables. GNU licensed.
  • silabajs functionally comparable. It's in pure js instead of typescript.

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.