Code:
landiction_aulzhn = "ɑæɐɑβɓʙɕçðdʒɖɗəɚɵɘɛɜɝɛɞɠɢʛɥɦħɧʜɪɪɨʝɟʄɫɬʟɭɮɱŋɲɴɳɔœøɒɔɶɸɾʁɹɻʀɽɺʃʂθtʃtsʈʊʊʉʌʋⱱʍɯɰχʎɣʏɤʒʐʑʔʕʢʡː"
def repl(val):
T2.delete("1.0",END)
T2.insert(END,val)
def readJsonDict(file):
with open(file,'r',encoding="utf-8-sig") as f:
d = json.load(f)
f.close()
return d
def writeJsonDict(diction,file):
with open(file,'w',encoding="utf-8-sig") as f:
json.dump(diction,f,ensure_ascii=False)
f.close()
##EVERYTHING BELOW IS PART OF A DIFFERENT FUNCTION, CUT OUT OF THE REST BECAUSE THE REST HAS NOTHING TO DO WITH THIS
elif change.get() == 4:
inp = inp.split()
words = readJsonDict("Aulzhn.txt")
for x in range(0,len(inp)):
print(x) ##!!
for i, j in words.items():
print(inp[x] + " :: " + i + " :: " + j) ##!!
print(type(inp[x])) ##!!
print(type(i)) ##!!
if inp[x] == i:
inp[x] = j
print("FOUND IN DICTIONARY BREAK") ##!!
break
print("NEW WORD OPERATION") ##!!
neword = ""
while True:
inum = len(inp[x])
if inum <= 2:
onum = random.randint(1,2)
else:
onum = random.randint(inum - 2,inum + 2)
for y in range(onum):
let = random.choice(landiction_aulzhn)
neword = neword + let
found = False
for o, k in words.items():
if neword == k:
found = True
if found == False:
print("NEW WORD MADE BREAK") ##!!
break
words[inp[x]] = neword
inp[x] = neword
break
print(words) ##!!
writeJsonDict(words,"Aulzhn.txt")
inp = "ˑ".join(inp)
repl(inp)
print(words) ##!!
OUTPUT line 1 is the number of the operation taking place (value of x, how many words it's gone through from the input)
OUTPUT line 2 is the class of the input word. Line 3 is the class of the word it's being checked against to see if there's already a dictionary entry for that word.
OUTPUT line 4/5 is showing whether the corresponding word was found in the dictionary or if it isn't, that a new word was made and added to it.
The final lines are showing the dictionary after being written to (I have this twice in there for some reason whoops)
Here's my output:
Code:
INPUT: "fox"
0
fox :: fox :: ɽχɶɛt
<class 'str'>
<class 'str'>
FOUND IN DICTIONARY BREAK
{'fox': 'ɽχɶɛt', 'the': 'tⱱɢçɽ', '.': '.'}
{'fox': 'ɽχɶɛt', 'the': 'tⱱɢçɽ', '.': '.'}
INPUT: "the"
0
the :: fox :: ɽχɶɛt
<class 'str'>
<class 'str'>
NEW WORD OPERATION
NEW WORD MADE BREAK
{'fox': 'ɽχɶɛt', 'the': 'ɴɟɯʒ', '.': '.'}
{'fox': 'ɽχɶɛt', 'the': 'ɴɟɯʒ', '.': '.'}
INPUT: "cat"
0
cat :: fox :: ɽχɶɛt
<class 'str'>
<class 'str'>
NEW WORD OPERATION
NEW WORD MADE BREAK
{'fox': 'ɽχɶɛt', 'cat': 'ɪʁ', 'the': 'ɴɟɯʒ', '.': '.'}
{'fox': 'ɽχɶɛt', 'cat': 'ɪʁ', 'the': 'ɴɟɯʒ', '.': '.'}
Basically for some reason it's only checking against a the very first word in the dictionary when trying to find a word in the dictionary, and is thereby rerolling any word that isn't "fox". I've looked through the code multiple times and have NO IDEA why this is happening though I'm probably missing something obvious.