Introduction
Introduction Statistics Contact Development Disclaimer Help
Add zombie language to annna. - annna - Annna the nice friendly bot.
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6…
Log
Files
Refs
Tags
README
---
commit 708589d9a8cd100e0145e0a69a6a7f1f99b4b82f
parent 31edfad8e895852b55f40f26e64868c9cd4dd9d3
Author: Annna Robert-Houdin <[email protected]>
Date: Thu, 31 Oct 2024 19:31:04 +0100
Add zombie language to annna.
Diffstat:
M annna-message-common | 10 ++++++++++
A zombie | 186 +++++++++++++++++++++++++++++…
2 files changed, 196 insertions(+), 0 deletions(-)
---
diff --git a/annna-message-common b/annna-message-common
@@ -624,6 +624,16 @@ case "${text}" in
suri="$(printf "%s\n" "${word}" | bitreich-speak)"
annna-say -s "${server}" -c "${channel}" "${suri}"
;;
+"${ircuser}, please zombie "*)
+ word="$(printf "%s\n" "${text}" | cut -c 22- | sed 's,\t, ,g')"
+ suri="$(printf "%s\n" "${word}" | zombie -e)"
+ annna-say -s "${server}" -c "${channel}" "${suri}"
+ ;;
+"${ircuser}, please zombie say "*)
+ word="$(printf "%s\n" "${text}" | cut -c 26- | sed 's,\t, ,g')"
+ suri="$(printf "%s\n" "${word}" | zombie -e | bitreich-speak)"
+ annna-say -s "${server}" -c "${channel}" "${suri}"
+ ;;
"${ircuser}, what can I cook with "*)
ingredients="$(printf "%s\n" "${text}" | cut -c 29- | sed 's,\t, ,g…
case "$ingredients" in
diff --git a/zombie b/zombie
@@ -0,0 +1,186 @@
+#!/usr/bin/env python
+# coding=utf-8
+#
+# Copy me if you can.
+# by 20h
+#
+# Idea from: https://github.com/DanPlayz0/Chucky/blob/main/assets/zombie-trans…
+
+import os
+import sys
+import getopt
+
+zombiemapping = {
+ "Ar": "a",
+ "AA": "b",
+ "Ab": "c",
+ "RA": "d",
+ "bb": "e",
+ "BA": "f",
+ "ll": "g",
+ "bG": "h",
+ "Gn": "i",
+ "GA": "j",
+ "GG": "k",
+ "nh": "l",
+ "hh": "m",
+ "MM": "n",
+ "hr": "o",
+ "hA": "p",
+ "hb": "q",
+ "rr": "r",
+ "hG": "s",
+ "Gg": "t",
+ "GM": "u",
+ "nr": "v",
+ "Mr": "w",
+ "Gl": "x",
+ "nn": "y",
+ "KA": "z",
+ "aR": "A",
+ "aa": "B",
+ "aB": "C",
+ "rA": "D",
+ "BB": "E",
+ "ba": "F",
+ "LL": "G",
+ "Bg": "H",
+ "gN": "I",
+ "ga": "J",
+ "gg": "K",
+ "NH": "L",
+ "HH": "M",
+ "mm": "N",
+ "HR": "O",
+ "Ha": "P",
+ "HB": "Q",
+ "RR": "R",
+ "Hq": "S",
+ "gG": "T",
+ "gm": "U",
+ "NR": "V",
+ "mR": "W",
+ "gL": "X",
+ "NN": "Y",
+ "ka": "Z"
+}
+
+humanmapping = {
+ "a": "Ar",
+ "b": "AA",
+ "c": "Ab",
+ "d": "RA",
+ "e": "bb",
+ "f": "BA",
+ "g": "ll",
+ "h": "bG",
+ "i": "Gn",
+ "j": "GA",
+ "k": "GG",
+ "l": "nh",
+ "m": "hh",
+ "n": "MM",
+ "o": "hr",
+ "p": "hA",
+ "q": "hb",
+ "r": "rr",
+ "s": "hG",
+ "t": "Gg",
+ "u": "GM",
+ "v": "nr",
+ "w": "Mr",
+ "x": "Gl",
+ "y": "nn",
+ "z": "KA",
+ "A": "aR",
+ "B": "aa",
+ "C": "aB",
+ "D": "ra",
+ "E": "BB",
+ "F": "ba",
+ "G": "LL",
+ "H": "Bg",
+ "I": "gN",
+ "J": "ga",
+ "K": "gg",
+ "L": "NH",
+ "M": "HH",
+ "N": "mm",
+ "O": "HR",
+ "P": "Ha",
+ "Q": "HB",
+ "R": "RR",
+ "S": "Hg",
+ "T": "gG",
+ "U": "gm",
+ "V": "NR",
+ "W": "mR",
+ "X": "gL",
+ "Y": "NN",
+ "Z": "ka"
+}
+
+def human2zombie(s):
+ r = ""
+ for c in s:
+ try:
+ r += humanmapping[c]
+ except KeyError:
+ r += c
+ return r
+
+def zombie2human(s):
+ r = ""
+ while 1:
+ c = s[:2]
+ s = s[2:]
+ try:
+ r += zombiemapping[c]
+ except KeyError:
+ r += c
+ if len(s) == 0:
+ break
+ return r
+
+def usage(app):
+ app = os.path.basename(app)
+ print("usage: %s [-h] [-e|-d]" % (app), file=sys.stderr)
+ sys.exit(1)
+
+def main(args):
+ try:
+ opts, largs = getopt.getopt(args[1:], "hed")
+ except getopt.GetoptError as err:
+ print(str(err))
+ usage(args[0])
+
+ dodecode=0
+ doencode=0
+
+ for o, a in opts:
+ if o == "-h":
+ usage(args[0])
+ elif o == "-d":
+ dodecode=1
+ elif o == "-e":
+ doencode=1
+ else:
+ assert False, "unhandled option"
+
+ ins = sys.stdin.read()
+ rs = None
+ words = ins.split(" ")
+ if doencode:
+ rs = " ".join([human2zombie(w) for w in words])
+ if dodecode:
+ rs = " ".join([zombie2human(w) for w in words])
+ if rs != None:
+ print("%s" % (rs), end='')
+ else:
+ usage(args[0])
+
+ return 0
+
+if __name__ == "__main__":
+ sys.exit(main(sys.argv))
+
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.