def f_lossy(self, program, is_rir):
    """Transforms a single program to its lossy IR."""
    lir_tokens = []
    last_token = None
    for token in program.split():
      if not self._should_anonymize(token, last_token):
        lir_tokens.append(token)
        last_token = token
      else:
        # In this case a repeated "left"/"right" action is encountered, and thus
        # is anonymized.
        lir_tokens.append("I_TURN_DIRECT")
    return " ".join(lir_tokens)
Transforms a single program to its lossy IR.
language/compir/dataset_parsers/scan_parser.py