234698b07ab372738686e3d3de6ab8f08b1a7057,nala/learning/taggers.py,RelationshipExtractionGeneMutation,tag,#RelationshipExtractionGeneMutation#Any#,135

Before Change


        super().__init__(predicts_classes)

    def tag(self, dataset):
        for docid, doc in dataset.documents.items():
            for partid, part in doc.parts.items():
                for ann in part.annotations:
                    if ann.class_id == MUT_CLASS_ID:
                        for ann2 in part.annotations:
                            if ann2.class_id == PRO_CLASS_ID:
                                try:
                                    // here happens the magic
                                    // atm: if in same sentence is the only condition
                                    if part.return_sentence_nr(ann.offset) == part.return_sentence_nr(ann2.offset):
                                        part.relations.append(
                                            Relation(ann.offset, ann2.offset, ann.text, ann2.text, PRO_REL_MUT_CLASS_ID))
                                except IndexError:
                                    pass

    def tag_2(self, dataset):
        from itertools import product
        for part in dataset.parts():
            for ann_1, ann_2 in product(

After Change


        from itertools import product
        for part in dataset.parts():
            for ann_1, ann_2 in product(
                    (ann for ann in part.annotations if ann.class_id == MUT_CLASS_ID),
                    (ann for ann in part.annotations if ann.class_id == PRO_CLASS_ID)):
                if part.get_sentence_index_for_annotation(ann_1) == part.get_sentence_index_for_annotation(ann_2):
                    part.relations.append(
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 7

Instances


Project Name: Rostlab/nalaf
Commit Name: 234698b07ab372738686e3d3de6ab8f08b1a7057
Time: 2015-10-06
Author: carsten.uhlig@gmail.com
File Name: nala/learning/taggers.py
Class Name: RelationshipExtractionGeneMutation
Method Name: tag


Project Name: quantumlib/Cirq
Commit Name: 010580845043ef751687b0ab34f694939a2fa4f5
Time: 2020-09-17
Author: kevinjefferysung@gmail.com
File Name: cirq/study/sweepable.py
Class Name:
Method Name: to_sweeps


Project Name: KhronosGroup/NNEF-Tools
Commit Name: 62b38fec099eb8a94c61fa032d05b305a9b7984f
Time: 2019-02-26
Author: tamas.danyluk@aimotive.com
File Name: parser/cpp/python/nnef.py
Class Name:
Method Name: format_invocation


Project Name: matplotlib/matplotlib
Commit Name: 34b8eb46e5de6b760bc131e461755042716e259d
Time: 2018-02-07
Author: story645@gmail.com
File Name: lib/matplotlib/category.py
Class Name: StrCategoryConverter
Method Name: convert