class_docstr: BytePairEncoder trains byte pair encoding and
  encodes words using trained encoding
class_docstr_tok: ["BytePairEncoder","trains","byte","pair","encoding","and","encodes","words","using","trained","encoding"]
docstr: Trains byte pair encoding.
  
  :param word_dictionary: a collection of words with count of times each word appears in training corpus.
  :type word_dictionary: dict-like of type str : int.
  
  :param vocab_size: maximum number of tokens in the encoder dictionary.
  :type vocab_size: int.
  
  :param use_eow: use special end-of-word token for each word in the word_dictionary
      and for each word that will be encoded after training is completed.
  :type use_eow: bool, default=True.
  
  :param use_sow: use special start-of-word token for each word in the word_dictionary
      and for each word that will be encoded after training is completed.
  :type use_sow: bool, default=False.
  
  :return: BytePairEncoder
docstr_tok: ["Trains","byte","pair","encoding",".",":","param","word_dictionary",":","a","collection","of","words","with","count","of","times","each","word","appears","in","training","corpus",".",":","type","word_dictionary",":","dict-like","of","type","str",":","int",".",":","param","vocab_size",":","maximum","number","of","tokens","in","the","encoder","dictionary",".",":","type","vocab_size",":","int",".",":","param","use_eow",":","use","special","end-of-word","token","for","each","word","in","the","word_dictionary","and","for","each","word","that","will","be","encoded","after","training","is","completed",".",":","type","use_eow",":","bool",",","default=True",".",":","param","use_sow",":","use","special","start-of-word","token","for","each","word","in","the","word_dictionary","and","for","each","word","that","will","be","encoded","after","training","is","completed",".",":","type","use_sow",":","bool",",","default=False",".",":","return",":","BytePairEncoder"]
code: def train(
      cls,
      word_dictionary: tp.Dict[str, int],
      *,
      vocab_size: int,
      use_eow: bool = True,
      use_sow: bool = False,
      use_raw_bytes: bool = False,
      unknown_token_id: int = 0,
  ) -> "BytePairEncoder":
      """Trains byte pair encoding.
  
      :param word_dictionary: a collection of words with count of times each word appears in training corpus.
      :type word_dictionary: dict-like of type str : int.
  
      :param vocab_size: maximum number of tokens in the encoder dictionary.
      :type vocab_size: int.
  
      :param use_eow: use special end-of-word token for each word in the word_dictionary
          and for each word that will be encoded after training is completed.
      :type use_eow: bool, default=True.
  
      :param use_sow: use special start-of-word token for each word in the word_dictionary
          and for each word that will be encoded after training is completed.
      :type use_sow: bool, default=False.
  
      :return: BytePairEncoder
      """
      result = BytePairEncoder(None, eow=None, sow=None)
      result._internal.train(
          word_dictionary,
          vocab_size,
          use_eow,
          use_sow,
          use_raw_bytes,
          unknown_token_id,
      )
      return result
  
file_path: neoml/NeoML/Python/neoml/BytePairEncoder.py
imports: import neoml.PythonWrapper
  import typing
label_desc: Use image node_id 2 for calling the BytePairEncoder obj's underlying member method code with example usage: obj.train(cls, word_dictionary) and returns: result