''' 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 = "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'] 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 ''' 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 = 200 MAX_CARACT_DEDUIT = 50 TOKEN_SIZE = 25 MAX_CARACT_DETAIL = 500 DEBUG_LEVEL = logging.DEBUG LOG_FILE_NAME = "./Log/log_file.log" upload_folder = "./Data/" ALLOWED_EXTENSIONS = {'txt', 'pdf', 'png', 'jpg', 'jpeg', 'gif'} 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 = 55 ''' 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'] ''' 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 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/"