Update djezzy.py
Browse files
djezzy.py
CHANGED
@@ -102,7 +102,7 @@ def pip(question,docs_text, docs_embeddings,mots_a_verifier,vector_db):
|
|
102 |
|
103 |
# Question à analyser
|
104 |
question = query_text
|
105 |
-
|
106 |
# Convertir la question en une liste de mots
|
107 |
mots_question = question.lower().split()
|
108 |
bi_grammes = [' '.join([mots_question[i], mots_question[i+1]]) for i in range(len(mots_question)-1)]
|
@@ -120,6 +120,7 @@ def pip(question,docs_text, docs_embeddings,mots_a_verifier,vector_db):
|
|
120 |
if not mots_trouves:
|
121 |
|
122 |
similarities = [cosine_similarity(doc.reshape(1,-1), query_embedding_array.reshape(1,-1)) for doc in docs_embeddings]
|
|
|
123 |
sorted_docs = sorted(zip(docs_text, docs_embeddings, similarities), key=lambda x: x[2], reverse=True)
|
124 |
similar_docs1 = [(doc,sim) for doc, _, sim in sorted_docs if sim > 0.72]
|
125 |
if not similar_docs1:
|
|
|
102 |
|
103 |
# Question à analyser
|
104 |
question = query_text
|
105 |
+
print(question)
|
106 |
# Convertir la question en une liste de mots
|
107 |
mots_question = question.lower().split()
|
108 |
bi_grammes = [' '.join([mots_question[i], mots_question[i+1]]) for i in range(len(mots_question)-1)]
|
|
|
120 |
if not mots_trouves:
|
121 |
|
122 |
similarities = [cosine_similarity(doc.reshape(1,-1), query_embedding_array.reshape(1,-1)) for doc in docs_embeddings]
|
123 |
+
print(similarities)
|
124 |
sorted_docs = sorted(zip(docs_text, docs_embeddings, similarities), key=lambda x: x[2], reverse=True)
|
125 |
similar_docs1 = [(doc,sim) for doc, _, sim in sorted_docs if sim > 0.72]
|
126 |
if not similar_docs1:
|