update git.ignore and remorse-generate-function

This commit is contained in:
2025-07-22 19:24:14 +02:00
parent 9941d8a76b
commit 8a69549970
2 changed files with 23 additions and 26 deletions

2
.gitignore vendored
View File

@@ -3,3 +3,5 @@
/data-extended/ /data-extended/
/Hilfsprogramme/ /Hilfsprogramme/
/.idea/ /.idea/
/data/t9-de.dic
/data/morse-de.dic

View File

@@ -2355,7 +2355,7 @@ befinden.
else: else:
try: try:
wbfile = open("./data/german.dic", "r", wbfile = open("./data/german.dic", "r",
encoding="iso-8859-15") # german.dic von https://sourceforge.net/projects/germandict/ encoding="iso-8859-1") # german.dic von https://sourceforge.net/projects/germandict/
except FileNotFoundError: except FileNotFoundError:
Ausgabe.insert(1.0, hilfetext + "\n") Ausgabe.insert(1.0, hilfetext + "\n")
else: else:
@@ -2396,7 +2396,7 @@ befinden.
Ausgabe.insert(1.0, hilfetext + "\n") Ausgabe.insert(1.0, hilfetext + "\n")
else: else:
try: try:
wbfile = open("./data/german.dic", "r", encoding="iso-8859-15") wbfile = open("./data/german.dic", "r", encoding="iso-8859-1")
except FileNotFoundError: except FileNotFoundError:
Ausgabe.insert(1.0, hilfetext + "\n") Ausgabe.insert(1.0, hilfetext + "\n")
else: else:
@@ -2524,7 +2524,7 @@ im Unterverzeichnis "data" befinden.
else: else:
try: try:
wbfile = open("./data/morse-de.dic", "r", wbfile = open("./data/morse-de.dic", "r",
encoding="iso-8859-15") # german.dic von https://sourceforge.net/projects/germandict/ encoding="iso-8859-1") # german.dic von https://sourceforge.net/projects/germandict/
except FileNotFoundError: except FileNotFoundError:
try: try:
testfile = open("./data/german.dic", "r") testfile = open("./data/german.dic", "r")
@@ -2573,7 +2573,7 @@ def remorse_germandic():
ualphabet["...--.."] = "ß" ualphabet["...--.."] = "ß"
eingabetext = Eingabe.get(1.0, END) eingabetext = Eingabe.get(1.0, END)
eingabetext = eingabetext.rstrip() eingabetext = eingabetext.rstrip()
wbfile = open("./data/german.dic", "r", encoding="iso-8859-15") wbfile = open("./data/german.dic", "r", encoding="iso-8859-1")
Ausgabe.insert(1.0, "\n") Ausgabe.insert(1.0, "\n")
for zeile in wbfile: for zeile in wbfile:
zeile = zeile.strip(" \t\n\r") zeile = zeile.strip(" \t\n\r")
@@ -2602,24 +2602,19 @@ def remorse_generate_morsede():
'?': '..--..', '=': '-...-', ';': '-.-.-.', ':': '---...', '/': '-..-.', '?': '..--..', '=': '-...-', ';': '-.-.-.', ':': '---...', '/': '-..-.',
'.': '.-.-.-', '-': '-....-', ',': '--..--', '+': '.-.-.', ')': '-.--.-', '.': '.-.-.-', '-': '-....-', ',': '--..--', '+': '.-.-.', ')': '-.--.-',
'(': '-.--.', "'": '.----.', 'SS': '...--..'} '(': '-.--.', "'": '.----.', 'SS': '...--..'}
ofile = open("./data/morse-de.dic", "a", encoding="iso-8859-15") with open("./data/morse-de.dic", "w", encoding="iso-8859-1") as ofile:
ofile.write("-----,0\n.----,1\n..---,2\n...--,3\n....-,4\n.....,5\n-....,6\n--...,7\n---..,8\n----.,9\n") for symbol, morse in alphabet.items():
ofile.write(".-,A\n-...,B\n-.-.,C\n-..,D\n.,E\n..-.,F\n--.,G\n....,H\n..,I\n.---,J\n-.-,K\n.-..,L\n--,M\n") ofile.write(f"{morse},{symbol}\n")
ofile.write("-.,N\n---,O\n.--.,P\n--.-,Q\n.-.,R\n...,S\n-,T\n..-,U\n...-,V\n.--,W\n-..-,X\n-.--,Y\n--..,Z\n") with open("./data/german.dic", "r", encoding="iso-8859-1") as infile:
ofile.write("--.--,Ñ\n..-..,É\n.-..-,È\n.--.-,À\n..--,Ü\n---.,Ö\n.-.-,Ä\n..--.-,_\n.--.-.,@\n..--..,?\n-...-,=\n") for line in infile:
ofile.write("-.-.-.,;\n---...,:\n-..-.,/\n.-.-.-,.\n-....-,-\n.-.-.,+\n-.--.-,)\n-.--.,(\n.----.,'\n...--..,ß\n") word = line.strip()
file = open("./data/german.dic", "r", encoding="iso-8859-15")
for zeile in file:
omsg = ""
zeile = zeile.rstrip()
try: try:
for char in zeile: morse_word = ''.join(alphabet[char.upper()] for char in word)
omsg = omsg + alphabet[char.upper()] ofile.write(f"{morse_word},{word}\n")
except TypeError: except KeyError:
# Überspringe Wörter mit nicht-unterstützten Zeichen
continue continue
else: infile.close()
ofile.write(omsg + "," + zeile + "\n")
file.close()
ofile.close() ofile.close()
@@ -2703,7 +2698,7 @@ im Unterverzeichnis "data" befinden.
Ausgabe.insert(1.0, hilfetext + "\n") Ausgabe.insert(1.0, hilfetext + "\n")
else: else:
try: try:
wbfile = open("./data/t9-de.dic", "r", encoding="iso-8859-15") wbfile = open("./data/t9-de.dic", "r", encoding="iso-8859-1")
except FileNotFoundError: except FileNotFoundError:
try: try:
testfile = open("./data/german.dic", "r") testfile = open("./data/german.dic", "r")
@@ -2748,7 +2743,7 @@ def t9_germandic():
'-': '1', ',': '1', '+': '0', ')': '1', '(': '1', 'SS': '7'} '-': '1', ',': '1', '+': '0', ')': '1', '(': '1', 'SS': '7'}
eingabetext = Eingabe.get(1.0, END) eingabetext = Eingabe.get(1.0, END)
eingabetext = eingabetext.rstrip() eingabetext = eingabetext.rstrip()
wbfile = open("./data/german.dic", "r", encoding="iso-8859-15") wbfile = open("./data/german.dic", "r", encoding="iso-8859-1")
Ausgabe.insert(1.0, "\n") Ausgabe.insert(1.0, "\n")
for zeile in wbfile: for zeile in wbfile:
zeile = zeile.strip(" \t\n\r") zeile = zeile.strip(" \t\n\r")
@@ -2773,8 +2768,8 @@ def t9_generate_t9de():
'0': '0', 'Ñ': '6', 'É': '3', 'È': '3', 'À': '2', 'Ü': '8', 'Ö': '6', '0': '0', 'Ñ': '6', 'É': '3', 'È': '3', 'À': '2', 'Ü': '8', 'Ö': '6',
'Ä': '2', '@': '1', '?': '1', '=': '0', ':': '1', '/': '1', '.': '1', 'Ä': '2', '@': '1', '?': '1', '=': '0', ':': '1', '/': '1', '.': '1',
'-': '1', ',': '1', '+': '0', ')': '1', '(': '1', 'SS': '7'} '-': '1', ',': '1', '+': '0', ')': '1', '(': '1', 'SS': '7'}
ofile = open("./data/t9-de.dic", "a", encoding="iso-8859-15") ofile = open("./data/t9-de.dic", "a", encoding="iso-8859-1")
file = open("./data/german.dic", "r", encoding="iso-8859-15") file = open("./data/german.dic", "r", encoding="iso-8859-1")
for zeile in file: for zeile in file:
omsg = "" omsg = ""
zeile = zeile.rstrip() zeile = zeile.rstrip()