Page 1 of 3
Alphabeticising a word list?
Posted: Fri Nov 21, 2025 9:03 am
by richmond62
I have an alphabet (and it really doesn't matter which one it is) that is NOT the English variant of the Latin alphabet (let's call it Ruritanian).
Now I have a load of Ruritanian texts that have been entered into a textField in Unicode-compliant Ruritanian script . . .
Now I want to take each word out of that textField (and, before you ask, word breaks are SPACES) and shove it in a listField, and then . . .
ALPHABETICISE that list according to the alphabetical order of the Ruritanian alphabet.
Obviously SORT will NOT do that.
Re: Alphabeticising a word list?
Posted: Fri Nov 21, 2025 9:09 am
by richmond62
Should this work?
Code: Select all
sort lines of test by customSort(richmondsOrder,each)
The problem is apparently, that richmondsOrder might prove a bit awkward as I am not convinced that:
Code: Select all
put numToCodePoint(2296) & numToCodePoint(2297) & numToCodePoint(2298) into richmondsOrder
is going to "sit nicely".
Re: Alphabeticising a word list?
Posted: Fri Nov 21, 2025 12:41 pm
by Klaus
Please post your function "customSort"!
Maybe take a look at this:
https://lessons.livecode.com/m/2592/l/1 ... ing-a-list

Re: Alphabeticising a word list?
Posted: Fri Nov 21, 2025 2:54 pm
by dunbarx
Richmond.
Klaus implied what you already said, that is, you have to explicitly specify the "order" of "letters" of your alphabet. Then you can create a list of such letters that are paired with a number. Once you have that, then a custom function can sort it.
If this Martian alphabet is entirely your own, then no existing "codePoint" can help.
Craig
Re: Alphabeticising a word list?
Posted: Fri Nov 21, 2025 3:17 pm
by dunbarx
Maybe I misread.
Your alphabet is unicode-based? If so, what is the issue? Is the codePoint order of that alphabet not, er, ordered?
Craig
Re: Alphabeticising a word list?
Posted: Fri Nov 21, 2025 4:19 pm
by SparkOut
It may be as simple as "sort international" but I that is a hope, rather than expectation.
Re: Alphabeticising a word list?
Posted: Fri Nov 21, 2025 5:03 pm
by dunbarx
Sparkout.
It sounds like the alphabet is Elbonian. I do not think they follow ordinary conventions.
Craig
Re: Alphabeticising a word list?
Posted: Fri Nov 21, 2025 5:12 pm
by Klaus
I also exspected something "highly exotic", but looks like this is just a sort of custom font:
http://www.myfont.de/fonts/charmap/2275-Ruritania.html

Re: Alphabeticising a word list?
Posted: Fri Nov 21, 2025 6:09 pm
by dunbarx
Hmmm. I see it.
Richmond, what is your issue?
Craig
Re: Alphabeticising a word list?
Posted: Fri Nov 21, 2025 7:56 pm
by richmond62
If this Martian alphabet is entirely your own, then no existing "codePoint" can help.
No Martian alphabets will get hurt in this exercise, but I could have listed:
Devanagari
Grantha
Bengali
Old Bulgarian Cyrillic
Glagolitic
Gothic
Old Norse
Anglo-Saxon
Ge'ez Amharic
But was attempting some sort of shorthand by using 'Ruritanian'.
Re: Alphabeticising a word list?
Posted: Fri Nov 21, 2025 8:28 pm
by SparkOut
richmond62 wrote: ↑Fri Nov 21, 2025 9:09 am
Should this work?
Code: Select all
sort lines of test by customSort(richmondsOrder,each)
The problem is apparently, that richmondsOrder might prove a bit awkward as I am not convinced that:
Code: Select all
put numToCodePoint(2296) & numToCodePoint(2297) & numToCodePoint(2298) into richmondsOrder
is going to "sit nicely".
That indeed will not "sit nicely".
I think either never mind the custom sort, unless there's something you need to adjust that an international sort won't chew. Or work your custom sort into a function, then call it
Code: Select all
sort lines of test by richmondsOrder(each)
and you'd define a function,
which takes each iteration of the source data element and return "something" as a sorting index for the original sort to work on.
Re: Alphabeticising a word list?
Posted: Fri Nov 21, 2025 9:01 pm
by stam
I'd offer an opinion but I can't say I'm certain I understand what Richmond's ask actually is?
Sort the words?
Sort the words by more than the first char?
Sort the letters within each word?
Sort all the letters of the text into char-soup?
The question that immediately follows is why. Not being facetious, but presumably this is aid of loftier goal, that may be more effectively achieved using other means.
Perhaps if Richmond can expand what he's trying to do and what exactly he wants it might be easier to offer help...
Re: Alphabeticising a word list?
Posted: Fri Nov 21, 2025 9:07 pm
by dunbarx
Richmond.
So Ruritania is an imaginary world derived from three novels starting with "The Prisoner of Zenda".
This means the alphabet does not really exist.
But there is a published imaginary alphabet. Why not simply attach a number to each Rumanian letter, sort those pairs numeric and then strip the numbers?
Craig
Re: Alphabeticising a word list?
Posted: Fri Nov 21, 2025 9:13 pm
by dunbarx
Hey, there is a Ruritainium font, and unicode contains it. For example, "A" is U+0041.
Done. You can sort away.
Craig
Re: Alphabeticising a word list?
Posted: Fri Nov 21, 2025 10:02 pm
by bn
Richmond,
from the dictionary entry for sort container:
Name: sortType
Type: enum
Description:
If you don't specify a sortType, the sortType is text.
• international: sorts by collation according to the system locale
• numeric: sorts by number. (Use this form if the sortKey consists of numbers)
• datetime: treats the sortKey as a date and/or time
• text: sorts using a codepoint by codepoint comparison
• binary: sorts using a byte by byte comparison
So I gave it a try:
No idea what it is saying or if it is working or not. It does sort however.
Kind regards
Bernd