Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
swapanroy authored Sep 21, 2021
1 parent f263fd9 commit 35eba84
Showing 1 changed file with 33 additions and 2 deletions.
35 changes: 33 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,39 @@
Python Program to translate to and from Braille (Grade 1 Braille). It includes alphabets, numbers, puntuations and symbols.

Source for translation : https://www.pharmabraille.com/braille-codes/unified-english-braille-ueb-code/
## Logic :
Loop over the index and pick values

## Defining translation
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']
puntuation = [',',';',':','.','?','!', ';','(',')', '/', '-']
puntuationBraille = ['⠂','⠆','⠒','⠲','⠦','⠖','⠐⠣','⠐⠜','⠸⠌','⠤']
character = ['&','*','@','©','®','™','°',]
characterBraille = ['⠈⠯','⠐⠔','⠈⠁','⠘⠉','⠘⠗','⠘⠞','⠘⠚',]

## Loop over the index and pick values


def main():
inputString = ' '
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)
return


![Output of translated Braille](https://github.com/swapanroy/BrailleTranslatation/blob/6dac8fb7437262aa5d96ecd8315594b7bb2ee8db/Braille.jpg )

Expand Down

0 comments on commit 35eba84

Please sign in to comment.