Exemple #1
0
def vec2char_one_hot(vec, vocabularies):
    vecs = split_into_word_and_punctuation(vec, len(vocabularies[1]))
    chars = list()
    chars.append(vec2char(vecs[0], vocabularies[0]))
    extended_punc_voc = [''] + vocabularies[1]
    for vec in vecs[1:]:
        chars.append(vec2char(vec, extended_punc_voc))

    str_list = list()
    if isinstance(chars[0], list):
        for one_repl_chars in zip(*chars):
            str_list.append(''.join(one_repl_chars))
        return str_list
    return ''.join(chars)
 def vec2char(vec, vocabulary):
     return vec2char(vec, vocabulary)