I did this rereading excercise too - but eventually I think I know what he needs. He has a sorted list of records and he want's to determine what kind of sort was used to sort it.
More precisely he has a definition of a family of sorting functions, and the result of applying one of those functions to some data record. He want's to determine what was that function.
Perhaps he want's an algorithm that given the sorted list would output the definition of the sorting function. | [reply] |
| [reply] |
less is more
Sorry about that - I didn't want to put a hard problem before you without showing that I had at least begun to think about it.
So, given the input in the original posts __DATA__, I'm trying to extract a decleration for use with Sort::ArbBiLex, so that, if the original records lose their ordering, I could resort them.
| [reply] |
I think the problem was more mine than yours. zby managed to work out what you were asking, as evidenced by
Perhaps he want's an algorithm that given the sorted list would output the definition of the sorting function.
But no matter how many times I read it, I didn't get your drift.
However, since then I have given the problem some pretty serious thunking, and I'm really not sure that what your asking is possible. Leastwise, not if your after complete accuracy unless you have a very large sample set that reflects all the possible comparisons. Even then, there is another, trickier problem.
Lets assume somewhere in your dataset you had
cuerno
chile
According to the POD for Sort::ArbBiLex, in a spanish dictionary, cuerno sorts before chile, because the 'ch' in chile, is considered a "single glyph" that sorts after the single glyph 'c' in cuerno.
The problem is, whos to says that there isn't a language where the second glyph in cuerno is 'ue', and that this is designated as sorting before the second glyph in chile, 'h'?
I simply cannot see any mechanistic way of making the determination of when 2 character codes represent a single glyph. It strikes me that the only way to do this is heuristically, and that means that you would have to already know what pairs consituted single glyphs up front.
I don't envy you the problem, but if you do solve it, I'd be very interested to see how you do it.
Good luck:)
Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
| [reply] [d/l] |
I agree. In my original post I mention that the first step would be to get a list of glyphs, which would probably require manual intervention. (Although not in the simple case where all multi-character glyphs are escaped)
But even if the glyphs are known I can't see how to go forward.
I'm also not necessarily trying for a perfect solution.
btw, I take to heart youre less is more comment. I think the problem could have been much more clearly presented, and I will try to do so in the future.
| [reply] |