e- / Hangul.js

한글 자음/모음 분리/조합 자바스크립트 라이브러리. 자바스크립트 한글 오토마타 구현체입니다.
https://e-.github.io/Hangul.js/examples/
MIT License
694 stars 96 forks source link

Missing Complex Vowels #8

Open roe-ese opened 7 years ago

roe-ese commented 7 years ago

Firstly, I'd like to thank you for putting to together and sharing this fantastic tool.

Hangul.assemble(['ㅅ','ㅓ','ㅣ']); // Results in '서 ㅣ' and not '세'.

This issue concerns the following for 'Hangul.assemble()': 'ㅏ,ㅣ' 'ㅓ,ㅣ' 'ㅗ,ㅏ,ㅣ' 'ㅘ,ㅣ' 'ㅜ,ㅓ,ㅣ' 'ㅝ,ㅣ'

Added these to the 'COMPLEX_VOWELS' array might resolve this issue, however the triplets, e.g. 'ㅜ,ㅓ,ㅣ' might require this array to be completely reformatted. It seems like 'COMPLEX_VOWELS' are only diphthongs and do not accommodate triphthongs.

hangul.js, Line 64 COMPLEX_VOWELS = [ ['ㅏ','ㅣ','ㅐ'], ['ㅓ','ㅣ','ㅔ'], ['ㅗ','ㅏ','ㅘ'], ['ㅗ','ㅐ','ㅙ'], ['ㅘ','ㅣ','ㅙ'], ['ㅗ','ㅣ','ㅚ'], ['ㅜ','ㅓ','ㅝ'], ['ㅜ','ㅔ','ㅞ'], ['ㅝ','ㅣ','ㅞ'], ['ㅜ','ㅣ','ㅟ'], ['ㅡ','ㅣ','ㅢ'] ],

I haven't added ['ㅗ','ㅏ','ㅣ','ㅙ'], [''ㅗ,'ㅓ','ㅣ','ㅞ']

Kindly, James Ro

(노경진)

e- commented 7 years ago

Hello,

As mentioned in the README file, this library strictly follows the assembling rule of KS X 5002 keyboards. In this layout, pressing the 'ㅏ' key followed by the 'ㅣ' key does not produce 'ㅐ' but separated vowels "ㅏㅣ". This is an inconsistent behavior in that pressing the 'ㅜ' and 'ㅣ' keys produces a combined one, 'ㅟ'. I believe it is a design flaw of the layout, but this library also simulates it. You can add such rules for your own purpose but please note that it is not the original purpose of this library. Also, I think adding the triphthong rules will not work.

By the way, I agree that we need a way to support various assembling rules. For example, pressing the 'ㄱ' key twice enters 'ㄲ' in MacOS but "ㄱㄱ" in Windows. This is another ambiguity of the assembling rule. I think we need to first list examples of such ambiguity. Please let me know if you have any idea on this.

roe-ese commented 7 years ago

Could you list all known examples of such ambiguities here? I'd like to understand the problem, and if it extends to something more than just consonant clusters.

roe-ese commented 7 years ago

The assembly rules of KS X 5002 keyboards, as you know, has a few inconsistencies from the actual Hangul orthography. (Other examples of this mentioned in post.) If a Korean person were to sequentially write out 'ㄱ', 'ㅏ', 'ㅣ' it would result in '개' and in KS X 5002 it would result in '가ㅣ', which is unnatural. This is a design flaw in the KS X 5002 keyboards standard, and is inconsistent with the other iotatized diphthongs and triphthongs, 'ㅚ', 'ㅟ', 'ㅢ', etc. The question is, do you want to stick to standards resulting in assembly aberrations or do you want to perfect the rules here? Perhaps we can add two assemble functions, one for KS X 5002 and one for a natural rendering of Hangul.

Another possible issue with the KS X 5002 keyboard is typing initial non-double consonant clusters, e.g. 'ㄼ', 'ㄽ', 'ㄾ', 'ㄿ', 'ㅀ', etc.