title: How do I check whether a given string is a valid geographical location or not?
body: <p>I have a list of strings (noun phrases) and I want to filter out all valid geographical locations from them. Most of these (unwanted location names) are country or city or state names. What would be a way to do this? Is there any open-source lookup table available which contains all country, states, cities of the world?</p>
  
  <p>Example desired output:
  <em>TREC4</em>: false,   <em>Vienna</em>: <strong>true</strong>,   <em>Ministry</em>: false,   <em>IBM</em>: false,   <em>Montreal</em>: <strong>true</strong>,   <em>Singapore</em>: <strong>true</strong></p>
  
  <p>Unlike this post: <a href="https://stackoverflow.com/questions/12042452/verify-user-input-location-string-is-a-valid-geographic-location">Verify user input location string is a valid geographic location?</a>
  I have a high number of strings like these (~0.7 million) so <em>google geolocation API</em> is probably not an option for me.</p>