Write code that, given an English word, outputs the number of syllables it has. Scoring will be determined by a combination of code length and accuracy.
- The accuracy of the solution should be measured against this CSV file (which countains syllable counts for all the 52,439 entries in the CMU Pronouncing Dictionary that are also words listed in the SOWPODS Scrabble Dictionary).
- Entries should accept any word listed in the file and return a numeric value for it; behaviour on other inputs is left undefined. Note that the words listed are all lower-case and between 2 and 15 letters long.
- The returned syllable count is correct if it corresponds to any of the listed counts for that word. Note that some words have multiple correct syllable counts, which are separated with a '|' in the CSV: eg
resume,2|3 resumed,2 resumes,2|3 resuming,3
This is a modified code-golf, with the total score being the sum of the code length in bytes and the square of percentage error (which is first rounded to the nearest percent). For example:
lambda s:2has a score of 10 (bytes) + 61*61 (squared % error) = 3731
lambda s:sum(s.count(v)for v in "aeiouy")has a score of 41 + 45*45 = 2066.