0110937ab04f4298f98963bed1de08962d776b24,src/fonduer/features/feature_libs/structural_features.py,,extract_structural_features,#Any#,26

Before Change


                    yield candidate.id, FEATURE_PREFIX + feature, value

        // Binary candidates
        elif len(args) == 2:
            span1, span2 = args
            if span1.sentence.is_structural() or span2.sentence.is_structural():
                for span, prefix in [(span1, "e1_"), (span2, "e2_")]:
                    if span.stable_id not in unary_strlib_feats:
                        unary_strlib_feats[span.stable_id] = set()
                        for feature, value in _strlib_unary_features(span):
                            unary_strlib_feats[span.stable_id].add((feature, value))

                    for feature, value in unary_strlib_feats[span.stable_id]:
                        yield candidate.id, FEATURE_PREFIX + prefix + feature, value

                if candidate.id not in binary_strlib_feats:
                    binary_strlib_feats[candidate.id] = set()
                    for feature, value in _strlib_binary_features(span1, span2):
                        binary_strlib_feats[candidate.id].add((feature, value))

                for feature, value in binary_strlib_feats[candidate.id]:
                    yield candidate.id, FEATURE_PREFIX + feature, value
        else:
            raise NotImplementedError(
                "Only handles unary and binary candidates currently"
            )


def _strlib_unary_features(span: SpanMention) -> Iterator[Tuple[str, int]]:
    Structural-related features for a single span.

After Change


        // Multinary candidates
        else:
            spans = args
            if all([span.sentence.is_structural() for span in spans]):
                for i, span in enumerate(spans):
                    prefix = f"e{i}_"
                    if span.stable_id not in unary_strlib_feats:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: HazyResearch/fonduer
Commit Name: 0110937ab04f4298f98963bed1de08962d776b24
Time: 2020-07-01
Author: wajdikhattel@think-it.io
File Name: src/fonduer/features/feature_libs/structural_features.py
Class Name:
Method Name: extract_structural_features


Project Name: HazyResearch/fonduer
Commit Name: 5ad9ae2b8ae6b55b07e99de924c77112706aa3b7
Time: 2020-07-01
Author: wajdikhattel@think-it.io
File Name: src/fonduer/features/feature_libs/visual_features.py
Class Name:
Method Name: extract_visual_features


Project Name: scikit-learn/scikit-learn
Commit Name: 670b85c9e9cec05210e8596bc1fb9ca66787162f
Time: 2020-04-19
Author: 50599110+lrjball@users.noreply.github.com
File Name: sklearn/compose/_column_transformer.py
Class Name: ColumnTransformer
Method Name: get_feature_names