def sequence_to_text(sequence, tp=None):
    'Converts a sequence of IDs back to a string'
    global _id_to_symbol
    if tp:
        (_symbols, _) = make_symbols(**tp)
        _id_to_symbol = {i: s for (i, s) in enumerate(_symbols)}
    result = ''
    for symbol_id in sequence:
        if (symbol_id in _id_to_symbol):
            s = _id_to_symbol[symbol_id]
            if ((len(s) > 1) and (s[0] == '@')):
                s = ('{%s}' % s[1:])
            result += s
    return result.replace('}{', ' ')
Converts a sequence of IDs back to a string
def sequence_to_text(sequence, tp=None):
    
    global _id_to_symbol
    if tp:
        (_symbols, _) = make_symbols(**tp)
        _id_to_symbol = {i: s for (i, s) in enumerate(_symbols)}
    result = 
    for symbol_id in sequence:
        if (symbol_id in _id_to_symbol):
            s = _id_to_symbol[symbol_id]
            if ((len(s) > 1) and (s[0] == '@')):
                s = ('{%s}' % s[1:])
            result += s
    return result.replace('}{', ' ')