merge-gui #4

Merged
racloody merged 15 commits from merge-gui into main 2023-10-16 19:39:19 +00:00
9 changed files with 0 additions and 56 deletions
Showing only changes of commit de62dfdf44 - Show all commits

View file

@ -1,45 +0,0 @@
import jaro
import json
# Load database
print("Loading database ...")
with open("Code/data.json", "r") as file:
database = json.loads(file.read())
prompt = input("name > ")
tokens = prompt.split()
# Finding possible words index
possible_words = []
for t in tokens:
found_words = []
for w in database["lexique"]["index"].keys():
if jaro.jaro_winkler_metric(w, t) > 0.93:
index = database["lexique"]["index"][w]
if index not in found_words:
found_words.append(index)
if found_words:
possible_words.append(found_words)
print(possible_words)
# Test every formation
to_test = []
test_passed = []
for f in database["formations"].keys():
checked_count = 0
for ti in database["formations"][f]["recW"].keys():
for found_index in possible_words:
if int(ti) in found_index:
checked_count += 1
break
if checked_count == len(possible_words):
test_passed.append(f)
# Print the result
for f in test_passed:
print(database["formations"][f]["nm"], "at :", list(database["formations"][f]["recS"].keys())[1])

Binary file not shown.

View file

After

Width:  |  Height:  |  Size: 14 KiB

View file

After

Width:  |  Height:  |  Size: 5.8 KiB

View file

After

Width:  |  Height:  |  Size: 8.3 KiB

View file

After

Width:  |  Height:  |  Size: 8.1 KiB

BIN
data.json

Binary file not shown.

11
test.py
View file

@ -1,11 +0,0 @@
import json
with open('data.json', 'r') as fichier:
donnees = json.load(fichier)
json_formate = json.dumps(donnees, indent=4)
# Écrire les données formatées dans un nouveau fichier
with open('data', 'w') as fichier_formate:
fichier_formate.write(json_formate)