The function seems to be intended mainly for city names as inputs, but it may not be able to process every city correctly. The rule doesn't seem to apply to non-city related words, as they mostly return "undefined."