code: def clean_whisper_alignments(
      whisper_word_alignments: List[dict],
  ) -> List[dict]:
      """Change required to match gentle's tokenization with Whisper's word alignments"""
  
      processed_words = []
      for word_alignment in whisper_word_alignments:
          if word_alignment.word == "%":
              processed_words.append(
                  word_alignment._replace(word=" percent")
              )
          elif (
              word_alignment.word[0] == "'" and len(processed_words) > 0
          ):
              # eg: "'Or" from ["d", "'Or"]
              processed_words[-1]._replace(
                  word=processed_words[-1].word + word_alignment.word,
                  end=word_alignment.end,
              )
          elif hard_normalize(word_alignment.word) == "":
              # eg: " -"
              continue
          else:
              processed_words.append(word_alignment)
  
      return processed_words
  
file_path: ray/doc/source/serve/doc_code/whisper_example.py
imports: from ray import serve
  import re
  import subprocess
  from typing import List
  import starlette.requests
label_desc: Use image node_id 2 for calling a global function with example usage: clean_whisper_alignments(whisper_word_alignments) and returns: processed_words