Merge branch 'develop' into 'master'

2.1.1

See merge request Dandellion/matrix-wug!9
This commit is contained in:
Daniel Løvbrøtte Olsen 2019-03-01 01:47:00 +00:00
commit dc45ff0df3
4 changed files with 89 additions and 8 deletions

View File

@ -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!

View File

@ -1,12 +1,9 @@
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;
@ -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}`;

39
x2i/ik-keys.yaml Normal file
View File

@ -0,0 +1,39 @@
---
- - l^%
- ł̣
- - l%^
- ł̣
- - L^%
- Ł̣
- - L%^
- Ł̣
- - g^
- ġ
- - G^
- Ġ
- - l^
-
- - l%
- ł
- - L^
-
- - L%
- Ł
- - '&^'
- ł̣
- - N%
- Ñ
- - N^
- Ŋ
- - n%
- ñ
- - n^
- ŋ
- - r^
- ȓ
- - R^
- Ȓ
- - '&'
- ł

View File

@ -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"),
},
};