def translate(pua, composed=True):
from .encoder import PUAComposedEncoder<EOL>from .encoder import PUADecomposedEncoder<EOL>if composed:<EOL><INDENT>JamoEncoder = PUAComposedEncoder<EOL><DEDENT>else:<EOL><INDENT>JamoEncoder = PUADecomposedEncoder<EOL><DEDENT>encoder = JamoEncoder()<EOL>return encoder.encode(pua, final=True)<EOL>
Convert a unicode string with Hanyang-PUA codes
    to a Syllable-Initial-Peak-Final encoded unicode string.

    :param pua: a unicode string with Hanyang-PUA codes
    :param composed: the result should be composed as possible (default True)
    :return: Syllable-Initial-Peak-Final encoded unicode string