gec_metrics.analysis.attributor.sub module

class gec_metrics.analysis.attributor.sub.AttributorSub(config)[source]

Bases: AttributorBase

generate(src: str, edits: list[Edit] | list[list[Edit]]) list[dict][source]

Generate edited sentence by removing each edit from the reference.

Parameters:
  • src (str) – source sentence.

  • edits (list[errant.edit.Edit]) – Edit to be applied to the source.

Returns:

Each element has two keys:

”sentence”: An edited sentence. “indices”: Indices of edits that were removed from the reference sentence.

Return type:

list[Dict]

post_process(scores: list[float], sent_level_score: float | None = None, indices: list[tuple] | None = None) list[float][source]

Normalize each score by the sum of the scores.

Parameters:
  • scores (list[float]) – delta M() scores.

  • sent_level_score (Optional[float]) – Used when normalization.

  • indices (Optional[list[Tuple]]) – Which edits were applied to the source.

Returns:

Post pocessed scores.

Return type:

list[float]