syllabize-es

Turns Spanish words into syllables, and much more.

Intro

The package tries to duplicate most of the functions from Silabeador TIP and provide some more:

It is tested against a comprehensive dataset, so the package should be quite reliable.

Example

```rust use syllabize_es::{syllable::Syllable, Word, StressType, DiphthongType};

// Convert a word into syllabized struct let word: Word = "construir".into();

// Number of syllables assert_eq!(word.syllables.len(), 2);

// First syllable, in string form asserteq!(word.syllables[0].tostring(), "cons");

// Second syllable, in struct form asserteq!( word.syllables[1], Syllable { onset: "tr".tostring(), nucleus: "ui".tostring(), coda: "r".tostring() } );

// Get syllabified string, using "-" as delimiter assert_eq!(word.syllabize("-"), "cons-truir");

// Index of the stressed syllable of word.syllables asserteq!(word.stressindex, 1);

// Named type of the stress assert_eq!(word.stress(), StressType::Oxytone);

// All existing vowel combinations let vowelcombos = word.vowelcombos();

// The word doesn't contain hiatuses or triphthongs asserteq!(vowelcombos.hiatuses.len(), 0); asserteq!(vowelcombos.triphthongs.len(), 0);

// But it contains a diphthong asserteq!(vowelcombos.diphthongs.len(), 1);

let dp = &vowelcombos.diphthongs[0]; // All its attributes asserteq!(dp.syllableindex, 1); asserteq!(dp.kind, DiphthongType::Homogenous); assert_eq!(dp.composite, "ui");

// The rhyming part of the word assert_eq!(word.rhyme(), "ir"); ```

CLI Example

shell-session $ syllabize palabra pa-la-bra

Limitations and TODOs

Some attributes aren't provided because they are trivial to tell, without syllabizing a word:

Some attributes aren't provided because it's trivial to get. For example: Tonic syllable is easy to get when you have a vector of syllables and the index of the stressed syllable.

Some features may be provided in future releases, for example:

License

MIT.

Inspirations

The package is a rewriting of the NPM package silabacion, but with a simpler interface.