From 164ce55bbe6549d1cc2618dca2f53eeac04de349 Mon Sep 17 00:00:00 2001
From: Tiravy Amaury <amaury.tiravy@ecl20.ec-lyon.fr>
Date: Thu, 7 Mar 2024 10:54:14 +0100
Subject: [PATCH] enlever_accents

---
 requirements.txt | 3 ++-
 test_combine.py  | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/requirements.txt b/requirements.txt
index fcec211..bcfb64b 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -11,4 +11,5 @@ spacy
 PyQt5
 sklearn
 nltk
-sys
\ No newline at end of file
+sys
+unidecode
\ No newline at end of file
diff --git a/test_combine.py b/test_combine.py
index 233702c..a3b610b 100644
--- a/test_combine.py
+++ b/test_combine.py
@@ -7,6 +7,7 @@ from sklearn.metrics.pairwise import cosine_similarity
 import numpy as np
 from nltk.corpus import stopwords
 from nltk.tokenize import word_tokenize
+from unidecode import unidecode
 
 def read_text_file(file_path):
     """
@@ -18,7 +19,7 @@ def read_text_file(file_path):
     """
     with open(file_path, 'r', encoding='utf-8') as file:
         content = file.read().split('\n\n')
-        content1 = [item for item in content if item != ""]
+        content1 = [unidecode(item) for item in content if item != ""]
     return content1
 
 def extract_keywords_french(sentence):
@@ -251,6 +252,7 @@ class ChatbotInterface(QWidget):
         Handles the user's input, processes it, and displays the chatbot's response.
         """
         user_command = self.user_input_entry.text()
+        user_command=unidecode(user_command)
         if len(user_command)>0:
             self.conversation_text.clear()
             self.conversation_text.append(f"demande élève: {user_command}")
-- 
GitLab