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

Class Annotation

language/diffqg/annotation.py:23–40  ·  view source on GitHub ↗

A single DiffQG annotation, either gold or model-generated.

Source from the content-addressed store, hash-verified

21
22@dataclasses.dataclass
23class Annotation:
24 """A single DiffQG annotation, either gold or model-generated."""
25
26 base_text: str
27 target_text: str
28 answer_span: str
29 question: Optional[str]
30 is_edited: Optional[bool] = None
31
32 def __init__(self, json_dic: Dict[str, Any]) -> None:
33 self.base_text = json_dic["base"]
34 self.target_text = json_dic["target"]
35 self.question = json_dic["q"] if json_dic["q"] else None
36 self.answer_span = json_dic["a"]
37 self.is_edited = json_dic["is_edited"] if "is_edited" in json_dic else None
38
39 def key_annotation(self) -> str:
40 return f"{self.base_text}::{self.target_text}::{self.answer_span}"
41
42
43@dataclasses.dataclass

Callers 1

_read_annotationsFunction · 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…