class_docstr: TextClassifier handler class. This handler takes a text (string) and
  as input and returns the classification text based on the model vocabulary.
  Because the predefined TextHandler in ts/torch_handler defines unnecessary
  steps like loading a vocabulary file for the tokenizer, we define our handler
  starting from BaseHandler.
class_docstr_tok: ["TextClassifier","handler","class",".","This","handler","takes","a","text","(","string",")","and","as","input","and","returns","the","classification","text","based","on","the","model","vocabulary",".","Because","the","predefined","TextHandler","in","ts\/torch_handler","defines","unnecessary","steps","like","loading","a","vocabulary","file","for","the","tokenizer",",","we","define","our","handler","starting","from","BaseHandler","."]
docstr: Tokenization is dealt with inside the scripted model itself.
  We therefore only apply these basic cleanup operations :
      - remove html tags
      - lowercase all text
  
  Args:
      data (str): The input data is in the form of a string
  
  Returns:
      (Tensor): Text Tensor is returned after perfoming the pre-processing operations
      (str): The raw input is also returned in this function
docstr_tok: ["Tokenization","is","dealt","with","inside","the","scripted","model","itself",".","We","therefore","only","apply","these","basic","cleanup","operations",":","-","remove","html","tags","-","lowercase","all","text","Args",":","data","(","str",")",":","The","input","data","is","in","the","form","of","a","string","Returns",":","(","Tensor",")",":","Text","Tensor","is","returned","after","perfoming","the","pre-processing","operations","(","str",")",":","The","raw","input","is","also","returned","in","this","function"]
code: def preprocess(self, data):
      """
      Tokenization is dealt with inside the scripted model itself.
      We therefore only apply these basic cleanup operations :
          - remove html tags
          - lowercase all text
  
      Args:
          data (str): The input data is in the form of a string
  
      Returns:
          (Tensor): Text Tensor is returned after perfoming the pre-processing operations
          (str): The raw input is also returned in this function
      """
  
      # Compat layer: normally the envelope should just return the data
      # directly, but older versions of Torchserve didn't have envelope.
  
      text_batch = []
      for line in data:
          text = line.get("data") or line.get("body")
          # Decode text if not a str but bytes or bytearray
          if isinstance(text, (bytes, bytearray)):
              text = text.decode("utf-8")
  
          text = remove_html_tags(text)
          text = text.lower()
          text_batch.append(text)
  
      return text_batch
  
file_path: serve/examples/text_classification_with_scriptable_tokenizer/handler.py
imports: import logging
  from abc import ABC
  import torch
  import torch.nn.functional
  import torchtext
  from ts.torch_handler.base_handler import BaseHandler
  from ts.utils.util import CLEANUP_REGEX, map_class_to_label
label_desc: Use image node_id 1 for calling the CustomTextClassifier obj's underlying member method code with example usage: obj.preprocess(data) and returns: text_batch