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: Encodes input text.
  
  :param text: input word or list of words.
  :type text: str or list of str
  
  :return:
      - **token_ids** - ids of tokens.
          range of ids values = [-1, 0, ... , tokens_count].
          -1 is reserved value for unknown chars.
      - **token_positions** - starts and ends of tokens in the input word.
          the start is equal to the end for special tokens (eow, sow). 
  :rtype:
      - tuple(token_ids, token_positions)
      - **token_ids** - *list of token ids (int)*
      - **token_positions** - *list of pairs (int, int)*
docstr_tok: ["Encodes","input","text",".",":","param","text",":","input","word","or","list","of","words",".",":","type","text",":","str","or","list","of","str",":","return",":","-","*","*","token_ids","*","*","-","ids","of","tokens",".","range","of","ids","values","=","[","-1",",","0",",","...",",","tokens_count","]",".","-1","is","reserved","value","for","unknown","chars",".","-","*","*","token_positions","*","*","-","starts","and","ends","of","tokens","in","the","input","word",".","the","start","is","equal","to","the","end","for","special","tokens","(","eow",",","sow",")",".",":","rtype",":","-","tuple","(","token_ids",",","token_positions",")","-","*","*","token_ids","*","*","-","*","list","of","token","ids","(","int",")","*","-","*","*","token_positions","*","*","-","*","list","of","pairs","(","int",",","int",")","*"]
code: def encode(
      self, text: tp.Union[str, tp.List[str]]
  ) -> tp.Tuple[tp.List[int], tp.List[tp.Tuple[int, int]]]:
      """Encodes input text.
  
      :param text: input word or list of words.
      :type text: str or list of str
  
      :return:
          - **token_ids** - ids of tokens.
              range of ids values = [-1, 0, ... , tokens_count].
              -1 is reserved value for unknown chars.
          - **token_positions** - starts and ends of tokens in the input word.
              the start is equal to the end for special tokens (eow, sow).
      :rtype:
          - tuple(token_ids, token_positions)
          - **token_ids** - *list of token ids (int)*
          - **token_positions** - *list of pairs (int, int)*
      """
      if type(text) is str:
          text = [text]
      return self._internal.encode(text)
  
file_path: neoml/NeoML/Python/neoml/BytePairEncoder.py
imports: import neoml.PythonWrapper
  import typing
label_desc: Use image node_id 5 for calling the BytePairEncoder obj's underlying member method code with example usage: obj.encode(text) and returns: self