''' 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 CONNECTION_STRING = "mongodb://localhost:27017/cherifdb" client = MongoClient(CONNECTION_STRING) dbname = client['cherifdb'] YTUBES_CONNECTION_STRING = "mongodb://localhost:27017/" YTUBES_client = MongoClient(YTUBES_CONNECTION_STRING) YTUBES_dbname = YTUBES_client['mysyvideodb'] ''' 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 = 250 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 = 500 ''' Cette variable definit le nombre de mots retourné dans le cas d'une aide à avec une recherche vide ''' HELP_WORD_QUERY_LIMIT = 3