Skip to main content

Wunsen

Wunsen transliterates/transcribes from other languages into Thai.

วุ้นเส้นสามารถทับศัพท์จากภาษาต่างๆ มาเป็นภาษาไทย

Currently support:

  • Japanese (from Hepburn romanization)
  • Korean (from Revised Romanization)
  • Mandarin (from Hanyu Pinyin)
  • Vietnamese (Latin script)

Demo here.

Installation

Requirement:

Python >= 3.7

khanaa

pip install wunsen

Usage

from wunsen import ThapSap

# Japanese
thap_ja = ThapSap('ja')
thap_ja.thap('ohayō')
# => 'โอฮาโย'

# without macron
thap_ja_no_macron = ThapSap('ja', input='Hepburn-no diacritic')
thap_ja_no_macron.thap('ohayou')
# => 'โอฮาโย'

# another transliteration system for Japanese
thap_ja = ThapSap('ja', system='RI35')
thap_ja.thap('ohayō')
# => 'โอะฮะโย'

# Korean
thap_ko = ThapSap('ko')
thap_ko.thap('annyeonghaseyo')
# => 'อันนย็องฮาเซโย'

# Mandarin (Pinyin with tone diacritics is not supported yet.)
thap_zh = ThapSap('zh', system='RI49')
thap_zh.thap('ni3 hao3')
# => 'หนี ห่าว'

thap_zh = ThapSap('zh', system='THC43')
thap_zh.thap('ni3 hao3')
# => 'หนี เห่า'

# Vietnamese
thap_vi = ThapSap('vi')
thap_vi.thap('xin chào')
# => 'ซีน จ่าว'

Transcription/Transliteration System in Wunsen

There might be some differences between Wunsen result and the intended result from the actual system, so please review the results.

  • Japanese =>
    • หลักเกณฑ์การทับศัพท์ภาษาญี่ปุ่น (สำนักงานราชบัณฑิตยสภา พ.ศ. 2561) 'ORS61'
    • หลักเกณฑ์การทับศัพท์ภาษาญี่ปุ่น (ราชบัณฑิตยสถาน พ.ศ. 2535) 'RI35'
  • Korean => หลักเกณฑ์การทับศัพท์ภาษาเกาหลี (ราชบัณฑิตยสถาน พ.ศ. 2555) 'RI55'
  • Mandarin =>
    • หลักเกณฑ์การทับศัพท์ภาษาจีน (ราชบัณฑิตยสถาน พ.ศ. 2549) 'RI49'
    • เกณฑ์การถ่ายทอดเสียงภาษาจีนแมนดารินด้วยอักขรวิธีไทย (คณะกรรมการสืบค้นประวัติศาสตร์ไทยในเอกสารภาษาจีน พ.ศ. 2543) 'THC43'
  • Vietnamese => หลักเกณฑ์การทับศัพท์ภาษาเวียดนาม (ราชบัณฑิตยสถาน พ.ศ. 2555) 'RI55'

Wunsen is not affiliated with proposers of the above transliteration systems.

วุ้นเส้นไม่มีส่วนเกี่ยวข้องกับผู้กำหนดแนวทางการทับศัพท์แต่อย่างใด

Notes

Syllabification Issues

Wunsen might break syllables in incorrect place. You might have to add apostrophe:

thap_ja.thap("honya | hon'ya")
# => "โฮเนีย | ฮงยะ"

thap_ko.thap("waengwaeng, maeum | waeng'waeng, ma'eum")
# => "แว็นกแว็ง, แมอุม | แว็งแว็ง, มาอึม"

Mandarin Tone Sandhi

For Mandarin, both transliteration systems specify that we should apply third tone sandhi rule to the Thai result. Wunsen will automatically apply it, but you can turn it off.

thap_zh_no_sandhi = ThapSap('zh', option={'sandhi': False})
thap_zh_no_sandhi.thap('ni3 hao3')
# => 'หนี่ เห่า' / ni3 hao3

# if we turn it on
thap_zh_with_sandhi = ThapSap('zh', option={'sandhi': True})
thap_zh_with_sandhi.thap('ni3 hao3')
# => 'หนี เห่า' / ni2 hao3

thap_zh_with_sandhi.thap('ni3hao3')
# => 'หนีเห่า' / ni2hao3

# examples from wikipedia
thap_zh_with_sandhi.thap('bao3guan3 hao3')
# => 'เป๋าก๋วน เห่า' / bao2guan2 hao3

thap_zh_with_sandhi.thap('lao3 bao3guan3')
# => 'เหล่า เป๋าก่วน' / lao3 bao2guan3

Wunsen doesn't apply 不 (bù) and 一 (yī) tone rules as they are difficult to recognize in Pinyin.

Japanese long vowels

Although we should transcribe two short vowels from different origins, that are next to each other, as two short vowels (not one long vowel), Wunsen cannot cover this case reliably.

thap_ja.thap("公子 kōshi | 子牛 koushi | 石井 Ishii | ただいま tadaima")
# => "公子 โคชิ | 子牛 โคอูชิ | 石井 อิชิอิ | ただいま ทาไดมะ"
# kōshi, koushi, Ishii are fine but tadaima is ta-dai-ma in Wunsen instead of ta-da-i-ma

thap_ja_no_macron.thap("公子 koushi | 子牛 koushi | 石井 Ishii | ただいま tadaima")
# => "公子 โคชิ | 子牛 โคชิ | 石井 อิชี | ただいま ทาไดมะ"
# they're transcribed as kou-shi | kou-shi | i-shii | ta-dai-ma so they're incorrect except 公子

Spacing in Thai

If we want to follow the actual transcription/transliteration system, in some cases, space between syllables or words might have to be deleted in Thai result.

For example, หลักเกณฑ์การทับศัพท์ภาษาเวียดนาม (ราชบัณฑิตยสถาน พ.ศ. 2555) (Vietnamese system) specifies that space in Vietnamese place names should be deleted, but in personal name, the space should still be there as in Vietnamese.

Because it depends on the situation, Wunsen will leave spacing as it is.

Metadata

Release files for wunsen 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wunsen 0.0.3
File Size Uploaded
wunsen-0.0.3.tar.gz 23.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wunsen 0.0.3
File Interpreter ABI Platform
wunsen-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 44.3 kB

Release files / wunsen-0.0.3.tar.gz

Download URL wunsen-0.0.3.tar.gz
Size 23.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ed3e4846c6b1146d737f91936dec22da7d8cf96e3bc10cfd5dd088d1ed0a6164
BLAKE2b-256 checksum
How to use checksums
114dbc2500510556c4e66ec288e116fa34145cc46a0a52999a33df0181ff7938
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Release files / wunsen-0.0.3-py3-none-any.whl

Download URL wunsen-0.0.3-py3-none-any.whl
Size 21.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5312a8b308dbbbae3b1b258d56d7facf78d54f7620e2fd0d29bb0e5fe6e8f68c
BLAKE2b-256 checksum
How to use checksums
0802992411085e07ea2d306ebf783e8f56da769e005a15ab6d5594a9910a8240
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page