Skip to content

Latest commit

 

History

History
75 lines (57 loc) · 3.01 KB

README.md

File metadata and controls

75 lines (57 loc) · 3.01 KB
brai.py

Brai.py

braipy GitHub License GitHub Created At GitHub forks Email

This library allows you to work with braille in python! 8 braille is not available at this time.

Note

Also, in this library, in accordance with the style of Braille.
From upper left to upper right: 1,2,3, and from upper right to lower right: 4,5,6. The protruding part is denoted by "true" and the flat part by "false. [True, True, False, True, False, True]

Install

# Use different commands depending on the environment
pip install git+https://github.com/naisu-dev/braipy.git
pip3 install git+https://github.com/naisu-dev/braipy.git

Example of use

import braipy


## Create a class from a list of bools
mytenji = braipy.Tenji([True, True, False, False, True, False])
print(mytenji) # ⠓
print(mytenji.data) # [True, True, False, False, True, False]


## Some class changes  0: False  1: True  2: To the opposite state from the present    3:as it is now
mytenji = mytenji.push([0, 2, 2, 2, 1, 3])
print(mytenji) # ⠜
print(mytenji.data) # [False, False, True, True, True, False]


## Create classes from Braille text
mytenji = braipy.Tenji.tenjitext_to_cls("⠇")
print(mytenji) # ⠇
print(mytenji.data) # [True, True, True, False, False, False]


## Create a list of classes from normal text
mytenji = braipy.Tenji.text_to_cls("helloworld", mode="translate") #Transformation with str.translate
mytenji = braipy.Tenji.text_to_cls("helloworld", mode="character") #Convert in your own way
## There are two modes. In translate mode, if there is text that is not in the dictionary, it will go through, but in character mode, an error will occur.
print(mytenji) # [⠓, ⠑, ⠇, ⠇, ⠕, ⠺, ⠕, ⠗, ⠇, ⠙]

-Alpha function-

Dictionary

Braipy will provide you with an original dictionary, but you can also use your own dictionary

import braipy

mydict = {
    "h": [True, True, True, True, True, True],
    "e": [True, False, False, False, True, True],
    "l": [True, False, True, False, True, True],
    "o": [False, True, False, False, True, True]
}

mytenji = braipy.Mytenji.text_to_cls("hello", mydict)
print(mytenji) # ["⠿", "⠱", "⠵", "⠵", "⠲"]  *A list of classes is returned

This readme was translated from Japanese to English using deepl translation, so there may be some grammar errors.