code: def encode_with_offsets(self, sentences, output_type=str):
      is_multi_sentences = isinstance(sentences, list)
      if not is_multi_sentences:
          sentences = [sentences]
      tokens = []
      token_ids = []
      offsets = []
      for sentence in sentences:
          encode_token = self._bpe.encode(
              [sentence],
              output_type=self._out_type.SUBWORD,
              dropout_prob=self._bpe_dropout,
          )[0]
          encode_id = self._bpe.encode(
              [sentence],
              output_type=self._out_type.ID,
              dropout_prob=self._bpe_dropout,
          )[0]
          encode_token_without_meta_symbol = [
              x.replace(self._meta_symbol, " ") for x in encode_token
          ]
          if len(encode_token_without_meta_symbol) > 0:
              encode_token_without_meta_symbol[
                  0
              ] = encode_token_without_meta_symbol[0].replace(" ", "")
          encode_offset = rebuild_offset_from_tokens(
              sentence, encode_token_without_meta_symbol
          )
          tokens.append(encode_token)
          token_ids.append(encode_id)
          offsets.append(encode_offset)
      if not is_multi_sentences:
          tokens = tokens[0]
          token_ids = token_ids[0]
          offsets = offsets[0]
      if output_type is str:
          return tokens, offsets
      elif output_type is int:
          return token_ids, offsets
      else:
          raise TokenTypeNotSupportedError(output_type)
  
file_path: gluon-nlp/src/gluonnlp/data/tokenizers/yttm.py
imports: from typing import Optional, Tuple, Union, List
  import os
  from .base import *
  from ..vocab import Vocab, load_vocab
  from ...utils.lazy_imports import try_import_yttm
label_desc: Use image node_id 4 for calling the YTTMTokenizer obj's underlying member method code with example usage: obj.encode_with_offsets(sentences, output_type) and returns: tokens,  offsets, token_ids,  offsets