code: def replace_wrep(t:str) -> str:
      "Replace word repetitions in `t`."
      def _replace_wrep(m:Collection[str]) -> str:
          c,cc = m.groups()
          return f' {TK_WREP} {len(cc.split())+1} {c} '
      re_wrep = re.compile(r'(\b\w+\W+)(\1{3,})')
      return re_wrep.sub(_replace_wrep, tf replace_wrep(t:str) -> str:
      "Replace word repetitions in `t`."
      def _replace_wrep(m:Collection[str]) -> str:
          c,cc = m.groups()
          return f' {TK_WREP} {len(cc.split())+1} {c} '
      re_wrep = re.compile(r'(\b\w+\W+)(\1{3,})')
      return re_wrep.sub(_replace_wrep, t)
docs: Replace word repetitions in `t`.