Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re^3: Sorting Vietnamese text

by pdenisowski (Acolyte)
on Dec 23, 2013 at 15:10 UTC ( #1068198=note: print w/replies, xml ) Need Help??

in reply to Re^2: Sorting Vietnamese text
in thread Sorting Vietnamese text

It's still missing a correct 'secondary sort' (for the edge case when the diacritic-stripped words are identical);

(laughs) That's hardly an "edge case" in Vietnamese - there are thousands of minimal pairs where the only difference between the words is the diacritical marks. While it's possible to read and understand Vietnamese typed in (7-bit) ASCII without too much ambiguity (i.e. you can figure out what word is meant from the context), this obviously wouldn't work for a dictionary.

The other issue is that the words in the dictionary need to be sorted in the "correct" order for me to detect duplicates, etc.

I'll try out your suggestion later today - thanks again!

Replies are listed 'Best First'.
Re^4: Sorting Vietnamese text
by Anonymous Monk on Dec 23, 2013 at 18:47 UTC
    I'm probably completely off base here -- why does m số come before m when sorts at the same point as ? And the same question with ỳ ạch and ỷ and the other lines...

    I think there's something wrong with my alphabet -- some characters being eaten perhaps -- since the tr/// has duplicates? If they're wrong, please re-input the correct alphabetical order into the tr/// lines yourself.

    I'm still not sure how spaces play part in all this; I'd sort all the single-character y variants together, and before the two-syllable ones, but the order you've given does not match that and somehow my code handles it handled it even though it shouldn't have.

    You should split the string into two before sorting, though. One part for the actual word, the other for the translation.

    Anyway, here's a try for a correct secondary sort -- of course, I do not have any words to test it on. It sorts how I expect it to do based on what I said in 1068139, but it does not sort how you expect it to.

    Also, why the hell is my tr///d not deleting characters?

Re^4: Sorting Vietnamese text
by Anonymous Monk on Dec 23, 2013 at 19:04 UTC
    Okay -- the alphabet is only 93 characters per the link in 1068127; you had seven characters extra.

    You should clarify what the relation between monosyllables and polysyllables is, and what is the desired collation behaviour between them.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1068198]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (10)
As of 2018-06-21 22:39 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (120 votes). Check out past polls.