Jaeum Modifier

jaeum_modifier module modifies a single Jaeum of a Hangul syllable among the given Hangul word or sentence.

Examples

Modify a single syllable chosen by an index.

from jaeum_modifier import modify
message = u'안녕하세요'
print(modify(message, index=1, jaeum=u'ㅉ')) # 안쪙하세요

jaeum_modifier.modify replaces Jaeum of the indexed syllable to the given Jaeum(JJ(u'ㅉ')).

Set multiple syallables by the complexity.

from jaeum_modifier import modify_by_complexity
message = u'안녕하세요'
print(modify_by_complexity(message, jaeum=u'ㅉ', complexity=2)) # 안녕짜쩨쬬

By complexity we mean the number of Jamos that is used to make up a syllable. In the example above, we choose all syllables with complexity of 2. Looking at the example message(u'안녕하세요'), we see complexities of 3 3 2 2 2. Thus, only the last three syllables are modified.

Installation

Jaeum Modifier can be installed via pip:

$ pip install jaeum-modifier

You can also install from Github repository:

$ git clone git@github.com:hyunchel/jaeum_modifier.git
$ cd jaeum_modifier
$ python setup.py install

Community

There is no community for this project.

License

jaeum_modifier is under MIT License. For more information, please see LICENSE.

Reference

Interface

jaeum_modifier.modify(target, index, jaeum)

Modify target on index by injecting jaeum.

Parameters:
  • target – a word or sentence composed in Hangul.
  • index – desired index to perform Jaeum injection on.
  • jaeum – a unicode string that should represent Jaeum.
Raise:

exceptions.NoIndexFoundError

Returns:

new unicode string in Hangul with a Jaeum replaced at the specified index.

Return type:

unicode

jaeum_modifier.modify_all(target, jaeum)

Modify all jaeums in the given target to the given jaeum.

Parameters:
  • target – a word or sentence composed in Hangul.
  • jaeum – a unicode string that should represent Jaeum.
Returns:

new unicode string in Hangul with a Jaeum injected.

Return type:

unicode

jaeum_modifier.modify_by_complexity(target, jaeum, complexity)

Set jaeum by complexity.

Parameters:
  • target – a word or sentence composed in Hangul.
  • jaeum – a unicode string that should represent Jaeum.
  • complexity – desired complexity to perform Jaeum injections on.
Raise:

exceptions.NoComplexityFoundError

Returns:

new unicode string in Hangul with Jaeum(s) replaced.

Return type:

unicode

Exceptions

exception jaeum_modifier.InvalidHangulError

Expected Hangul, but failed Hangul test.

exception jaeum_modifier.InvalidJaeumError

Expected Jaeum, but failed Jauem test.

exception jaeum_modifier.NoComplexityFoundError

There is no eumjul with desired complexity.

exception jaeum_modifier.NoIndexFoundError

Specified index runs out of bounds on the given unicode string.

Summary

jaeum_modifier.modify(target, index, jaeum) Modify target on index by injecting jaeum.
jaeum_modifier.modify_all(target, jaeum) Modify all jaeums in the given target to the given jaeum.
jaeum_modifier.modify_by_complexity(target, ...) Set jaeum by complexity.
jaeum_modifier.InvalidHangulError Expected Hangul, but failed Hangul test.
jaeum_modifier.InvalidJaeumError Expected Jaeum, but failed Jauem test.
jaeum_modifier.NoComplexityFoundError There is no eumjul with desired complexity.
jaeum_modifier.NoIndexFoundError Specified index runs out of bounds on the given unicode string.