Parsing nemeth.json in python to integrate in pybrl

nemeth.json is a file which includes the Nemeth code in order to translate LaTeX files. I found it in the latex2nemeth project by Antonis Tsolomitis and Andreas Papasalοuros, which translates LaTeX files into Braille.

I needed to convert this file in order to integrate it into pybrl, which means:

  • Changing the values which are in unicode, into the raise-dot representation that is used in pybrl. For instance, the plus (+) sign needs to be converted into "011101".
  • The keys from the JSON file, need to be converted/used within pybrl later in order to do the math translation.

The latter won't be done now, but the conversion of the values is more crucial for now. As of the latest commit, pybrl can also translate unicode braille symbols into the raise-dot representation, which will be used in order to parse the JSON file.

The final result of this notebook is already saved in nemeth.dict.

The purpose of this notebook:

I want to illustrate how to manipulate such data using functions within pybrl, in order to integrate new languages or symbols. Hopefully, this will help understanding how data is used within the program.


In [1]:
# Import the dependencies
import six             # Python 2 and 3 compatibility
import json            # Load/Save JSON

import pybrl as brl    # pybrl

In [3]:
# Load the JSON file
jdata = {}
with open("nemeth.json", 'r') as f:
    jdata = json.load(f)

In [4]:
jdata.keys()


Out[4]:
dict_keys(['letters', 'theoremSymbols', 'mathSymbols'])

In the JSON file, there are three categories of symbols:

  • theoremSymbols are the numeric symbols 0-9
  • letters are English and Greek characters and symbols used in standard text. These aren't needed because they are already included in pybrl and are used in different modules of the program.
  • mathSymbols include the nemeth symbols that we need.

In [5]:
# Convert the symbols
raise_dot = {}
for key,val in six.iteritems(jdata['mathSymbols']):
    tmp_repr = brl.fromUnicodeSymbols(val)[0] # Get the raise-dot representation list. e.g. ['000101', '100000']
    
    # Remember that whatever is represented by multiple braille cells, can be represented by concatenating the two representations.
    # So, we just join the list:
    raise_dot[key] = "".join(tmp_repr)

In [6]:
# Let's see the result:
raise_dot


Out[6]:
{' ': '',
 '!': '011010',
 '#': '001111',
 '#0': '001111001011',
 '#1': '001111010000',
 '#2': '001111011000',
 '#3': '001111010010',
 '#4': '001111010011',
 '#5': '001111010001',
 '#6': '001111011010',
 '#7': '001111011011',
 '#8': '001111011001',
 '#9': '001111001010',
 "'": '001000',
 '(': '111011',
 ')': '011111',
 '*': '000100001111',
 '+': '001101',
 ',': '000001',
 '-': '001001',
 '--': '001001001001',
 '---': '001001001001001001',
 '.': '010011',
 '/': '001100',
 '0': '001011',
 '1': '010000',
 '2': '011000',
 '3': '010010',
 '4': '010011',
 '5': '010001',
 '6': '011010',
 '7': '011011',
 '8': '011001',
 '9': '001010',
 ':': '011000',
 ';': '010001',
 '<': '000010101000',
 '=': '000101101000',
 '>': '000101010000',
 '?': '000111011001',
 '@': '000100100000011110',
 'A': '000001100000',
 'B': '000001110000',
 'C': '000001100100',
 'D': '000001100110',
 'E': '000001100010',
 'F': '000001110100',
 'G': '000001110110',
 'H': '000001110010',
 'I': '000001010100',
 'J': '000001010110',
 'K': '000001101000',
 'L': '000001111000',
 'M': '000001101100',
 'N': '000001101110',
 'O': '000001101010',
 'P': '000001111100',
 'Q': '000001111110',
 'R': '000001111010',
 'S': '000001011100',
 'T': '000001011110',
 'U': '000001101001',
 'V': '000001111001',
 'W': '000001010111',
 'X': '000001101101',
 'Y': '000001101111',
 'Z': '000001101011',
 '[': '000100111011',
 '\\\n': '',
 '\\ ': '',
 '\\!': '',
 '\\$': '000100011100',
 '\\%': '000100001011',
 '\\&': '000111111101',
 '\\,': '',
 '\\:': '',
 '\\;': '',
 '\\Bbbk': '000111101000',
 '\\Big\\|': '000001110011000001110011',
 '\\Bigg\\|': '000001110011000001110011',
 '\\Biggl(': '000001111011',
 '\\Biggl[': '000100000001111011',
 '\\Biggl\\langle': '000101000101000001111011',
 '\\Biggl\\llbracket': '000100000111000001111011',
 '\\Biggl\\llcorner': '000100000011000001111011',
 '\\Biggl\\ulcorner': '000100000110000001111011',
 '\\Biggl\\{': '000101000001111011',
 '\\Biggl|': '000001110011',
 '\\Biggm|': '000001110011',
 '\\Biggr)': '000001011111',
 '\\Biggr\\lrcorner': '000100000011000001011111',
 '\\Biggr\\rangle': '000101000101000001011111',
 '\\Biggr\\rrbracket': '000100000111000001011111',
 '\\Biggr\\urcorner': '000100000110000001011111',
 '\\Biggr\\}': '000101000001011111',
 '\\Biggr]': '000100000001011111',
 '\\Biggr|': '000001110011',
 '\\Bigl(': '000001111011',
 '\\Bigl[': '000100000001111011',
 '\\Bigl\\llbracket': '000100000111000001111011',
 '\\Bigl\\llcorner': '000100000011000001111011',
 '\\Bigl\\ulcorner': '000100000110000001111011',
 '\\Bigl\\{': '000101000001111011',
 '\\Bigl\\|': '000001110011',
 '\\Bigl|': '000001110011',
 '\\Bigm|': '000001110011',
 '\\Bigr)': '000001011111',
 '\\Bigr\\lrcorner': '000100000011000001011111',
 '\\Bigr\\rangle': '000101000101000001011111',
 '\\Bigr\\rrbracket': '000100000111000001011111',
 '\\Bigr\\urcorner': '000100000110000001011111',
 '\\Bigr\\|': '000001110011',
 '\\Bigr\\}': '000101000001011111',
 '\\Bigr]': '000100000001011111',
 '\\Bigr|': '000001110011',
 '\\Bot': '110101100101011011011011110011',
 '\\Box': '110101010011',
 '\\Bumpeq': '000100110001000001110001',
 '\\Cap': '000101100101000111110101000101100101110111',
 '\\Colonapprox': '011000011000000010000100100011000100100011',
 '\\Coloneq': '011000011000000010100011',
 '\\Coloneqq': '011000011000000010000101101000',
 '\\Colonsim': '011000011000000100100011',
 '\\Cup': '000101001101000111110101000101001101110111',
 '\\Delta': '000101000001100110',
 '\\Diamond': '110101100110',
 '\\DiamondLeft': '110101010101011011011011110101100110',
 '\\DiamondRight': '110101100110110101011011011011101010',
 '\\Diamondblack': '110101000111100110',
 '\\Diamonddot': '110101100110000111110101100001110111',
 '\\DiamonddotLeft': '110101010101011011011011110101100110000111110101100001110111',
 '\\DiamonddotRight': '110101100110000111110101100001110111110101011011011011101010',
 '\\Diamonddotleft': '110101010101110101100110000111110101100001110111',
 '\\Diamonddotright': '110101100110000111110101100001110111110101101010',
 '\\Diamondleft': '110101010101110101100110',
 '\\Diamondright': '110101100110110101101010',
 '\\Downarrow': '110101100101011011011011101010',
 '\\Eqcolon': '100011000010011000011000',
 '\\Eqqcolon': '000101101000000010011000011000',
 '\\Finv': '110101000001110100110111',
 '\\Game': '110101000001110110110111',
 '\\Gamma': '000101000001110110',
 '\\Im': '000001010100101100',
 '\\Join': '110101000111000100100001111000110111',
 '\\Lambda': '000101000001111000',
 '\\Leftarrow': '110101010101011011011011',
 '\\Leftrightarrow': '110101010101011011011011101010',
 '\\Lleftarrow': '110101010101111111111111',
 '\\Longleftarrow': '110101010101010010010010',
 '\\Longleftrightarrow': '110101010101011011011011101010',
 '\\Longmappedfrom': '110101010101011011011011110011',
 '\\Longmapsto': '110101110011011011011011101010',
 '\\Longmmappedfrom': '110101010101011011011011110011110011',
 '\\Longmmapsto': '110101110011110011011011011011101010',
 '\\Longrightarrow': '110101010101011011011011',
 '\\Mappedfrom': '110101010101011011110011',
 '\\Mapsto': '110101110011011011101010',
 '\\Mmappedfrom': '110101010101011011110011110011',
 '\\Mmapsto': '110101110011110011011011101010',
 '\\Nearrow': '110101000110011011011011101010',
 '\\Nwarrow': '110101000110010101011011011011',
 '\\Omega': '000101000001010111',
 '\\Perp': '110101100101011011011011110011',
 '\\Phi': '000101000001110100',
 '\\Pi': '000101000001111100',
 '\\Pr': '000001111100111010',
 '\\Psi': '000101000001101111',
 '\\Qoppa': '000101000001111110',
 '\\Re': '000001111010100010',
 '\\Rightarrow': '110101011011011011101010',
 '\\Rrightarrow': '110101111111111111101010',
 '\\SS': '000001011100000001011100',
 '\\Sampi': '000101000001100100',
 '\\Searrow': '110101000011011011011011101010',
 '\\Sigma': '000101000001011100',
 '\\Stigma': '000101000001011101',
 '\\Subset': '000111000010101000000111110101000111000010101000110111',
 '\\Supset': '000111000101010000000111110101000111000101010000110111',
 '\\Swarrow': '110101000011010101011011011011',
 '\\Theta': '000101000001100111',
 '\\Top': '110101110001011011011011110011',
 '\\Uparrow': '110101110001011011011011101010',
 '\\Updownarrow': '110101110001010101011011011011101010',
 '\\Upsilon': '000101000001101001',
 '\\VDash': '110101110011110011010010010010',
 '\\Vdash': '110101110011110011011011011011',
 '\\VvDash': '110101110011110011110011011011011011',
 '\\Vvdash': '110101110011110011110011010010010010',
 '\\Wr': '',
 '\\Xi': '000101000001101101',
 '\\_': '001001001001',
 '\\acute': '110001001000',
 '\\adots': '110101110001001000001000001000',
 '\\aleph': '000001000001100000',
 '\\alpha': '000101100000',
 '\\amalg': '110101000101111100110111',
 '\\angle': '110101010101',
 '\\approx': '000100100011000100100011',
 '\\approxeq': '000100100011000100100011100011',
 '\\arccos': '100000111010100100100100101010011100',
 '\\arcsin': '100000111010100100011100010100101110',
 '\\arctan': '100000111010100100011110100000101110',
 '\\arg': '100000111010110110',
 '\\ast': '000100001111',
 '\\asymp': '110101100000110101001000',
 '\\atop': '100101',
 '\\backepsilon': '000100010001',
 '\\backprime': '000100001000',
 '\\backsim': '000100000100100011',
 '\\backsimeq': '000100000100100011100011',
 '\\bar': '100011',
 '\\barlambda': '000100000101111000',
 '\\barwedge': '100011000100100101',
 '\\base': '000010',
 '\\because': '000100001100',
 '\\beta': '000101110000',
 '\\beth': '000001000001111001',
 '\\between': '111011011111',
 '\\big': '000001',
 '\\big(': '000001111011',
 '\\big)': '000001011111',
 '\\big\\{': '000101000001111011',
 '\\big\\|': '000001110011000001110011',
 '\\big\\}': '000001110011000001110011',
 '\\bigcap': '000101100101',
 '\\bigcirc': '110101100100',
 '\\bigcup': '000101001101',
 '\\bigg': '000001',
 '\\bigg(': '000001111011',
 '\\bigg)': '000001011111',
 '\\bigg\\{': '000101000001111011',
 '\\bigg\\|': '000001110011000001110011',
 '\\bigg\\}': '000001110011000001110011',
 '\\biggl(': '000001111011',
 '\\biggl[': '000100000001111011',
 '\\biggl\\langle': '000101000101000001111011',
 '\\biggl\\llbracket': '000100000111000001111011',
 '\\biggl\\llcorner': '000100000011000001111011',
 '\\biggl\\ulcorner': '000100000110000001111011',
 '\\biggl\\{': '000101000001111011',
 '\\biggl|': '000001110011',
 '\\biggm|': '000001110011',
 '\\biggr)': '000001011111',
 '\\biggr\\lrcorner': '000100000011000001011111',
 '\\biggr\\rangle': '000101000101000001011111',
 '\\biggr\\rrbracket': '000100000111000001011111',
 '\\biggr\\urcorner': '000100000110000001011111',
 '\\biggr\\}': '000101000001011111',
 '\\biggr]': '000100000001011111',
 '\\biggr|': '000001110011',
 '\\bigg|': '000001110011000001110011',
 '\\bigl(': '000001111011',
 '\\bigl[': '000100000001111011',
 '\\bigl\\langle': '000101000101000001111011',
 '\\bigl\\llbracket': '000100000111000001111011',
 '\\bigl\\llcorner': '000100000011000001111011',
 '\\bigl\\ulcorner': '000100000110000001111011',
 '\\bigl\\{': '000101000001111011',
 '\\bigl\\|': '000001110011',
 '\\bigl|': '000001110011',
 '\\bigm|': '000001110011',
 '\\bignplus': '000101100101000111110101001101110111',
 '\\bigodot': '110101100100000111110101100001110111',
 '\\bigoplus': '110101100100000111110101001101110111',
 '\\bigotimes': '110101100100000111110101000100100001110111',
 '\\bigr)': '000001011111',
 '\\bigr\\lrcorner': '000100000011000001011111',
 '\\bigr\\rangle': '000101000101000001011111',
 '\\bigr\\rrbracket': '000100000111000001011111',
 '\\bigr\\urcorner': '000100000110000001011111',
 '\\bigr\\|': '000001110011',
 '\\bigr\\}': '000101000001011111',
 '\\bigr]': '000100000001011111',
 '\\bigr|': '000001110011',
 '\\bigsqcap': '000100000101100101',
 '\\bigsqcapplus': '000100000101100101000111110101001101110111',
 '\\bigsqcup': '000100000101001101',
 '\\bigsqcupplus': '000100000101001101000111110101001101110111',
 '\\bigstar': '110101000111011100',
 '\\bigtriangledown': '000101110101',
 '\\bigtriangleup': '110101011110',
 '\\biguplus': '000101001101000111110101001101110111',
 '\\bigvee': '000100001101',
 '\\bigwedge': '000100100101',
 '\\big|': '000001110011000001110011',
 '\\binom': '100101',
 '\\blacklozenge': '110101000111100110',
 '\\blacksquare': '110101000111010011',
 '\\blacktriangle': '110101000111011110',
 '\\blacktriangledown': '110101000111000101011110',
 '\\blacktriangleleft': '000111110101000010101000111000110111',
 '\\blacktriangleright': '000111110101000111000101010000110111',
 '\\bot': '110101111100',
 '\\bowtie': '110101000111000100100001111000110111',
 '\\boxLeft': '110101010101001011001011110101010011',
 '\\boxRight': '110101010011110101011011011011101010',
 '\\boxast': '110101010011000111110101000100001111110111',
 '\\boxbar': '110101010011000111110101110011110111',
 '\\boxbslash': '110101010011000111110101010001110111',
 '\\boxdot': '110101010011000111110101100001110111',
 '\\boxdotLeft': '110101010101011011011011110101010011000111110101100001110111',
 '\\boxdotRight': '110101010011000111110101100001110111110101011011011011101010',
 '\\boxdotleft': '110101010101110101010011000111110101100001110111',
 '\\boxdotright': '110101010011000111100001110111110101101010',
 '\\boxleft': '110101010101110101010011',
 '\\boxminus': '110101010011000111110101100011110111',
 '\\boxplus': '110101010011000111110101001101110111',
 '\\boxright': '110101010011110101101010',
 '\\boxslash': '110101010011000111110101001010110111',
 '\\boxtimes': '110101010011000111110101000100100001110111',
 '\\breve': '000111100101',
 '\\bullet': '000111010011',
 '\\cap': '000101100101',
 '\\cdot': '100001',
 '\\cdots': '001000001000001000',
 '\\centerdot': '100001',
 '\\check': '110001000100000111110001',
 '\\checked': '000100001110',
 '\\chi': '000101111101',
 '\\choose': '100101',
 '\\circ': '000101100001',
 '\\circeq': '000010000101101000110001000101100001110111',
 '\\circlearrowleft': '110101100100000111110101010101110111',
 '\\circlearrowright': '110101100100000111110101101010110111',
 '\\circledS': '110101100100000111110101000001011100110111',
 '\\circledast': '110101100100000111110101000100001111110111',
 '\\circledbar': '110101100100000111110101110011110111',
 '\\circledbslash': '110101100100000111110101010001110111',
 '\\circledcirc': '110101100100000111110101000101100001110111',
 '\\circleddash': '110101100100000111110101001001110111',
 '\\circleddotleft': '110101100100000111110101100001110101010101110111',
 '\\circleddotright': '110101100100000111110101100001110101101010110111',
 '\\circledgtr': '110101100100000111110101000101010000110111',
 '\\circledless': '110101100100000111110101000010101000110111',
 '\\circledvee': '110101100100000111110101000100001111110111',
 '\\circledwedge': '110101100100000111110101000100100111110111',
 '\\circleleft': '110101100100000111110101010101110111',
 '\\circleright': '110101100100000111110101101010110111',
 '\\colonapprox': '011000000100100011000100100011',
 '\\coloneq': '011000000010100011',
 '\\coloneqq': '011000000010000101101000',
 '\\colonsim': '011000000010000100100011',
 '\\complement': '000101100100',
 '\\cong': '000100100011000101101000',
 '\\coprod': '10010010111001011010110100010100101001010110100010010001',
 '\\copyright': '110101100100000111110101000001100100110111',
 '\\cos': '100100101010011100',
 '\\cosh': '100100101010011100110010',
 '\\cot': '100100101010011110',
 '\\coth': '100100101010011110110010',
 '\\csc': '100100011100100100',
 '\\cup': '000101001101',
 '\\curlyeqprec': '110101100011000101000010101000110111',
 '\\curlyeqsucc': '110101100011000101000101010000110111',
 '\\curlyvee': '110101000100001101110111',
 '\\curlywedge': '110101000100100101110111',
 '\\curvearrowleft': '110101010001001010101010',
 '\\curvearrowright': '110101010101010001001010',
 '\\dagger': '000111110111',
 '\\daleth': '000001000001100110',
 '\\dashleftarrow': '110101010101010010',
 '\\dashleftrightarrow': '110101010101010010',
 '\\dashrightarrow': '110101010010',
 '\\dashv': '110101010010010010110011',
 '\\ddag': '000111000111110111',
 '\\ddagger': '000111000111110111',
 '\\ddot': '110001100001100001110111',
 '\\ddots': '110101100101001000001000001000',
 '\\deg': '100110100010110110',
 '\\delta': '000101100110',
 '\\det': '100110100010011110',
 '\\diagdown': '000111100001',
 '\\diagup': '001100',
 '\\diamond': '110101100110',
 '\\digamma': '000101111001',
 '\\dim': '100110010100101100',
 '\\displaystyle': '',
 '\\div': '000101001100',
 '\\divideontimes': '000100100001000111110101000101001100110111',
 '\\dot-begin': '000010',
 '\\dot-end': '100001',
 '\\doteq': '000010000101101000110001100001110111',
 '\\doteqdot': '000010000101101000100101100001110001100001110111',
 '\\dotplus': '000010001101110001100001110111',
 '\\dots': '001000001000001000',
 '\\dotsc': '001000001000001000',
 '\\doublebarwedge': '000101101000000100100101',
 '\\downarrow': '110101100101010010010010101010',
 '\\downdownarrows': '110101100101010010010010101010000010110101100101010010010010101010',
 '\\downharpoonleft': '110101100101010010010010000001101010',
 '\\downharpoonright': '110101100101010010010010000100101010',
 '\\ell': '000001111000',
 '\\emptyset': '000111001011',
 '\\epsilon': '000101100010',
 '\\eqcirc': '000101100001000100000101101000110111',
 '\\eqcolon': '100011000010011000',
 '\\eqqcolon': '000101101000000010011000',
 '\\eqslantgtr': '100011000101010000',
 '\\eqslantless': '100011000010101000',
 '\\equiv': '000111111000',
 '\\eta': '000101100011',
 '\\eth': '110101001100000100100110110111',
 '\\exists': '000100111111',
 '\\exp': '100010101101111100',
 '\\fallingdotseq': '',
 '\\fint': '001100011101',
 '\\forall': '000100111101',
 '\\frac-b': '100111',
 '\\frac-e': '001111',
 '\\frac-separator': '001100',
 '\\frown': '110101100000',
 '\\gamma': '000101110110',
 '\\gcd': '110110100100100110',
 '\\geq': '000101010000100011',
 '\\geqq': '000101010000000101101000',
 '\\geqslant': '000101010000100011',
 '\\gg': '000101010000000100000101010000110111',
 '\\ggg': '000101010000000100000101010000000100000101010000110111',
 '\\gimel': '000001000001110110',
 '\\gnapprox': '000101010000001100000100100011000100100011',
 '\\gneq': '000101010000001100100011',
 '\\gneqq': '000010000101101000110001000101100001110111',
 '\\gnsim': '000101010000001100000100100011',
 '\\grave': '100011',
 '\\gtrapprox': '000101010000000100100011000100100011',
 '\\gtrdot': '000101010000000111110101100001110111',
 '\\gtreqless': '000101010000100011000010101000',
 '\\gtreqqless': '000101010000000101101000000010101000',
 '\\gtrless': '000101010000000010101000',
 '\\gtrsim': '000101010000000100100011',
 '\\gvertneqq': '000101010000001100000101101000',
 '\\hat': '110001000111110001',
 '\\hbar': '000100110010',
 '\\hom': '110010101010101100',
 '\\hookleftarrow': '110101010101010010010010000100101111',
 '\\hookrightarrow': '110101000100111101010010010010101010',
 '\\hslash': '110101001100110010110111',
 '\\hspace*': '',
 '\\idotsint': '011101001000001000001000011101',
 '\\iiiint': '011101011101011101011101',
 '\\iiint': '011101011101011101',
 '\\iint': '011101011101',
 '\\imath': '110101010100110111',
 '\\in': '000100100010',
 '\\inf': '010100101110110100',
 '\\infty': '000001111111',
 '\\int': '011101',
 '\\intercal': '110101110001010010010010110011',
 '\\invamp': '110101111101110111',
 '\\iota': '000101010100',
 '\\jmath': '110101010110110111',
 '\\kappa': '000101101000',
 '\\ker': '101000100010111010',
 '\\lJoin': '110101000111000100100001110111',
 '\\lambda': '000101111000',
 '\\lambdabar': '000100000101111000',
 '\\lambdaslash': '110101001100000101111000110111',
 '\\langle': '000101000101111011',
 '\\lceil': '000100000110111011',
 '\\ldots': '001000001000001000',
 '\\le': '000010101000100011',
 '\\leadsto': '110101001010010010010001101010',
 '\\leadstoext': '000100100011',
 '\\left(': '000001111011',
 '\\left.': '',
 '\\left[': '000100000001111011',
 '\\left\\langle': '000101000101000001111011',
 '\\left\\llbracket': '000100000111000001111011',
 '\\left\\llcorner': '000100000011000001111011',
 '\\left\\ulcorner': '000100000110000001111011',
 '\\left\\{': '000101000001111011',
 '\\left\\|': '000001110011000001110011',
 '\\leftarrow': '110101010101',
 '\\leftarrowtail': '110101010101010010010010010101',
 '\\leftharpoondown': '110101000001010101010010010010',
 '\\leftharpoonup': '110101000100010101010010010010',
 '\\leftleftarrows': '110101010101010010010010110101010101010010010010',
 '\\leftquote': '000001011001',
 '\\leftrightarrow': '110101010101010010010010101010',
 '\\leftrightarrows': '110101010101010010010010110101010010010010101010',
 '\\leftrightharpoons': '110101000001010101010010010010110101010010010010000100101010',
 '\\leftrightsquigarrow': '110101010101001010010001001010101010',
 '\\leftsquigarrow': '110101010101001010010001001010',
 '\\leftthreetimes': '',
 '\\left|': '000001110011',
 '\\lenqno': '',
 '\\leq': '000010101000100011',
 '\\leqno': '',
 '\\leqq': '000010101000000101101000',
 '\\leqslant': '000010101000100011',
 '\\lessapprox': '000010101000000100100011000100100011',
 '\\lessdot': '000010101000000111110101100001110111',
 '\\lesseqgtr': '000010101000100011000101010000',
 '\\lesseqqgtr': '000010101000000101101000000101010000',
 '\\lessgtr': '000010101000000101010000',
 '\\lesssim': '000010101000000100100011',
 '\\lfloor': '000100000011111011',
 '\\lg': '111000110110',
 '\\lhd': '110101000010101000111000110111',
 '\\lim': '111000010100101100',
 '\\liminf': '100101111000010100101100',
 '\\limsup': '110001111000010100101100',
 '\\ll': '000010101000000100000010101000110111',
 '\\llbracket': '000100000111111011',
 '\\llcorner': '000100000011111011',
 '\\lll': '000010101000000100000010101000000100000010101000110111',
 '\\ln': '111000101110',
 '\\lnapprox': '000010101000001100000100100011000100100011',
 '\\lneq': '000010101000001100100011',
 '\\lneqq': '000010101000001100000101101000',
 '\\lnsim': '000010101000001100000100100011',
 '\\log': '111000101010110110',
 '\\longleftarrow': '110101010101010010010010',
 '\\longleftrightarrow': '110101010101010010010010101010',
 '\\longmappedfrom': '110101010101010010010010110011',
 '\\longmapsto': '110101110011010010010010101010',
 '\\longmmappedfrom': '110101010101010010010010110011110011',
 '\\longmmapsto': '110101110011110011010010010010101010',
 '\\longrightarrow': '110101010010010010101010',
 '\\lowint': '100101011101',
 '\\lozenge': '110101100110',
 '\\lq': '000001011001',
 '\\lrJoin': '110101000111000100100001111000110111',
 '\\lrcorner': '000100000011011111',
 '\\lrtimes': '110101000111000100100001111000110111',
 '\\ltimes': '110101000111000100100001110111',
 '\\lvertneqq': '000010101000100011001100000101101000110111',
 '\\mappedfrom': '110101010101010010110011',
 '\\mapsto': '110101110011010010101010',
 '\\mathbb': '000111',
 '\\mathcal': '000100000011',
 '\\mathring': '000101100001',
 '\\max': '101100100000101101',
 '\\measuredangle': '110101010101000100110101100000110111',
 '\\medbullet': '110101000111100100',
 '\\medcirc': '110101100100',
 '\\mho': '110101000101010110110111',
 '\\mid': '110011',
 '\\min': '101100010100101110',
 '\\mmappedfrom': '110101010101010010110011110011',
 '\\mmapsto': '110101110011110011010010101010',
 '\\models': '110101110011011011011011',
 '\\mp': '001001001101',
 '\\mu': '000101101100',
 '\\multimap': '110101010010010010000101100001',
 '\\multimapboth': '110101000101100001010010010010000101100001',
 '\\multimapbothvert': '110101110001000101100001010010010010000101100001',
 '\\multimapdot': '110101010010010010100001',
 '\\multimapdotboth': '110101100001010010010010100001',
 '\\multimapdotbothA': '110101000101100001010010010010100001',
 '\\multimapdotbothAvert': '110101110001100001010010010010000101100001',
 '\\multimapdotbothB': '110101100001010010010010000101100001',
 '\\multimapdotbothBvert': '110101110001000101100001010010010010100001',
 '\\multimapdotbothvert': '110101110001100001010010010010100001',
 '\\multimapdotinv': '110101100001010010010010',
 '\\multimapinv': '110101000101100001010010010010',
 '\\nBumpeq': '001100000100110001000001110001',
 '\\nLeftarrow': '001100110101010101011011011011',
 '\\nLeftrightarrow': '001100110101010101011011011011101010',
 '\\nRightarrow': '001100110101011011011011101010',
 '\\nSubset': '001100000111000010101000000111110101000111000010101000110111',
 '\\nSupset': '001100000111000101010000000111110101000111000101010000110111',
 '\\nVDash': '001100110101110011110011010010010010',
 '\\nabla': '000101110101',
 '\\napprox': '001100000100100011000100100011',
 '\\napproxeq': '001100000100100011000100100011100011',
 '\\nasymp': '001100110101100000110101001000',
 '\\nbacksim': '001100000100000100100011',
 '\\ncong': '001100000100100011000101101000',
 '\\ne': '001100000101101000',
 '\\nearrow': '110101000110010010010010101010',
 '\\neg': '110101010010010010000001110011',
 '\\neq': '001100000101101000',
 '\\nequiv': '001100111111',
 '\\nexists': '001100000100111111',
 '\\ngeq': '001100000101010000100011',
 '\\ngeqq': '001100000101010000000101101000',
 '\\ngeqslant': '001100000101010000100011',
 '\\ngg': '001100000101010000000100000101010000110111',
 '\\ngtr': '001100000101010000',
 '\\ngtrapprox': '001100000101010000000100100011000100100011',
 '\\ngtrless': '001100000010101000000101010000',
 '\\ngtrsim': '001100000101010000000100100011',
 '\\ni': '000100010001',
 '\\nleftarrow': '001100110101010101',
 '\\nleftrightarrow': '001100110101010101010010010010101010',
 '\\nleq': '001100000010101000100011',
 '\\nleqq': '001100000010101000000101101000',
 '\\nleqslant': '001100000010101000100011',
 '\\nless': '001100000010101000',
 '\\nlessapprox': '001100000010101000000100100011000100100011',
 '\\nlessgtr': '001100000101010000000010101000',
 '\\nlesssim': '001100000010101000000100100011',
 '\\nll': '001100000010101000000100000010101000110111',
 '\\nmid': '001100110011',
 '\\not': '001100',
 '\\notin': '001100000100100010',
 '\\notni': '001100000100010001',
 '\\notowns': '001100000100010001',
 '\\nparallel': '001100110101111000',
 '\\nplus': '000101100101000111110101001101110111',
 '\\nprec': '001100000101000010101000',
 '\\nprecapprox': '001100000101000010101000000100100011000100100011',
 '\\npreccurlyeq': '001100110101000101000010101000100011110111',
 '\\npreceq': '001100000101000010101000100011',
 '\\npreceqq': '001100000101000010101000000101101000',
 '\\nprecsim': '001100000101000010101000000100100011',
 '\\nrightarrow': '001100110101101010',
 '\\nshortmid': '001100110011',
 '\\nshortparallel': '001100110101111000',
 '\\nsim': '001100000100100011',
 '\\nsimeq': '001100000100100011100011',
 '\\nsqsubset': '001100000100000111000010101000',
 '\\nsqsubseteq': '001100000100000111000010101000100011',
 '\\nsqsupset': '001100000100000111000101010000',
 '\\nsqsupseteq': '001100000100000111000101010000100011',
 '\\nsubset': '001100000111000010101000',
 '\\nsubseteq': '001100000111000010101000100011',
 '\\nsucc': '000101000101010000',
 '\\nsuccapprox': '001100000101000101010000000100100011000100100011',
 '\\nsucccurlyeq': '001100110101000101000101010000100011110111',
 '\\nsucceq': '001100000101000101010000100011',
 '\\nsucceqq': '001100000101000101010000000101101000',
 '\\nsuccsim': '001100000101000101010000000100100011',
 '\\nsupset': '001100000111000101010000',
 '\\nsupseteq': '001100000111000101010000100011',
 '\\nsupseteqq': '001100000111000101010000000101101000',
 '\\nthickapprox': '001100000111000100100011000111000100100011',
 '\\ntriangleleft': '001100110101000010101000111000110111',
 '\\ntrianglelefteq': '001100110101000010101000111000100011110111',
 '\\ntriangleright': '001100110101000111000101010000110111',
 '\\ntrianglerighteq': '001100110101000111000101010000100011110111',
 '\\ntwoheadleftarrow': '001100110101010101010101010010010010',
 '\\ntwoheadrightarrow': '001100110101010010010010101010101010',
 '\\nu': '000101101110',
 '\\nvDash': '001100110101110011011011011011',
 '\\nvarparallel': '001100110101111000',
 '\\nvarparallelinv': '001100000111100001000111100001',
 '\\nvdash': '001100110101110011010010010010',
 '\\nwarrow': '110101000110010101010010010010',
 '\\odot': '110101100100000111110101100001110111',
 '\\oiiint': '011101011101011101000100110101100100110111',
 '\\oiiintclockwise': '011101011101011101000100110101010101010001001010110111',
 '\\oiiintctrclockwise': '011101011101011101000100110101010001001010101010110111',
 '\\oiint': '011101011101000100110101100100110111',
 '\\oiintclockwise': '011101011101000100110101010101010001001010110111',
 '\\oiintctrclockwise': '011101011101000100110101010001001010101010110111',
 '\\oint': '011101000100110101100100110111',
 '\\ointclockwise': '011101000100110101010101010001001010110111',
 '\\ointctrclockwise': '011101000100110101010001001010101010110111',
 '\\omega': '000101010111',
 '\\ominus': '110101100100000111110101001001110111',
 '\\openJoin': '000100100001',
 '\\oplus': '110101100100000111110101001101110111',
 '\\oslash': '110101100100000111110101001010110111',
 '\\otimes': '110101100100000111110101000100100001110111',
 '\\overbrace-begin': '000010',
 '\\overbrace-end': '110111',
 '\\overbrace-middle': '110001000101111011110001110001',
 '\\overline-begin': '000010',
 '\\overline-end': '110001100011',
 '\\parallel': '110101111000',
 '\\partial': '000100100110',
 '\\perp': '110101111100',
 '\\phi': '000101110100',
 '\\pi': '000101111100',
 '\\pm': '001101001001',
 '\\prec': '000101000010101000',
 '\\precapprox': '000101000010101000000100100011000100100011',
 '\\preccurlyeq': '110101000101000010101000100011110111',
 '\\preceq': '000101000010101000100011',
 '\\preceqq': '000101000010101000000101101000',
 '\\precnapprox': '001100000101000010101000000100100011000100100011',
 '\\precnsim': '000101000010101000001100000100100011',
 '\\precsim': '000101000010101000000100100011',
 '\\prime': '001000',
 '\\prod': '000101000001111100',
 '\\propto': '000111111111',
 '\\psi': '000101101111',
 '\\qquad': '',
 '\\quad': '',
 '\\rJoin': '110101000100100001111000110111',
 '\\radical-index': '110001',
 '\\rangle': '000101000101011111',
 '\\rceil': '000100000110011111',
 '\\rfloor': '000100000011011111',
 '\\rhd': '110101000111000101010000110111',
 '\\rho': '000101111010',
 '\\right)': '000001011111',
 '\\right.': '',
 '\\right\\lrcorner': '000100000011000001011111',
 '\\right\\rangle': '000101000101000001011111',
 '\\right\\rrbracket': '000100000111000001011111',
 '\\right\\urcorner': '000100000110000001011111',
 '\\right\\|': '000001110011000001110011',
 '\\right\\}': '000101000001011111',
 '\\right]': '000100000001011111',
 '\\rightarrow': '110101101010',
 '\\rightarrowtail': '110101101010010010010010101010',
 '\\rightharpoondown': '110101010010010010000001101010',
 '\\rightharpoonup': '110101010010010010000100101010',
 '\\rightleftarrows': '110101010010010010101010110101010101010010010010',
 '\\rightleftharpoons': '110101010010010010000100101010110101000001010101010010010010',
 '\\rightquote': '001011001000',
 '\\rightrightarrows': '110101010010010010101010110101010010010010101010',
 '\\rightsquigarrow': '110101001010010001001010101010',
 '\\rightthreetimes': '',
 '\\right|': '000001110011',
 '\\risingdotseq': '',
 '\\rq': '001011001000',
 '\\rrbracket': '000100000111011111',
 '\\rtimes': '110101000100100001111000110111',
 '\\searrow': '110101000011010010010010101010',
 '\\sec': '011100100010100100',
 '\\setminus': '000111100001',
 '\\sharp': '000101001111',
 '\\shortmid': '110011',
 '\\shortparallel': '110101111000',
 '\\sigma': '000101011100',
 '\\sim': '000100100011',
 '\\simeq': '000100100011100011',
 '\\sin': '011100010100101110',
 '\\sinh': '011100010100101110110010',
 '\\smallfrown': '110101100000',
 '\\smallsetminus': '000111100001',
 '\\smallsmile': '110101001000',
 '\\smile': '110101001000',
 '\\sphericalangle': '110101010101000111110101110101100000110111',
 '\\sqcap': '000100000101100101',
 '\\sqcapplus': '000100000101100101000111110101001101110111',
 '\\sqcup': '000100000101001101',
 '\\sqcupplus': '000100000101001101000111110101001101110111',
 '\\sqiiintop': '011101011101011101000100110101111010110111',
 '\\sqiintop': '011101011101000100110101111010110111',
 '\\sqint': '011101000100110101010011110111',
 '\\sqrt-b': '001110',
 '\\sqrt-e': '110111',
 '\\sqrt-level': '000101',
 '\\sqsubset': '000100000111000010101000',
 '\\sqsubseteq': '000100000111000010101000100011',
 '\\sqsupset': '000100000111000101010000',
 '\\sqsupseteq': '000100000111000101010000100011',
 '\\square': '110101010011',
 '\\stackrel-begin': '000010',
 '\\stackrel-end': '110111',
 '\\stackrel-middle': '110001',
 '\\star': '110101011100',
 '\\strictfi': '110101111101010010010010',
 '\\strictif': '110101010010010010101111',
 '\\strictiff': '110101111101010010010010101111',
 '\\sub': '000011',
 '\\subset': '000111000010101000',
 '\\subseteq': '000111000010101000100011',
 '\\subseteqq': '000111000010101000000101101000',
 '\\subsetneq': '000111000010101000001100100011',
 '\\subsetneqq': '000111000010101000001100000101101000',
 '\\succ': '000101000101010000',
 '\\succapprox': '000101000101010000000100100011000100100011',
 '\\succcurlyeq': '110101000101000101010000100011110111',
 '\\succeq': '000101000101010000100011',
 '\\succeqq': '000101000101010000000101101000',
 '\\succnapprox': '000101000101010000001100000100100011000100100011',
 '\\succnsim': '000101000101010000001100000100100011',
 '\\succsim': '000101000101010000000100100011',
 '\\sum': '000101000001011100',
 '\\sup': '011100101001111100',
 '\\superscript': '000110',
 '\\supset': '000111000101010000',
 '\\supseteq': '000111000101010000100011',
 '\\supseteqq': '000111000101010000000101101000',
 '\\supsetneq': '000111000101010000001100100011',
 '\\supsetneqq': '000111000101010000001100000101101000',
 '\\surd': '001110',
 '\\swarrow': '110101000011010101010010010010',
 '\\tan': '011110100000101110',
 '\\tanh': '011110100000101110110010',
 '\\tau': '000101011110',
 '\\textstirling': '000100111000',
 '\\therefore': '000001100001',
 '\\theta': '000101100111',
 '\\thickapprox': '000111000100100011000111000100100011',
 '\\thicksim': '000111000100100011',
 '\\tianglelefteq': '110101000010101000111000100011110111',
 '\\tilde': '000100100011',
 '\\times': '000100100001',
 '\\to': '110101101010',
 '\\top': '110101110001010010010010110011',
 '\\trangleleft': '110101000010101000111000110111',
 '\\triangle': '110101011110',
 '\\triangledown': '000101110101',
 '\\trianglelefteq': '110101000010101000111000100011110111',
 '\\triangleq': '000010000101101000110001110101011110110111',
 '\\triangleright': '110101000111000101010000110111',
 '\\trianglerighteq': '110101000111000101010000100011110111',
 '\\twoheadleftarrow': '110101010101010101010010010010',
 '\\twoheadrightarrow': '110101010010010010101010101010',
 '\\ulcorner': '000100000110111011',
 '\\under': '100101',
 '\\underbrace-begin': '000010',
 '\\underbrace-end': '110111',
 '\\underbrace-middle': '100101000101011111100101100101',
 '\\underline-begin': '000010',
 '\\underline-end': '100101100011',
 '\\unlhd': '110101000010101000111000100011110111',
 '\\unrhd': '110101000111000101010000100011110111',
 '\\uparrow': '110101110001010010010010101010',
 '\\updownarrow': '110101110001010101010010010010101010',
 '\\upharpoonleft': '110101110001010010010010000100101010',
 '\\upharpoonright': '110101110001010010010010000001101010',
 '\\upint': '110001011101',
 '\\uplus': '000101001101000111110101001101110111',
 '\\upsilon': '000101101001',
 '\\upuparrows': '110101110001010010010010101010000010110101110001010010010010101010',
 '\\urcorner': '000100000110011111',
 '\\vDash': '110101110011011011011011',
 '\\varepsilon': '000101000100100010',
 '\\varg': '000100110110',
 '\\varkappa': '000101000100101000',
 '\\varliminf': '100101111000010100101100',
 '\\varlimsup': '110001111000010100101100',
 '\\varnothing': '000111001011',
 '\\varoiiintclockwise': '011101011101011101000100110101010101010001001010110111',
 '\\varoiiintctrclockwise': '011101011101011101000100110101010001001010101010110111',
 '\\varoiintclockwise': '011101011101000100110101010101010001001010110111',
 '\\varoiintctrclockwise': '011101011101000100110101010001001010101010110111',
 '\\varointclockwise': '011101000100110101010101010001001010110111',
 '\\varointctrclockwise': '011101000100110101010001001010101010110111',
 '\\varparallel': '110101111000',
 '\\varparallelinv': '000111100001000111100001',
 '\\varphi': '000101000100110100',
 '\\varpi': '000101000100111100',
 '\\varprod': '000010000100100001',
 '\\varpropto': '000111111111',
 '\\varrho': '000101000100111010',
 '\\varsigma': '000101000100011100',
 '\\varsubsetneq': '000111000010101000001100100011',
 '\\varsubsetneqq': '000111000010101000001100000101101000',
 '\\varsupsetneq': '000111000101010000001100100011',
 '\\varsupsetneqq': '000111000101010000001100000101101000',
 '\\vartheta': '000101000100100111',
 '\\vartriangle': '110101011110',
 '\\vartriangleleft': '110101000010101000111000110111',
 '\\vartrianlgeright': '110101000111000101010000110111',
 '\\varv': '000100111001',
 '\\varw': '000100010111',
 '\\vary': '000100101111',
 '\\vdash': '110101110011010010010010',
 '\\vdots': '110101100101001000001000001000',
 '\\vec-begin': '000010',
 '\\vec-end': '110001110101101010110111',
 '\\vee': '000100001101',
 '\\veebar': '000100001101100011',
 '\\wedge': '000100100101',
 '\\widetilde-begin': '000010',
 '\\widetilde-end': '110001000100000001100011',
 '\\wp': '000100000011111100',
 '\\wr': '',
 '\\xi': '000101101101',
 '\\zeta': '000101101011',
 '\\{': '000101111011',
 '\\|': '110011110011',
 '\\}': '000101011111',
 ']': '000100011111',
 'a': '100000',
 'b': '110000',
 'c': '100100',
 'd': '100110',
 'e': '100010',
 'f': '110100',
 'frac-level': '000001',
 'g': '110110',
 'h': '110010',
 'i': '010100',
 'j': '010110',
 'k': '101000',
 'l': '111000',
 'm': '101100',
 'n': '101110',
 'o': '101010',
 'p': '111100',
 'q': '111110',
 'r': '111010',
 's': '011100',
 't': '011110',
 'u': '101001',
 'v': '111001',
 'w': '010111',
 'x': '101101',
 'y': '101111',
 'z': '101011',
 '{': '',
 '|': '110011',
 '}': '',
 'Α': '000101100000',
 'Β': '000101110000',
 'Ε': '000101100010',
 'Ζ': '000101101011',
 'Η': '000101001110',
 'Ι': '000101010100',
 'Κ': '000101101000',
 'Μ': '000101101100',
 'Ν': '000101101110',
 'Ξ': '000101101101',
 'Ο': '000101101010',
 'Ρ': '000101111010',
 'Τ': '000101011110',
 'Υ': '000101101111',
 'Χ': '000101110010',
 'α': '100000',
 'β': '110000',
 'γ': '110110',
 'δ': '100110',
 'ε': '100010',
 'ζ': '101011',
 'η': '001110',
 'θ': '100111',
 'ι': '010100',
 'κ': '101000',
 'λ': '111000',
 'μ': '101100',
 'ν': '101110',
 'ξ': '101101',
 'ο': '101010',
 'π': '111100',
 'ρ': '111010',
 'ς': '011100',
 'σ': '011100',
 'τ': '011110',
 'υ': '101111',
 'φ': '110100',
 'χ': '110010',
 'ψ': '111101',
 'ω': '010110',
 'ϊ': '010100',
 'ϋ': '101111'}

In [7]:
# Save the data into nemeth.dict
with open("nemeth.dict", 'w') as f:
    json.dump(raise_dot, f)

Now the only thing that is needed in order to integrate the Nemeth code is to convert and use the keys in this dictionary appropriately, in order to do the correct translation of math.