scripts: Remove unintentional whitespaces

This commit is contained in:
Alexander Polynomdivision 2018-10-09 16:25:49 +02:00
parent eee04671ff
commit 5c3603f595

View File

@ -46,6 +46,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 = ""
mnemonic = ""
@ -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 <URI> <Database>", 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")