(word, vowels="aeiouy")
| 304 | 0.30-0.50 (difficult) => 0.60-0.70 (standard) => 0.90-1.00 (very easy). |
| 305 | """ |
| 306 | def count_syllables(word, vowels="aeiouy"): |
| 307 | n = 0 |
| 308 | p = False # True if the previous character was a vowel. |
| 309 | for ch in word.endswith("e") and word[:-1] or word: |
| 310 | v = ch in vowels |
| 311 | n += int(v and not p) |
| 312 | p = v |
| 313 | return n |
| 314 | if len(string) < 3: |
| 315 | return 1.0 |
| 316 | string = string.strip() |
no outgoing calls
no test coverage detected
searching dependent graphs…