5 kyu

Readability is King

234 of 1,004matstc
Description
Loading description...
Mathematics
Algorithms
  • Please sign in or sign up to leave a comment.
  • Machinist80 Avatar

    I don't know why, but this is ranked as a 5 kyu kata, for which you're supposed to win 21 points, but I only won 8 points initially, which turned to 9 points when I refreshed my profile. Weird.

  • tilr88 Avatar

    Fixed 0.01 rounding errors in python by using 11.80 instead of 11.8

  • JohanWiltink Avatar

    ( JS, possibly others )

    • Random tests sometimes generate sentences ending in " ."
    • Random tests sometimes generate words without vowels

    These things make counting words difficult, because they are not normal syllables, words, and sentences. The reference solution counts "lbl" as 1 word and 0 syllables. This may strictly comply with the specs, but I'd say it's not in the spirit of it.

  • saudiGuy Avatar

    python new test framework is required. updated in this fork

  • ahmet_popaj Avatar

    Heads off to the creator for this brain-teasing challenge, diving into katas is very enlightening, kudos...

  • tdm725 Avatar

    I got a weird error for the random tests but could not figure out why.

  • mauro-1 Avatar

    Same issue in ALL kata with floats:

    Don't round float results!

    https://docs.codewars.com/authoring/kata/floating-point/

  • user8436785 Avatar

    needs random tests

  • Firefly2002 Avatar

    At least in Javascript: The tests don't require rounding to two places simply because they all happen to be at two digits of precision. The description mentions ignoring dashes, hyphens, apostrophes, ellipses and abbreviations, but none of those appear anywhere.

  • iamchingel Avatar

    I am getting this error TypeError: fleschKincaid(...).toFixed is not a function. how to deal with it?

  • Vinh-CHUC Avatar

    This comment has been hidden.

  • jolaf Avatar

    I have strange problems with Random tests in Python version. Some of them pass, while some not.

    For example, let's take the test Cuddles a cute cuddles sleeps fun pippi? Cover cover hyperactive? Ubercuteness soft cuddles? Pippi sweet chair cute pippi.

    My solution sees 4 sentences, 18 words and 35 syllables in it, so the result should be 0.39 * 18 / 4 + 11.8 * 35 / 18 - 15.59 = 9.11, however I get the following error:

    It should work for random inputs too: 9.11 should equal 14.37

    However, my solution produces 14.37 if the number of sentences in this test is supposed to be 1.

    So my guess is that random test checker doesn't count ? as end of sentence, as it probably should.

  • jolaf Avatar

    Bug in Python version. When I submit my solution, at the first Random test I get the following error:

    NameError: global name 'findall' is not defined

    I don't use global findall nor import it, so it looks like not my fault.

  • GiacomoSorbi Avatar

    Translated into Python, if you wish to approve it :)

    Let me know if you may appreciate random test cases in both JS and Ruby and thanks for this kata :)

  • TehCupcakes Avatar

    This comment has been hidden.

  • IGRACH Avatar

    I'm getting TypeError: Object 3.67 has no method 'toFixed' at Array.forEach But it works in node on my PC node v0.10.35

  • laomatt Avatar

    This comment has been hidden.

  • laomatt Avatar

    lol, the test for my code says "Grade level should be 3.67 but was 3.67. The text was: The turtle is leaving. " , is 3.67 not equal to 3.67?

  • mayurarora Avatar

    For the first two test-cases:
    Grade level should be -1.06 but was -1.06. The text was: A good book is hard to find. - Expected: -1.06, instead got: -1.06
    Grade level should be 3.67 but was 3.67. The text was: The turtle is leaving. - Expected: 3.67, instead got: 3.67

    Also, for the third one , isn't the answer incorrect ? We have 10 words and the average no. of syllables is 1.1.

     ( 0.39 * 10 ) + (11.8 * 1.1 ) - 15.39 != 0.66 

    What am I missing here ?

  • ooflorent Avatar

    You should add some randomness:

    var txts = [
      // ...
    ]
    
    for (var i = Math.random() * 10 | 0; i--;) {
      txts.sort(function() { return Math.random() - 0.5 })
    }
    
  • wthit56 Avatar

    Enjoyed this one. Simple and straightforward.

    I wish a margin of error was allowed what with float's innaccuracies and such, though. It seems we're forced to do a +number.toFixed() hack to pass the tests, but this should really be the job of the test.

  • ZozoFouchtra Avatar

    JS-translation kumited.

  • jacobb Avatar

    You could be a bit more detailed in your definition of a sentence. I'm guessing [.?!] is what you're looking for, but better to be explicit. E.g. […] (single char, by the way) could count too.

  • pjfranzini Avatar

    Nice kata, however the testing could be tightened up (see comments in my solution).