Пример #1
0
def sampa2uni(seq):
    """
    Convert sequence in IPA-sampa-format to IPA-unicode.

    Notes
    -----
    This function is based on code taken from Peter Kleiweg
    (http://www.let.rug.nl/~kleiweg/L04/devel/python/xsampa.html).

    """

    result = ''
    tokens = reXS.findall(seq)
    for tok, err in tokens:
        assert not err and tokens
        result += xs[tok]

    return result
Пример #2
0
def sampa2uni(seq):
    """
    Convert sequence in IPA-sampa-format to IPA-unicode.

    Notes
    -----
    This function is based on code taken from Peter Kleiweg
    (http://www.let.rug.nl/~kleiweg/L04/devel/python/xsampa.html).

    """

    result = ''
    tokens = reXS.findall(seq)
    for tok, err in tokens:
        try:
            assert not err and tokens
        except AssertionError:
            raise AssertionError('{0} + {1}'.format(err, tok))
        result += xs[tok]

    return result