mirror of
https://github.com/heyarne/berliner-winter.git
synced 2026-05-06 19:23:39 +02:00
Move geocoding to Google API
This commit is contained in:
parent
13ac77b575
commit
cb0175a7b7
4 changed files with 57 additions and 22 deletions
22
locator.py
Normal file
22
locator.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import time
|
||||
from models import *
|
||||
from analyze import *
|
||||
|
||||
for article in Article.select().limit(5):
|
||||
potential = get_potential_places(article.place, article.description)
|
||||
places = improve_potential_places(potential)
|
||||
|
||||
print("Found places: {}".format(places))
|
||||
|
||||
for place in places:
|
||||
query = " ".join([word for (word, tag) in place])
|
||||
print("Query: {}, Berlin".format(query))
|
||||
|
||||
locations = get_geoloc(query)
|
||||
|
||||
for location in locations:
|
||||
location["article"] = article
|
||||
location["match"] = query
|
||||
Location.create(**location)
|
||||
|
||||
# time.sleep(1)
|
||||
Loading…
Add table
Add a link
Reference in a new issue