5 kyu

Haiku Checker

181 of 253anter69
Description
Loading description...
Algorithms
  • Please sign in or sign up to leave a comment.
  • jkimbell Avatar

    The lengths that I will go to, to avoid regex...

  • ahmet_popaj Avatar

    Thanks for the kata, a nice chance to exercise and practice.

  • JoshThurston Avatar

    According to the paragraph explaining what constitutes as a silent 'E' in this challenge, shouldn't apple be one syllable?

    • anter69 Avatar

      Isn't it counted as one?

    • JoshThurston Avatar

      No, had it in one of my randomized test cases and it was 2

    • anter69 Avatar

      (I suppose the language is JS, based on your profile)

      I checked the JS tests, and it counts correctly 1 syllable for "apple". If you have such an issue, please copy-paste the whole input and the error message here, so that we can help you better.

      Question marked resolved by anter69 5 years ago
  • docgunthrop Avatar

    In Python, some of the random tests are returning incorrect results. The following below are a handful of example tests that are expecting True, but should be False. It appears to affect words that end in yer, such as layer, mayor, etc. by counting them as one syllable instead of two.

    The middle line has 8 syllables.

    Loan chamber breathe pass
    Lake layer quote punishment root.
    Agreement weak pink
    

    First line has 7 syllables, but 6 per the rules of this kata (consecutive vowels, so soviet is counted as 2). Still should return False.

    Guilty soviet mayor
    Chase terrorist folk long thus
    Nor game assure war.
    
    • anter69 Avatar

      I see the issue: y is counted as a vowel, which it sometimes is, and sometimes not. I have to find a way around it... will get to work.

      But in the meantime, I really like this random haiku you quoted:

      Guilty soviet mayor
      Chase terrorist folk...
      ...war!

      What a clever piece of (artificial) intelligence ;-)

    • JohanWiltink Avatar

      Isn't "mayor" one syllable?

      I am unsure if it's worth the complications to distinguish when 'y' is a vowel and when it is not. English syllables are not easy; if you want to do it fully correct - well, you can't.

    • docgunthrop Avatar

      I've always pronounced "mayor" with 2 syllables, but, according to Merriam-Webster, there are two pronunciations (with the 2-syllables being the dominant). Either way, "layer" is not pronounced "lair" (except maybe by the type of people who say "nukular"?).

      English syllables are not easy; if you want to do it fully correct - well, you can't.

      Agreed here, but in that case, the specifics should be outlined in the Description. Another example is besides. The reference solution correctly recognizes that the word is 2 syllables, handling the rule about the silent "E" words even for plurals. But then in that case it would fail with a word such as fixes.

      The Description could be improved if there were more detail covering the special cases that are going to be tested in this kata.

    • anter69 Avatar

      ...or maybe I will just remove these pesky words from the list! :-)

    • anter69 Avatar

      In fact, I really consider that removing a few words from the word list (e.g. layer, mayor) would be the least painful solution, and would not invalidate current solutions.

    • docgunthrop Avatar

      It looks like the part of a word that has a y with adjacent vowels is considered one syllable in the tests, so a word like yoyo is regarded as one syllable.

    • anter69 Avatar

      I subtracted the "problematic" words from the list in ruby and python. However, I would need some help with JS.

      @JohanWiltink: could you do a simple update to the JS version (if it is a simple - list or similar)? Here are the list of words to be removed: ["anyone", "beyond", "buyer", "employee", "employer", "everyone", "layer", "mayor", "player", "prayer", "taxpayer"]

      Thanks

    • docgunthrop Avatar

      @anter69, I'll leave it up to you and @JohanWiltink to decide when the tests are satisfactory. Feel free to mark this issue resolved at your discretion.

    • user8436785 Avatar

      if it is a simple - list or similar

      You can't coerce an array into an integer, so you're doing NaN - NaN => NaN. I'll see if i can fix this, Johan doesn't know Python or Ruby.

    • user8436785 Avatar

      Uh, I don't have edit access,

    • anter69 Avatar

      Removed the above-mentioned words manually from all languages, closing the issue.

      If you still notice problems, please open a new issue.

      Issue marked resolved by anter69 5 years ago
    • JohanWiltink Avatar

      I didn't get notifications for this thread, so I missed that request. Thanks anter!

      ( everyone? two wrongs seem to make a right there. :P prayer? isn't that one syllable? )

    • anter69 Avatar

      Let's just skip this ;-)

  • user7820265 Avatar

    this is a 6kyu kata.

  • JohanWiltink Avatar
  • ips-james Avatar

    One of the simple test cases in Python has a typo in the input in the word "Python".

  • Voile Avatar

    Approved ;-)

  • daniloxxv Avatar

    Nice kata! Made me learn a bit more about Regex. :)