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

Class Verbs

pattern/text/it/inflect.py:276–397  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

274]
275
276class Verbs(_Verbs):
277
278 def __init__(self):
279 _Verbs.__init__(self, os.path.join(MODULE, "it-verbs.txt"),
280 language = "it",
281 default = {},
282 format = [
283 0, 1, 2, 3, 4, 5, 6, 8, # indicativo presente
284 34, 35, 36, 37, 38, 39, 24, # indicativo passato remoto
285 17, 18, 19, 20, 21, 22, # indicativo imperfetto
286 40, 41, 42, 43, 44, 45, # indicativo futuro semplice
287 46, 47, 48, 49, 50, 51, # condizionale presente
288 52, 521,53, 54, 541, # imperativo
289 55, 56, 57, 58, 59, 60, # congiuntivo presente
290 67, 68, 69, 70, 71, 72 # congiontive imperfetto
291 ])
292
293 def find_lemma(self, verb):
294 """ Returns the base form of the given inflected verb, using a rule-based approach.
295 """
296 v = verb.lower()
297 # Probably infinitive if ends in -are, -ere, -ire or reflexive -rsi.
298 if v.endswith(("are", "ere", "ire", "rsi")):
299 return v
300 # Ruleset adds 3% accuracy.
301 for a, b in verb_majority_vote:
302 if v.endswith(a):
303 return v[:-len(a)] + b
304 v = v.replace("cha", "ca")
305 v = v.replace("che", "ce")
306 v = v.replace("gha", "ga")
307 v = v.replace("ghe", "ge")
308 v = v.replace("ghi", "gi")
309 v = v.replace("gge", "ggie")
310 # Many verbs end in -ire and have a regular inflection:
311 for x in ((
312 u"irò", "irai", u"irà", "iremo", "irete", "iranno", # future
313 "irei", "iresti", "irebbe", "iremmo", "ireste", "irebbero", # conditional
314 "ascano", # subjunctive I
315 "issi", "isse", "issimo", "iste", "issero", # subjunctive II
316 "ivo", "ivi", "iva", "ivamo", "ivate", "ivano", # past imperfective
317 "isti", "immo", "iste", "irono", "ito", # past perfective
318 "isco", "isci", "isce", "ite", "iscono", "indo")): # present
319 if v.endswith(x):
320 return v[:-len(x)] + "ire"
321 # Many verbs end in -are and have a regular inflection:
322 for x in ((
323 u"erò", "erai", u"erà", "eremo", "erete", "eranno", # future
324 "erei", "eresti", "erebbe", "eremmo", "ereste", "erebbero", # conditional
325 "iamo", "iate", "ino", # subjunctive I
326 "assi", "asse", "assimo", "aste", "assero", # subjunctive II
327 "avo", "avi", "ava", "avamo", "avate", "avano", # past imperfective
328 "ai", "asti", u"ò", "ammo", "aste", "arono", "ato", # past perfective
329 "iamo", "ate", "ano", "ando")): # present
330 if v.endswith(x):
331 return v[:-len(x)] + "are"
332 # Many verbs end in -ere and have a regular inflection:
333 for x in ((

Callers 1

inflect.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…