4
$\begingroup$

I want to sort strings of chinese characters. I used to use below code

list={"大家","早上","好"};
AlphabeticSort[list, Entity["Language", "ChineseMandarin"]]

And it worked. But now it returns an error message

AlphabeticSort::nalph: The alphabet Mandarin is not known or not available.

What is wrong? How to work around this?

$\endgroup$
  • $\begingroup$ Unfortunately, under the "Possible issues" for Alphabet (which is used by AlphabeticSort), it shows this issue. Japanese does appear to work - if Chinese also sorts by stroke count, perhaps that's a useful workaround? $\endgroup$ – Carl Lange Apr 17 at 7:38
4
+50
$\begingroup$

The following gives an answer (which I don't know if it is correct, not being able to read Chinese):

AlphabeticSort[list, Entity["Language", "Chinese"]]
(* {"大家", "好", "早上"} *)

I'm not sure why "ChineseMandarin" doesn't work. Could be a bug in the translation layer from langauges to sorting order.

$\endgroup$
  • $\begingroup$ Great, works, Thank you : ) $\endgroup$ – matheorem Apr 21 at 6:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.