def replaceItem(full_str, p_match, rep_str):

    if 1 > len( p_match.split() ):   # If p_match has just more than element, replace it directly
        return full_str.replace(p_match, rep_str, 1)
    else:   # else, iterate over the elements in full_str to find p_match to replace it with rep_str
        tmpLst = []
        for tok in full_str.split():
            if tok == p_match:
                tmpLst.append(rep_str)
            else:
                tmpLst.append(tok)
        return ' '.join(tmpLst)
dataset/ETHPy150Open sfu-natlang/Kriya/src/Kriya-Grammar-Xtrctr/SCFGXtractor_ph1.py/replaceItem/swapped operands of `>`