Wenyan: 建议将变量名中汉字罗马化时使用中古汉语拟音

Created on 21 Dec 2019  ·  15Comments  ·  Source: wenyan-lang/wenyan

愚以为使用文言文编程却在编译时用现代汉语拼音转写实在是有违和感,应当使用中古汉语拟音。这里有一个白一平教授的方案:维基百科链接,其中“External Links”内有常用字的转换表格,如“文言”二字的转写为“mjun ngjon”。

chinese-language

Most helpful comment

@frederick-vs-ja 中古更好,文言文虽产自上古,但中古时期一样繁荣,有大量的诗词名篇。语音上兼顾上古和现代读音,读起来更能被大众接受。

All 15 comments

所见略同 #295 作者已经给了回复

所见略同 #295 作者已经给了回复

非也,#295说的是这个语言的英文名称,我这个issue说的是变量名的转写

@Elysion-tcfa I totally agree!

The link you gave me contains a PDF and is not very easy to parse using a program. I'm wondering if you know of a better source (e.g. TXT/JSON)?

If there is easily parsable table, I can replace pinyin with Baxter's transcription in a hot second.

Thank you very much for bringing this up.

我个人意见是文言文是上古汉语时期的产物,用上古汉语拟音似乎会更搭配。但是不知道是否有可用的上古汉语拟音拉丁化方案。

我个人意见是文言文是上古汉语时期的产物,用上古汉语拟音似乎会更搭配。但是不知道是否有可用的上古汉语拟音拉丁化方案。

上古汉语拟音基本是一团浆糊,中古汉语由于有详尽的韵书、方言、日韩越汉字音读的资料作为参考,各家拟音的一致性比较强

@frederick-vs-ja 中古更好,文言文虽产自上古,但中古时期一样繁荣,有大量的诗词名篇。语音上兼顾上古和现代读音,读起来更能被大众接受。

@Elysion-tcfa I totally agree!

The link you gave me contains a PDF and is not very easy to parse using a program. I'm wondering if you know of a better source (e.g. TXT/JSON)?

If there is easily parsable table, I can replace pinyin with Baxter's transcription in a hot second.

Thank you very much for bringing this up.

我可以抽时间弄一份,或者找一下有没有已经做好的方便处理的格式

@Elysion-tcfa That would be very much appreciated!

@frederick-vs-ja If you can provide a table for上古擬音, I'd gladly add that too.

I figure that everyone has a favorite transcription system, and since it is not difficult at all to add new ones, I'll support any of them as long as there is a parse-able resource.

Thanks!

Or better, make it configurable?

@Elysion-tcfa I totally agree!
The link you gave me contains a PDF and is not very easy to parse using a program. I'm wondering if you know of a better source (e.g. TXT/JSON)?
If there is easily parsable table, I can replace pinyin with Baxter's transcription in a hot second.
Thank you very much for bringing this up.

我可以抽时间弄一份,或者找一下有没有已经做好的方便处理的格式

I doubt we have a json or plain text file that machine/program can read. There is no fundamental work done on that part for Chinese studies. Let's start with a more authorative version of middle chinese phonological system (王力、李荣、李方桂、董同龢、罗杰瑞等的中古拟音也许更为学界所接受), and put that into an open-source project by itself.

@Elysion-tcfa I totally agree!
The link you gave me contains a PDF and is not very easy to parse using a program. I'm wondering if you know of a better source (e.g. TXT/JSON)?
If there is easily parsable table, I can replace pinyin with Baxter's transcription in a hot second.
Thank you very much for bringing this up.

我可以抽时间弄一份,或者找一下有没有已经做好的方便处理的格式

I doubt we have a json or plain text file that machine/program can read. There is no fundamental work done on that part for Chinese studies. Let's start with a more authorative version of middle chinese phonological system (王力、李荣、李方桂、董同龢、罗杰瑞等的中古拟音也许更为学界所接受), and put that into an open-source project by itself.

稍微离一下题,我个人觉得这几位的结果似乎偏旧了。而且就此 issue 的目的而言,需要的不是具体拟音,而是中古汉语音位的拉丁字母转写方案。

@LingDong- Hi, I've dumped Baxter's Middle Chinese transcriptions of 7,469 characters and attached them here: mid_chinese.json.zip. They are consolidated into a JSON dictionary with characters as keys and lists of all transcribed pronunciations as values. The main data source is this link, with some missing transcriptions manually filled in using 韻典網. Additionally I've stripped the ' prefix and replaced ɨ with io to make the transcriptions suitable for variable names.

Hi @Elysion-tcfa

Thanks so much for making the database! Now romanization method is selectable on the online IDE (and in code) with Baxter's transcription as an option:

image

If anyone else would like to provide data file for other 擬音 systems, I'd gladly add them as an option too. Thanks!

@LingDong- Thanks very much for adding this feature! I think I can close this issue for now.

無意中搜索時發現了這個串。我推薦一下我寫的兩個工具:《切韻》音系自動推導器《切韻》音系 JavaScript 函式庫。前者是手動由一篇文本生成各家擬音等的工具,後者是用於自動生成的函式庫。

回到本題,若要「变量名中汉字罗马化时使用中古汉语拟音」,我認為古韻羅馬字是較好的選擇。而且以古韻羅馬字寫程序已有成功先例,即上面提到的 韻典網。擷取一段示例程式碼如下:

def get_pairs(self):
  yonh_mux_list = []
  traversed = {}

  for yonh in self.all():
    if yonh.mjeng in traversed: continue
    traversed[yonh.mjeng] = True
    item = {
      'gheh': yonh.gheh,
      'tongx': yonh.tongx,
      'ho': yonh.ho,
      'cio': None,
      'tshyuk': None,
    }

白一平轉寫中使用了加號 +會與程式語言的運算符相衝突(不過上面並未出現此問題,因為使用的是擬音而非轉寫,但是會有非 ASCII 字符 ɨ 的問題。上面的做法是使用 io 替代)。而古韻羅馬字只用到了 26 個英文字母,所以更為實用(且在語言學圈子中也更常用)。

若要將中文轉換為古韻羅馬字,更簡單的方法是使用 Rime 中古全拼輸入法的詞庫,因為詞庫中含多字詞語,能更好地處理多音字的問題。一般只需使用基本的正向最長分詞再轉換即可。

其他擬音或拼音(如 unt 切韻朗讀音、msoeg 擬音)因有較多的非 ASCII 國際音標,在此應該不適用。

Was this page helpful?
0 / 5 - 0 ratings

Related issues

calpa picture calpa  ·  5Comments

Tim1995 picture Tim1995  ·  4Comments

LingDong- picture LingDong-  ·  5Comments

cnwhy picture cnwhy  ·  5Comments

streetartist picture streetartist  ·  5Comments