diff --git a/scripts/csv_vocab_to_mongo.py b/scripts/csv_vocab_to_mongo.py index b6b17b3..f027697 100644 --- a/scripts/csv_vocab_to_mongo.py +++ b/scripts/csv_vocab_to_mongo.py @@ -45,6 +45,9 @@ def csv_to_vocab(filename, type, from_id): # The nouns are special row = preprocess_row(raw) if type == TYPE_NOUNS else raw + + # Remove any whitespaces in front of or after the string + row = [col.strip() for col in row] grundform = row[0] hint = "" @@ -114,7 +117,7 @@ def csv_to_vocab(filename, type, from_id): return vocab, id log("Lateinicus CSV to Vocabulary DB Model") -if (len(sys.argv) < 3): +if len(sys.argv) < 3 and os.getenv("DEBUG") != None: log("Not enough arguments!", err=True) log("Usage: csv_vocab_to_mongo.py ", err=True) sys.exit(1) @@ -142,6 +145,9 @@ log("Adverbs...", tabs=1) adj, last_id = csv_to_vocab("Adverbien.csv", TYPE_ADVERBS, last_id) vocab += adj +if os.getenv("DEBUG") == None: + print(vocab) + sys.exit() # Connect to the database log("Inserting vocabulary into database")