diff --git a/app/multilinguality.py b/app/multilinguality.py index 81f4a8d..6a88b27 100644 --- a/app/multilinguality.py +++ b/app/multilinguality.py @@ -1,4 +1,4 @@ -from os.path import dirname, join, realpath, isfile +from os.path import dirname, join, realpath, isfile, isdir def read_language_codes(): dir_path = dirname(dirname(realpath(__file__))) @@ -14,6 +14,9 @@ def read_stopwords(lang): dir_path = dirname(dirname(realpath(__file__))) ling_dir = join(dir_path,'app','ling','stopwords') STOPWORDS = [] + if not isdir(ling_dir) or not isfile(join(ling_dir,lang)): + return STOPWORDS + with open(join(ling_dir,lang),'r') as f: STOPWORDS = f.read().splitlines() return STOPWORDS