05/05/22 - 18h30
parent
d4c58eaebb
commit
c96a675925
|
@ -383,7 +383,7 @@ def Ela_stemmize_search(tab_tokens):
|
||||||
'''
|
'''
|
||||||
On fait la correction orthographe avant
|
On fait la correction orthographe avant
|
||||||
'''
|
'''
|
||||||
print("AVANT COORECTION ORH ="+str(mot)+" ==> APRES = "+unidecode(str(MYSY_GV.spell.correction(mot))))
|
print("AVANT CORRECTION ORTHOGRAHIQUE ="+str(mot)+" ==> APRES = "+unidecode(str(MYSY_GV.spell.correction(mot))))
|
||||||
corrected_str = str(MYSY_GV.spell.correction(mot))
|
corrected_str = str(MYSY_GV.spell.correction(mot))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -585,32 +585,47 @@ def mysy_recherche_levenshtein(tab_mot):
|
||||||
training_mots = []
|
training_mots = []
|
||||||
|
|
||||||
for mot in tab_mot:
|
for mot in tab_mot:
|
||||||
if( len( mot ) > 2):
|
|
||||||
mot_first_caract = mot[0:3]
|
|
||||||
print(" Traitement de " + str(mot) + " = 3 first => " + str(mot_first_caract))
|
|
||||||
|
|
||||||
v = {'$regex': "^" + mot_first_caract}
|
'''
|
||||||
print("v = " + str(v))
|
Si le mot appartient à la collection "word_not_stem", alors il faut faire un recherche strict
|
||||||
|
pas de recherche elastique à faire.
|
||||||
|
'''
|
||||||
|
print("### + #### '" + str(mot) + "' mycommon.Word_Not_Stemmize(str(mot) = '" +
|
||||||
|
str(mycommon.Word_Not_Stemmize(str(mot))))
|
||||||
|
if (mycommon.Word_Not_Stemmize(str(mot)) is True):
|
||||||
|
# "recherche strict"
|
||||||
|
if (str(mot) not in training_mots):
|
||||||
|
print(" Le mot " + str(mot) + " est dans la table 'word_not_stem', donc pas de recherche elastique")
|
||||||
|
training_mots.append(str(mot))
|
||||||
|
|
||||||
for x in coll_name.find({'mots': v}):
|
else:
|
||||||
cmp_levenshtein = int(mycommon.levenshtein(mot, str(x['mots'])))
|
|
||||||
print(" check ### ="+str(x['mots']))
|
|
||||||
|
|
||||||
if( len(mot) <= 5 and cmp_levenshtein <= 1):
|
if( len( mot ) > 2):
|
||||||
if( str(x['mots']) not in training_mots):
|
mot_first_caract = mot[0:3]
|
||||||
training_mots.append( str(x['mots']) )
|
print(" Traitement de " + str(mot) + " = 3 first => " + str(mot_first_caract))
|
||||||
|
|
||||||
elif( len(mot) <= 10 and cmp_levenshtein <= 2):
|
v = {'$regex': "^" + mot_first_caract}
|
||||||
if( str(x['mots']) not in training_mots):
|
print("v = " + str(v))
|
||||||
training_mots.append( str(x['mots']) )
|
|
||||||
|
|
||||||
elif ( cmp_levenshtein <= 3):
|
for x in coll_name.find({'mots': v}):
|
||||||
if (str(x['mots']) not in training_mots):
|
cmp_levenshtein = int(mycommon.levenshtein(mot, str(x['mots'])))
|
||||||
training_mots.append(str(x['mots']))
|
#print(" check ### ="+str(x['mots']))
|
||||||
|
|
||||||
elif (cmp_levenshtein > 3):
|
if( len(mot) <= 5 and cmp_levenshtein <= 1):
|
||||||
print(" KOO cmp_levenshtein : " + mot + " CMP " + str(x['mots']) + " = " + str(cmp_levenshtein) +
|
if( str(x['mots']) not in training_mots):
|
||||||
" ==> id_formation" + str(x['id_formation']) + " ==> occurrence = " + str(x['occurence']))
|
training_mots.append( str(x['mots']) )
|
||||||
|
|
||||||
|
elif( len(mot) <= 10 and cmp_levenshtein <= 2):
|
||||||
|
if( str(x['mots']) not in training_mots):
|
||||||
|
training_mots.append( str(x['mots']) )
|
||||||
|
|
||||||
|
elif ( cmp_levenshtein <= 3):
|
||||||
|
if (str(x['mots']) not in training_mots):
|
||||||
|
training_mots.append(str(x['mots']))
|
||||||
|
|
||||||
|
elif (cmp_levenshtein > 3):
|
||||||
|
print(" KOOFF cmp_levenshtein : " + mot + " CMP " + str(x['mots']) + " = " + str(cmp_levenshtein) +
|
||||||
|
" ==> id_formation" + str(x['id_formation']) + " ==> occurrence = " + str(x['occurence']))
|
||||||
|
|
||||||
|
|
||||||
return True, training_mots
|
return True, training_mots
|
||||||
|
@ -681,7 +696,7 @@ def ela_recherche_tokens_source_field(sentence, source_fied=""):
|
||||||
'''
|
'''
|
||||||
|
|
||||||
collection = MYSY_GV.dbname["elaindex"]
|
collection = MYSY_GV.dbname["elaindex"]
|
||||||
print(" mot recherché tab_tokens4 (initialement) = " + str(tab_tokens4))
|
print(" mot recherchéee tab_tokens4 (initialement) = " + str(tab_tokens4))
|
||||||
status, new_tab_tokens4 = mysy_recherche_levenshtein(tab_tokens4)
|
status, new_tab_tokens4 = mysy_recherche_levenshtein(tab_tokens4)
|
||||||
if (status is False):
|
if (status is False):
|
||||||
mycommon.myprint(str(inspect.stack()[0][3]) + " Recherche : mysy_recherche_levenshtein return FALSE ")
|
mycommon.myprint(str(inspect.stack()[0][3]) + " Recherche : mysy_recherche_levenshtein return FALSE ")
|
||||||
|
|
13
email_mgt.py
13
email_mgt.py
|
@ -10,22 +10,17 @@ import sys, os
|
||||||
import prj_common as mycommon
|
import prj_common as mycommon
|
||||||
|
|
||||||
locale.setlocale(category=locale.LC_ALL, locale='fr_FR.utf8')
|
locale.setlocale(category=locale.LC_ALL, locale='fr_FR.utf8')
|
||||||
smtp_address = 'smtp.ionos.fr'
|
|
||||||
port = 587
|
|
||||||
sender = 'No.Reply@educetera.org'
|
|
||||||
receiver = 'cbalde@bigben-connected.com'
|
|
||||||
user = 'No.Reply@educetera.org'
|
|
||||||
password = 'Vince1234!'
|
|
||||||
|
|
||||||
|
|
||||||
smtp_address = 'smtp-relay.sendinblue.com'
|
smtp_address = 'smtp-relay.sendinblue.com'
|
||||||
port = 587
|
port = 587
|
||||||
sender = 'billardman01@hotmail.com'
|
sender = 'contact@mysy-training.com'
|
||||||
receiver = ["cbalde3@mysy-training.com","billardman1@gmail.com"]
|
receiver = ["cbalde3@mysy-training.com","billardman1@gmail.com"]
|
||||||
|
|
||||||
|
|
||||||
user = 'billardman01@hotmail.com'
|
user = 'contact@mysy-training.com'
|
||||||
password = 'cYa1pk56Zx7EzKmg'
|
password = 'yGmzqBfrjb3YCvQN'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ def mysy_recherche_levenshtein_orig():
|
||||||
training_mots.append(str(x['mots']))
|
training_mots.append(str(x['mots']))
|
||||||
|
|
||||||
elif (cmp_levenshtein > 3):
|
elif (cmp_levenshtein > 3):
|
||||||
print(" KOO cmp_levenshtein : "+mot+" CMP "+str(x['mots'])+" = "+str(cmp_levenshtein)+
|
print(" KOO ?? KE cmp_levenshtein : "+mot+" CMP "+str(x['mots'])+" = "+str(cmp_levenshtein)+
|
||||||
" ==> id_formation"+str(x['id_formation'])+" ==> occurrence = "+str(x['occurence']))
|
" ==> id_formation"+str(x['id_formation'])+" ==> occurrence = "+str(x['occurence']))
|
||||||
|
|
||||||
return True, training_mots
|
return True, training_mots
|
||||||
|
@ -81,32 +81,52 @@ def mysy_recherche_levenshtein(tab_mot):
|
||||||
training_mots = []
|
training_mots = []
|
||||||
|
|
||||||
for mot in tab_mot:
|
for mot in tab_mot:
|
||||||
if( len( mot ) > 2):
|
|
||||||
mot_first_caract = mot[0:3]
|
|
||||||
print(" Traitement de " + str(mot) + " = 3 first => " + str(mot_first_caract))
|
|
||||||
|
|
||||||
v = {'$regex': "^" + mot_first_caract}
|
'''
|
||||||
print("v = " + str(v))
|
Si le mot appartient à la collection "word_not_stem", alors il faut faire un recherche strict
|
||||||
|
pas de recherche elastique à faire.
|
||||||
|
'''
|
||||||
|
print("### + #### '"+str(mot)+"' mycommon.Word_Not_Stemmize(str(mot) = '"+
|
||||||
|
mycommon.Word_Not_Stemmize(str(mot)))
|
||||||
|
|
||||||
for x in coll_name.find({'mots': v}):
|
if (mycommon.Word_Not_Stemmize(str(mot)) is False):
|
||||||
cmp_levenshtein = int(mycommon.levenshtein(mot, str(x['mots'])))
|
#"recherche strict"
|
||||||
|
if ( str(mot) not in training_mots):
|
||||||
|
print(" Le mot "+str(mot)+" est dans la table 'word_not_stem', donc pas de recherche elastique")
|
||||||
|
training_mots.append(str(mot))
|
||||||
|
|
||||||
|
else:
|
||||||
|
|
||||||
|
'''
|
||||||
|
Si le mot N'APPARTIENT PAS à la collection "word_not_stem" alors c'est un mot classique
|
||||||
|
il faut faire une recherche elastique
|
||||||
|
'''
|
||||||
|
if( len( mot ) > 2):
|
||||||
|
mot_first_caract = mot[0:3]
|
||||||
|
print(" Traitement de " + str(mot) + " = 3 first => " + str(mot_first_caract))
|
||||||
|
|
||||||
|
v = {'$regex': "^" + mot_first_caract}
|
||||||
|
print("v = " + str(v))
|
||||||
|
|
||||||
|
for x in coll_name.find({'mots': v}):
|
||||||
|
cmp_levenshtein = int(mycommon.levenshtein(mot, str(x['mots'])))
|
||||||
|
|
||||||
|
|
||||||
if( len(mot) <= 5 and cmp_levenshtein <= 1):
|
if( len(mot) <= 5 and cmp_levenshtein <= 1):
|
||||||
if( str(x['mots']) not in training_mots):
|
if( str(x['mots']) not in training_mots):
|
||||||
training_mots.append( str(x['mots']) )
|
training_mots.append( str(x['mots']) )
|
||||||
|
|
||||||
elif( len(mot) <= 10 and cmp_levenshtein <= 2):
|
elif( len(mot) <= 10 and cmp_levenshtein <= 2):
|
||||||
if( str(x['mots']) not in training_mots):
|
if( str(x['mots']) not in training_mots):
|
||||||
training_mots.append( str(x['mots']) )
|
training_mots.append( str(x['mots']) )
|
||||||
|
|
||||||
elif ( cmp_levenshtein <= 3):
|
elif ( cmp_levenshtein <= 3):
|
||||||
if (str(x['mots']) not in training_mots):
|
if (str(x['mots']) not in training_mots):
|
||||||
training_mots.append(str(x['mots']))
|
training_mots.append(str(x['mots']))
|
||||||
|
|
||||||
elif (cmp_levenshtein > 3):
|
elif (cmp_levenshtein > 3):
|
||||||
print(" KOO cmp_levenshtein : " + mot + " CMP " + str(x['mots']) + " = " + str(cmp_levenshtein) +
|
print(" KOO00 cmp_levenshtein : " + mot + " CMP " + str(x['mots']) + " = " + str(cmp_levenshtein) +
|
||||||
" ==> id_formation" + str(x['id_formation']) + " ==> occurrence = " + str(x['occurence']))
|
" ==> id_formation" + str(x['id_formation']) + " ==> occurrence = " + str(x['occurence']))
|
||||||
|
|
||||||
|
|
||||||
return True, training_mots
|
return True, training_mots
|
||||||
|
|
Loading…
Reference in New Issue