Skip to content

Matching city names with the arbitrary query string.

Notifications You must be signed in to change notification settings

eburakova/geoname_matching

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Geoname seach

Open In Colab

For Yandex Practicum Career Center

A hackaton project with the aim to create a tool that would suggest the cities whose names match the query string.

➡️ Input: query string (potentially containing misspellings)

⏬ Output: a dictionary of k best matching entries with the info on country, population as well as geonameID

See the main notebook for the detailed description and research.

Data sources: http://download.geonames.org/export/dump/

geonamesearch.py demo

 from geonamesearch import search 
 > Connection established: geo_v2 на 77.222.36.33
 q = 'Karaganda'
 search(q, k=5, weight_mode='exp', asdict=False)
geonameid name region country score
609655 Karagandy Karaganda Kazakhstan 98.391
2028078 Aginskoye Zabaykalskiy (Transbaikal) Kray Russia 88.391
790015 Inđija Vojvodina Serbia 78.391
1501321 Kurgan Kurgan Oblast Russia 73.457
553915 Kaluga Kaluga Oblast Russia 73.391
q = 'Milkyway'
search(q, k=3, weight_mode='exp', asdict=False)
geonameid name region country score
561731 Gay Orenburg Oblast Russia 71.084
527740 Melenki Vladimir Oblast Russia 70.391
1526193 Arkalyk Qostanay Kazakhstan 70.391
q = 'Сталинград'
search(q, k=3, weight_mode='exp', asdict=False)
geonameid name region country score
472757 Volgograd Volgograd Oblast Russia 88.427
1526273 Astana Astana Kazakhstan 74.393
498817 Saint Petersburg St.-Petersburg Russia 72.409
q = 'Berlin'
search(q, k=3, weight_mode='exp', asdict=False, country_selection=None) # runs 10 seconds
geonameid name region country score
2950159 Berlin Berlin Germany 99.084
5164706 North Canton Ohio United States 98.391
2820577 Überlingen Baden-Wurttemberg Germany 90
q = 'Berlin'
search(q, k=3, weight_mode='exp', asdict=False, country_selection=['DE']).to_markdown()  # runs 0.7s!
geonameid name region country score
2950159 Berlin Berlin Germany 99.084
2820577 Überlingen Baden-Wurttemberg Germany 90
2950096 Bernau bei Berlin Brandenburg Germany 89.777

About

Matching city names with the arbitrary query string.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published