File size: 722 Bytes
eca534f 8360ec7 eca534f 8360ec7 eca534f 8360ec7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
from openfactcheck.core.state import FactCheckerState
from openfactcheck.core.solver import StandardTaskSolver, Solver
@Solver.register("concat_response_generator", "claim_info", "output")
class ConcatResponseRegenerator(StandardTaskSolver):
"""
A solver to concatenate the edited claims into a single document.
"""
def __init__(self, args):
super().__init__(args)
def __call__(self, state: FactCheckerState, *args, **kwargs):
claim_info = state.get(self.input_name)
edited_claims = [v["edited_claims"] for _, v in claim_info.items()]
revised_document = " ".join(edited_claims).strip()
state.set(self.output_name, revised_document)
return True, state
|