Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
prepare the text first solution in Clear category for English to Braille Translator by Olpag
braille = {'a': ((1,0),(0,0),(0,0)), 'b': ((1,0),(1,0),(0,0)), 'c': ((1,1),(0,0),(0,0)), 'd': ((1,1),(0,1),(0,0)),
'e': ((1,0),(0,1),(0,0)), 'f': ((1,1),(1,0),(0,0)), 'g': ((1,1),(1,1),(0,0)), 'h': ((1,0),(1,1),(0,0)),
'i': ((0,1),(1,0),(0,0)), 'j': ((0,1),(1,1),(0,0)), 'k': ((1,0),(0,0),(1,0)), 'l': ((1,0),(1,0),(1,0)),
'm': ((1,1),(0,0),(1,0)), 'n': ((1,1),(0,1),(1,0)), 'o': ((1,0),(0,1),(1,0)), 'p': ((1,1),(1,0),(1,0)),
'q': ((1,1),(1,1),(1,0)), 'r': ((1,0),(1,1),(1,0)), 's': ((0,1),(1,0),(1,0)), 't': ((0,1),(1,1),(1,0)),
'u': ((1,0),(0,0),(1,1)), 'v': ((1,0),(1,0),(1,1)), 'w': ((0,1),(1,1),(1,1)), 'x': ((1,1),(0,0),(1,1)),
'y': ((1,1),(0,1),(1,1)), 'z': ((1,0),(0,1),(1,1)), ' ': ((0,0),(0,0),(0,0)),
',': ((0,0),(1,0),(0,0)), '.': ((0,0),(1,1),(0,1)), '-': ((0,0),(1,1),(0,0)), '?': ((0,0),(1,0),(1,1)),
'_': ((0,0),(0,0),(1,1)), '!': ((0,0),(1,1),(1,0)), 'C': ((0,0),(0,0),(0,1)), 'N': ((0,1),(0,1),(1,1)),
}
digits = ('j','a','b','c','d','e','f','g','h','i')
len_string = 10
from itertools import zip_longest
def braille_page(text):
empty_column, empty_line = (0,), (0,) * (2*len_string + len_string -1)
text = ''.join('C' + ch.lower() if ch.isupper() else 'N' + digits[int(ch)] if ch.isdigit() else ch for ch in text)
strings = list(map(''.join, zip_longest(*[iter(text)]*10, fillvalue=' '))) if len(text) > len_string else [text]
def braille_string(data):
lines = [(),(),()]
for num, ch in enumerate(data, start=1):
for i in range(3):
lines[i] += braille[ch][i]
if num < len(data):
lines[i] += empty_column
return lines
page = sum([braille_string(string) + [empty_line] for string in strings], [])[:-1]
return tuple(page)
Aug. 6, 2019