Exemple #1
0
def run_compare_sgb_and_siy_to_base(fs):
    """[str] -> {utf-8-char:set<lev.Rule>}
    ((sgb <=> base) & (sgb <=> base)) - (map (<=> base) rest)"""
    sgb = fs[2]
    siy = fs[8]
    base = fs[0]
    del fs[8]
    del fs[2]
    del fs[0]  # dangerous but who cares
    outsiders = dct.zipwith(and_, classify(compare(base, sgb)), classify(compare(base, siy)), default=set())
    others = map(compose(classify, cur(compare, base)), fs)
    kws = {"default": set()}
    return dct.zipwith((lambda v, *rest: reduce(sub, rest, v)), outsiders, *others, **kws)
Exemple #2
0
def run_compare_all_to_sgbsiy(fs):
    """[str] -> {utf-8-char:set<lev.Rule>}
    (siy<=>sgb) - (map (base<=>) rest)"""
    sgb = fs[2]
    siy = fs[8]
    base = fs[0]
    del fs[8]
    del fs[2]
    del fs[0]  # dangerous but who cares
    diff = classify(compare(sgb, siy))
    others = map(compose(classify, cur(compare, base)), fs)
    # return dct_mapall(lambda v,*rest: reduce(sub, rest, v), diff, *others)
    kws = {"default": set()}
    return dct.zipwith((lambda v, *rest: reduce(sub, rest, v)), diff, *others, **kws)
Exemple #3
0
def groupavg((c1,c2)):
    "group average"
    return avg(map(compose(edges.__getitem__, frozenset),
                   cross(flatten(c1), flatten(c2))))
Exemple #4
0
def complete((c1,c2)):
    "complete link"
    return max(map(compose(edges.__getitem__, frozenset),
                   cross(flatten(c1), flatten(c2))))
Exemple #5
0
def single((c1,c2)):
    "single link"
    return min(map(compose(edges.__getitem__, frozenset),
                   cross(flatten(c1), flatten(c2))))