def to_lossy(
      self,
      is_rir = False,
      train_examples = None,
      test_examples = None
  ):
    """Transforms examples to their lossy (and maybe also reversible) IR.

    Args:
      is_rir: if True, the input is a reversible IR, in comparison to a program
        in the original formalism.
      train_examples: to be supplied incase is_rir=True, and holds examples in
        their reversible IR.
      test_examples: to be supplied incase is_rir=True, and holds examples in
        their reversible IR.

    Returns:
      A tuple of train and test examples in their lossy IR (and maybe also
      reversible IR).
    """

    def get_lir_examples(examples):
      return [
          Example(example.utterance,
                  self.f_lossy(example.program, is_rir=is_rir))
          for example in examples
      ]

    if not train_examples or not test_examples:
      train_examples, test_examples = self.train_examples, self.test_examples
    return get_lir_examples(train_examples), get_lir_examples(test_examples)
Transforms examples to their lossy (and maybe also reversible) IR.

    Args:
      is_rir: if True, the input is a reversible IR, in comparison to a program
        in the original formalism.
      train_examples: to be supplied incase is_rir=True, and holds examples in
        their reversible IR.
      test_examples: to be supplied incase is_rir=True, and holds examples in
        their reversible IR.

    Returns:
      A tuple of train and test examples in their lossy IR (and maybe also
      reversible IR).
    
language/compir/dataset_parsers/dataset_parser.py