File size: 787 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
20
21
from openfactcheck.core.state import FactCheckerState
from openfactcheck.core.solver import StandardTaskSolver, Solver

@Solver.register("factool_post_editor", "claim_info", "claim_info")
class FactoolPostEditor(StandardTaskSolver):
    """
    A solver to post-process the results of the Factool model. 
    Used to presents the results in human-readable format and to save the analysis in a JSON file.
    """
    def __init__(self, args):
        super().__init__(args)

    def __call__(self, state: FactCheckerState, *args, **kwargs):
        claim_info = state.get(self.input_name)

        for key, pair in claim_info.items():
            claim_info[key]['edited_claims'] = claim_info[key]['stances'][0]

        state.set(self.output_name, claim_info)
        return True, state