开发者

Python lib to return the adjectival form of a Country

I开发者_如何学JAVA'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


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.


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜