MCPcopy Index your code
hub / github.com/clips/pattern / attributive

Function attributive

pattern/text/nl/inflect.py:352–376  ·  view source on GitHub ↗

For a predicative adjective, returns the attributive form (lowercase). In Dutch, the attributive is formed with -e: "fel" => "felle kritiek".

(adjective)

Source from the content-addressed store, hash-verified

350}
351
352def attributive(adjective):
353 """ For a predicative adjective, returns the attributive form (lowercase).
354 In Dutch, the attributive is formed with -e: "fel" => "felle kritiek".
355 """
356 w = adjective.lower()
357 if w in adjective_attributive:
358 return adjective_attributive[w]
359 if w.endswith("e"):
360 return w
361 if w.endswith(("er","st")) and len(w) > 4:
362 return w + "e"
363 if w.endswith("ees"):
364 return w[:-2] + w[-1] + "e"
365 if w.endswith("el") and len(w) > 2 and not is_vowel(w[-3]):
366 return w + "e"
367 if w.endswith("ig"):
368 return w + "e"
369 if len(w) > 2 and (not is_vowel(w[-1]) and is_vowel(w[-2]) and is_vowel(w[-3]) or w[:-1].endswith("ij")):
370 if w.endswith("f"): w = w[:-1] + "v"
371 if w.endswith("s"): w = w[:-1] + "z"
372 if w[-2] == w[-3]:
373 w = w[:-2] + w[-1]
374 elif len(w) > 1 and is_vowel(w[-2]) and w.endswith(tuple("bdfgklmnprst")):
375 w = w + w[-1]
376 return w + "e"
377
378adjective_predicative = dict((v,k) for k,v in adjective_attributive.iteritems())
379adjective_predicative.update({

Callers 1

loadMethod · 0.90

Calls 2

lenFunction · 0.85
is_vowelFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…