diaeresis_verbs.py (710B)
1 #!/usr/bin/python3 2 3 import os 4 import sys 5 6 # modules are in the parent folder 7 sys.path.insert(1, os.path.join(sys.path[0], '..')) 8 9 from common import consonants 10 11 for l in sys.stdin.readlines(): 12 w = l.strip() 13 if w.endswith("ions"): 14 lens = 4 15 else: 16 lens = 3 17 if (len(w) < lens+2): 18 print ("1 %s" % w) 19 continue 20 x = w[-lens-2] 21 y = w[-lens-1] 22 if not x in consonants or not y in consonants or x == y: 23 print ("1 %s" % w) 24 continue 25 # inspired by 26 # https://www.cairn.info/revue-litteratures-classiques-2015-3-page-187.htm 27 if y in "rl" and x not in "rl": 28 print ("2 %s" % w) 29 continue 30 print ("1 %s" % w) 31 continue 32 33