diff --git a/README.md b/README.md index 2fde7d0..ff62612 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,15 @@ For the PIE notation: * Palato-velars are marked with a following ' and x1, x2, x3 etc. yields the laryngeals, with x@ for the subscript a laryngeal, and xx for an unknown laryngeal. This is best learned by experimenting. + Inuktitut Syllabics: https://en.wikipedia.org/wiki/Inuktitut_syllabics +Iñupiatun Orthography: + +* & for miniscule ł +* l% and n% for ł and ñ each +* g^, l^, &^ (or l%^ and l^%) n^, and r^ for ġ ḷ ł̣ ŋ ȓ each + These conversions were originally taken from [xsduan/conniebot](https://github.com/xsduan/conniebot), and the discord bot Tuugaalikkuluk (thanks!) But have later divirged a bit. To use the bot I run an instance at [@wug:dodsorf.as](https://matrix.to/#/@wug:dodsorf.as), you can invite it to a room or DM it to use the converter. Or you can read the setup instructions below to host your own! diff --git a/index.ts b/index.ts index eb90246..f4e7014 100644 --- a/index.ts +++ b/index.ts @@ -1,16 +1,13 @@ -const version = "2.0.1"; +const version = "2.1.1"; import x2i from "./x2i"; import { existsSync } from "fs"; const config = (existsSync("./config.json")) ? require("./config.json") : {}; -console.log(process.env.MATRIXDEV_HOMESERVER); -console.log(process.env.MATRIXDEV_TOKEN); - const MatrixClient = require("matrix-bot-sdk").MatrixClient; const AutojoinRoomsMixin = require("matrix-bot-sdk").AutojoinRoomsMixin; -const homeserver = (config.homeserver || process.env.WUG_HOMESERVER || process.env.MATRIXDEV_HOMESERVER); +const homeserver = (config.homeserver || process.env.WUG_HOMESERVER || process.env.MATRIXDEV_HOMESERVER); const token = (config.token || process.env.WUG_TOKEN || process.env.MATRIXDEV_TOKEN); const client = new MatrixClient(homeserver, token); @@ -29,6 +26,8 @@ async function handle(roomId, event) { if (event.sender === await myself) { console.log("Wait a minute... That's me!"); return;}; if (event.content.body === "!xhelp" || event.content.body === (await client.getUserProfile(await myself)).displayname + ": help") {help(roomId); return;}; + if (event.content.body === "!xik") {xik(roomId); return;}; + if (event.content.body === "!pie") {xpie(roomId); return;}; if (event.content.body === "!xdebug") {debug(roomId); return;}; console.log("Trying to convert the message!"); @@ -41,17 +40,48 @@ async function handle(roomId, event) { function help(roomId) { - var message = `Hi I can help you translate X-SAMPA, Z-SAMPA to IPA, and transcribe into proto-indo european notation! -Use (x/z/p) together with either / or [] as delimeters + var message = `Hi I can help you translate X-SAMPA, Z-SAMPA to IPA! +Use (x/z/p/i/ik) together with either / or [] as delimeters x/"hEloU/ z[or\` 5aIk DIz] p/mreghnom/ 😀 -I also can transcribe to Inuktitut Syllabics like this: i[tusaumaqattautijjutinik aulattijiit]. +x - X-SAMPA - https://en.wikipedia.org/wiki/X-SAMPA +z - Z-SAMPA - http://www.kneequickie.com/kq/Z-SAMPA +p - Proto-Indo-European Notation (see !xpie) +i - Inuktitut Syllabics | https://en.wikipedia.org/wiki/Inuktitut_syllabics +ik - Iñupiatun Orthography (see !xik) Find my source at https://github.com/Dali99/matrix-wug`; client.sendNotice(roomId, message); } +function xpie(roomId) { + var message = `This is a fun PIE notation + +a preceding " is acute accent +a following : is the macron +a following . is the syllabicity marker +h always becomes superscript and v is superscript w. +Palato-velars are marked with a following ' and x1, x2, x3 etc. yields the laryngeals, with x@ for the subscript a laryngeal, and xx for an unknown laryngeal. + +There's probably more, but this is best learned by experimenting (or reading https://github.com/dali99/matrix-wug/blob/master/x2i/apie-keys.yaml) + +Thanks to conniebot (xsduan) for the encoding`; + + client.sendNotice(roomId, message); +} + +function xik(roomId) { + var message = `There are several distinct Iñupiatun orthographies, and I can type all of them. +& for miniscule ł +l% and n% for ł and ñ each +g^, l^, &^ (or l%^ and l^%) n^, and r^ for ġ ḷ ł̣ ŋ ȓ each + +Thanks to Tuugaalikkuluk for the encoding`; + + client.sendNotice(roomId, message); +} + async function debug(roomId) { var message = `Hi my name is ${await myself}, and I want to help you debug me! I run version ${version} 💝 and currently reside in ${roomId}`; diff --git a/x2i/ik-keys.yaml b/x2i/ik-keys.yaml new file mode 100644 index 0000000..70d078d --- /dev/null +++ b/x2i/ik-keys.yaml @@ -0,0 +1,39 @@ +--- +- - l^% + - ł̣ +- - l%^ + - ł̣ +- - L^% + - Ł̣ +- - L%^ + - Ł̣ + +- - g^ + - ġ +- - G^ + - Ġ +- - l^ + - ḷ +- - l% + - ł +- - L^ + - Ḷ +- - L% + - Ł +- - '&^' + - ł̣ +- - N% + - Ñ +- - N^ + - Ŋ +- - n% + - ñ +- - n^ + - ŋ +- - r^ + - ȓ +- - R^ + - Ȓ + +- - '&' + - ł \ No newline at end of file diff --git a/x2i/index.ts b/x2i/index.ts index 580e9ee..197ec03 100644 --- a/x2i/index.ts +++ b/x2i/index.ts @@ -37,6 +37,10 @@ const regex = OuterXRegExp( const defaultMatchAction = (left: string, match: string, right: string) => left + match + right; const matchType: { [key: string]: IMatchInstructions } = { + ik: { + join: (_, match) => `- ${match}`, + keys: readKeys("./x2i/ik-keys.yaml"), + }, p: { join: (_, match) => `*${match}`, keys: readKeys("./x2i/apie-keys.yaml"), @@ -48,6 +52,7 @@ const matchType: { [key: string]: IMatchInstructions } = { keys: readKeys("./x2i/z2i-keys.yaml"), }, i: { + join: (_, match) => `- ${match}`, keys: readKeys("./x2i/i-keys.yaml"), }, };