code: def encode(self, sentences, output_type=str):
      is_single_sentence = not isinstance(sentences, list)
      if is_single_sentence:
          sentences = [sentences]
      if output_type is str:
          tokens = self._bpe.encode(
              sentences,
              output_type=self._out_type.SUBWORD,
              dropout_prob=self._bpe_dropout,
          )
      elif output_type is int:
          tokens = self._bpe.encode(
              sentences,
              output_type=self._out_type.ID,
              dropout_prob=self._bpe_dropout,
          )
      else:
          raise TokenTypeNotSupportedError(output_type)
      if is_single_sentence:
          return tokens[0]
      else:
          return tokens
  
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 2 for calling the YTTMTokenizer obj's underlying member method code with example usage: obj.encode(sentences, output_type) and returns: tokens, tokens