Wolfram Language

Multilingual Functionality

Group Words by Initial Letters Alphabetically

Take a sample list of 200 Russian words from WordList.

In[1]:=
Click for copyable input
russianWords = RandomSample[WordList[Language -> "Russian"], 200];

Sort them using the alphabetic order of Russian.

In[2]:=
Click for copyable input
russianWords = AlphabeticSort[russianWords, "Russian"];

Build an OpenerView structure with the words grouped by initial letters.

show complete Wolfram Language input
In[3]:=
Click for copyable input
buildOpenerViewerLevelN[words_, n_] := Column[If[Length[#] === 1, #[[1]], Replace[OpenerView[{Row[{Style[StringTake[#[[1]], n], Gray], " (", Length[#], ")"}], buildOpenerViewerLevelN[#, n + 1]}], OpenerView[{_, Column[{x_}]}] :> x]] & /@ SplitBy[words, StringTake[#, UpTo[n]] &]]
In[4]:=
Click for copyable input
buildOpenerViewerLevelN[russianWords, 1]
Out[4]=

Related Examples

de es fr ja ko pt-br ru zh