Add niceness and log output to the geocoding

This commit is contained in:
Arne Schlüter 2015-01-18 11:22:07 +01:00
commit 24ffdeb1ec

View file

@ -2,7 +2,11 @@ import time
from models import * from models import *
from analyze import * from analyze import *
for article in Article.select().limit(5): print("Start geocoding...")
start_time = time.time()
articles = Article.select()
for article in articles:
potential = get_potential_places(article.place, article.description) potential = get_potential_places(article.place, article.description)
places = improve_potential_places(potential) places = improve_potential_places(potential)
@ -19,4 +23,7 @@ for article in Article.select().limit(5):
location["match"] = query location["match"] = query
Location.create(**location) Location.create(**location)
# time.sleep(1) time.sleep(1)
time_taken = time.time() - start_time
print("Geocoded {} articles in {} seconds".format(articles.count(), time_taken))