import json
from typing import List, Any
def bubbleSort(result):
n = len(result)
dicts = {}
with open('Schachnovelle.txt', 'r') as f:
for line in f:
for word in line.split():
if word in dicts:
dicts[word] += 1
else:
dicts[word] = 1
x = dicts.values()
#print(x)
class entry:
word: str
amount: int
sorted_values = []
for name in dicts:
item = entry()
item.word = name
item.amount = dicts[name]
sorted_values.append(item)
temp = 0
trade = True
while trade:
trade = False
for n in range(len(sorted_values)-1):
if sorted_values[n] > sorted_values[n+1]:
temp = sorted_values[n]
sorted_values[n] = sorted_values[n+1]
sorted_values[n+1] = temp
trade = True
print(sorted_values)