First of all: I'm not a technic, but I asked the AI to build me a Sigil plugin in order to automatically search and replace old german orthography to the new one. The AI helped me to create a directory "Rechtschreibung" with the contents of a "plugin.py" and a "plugin.xml" (code below). I compressed the directory to "Rechtschreibung.zip", but at adding the plugin to Sigil it is refused. OS: Linux Mint 22.3 Cinnamon 64 bit, Sigil v. 2.7.6.
Code:
# -*- coding: utf-8 -*-
# Sigil Plugin: Rechtschreibreform Alt -> Neu
# Autor: ChatGPT
# Beschreibung: Wandelt alte deutsche Rechtschreibung in neue um (Batch, inkl. Regex + Wortliste)
import re
# -----------------------------
# REGEX-REGELN (zuerst ausführen)
# -----------------------------
regex_rules = [
(r"\bdaß\b", "dass"),
(r"\bDaß\b", "Dass"),
(r"\bmuß\b", "muss"),
(r"\bMuß\b", "Muss"),
(r"\bmußt\b", "musst"),
(r"\bmußte(n)?\b", r"musste\1"),
(r"\bso daß\b", "sodass"),
(r"\bstatt finden\b", "stattfinden"),
(r"\bkennen lernen\b", "kennenlernen"),
(r"\bteil nehmen\b", "teilnehmen"),
(r"\bwieder sehen\b", "wiedersehen"),
(r"\bim allgemeinen\b", "im Allgemeinen"),
(r"\bim folgenden\b", "im Folgenden"),
(r"\bim voraus\b", "im Voraus"),
]
# -----------------------------
# EXPLIZITE ERSETZUNGSLISTE
# -----------------------------
word_replacements = {
"Schloß": "Schloss",
"Fluß": "Fluss",
"Kuß": "Kuss",
"naß": "nass",
"biß": "biss",
"riß": "riss",
"Photographie": "Fotografie",
"Photograph": "Fotograf",
"Telephon": "Telefon",
"Graphik": "Grafik",
"Delphin": "Delfin",
"Portemonnaie": "Portmonee",
"auf Grund": "aufgrund",
"zu Grunde": "zugrunde",
"in Folge": "infolge",
"Rataus" : "Rathaus",
}
# -----------------------------
# HAUPTFUNKTION
# -----------------------------
def run(bk):
for (id, href) in bk.text_iter():
content = bk.readfile(id)
# Regex-Regeln anwenden
for pattern, repl in regex_rules:
content = re.sub(pattern, repl, content)
# Wortliste anwenden
for old, new in word_replacements.items():
content = content.replace(old, new)
bk.writefile(id, content)
return 0
# -----------------------------
# ERWEITERBAR
# -----------------------------
# Du kannst beliebig viele Regeln ergänzen.
# Wichtig: Erst Regex, dann Wortliste.
Code:
<?xml version="1.0" encoding="utf-8"?>
<plugin>
<name>Rechtschreibreform Alt→Neu</name>
<type>edit</type>
<author>ChatGPT</author>
<version>1.0</version>
<description>Konvertiert alte deutsche Rechtschreibung in neue</description>
<script>plugin.py</script>
</plugin>
Can someone help, please? Of course, the list is rather short, but I aim to complete it by the time.