package hypua2jamo

hypua2jamo.codes2unicode(codes, composed=True)[source]

Convert Hanyang-PUA code iterable to Syllable-Initial-Peak-Final encoded unicode string.

Parameters:
  • codes – an iterable of Hanyang-PUA code

  • composed – the result should be composed as much as possible (default True)

Returns:

Syllable-Initial-Peak-Final encoded unicode string

hypua2jamo.translate(pua, composed=True)[source]

Convert a unicode string with Hanyang-PUA codes to a Syllable-Initial-Peak-Final encoded unicode string.

Parameters:
  • pua – a unicode string with Hanyang-PUA codes

  • composed – the result should be composed as possible (default True)

Returns:

Syllable-Initial-Peak-Final encoded unicode string

hypua2jamo.encoder

class hypua2jamo.encoder.PUAComposedEncoder(errors='strict')[source]

PUA-to-Jamo(composed) encoder

Pure python implementation.

encode(pua_string, final=False)

Encodes input and returns the resulting object.

getstate()

Return the current state of the encoder.

reset()

Resets the encoder to the initial state.

setstate(state)

Set the current state of the encoder. state must have been returned by getstate().

class hypua2jamo.encoder.PUADecomposedEncoder(errors='strict')[source]

PUA-to-Jamo(decomposed) encoder

Pure python implementation.

encode(pua_string, final=False)

Encodes input and returns the resulting object.

getstate()

Return the current state of the encoder.

reset()

Resets the encoder to the initial state.

setstate(state)

Set the current state of the encoder. state must have been returned by getstate().

class hypua2jamo.encoder.JamoDecomposingEncoder(errors='strict')[source]

Jamo(composed)-to-Jamo(decomposed) encoder

Pure python implementation.

encode(pua_string, final=False)

Encodes input and returns the resulting object.

getstate()

Return the current state of the encoder.

reset()

Resets the encoder to the initial state.

setstate(state)

Set the current state of the encoder. state must have been returned by getstate().

hypua2jamo.decoder

class hypua2jamo.decoder.PUAComposedDecoder(errors='strict')[source]

Composed Jamo-to-PUA decoder

Pure python implementation.

decode(jamo_string, final=False)

Decode input and returns the resulting object.

getstate()

Return the current state of the decoder.

This must be a (buffered_input, additional_state_info) tuple. buffered_input must be a bytes object containing bytes that were passed to decode() that have not yet been converted. additional_state_info must be a non-negative integer representing the state of the decoder WITHOUT yet having processed the contents of buffered_input. In the initial state and after reset(), getstate() must return (b””, 0).

reset()

Reset the decoder to the initial state.

setstate(state)

Set the current state of the decoder.

state must have been returned by getstate(). The effect of setstate((b””, 0)) must be equivalent to reset().

class hypua2jamo.decoder.PUADecomposedDecoder(errors='strict')[source]

Decomposed Jamo-to-PUA decoder

Pure python implementation.

decode(jamo_string, final=False)

Decode input and returns the resulting object.

getstate()

Return the current state of the decoder.

This must be a (buffered_input, additional_state_info) tuple. buffered_input must be a bytes object containing bytes that were passed to decode() that have not yet been converted. additional_state_info must be a non-negative integer representing the state of the decoder WITHOUT yet having processed the contents of buffered_input. In the initial state and after reset(), getstate() must return (b””, 0).

reset()

Reset the decoder to the initial state.

setstate(state)

Set the current state of the decoder.

state must have been returned by getstate(). The effect of setstate((b””, 0)) must be equivalent to reset().

class hypua2jamo.decoder.JamoComposingDecoder(errors='strict')[source]

Jamo(decomposed)-to-Jamo(composed) decoder

Pure python implementation.

decode(jamo_string, final=False)

Decode input and returns the resulting object.

getstate()

Return the current state of the decoder.

This must be a (buffered_input, additional_state_info) tuple. buffered_input must be a bytes object containing bytes that were passed to decode() that have not yet been converted. additional_state_info must be a non-negative integer representing the state of the decoder WITHOUT yet having processed the contents of buffered_input. In the initial state and after reset(), getstate() must return (b””, 0).

reset()

Reset the decoder to the initial state.

setstate(state)

Set the current state of the decoder.

state must have been returned by getstate(). The effect of setstate((b””, 0)) must be equivalent to reset().