Sorting Cities and Building a Dictionary
In Version 11, it is possible to sort strings using an alphabetic comparison method defined for each language.
For example, get a group of cities from Denmark.
In[1]:=
cityNames =
EntityValue[
GeoEntities[
Entity["AdministrativeDivision", {"Nordjylland", "Denmark"}],
"City"], "Name"];
Now sort these cities using AlphabeticSort but setting the languages separately to Danish and English, to be able to appreciate the differences between them.
In[2]:=
sortedCityNames =
Transpose[{AlphabeticSort[cityNames, "Danish"],
AlphabeticSort[cityNames, "English"]}];
show complete Wolfram Language input
Out[3]=
Create a sorted dictionary translating a random sample of words from Swedish to English.
In[4]:=
words = AlphabeticSort[
RandomSample[WordList[Language -> "Swedish"], 6], "Swedish"];
In[5]:=
sortedTranslations =
AlphabeticSort[#, "English"] & /@
WordTranslation[words, "Swedish" -> "English"];
show complete Wolfram Language input
Out[6]=