code: def batch_apply(self, batch, is_train=False, stats=None, **kwargs):
      bucket_size = len(batch)
      examples_with_tags = 0
  
      for i, (ex, _, _) in enumerate(batch):
          # Skip half examples to speed up the transform. This sets
          # a hard limit of 0.5 to the `tags_corpus_ratio`, which is
          # excessive and should be avoided anyway.
          if i % 2 == 0:
              original_src = ex["src"]
              original_tgt = ex["tgt"]
              augmented_example, is_match = self.apply(
                  ex, is_train, stats, **kwargs
              )
              if is_match and (
                  examples_with_tags
                  < bucket_size * self.tags_corpus_ratio
              ):
                  examples_with_tags += 1
                  ex["src"] = augmented_example["src"]
                  ex["tgt"] = augmented_example["tgt"]
              else:
                  ex["src"] = original_src
                  ex["tgt"] = original_tgt
  
      logger.debug(
          f"Added tags to {examples_with_tags}/{bucket_size} examples"
      )
      return batch
  
imports: from onmt.utils.logging import logger
  from onmt.transforms import register_transform
  from .transform import Transform
  import random
  import ahocorasick
  import string
label_desc: Use image node_id 6 for calling the InlineTagsTransform obj's underlying member method code with example usage: obj.batch_apply(batch, is_train, stats) and returns: batch