#!/usr/bin/python3 import subprocess import os import csv import re import shutil KANSI_TABLE_HEADER = """KeyCode=mnptkswljiueoaAR Length=16 Prompt= ConstructPhrase= [Data] . 。 [ 「 ] 」 """ SITELEN_SELI_KIWEN_TABLE_HEADER = """KeyCode=mnptkswljiueoa()[]{}^*.:-_" Length=16 Prompt= ConstructPhrase= [Data] _   ( 󱦗 ) 󱦘 [ 󱦐 ] 󱦑 { 󱦚 } 󱦛 ^ 󱦕 * 󱦖 . 󱦜 : 󱦝  - ‍ """ def make_conf(name, filepath): a = f"""[InputMethod] Name=toki pona - sitelen Kansi({name}) LangCode=toki pona Addon=table Configurable=True [Table] File=table/{filepath}.dict OrderPolicy=Fast PageSize=10 ExactMatch=True [Table/PrevPage] 0=Page_Up [Table/NextPage] 0=Page_Down [Table/Selection] 0=F1 1=F2 2=F3 3=F4 4=F5 5=F6 6=F7 7=F8 8=F9 9=F10 """ with open(f"confs/{filepath}.conf", "w") as f: f.write(a) # make the table dirs for i in ["generated_tables", "confs", "table"]: try: os.mkdir(i) except FileExistsError as e: pass print("Generating sitelen seli kiwen table...") data = open("sitelen_seli_kiwen_glyph_data.txt").read().split("