code: def _clean(sentence, subword_option):
      """Clean and handle BPE or SPM outputs."""
      sentence = sentence.strip()
  
      # BPE
      if subword_option == "bpe":
          sentence = re.sub("@@ ", "", sentence)
  
      # SPM
      elif subword_option == "spm":
          sentence = (
              "".join(sentence.split()).replace("\u2581", " ").lstrip()
          )
  
      return sentence
  
file_path: nlp-architect/examples/sparse_gnmt/gnmt/utils/evaluation_utils.py
imports: import codecs
  import os
  import re
  import subprocess
  import tensorflow
  from .None import rouge, bleu
label_desc: Use image node_id 2 for calling a global function with example usage: _clean(sentence, subword_option) and returns: sentence