Python script to help sort terms in a foreign language according to a user-defined criteria