words / syllable

Count syllables in an English word
https://words.github.io/syllable/
MIT License
223 stars 23 forks source link

False positives for 1 syllable #37

Closed ssteigen closed 4 years ago

ssteigen commented 4 years ago

Using this with sentencer.js to create a random phrase generator with the option to restrict the number of syllables per word.

import Sentencer from 'sentencer';
import Syllable from 'syllable';

function getWordsWithSyllables(num, words) {
    return words.filter(function(word) {
        return Syllable(word) === num;
    });
};

console.log(getWordsWithSyllables(1, Sentencer._adjectives));

Results in the following output:

[
  "aged",
  "ain",
  "air",
  "bar",
  "beauish", // 2 syllables
  "biped", // 2 syllables
  "bluest", // 2 syllables
  "bluish", // 2 syllables
  "bomb",
  "broch",
  "brute",
  "chill",
  "chin",
  "crooked", // 2 syllables
  "cruel",
  "crying", // 2 syllables
  "cursed",
  "cussed",
  "dam",
  "deuced",
  "dun",
  "dying", // 2 syllables
  "freest", // 2 syllables
  "gluey", // 2 syllables
  "grave",
  "here",
  "hyoid", // 2 syllables
  "jasp",
  "jet",
  "laic",
  "learned",
  "liege",
  "louvred",
  "lying", // 2 syllables
  "male",
  "man",
  "measled", // 2 syllables
  "mere",
  "meshed",
  "mis",
  "naif",
  "naive", // 2 syllables
  "pan",
  "par",
  "pass",
  "peaked",
  "prying", // 2 syllables
  "pyoid", // 2 syllables
  "said",
  "saut",
  "shredless", // 2 syllables
  "store",
  "theist", // 2 syllables
  "toey", // 2 syllables
  "treen", // 2 syllables
  "vying", // 2 syllables
  "weest" // 2 syllables
]

English is weird! Admittedly, I had to look up the pronunciation for a number of these.

wooorm commented 4 years ago

As a non-native English speaker, English is very weird ;) Those are lovely examples, Thanks for them!

Same as https://github.com/words/syllable/issues/38#issuecomment-610573612 applies!

MichaelChambers commented 4 years ago

https://github.com/words/syllable/pull/40 fixes ying$

MichaelChambers commented 4 years ago

https://github.com/words/syllable/pull/40 now fixes (th|d)eist also

MichaelChambers commented 4 years ago

https://github.com/words/syllable/pull/40 fixed naive and shredless

MichaelChambers commented 4 years ago

@wooorm , some of the list I didn't update, as they weren't common words and/or didn't appear to be part of a many-word-rule. I didn't update any of these. Instead of rules, perhaps these all could go into problematic as one-off exceptions. "beauish", // 2 syllables "biped", // 2 syllables "bluest", // 2 syllables "bluish", // 2 syllables "crooked", // 2 syllables "freest", // 2 syllables "gluey", // 2 syllables "hyoid", // 2 syllables "measled", // 2 syllables "pyoid", // 2 syllables "toey", // 2 syllables "treen", // 2 syllables "weest" // 2 syllables

wooorm commented 4 years ago

If possible, the problematic list should be kept as short as possible. But yup, if there are no patterns in those words, that makes sense!