class_docstr: Class to translate text in various languages to English.
class_docstr_tok: ["Class","to","translate","text","in","various","languages","to","English","."]
docstr: ```
  Constructor for English translator
  
  Args:
    src_lang(str): language code of source language.
                   Must be one of SUPPORTED_SRC_LANGS:
                     'zh': Chinese (either tradtional or simplified)
                     'ar': Arabic
                     'ru' : Russian
                     'de': German
                     'af': Afrikaans
                     'es': Spanish
                     'fr': French
                     'it': Italian
                     'pt': Portuguese
    device(str): device to use (e.g., 'cuda', 'cpu')
    quantize(bool): If True, use quantization.
  ```
docstr_tok: ["``","`","Constructor","for","English","translator","Args",":","src_lang","(","str",")",":","language","code","of","source","language",".","Must","be","one","of","SUPPORTED_SRC_LANGS",":","'zh","'",":","Chinese","(","either","tradtional","or","simplified",")","'ar","'",":","Arabic","'ru","'",":","Russian","'de","'",":","German","'af","'",":","Afrikaans","'es","'",":","Spanish","'fr","'",":","French","'it","'",":","Italian","'pt","'",":","Portuguese","device","(","str",")",":","device","to","use","(","e.g.",",","'cuda","'",",","'cpu","'",")","quantize","(","bool",")",":","If","True",",","use","quantization",".","``","`"]
code: def __init__(self, src_lang=None, device=None, quantize=False):
      """
      ```
      Constructor for English translator
  
      Args:
        src_lang(str): language code of source language.
                       Must be one of SUPPORTED_SRC_LANGS:
                         'zh': Chinese (either tradtional or simplified)
                         'ar': Arabic
                         'ru' : Russian
                         'de': German
                         'af': Afrikaans
                         'es': Spanish
                         'fr': French
                         'it': Italian
                         'pt': Portuguese
        device(str): device to use (e.g., 'cuda', 'cpu')
        quantize(bool): If True, use quantization.
      ```
      """
  
      if src_lang is None or src_lang not in SUPPORTED_SRC_LANGS:
          raise ValueError(
              "A src_lang must be supplied and be one of: %s"
              % (SUPPORTED_SRC_LANGS)
          )
      self.src_lang = src_lang
      self.translators = []
      if src_lang == "ar":
          self.translators.append(
              Translator(
                  model_name="Helsinki-NLP/opus-mt-ar-en",
                  device=device,
                  quantize=quantize,
              )
          )
      elif src_lang == "ru":
          self.translators.append(
              Translator(
                  model_name="Helsinki-NLP/opus-mt-ru-en",
                  device=device,
                  quantize=quantize,
              )
          )
      elif src_lang == "de":
          self.translators.append(
              Translator(
                  model_name="Helsinki-NLP/opus-mt-de-en",
                  device=device,
                  quantize=quantize,
              )
          )
      elif src_lang == "af":
          self.translators.append(
              Translator(
                  model_name="Helsinki-NLP/opus-mt-af-en",
                  device=device,
                  quantize=quantize,
              )
          )
      elif src_lang in ["es", "fr", "it", "pt"]:
          self.translators.append(
              Translator(
                  model_name="Helsinki-NLP/opus-mt-ROMANCE-en",
                  device=device,
                  quantize=quantize,
              )
          )
      # elif src_lang == 'zh': # could not find zh->en model, so currently doing two-step translation to English via German
      # self.translators.append(Translator(model_name='Helsinki-NLP/opus-mt-ZH-de', device=device))
      # self.translators.append(Translator(model_name='Helsinki-NLP/opus-mt-de-en', device=device))
      elif src_lang == "zh":
          self.translators.append(
              Translator(
                  model_name="Helsinki-NLP/opus-mt-zh-en",
                  device=device,
                  quantize=quantize,
              )
          )
      else:
          raise ValueError(
              "lang:%s is currently not supported." % (src_lang)
          )
  
file_path: ktrain/ktrain/text/translation/core.py
imports: from ...None import utils
  from ...imports import *
  from ...torch_base import TorchBase
  from ..None import textutils
label_desc: Use image node_id 1 to create a new EnglishTranslator object  with example: obj = EnglishTranslator(src_lang, device, quantize)