Translates standard alphabet based text to Grade 2 Braille and back.
Translating text to Grade 2 Braille is a non-trivial task since it is not just a variant of the alphabet, it is an independent writing system. Iterating over a string and translating it one character at a time will not yield correct results for Grade 2 Braille. Many braille symbols have multiple meanings and this can lead to ambiguities. Furthermore, certain words and letters that are commonly seen in the English language can be represented by fewer braille symbols than there are letters (these are called contractions). The algorithm used in this software is summarized below.
The following is the above introduction translated to braille:
⠠⠞⠗⠁⠝⠎⠇⠁⠞⠊⠝⠛ ⠞⠑⠭⠞ ⠖ ⠠⠛⠗⠁⠙⠑ ⠼⠃ ⠠⠃⠗⠁⠊⠇⠇⠑ ⠊⠎ ⠁ ⠝⠕⠝⠤⠞⠗⠊⠧⠊⠁⠇ ⠞⠁⠎⠅ ⠎⠊⠝⠉⠑ ⠭ ⠊⠎ ⠝ ⠚ ⠁ ⠧⠁⠗⠊⠁⠝⠞ ⠷ ⠮ ⠁⠇⠏⠓⠁⠃⠑⠞⠂ ⠭ ⠊⠎ ⠁⠝ ⠊⠝⠙⠑⠏⠑⠝⠙⠑⠝⠞ ⠺⠗⠊⠞⠊⠝⠛ ⠎⠽⠎⠞⠑⠍⠲ ⠠⠊⠞⠑⠗⠁⠞⠊⠝⠛ ⠕⠧⠑⠗ ⠁ ⠎⠞⠗⠊⠝⠛ ⠯ ⠞⠗⠁⠝⠎⠇⠁⠞⠊⠝⠛ ⠭ ⠕⠝⠑ ⠉⠓⠁⠗⠁⠉⠞⠑⠗ ⠁⠞ ⠁ ⠞⠊⠍⠑ ⠺ ⠝ ⠽⠊⠑⠇⠙ ⠉⠕⠗⠗⠑⠉⠞ ⠗⠑⠎⠥⠇⠞⠎ ⠿ ⠠⠛⠗⠁⠙⠑ ⠼⠃ ⠠⠃⠗⠁⠊⠇⠇⠑⠲ ⠠⠍⠁⠝⠽ ⠃⠗⠁⠊⠇⠇⠑ ⠎⠽⠍⠃⠕⠇⠎ ⠓ ⠍⠥⠇⠞⠊⠏⠇⠑ ⠍⠑⠁⠝⠊⠝⠛⠎ ⠯ ⠞⠓⠊⠎ ⠉ ⠇⠑⠁⠙ ⠖ ⠁⠍⠃⠊⠛⠥⠊⠞⠊⠑⠎⠲ ⠠⠋⠥⠗⠞⠓⠑⠗⠍⠕⠗⠑⠂ ⠉⠑⠗⠞⠁⠊⠝ ⠺⠕⠗⠙⠎ ⠯ ⠇⠑⠞⠞⠑⠗⠎ ⠞ ⠁⠗⠑ ⠉⠕⠍⠍⠕⠝⠇⠽ ⠎⠑⠑⠝ ⠔ ⠮ ⠠⠑⠝⠛⠇⠊⠎⠓ ⠇⠁⠝⠛⠥⠁⠛⠑ ⠉ ⠃⠑ ⠗⠑⠏⠗⠑⠎⠑⠝⠞⠑⠙ ⠃⠽ ⠋⠑⠺⠑⠗ ⠃⠗⠁⠊⠇⠇⠑ ⠎⠽⠍⠃⠕⠇⠎ ⠞⠓⠁⠝ ⠞⠓⠑⠗⠑ ⠁⠗⠑ ⠇⠑⠞⠞⠑⠗⠎ ⠶⠞⠓⠑⠎⠑ ⠁⠗⠑ ⠉⠁⠇⠇⠑⠙ ⠉⠕⠝⠞⠗⠁⠉⠞⠊⠕⠝⠎⠶⠲ ⠠⠮ ⠁⠇⠛⠕⠗⠊⠞⠓⠍ ⠥⠎⠑⠙ ⠔ ⠞⠓⠊⠎ ⠎⠕⠋⠞⠺⠁⠗⠑ ⠊⠎ ⠎⠥⠍⠍⠁⠗⠊⠵⠑⠙ ⠃⠑⠇⠕⠺⠲
Usage:
Usage:
main.py <parameter>
main.py <file name> <parameter>
Parameters:
-braille | --b translate braille to text
-text | --t translate text to braille
-help | --h display this screen
-map | --m print translation map
Creating a perfect braille translation can only be done by a human as it requires an understanding of the content at hand. Also, many braille contractions follow pronunciation so programming this can be quite tricky. For instance, the “th” contraction that is used in “thought” would not be used in “pothole”.
This Braille Translator does not include partial contractions as this would increase the complexity of the code ten-fold. This software is meant to provide a rough translation and was written as a means for me to learn Python. Anyone who wants to produce quality braille to meet contract standards should consider consulting an expert instead.