Loading .gitignore +0 −2 Original line number Diff line number Diff line Loading @@ -164,5 +164,3 @@ cython_debug/ #.idea/ # End of https://www.toptal.com/developers/gitignore/api/python variables.txt variables.nani features/min_max_stats_finder.py +110 −60 Original line number Diff line number Diff line Loading @@ -15,61 +15,124 @@ def min_max_scores(content): for idx_scene, scene in enumerate(chapter["Scenes"]): scene_name = scene["Title"] min_score, max_score = find_scene_scores(scene, 'score') min_authenticiy, max_authenticiy = find_scene_scores(scene, 'authenticiy') min_respect, max_respect = find_scene_scores(scene, 'respect') min_compassion, max_compassion = find_scene_scores(scene, 'compassion') min_hope, max_hope = find_scene_scores(scene, 'hope') min_empathy, max_empathy = find_scene_scores(scene, 'empathy') scores[scene_name] = { "max_score": max_score, "min_Score": min_score, "max_authenticiy": max_authenticiy, "min_authenticiy": min_authenticiy, "max_respect": max_respect, "min_respect": min_respect, "max_compassion": max_compassion, "min_compassion": min_compassion, "max_hope": max_hope, "min_hope": min_hope, "max_empathy": max_empathy, "min_empathy": min_empathy } if idx_chapter == 0 and idx_scene == 2: scores[scene_name] = {} elif idx_chapter == 1 and idx_scene == 1: scores[scene_name] = {} else: scores[scene_name] = find_scene_scores(scene) print(scene_name+" ("+str(idx_scene+1)+") done") return scores def find_scene_scores(scene, weight_name): def find_scene_scores(scene): graph, end_nodes = create_graph(scene) scene_min_score = 10000 scene_max_score = -1000 #scene_min_score = 10000 #scene_max_score = -1000 #scene_min_path = [] #scene_max_path = [] max_score=-100 min_score=100 max_authenticiy=-100 min_authenticiy=100 max_respect=-100 min_respect=100 max_compassion=-100 min_compassion=100 max_hope=-100 min_hope=100 max_empathy=-100 min_empathy=100 # Iterate over each end node for end_nodes in end_nodes: paths =nx.all_simple_paths(graph,source=1,target=end_nodes) #paths =nx.all_simple_paths(graph,source=1,target=end_nodes) paths2 = nx.all_simple_edge_paths(graph,source=1,target=end_nodes) #Iterate over all paths for path in paths: for path in paths2: path_score_weight = 0 path_authenticity_weight = 0 path_respect_weight = 0 path_compassion_weight = 0 path_hope_weight = 0 path_empathy_weight = 0 for edge in path: scores = graph.get_edge_data(edge[0], edge[1])[edge[2]] path_weight = nx.path_weight(graph,path,weight=weight_name) path_score_weight += scores["score"] path_authenticity_weight += scores["authenticiy"] path_respect_weight += scores["respect"] path_compassion_weight += scores["compassion"] path_hope_weight += scores["hope"] path_empathy_weight += scores["empathy"] #path_weight = nx.path_weight(graph,path,weight=weight_name) # if the score of the current path is lower than the scene_min_score, we replace scene_min_score by the weight of the current path if path_weight < scene_min_score: scene_min_score = path_weight #scene_min_path = path if path_score_weight < min_score: min_score = path_score_weight if path_authenticity_weight < min_authenticiy: min_authenticiy = path_authenticity_weight if path_respect_weight < min_respect: min_respect = path_respect_weight if path_compassion_weight < min_compassion: min_compassion = path_compassion_weight if path_hope_weight < min_hope: min_hope = path_hope_weight if path_empathy_weight < min_empathy: min_empathy = path_empathy_weight # if the score of the current path is bigger than the scene_max_score, we replace scene_max_score by the weight of the current path if path_weight > scene_max_score: scene_max_score = path_weight #scene_max_path = path if path_score_weight > max_score: max_score = path_score_weight if path_authenticity_weight > max_authenticiy: max_authenticiy = path_authenticity_weight if path_respect_weight > max_respect: max_respect = path_respect_weight if path_compassion_weight > max_compassion: max_compassion = path_compassion_weight if path_hope_weight > max_hope: max_hope = path_hope_weight if path_empathy_weight > max_empathy: max_empathy = path_empathy_weight return scene_min_score, scene_max_score return { "max_score": max_score, "min_Score": min_score, "max_authenticiy": max_authenticiy, "min_authenticiy": min_authenticiy, "max_respect": max_respect, "min_respect": min_respect, "max_compassion": max_compassion, "min_compassion": min_compassion, "max_hope": max_hope, "min_hope": min_hope, "max_empathy": max_empathy, "min_empathy": min_empathy } def create_graph(scene): graph = nx.DiGraph() #graph = nx.DiGraph() graph = nx.MultiDiGraph() end_nodes = set() for interaction in scene["Interactions"]: Loading @@ -77,11 +140,13 @@ def create_graph(scene): for choice in interaction['Responses']: child_node = choice["NextInteractionID"] score = choice["Authenticity"] + choice["Respect"] + choice["Compassion"] + choice["Hope"] + choice["Empathy"] if child_node != -1: graph.add_edge(current_node,child_node, score=score, authenticiy=choice["Authenticity"], respect=choice["Respect"], compassion=choice["Compassion"], hope=choice["Hope"], empathy=choice["Empathy"]) else: end_nodes.add(current_node) return graph, end_nodes def normalize_string(text): Loading @@ -90,16 +155,11 @@ def normalize_string(text): .replace("ê", "e").replace("è", "e").replace("à", "a") def show_graph(graph, attribut): pos = nx.spring_layout(graph, seed=7) nx.draw_networkx_nodes(graph, pos, node_size=700) nx.draw_networkx_edges(graph, pos, edgelist=graph.edges(data=True), width=6) nx.draw_networkx_labels(graph, pos, font_size=20, font_family="sans-serif") edge_labels = nx.get_edge_attributes(graph, attribut) nx.draw_networkx_edge_labels(graph, pos, edge_labels) ax = plt.gca() ax.margins(0.08) plt.axis("off") plt.tight_layout() pos = nx.spring_layout(graph) nx.draw_networkx_nodes(graph, pos, node_size=300) nx.draw(graph, pos, with_labels=True, connectionstyle='arc3, rad = 0.1') edge_labels=dict([((u,v,),d[attribut]) for u,v,d in graph.edges(data=True)]) plt.show() def write_vars_to_file(scores): Loading @@ -118,21 +178,11 @@ if __name__ == "__main__": with open("Chapters.json", 'r', encoding="utf-8") as j: contents = json.loads(j.read()) scene = contents["Chapters"][0]["Scenes"][3] #min_authenticiy, max_authenticiy = find_scene_scores(scene, 'authenticiy') min_respect, max_respect = find_scene_scores(scene, 'respect') #min_compassion, max_compassion = find_scene_scores(scene, 'compassion') #min_hope, max_hope = find_scene_scores(scene, 'hope') #min_empathy, max_empathy = find_scene_scores(scene, 'empathy') print("min:"+str(min_respect)) print("max:"+ str(max_respect)) graph, end_nodes = create_graph(scene) show_graph(graph,"respect") scores = find_scene_scores(scene) print(scores) variables.txt 0 → 100644 +409 −0 Original line number Diff line number Diff line - name: presentation_max_score value: 55 - name: presentation_min_score value: -16 - name: presentation_max_authenticiy value: 0 - name: presentation_min_authenticiy value: 0 - name: presentation_max_respect value: 16 - name: presentation_min_respect value: -5 - name: presentation_max_compassion value: 22 - name: presentation_min_compassion value: -8 - name: presentation_max_hope value: 0 - name: presentation_min_hope value: 0 - name: presentation_max_empathy value: 23 - name: presentation_min_empathy value: -6 - name: vite_fait_bien_fait_max_score value: 5 - name: vite_fait_bien_fait_min_score value: 0 - name: vite_fait_bien_fait_max_authenticiy value: 5 - name: vite_fait_bien_fait_min_authenticiy value: 0 - name: vite_fait_bien_fait_max_respect value: 0 - name: vite_fait_bien_fait_min_respect value: 0 - name: vite_fait_bien_fait_max_compassion value: 0 - name: vite_fait_bien_fait_min_compassion value: 0 - name: vite_fait_bien_fait_max_hope value: 0 - name: vite_fait_bien_fait_min_hope value: 0 - name: vite_fait_bien_fait_max_empathy value: 0 - name: vite_fait_bien_fait_min_empathy value: 0 - name: les_soins_max_score value: 78 - name: les_soins_min_score value: -16 - name: les_soins_max_authenticiy value: 0 - name: les_soins_min_authenticiy value: 0 - name: les_soins_max_respect value: 23 - name: les_soins_min_respect value: -4 - name: les_soins_max_compassion value: 21 - name: les_soins_min_compassion value: -6 - name: les_soins_max_hope value: 0 - name: les_soins_min_hope value: 0 - name: les_soins_max_empathy value: 39 - name: les_soins_min_empathy value: -6 - name: le_dîner_max_score value: 16 - name: le_dîner_min_score value: -1 - name: le_dîner_max_authenticiy value: 0 - name: le_dîner_min_authenticiy value: 0 - name: le_dîner_max_respect value: 5 - name: le_dîner_min_respect value: 1 - name: le_dîner_max_compassion value: 4 - name: le_dîner_min_compassion value: 0 - name: le_dîner_max_hope value: 0 - name: le_dîner_min_hope value: 0 - name: le_dîner_max_empathy value: 8 - name: le_dîner_min_empathy value: -2 - name: lieu_de_vie,_lieu_de_mort_max_score value: 60 - name: lieu_de_vie,_lieu_de_mort_min_score value: -3 - name: lieu_de_vie,_lieu_de_mort_max_authenticiy value: 0 - name: lieu_de_vie,_lieu_de_mort_min_authenticiy value: 0 - name: lieu_de_vie,_lieu_de_mort_max_respect value: 14 - name: lieu_de_vie,_lieu_de_mort_min_respect value: -4 - name: lieu_de_vie,_lieu_de_mort_max_compassion value: 18 - name: lieu_de_vie,_lieu_de_mort_min_compassion value: 1 - name: lieu_de_vie,_lieu_de_mort_max_hope value: 0 - name: lieu_de_vie,_lieu_de_mort_min_hope value: 0 - name: lieu_de_vie,_lieu_de_mort_max_empathy value: 29 - name: lieu_de_vie,_lieu_de_mort_min_empathy value: -3 - name: projet_de_vie_max_score value: 88 - name: projet_de_vie_min_score value: -5 - name: projet_de_vie_max_authenticiy value: 0 - name: projet_de_vie_min_authenticiy value: 0 - name: projet_de_vie_max_respect value: 21 - name: projet_de_vie_min_respect value: 1 - name: projet_de_vie_max_compassion value: 29 - name: projet_de_vie_min_compassion value: -2 - name: projet_de_vie_max_hope value: 0 - name: projet_de_vie_min_hope value: 0 - name: projet_de_vie_max_empathy value: 40 - name: projet_de_vie_min_empathy value: -4 - name: culpabilite_des_proches_max_score value: 54 - name: culpabilite_des_proches_min_score value: -1 - name: culpabilite_des_proches_max_authenticiy value: 0 - name: culpabilite_des_proches_min_authenticiy value: 0 - name: culpabilite_des_proches_max_respect value: 12 - name: culpabilite_des_proches_min_respect value: 0 - name: culpabilite_des_proches_max_compassion value: 17 - name: culpabilite_des_proches_min_compassion value: -1 - name: culpabilite_des_proches_max_hope value: 0 - name: culpabilite_des_proches_min_hope value: 0 - name: culpabilite_des_proches_max_empathy value: 28 - name: culpabilite_des_proches_min_empathy value: -3 - name: angoisse_de_la_dyspnee_max_score value: 56 - name: angoisse_de_la_dyspnee_min_score value: -9 - name: angoisse_de_la_dyspnee_max_authenticiy value: 0 - name: angoisse_de_la_dyspnee_min_authenticiy value: 0 - name: angoisse_de_la_dyspnee_max_respect value: 15 - name: angoisse_de_la_dyspnee_min_respect value: -1 - name: angoisse_de_la_dyspnee_max_compassion value: 23 - name: angoisse_de_la_dyspnee_min_compassion value: -5 - name: angoisse_de_la_dyspnee_max_hope value: 0 - name: angoisse_de_la_dyspnee_min_hope value: 0 - name: angoisse_de_la_dyspnee_max_empathy value: 22 - name: angoisse_de_la_dyspnee_min_empathy value: -7 - name: les_dernieres_volontes_max_score value: 34 - name: les_dernieres_volontes_min_score value: 0 - name: les_dernieres_volontes_max_authenticiy value: 0 - name: les_dernieres_volontes_min_authenticiy value: 0 - name: les_dernieres_volontes_max_respect value: 7 - name: les_dernieres_volontes_min_respect value: 1 - name: les_dernieres_volontes_max_compassion value: 13 - name: les_dernieres_volontes_min_compassion value: -1 - name: les_dernieres_volontes_max_hope value: 0 - name: les_dernieres_volontes_min_hope value: 0 - name: les_dernieres_volontes_max_empathy value: 16 - name: les_dernieres_volontes_min_empathy value: -2 - name: les_professionnels_face_a_la_mort_max_score value: 0 - name: les_professionnels_face_a_la_mort_min_score value: 0 - name: les_professionnels_face_a_la_mort_max_authenticiy value: 0 - name: les_professionnels_face_a_la_mort_min_authenticiy value: 0 - name: les_professionnels_face_a_la_mort_max_respect value: 0 - name: les_professionnels_face_a_la_mort_min_respect value: 0 - name: les_professionnels_face_a_la_mort_max_compassion value: 0 - name: les_professionnels_face_a_la_mort_min_compassion value: 0 - name: les_professionnels_face_a_la_mort_max_hope value: 0 - name: les_professionnels_face_a_la_mort_min_hope value: 0 - name: les_professionnels_face_a_la_mort_max_empathy value: 0 - name: les_professionnels_face_a_la_mort_min_empathy value: 0 - name: acceptation_inconditionnelle_max_score value: 72 - name: acceptation_inconditionnelle_min_score value: -4 - name: acceptation_inconditionnelle_max_authenticiy value: 0 - name: acceptation_inconditionnelle_min_authenticiy value: 0 - name: acceptation_inconditionnelle_max_respect value: 19 - name: acceptation_inconditionnelle_min_respect value: 0 - name: acceptation_inconditionnelle_max_compassion value: 24 - name: acceptation_inconditionnelle_min_compassion value: -3 - name: acceptation_inconditionnelle_max_hope value: 0 - name: acceptation_inconditionnelle_min_hope value: 0 - name: acceptation_inconditionnelle_max_empathy value: 33 - name: acceptation_inconditionnelle_min_empathy value: -4 - name: soin_de_bouche_max_score value: 50 - name: soin_de_bouche_min_score value: -18 - name: soin_de_bouche_max_authenticiy value: 0 - name: soin_de_bouche_min_authenticiy value: 0 - name: soin_de_bouche_max_respect value: 12 - name: soin_de_bouche_min_respect value: -9 - name: soin_de_bouche_max_compassion value: 17 - name: soin_de_bouche_min_compassion value: -6 - name: soin_de_bouche_max_hope value: 0 - name: soin_de_bouche_min_hope value: 0 - name: soin_de_bouche_max_empathy value: 26 - name: soin_de_bouche_min_empathy value: -5 - name: conflit_interieur_max_score value: 4 - name: conflit_interieur_min_score value: 0 - name: conflit_interieur_max_authenticiy value: 4 - name: conflit_interieur_min_authenticiy value: 0 - name: conflit_interieur_max_respect value: 0 - name: conflit_interieur_min_respect value: 0 - name: conflit_interieur_max_compassion value: 0 - name: conflit_interieur_min_compassion value: 0 - name: conflit_interieur_max_hope value: 0 - name: conflit_interieur_min_hope value: 0 - name: conflit_interieur_max_empathy value: 0 - name: conflit_interieur_min_empathy value: 0 - name: rupture_du_lien_max_score value: 31 - name: rupture_du_lien_min_score value: -16 - name: rupture_du_lien_max_authenticiy value: 0 - name: rupture_du_lien_min_authenticiy value: 0 - name: rupture_du_lien_max_respect value: 8 - name: rupture_du_lien_min_respect value: -2 - name: rupture_du_lien_max_compassion value: 13 - name: rupture_du_lien_min_compassion value: -6 - name: rupture_du_lien_max_hope value: 0 - name: rupture_du_lien_min_hope value: 0 - name: rupture_du_lien_max_empathy value: 14 - name: rupture_du_lien_min_empathy value: -8 - name: le_deuil_max_score value: 43 - name: le_deuil_min_score value: -13 - name: le_deuil_max_authenticiy value: 0 - name: le_deuil_min_authenticiy value: 0 - name: le_deuil_max_respect value: 12 - name: le_deuil_min_respect value: -1 - name: le_deuil_max_compassion value: 18 - name: le_deuil_min_compassion value: -11 - name: le_deuil_max_hope value: 0 - name: le_deuil_min_hope value: 0 - name: le_deuil_max_empathy value: 18 - name: le_deuil_min_empathy value: -6 - name: un_nouveau_patient_en_chambre_14_max_score value: 41 - name: un_nouveau_patient_en_chambre_14_min_score value: -7 - name: un_nouveau_patient_en_chambre_14_max_authenticiy value: 0 - name: un_nouveau_patient_en_chambre_14_min_authenticiy value: 0 - name: un_nouveau_patient_en_chambre_14_max_respect value: 16 - name: un_nouveau_patient_en_chambre_14_min_respect value: -8 - name: un_nouveau_patient_en_chambre_14_max_compassion value: 12 - name: un_nouveau_patient_en_chambre_14_min_compassion value: -1 - name: un_nouveau_patient_en_chambre_14_max_hope value: 0 - name: un_nouveau_patient_en_chambre_14_min_hope value: 0 - name: un_nouveau_patient_en_chambre_14_max_empathy value: 21 - name: un_nouveau_patient_en_chambre_14_min_empathy value: -3 - name: comment_faire_son_deuil_max_score value: 5 - name: comment_faire_son_deuil_min_score value: 0 - name: comment_faire_son_deuil_max_authenticiy value: 5 - name: comment_faire_son_deuil_min_authenticiy value: 0 - name: comment_faire_son_deuil_max_respect value: 0 - name: comment_faire_son_deuil_min_respect value: 0 - name: comment_faire_son_deuil_max_compassion value: 0 - name: comment_faire_son_deuil_min_compassion value: 0 - name: comment_faire_son_deuil_max_hope value: 0 - name: comment_faire_son_deuil_min_hope value: 0 - name: comment_faire_son_deuil_max_empathy value: 0 - name: comment_faire_son_deuil_min_empathy value: 0 @stop No newline at end of file Loading
.gitignore +0 −2 Original line number Diff line number Diff line Loading @@ -164,5 +164,3 @@ cython_debug/ #.idea/ # End of https://www.toptal.com/developers/gitignore/api/python variables.txt variables.nani
features/min_max_stats_finder.py +110 −60 Original line number Diff line number Diff line Loading @@ -15,61 +15,124 @@ def min_max_scores(content): for idx_scene, scene in enumerate(chapter["Scenes"]): scene_name = scene["Title"] min_score, max_score = find_scene_scores(scene, 'score') min_authenticiy, max_authenticiy = find_scene_scores(scene, 'authenticiy') min_respect, max_respect = find_scene_scores(scene, 'respect') min_compassion, max_compassion = find_scene_scores(scene, 'compassion') min_hope, max_hope = find_scene_scores(scene, 'hope') min_empathy, max_empathy = find_scene_scores(scene, 'empathy') scores[scene_name] = { "max_score": max_score, "min_Score": min_score, "max_authenticiy": max_authenticiy, "min_authenticiy": min_authenticiy, "max_respect": max_respect, "min_respect": min_respect, "max_compassion": max_compassion, "min_compassion": min_compassion, "max_hope": max_hope, "min_hope": min_hope, "max_empathy": max_empathy, "min_empathy": min_empathy } if idx_chapter == 0 and idx_scene == 2: scores[scene_name] = {} elif idx_chapter == 1 and idx_scene == 1: scores[scene_name] = {} else: scores[scene_name] = find_scene_scores(scene) print(scene_name+" ("+str(idx_scene+1)+") done") return scores def find_scene_scores(scene, weight_name): def find_scene_scores(scene): graph, end_nodes = create_graph(scene) scene_min_score = 10000 scene_max_score = -1000 #scene_min_score = 10000 #scene_max_score = -1000 #scene_min_path = [] #scene_max_path = [] max_score=-100 min_score=100 max_authenticiy=-100 min_authenticiy=100 max_respect=-100 min_respect=100 max_compassion=-100 min_compassion=100 max_hope=-100 min_hope=100 max_empathy=-100 min_empathy=100 # Iterate over each end node for end_nodes in end_nodes: paths =nx.all_simple_paths(graph,source=1,target=end_nodes) #paths =nx.all_simple_paths(graph,source=1,target=end_nodes) paths2 = nx.all_simple_edge_paths(graph,source=1,target=end_nodes) #Iterate over all paths for path in paths: for path in paths2: path_score_weight = 0 path_authenticity_weight = 0 path_respect_weight = 0 path_compassion_weight = 0 path_hope_weight = 0 path_empathy_weight = 0 for edge in path: scores = graph.get_edge_data(edge[0], edge[1])[edge[2]] path_weight = nx.path_weight(graph,path,weight=weight_name) path_score_weight += scores["score"] path_authenticity_weight += scores["authenticiy"] path_respect_weight += scores["respect"] path_compassion_weight += scores["compassion"] path_hope_weight += scores["hope"] path_empathy_weight += scores["empathy"] #path_weight = nx.path_weight(graph,path,weight=weight_name) # if the score of the current path is lower than the scene_min_score, we replace scene_min_score by the weight of the current path if path_weight < scene_min_score: scene_min_score = path_weight #scene_min_path = path if path_score_weight < min_score: min_score = path_score_weight if path_authenticity_weight < min_authenticiy: min_authenticiy = path_authenticity_weight if path_respect_weight < min_respect: min_respect = path_respect_weight if path_compassion_weight < min_compassion: min_compassion = path_compassion_weight if path_hope_weight < min_hope: min_hope = path_hope_weight if path_empathy_weight < min_empathy: min_empathy = path_empathy_weight # if the score of the current path is bigger than the scene_max_score, we replace scene_max_score by the weight of the current path if path_weight > scene_max_score: scene_max_score = path_weight #scene_max_path = path if path_score_weight > max_score: max_score = path_score_weight if path_authenticity_weight > max_authenticiy: max_authenticiy = path_authenticity_weight if path_respect_weight > max_respect: max_respect = path_respect_weight if path_compassion_weight > max_compassion: max_compassion = path_compassion_weight if path_hope_weight > max_hope: max_hope = path_hope_weight if path_empathy_weight > max_empathy: max_empathy = path_empathy_weight return scene_min_score, scene_max_score return { "max_score": max_score, "min_Score": min_score, "max_authenticiy": max_authenticiy, "min_authenticiy": min_authenticiy, "max_respect": max_respect, "min_respect": min_respect, "max_compassion": max_compassion, "min_compassion": min_compassion, "max_hope": max_hope, "min_hope": min_hope, "max_empathy": max_empathy, "min_empathy": min_empathy } def create_graph(scene): graph = nx.DiGraph() #graph = nx.DiGraph() graph = nx.MultiDiGraph() end_nodes = set() for interaction in scene["Interactions"]: Loading @@ -77,11 +140,13 @@ def create_graph(scene): for choice in interaction['Responses']: child_node = choice["NextInteractionID"] score = choice["Authenticity"] + choice["Respect"] + choice["Compassion"] + choice["Hope"] + choice["Empathy"] if child_node != -1: graph.add_edge(current_node,child_node, score=score, authenticiy=choice["Authenticity"], respect=choice["Respect"], compassion=choice["Compassion"], hope=choice["Hope"], empathy=choice["Empathy"]) else: end_nodes.add(current_node) return graph, end_nodes def normalize_string(text): Loading @@ -90,16 +155,11 @@ def normalize_string(text): .replace("ê", "e").replace("è", "e").replace("à", "a") def show_graph(graph, attribut): pos = nx.spring_layout(graph, seed=7) nx.draw_networkx_nodes(graph, pos, node_size=700) nx.draw_networkx_edges(graph, pos, edgelist=graph.edges(data=True), width=6) nx.draw_networkx_labels(graph, pos, font_size=20, font_family="sans-serif") edge_labels = nx.get_edge_attributes(graph, attribut) nx.draw_networkx_edge_labels(graph, pos, edge_labels) ax = plt.gca() ax.margins(0.08) plt.axis("off") plt.tight_layout() pos = nx.spring_layout(graph) nx.draw_networkx_nodes(graph, pos, node_size=300) nx.draw(graph, pos, with_labels=True, connectionstyle='arc3, rad = 0.1') edge_labels=dict([((u,v,),d[attribut]) for u,v,d in graph.edges(data=True)]) plt.show() def write_vars_to_file(scores): Loading @@ -118,21 +178,11 @@ if __name__ == "__main__": with open("Chapters.json", 'r', encoding="utf-8") as j: contents = json.loads(j.read()) scene = contents["Chapters"][0]["Scenes"][3] #min_authenticiy, max_authenticiy = find_scene_scores(scene, 'authenticiy') min_respect, max_respect = find_scene_scores(scene, 'respect') #min_compassion, max_compassion = find_scene_scores(scene, 'compassion') #min_hope, max_hope = find_scene_scores(scene, 'hope') #min_empathy, max_empathy = find_scene_scores(scene, 'empathy') print("min:"+str(min_respect)) print("max:"+ str(max_respect)) graph, end_nodes = create_graph(scene) show_graph(graph,"respect") scores = find_scene_scores(scene) print(scores)
variables.txt 0 → 100644 +409 −0 Original line number Diff line number Diff line - name: presentation_max_score value: 55 - name: presentation_min_score value: -16 - name: presentation_max_authenticiy value: 0 - name: presentation_min_authenticiy value: 0 - name: presentation_max_respect value: 16 - name: presentation_min_respect value: -5 - name: presentation_max_compassion value: 22 - name: presentation_min_compassion value: -8 - name: presentation_max_hope value: 0 - name: presentation_min_hope value: 0 - name: presentation_max_empathy value: 23 - name: presentation_min_empathy value: -6 - name: vite_fait_bien_fait_max_score value: 5 - name: vite_fait_bien_fait_min_score value: 0 - name: vite_fait_bien_fait_max_authenticiy value: 5 - name: vite_fait_bien_fait_min_authenticiy value: 0 - name: vite_fait_bien_fait_max_respect value: 0 - name: vite_fait_bien_fait_min_respect value: 0 - name: vite_fait_bien_fait_max_compassion value: 0 - name: vite_fait_bien_fait_min_compassion value: 0 - name: vite_fait_bien_fait_max_hope value: 0 - name: vite_fait_bien_fait_min_hope value: 0 - name: vite_fait_bien_fait_max_empathy value: 0 - name: vite_fait_bien_fait_min_empathy value: 0 - name: les_soins_max_score value: 78 - name: les_soins_min_score value: -16 - name: les_soins_max_authenticiy value: 0 - name: les_soins_min_authenticiy value: 0 - name: les_soins_max_respect value: 23 - name: les_soins_min_respect value: -4 - name: les_soins_max_compassion value: 21 - name: les_soins_min_compassion value: -6 - name: les_soins_max_hope value: 0 - name: les_soins_min_hope value: 0 - name: les_soins_max_empathy value: 39 - name: les_soins_min_empathy value: -6 - name: le_dîner_max_score value: 16 - name: le_dîner_min_score value: -1 - name: le_dîner_max_authenticiy value: 0 - name: le_dîner_min_authenticiy value: 0 - name: le_dîner_max_respect value: 5 - name: le_dîner_min_respect value: 1 - name: le_dîner_max_compassion value: 4 - name: le_dîner_min_compassion value: 0 - name: le_dîner_max_hope value: 0 - name: le_dîner_min_hope value: 0 - name: le_dîner_max_empathy value: 8 - name: le_dîner_min_empathy value: -2 - name: lieu_de_vie,_lieu_de_mort_max_score value: 60 - name: lieu_de_vie,_lieu_de_mort_min_score value: -3 - name: lieu_de_vie,_lieu_de_mort_max_authenticiy value: 0 - name: lieu_de_vie,_lieu_de_mort_min_authenticiy value: 0 - name: lieu_de_vie,_lieu_de_mort_max_respect value: 14 - name: lieu_de_vie,_lieu_de_mort_min_respect value: -4 - name: lieu_de_vie,_lieu_de_mort_max_compassion value: 18 - name: lieu_de_vie,_lieu_de_mort_min_compassion value: 1 - name: lieu_de_vie,_lieu_de_mort_max_hope value: 0 - name: lieu_de_vie,_lieu_de_mort_min_hope value: 0 - name: lieu_de_vie,_lieu_de_mort_max_empathy value: 29 - name: lieu_de_vie,_lieu_de_mort_min_empathy value: -3 - name: projet_de_vie_max_score value: 88 - name: projet_de_vie_min_score value: -5 - name: projet_de_vie_max_authenticiy value: 0 - name: projet_de_vie_min_authenticiy value: 0 - name: projet_de_vie_max_respect value: 21 - name: projet_de_vie_min_respect value: 1 - name: projet_de_vie_max_compassion value: 29 - name: projet_de_vie_min_compassion value: -2 - name: projet_de_vie_max_hope value: 0 - name: projet_de_vie_min_hope value: 0 - name: projet_de_vie_max_empathy value: 40 - name: projet_de_vie_min_empathy value: -4 - name: culpabilite_des_proches_max_score value: 54 - name: culpabilite_des_proches_min_score value: -1 - name: culpabilite_des_proches_max_authenticiy value: 0 - name: culpabilite_des_proches_min_authenticiy value: 0 - name: culpabilite_des_proches_max_respect value: 12 - name: culpabilite_des_proches_min_respect value: 0 - name: culpabilite_des_proches_max_compassion value: 17 - name: culpabilite_des_proches_min_compassion value: -1 - name: culpabilite_des_proches_max_hope value: 0 - name: culpabilite_des_proches_min_hope value: 0 - name: culpabilite_des_proches_max_empathy value: 28 - name: culpabilite_des_proches_min_empathy value: -3 - name: angoisse_de_la_dyspnee_max_score value: 56 - name: angoisse_de_la_dyspnee_min_score value: -9 - name: angoisse_de_la_dyspnee_max_authenticiy value: 0 - name: angoisse_de_la_dyspnee_min_authenticiy value: 0 - name: angoisse_de_la_dyspnee_max_respect value: 15 - name: angoisse_de_la_dyspnee_min_respect value: -1 - name: angoisse_de_la_dyspnee_max_compassion value: 23 - name: angoisse_de_la_dyspnee_min_compassion value: -5 - name: angoisse_de_la_dyspnee_max_hope value: 0 - name: angoisse_de_la_dyspnee_min_hope value: 0 - name: angoisse_de_la_dyspnee_max_empathy value: 22 - name: angoisse_de_la_dyspnee_min_empathy value: -7 - name: les_dernieres_volontes_max_score value: 34 - name: les_dernieres_volontes_min_score value: 0 - name: les_dernieres_volontes_max_authenticiy value: 0 - name: les_dernieres_volontes_min_authenticiy value: 0 - name: les_dernieres_volontes_max_respect value: 7 - name: les_dernieres_volontes_min_respect value: 1 - name: les_dernieres_volontes_max_compassion value: 13 - name: les_dernieres_volontes_min_compassion value: -1 - name: les_dernieres_volontes_max_hope value: 0 - name: les_dernieres_volontes_min_hope value: 0 - name: les_dernieres_volontes_max_empathy value: 16 - name: les_dernieres_volontes_min_empathy value: -2 - name: les_professionnels_face_a_la_mort_max_score value: 0 - name: les_professionnels_face_a_la_mort_min_score value: 0 - name: les_professionnels_face_a_la_mort_max_authenticiy value: 0 - name: les_professionnels_face_a_la_mort_min_authenticiy value: 0 - name: les_professionnels_face_a_la_mort_max_respect value: 0 - name: les_professionnels_face_a_la_mort_min_respect value: 0 - name: les_professionnels_face_a_la_mort_max_compassion value: 0 - name: les_professionnels_face_a_la_mort_min_compassion value: 0 - name: les_professionnels_face_a_la_mort_max_hope value: 0 - name: les_professionnels_face_a_la_mort_min_hope value: 0 - name: les_professionnels_face_a_la_mort_max_empathy value: 0 - name: les_professionnels_face_a_la_mort_min_empathy value: 0 - name: acceptation_inconditionnelle_max_score value: 72 - name: acceptation_inconditionnelle_min_score value: -4 - name: acceptation_inconditionnelle_max_authenticiy value: 0 - name: acceptation_inconditionnelle_min_authenticiy value: 0 - name: acceptation_inconditionnelle_max_respect value: 19 - name: acceptation_inconditionnelle_min_respect value: 0 - name: acceptation_inconditionnelle_max_compassion value: 24 - name: acceptation_inconditionnelle_min_compassion value: -3 - name: acceptation_inconditionnelle_max_hope value: 0 - name: acceptation_inconditionnelle_min_hope value: 0 - name: acceptation_inconditionnelle_max_empathy value: 33 - name: acceptation_inconditionnelle_min_empathy value: -4 - name: soin_de_bouche_max_score value: 50 - name: soin_de_bouche_min_score value: -18 - name: soin_de_bouche_max_authenticiy value: 0 - name: soin_de_bouche_min_authenticiy value: 0 - name: soin_de_bouche_max_respect value: 12 - name: soin_de_bouche_min_respect value: -9 - name: soin_de_bouche_max_compassion value: 17 - name: soin_de_bouche_min_compassion value: -6 - name: soin_de_bouche_max_hope value: 0 - name: soin_de_bouche_min_hope value: 0 - name: soin_de_bouche_max_empathy value: 26 - name: soin_de_bouche_min_empathy value: -5 - name: conflit_interieur_max_score value: 4 - name: conflit_interieur_min_score value: 0 - name: conflit_interieur_max_authenticiy value: 4 - name: conflit_interieur_min_authenticiy value: 0 - name: conflit_interieur_max_respect value: 0 - name: conflit_interieur_min_respect value: 0 - name: conflit_interieur_max_compassion value: 0 - name: conflit_interieur_min_compassion value: 0 - name: conflit_interieur_max_hope value: 0 - name: conflit_interieur_min_hope value: 0 - name: conflit_interieur_max_empathy value: 0 - name: conflit_interieur_min_empathy value: 0 - name: rupture_du_lien_max_score value: 31 - name: rupture_du_lien_min_score value: -16 - name: rupture_du_lien_max_authenticiy value: 0 - name: rupture_du_lien_min_authenticiy value: 0 - name: rupture_du_lien_max_respect value: 8 - name: rupture_du_lien_min_respect value: -2 - name: rupture_du_lien_max_compassion value: 13 - name: rupture_du_lien_min_compassion value: -6 - name: rupture_du_lien_max_hope value: 0 - name: rupture_du_lien_min_hope value: 0 - name: rupture_du_lien_max_empathy value: 14 - name: rupture_du_lien_min_empathy value: -8 - name: le_deuil_max_score value: 43 - name: le_deuil_min_score value: -13 - name: le_deuil_max_authenticiy value: 0 - name: le_deuil_min_authenticiy value: 0 - name: le_deuil_max_respect value: 12 - name: le_deuil_min_respect value: -1 - name: le_deuil_max_compassion value: 18 - name: le_deuil_min_compassion value: -11 - name: le_deuil_max_hope value: 0 - name: le_deuil_min_hope value: 0 - name: le_deuil_max_empathy value: 18 - name: le_deuil_min_empathy value: -6 - name: un_nouveau_patient_en_chambre_14_max_score value: 41 - name: un_nouveau_patient_en_chambre_14_min_score value: -7 - name: un_nouveau_patient_en_chambre_14_max_authenticiy value: 0 - name: un_nouveau_patient_en_chambre_14_min_authenticiy value: 0 - name: un_nouveau_patient_en_chambre_14_max_respect value: 16 - name: un_nouveau_patient_en_chambre_14_min_respect value: -8 - name: un_nouveau_patient_en_chambre_14_max_compassion value: 12 - name: un_nouveau_patient_en_chambre_14_min_compassion value: -1 - name: un_nouveau_patient_en_chambre_14_max_hope value: 0 - name: un_nouveau_patient_en_chambre_14_min_hope value: 0 - name: un_nouveau_patient_en_chambre_14_max_empathy value: 21 - name: un_nouveau_patient_en_chambre_14_min_empathy value: -3 - name: comment_faire_son_deuil_max_score value: 5 - name: comment_faire_son_deuil_min_score value: 0 - name: comment_faire_son_deuil_max_authenticiy value: 5 - name: comment_faire_son_deuil_min_authenticiy value: 0 - name: comment_faire_son_deuil_max_respect value: 0 - name: comment_faire_son_deuil_min_respect value: 0 - name: comment_faire_son_deuil_max_compassion value: 0 - name: comment_faire_son_deuil_min_compassion value: 0 - name: comment_faire_son_deuil_max_hope value: 0 - name: comment_faire_son_deuil_min_hope value: 0 - name: comment_faire_son_deuil_max_empathy value: 0 - name: comment_faire_son_deuil_min_empathy value: 0 @stop No newline at end of file