compobot/lib/README.txt

70 lines
1.9 KiB
Text
Raw Normal View History

2020-09-18 11:17:49 +02:00
How to get the list of usable key-sequences?
--------------------------------------------
Download the X11 compose-sequences for en_US.UTF-8¹ and get rid of some things:
- Comments (XCOMM)
- Sequences not started my Multi_key
- Sequences containing non-standard characters
- Sequences containing other dead keys
2020-09-18 11:17:49 +02:00
¹) en_US.UTF-8 seems to be quite complete and also available on other locales.
$ wget https://cgit.freedesktop.org/xorg/lib/libX11/plain/nls/en_US.UTF-8/Compose.pre
$ grep -i '^<multi' Compose.pre | grep -v '<dead' | grep -v '<U....>' | grep -v '<U.....>' > Compose.usable
2020-09-18 11:17:49 +02:00
Convert to psv
--------------
- Plus-separated-values because + is not used elsewhere in the file.
- Regex to extract the fields into psv.
- The second description is all-uppper, we'll convert it to all lower.
2020-09-18 11:17:49 +02:00
$ sed --regexp-extended 's/(.*>)\s*:\s\"(.*)\"\s*(\S*)\s*#\s*(.*)/\1+\2+\3+\L\4/' Compose.usable > Compose.psv
2020-09-18 11:17:49 +02:00
Load into SQLite
----------------
$ sqlite3 Compose.db3
CREATE TABLE "keySequences" (
"keySequence" TEXT NOT NULL,
"utfCharacter" TEXT NOT NULL,
"desc1" TEXT,
"desc2" TEXT
);
.mode csv
.separator "+"
.import Compose.psv keySequences
How to get random, unique entries that do not repeat
----------------------------------------------------
Create a table for characters we already sent.
2020-09-18 11:17:49 +02:00
CREATE TABLE "alreadySent" (
"keySequenceROWID" INTEGER,
"timestamp" INTEGER
);
Create a view with yet unsent characters
2020-09-18 11:17:49 +02:00
CREATE VIEW stillAvailable (
keySequenceROWID,
keySequence,
utfCharacter,
desc1,desc2
)
AS
SELECT ROWID, keySequence, utfCharacter, desc1, desc2
FROM keySequences
WHERE ROWID NOT IN (
SELECT keySequenceROWID
FROM alreadySent
);
2020-09-18 11:17:49 +02:00
Add some phrases to start the toot with
---------------------------------------
Create a table with some entry-phrases:
CREATE TABLE "phrases" (
"phrase" TEXT
);
.mode csv
.separator "+"
.import phrases.txt phrases