BERT_rationale_benchmark/models/pipeline/pipeline_utils.py
def prep(data: List[Annotation]) -> List[Tuple[SentenceEvidence, SentenceEvidence]]:
        """Prepares data for evidence identification and classification.

        Creates paired evaluation data, wherein each (annotation, docid, sentence, kls)
        tuplet appears first as the kls determining if the sentence is evidence, and
        secondarily what the overall classification for the (annotation/docid) pair is.
        This allows selection based on model scores of the evidence_identifier for
        input to the evidence_classifier.
        """
        identification_data = annotations_to_evidence_identification(data, docs)
        classification_data = annotations_to_evidence_classification(data, docs, class_interner, include_all=True)
        ann_doc_sents = defaultdict(lambda: defaultdict(dict))  # ann id -> docid -> sent idx -> sent data
        ret = []
        for sent_ev in classification_data:
            id_data = identification_data[sent_ev.ann_id][sent_ev.docid][sent_ev.index]
            ret.append((id_data, sent_ev))
            assert id_data.ann_id == sent_ev.ann_id
            assert id_data.docid == sent_ev.docid
            assert id_data.index == sent_ev.index
        assert len(ret) == len(classification_data)
        return ret
Prepares data for evidence identification and classification.

        Creates paired evaluation data, wherein each (annotation, docid, sentence, kls)
        tuplet appears first as the kls determining if the sentence is evidence, and
        secondarily what the overall classification for the (annotation/docid) pair is.
        This allows selection based on model scores of the evidence_identifier for
        input to the evidence_classifier.
        
Prepares data for evidence identification and classification.
Creates paired evaluation data, wherein each (annotation, docid, sentence, kls)
tuplet appears first as the kls determining if the sentence is evidence, and
secondarily what the overall classification for the (annotation/docid) pair is.
This allows selection based on model scores of the evidence_identifier for
input to the evidence_classifier.
Prepares data for evidence identification and classification . Creates paired evaluation data wherein each ( annotation docid sentence kls ) tuplet appears first as the kls determining if the sentence is evidence and secondarily what the overall classification for the ( annotation / docid ) pair is . This allows selection based on model scores of the evidence_identifier for input to the evidence_classifier .
def prep(data: List[Annotation]) -> List[Tuple[SentenceEvidence, SentenceEvidence]]:
        identification_data = annotations_to_evidence_identification(data, docs)
        classification_data = annotations_to_evidence_classification(data, docs, class_interner, include_all=True)
        ann_doc_sents = defaultdict(lambda: defaultdict(dict))  
        ret = []
        for sent_ev in classification_data:
            id_data = identification_data[sent_ev.ann_id][sent_ev.docid][sent_ev.index]
            ret.append((id_data, sent_ev))
            assert id_data.ann_id == sent_ev.ann_id
            assert id_data.docid == sent_ev.docid
            assert id_data.index == sent_ev.index
        assert len(ret) == len(classification_data)
        return ret
def prep ( data : List [ Annotation ] ) -> List [ Tuple [ SentenceEvidence , SentenceEvidence ] ] : identification_data = annotations_to_evidence_identification ( data , docs ) classification_data = annotations_to_evidence_classification ( data , docs , class_interner , include_all = True ) ann_doc_sents = defaultdict ( lambda : defaultdict ( dict ) ) ret = [ ] for sent_ev in classification_data : id_data = identification_data [ sent_ev . ann_id ] [ sent_ev . docid ] [ sent_ev . index ] ret . append ( ( id_data , sent_ev ) ) assert id_data . ann_id == sent_ev . ann_id assert id_data . docid == sent_ev . docid assert id_data . index == sent_ev . index assert len ( ret ) == len ( classification_data ) return ret
Prepares data for evidence identification and classification.
Prepares data for evidence identification and classification .
"""Prepares data for evidence identification and classification.

        Creates paired evaluation data, wherein each (annotation, docid, sentence, kls)
        tuplet appears first as the kls determining if the sentence is evidence, and
        secondarily what the overall classification for the (annotation/docid) pair is.
        This allows selection based on model scores of the evidence_identifier for
        input to the evidence_classifier.
        """ # ann id -> docid -> sent idx -> sent data
data
List[Annotation]