Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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!


Comment on Re^3: Sorting Vietnamese text
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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1068198]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (14)
As of 2014-09-16 20:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (47 votes), past polls