9

Early in the history of japanese.SE one user created an enhancement that made it easy for editors to include phonetic spelling with Han characters. It was so popular that Stack Exchange took it and made it a standard feature of the site.

In Japanese you typically add Japanese phonetic script (hiragana and katakana) to characters (known as Kanji in Japanese). This is common not just in material for learners but also for Japanese readers where it will be added just for the the obscure characters that many Japanese might not know how to pronounce. This is known as either "furigana" or "ruby text".

The same thing is not so common in Chinese text, but it's still possible. And since many of us using chinese.SE are learners who find Pinyin less difficult (though still not always easy) than Hanzi, it would still be of benefit.

It does not automatically decide the pinyin for the characters, the editor has to specifically include it using some simple formatting.

The result is that the pinyin would be displayed abover the characters, so easy to ignore for people who can read hanzi well enough. At present we right the hanzi and pinyin next to each other, or in one recent post the editor "interleaved" the characters and pinyin one-by-one, which is not very easy to read.

What do others think?


I've started a topic on the Japanese JL&U so our interested users here can discuss the feature with the users there, and see how it works. Currently it does not "just work" for Pinyin, but we might found out if they can modify it easily to work.

3

5 Answers 5

9

I've hacked together a derivative of the JLU script that should work rudimentarily as a proof-of-concept. You can download it from this pastebin link and install it however you usually install userscripts in your browser. I haven't tested this besides in Chrome, so if it doesn't work in another recent browser, let me know.

Basically, I removed support for okurigana and pitch accent (since, as far as I know, Mandarin doesn't have those things) and added auto-conversion for things like zhong1wen2 to zhōngwén (as Don Kirkby requested). (I also made the regexes a bit more readable - more on that later.)

Structurally, this script behaves like the JLU helper script. You can write things like:

象形字{xiàngxíngzì}
指事字{zhi3shi4zi4}
会[意]{yì}字
假借{jia3jie4}字{zi4}

and if you have the script enabled, these things automagically convert to furigana-style annotations:

how the annotations should look

If you include the pinyin in "numeric" form (like the second and fourth examples above), it will also automatically be segmented so that each syllable is placed above its corresponding character.

Since my knowledge of Chinese orthography is extremely minimal, I need to know some more things in order to improve this:

  1. Can pinyin written in "diacritic" form (like the first and third examples above) be unambiguously broken into syllables (by itself, without reference to the characters)? If so, I can figure out how to implement automatic segmentation for diacritic-form pinyin.
  2. Does this site cover Chinese languages besides Mandarin, and if so, would there be any demand for tonal annotations for other languages? I don't know anything at all about languages besides Mandarin, so I'd need pointers to some basic resources on orthography.
  3. On JLU, there's also support for annotations of the form 神【かみ】 (in addition to square brackets []) because that's how dictionaries do it. Does Chinese have any similar practices that ought to be supported?
  4. On JLU, the following characters behave like punctuation for the purposes of the helper script: .、。--/。<>()\(\)≪≫;;::!!==≡≠≒$¥?\?&##@@“‘”’. Are there any additional punctuation characters for Chinese?
  5. Are there any characters that would require annotation outside the UTF-8 range from U+4E00 to U+FEED? That's what JLU uses, and it seems to cover all common CJK characters, but the CJK Unified Ideographs Extension ranges fall outside that, and I don't know if you folks would need that. (If you're not familiar with Unicode ranges, take a look at this site.)

If this turns out to be useful to you folks, hopefully some friendly SE employee will come by and implement this properly at some point in the future.

9
  • 1
    Beat me to it :) Ah well, I've uploaded my version to gist.github.com/cyphr/7562487 in case any of it's useful.
    – cypher
    Nov 20, 2013 at 13:03
  • Besides not being sure what you mean by "outside the UTF-8 range" this looks great, thanks! (Maybe you just mean that particular Unicode range since UTF-8 is capable of the full Unicode repertoire.) Nov 20, 2013 at 14:52
  • @hippietrail Yes, I mean the part of UTF-8 from U+4E00 to U+FEED. There are apparently some other CJK ideographs that live between U+20000 and U+2FA1F, but I don't know if any of those are of practical use on CLU.
    – senshin
    Nov 20, 2013 at 14:56
  • There is a great regex library for JavaScript called XRegExp that can match han characters perfectly. You don't even have to include the library - you can just use it to generate the regexp and plug that in. Nov 20, 2013 at 15:28
  • 1
    @hippietrail Oh, cool. I'll take a look at that.
    – senshin
    Nov 20, 2013 at 15:31
  • 1
    A few things: there's an ie-specific font-family:"MS Gothic","MS ゴシック" CSS line to make sure Kana displays correctly, but I think it should be removed for Chinese. Also, it might be worth adding support for the fifth tone, so that e.g. 对不起{dui4bu5qi3} would be split one for each character. That's about all I can think of right now, you've done a very good job!
    – cypher
    Nov 20, 2013 at 20:54
  • The pastebin link seems to be blocked by the Great Firewall. Is there another way to try this script in China? Nov 23, 2013 at 17:42
  • @hippietrail Ooh, that's not good. Do either Github or Bitbucket make it through the firewall? Or if not, do you have any other suggestions for text hosting sites? (I'll post a fixed-up version using your and cypher's suggestions in a day or two.)
    – senshin
    Nov 24, 2013 at 7:32
  • @senshin: The main page of both Github and Bitbucket loaded fine for me here in 呼和浩特. Nov 24, 2013 at 10:06
3

A Community Manager has added this to the:

Community Management Team's backlog

There is no ETA on when it will be looked at and/or taken care of, but at least we can be assured that it's not lost in the pile of meta posts.

8
  • 1
    @droooze see above.
    – Mou某 Mod
    Oct 31, 2019 at 6:30
  • Thank you for bringing the community managers on this!
    – dROOOze
    Nov 1, 2019 at 5:05
  • In the meantime, I suggest either Perapera Chinese or Zhongwen Chinese Popup Dictionary for your browser. Or mastering Chinese... that works too.
    – Becky 李蓓 Mod
    Nov 1, 2019 at 10:03
  • @Becky李蓓 For it to be able to be used for Pinyin is useful too, but I want Ruby text implemented for annotation purposes in general, as a comparative linguistics tool.
    – dROOOze
    Nov 1, 2019 at 11:27
  • 1
    It is a bit weird that Japanese.SE has better pinyin support than Chinese.SE.
    – Becky 李蓓 Mod
    Jan 25, 2020 at 6:11
  • 1
    @Becky李蓓 you know what, Anime and Manga StackExchange has better pinyin support than Chinese.SE. I guess some of these things are based on community support: Chinese SE isn't very good at voting.
    – dROOOze
    Jan 27, 2020 at 11:18
  • 1
    I request for this feature request to be escalated: Is the question a feature request that looks like it has community support? Yes!!!
    – Becky 李蓓 Mod
    Mar 14, 2020 at 3:22
  • 3
    @Becky李蓓 I’ve just added the [status-review] tag to the original question.
    – Mou某 Mod
    Mar 14, 2020 at 10:46
2

I think it would be a nice option when you particularly want to discuss the pronunciation of a character, but I wouldn't use it regularly.

To help people visualize what it would look like, I posted an example of pinyin in ruby text at GitHub. If the feature supported converting zhong1wen2 to zhōngwén that would make it easier to use.

1
  • I like this idea more. It's more friendly to less tech-savvy individuals. Dec 4, 2013 at 3:03
2

Thanks to @senshin for drafting up an idea of what the enhancement should look like. I've noted what I think the enhancement should support at Japanese SE Meta (it's easier to demonstrate ruby text there).

Suggestions/corrections welcome.

2

Based on our current roadmap, this isn't work that we will take on, as it doesn't coincide with functional areas that we plan to improve in the near future. We recognize that time and thought was put into this request, but unfortunately, we can't prioritize it at this time.

1
  • 3
    Would you be able to lightly elaborate on the amount of work that needs to be done to Chinese SE for this feature to be implemented, so we can better understand why it would be declined, especially since Japanese SE and Anime SE already have the exact feature we are looking for. I understand that StackExchange has priority roadmaps, but those stack-wide changes are of very low priority for the quality of experience Chinese SE, compared to a feature like this.
    – dROOOze
    Feb 20, 2021 at 10:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .