summary refs log tree commit diff
diff options
context:
space:
mode:
authorequa <equaa@protonmail.com>2023-01-15 11:58:00 -0600
committerequa <equaa@protonmail.com>2023-01-15 11:58:00 -0600
commit18a0bed48264e5fb2db07974dd912f7b5e940f65 (patch)
tree1be5b1f8d93e7433b9093d7a687052ac74527684
parent08793cfa2ccdae4c4091e1b977f9a45c174e8d49 (diff)
organize!
-rw-r--r--TODO5
-rw-r--r--dictgen/config.embedded.lua18
-rw-r--r--dictgen/config.main.lua18
-rw-r--r--dictgen/dkjson.lua (renamed from plover_toki_pona/dictionaries/dkjson.lua)0
-rw-r--r--dictgen/steno.lua (renamed from plover_toki_pona/dictionaries/steno.lua)37
-rw-r--r--dictgen/words.lua (renamed from plover_toki_pona/dictionaries/words.lua)3
6 files changed, 59 insertions, 22 deletions
diff --git a/TODO b/TODO
new file mode 100644
index 0000000..6d44083
--- /dev/null
+++ b/TODO
@@ -0,0 +1,5 @@
+make fingerspelling syllable-based, maybe
+add punctuation and commands to dictionary
+documentation!!!
+add qwerty keyboard layout
+make the gemini PR layout more "forgiving" (making both rows of keys do the same thing?)
diff --git a/dictgen/config.embedded.lua b/dictgen/config.embedded.lua
new file mode 100644
index 0000000..8222951
--- /dev/null
+++ b/dictgen/config.embedded.lua
@@ -0,0 +1,18 @@
+return {
+	words = require("words"),
+	convert_to_english = true,
+	extra_briefs = {
+                ["KI/KHE/SHE/SNA/SHA/KA/LU"] = "kijetesantakalu",
+                ["HR"] = "{^.}",
+                ["HWNR"] = "{^\n^}",
+                S = "sina",
+                HS = "tawa",
+                P = "pi",
+                HP = "wile",
+                K = "kama",
+                HK = "jan",
+                L = "li",
+                M = "mi",
+                HM = "ni",
+	}
+}
diff --git a/dictgen/config.main.lua b/dictgen/config.main.lua
new file mode 100644
index 0000000..640b973
--- /dev/null
+++ b/dictgen/config.main.lua
@@ -0,0 +1,18 @@
+return {
+	words = require("words"),
+	convert_to_english = false,
+	extra_briefs = {
+                ["KI/KHE/SHE/SNA/SHA/KA/LU"] = "kijetesantakalu",
+                ["HR"] = "{^.}",
+                ["HWNR"] = "{^\n^}",
+                S = "sina",
+                HS = "tawa",
+                P = "pi",
+                HP = "wile",
+                K = "kama",
+                HK = "jan",
+                L = "li",
+                M = "mi",
+                HM = "ni",
+	}
+}
diff --git a/plover_toki_pona/dictionaries/dkjson.lua b/dictgen/dkjson.lua
index fa50b9f..fa50b9f 100644
--- a/plover_toki_pona/dictionaries/dkjson.lua
+++ b/dictgen/dkjson.lua
diff --git a/plover_toki_pona/dictionaries/steno.lua b/dictgen/steno.lua
index 7a32c10..95040d6 100644
--- a/plover_toki_pona/dictionaries/steno.lua
+++ b/dictgen/steno.lua
@@ -4,7 +4,6 @@
 -- - punctuation?
 
 local dkjson = require("dkjson")
-local words = require("words")
 
 local function warn(str)
 	io.stderr:write(str .. "\n")
@@ -182,6 +181,14 @@ assert_tp(word_brief("lili", true), "LWI")
 
 --
 do
+	if not arg[1] then
+		warn("usage: steno.lua [CONFIG]")
+		os.exit(1)
+	end
+
+	local config = assert(dofile(arg[1]))
+		assert(config.words)
+	if not config.extra_briefs then config.extra_briefs = {} end
 	local dictionary = {}
 
 	-- returns whether insertion was successful
@@ -190,8 +197,12 @@ do
 		-- it's more useful to just pretend the insertion was successful
 		if not outline then return true end
 		-- we can change this for keymaps later!
-		local steno = write_outline(outline_to_steno(outline))
-		local steno = write_tp_outline(outline)
+		local steno
+		if config.convert_to_english then
+			steno = write_outline(outline_to_steno(outline))
+		else
+			steno = write_tp_outline(outline)
+		end
 
 		if not force and dictionary[steno] then
 			nop(string.format(
@@ -205,7 +216,7 @@ do
 		end
 	end
 
-	for _, word in ipairs(words) do
+	for _, word in ipairs(config.words) do
 		add_word(word_outline(word), word, true)
 		if not add_word(word_brief(word, false), word, false) then
 			add_word(word_brief(word, true), word, false)
@@ -219,23 +230,7 @@ do
 		end
 	end
 
-	local extra_briefs = {
-		["KI/KHE/SHE/SNA/SHA/KA/LU"] = "kijetesantakalu",
-		["HR"] = "{^.}",
-		["HWNR"] = "{^\n^}",
-		W = "=undo",
-		S = "sina",
-		HS = "tawa",
-		P = "pi",
-		HP = "wile",
-		K = "kama",
-		HK = "jan",
-		L = "li",
-		M = "mi",
-		HM = "ni",
-	}
-
-	for k, v in pairs(extra_briefs) do
+	for k, v in pairs(config.extra_briefs) do
 		-- the irony of reparsing and unparsing this is not lost on me
 		add_word(read_tp_outline(k), v, true)
 	end
diff --git a/plover_toki_pona/dictionaries/words.lua b/dictgen/words.lua
index 5abbcd4..b83b4ad 100644
--- a/plover_toki_pona/dictionaries/words.lua
+++ b/dictgen/words.lua
@@ -1,3 +1,4 @@
+-- in roughly frequency order
 return {
 	"mi",
 	"li",
@@ -122,5 +123,5 @@ return {
 	"jelo",
 	"monsi",
 	"lupa",
-    "pu"
+	"pu"
 }