In 2015, there were an estimated 253 million people with visual impairment worldwide. Of these, 36 million were blind and a further 217 million had moderate to severe visual impairment (MSVI). Many blind people use Braille for reading purposes.
Braille is the world's most popular tactile reading and writing system.
In the below program, I have shown a way to convert English to Braille, another program, I’m working on is to convert image to speech.
Program takes into account alphabets, numbers, puntuations and symbols.
Created using Python 3.9 (Latest version) -download here
Defining translation values based on Grade 1 Braille
alphaBraille = ['⠁', '⠃', '⠉', '⠙', '⠑', '⠋', '⠛',
'⠓', '⠊', '⠚', '⠅', '⠇','⠍', '⠝', '⠕', '⠏', '⠟', '⠗',
'⠎', '⠞', '⠥', '⠧', '⠺', '⠭', '⠽', '⠵', ' ']
numBraille = ['⠼⠁', '⠼⠃', '⠼⠉', '⠼⠙', '⠼⠑', '⠼⠋',
'⠼⠛', '⠼⠓', '⠼⠊', '⠼⠚']
alphabet = ['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', ' ']
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9','0']
Logic
if len(translateToBraille) > 0 :
for n in translateToBraille.lower():
if n in alphabet:
inputString += alphaBraille[alphabet.index(n)]
elif n in nums:
inputString += numBraille[nums.index(n)]
elif n in puntuation:
inputString += puntuationBraille[puntuation.index(n)]
elif n in character:
inputString += characterBraille[character.index(n)]
print(inputString)
To test our cases
translateToBraille = 'This is good day & Tony what are you planning to do @ the mall ?'
Output
Code in Github
Reach me on my Twitter
Note: Thanks to Paul for this photo via @unsplash 🎁
Other item to look into:
Top comments (0)