code: def _src_sentence_with_terms(
      self, source_string, target_string
  ) -> tuple:
      maybe_augmented = source_string.split(self.delimiter)
      source_only = maybe_augmented[0].strip()
      augmented_part = (
          maybe_augmented[1].strip()
          if len(maybe_augmented) > 1
          else None
      )
  
      doc_src = self.src_nlp(source_only)
      doc_tgt = self.tgt_nlp(target_string)
  
      # Perform tokenization with spacy for consistency.
      tokenized_source = [tok.text for tok in doc_src]
      lemmatized_source = [
          "∥".join(tok.lemma_.lower().split()) for tok in doc_src
      ]
      lemmatized_target = [tok.lemma_.lower() for tok in doc_tgt]
  
      lemmatized_source_string = " ".join(lemmatized_source)
  
      offset = 0
      source_with_terms = list()
      term_counter = 0
  
      max_terms_allowed = int(
          len(tokenized_source) * self.term_example_ratio
      )
      is_match = False
      for match_end, (src_entry, tgt_entry) in self.automaton.iter_long(
          lemmatized_source_string
      ):
          if term_counter == max_terms_allowed:
              break
  
          match_start = match_end - len(src_entry) + 1
  
          # We ensure that the target lemma is present in the lemmatized
          # target string, that the match is an exact match (there is
          # whitespace before or after the term)
          # and we perform some bound checking.
          if (
              (
                  tgt_entry.lower()
                  not in " ".join(lemmatized_target).lower()
              )
              or (
                  len(lemmatized_source_string) != match_end + 1
                  and not (
                      lemmatized_source_string[match_end + 1].isspace()
                  )
              )
              or (
                  not lemmatized_source_string[
                      match_start - 1
                  ].isspace()
                  and match_start != 0
              )
          ):
              continue
          else:
              term_counter += 1
  
              # Map the lemmatized string match index to
              # the lemmatized list index
              lemma_list_index = 0
              for i, w in enumerate(lemmatized_source):
                  if lemma_list_index == match_start:
                      lemma_list_index = i
                      break
                  else:
                      lemma_list_index += len(w) + 1
  
              # We need to know if the term is multiword
              num_words_in_src_term = len(src_entry.split())
              src_term = " ".join(
                  tokenized_source[
                      lemma_list_index : lemma_list_index
                      + num_words_in_src_term
                  ]
              ).strip()
  
              # Join multiword target lemmas with a unique separator so
              # we can treat them as single word and not change the indices.
              tgt_term = tgt_entry.replace(" ", "∥").rstrip().lower()
              source_with_terms.append(
                  f"{lemmatized_source_string[offset: match_start]}"
                  f"{self.src_term_stoken}∥{src_term}∥{self.tgt_term_stoken}∥"
                  f"{tgt_term}∥{self.tgt_term_etoken}"
              )
  
              offset = match_end + 1
              is_match = True
  
      if is_match:
          source_with_terms.append(lemmatized_source_string[offset:])
          tokenized_source_with_terms = "".join(
              source_with_terms
          ).split()
  
          if not (
              len(tokenized_source)
              == len(lemmatized_source)
              == len(tokenized_source_with_terms)
          ):
              final_string = " ".join(tokenized_source)
              fixed_punct = re.sub(
                  r" ([^\w\s｟\-\–])", r"\1", final_string
              )
              return fixed_punct.split(), not is_match
  
          # Construct the final source from the lemmatized list
          # that contains the terms. We compare the tokens in the
          # term-augmented lemma list with the tokens in the original
          # lemma list. If the lemma is the same, then we replace with
          # the token from the original tokenized source list. If they
          # are not the same, it means the lemma has been augemented
          # with a term, so we inject this in the final list.
          completed_tokenized_source = list()
          for idx in range(len(tokenized_source_with_terms)):
              # Restore the spaces in multi-word terms
              src_lemma = tokenized_source_with_terms[idx].replace(
                  "∥", " "
              )
              if lemmatized_source[idx].replace("∥", " ") == src_lemma:
                  completed_tokenized_source.append(
                      tokenized_source[idx]
                  )
              else:
                  completed_tokenized_source.append(src_lemma)
  
          if augmented_part is not None:
              final_string = " ".join(
                  completed_tokenized_source
                  + [self.delimiter]
                  + augmented_part.split()
              )
          else:
              final_string = " ".join(completed_tokenized_source)
  
          fixed_punct = re.sub(r" ([^\w\s｟\-\–])", r"\1", final_string)
          return fixed_punct.split(), is_match
      else:
          final_string = " ".join(tokenized_source)
          fixed_punct = re.sub(r" ([^\w\s｟\-\–])", r"\1", final_string)
          return fixed_punct.split(), not is_match
  
imports: from onmt.utils.logging import logger
  from onmt.transforms import register_transform
  from .transform import Transform
  import spacy
  import ahocorasick
  import re
label_desc: Use image node_id 4 for calling the TermMatcher obj's underlying member method code with example usage: obj._src_sentence_with_terms(source_string, target_string) and returns: fixed_punct,  is_match, fixed_punct,  unknown, fixed_punct,  unknown