Returns the predicative adjective (lowercase). In Spanish, the attributive form is always used for descriptive adjectives: "el chico alto" => masculine, "la chica alta" => feminine. The predicative is useful for lemmatization.
(adjective)
| 400 | #print attributive("normal", gender=PLURAL) # normales |
| 401 | |
| 402 | def predicative(adjective): |
| 403 | """ Returns the predicative adjective (lowercase). |
| 404 | In Spanish, the attributive form is always used for descriptive adjectives: |
| 405 | "el chico alto" => masculine, |
| 406 | "la chica alta" => feminine. |
| 407 | The predicative is useful for lemmatization. |
| 408 | """ |
| 409 | w = adjective.lower() |
| 410 | # histéricos => histérico |
| 411 | if w.endswith(("os", "as")): |
| 412 | w = w[:-1] |
| 413 | # histérico => histérico |
| 414 | if w.endswith("o"): |
| 415 | return w |
| 416 | # histérica => histérico |
| 417 | if w.endswith("a"): |
| 418 | return w[:-1] + "o" |
| 419 | # horribles => horrible, humorales => humoral |
| 420 | if w.endswith("es"): |
| 421 | if len(w) >= 4 and not is_vowel(normalize(w[-3])) and not is_vowel(normalize(w[-4])): |
| 422 | return w[:-1] |
| 423 | return w[:-2] |
| 424 | return w |
no test coverage detected
searching dependent graphs…