18ac84177e0905c92b87efa5ba9ad515e125bb0d,estnltk/dividing.py,,lists_collect_spans,#Any#Any#,229

Before Change




def lists_collect_spans(outer_spans, inner_spans):
    spans = [(first(span), last(span)) for span in outer_spans]
    return spans_collect_spans(spans, inner_spans)


def lists_collect_lists(outer_spans, inner_spans):

After Change



def lists_collect_spans(outer_spans, inner_spans):
    mapping = []
    flattened_spans = []
    for idx, spans in enumerate(outer_spans):
        for s in spans:
            flattened_spans.append(s)
            mapping.append(idx)
    flattened_spans, mapping = zip(*sorted(zip(flattened_spans, mapping)))
    flat_bins = list(spans_collect_spans(flattened_spans, inner_spans))
    bins = [[] for _ in range(len(outer_spans))]
    for flatidx, flatbin in enumerate(flat_bins):
        binidx = mapping[flatidx]
        bins[binidx].extend(flatbin)
    for bin in bins:
        yield unique(bin)

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 10

Instances


Project Name: estnltk/estnltk
Commit Name: 18ac84177e0905c92b87efa5ba9ad515e125bb0d
Time: 2015-06-03
Author: tpetmanson@gmail.com
File Name: estnltk/dividing.py
Class Name:
Method Name: lists_collect_spans


Project Name: drckf/paysage
Commit Name: 6a476bb3fd6a51d8a8cbf5299dcc7d6d5ce1ed64
Time: 2017-06-02
Author: austinh@alum.mit.edu
File Name: paysage/models/model.py
Class Name: Model
Method Name: _alternating_update


Project Name: estnltk/estnltk
Commit Name: 18ac84177e0905c92b87efa5ba9ad515e125bb0d
Time: 2015-06-03
Author: tpetmanson@gmail.com
File Name: estnltk/dividing.py
Class Name:
Method Name: lists_collect_lists