Returns the comparative or superlative form of the given adjective.
(adjective, suffix=COMPARATIVE)
| 764 | return n |
| 765 | |
| 766 | def grade(adjective, suffix=COMPARATIVE): |
| 767 | """ Returns the comparative or superlative form of the given adjective. |
| 768 | """ |
| 769 | n = _count_syllables(adjective) |
| 770 | if adjective in grade_irregular: |
| 771 | # A number of adjectives inflect irregularly. |
| 772 | return grade_irregular[adjective][suffix != COMPARATIVE] |
| 773 | elif adjective in grade_uninflected: |
| 774 | # A number of adjectives don't inflect at all. |
| 775 | return "%s %s" % (suffix == COMPARATIVE and "more" or "most", adjective) |
| 776 | elif n <= 2 and adjective.endswith("e"): |
| 777 | # With one syllable and ending with an e: larger, wiser. |
| 778 | suffix = suffix.lstrip("e") |
| 779 | elif n == 1 and len(adjective) >= 3 \ |
| 780 | and adjective[-1] not in VOWELS and adjective[-2] in VOWELS and adjective[-3] not in VOWELS: |
| 781 | # With one syllable ending with consonant-vowel-consonant: bigger, thinner. |
| 782 | if not adjective.endswith(("w")): # Exceptions: lower, newer. |
| 783 | suffix = adjective[-1] + suffix |
| 784 | elif n == 1: |
| 785 | # With one syllable ending with more consonants or vowels: briefer. |
| 786 | pass |
| 787 | elif n == 2 and adjective.endswith("y"): |
| 788 | # With two syllables ending with a y: funnier, hairier. |
| 789 | adjective = adjective[:-1] + "i" |
| 790 | elif n == 2 and adjective[-2:] in ("er", "le", "ow"): |
| 791 | # With two syllables and specific suffixes: gentler, narrower. |
| 792 | pass |
| 793 | else: |
| 794 | # With three or more syllables: more generous, more important. |
| 795 | return "%s %s" % (suffix==COMPARATIVE and "more" or "most", adjective) |
| 796 | return adjective + suffix |
| 797 | |
| 798 | def comparative(adjective): |
| 799 | return grade(adjective, COMPARATIVE) |
no test coverage detected
searching dependent graphs…