Module talk:ko-tone

From Wiktionary, the free dictionary
Latest comment: 4 years ago by Karaeng Matoaya
Jump to navigation Jump to search

@Karaeng Matoaya I've made changes to the code, hopefully to make it easier to manage.

  • foobarX actually isn't a preferred variable name, since it isn't descriptive, so I renamed them (hopefully appropriately).
  • I created a new function called tag() that colors text.
    • I moved the details of bold formatting/coloring to Template:ko-tone/style.css, so that when editing this code you only have to think about 'H', not about how 'H corresponds to red'.
  • I converted the syllable-coloring process to use a feature of mw.ustring.gsub() where designated groups of characters can be processed with a one-off function.
    • The carat indicates the beginning of the string.
    • Each set of parentheses (as well as a and b) indicates a group.
    • The period indicates a single character.
      • This should also eliminate the problem regarding "nouns that have multiple instances of the same Hangul block", since 'looking for the character N characters after the beginning of the string' is unambiguous.

I did my best to edit piece by piece and test it each time to reduce mistakes and make it easier to pinpoint sets of changes.

If I made any mistakes, please point them out, and if anything is still unclear, I'll be glad to explain. ^^

It's really cool that we have this data on entries now, and I'm glad that you made this module ^^

Suzukaze-c (talk) 02:50, 28 October 2020 (UTC)Reply

@Suzukaze-c Thanks, this looks great and cleans up a lot of things I was inadequate to handle!! I've tested out a few words and other than the LH_reg thing you just fixed, it all seems to work perfectly.
Eventually (in maybe a few years? maybe in 2030?) this should handle three sets of tones: Busan + Daegu + something from the Hamgyong dialect. Unfortunately it's not easy to find comprehensive data—I have a good dictionary of Busan forms but it marks only the pitch in isolation, so e.g. LH_reg and LH_H aren't distinguished. I'm only a semi-fluent heritage speaker of South Gyeongsang dialect so I've been wary of distinguishing these two based on intuition except for very common words like 고추 (gochu) where I'm 95% sure that this is the correct pitch.
And there's less data for the other two—especially not for the Hamgyong dialect. If we do get around to adding Hamgyong tone we'll probably have to use the pitch accent that Koreans in Yanbian use, given the current state of North Korea.--Karaeng Matoaya (talk) 23:27, 28 October 2020 (UTC)Reply