class_docstr: Class to translate text in various languages to English.
class_docstr_tok: ["Class","to","translate","text","in","various","languages","to","English","."]
docstr: ```
  Translate source document to English.
  To speed up translations, you can set num_beams and early_stopping (e.g., num_beams=4, early_stopping=True).
  
  Args:
    src_text(str): source text. Must be in language specified by src_lang (language code) supplied to constructor
                   The source text can either be a single sentence or an entire document with multiple sentences
                   and paragraphs.
                   IMPORTANT NOTE: Sentences are joined together and fed to model as single batch.
                                   If the input text is very large (e.g., an entire book), you should
                                   break it up into reasonbly-sized chunks (e.g., pages, paragraphs, or sentences) and
                                   feed each chunk separately into translate to avoid out-of-memory issues.
    join_with(str):  list of translated sentences will be delimited with this character.
                     default: each sentence on separate line
    num_beams(int): Number of beams for beam search. Defaults to None.  If None, the transformers library defaults this to 1,
                    whicn means no beam search.
    early_stopping(bool):  Whether to stop the beam search when at least ``num_beams`` sentences
                           are finished per batch or not. Defaults to None.  If None, the transformers library
                           sets this to False.
  Returns:
    str: translated text
  ```
docstr_tok: ["``","`","Translate","source","document","to","English",".","To","speed","up","translations",",","you","can","set","num_beams","and","early_stopping","(","e.g.",",","num_beams=4",",","early_stopping=True",")",".","Args",":","src_text","(","str",")",":","source","text",".","Must","be","in","language","specified","by","src_lang","(","language","code",")","supplied","to","constructor","The","source","text","can","either","be","a","single","sentence","or","an","entire","document","with","multiple","sentences","and","paragraphs",".","IMPORTANT","NOTE",":","Sentences","are","joined","together","and","fed","to","model","as","single","batch",".","If","the","input","text","is","very","large","(","e.g.",",","an","entire","book",")",",","you","should","break","it","up","into","reasonbly-sized","chunks","(","e.g.",",","pages",",","paragraphs",",","or","sentences",")","and","feed","each","chunk","separately","into","translate","to","avoid","out-of-memory","issues",".","join_with","(","str",")",":","list","of","translated","sentences","will","be","delimited","with","this","character",".","default",":","each","sentence","on","separate","line","num_beams","(","int",")",":","Number","of","beams","for","beam","search",".","Defaults","to","None",".","If","None",",","the","transformers","library","defaults","this","to","1",",","whicn","means","no","beam","search",".","early_stopping","(","bool",")",":","Whether","to","stop","the","beam","search","when","at","least","``","num_beams","``","sentences","are","finished","per","batch","or","not",".","Defaults","to","None",".","If","None",",","the","transformers","library","sets","this","to","False",".","Returns",":","str",":","translated","text","``","`"]
code: def translate(
      self, src_text, join_with="\n", num_beams=1, early_stopping=False
  ):
      """
      ```
      Translate source document to English.
      To speed up translations, you can set num_beams and early_stopping (e.g., num_beams=4, early_stopping=True).
  
      Args:
        src_text(str): source text. Must be in language specified by src_lang (language code) supplied to constructor
                       The source text can either be a single sentence or an entire document with multiple sentences
                       and paragraphs.
                       IMPORTANT NOTE: Sentences are joined together and fed to model as single batch.
                                       If the input text is very large (e.g., an entire book), you should
                                       break it up into reasonbly-sized chunks (e.g., pages, paragraphs, or sentences) and
                                       feed each chunk separately into translate to avoid out-of-memory issues.
        join_with(str):  list of translated sentences will be delimited with this character.
                         default: each sentence on separate line
        num_beams(int): Number of beams for beam search. Defaults to None.  If None, the transformers library defaults this to 1,
                        whicn means no beam search.
        early_stopping(bool):  Whether to stop the beam search when at least ``num_beams`` sentences
                               are finished per batch or not. Defaults to None.  If None, the transformers library
                               sets this to False.
      Returns:
        str: translated text
      ```
      """
      text = src_text
      for t in self.translators:
          text = t.translate(
              text,
              join_with=join_with,
              num_beams=num_beams,
              early_stopping=early_stopping,
          )
      return text
  
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 2 for calling the EnglishTranslator obj's underlying member method code with example usage: obj.translate(src_text, join_with, num_beams, early_stopping) and returns: text