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

Function definite_article

pattern/text/it/inflect.py:63–76  ·  view source on GitHub ↗

Returns the definite article for a given word.

(word, gender=MALE)

Source from the content-addressed store, hash-verified

61zs = lambda w: w and (w[:1] == "z" or (w[:1] == "s" and not is_vowel(w[1:2])))
62
63def definite_article(word, gender=MALE):
64 """ Returns the definite article for a given word.
65 """
66 if PLURAL in gender and MALE in gender and (is_vowel(word[:1]) or zs(word)):
67 return "gli"
68 if PLURAL not in gender and word and is_vowel(word[:1]):
69 return "l'"
70 if PLURAL not in gender and MALE in gender and zs(word):
71 return "lo"
72 if MALE in gender:
73 return PLURAL in gender and "i" or "il"
74 if FEMALE in gender:
75 return PLURAL in gender and "le" or "la"
76 return "il"
77
78def indefinite_article(word, gender=MALE):
79 """ Returns the indefinite article for a given word.

Callers 1

articleFunction · 0.70

Calls 1

is_vowelFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…