def map_ids_to_strs(ids, vocab, join=True, strip_pad='<PAD>', strip_bos='<BOS>', strip_eos='<EOS>', compat=True):
    "Transforms `int` indexes to strings by mapping ids to tokens,\n    concatenating tokens into sentences, and stripping special tokens, etc.\n\n    Args:\n        ids: An n-D numpy array or (possibly nested) list of `int` indexes.\n        vocab: An instance of :class:`~texar.tf.data.Vocab`.\n        join (bool): Whether to concat along the last dimension of the\n            the tokens into a string separated with a space character.\n        strip_pad (str): The PAD token to strip from the strings (i.e., remove\n            the leading and trailing PAD tokens of the strings). Default\n            is '<PAD>' as defined in\n            :class:`~texar.tf.data.SpecialTokens`.PAD.\n            Set to `None` or `False` to disable the stripping.\n        strip_bos (str): The BOS token to strip from the strings (i.e., remove\n            the leading BOS tokens of the strings).\n            Default is '<BOS>' as defined in\n            :class:`~texar.tf.data.SpecialTokens`.BOS.\n            Set to `None` or `False` to disable the stripping.\n        strip_eos (str): The EOS token to strip from the strings (i.e., remove\n            the EOS tokens and all subsequent tokens of the strings).\n            Default is '<EOS>' as defined in\n            :class:`~texar.tf.data.SpecialTokens`.EOS.\n            Set to `None` or `False` to disable the stripping.\n\n    Returns:\n        If :attr:`join` is True, returns a `(n-1)`-D numpy array (or list) of\n        concatenated strings. If :attr:`join` is False, returns an `n`-D numpy\n        array (or list) of str tokens.\n\n    Example:\n\n        .. code-block:: python\n\n            text_ids = [[1, 9, 6, 2, 0, 0], [1, 28, 7, 8, 2, 0]]\n\n            text = map_ids_to_strs(text_ids, data.vocab)\n            # text == ['a sentence', 'parsed from ids']\n\n            text = map_ids_to_strs(\n                text_ids, data.vocab, join=False,\n                strip_pad=None, strip_bos=None, strip_eos=None)\n            # text == [['<BOS>', 'a', 'sentence', '<EOS>', '<PAD>', '<PAD>'],\n            #          ['<BOS>', 'parsed', 'from', 'ids', '<EOS>', '<PAD>']]\n    "
    tokens = vocab.map_ids_to_tokens_py(ids)
    if isinstance(ids, (list, tuple)):
        tokens = tokens.tolist()
    if compat:
        tokens = compat_as_text(tokens)
    str_ = str_join(tokens, compat=False)
    str_ = strip_special_tokens(str_, strip_pad=strip_pad, strip_bos=strip_bos, strip_eos=strip_eos, compat=False)
    if join:
        return str_
    else:
        return _recur_split(str_, ids)
Transforms `int` indexes to strings by mapping ids to tokens,
concatenating tokens into sentences, and stripping special tokens, etc.

Args:
    ids: An n-D numpy array or (possibly nested) list of `int` indexes.
    vocab: An instance of :class:`~texar.tf.data.Vocab`.
    join (bool): Whether to concat along the last dimension of the
        the tokens into a string separated with a space character.
    strip_pad (str): The PAD token to strip from the strings (i.e., remove
        the leading and trailing PAD tokens of the strings). Default
        is '<PAD>' as defined in
        :class:`~texar.tf.data.SpecialTokens`.PAD.
        Set to `None` or `False` to disable the stripping.
    strip_bos (str): The BOS token to strip from the strings (i.e., remove
        the leading BOS tokens of the strings).
        Default is '<BOS>' as defined in
        :class:`~texar.tf.data.SpecialTokens`.BOS.
        Set to `None` or `False` to disable the stripping.
    strip_eos (str): The EOS token to strip from the strings (i.e., remove
        the EOS tokens and all subsequent tokens of the strings).
        Default is '<EOS>' as defined in
        :class:`~texar.tf.data.SpecialTokens`.EOS.
        Set to `None` or `False` to disable the stripping.

Returns:
    If :attr:`join` is True, returns a `(n-1)`-D numpy array (or list) of
    concatenated strings. If :attr:`join` is False, returns an `n`-D numpy
    array (or list) of str tokens.

Example:

    .. code-block:: python

        text_ids = [[1, 9, 6, 2, 0, 0], [1, 28, 7, 8, 2, 0]]

        text = map_ids_to_strs(text_ids, data.vocab)
        # text == ['a sentence', 'parsed from ids']

        text = map_ids_to_strs(
            text_ids, data.vocab, join=False,
            strip_pad=None, strip_bos=None, strip_eos=None)
        # text == [['<BOS>', 'a', 'sentence', '<EOS>', '<PAD>', '<PAD>'],
        #          ['<BOS>', 'parsed', 'from', 'ids', '<EOS>', '<PAD>']]
def map_ids_to_strs(ids, vocab, join=True, strip_pad='<PAD>', strip_bos='<BOS>', strip_eos='<EOS>', compat=True):
    "Transforms `int` indexes to strings by mapping ids to tokens,\n    concatenating tokens into sentences, and stripping special tokens, etc.\n\n    Args:\n        ids: An n-D numpy array or (possibly nested) list of `int` indexes.\n        vocab: An instance of :class:`~texar.tf.data.Vocab`.\n        join (bool): Whether to concat along the last dimension of the\n            the tokens into a string separated with a space character.\n        strip_pad (str): The PAD token to strip from the strings (i.e., remove\n            the leading and trailing PAD tokens of the strings). Default\n            is '<PAD>' as defined in\n            :class:`~texar.tf.data.SpecialTokens`.PAD.\n            Set to `None` or `False` to disable the stripping.\n        strip_bos (str): The BOS token to strip from the strings (i.e., remove\n            the leading BOS tokens of the strings).\n            Default is '<BOS>' as defined in\n            :class:`~texar.tf.data.SpecialTokens`.BOS.\n            Set to `None` or `False` to disable the stripping.\n        strip_eos (str): The EOS token to strip from the strings (i.e., remove\n            the EOS tokens and all subsequent tokens of the strings).\n            Default is '<EOS>' as defined in\n            :class:`~texar.tf.data.SpecialTokens`.EOS.\n            Set to `None` or `False` to disable the stripping.\n\n    Returns:\n        If :attr:`join` is True, returns a `(n-1)`-D numpy array (or list) of\n        concatenated strings. If :attr:`join` is False, returns an `n`-D numpy\n        array (or list) of str tokens.\n\n    Example:\n\n        .. code-block:: python\n\n            text_ids = [[1, 9, 6, 2, 0, 0], [1, 28, 7, 8, 2, 0]]\n\n            text = map_ids_to_strs(text_ids, data.vocab)\n            # text == ['a sentence', 'parsed from ids']\n\n            text = map_ids_to_strs(\n                text_ids, data.vocab, join=False,\n                strip_pad=None, strip_bos=None, strip_eos=None)\n            # text == [['<BOS>', 'a', 'sentence', '<EOS>', '<PAD>', '<PAD>'],\n            #          ['<BOS>', 'parsed', 'from', 'ids', '<EOS>', '<PAD>']]\n    "
    tokens = vocab.map_ids_to_tokens_py(ids)
    if isinstance(ids, (list, tuple)):
        tokens = tokens.tolist()
    if compat:
        tokens = compat_as_text(tokens)
    str_ = str_join(tokens, compat=False)
    str_ = strip_special_tokens(str_, strip_pad=strip_pad, strip_bos=strip_bos, strip_eos=strip_eos, compat=False)
    if join:
        return str_
    else:
        return _recur_split(str_, ids)