MCPcopy Create free account
hub / github.com/google-research/language / Score

Class Score

language/diffqg/metrics.py:38–62  ·  view source on GitHub ↗

Evaluation of a single example pair.

Source from the content-addressed store, hash-verified

36
37@dataclasses.dataclass
38class Score:
39 """Evaluation of a single example pair."""
40
41 # pylint: disable=invalid-name because L is more readable here.
42 rouge_L: float
43 rouge_1: float
44 label: Label
45 bleurt: Optional[float] = None
46 qsim: Optional[bool] = None
47
48 def to_dict(self):
49 """Translates class into dictionary, excluding unspecified values."""
50 scores = {
51 "rougeL": self.rouge_L,
52 "rouge_1": self.rouge_1,
53 "label": f"{self.label}",
54 }
55 if self.qsim is not None:
56 scores["qsim"]: self.qsim
57 if self.bleurt is not None:
58 scores["bleurt"] = self.bleurt
59 return scores
60
61 def __str__(self):
62 return json.dumps(self.to_dict())
63
64
65@dataclasses.dataclass

Callers 2

score_batchMethod · 0.85
score_pairMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…