class_docstr: Tag that corresponds to a token edit operation.
  
  Attributes:
      tag_type: TagType of the tag.
      added_phrase: A phrase that's inserted before the tagged token (can be
          empty).
class_docstr_tok: ["Tag","that","corresponds","to","a","token","edit","operation",".","Attributes",":","tag_type",":","TagType","of","the","tag",".","added_phrase",":","A","phrase","that","'s","inserted","before","the","tagged","token","(","can","be","empty",")","."]
docstr: Constructs a Tag object by parsing tag to tag_type and added_phrase.
  
  Args:
      tag: String representation for the tag which should have the following
          format "<TagType>|<added_phrase>" or simply "<TagType>" if no phrase
          is added before the tagged token. Examples of valid tags include "KEEP",
          "DELETE|and".
  
  Raises:
      ValueError: If <TagType> is invalid.
docstr_tok: ["Constructs","a","Tag","object","by","parsing","tag","to","tag_type","and","added_phrase",".","Args",":","tag",":","String","representation","for","the","tag","which","should","have","the","following","format","``","<","TagType",">","|","<","added_phrase",">","''","or","simply","``","<","TagType",">","''","if","no","phrase","is","added","before","the","tagged","token",".","Examples","of","valid","tags","include","``","KEEP","''",",","``","DELETE|and","''",".","Raises",":","ValueError",":","If","<","TagType",">","is","invalid","."]
code: def __init__(self, tag: str) -> None:
      """Constructs a Tag object by parsing tag to tag_type and added_phrase.
  
      Args:
          tag: String representation for the tag which should have the following
              format "<TagType>|<added_phrase>" or simply "<TagType>" if no phrase
              is added before the tagged token. Examples of valid tags include "KEEP",
              "DELETE|and".
  
      Raises:
          ValueError: If <TagType> is invalid.
      """
      if "|" in tag:
          pos_pipe = tag.index("|")
          tag_type, added_phrase = tag[:pos_pipe], tag[pos_pipe + 1 :]
      else:
          tag_type, added_phrase = tag, ""
      try:
          self.tag_type = TagType[tag_type]
      except KeyError:
          raise ValueError(
              "TagType should be KEEP or DELETE, not {}".format(
                  tag_type
              )
          )
      self.added_phrase = added_phrase
  
file_path: NeMo/nemo/collections/nlp/data/text_normalization_as_tagging/tagging.py
imports: import re
  from enum import Enum
  from typing import List, Tuple
  import nemo.collections.nlp.data.text_normalization_as_tagging.utils
label_desc: Use image node_id 1 to create a new Tag object from inherited base classes: object with example: obj = Tag(tag)