Skip to content
Snippets Groups Projects
Commit 164ce55b authored by Tiravy Amaury's avatar Tiravy Amaury
Browse files

enlever_accents

parent 7427b81c
No related branches found
No related tags found
No related merge requests found
...@@ -12,3 +12,4 @@ PyQt5 ...@@ -12,3 +12,4 @@ PyQt5
sklearn sklearn
nltk nltk
sys sys
unidecode
\ No newline at end of file
...@@ -7,6 +7,7 @@ from sklearn.metrics.pairwise import cosine_similarity ...@@ -7,6 +7,7 @@ from sklearn.metrics.pairwise import cosine_similarity
import numpy as np import numpy as np
from nltk.corpus import stopwords from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize from nltk.tokenize import word_tokenize
from unidecode import unidecode
def read_text_file(file_path): def read_text_file(file_path):
""" """
...@@ -18,7 +19,7 @@ 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: with open(file_path, 'r', encoding='utf-8') as file:
content = file.read().split('\n\n') 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 return content1
def extract_keywords_french(sentence): def extract_keywords_french(sentence):
...@@ -251,6 +252,7 @@ class ChatbotInterface(QWidget): ...@@ -251,6 +252,7 @@ class ChatbotInterface(QWidget):
Handles the user's input, processes it, and displays the chatbot's response. Handles the user's input, processes it, and displays the chatbot's response.
""" """
user_command = self.user_input_entry.text() user_command = self.user_input_entry.text()
user_command=unidecode(user_command)
if len(user_command)>0: if len(user_command)>0:
self.conversation_text.clear() self.conversation_text.clear()
self.conversation_text.append(f"demande élève: {user_command}") self.conversation_text.append(f"demande élève: {user_command}")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment