# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

import pysgrs

[c for c in dir(pysgrs) if c.endswith("Alphabet") and not c.startswith("Generic")]

# ## Simple Alphabet

A = pysgrs.SimpleAlphabet()
print(A)

A.to_dataframe().T

g = A.permutations(5)
print([next(g) for i in range(10)])

g = A.product(5)
print([next(g) for i in range(10)])

A.is_monotonic

A.is_natural

A.index_types

A.encode("HELLO")

A.decode([22, 14, 17, 11, 3])

# ## ASCII Alphabet

AS = pysgrs.AsciiAlphabet()

AS.to_dataframe().T

AS.encode("Hello world!")

AS.decode([70, 111, 111, 32, 66, 97, 114])

AS.is_monotonic

AS.is_natural

# ## Morse Alphabet

M = pysgrs.MorseAlphabet()

M.to_dataframe().T

M.index_symbols

M.index_min_size

M.index_max_size

M.is_index_size_constant

M.index_types

M.encode("SOS")

M.decode(['-*-*', '*-**', '*', '*-', '*-*'])



StarcoderdataJupyterScriptsDedupFiltered