Compare commits
1 commit
main
...
HTML---DL-
Author | SHA1 | Date | |
---|---|---|---|
289ff6f3b4 |
15
HTML/index.html
Normal file
15
HTML/index.html
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<title>Naomana Downloads</title>
|
||||||
|
<meta name="description" content="Téléchargements Naomana">
|
||||||
|
<meta name="keywords" content="Naomana, naomana, choix eds, eds, aide parcousup, choix parcousup">
|
||||||
|
<meta charset="utf-8">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h1 style="font-family: Arial">Téléchargements Naomana</h1>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
BIN
assets/Logo.png
BIN
assets/Logo.png
Binary file not shown.
Before Width: | Height: | Size: 14 KiB |
Binary file not shown.
Before Width: | Height: | Size: 5.8 KiB |
Binary file not shown.
Before Width: | Height: | Size: 8.3 KiB |
Binary file not shown.
Before Width: | Height: | Size: 8.1 KiB |
141
main.py
141
main.py
|
@ -1,141 +0,0 @@
|
||||||
from tkinter import *
|
|
||||||
from tkinter import ttk
|
|
||||||
from tkinter import messagebox
|
|
||||||
import requests, json, jaro, zipfile, os
|
|
||||||
|
|
||||||
import tkinter as tk
|
|
||||||
|
|
||||||
|
|
||||||
#Get the name from the web site parcourstup
|
|
||||||
r = requests.get("https://ressource.parcoursup.fr/data/files.xml")
|
|
||||||
name = r.content[102:135].decode()
|
|
||||||
print(f"https://ressource.parcoursup.fr/data/{name}.zip")
|
|
||||||
|
|
||||||
# Download the dataset if it doesn't already exist
|
|
||||||
if not os.path.exists(name):
|
|
||||||
r = requests.get(f"https://ressource.parcoursup.fr/data/{name}.zip")
|
|
||||||
with open('data.zip', 'wb') as file:
|
|
||||||
file.write(r.content)
|
|
||||||
with zipfile.ZipFile('data.zip', 'r') as zip_ref:
|
|
||||||
zip_ref.extractall()
|
|
||||||
|
|
||||||
# Load database
|
|
||||||
print("Loading database ...")
|
|
||||||
with open(name, "r") as file:
|
|
||||||
database = json.loads(file.read())
|
|
||||||
|
|
||||||
def get_formations(prompt: str):
|
|
||||||
indices = [max([(jaro.jaro_winkler_metric(actual_word, word), index) for word, index in database["lexique"]["index"].items()], key=lambda x: x[0])[1] for actual_word in prompt.split()]
|
|
||||||
return [f"{formation['nm']} - {list(formation['recS'].keys())[-1]}" for formation in database["formations"].values() if all([str(index) in formation["recW"] for index in indices])]
|
|
||||||
|
|
||||||
|
|
||||||
#creation première fenetre
|
|
||||||
window = Tk()
|
|
||||||
def __init__(window):
|
|
||||||
Tk.__init__(window)
|
|
||||||
window.create_menu_bar()
|
|
||||||
#personnalisation fenêtre
|
|
||||||
window.title("Choix EDS")
|
|
||||||
window.geometry("1080x720")
|
|
||||||
window.minsize(480, 360)
|
|
||||||
window.maxsize(1920, 1080)
|
|
||||||
window.iconbitmap("assets/bitmap.ico")
|
|
||||||
window.config()
|
|
||||||
|
|
||||||
#Listbox/scrollbar
|
|
||||||
#création scrollbar
|
|
||||||
scrollbar = ttk.Scrollbar(window)
|
|
||||||
listbox = tk.Listbox(window, yscrollcommand=scrollbar.set)
|
|
||||||
scrollbar.config(command=listbox.yview)
|
|
||||||
|
|
||||||
scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
|
|
||||||
listbox.pack(fill=tk.BOTH, expand=True)
|
|
||||||
|
|
||||||
#CREATIONN DES FRAMES
|
|
||||||
frame = ttk.Frame(listbox)
|
|
||||||
highframe = ttk.Frame(frame)
|
|
||||||
bottomframe = ttk.Frame(frame)
|
|
||||||
|
|
||||||
|
|
||||||
#Création menu bar
|
|
||||||
menubar = Menu(window)
|
|
||||||
window.config(menu=menubar)
|
|
||||||
menuabout = Menu(menubar,tearoff=0)
|
|
||||||
menunon = Menu(menubar,tearoff=0)
|
|
||||||
def msgabout():
|
|
||||||
messagebox.showinfo("Choix EDS - En savoir plus ...", "By Raphael et Elouan")
|
|
||||||
def msgabout1():
|
|
||||||
messagebox.showinfo("Choix EDS - Code Source", "git : https://git.tipragot.fr/Naomana/Choix_Spe")
|
|
||||||
def msgabout2():
|
|
||||||
for i in range (100):
|
|
||||||
messagebox.showinfo("Choix EDS - Il fallait pas", "Je l'avais, dit, il ne faut pas clicker")
|
|
||||||
menubar.add_cascade(label="A propos", menu=menuabout)
|
|
||||||
menubar.add_cascade(label="Non", menu=menunon)
|
|
||||||
menuabout.add_command(label="Code source", command=msgabout1)
|
|
||||||
menuabout.add_command(label="En savoir plus...", command=msgabout)
|
|
||||||
menunon.add_command(label="Ne pas toucher", command=msgabout2)
|
|
||||||
|
|
||||||
|
|
||||||
#AJOUT ET AFFICHAGE DES ELEMENTS
|
|
||||||
#affichagge image
|
|
||||||
can = Canvas(highframe, width = 200 , height = 100)
|
|
||||||
|
|
||||||
can.pack()
|
|
||||||
Objet_Image = PhotoImage(file='assets/Logo.png')
|
|
||||||
Image_Affichee = can.create_image(0,0, image = Objet_Image, anchor='nw')
|
|
||||||
#ajouter le titre
|
|
||||||
label_title = ttk.Label(highframe, text="Aide au choix des spécialités", font=("Arial", 31))
|
|
||||||
#afficher le titre
|
|
||||||
label_title.pack(side=tk.TOP, pady=8)
|
|
||||||
|
|
||||||
#ajouter la description
|
|
||||||
label_subtitle = ttk.Label(highframe, text="Cette application est une assistance pour le choix des EDS et du parcours post BAC", font=("Arial", 16))
|
|
||||||
label_subtitle.pack()
|
|
||||||
|
|
||||||
#ajouter un champ de texte
|
|
||||||
int_prompt = ttk.Entry(highframe, font=("Arial", 16))
|
|
||||||
#afficher le champ de texte
|
|
||||||
int_prompt.pack(side=LEFT, expand=YES, fill=X, pady=25)
|
|
||||||
|
|
||||||
#ajouter un bouton
|
|
||||||
#définir fonction du bouton
|
|
||||||
|
|
||||||
prompt = ""
|
|
||||||
|
|
||||||
def getEntry(*_):
|
|
||||||
prompt = int_prompt.get()
|
|
||||||
print(get_formations(prompt))
|
|
||||||
|
|
||||||
click_btn= PhotoImage(file='assets/Search_button.png')
|
|
||||||
#Let us create a label for button event
|
|
||||||
img_label= Label(image=click_btn)
|
|
||||||
|
|
||||||
#Let us create a dummy button and pass the image
|
|
||||||
button= Button(highframe, image=click_btn,command= getEntry,
|
|
||||||
borderwidth=0)
|
|
||||||
button.pack(side=RIGHT, pady=30)
|
|
||||||
|
|
||||||
#creer bouton
|
|
||||||
|
|
||||||
#assingner boutton entrée
|
|
||||||
window.bind("<Return>", getEntry)
|
|
||||||
|
|
||||||
#AFFICHAGE DES FRAMES
|
|
||||||
#affichage frame haute
|
|
||||||
highframe.pack(side=TOP)
|
|
||||||
|
|
||||||
#affichage frame basse
|
|
||||||
bottomframe.pack(side=BOTTOM)
|
|
||||||
|
|
||||||
|
|
||||||
#afficher la frame
|
|
||||||
frame.pack(fill=tk.BOTH)
|
|
||||||
|
|
||||||
#TRAITER INFORMATION USER
|
|
||||||
#Récupérer l'éntrée dans une variable
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#affichage dans la boucle main
|
|
||||||
window.mainloop()
|
|
45
main5.py
Normal file
45
main5.py
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
import jaro
|
||||||
|
import json
|
||||||
|
|
||||||
|
# Load database
|
||||||
|
print("Loading database ...")
|
||||||
|
with open("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])
|
Loading…
Reference in a new issue