class_docstr: Class for creating and setting up fuzzy matchers.
class_docstr_tok: ["Class","for","creating","and","setting","up","fuzzy","matchers","."]
docstr: The TM should be a utf-8 text file with each line
  containing a source sentence and its translation, separated
  by the `self.tm_delimiter`. A TM size of 200k-250k pairs should
  provide enough matches and good performance, but this may
  depend on overall system specs (RAM, CPU)
docstr_tok: ["The","TM","should","be","a","utf-8","text","file","with","each","line","containing","a","source","sentence","and","its","translation",",","separated","by","the","`","self.tm_delimiter","`",".","A","TM","size","of","200k-250k","pairs","should","provide","enough","matches","and","good","performance",",","but","this","may","depend","on","overall","system","specs","(","RAM",",","CPU",")"]
code: def _create_tm(self, tm_path):
      """The TM should be a utf-8 text file with each line
      containing a source sentence and its translation, separated
      by the `self.tm_delimiter`. A TM size of 200k-250k pairs should
      provide enough matches and good performance, but this may
      depend on overall system specs (RAM, CPU)
      """
  
      src_segments, tgt_segments = list(), list()
      with open(tm_path, mode="r", encoding="utf-8") as file:
          pairs = file.readlines()
          for pair in pairs:
              source, target = map(str, pair.split(self.tm_delimiter))
  
              # Filter out very short or very long sentences
              # from the TM for better performance
              if (
                  len(source) < self.tm_unit_min_length
                  or len(source) > self.tm_unit_max_length
              ):
                  continue
              src_segments.append(source.strip())
              tgt_segments.append(target.strip())
      logger.debug(
          f"Translation Memory size for FuzzyMatch transform: "
          f"{len(src_segments)}"
      )
      return [src_segments, tgt_segments]
  
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 2 for calling the FuzzyMatcher obj's underlying member method code with example usage: obj._create_tm(tm_path) and returns: list