mirror of
https://github.com/heyarne/berliner-winter.git
synced 2026-05-06 19:23:39 +02:00
Add niceness and log output to the geocoding
This commit is contained in:
parent
cb0175a7b7
commit
24ffdeb1ec
1 changed files with 9 additions and 2 deletions
11
locator.py
11
locator.py
|
|
@ -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))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue