예제 #1
0
파일: atomicdigits.py 프로젝트: 47-/Cyprium
def decypher_code(code):
    """Yields all possible meanings of a number."""
    ln_w = len(code)
    valid_codes = set(R_MAP.keys())
    for grps in utils.all_groups_in_order(code, (1, 2, 3)):
        grps = tuple(("".join(grp) for grp in grps))
        if set(grps) <= valid_codes:
            yield tuple((R_MAP[e] for e in grps))
예제 #2
0
def decypher_code(code):
    """Yields all possible meanings of a number."""
    ln_w = len(code)
    valid_codes = set(R_MAP.keys())
    for grps in utils.all_groups_in_order(code, (1, 2, 3)):
        grps = tuple(("".join(grp) for grp in grps))
        if set(grps) <= valid_codes:
            yield tuple((R_MAP[e] for e in grps))
예제 #3
0
파일: atomicdigits.py 프로젝트: 47-/Cyprium
def cypher_word(word):
    """Yields all possible cypherings of a word, as tuples
       (codes, factor_crypted).
    """
    ln_w = len(word)
    for grps in utils.all_groups_in_order(word, (1, 2, 3)):
        cyphered = 0
        y = []
        for el in grps:
            el = "".join(el)
            if el in MAP:
                y.append(MAP[el])
                cyphered += len(el)
            else:
                y.append(" ".join(el))
        yield (" ".join(y), cyphered / ln_w)
예제 #4
0
def cypher_word(word):
    """Yields all possible cypherings of a word, as tuples
       (codes, factor_crypted).
    """
    ln_w = len(word)
    for grps in utils.all_groups_in_order(word, (1, 2, 3)):
        cyphered = 0
        y = []
        for el in grps:
            el = "".join(el)
            if el in MAP:
                y.append(MAP[el])
                cyphered += len(el)
            else:
                y.append(" ".join(el))
        yield (" ".join(y), cyphered / ln_w)
예제 #5
0
def cypher_word(word, c_map, c_sep):
    """
    Yields all possible cypherings of a word, as tuples
    (codes, factor_cyphered).
    factor_cyphered = nbr cyphered letters / nbr letters.
    """
    ln_w = len(word)
    for grps in utils.all_groups_in_order(word, (1, 2, 3)):
        cyphered = 0
        y = []
        for el in grps:
            el = "".join(el)
            if el in c_map:
                y.append(c_map[el])
                cyphered += len(el)
            else:
                y.append(c_sep.join(el))
        yield (c_sep.join(y), cyphered / ln_w)
예제 #6
0
파일: morse_wabun.py 프로젝트: 47-/Cyprium
def cypher_word(word, c_map, c_sep):
    """
    Yields all possible cypherings of a word, as tuples
    (codes, factor_cyphered).
    factor_cyphered = nbr cyphered letters / nbr letters.
    """
    ln_w = len(word)
    for grps in utils.all_groups_in_order(word, (1, 2, 3)):
        cyphered = 0
        y = []
        for el in grps:
            el = "".join(el)
            if el in c_map:
                y.append(c_map[el])
                cyphered += len(el)
            else:
                y.append(c_sep.join(el))
        yield (c_sep.join(y), cyphered / ln_w)
예제 #7
0
파일: argots.py 프로젝트: 47-/Cyprium
def cypher_word(word, syllable):
    """
    Yields all possible cypherings of a word, as tuples
    (codes, factor_cyphered).
    factor_cyphered = nbr added syllables / nbr letters.
    """
    ln_w = len(word)
    for grps in utils.all_groups_in_order(word, (1, 2)):
        cyphered = 0
        y = []
        first = True
        for el in grps:
            el = "".join(el)
            cyp = _obfuscate_syllable(el, syllable, first)
            if cyp != el:
                cyphered += 1
            y.append(cyp)
            if first:
                first = False
        yield ("".join(y), cyphered / ln_w)
예제 #8
0
파일: argots.py 프로젝트: underloki/Cyprium
def cypher_word(word, syllable):
    """
    Yields all possible cypherings of a word, as tuples
    (codes, factor_cyphered).
    factor_cyphered = nbr added syllables / nbr letters.
    """
    ln_w = len(word)
    for grps in utils.all_groups_in_order(word, (1, 2)):
        cyphered = 0
        y = []
        first = True
        for el in grps:
            el = "".join(el)
            cyp = _obfuscate_syllable(el, syllable, first)
            if cyp != el:
                cyphered += 1
            y.append(cyp)
            if first:
                first = False
        yield ("".join(y), cyphered / ln_w)