0110937ab04f4298f98963bed1de08962d776b24,src/fonduer/utils/data_model_utils/structural.py,,lowest_common_ancestor_depth,#Any#,187

Before Change


    span2 = _to_span(c[1])
    ancestor1 = np.array(span1.sentence.xpath.split("/"))
    ancestor2 = np.array(span2.sentence.xpath.split("/"))
    min_len = min(ancestor1.size, ancestor2.size)
    return min_len - np.argmin(ancestor1[:min_len] == ancestor2[:min_len])

After Change


    
    spans = [_to_span(i) for i in c]
    ancestors = [np.array(span.sentence.xpath.split("/")) for span in spans]
    min_len = min([a.size for a in ancestors])
    arrays = np.array([a[:min_len] for a in ancestors])
    arg_min = np.argmin(arrays[:-1] == arrays[1:], axis=1)
    val = np.min(arg_min[np.nonzero(arg_min)])
    return min_len - val
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/utils/data_model_utils/structural.py
Class Name:
Method Name: lowest_common_ancestor_depth


Project Name: tensorflow/cleverhans
Commit Name: 4887ef8baecbf5315ec0f235e56a4f93cd05aad7
Time: 2018-10-04
Author: nottombrown@gmail.com
File Name: cleverhans/attacks_tf.py
Class Name:
Method Name: spm


Project Name: scikit-video/scikit-video
Commit Name: c8102caf93b5ef5faa7effbdd581d83c632c0b83
Time: 2016-12-05
Author: tgoodall@utexas.edu
File Name: skvideo/motion/block.py
Class Name:
Method Name: _minCost