'Convenience function for parsing either text or vectors of indices.
``vec_type`` is the type of the returned vector if the input is a string.'

def parse(self, txt_or_vec, vec_type=list):

    if (type(txt_or_vec) == str):
        res = self.txt2vec(txt_or_vec, vec_type)
        assert (type(res) == vec_type)
        return res
    else:
        return self.vec2txt(txt_or_vec)
