Ricbit
Ricbit

Reputation: 839

Python lib to return the adjectival form of a Country

I'm looking for a Python library to return the adjectival form of a country. For example, given "Brazil" it would return "Brazilian", given "Greece" it would return "Greek".

If there's no lib like this available, I'll crawl thie wiki page below and make my own, I just don't want to replicate effort in case someone has already done that:

http://en.wikipedia.org/wiki/List_of_adjectival_and_demonymic_forms_of_place_names

Upvotes: 4

Views: 663

Answers (3)

Ricbit
Ricbit

Reputation: 839

In the end I coded my own library for that. It's available on github:

http://code.google.com/p/spojtweet/source/browse/country_demonyms.py

Upvotes: 1

Profane
Profane

Reputation: 1128

Your best bet would be the natural language toolkit, http://www.nltk.org/. One of their data modules called WordNet shows the approximate distance in meaning between words, for example. Assuming it has countries and national adjectives, you could certainly use their api to find what you need.

Upvotes: 1

Mikko Ohtamaa
Mikko Ohtamaa

Reputation: 83818

The is no such lib. The question you are asking is data related and if there were a solution it would be programming language neutral database of names.

Upvotes: 1

Related Questions