def iterateInitPhrPairs(sphr_len, (s_span, t_span)):
    global tot_rules_derived
    global ppairRulesSet
    for sub_phr_slen in xrange(1-sphr_len, 0, -1):
        if not sentInitDoD.has_key(sub_phr_slen): continue

        for sub_phr_pair in sentInitDoD[sub_phr_slen].keys():
            # Process the rule further only if its span is compatible to that of the target rule
            subSpanTuple = sentInitDoD[sub_phr_slen][sub_phr_pair]

            # Check constraint-2: The given phrases are sub-phrases of source and target spans
            src_side_compatible = checkRuleCompatibility(s_span, sub_phr_pair[0])
            tgt_side_compatible = checkRuleCompatibility(t_span, sub_phr_pair[1])
            if src_side_compatible and tgt_side_compatible:
                sub_s_span, sub_t_span = sub_phr_pair

                # If the sub spans are compatible with the given src & tgt spans then,
                # compose the new rule. If the new rule satisfies filtering constraints then,
                # it is added to the ppairRulesSet towards count
                rule = checkConstraints(s_span, t_span, sub_s_span, sub_t_span)
                if rule is not None:
                    ppairRulesSet.add(rule)

                # Count all the rules derived so far, including those not satisfying filtering constraints
                tot_rules_derived += 1
dataset/ETHPy150Open sfu-natlang/Kriya/src/Kriya-Grammar-Xtrctr/SCFGXtractor_ph1.py/iterateInitPhrPairs/swapped operands of `-`