class_docstr: Functor for parsing raw strings into list of int tokens.
  
  Examples:
      >>> parser = CharParser(['a', 'b', 'c'])
      >>> parser('abc')
      [0, 1, 2]
class_docstr_tok: ["Functor","for","parsing","raw","strings","into","list","of","int","tokens",".","Examples",":",">",">",">","parser","=","CharParser","(","[","'","a","'",",","'","b","'",",","'","c","'","]",")",">",">",">","parser","(","'abc","'",")","[","0",",","1",",","2","]"]
docstr: Creates simple mapping char parser.
  
  Args:
      labels: List of labels to allocate indexes for. Essentially,
          this is a id to str mapping.
      unk_id: Index to choose for OOV words (default: -1).
      blank_id: Index to filter out from final list of tokens
          (default: -1).
      do_normalize: True if apply normalization step before tokenizing
          (default: True).
      do_lowercase: True if apply lowercasing at normalizing step
          (default: True).
docstr_tok: ["Creates","simple","mapping","char","parser",".","Args",":","labels",":","List","of","labels","to","allocate","indexes","for",".","Essentially",",","this","is","a","id","to","str","mapping",".","unk_id",":","Index","to","choose","for","OOV","words","(","default",":","-1",")",".","blank_id",":","Index","to","filter","out","from","final","list","of","tokens","(","default",":","-1",")",".","do_normalize",":","True","if","apply","normalization","step","before","tokenizing","(","default",":","True",")",".","do_lowercase",":","True","if","apply","lowercasing","at","normalizing","step","(","default",":","True",")","."]
code: def __init__(
      self,
      labels: List[str],
      *,
      unk_id: int = -1,
      blank_id: int = -1,
      do_normalize: bool = True,
      do_lowercase: bool = True,
      do_tokenize: bool = True,
  ):
      """Creates simple mapping char parser.
  
      Args:
          labels: List of labels to allocate indexes for. Essentially,
              this is a id to str mapping.
          unk_id: Index to choose for OOV words (default: -1).
          blank_id: Index to filter out from final list of tokens
              (default: -1).
          do_normalize: True if apply normalization step before tokenizing
              (default: True).
          do_lowercase: True if apply lowercasing at normalizing step
              (default: True).
      """
  
      self._labels = labels
      self._unk_id = unk_id
      self._blank_id = blank_id
      self._do_normalize = do_normalize
      self._do_lowercase = do_lowercase
      self._do_tokenize = do_tokenize
  
      self._labels_map = {
          label: index for index, label in enumerate(labels)
      }
      self._special_labels = set(
          [label for label in labels if len(label) > 1]
      )
  
file_path: NeMo/nemo/collections/common/parts/preprocessing/parsers.py
imports: import string
  from typing import List, Optional
  from nemo.collections.common.parts.preprocessing import cleaners
label_desc: Use image node_id 1 to create a new CharParser object  with example: obj = CharParser(labels)