class_docstr: Apply the Moses Tokenizer/Detokenizer implemented in
   [sacremoses](https://github.com/alvations/sacremoses).
  
  .. note::
      sacremoses carries an LGPL 2.1+ license.
  
  Parameters
  ----------
  lang
      The language of the input.
class_docstr_tok: ["Apply","the","Moses","Tokenizer\/Detokenizer","implemented","in","[","sacremoses","]","(","https",":","\/\/github.com\/alvations\/sacremoses",")",".","..","note",":",":","sacremoses","carries","an","LGPL","2.1+","license",".","Parameters","--","--","--","--","--","lang","The","language","of","the","input","."]
code: def __init__(self, lang: str = "en", vocab: Optional[Vocab] = None):
      self._lang = lang
      self._vocab = vocab
      if lang == "zh":
          warnings.warn(
              "You may not use MosesTokenizer for Chinese sentences because it is "
              "not accurate. Try to use JiebaTokenizer. You may also tokenize the "
              "chinese sentence to characters and learn a BPE."
          )
      self._tokenizer = sacremoses.MosesTokenizer(lang=lang)
      self._detokenizer = sacremoses.MosesDetokenizer(lang=lang)
  
      # Here, we need to warm-up the tokenizer to compile the regex
      # This will boost the performance in MacOS
      # For benchmarking results, see
      # https://gist.github.com/sxjscience/f59d2b88262fefd4fb08565c9dec6099
      self._warmup()
  
file_path: gluon-nlp/src/gluonnlp/data/tokenizers/moses.py
imports: from typing import Optional
  import warnings
  import sacremoses
  from .base import TOKENIZER_REGISTRY, BaseTokenizerWithVocab, TokenizerEncodeWithoutVocabError, TokenizerDecodeWithoutVocabError, TokenTypeNotSupportedError, is_tokens_from_multiple_sentences, get_token_type
  from ..vocab import Vocab
label_desc: Use image node_id 1 to create a new MosesTokenizer object from inherited base classes: BaseTokenizerWithVocab with example: obj = MosesTokenizer(lang, vocab)