Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
September 16, 2021 08:29 pm GMT

Translate to Braille

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, Im working on is to convert image to speech.
Program takes into account alphabets, numbers, puntuations and symbols.

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

output in braille shown in Visual Studio

Code in Github
Reach me on my Twitter

Note: Thanks to Paul for this photo via @unsplash

Other item to look into:


Original Link: https://dev.to/swapanroy/translate-to-braille-1o79

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To