class_docstr: Perform fuzzy matching against a translation memory and
  augment source examples with target matches for Neural Fuzzy Repair.
  :cite:`bulte-tezcan-2019-neural`
class_docstr_tok: ["Perform","fuzzy","matching","against","a","translation","memory","and","augment","source","examples","with","target","matches","for","Neural","Fuzzy","Repair",".",":","cite",":","`","bulte-tezcan-2019-neural","`"]
code: def batch_apply(self, batch, is_train=False, stats=None, **kwargs):
      src_segments = list()
      for ex, _, _ in batch:
          # Apply a basic filtering to leave out very short or very long
          # sentences and speed up things a bit during fuzzy matching
          if (
              len(" ".join(ex["src"])) > self.fuzzymatch_min_length
              and len(" ".join(ex["src"])) < self.fuzzymatch_max_length
          ):
              src_segments.append(" ".join(ex["src"]))
          else:
              src_segments.append("")
      fuzzied_src = self.matcher._get_batch_matches(src_segments)
      assert len(src_segments) == len(fuzzied_src)
      for idx, (example, _, _) in enumerate(batch):
          if fuzzied_src[idx] != "":
              example["src"] = fuzzied_src[idx].split()
  
      return batch
  
imports: from onmt.utils.logging import logger
  from onmt.transforms import register_transform
  from .transform import Transform
  from rapidfuzz import fuzz, process
  import numpy
  import time
label_desc: Use image node_id 7 for calling the FuzzyMatchTransform obj's underlying member method code with example usage: obj.batch_apply(batch, is_train, stats) and returns: batch