I have a list of Chinese strings; for example, like this:
list1 = StringPartition[Import["http://text-share.com/view/c652fa55", "Data"][[-1]], 4]
Now I want to sort it according to Chinese alphabetical order.
There are two equivalent ways, but they differ in efficiency.
The faster way is
AlphabeticSort[new, Entity["Language", "ChineseMandarin"]]; // AbsoluteTiming
(*{0.00261, Null}*)
a much slower way is
SortBy[new, Transliterate]; // AbsoluteTiming
(*{0.465786, Null}*)
However, what if my data is like this:
list2 = Transpose[{list1, Range @ Length @ list1}];
I want to sort this list by the Chinese strings in it. SortBy[list2, Transliterate @ #[[1]] &]
is definitely slow. AlphabeticOrder
is also slow:
Sort[list2,
AlphabeticOrder[#1[[1]], #2[[1]],
Entity["Language", "ChineseMandarin"]]>=0 &]; // AbsoluteTiming
(*{0.512303, Null}*)
Is it possible to use AlphabeticSort
to sort an arbitrary list to get maximum efficiency?