amachine.am_vocabulary API documentation

# amachine.am_vocabulary

View Source

     1class Vocabulary :
     2
     3	symbols = {
     4	    "letters_lower" : [chr(i) for i in range(97, 123)],
     5	    "letters_upper" : [chr(i) for i in range(65, 91)],
     6	    "digits"        : [chr(i) for i in range(48, 58)],
     7	    "punctuation"   : [chr(i) for i in [33,44,45,46,58,59,63,39,34]],
     8	    "brackets"      : [chr(i) for i in [40,41,91,93,123,125, 60,62]],
     9	    "math"          : [chr(i) for i in [43,45,42,47,61,37, 94,126]],
    10	    "special"       : [chr(i) for i in [33,35,36,38,64,95]],
    11	    "whitespace"    : [chr(i) for i in [32, 9, 10]],
    12	    "greek_upper"   : [chr(i) for i in range(0x0391, 0x03A5) if i != 0x03A2][:19],
    13	    "greek_lower"   : [chr(i) for i in range(0x03B1, 0x03C5) if i != 0x03C2][:19],
    14	    "geometric"     : [chr(i) for i in range(0x25A0, 0x2600)],
    15	}
    16
    17	@staticmethod
    18	def _get( pool : str, n : int ) -> list[str] :
    19	    symbols = amVocabulary.symbols[ pool ]
    20	    if n > len( symbols ) :
    21	        raise ValueError( f"Requested {n} symbols from '{pool}' but only {len(symbols)} available" )
    22	    return symbols[ :n ]
    23
    24	@staticmethod
    25	def letters_lower( n : int ) -> list[str] : return amVocabulary._get( 'letters_lower', n )
    26	@staticmethod
    27	def letters_upper( n : int ) -> list[str] : return amVocabulary._get( 'letters_upper', n )
    28	@staticmethod
    29	def digits( n : int ) -> list[str] :        return amVocabulary._get( 'digits', n )
    30	@staticmethod
    31	def punctuation( n : int ) -> list[str] :   return amVocabulary._get( 'punctuation', n )
    32	@staticmethod
    33	def brackets( n : int ) -> list[str] :      return amVocabulary._get( 'brackets', n )
    34	@staticmethod
    35	def math( n : int ) -> list[str] :          return amVocabulary._get( 'math', n )
    36	@staticmethod
    37	def special( n : int ) -> list[str] :       return amVocabulary._get( 'special', n )
    38	@staticmethod
    39	def whitespace( n : int ) -> list[str] :    return amVocabulary._get( 'whitespace', n )
    40	@staticmethod
    41	def greek_upper( n : int ) -> list[str] :   return amVocabulary._get( 'greek_upper', n )
    42	@staticmethod
    43	def greek_lower( n : int ) -> list[str] :   return amVocabulary._get( 'greek_lower', n )
    44	@staticmethod
    45	def geometric( n : int ) -> list[str] :     return amVocabulary._get( 'geometric', n )
    46
    47	@staticmethod
    48	def num_letters_lower() -> int : return len( amVocabulary.symbols[ 'letters_lower' ] )
    49	@staticmethod
    50	def num_letters_upper() -> int : return len( amVocabulary.symbols[ 'letters_upper' ] )
    51	@staticmethod
    52	def num_digits() -> int :        return len( amVocabulary.symbols[ 'digits' ] )
    53	@staticmethod
    54	def num_punctuation() -> int :   return len( amVocabulary.symbols[ 'punctuation' ] )
    55	@staticmethod
    56	def num_brackets() -> int :      return len( amVocabulary.symbols[ 'brackets' ] )
    57	@staticmethod
    58	def num_math() -> int :          return len( amVocabulary.symbols[ 'math' ] )
    59	@staticmethod
    60	def num_special() -> int :       return len( amVocabulary.symbols[ 'special' ] )
    61	@staticmethod
    62	def num_whitespace() -> int :    return len( amVocabulary.symbols[ 'whitespace' ] )
    63	@staticmethod
    64	def num_greek_upper() -> int :   return len( amVocabulary.symbols[ 'greek_upper' ] )
    65	@staticmethod
    66	def num_greek_lower() -> int :   return len( amVocabulary.symbols[ 'greek_lower' ] )
    67	@staticmethod
    68	def num_geometric() -> int :     return len( amVocabulary.symbols[ 'geometric' ] )

class Vocabulary: View Source

     3class Vocabulary :
     4
     5	symbols = {
     6	    "letters_lower" : [chr(i) for i in range(97, 123)],
     7	    "letters_upper" : [chr(i) for i in range(65, 91)],
     8	    "digits"        : [chr(i) for i in range(48, 58)],
     9	    "punctuation"   : [chr(i) for i in [33,44,45,46,58,59,63,39,34]],
    10	    "brackets"      : [chr(i) for i in [40,41,91,93,123,125, 60,62]],
    11	    "math"          : [chr(i) for i in [43,45,42,47,61,37, 94,126]],
    12	    "special"       : [chr(i) for i in [33,35,36,38,64,95]],
    13	    "whitespace"    : [chr(i) for i in [32, 9, 10]],
    14	    "greek_upper"   : [chr(i) for i in range(0x0391, 0x03A5) if i != 0x03A2][:19],
    15	    "greek_lower"   : [chr(i) for i in range(0x03B1, 0x03C5) if i != 0x03C2][:19],
    16	    "geometric"     : [chr(i) for i in range(0x25A0, 0x2600)],
    17	}
    18
    19	@staticmethod
    20	def _get( pool : str, n : int ) -> list[str] :
    21	    symbols = amVocabulary.symbols[ pool ]
    22	    if n > len( symbols ) :
    23	        raise ValueError( f"Requested {n} symbols from '{pool}' but only {len(symbols)} available" )
    24	    return symbols[ :n ]
    25
    26	@staticmethod
    27	def letters_lower( n : int ) -> list[str] : return amVocabulary._get( 'letters_lower', n )
    28	@staticmethod
    29	def letters_upper( n : int ) -> list[str] : return amVocabulary._get( 'letters_upper', n )
    30	@staticmethod
    31	def digits( n : int ) -> list[str] :        return amVocabulary._get( 'digits', n )
    32	@staticmethod
    33	def punctuation( n : int ) -> list[str] :   return amVocabulary._get( 'punctuation', n )
    34	@staticmethod
    35	def brackets( n : int ) -> list[str] :      return amVocabulary._get( 'brackets', n )
    36	@staticmethod
    37	def math( n : int ) -> list[str] :          return amVocabulary._get( 'math', n )
    38	@staticmethod
    39	def special( n : int ) -> list[str] :       return amVocabulary._get( 'special', n )
    40	@staticmethod
    41	def whitespace( n : int ) -> list[str] :    return amVocabulary._get( 'whitespace', n )
    42	@staticmethod
    43	def greek_upper( n : int ) -> list[str] :   return amVocabulary._get( 'greek_upper', n )
    44	@staticmethod
    45	def greek_lower( n : int ) -> list[str] :   return amVocabulary._get( 'greek_lower', n )
    46	@staticmethod
    47	def geometric( n : int ) -> list[str] :     return amVocabulary._get( 'geometric', n )
    48
    49	@staticmethod
    50	def num_letters_lower() -> int : return len( amVocabulary.symbols[ 'letters_lower' ] )
    51	@staticmethod
    52	def num_letters_upper() -> int : return len( amVocabulary.symbols[ 'letters_upper' ] )
    53	@staticmethod
    54	def num_digits() -> int :        return len( amVocabulary.symbols[ 'digits' ] )
    55	@staticmethod
    56	def num_punctuation() -> int :   return len( amVocabulary.symbols[ 'punctuation' ] )
    57	@staticmethod
    58	def num_brackets() -> int :      return len( amVocabulary.symbols[ 'brackets' ] )
    59	@staticmethod
    60	def num_math() -> int :          return len( amVocabulary.symbols[ 'math' ] )
    61	@staticmethod
    62	def num_special() -> int :       return len( amVocabulary.symbols[ 'special' ] )
    63	@staticmethod
    64	def num_whitespace() -> int :    return len( amVocabulary.symbols[ 'whitespace' ] )
    65	@staticmethod
    66	def num_greek_upper() -> int :   return len( amVocabulary.symbols[ 'greek_upper' ] )
    67	@staticmethod
    68	def num_greek_lower() -> int :   return len( amVocabulary.symbols[ 'greek_lower' ] )
    69	@staticmethod
    70	def num_geometric() -> int :     return len( amVocabulary.symbols[ 'geometric' ] )

symbols = {'letters_lower': ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'], 'letters_upper': ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'], 'digits': ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'], 'punctuation': ['!', ',', '-', '.', ':', ';', '?', "'", '"'], 'brackets': ['(', ')', '[', ']', '{', '}', '<', '>'], 'math': ['+', '-', '*', '/', '=', '%', '^', '~'], 'special': ['!', '#', '$', '&', '@', '_'], 'whitespace': [' ', '\t', '\n'], 'greek_upper': ['Α', 'Β', 'Γ', 'Δ', 'Ε', 'Ζ', 'Η', 'Θ', 'Ι', 'Κ', 'Λ', 'Μ', 'Ν', 'Ξ', 'Ο', 'Π', 'Ρ', 'Σ', 'Τ'], 'greek_lower': ['α', 'β', 'γ', 'δ', 'ε', 'ζ', 'η', 'θ', 'ι', 'κ', 'λ', 'μ', 'ν', 'ξ', 'ο', 'π', 'ρ', 'σ', 'τ'], 'geometric': ['■', '□', '▢', '▣', '▤', '▥', '▦', '▧', '▨', '▩', '▪', '▫', '▬', '▭', '▮', '▯', '▰', '▱', '▲', '△', '▴', '▵', '▶', '▷', '▸', '▹', '►', '▻', '▼', '▽', '▾', '▿', '◀', '◁', '◂', '◃', '◄', '◅', '◆', '◇', '◈', '◉', '◊', '○', '◌', '◍', '◎', '●', '◐', '◑', '◒', '◓', '◔', '◕', '◖', '◗', '◘', '◙', '◚', '◛', '◜', '◝', '◞', '◟', '◠', '◡', '◢', '◣', '◤', '◥', '◦', '◧', '◨', '◩', '◪', '◫', '◬', '◭', '◮', '◯', '◰', '◱', '◲', '◳', '◴', '◵', '◶', '◷', '◸', '◹', '◺', '◻', '◼', '◽', '◾', '◿']}
@staticmethod
def letters_lower(n: int) -> list[str]: View Source

    26	@staticmethod
    27	def letters_lower( n : int ) -> list[str] : return amVocabulary._get( 'letters_lower', n )

@staticmethod
def letters_upper(n: int) -> list[str]: View Source

    28	@staticmethod
    29	def letters_upper( n : int ) -> list[str] : return amVocabulary._get( 'letters_upper', n )

@staticmethod
def digits(n: int) -> list[str]: View Source

    30	@staticmethod
    31	def digits( n : int ) -> list[str] :        return amVocabulary._get( 'digits', n )

@staticmethod
def punctuation(n: int) -> list[str]: View Source

    32	@staticmethod
    33	def punctuation( n : int ) -> list[str] :   return amVocabulary._get( 'punctuation', n )

@staticmethod
def brackets(n: int) -> list[str]: View Source

    34	@staticmethod
    35	def brackets( n : int ) -> list[str] :      return amVocabulary._get( 'brackets', n )

@staticmethod
def math(n: int) -> list[str]: View Source

    36	@staticmethod
    37	def math( n : int ) -> list[str] :          return amVocabulary._get( 'math', n )

@staticmethod
def special(n: int) -> list[str]: View Source

    38	@staticmethod
    39	def special( n : int ) -> list[str] :       return amVocabulary._get( 'special', n )

@staticmethod
def whitespace(n: int) -> list[str]: View Source

    40	@staticmethod
    41	def whitespace( n : int ) -> list[str] :    return amVocabulary._get( 'whitespace', n )

@staticmethod
def greek_upper(n: int) -> list[str]: View Source

    42	@staticmethod
    43	def greek_upper( n : int ) -> list[str] :   return amVocabulary._get( 'greek_upper', n )

@staticmethod
def greek_lower(n: int) -> list[str]: View Source

    44	@staticmethod
    45	def greek_lower( n : int ) -> list[str] :   return amVocabulary._get( 'greek_lower', n )

@staticmethod
def geometric(n: int) -> list[str]: View Source

    46	@staticmethod
    47	def geometric( n : int ) -> list[str] :     return amVocabulary._get( 'geometric', n )

@staticmethod
def num_letters_lower() -> int: View Source

    49	@staticmethod
    50	def num_letters_lower() -> int : return len( amVocabulary.symbols[ 'letters_lower' ] )

@staticmethod
def num_letters_upper() -> int: View Source

    51	@staticmethod
    52	def num_letters_upper() -> int : return len( amVocabulary.symbols[ 'letters_upper' ] )

@staticmethod
def num_digits() -> int: View Source

    53	@staticmethod
    54	def num_digits() -> int :        return len( amVocabulary.symbols[ 'digits' ] )

@staticmethod
def num_punctuation() -> int: View Source

    55	@staticmethod
    56	def num_punctuation() -> int :   return len( amVocabulary.symbols[ 'punctuation' ] )

@staticmethod
def num_brackets() -> int: View Source

    57	@staticmethod
    58	def num_brackets() -> int :      return len( amVocabulary.symbols[ 'brackets' ] )

@staticmethod
def num_math() -> int: View Source

    59	@staticmethod
    60	def num_math() -> int :          return len( amVocabulary.symbols[ 'math' ] )

@staticmethod
def num_special() -> int: View Source

    61	@staticmethod
    62	def num_special() -> int :       return len( amVocabulary.symbols[ 'special' ] )

@staticmethod
def num_whitespace() -> int: View Source

    63	@staticmethod
    64	def num_whitespace() -> int :    return len( amVocabulary.symbols[ 'whitespace' ] )

@staticmethod
def num_greek_upper() -> int: View Source

    65	@staticmethod
    66	def num_greek_upper() -> int :   return len( amVocabulary.symbols[ 'greek_upper' ] )

@staticmethod
def num_greek_lower() -> int: View Source

    67	@staticmethod
    68	def num_greek_lower() -> int :   return len( amVocabulary.symbols[ 'greek_lower' ] )

@staticmethod
def num_geometric() -> int: View Source

    69	@staticmethod
    70	def num_geometric() -> int :     return len( amVocabulary.symbols[ 'geometric' ] )