''' Ce fichier contient les variables globales du systeme ''' from pymongo import MongoClient from spellchecker import SpellChecker from nltk.stem.snowball import SnowballStemmer import spacy import logging from autocorrect import Speller from nltk.corpus import stopwords import ela_spacy_common as lsc """ Cette variable definit l'environnement de travail """ #MYSY_ENV = "PROD" #MYSY_ENV = "REC" MYSY_ENV = "DEV" if (MYSY_ENV == "PROD"): CONNECTION_STRING = "mongodb://localhost:27017/cherifdb" client = MongoClient(CONNECTION_STRING) dbname = client['cherifdb'] elif (MYSY_ENV == "DEV"): CONNECTION_STRING = "mongodb://localhost:27017/cherifdb_dev" client = MongoClient(CONNECTION_STRING) dbname = client['cherifdb_dev'] elif (MYSY_ENV == "REC"): CONNECTION_STRING = "mongodb://localhost:27017/cherifdb_rec" client = MongoClient(CONNECTION_STRING) dbname = client['cherifdb_rec'] YTUBES_CONNECTION_STRING = "mongodb://localhost:27017/" YTUBES_client = MongoClient(YTUBES_CONNECTION_STRING) YTUBES_dbname = YTUBES_client['mysyvideodb'] """ Cette Variable definit les port de connexion en dev ou en production """ MYSY_PORT_PROD = 5000 MYSY_PORT_DEV = 5001 MYSY_PORT_REC = 5001 ''' Cette Variable defini le nombre minimum de frequence d'un mot pour qu'il soit indexé. en gros, dans une text, les mots apparaissent moins de 5 fois sont consideré comme des mots à faible raisonnance''' INDEX_MIN_OCCURENCE = 5 ## Gle Variables stemmer = SnowballStemmer(language='french') nlp = spacy.load("fr_core_news_sm") spell = SpellChecker(language='fr') token_fr_pontuation = [] ''' La taille maximal d'un champs à retourner. Au dela de 300 caractère, le système rame ''' MAX_CARACT = 300 MAX_CARACT_DEDUIT = 150 TOKEN_SIZE = 25 MAX_CARACT_DETAIL = 10000 DEBUG_LEVEL = logging.DEBUG LOG_FILE_NAME = "./Log/log_file.log" upload_folder = "./Data/" ALLOWED_EXTENSIONS = {'txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif', 'webp'} logging.basicConfig( level=DEBUG_LEVEL, filename=LOG_FILE_NAME) AUTORIZED_SOURCE_IPV4=["127.0.0.1", "localhost", "88.170.110.220", "192.168.1.21", "192.168.1.48"] #assign the default stopwords list to a variable STOP_WORDS = spacy.lang.fr.stop_words.STOP_WORDS stopWords = set(stopwords.words('french')) sentence = "Bouygues a eu une coupure de réseau à Marseille chez ses clients marseillais et son couteau" lsc.update_stopWords(stopWords) #print(type(stopWords)) lsc.update_token_fr_pontuation(token_fr_pontuation) spell_fr = Speller(lang='fr') ''' Repertoire de stockage de video YouTubes ''' YTUBES_ENSCRIPT_LOCATION = "" ''' Email recever des alertes internes ''' INTERNAL_MAIL_RECEVER = "contact@mysy-training.com" INTERNAL_MAIL_SENDER = "contact@mysy-training.com" INTERNAL_TEL_RECEVER = "+33769203945" INTERNAL_TEL_SENDER = "+33769203945" ''' Cette variable definit le nombre max de retour à faire sur une requet de recherche ''' QUERY_LIMIT_ROW = 50 ''' Cette variable definit le nombre max retour à faire sur page d'acceuil ''' MAINPAGE_QUERY_LIMIT_ROW =50 ''' Cette variable definit le nombre de mots retourné dans le cas d'une aide à avec une recherche vide ''' HELP_WORD_QUERY_LIMIT = 3 ''' Les formats d'image accepté ''' IMG_FORMAT=['jpg', 'jpeg', 'png', 'jpe', 'webp', 'gif'] ''' Sendinblue clea API ''' SENDINBLUE_API_KEY = "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" ''' Taux de TVA ''' TVA_TAUX = 0.2 """ Variable defini le mombre max de mots clés dans une formation """ MAX_KEYWORD = 3 """ Connexion SFTP """ #MYSY_FTP_HOST = "192.168.1.21" MYSY_FTP_HOST = "88.170.110.220" MYSY_FTP_LOGIN = "mysysftpuser" MYSY_FTP_PWD = "JvMysedrBsDMy01!+" """ Repertoire de depot des factures """ #INVOICE_DIRECTORY = "/var/www/html/sftp_iexercice/mysy_invoices" INVOICE_DIRECTORY = "./Invoices/" """ Repertoire pour les liste d'emargement """ EMARGEMENT_DIRECTORY = "./Emargement/" """ """ """ Repertoire racine du ftp ou sont stocké les factures """ INVOICE_FTP_DIRECTORY = "https://sftp.iexercice.com/mysy_invoices/" if (MYSY_ENV == "PROD"): INVOICE_FTP_LOCAL_STORAGE_DIRECTORY = "/var/www/html/sftp_iexercice/mysy_invoices/" elif (MYSY_ENV == "DEV"): INVOICE_FTP_LOCAL_STORAGE_DIRECTORY = "/var/www/html/sftp_iexercice/mysy_invoices_dev/" elif (MYSY_ENV == "REC"): INVOICE_FTP_LOCAL_STORAGE_DIRECTORY = "/var/www/html/sftp_iexercice/mysy_invoices_rec/" """ Cette Variable definit le nombre de formation associées à retourner """ LIMIT_ASSOCIATED_TRAINING = 3 """ Valeur MAX du display ranking accordé aux compte de type demo """ DEMO_RANKING_VALUE = "50" """ Sendinblu compte support """ SENDINBLUE_API_KEY_SUPPORT = "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" """ Variable SMTP de OFFICE 365, suite a l'abandon de sendinblu comme relay stmp """ O365_SMTP_COUNT_password = 'Xad47198' O365_SMTP_COUNT_smtpsrv = "smtp.office365.com" O365_SMTP_COUNT_user = "support@mysy-training.com" O365_SMTP_COUNT_From_User = "support@mysy-training.com" O365_SMTP_COUNT_port = 587 #O365_SMTP_COUNT_password = 'GomboyaVince1234+' #O365_SMTP_COUNT_smtpsrv = "smtp.office365.com" #O365_SMTP_COUNT_user = "cbalde@mysy-training.com" #O365_SMTP_COUNT_From_User = "cbalde@mysy-training.com" #O365_SMTP_COUNT_port = 587