コード例 #1
0
ファイル: mosaic.py プロジェクト: JonathanWexler/olipy
 def make_wmt(cls, alphabet, num_spaces=0):
     if not isinstance(alphabet, basestring):
         alphabet = "".join(alphabet)
     try:
         alphabet = Alphabet.characters(alphabet)
     except KeyError, e:
         pass
コード例 #2
0
ファイル: mosaic.py プロジェクト: BalochiNLP/olipy
 def make_wmt(cls, alphabet, num_spaces=0):
     if not isinstance(alphabet, basestring):
         alphabet = "".join(alphabet)
     try:
         alphabet = Alphabet.characters(alphabet)
     except KeyError, e:
         pass
コード例 #3
0
ファイル: mosaic.py プロジェクト: JonathanWexler/olipy
 def potentials(classmethod):
     """Report on characters that might need to be added to this class."""
     for alphabet in Alphabet.TILABLE_CHARSET_S:
         if isinstance(alphabet, basestring):
             try:
                 alphabet = Alphabet.characters(alphabet)
             except KeyError, e:
                 pass
             if len(alphabet) > 50:
                 continue
             for i in alphabet:
                 if i not in cls.left_right and i not in cls.top_bottom:
                     print i
                 print
コード例 #4
0
ファイル: mosaic.py プロジェクト: charlesreid1/olipy
 def potentials(classmethod):
     """Report on characters that might need to be added to this class."""
     for alphabet in Alphabet.TILABLE_CHARSET_S:
         if isinstance(alphabet, str):
             try:
                 alphabet = Alphabet.characters(alphabet)
             except KeyError as e:
                 pass
             if len(alphabet) > 50:
                 continue
             for i in alphabet:
                 if i not in cls.left_right and i not in cls.top_bottom:
                     print(i)
                 print()
コード例 #5
0
ファイル: mosaic.py プロジェクト: charlesreid1/olipy
    def make_wmt(cls, alphabet, num_spaces=0):
        if not isinstance(alphabet, str):
            alphabet = "".join(alphabet)
        try:
            alphabet = Alphabet.characters(alphabet)
        except KeyError as e:
            pass
        common = uncommon = rare = None

        if len(alphabet) == 1:
            if not num_spaces:
                raise ValueError("Can't make a mosaic from a single character")
            common = alphabet
        elif len(alphabet) == 2:
            common = alphabet
        else:
            common, uncommon, rare = random.sample(alphabet, 3)
        common += "\N{EM SPACE}" * num_spaces
        return (WanderingMonsterTable(common, uncommon, rare),
                SymmetryList(alphabet))