commit fd634c864021ae23956e620dd97e0a98a6b3856f Author: koguzhan Date: Sun Jun 23 21:38:40 2019 +0200 script for lexc words diff --git a/dev/kirmonofy.py b/dev/kirmonofy.py new file mode 100644 index 0000000..e9485e4 --- /dev/null +++ b/dev/kirmonofy.py @@ -0,0 +1,61 @@ +import sys, os + +def monofy(line,left=True): + dic = { '':'A1', + '':"ADV", + '':"N-INFL", + '':"NP-TOP", + '':"POST", + '':"NP-COG-MF", + '':"NP-ORG", + '':"NP-AL", + '':"PRON-ITG", + '':"PRON-PERS", + '':"DET-ITG", + '':"ADV-ITG", + '':"V-INFL-IV", + '':"CC", + '':"INTERJ", + '':"CS", + '':'NP-ANT-M', + '':'NP-ANT-F', + '':"CA", + '':"V-INFL-TV", + '':"DET-QNT", + '':"DET-DEM", + '':"NP-COG-MF", + '':"PRON-QNT", + '':"PRON-DEM", + '':"NUM", + '':"ABBR" +} + + if left: + word = line.partition("")[2].partition("")[0] + else: + word = line.partition("")[0] + word = word.replace("","% ") + entry = word + ":" + word + " " + dic[tags] + " ; !" + return entry + + +if __name__=="__main__": + left = True + if "-kir" in sys.argv: left=False + d = os.path.dirname(__file__) + if left: + filename = os.path.join(d, '../../apertium-uig/apertium-uig.uig.lexc') + else: + filename = os.path.join(d, '../../apertium-kir/apertium-kir.kir.lexc') + text = "".join([x for x in open(filename).readlines() if "V-TD" not in x]) + for line in sys.stdin.readlines(): + if "<" in line: + try: + m = monofy(line,left) + if m not in text: + sys.stdout.write(m + "\n") + except KeyError: + continue +