module toki.symbols; import std.conv : to; import std.string; import utils.log; public enum Toki { a, akesi, ala, alasa, ale, anpa, ante, anu, awen, e, en, esun, ijo, ike, ilo, insa, jaki, jan, jelo, jo, kala, kalama, kama, kasi, ken, kepeken, kili, kiwen, ko, kon, kule, kulupu, kute, la, lape, laso, lawa, len, lete, li, lili, linja, lipu, loje, lon, luka, lukin, lupa, ma, mama, mani, meli, mi, mije, moku, moli, monsi, mu, mun, musi, mute, nanpa, nasa, nasin, nena, ni, nimi, noka, o, olin, ona, open, pakala, pali, palisa, pan, pana, pi, pilin, pimeja, pini, pipi, poka, poki, pona, pu, sama, seli, selo, seme, sewi, sijelo, sike, sin, sina, sinpin, sitelen, sona, soweli, suli, suno, supa, suwi, tan, taso, tawa, telo, tenpo, toki, tomo, tu, unpa, uta, utala, walo, wan, waso, wawa, weka, wile }; private Toki[string] getTable() { Toki[string] table; table["a"] = Toki.a; table["akesi"] = Toki.akesi; table["ala"] = Toki.ala; table["alasa"] = Toki.alasa; table["ale"] = Toki.ale; table["anpa"] = Toki.anpa; table["ante"] = Toki.ante; table["anu"] = Toki.anu; table["awen"] = Toki.awen; table["e"] = Toki.e; table["en"] = Toki.en; table["esun"] = Toki.esun; table["ijo"] = Toki.ijo; table["ike"] = Toki.ike; table["ilo"] = Toki.ilo; table["insa"] = Toki.insa; table["jaki"] = Toki.jaki; table["jan"] = Toki.jan; table["jelo"] = Toki.jelo; table["jo"] = Toki.jo; table["kala"] = Toki.kala; table["kalama"] = Toki.kalama; table["kama"] = Toki.kama; table["kasi"] = Toki.kasi; table["ken"] = Toki.ken; table["kepeken"] = Toki.kepeken; table["kili"] = Toki.kili; table["kiwen"] = Toki.kiwen; table["ko"] = Toki.ko; table["kon"] = Toki.kon; table["kule"] = Toki.kule; table["kulupu"] = Toki.kulupu; table["kute"] = Toki.kute; table["la"] = Toki.la; table["lape"] = Toki.lape; table["laso"] = Toki.laso; table["lawa"] = Toki.lawa; table["len"] = Toki.len; table["lete"] = Toki.lete; table["li"] = Toki.li; table["lili"] = Toki.lili; table["linja"] = Toki.linja; table["lipu"] = Toki.lipu; table["loje"] = Toki.loje; table["lon"] = Toki.lon; table["luka"] = Toki.luka; table["lukin"] = Toki.lukin; table["lupa"] = Toki.lupa; table["ma"] = Toki.ma; table["mama"] = Toki.mama; table["mani"] = Toki.mani; table["meli"] = Toki.meli; table["mi"] = Toki.mi; table["mije"] = Toki.mije; table["moku"] = Toki.moku; table["moli"] = Toki.moli; table["monsi"] = Toki.monsi; table["mu"] = Toki.mu; table["mun"] = Toki.mun; table["musi"] = Toki.musi; table["mute"] = Toki.mute; table["nanpa"] = Toki.nanpa; table["nasa"] = Toki.nasa; table["nasin"] = Toki.nasin; table["nena"] = Toki.nena; table["ni"] = Toki.ni; table["nimi"] = Toki.nimi; table["noka"] = Toki.noka; table["o"] = Toki.o; table["olin"] = Toki.olin; table["ona"] = Toki.ona; table["open"] = Toki.open; table["pakala"] = Toki.pakala; table["pali"] = Toki.pali; table["palisa"] = Toki.palisa; table["pan"] = Toki.pan; table["pana"] = Toki.pana; table["pi"] = Toki.pi; table["pilin"] = Toki.pilin; table["pimeja"] = Toki.pimeja; table["pini"] = Toki.pini; table["pipi"] = Toki.pipi; table["poka"] = Toki.poka; table["poki"] = Toki.poki; table["pona"] = Toki.pona; table["pu"] = Toki.pu; table["sama"] = Toki.sama; table["seli"] = Toki.seli; table["selo"] = Toki.selo; table["seme"] = Toki.seme; table["sewi"] = Toki.sewi; table["sijelo"] = Toki.sijelo; table["sike"] = Toki.sike; table["sin"] = Toki.sin; table["sina"] = Toki.sina; table["sinpin"] = Toki.sinpin; table["sitelen"] = Toki.sitelen; table["sona"] = Toki.sona; table["soweli"] = Toki.soweli; table["suli"] = Toki.suli; table["suno"] = Toki.suno; table["supa"] = Toki.supa; table["suwi"] = Toki.suwi; table["tan"] = Toki.tan; table["taso"] = Toki.taso; table["tawa"] = Toki.tawa; table["telo"] = Toki.telo; table["tenpo"] = Toki.tenpo; table["toki"] = Toki.toki; table["tomo"] = Toki.tomo; table["tu"] = Toki.tu; table["unpa"] = Toki.unpa; table["uta"] = Toki.uta; table["utala"] = Toki.utala; table["walo"] = Toki.walo; table["wan"] = Toki.wan; table["waso"] = Toki.waso; table["wawa"] = Toki.wawa; table["weka"] = Toki.weka; table["wile"] = Toki.wile; return table; } public Toki[] convert(string text) { auto table = getTable(); string[] words = split(text); Toki[] twords = []; foreach (string key; words) { Toki* found = key in table; if(found !is null) { twords = twords ~ *found; } else { log(LogLevel.DEBUG, format!"Word not in dictionary: %s"(key)); } } return twords; }