def to_dict(self):
    """Translates class into dictionary, excluding unspecified values."""
    scores = {
        "rougeL": self.rouge_L,
        "rouge_1": self.rouge_1,
        "label": f"{self.label}",
    }
    if self.qsim is not None:
      scores["qsim"]: self.qsim
    if self.bleurt is not None:
      scores["bleurt"] = self.bleurt
    return scores
Translates class into dictionary, excluding unspecified values.
language/diffqg/metrics.py