예제 #1
0
파일: align.py 프로젝트: sandersn/dialect
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)
예제 #2
0
파일: align.py 프로젝트: sandersn/dialect
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)
예제 #3
0
파일: cluster.py 프로젝트: sandersn/dialect
def groupavg((c1,c2)):
    "group average"
    return avg(map(compose(edges.__getitem__, frozenset),
                   cross(flatten(c1), flatten(c2))))
예제 #4
0
파일: cluster.py 프로젝트: sandersn/dialect
def complete((c1,c2)):
    "complete link"
    return max(map(compose(edges.__getitem__, frozenset),
                   cross(flatten(c1), flatten(c2))))
예제 #5
0
파일: cluster.py 프로젝트: sandersn/dialect
def single((c1,c2)):
    "single link"
    return min(map(compose(edges.__getitem__, frozenset),
                   cross(flatten(c1), flatten(c2))))