A short syllable in a word is either: - a vowel followed by a non-vowel other than w, x or Y and preceded by a non-vowel - a vowel at the beginning of the word followed by a non-vowel. Checks the three characters before the given index in the word (or entire word if None).
(w, before=None)
| 38 | return s in DOUBLE |
| 39 | |
| 40 | def is_short_syllable(w, before=None): |
| 41 | """ A short syllable in a word is either: |
| 42 | - a vowel followed by a non-vowel other than w, x or Y and preceded by a non-vowel |
| 43 | - a vowel at the beginning of the word followed by a non-vowel. |
| 44 | Checks the three characters before the given index in the word (or entire word if None). |
| 45 | """ |
| 46 | if before != None: |
| 47 | i = before<0 and len(w)+before or before |
| 48 | return is_short_syllable(w[max(0,i-3):i]) |
| 49 | if len(w) == 3 and is_consonant(w[0]) and is_vowel(w[1]) and is_consonant(w[2]) and w[2] not in "wxY": |
| 50 | return True |
| 51 | if len(w) == 2 and is_vowel(w[0]) and is_consonant(w[1]): |
| 52 | return True |
| 53 | return False |
| 54 | |
| 55 | def is_short(w): |
| 56 | """ A word is called short if it consists of a short syllable preceded by zero or more consonants. |
no test coverage detected
searching dependent graphs…