wunsen-0.0.3
توضیحات
Transliterate/transcribe from other languages into Thai
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | wunsen-0.0.3 |
| نام | wunsen |
| نسخه کتابخانه | 0.0.3 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | - |
| ایمیل نویسنده | cakimpei <cakimpei@gmail.com> |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/wunsen/ |
| مجوز | MIT License Copyright (c) 2022 cakimpei, cakimpei@gmail.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
# 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](https://wunsen.herokuapp.com/).
## Installation
Requirement:
Python >= 3.7
[khanaa](https://github.com/cakimpei/khanaa)
```
pip install wunsen
```
## Usage
```python
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:
```python
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.
```python
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.
```python
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.
نیازمندی
| مقدار | نام |
|---|---|
| - | khanaa>=0.0.6 |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.7 | Python |
نحوه نصب
نصب پکیج whl wunsen-0.0.3:
pip install wunsen-0.0.3.whl
نصب پکیج tar.gz wunsen-0.0.3:
pip install wunsen-0.0.3.tar.gz