class_docstr: Infer features for subword tokenization.
code: def apply(self, example, is_train=False, stats=None, **kwargs):
      if "src_feats" not in example:
          # Do nothing
          return example
  
      if self.reversible_tokenization == "joiner":
          original_src = example["src_original"]
          word_to_subword_mapping = subword_map_by_joiner(
              example["src"], original_subwords=original_src
          )
      else:  # Spacer
          word_to_subword_mapping = subword_map_by_spacer(
              example["src"]
          )
  
      new_src_feats = [[] for _ in range(len(example["src_feats"]))]
      for subword, word_id in zip(
          example["src"], word_to_subword_mapping
      ):
          for i, feat_values in enumerate(example["src_feats"]):
              inferred_feat = feat_values[word_id]
              new_src_feats[i].append(inferred_feat)
      example["src_feats"] = new_src_feats
  
      return example
  
file_path: OpenNMT-py/onmt/transforms/features.py
imports: from onmt.transforms import register_transform
  from .transform import Transform
  from onmt.utils.alignment import subword_map_by_joiner, subword_map_by_spacer
label_desc: Use image node_id 4 for calling the InferFeatsTransform obj's underlying member method code with example usage: obj.apply(example, is_train, stats) and returns: example, example