code: def _preprocess_en(sentence: str) -> str:
      """Preprocess english sentences.
  
      Copied from https://github.com/rwth-i6/ExtendedEditDistance/blob/master/util.py.
  
      Raises:
          ValueError: If input sentence is not of a type `str`.
  
      """
      if not isinstance(sentence, str):
          raise ValueError(
              f"Only strings allowed during preprocessing step, found {type(sentence)} instead"
          )
  
      sentence = sentence.rstrip()  # trailing space, tab, or newline
  
      # Add space before interpunctions
      rules_interpunction = [
          (".", " ."),
          ("!", " !"),
          ("?", " ?"),
          (",", " ,"),
      ]
      for pattern, replacement in rules_interpunction:
          sentence = sentence.replace(pattern, replacement)
  
      rules_re = [
          (r"\s+", r" "),  # get rid of extra spaces
          (r"(\d) ([.,]) (\d)", r"\1\2\3"),  # 0 . 1 -> 0.1
          (
              r"(Dr|Jr|Prof|Rev|Gen|Mr|Mt|Mrs|Ms) .",
              r"\1.",
          ),  # Mr . -> Mr.
      ]
      for pattern, replacement in rules_re:
          sentence = re.sub(pattern, replacement, sentence)
  
      # Add space between abbreviations
      rules_interpunction = [
          ("e . g .", "e.g."),
          ("i . e .", "i.e."),
          ("U . S .", "U.S."),
      ]
      for pattern, replacement in rules_interpunction:
          sentence = sentence.replace(pattern, replacement)
  
      # add space to beginning and end of string
      return " " + sentence + " "
  
file_path: torchmetrics/src/torchmetrics/functional/text/eed.py
imports: import re
  import unicodedata
  from math import inf
  from typing import List, Optional, Sequence, Tuple, Union
  from torch import Tensor, stack, tensor
  from typing_extensions import Literal
  from torchmetrics.functional.text.helper import _validate_inputs
label_desc: Use image node_id 3 for calling a global function with example usage: _preprocess_en(sentence) and returns: unknown