-
Notifications
You must be signed in to change notification settings - Fork 0
/
visualize_input.py
86 lines (78 loc) · 9.94 KB
/
visualize_input.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
from visualizer import *
import pickle
import os
def search():
token_file = "validating_data.pkl"
input_tokens_dir = "/Users/balazs/token_trace_normalized2"
input_tokens_path = os.path.join(input_tokens_dir, token_file)
tokens = pickle.load(open(input_tokens_path, 'rb'))
for formula, input in tokens:
# for char, box in input:
# if char == "\\prime":
# print("".join(formula))
joined = "".join(formula)
if "\\frac{z^{-1}(1+4z^{-1}+z^{-2})}{(1-z^{-1})^{4}" in joined:
print(input)
print(joined)
def main():
# visualize([('e', (0.0, 0.2720588, 0.16666667, 1.0)), ('-', (0.16847827, 0.15441176, 0.24637681, 0.15441176)), ('t', (0.27173913, 0.0, 0.32789856, 0.022058824)), ('\\cos', (0.36594203, 0.40441176, 0.45833334, 0.86764705)), ('2', (0.73913044, 0.2867647, 0.8786232, 0.8308824)), ('t', (0.86413044, 0.29411766, 1.0, 0.31617647))])
# visualize([('c', (0.0, 0.07638889, 0.13144329, 0.6319444)), ('x', (0.18814433, 0.45833334, 0.2783505, 0.8819444)), ('c', (0.378866, 0.0, 0.5670103, 0.7222222)), ('x', (0.5927835, 0.5902778, 0.69072163, 0.9861111)), ('+', (0.7654639, 0.8055556, 0.88659793, 0.8263889)), ('1', (0.9871134, 0.5347222, 1.0, 1.0))])
# visualize([('9', (0.26744187, 0.26785713, 0.36710963, 1.0)), ('+', (0.49833888, 0.51785713, 0.62458473, 0.60119045)), ('\\sqrt', (0.71428573, 0.065476194, 0.9833887, 0.89285713)), ('1', (0.85714287, 0.26190478, 0.88372093, 0.77380955)), ('6', (0.8803987, 0.27380952, 1.0, 0.7619048)), ('\\sqrt', (0.0, 0.0, 0.35215947, 0.9880952))])
# visualize([('2', (0.52150536, 0.3063063, 0.61290324, 0.4864865)), ('\\theta', (0.6155914, 0.2927928, 0.7096774, 0.4954955)), ('d', (0.7688172, 0.25675675, 0.9032258, 0.4864865)), ('\\theta', (0.91129035, 0.24324325, 1.0, 0.4864865)), ('\\int', (0.0, 0.0, 0.15322581, 1.0)), ('\\sin', (0.18010753, 0.36036035, 0.29032257, 0.6396396))])
# visualize([('F', (0.16644993, 0.28270042, 0.2353706, 0.7299578)), ('n', (0.2379714, 0.8312236, 0.26658, 1.0)), ('(', (0.3172952, 0.2742616, 0.35240573, 0.84388185)), ('a', (0.35630688, 0.5274262, 0.3914174, 0.6877637)), (')', (0.43172953, 0.23628692, 0.449935, 0.79746836)), ('F', (0.6371912, 0.13502109, 0.75812745, 0.51476794)), ('x', (0.70611185, 0.48101267, 0.7477243, 0.6919831)), ('(', (0.8413524, 0.029535865, 0.88686603, 0.65400845)), ('a', (0.8959688, 0.32911393, 0.9479844, 0.51898736)), (')', (0.97919375, 0.0, 1.0, 0.65822786)), ('\\lim', (0.0, 0.5949367, 0.08842653, 0.721519)), ('=', (0.5227568, 0.46413502, 0.55396616, 0.5021097)), ('x', (0.20156047, 0.7172996, 0.22886866, 0.8902954))])
# visualize([('\\int', (0.0, 0.0, 0.08794788, 0.97590363)), ('v', (0.24429968, 0.27710843, 0.37459284, 0.40963855)), ('-', (0.15309446, 0.4759036, 0.40716612, 0.5)), ('v', (0.22801302, 0.59638554, 0.38762215, 0.74698794)), ('\\int', (0.66775244, 0.10240964, 0.742671, 1.0)), ('2', (0.7654723, 0.36746988, 0.85016286, 0.6084337)), ('d', (0.89250815, 0.5060241, 0.9413681, 0.59638554)), ('d', (0.1465798, 0.24096386, 0.16938111, 0.41566265)), ('=', (0.51140064, 0.45783132, 0.5863192, 0.4698795)), ('x', (0.96091205, 0.5, 1.0, 0.59638554))])
# visualize([('7', (0.17663817, 0.2682927, 0.2735043, 0.8902439)), ('+', (0.46153846, 0.6219512, 0.56980056, 0.64634144)), ('\\sqrt', (0.6923077, 0.0, 1.0, 1.0)), ('2', (0.8262108, 0.3902439, 0.8974359, 0.80487806)), ('8', (0.92877495, 0.3902439, 0.98575497, 0.86585367)), ('\\sqrt', (0.0, 0.69512194, 0.0, 0.69512194))])
# visualize([('E', (0.6009852, 0.72289157, 0.6945813, 0.73493975)), ('0', (0.74876845, 0.8433735, 0.817734, 1.0)), ('4', (0.14778325, 0.6987952, 0.24630542, 0.79518074)), ('\\pi', (0.39408866, 0.7710843, 0.408867, 0.9518072)), ('1', (0.3546798, 0.0, 0.7093596, 0.024096385)), ('-', (0.0, 0.12048193, 1.0, 0.18072289))])
# visualize([('\\sqrt', (0.42813456, 0.44047618, 0.86850154, 0.9285714)), ('4', (0.6299694, 0.71428573, 0.6360856, 0.875)), ('4', (0.6666667, 0.54761904, 0.70642203, 0.6130952)), ('\\sqrt', (0.25076452, 0.25, 0.941896, 0.9464286)), ('\\sqrt', (0.0, 0.0, 1.0, 1.0)), ('!', (0.72782874, 0.5297619, 0.7308869, 0.63095236))])
# visualize([('\\sum', (0.0, 0.112068966, 0.21649484, 0.12931034)), ('k', (0.09793814, 0.8103448, 0.24742268, 1.0)), ('j', (0.4329897, 0.18965517, 0.5154639, 0.51724136)), ('[', (0.63917524, 0.02586207, 0.7061856, 0.060344826)), (']', (0.8969072, 0.0, 1.0, 0.49137932)), ('k', (0.76804125, 0.1637931, 0.9072165, 0.35344827))])
# visualize([('-', (0.0, 0.0, 0.0, 0.0)), ('-', (0.16666667, 0.1754386, 0.25925925, 0.20175439)), ('t', (0.5714286, 0.21929824, 0.6243386, 1.0)), ('-', (0.7037037, 0.5350877, 0.8518519, 0.5701754)), ('\\theta', (0.9100529, 0.40350878, 1.0, 0.98245615)), ('t', (0.013227513, 0.2982456, 0.11904762, 0.32456142)), ('1', (0.2989418, 0.02631579, 0.3068783, 0.31578946)), ('\\theta', (0.10846561, 0.5614035, 0.15873016, 1.0)), ('=', (0.34920636, 0.6666667, 0.43915343, 0.75438595))])
# visualize([('f', (0.0, 0.14728682, 0.04859335, 0.6937984)), ('(', (0.07289003, 0.058139537, 0.157289, 0.9728682)), (')', (0.27621484, 0.0, 0.32097188, 1.0)), ('z', (0.5268542, 0.68604654, 0.6086956, 0.85658914)), ('\\rightarrow', (0.61764705, 0.751938, 0.6636829, 0.75581396)), ('z', (0.67391306, 0.67054266, 0.75191814, 0.88372093)), ('f', (0.79539645, 0.18604651, 0.8248082, 0.5426357)), (')', (0.9501279, 0.1627907, 1.0, 0.6627907)), ('z', (0.16751918, 0.4651163, 0.24040921, 0.6550388)), ('z', (0.89641947, 0.32945737, 0.9757033, 0.5387597)), ('(', (0.8491049, 0.1124031, 0.9104859, 0.5968992)), ('\\lim', (0.52557546, 0.13178295, 0.55370843, 0.61627907)), ('=', (0.39514068, 0.627907, 0.46163684, 0.6511628)), ('0', (0.22762148, 0.56589144, 0.2685422, 0.67054266)), ('0', (0.73401535, 0.82945734, 0.75191814, 0.88372093))])
# visualize([('1', (0.0, 0.36178863, 0.008187135, 0.7154471)), ('-', (0.049122807, 0.53252035, 0.10175438, 0.53252035)), ('d', (0.14853801, 0.3089431, 0.19532163, 0.70731705)), ('=', (0.25614035, 0.4715447, 0.2982456, 0.47560975)), ('(', (0.34385964, 0.27235773, 0.4011696, 0.72357726)), ('1', (0.42105263, 0.32520324, 0.44444445, 0.69512194)), ('-', (0.47836256, 0.51626015, 0.52163744, 0.53252035)), ('d', (0.54619884, 0.30081302, 0.6, 0.67479676)), ('(', (0.63274854, 0.1300813, 0.6690059, 0.37398374)), ('m', (0.6830409, 0.21138212, 0.7403509, 0.35365853)), (')', (0.78128654, 0.06097561, 0.8023392, 0.34552845)), ('-', (0.52982455, 0.6869919, 0.78245616, 0.7154471)), ('m', (0.6233918, 0.8455285, 0.7134503, 1.0)), (')', (0.81637424, 0.08130081, 0.8842105, 0.87398374)), ('m', (0.91695905, 0.0, 1.0, 0.24796748))])
# visualize([('.', (0.19202898, 0.33467743, 0.19323671, 0.375)), ('0', (0.22584541, 0.14516129, 0.27173913, 0.3266129)), ('5', (0.2874396, 0.12096774, 0.3442029, 0.36290324)), ('-', (0.054347824, 0.51209676, 0.37439615, 0.54435486)), ('5', (0.121980675, 0.766129, 0.18357489, 1.0)), ('0', (0.21376811, 0.8185484, 0.28140098, 0.9919355)), ('=', (0.4335749, 0.28629032, 0.5084541, 0.29435483)), ('\\pm', (0.62801933, 0.028225806, 0.6413044, 0.2016129)), ('0', (0.7246377, 0.14919356, 0.781401, 0.42741936)), ('.', (0.78502417, 0.3951613, 0.8055556, 0.44354838)), ('0', (0.83816427, 0.18951613, 0.87922704, 0.375)), ('0', (0.91183573, 0.2016129, 0.9432367, 0.37903225)), ('1', (0.9963768, 0.16532259, 1.0, 0.4516129)), ('\\pm', (0.0, 0.0, 0.004830918, 0.23790322)), ('0', (0.107487924, 0.12096774, 0.1594203, 0.35080644))])
# visualize([('8', (0.14457831, 0.0062111802, 0.2951807, 0.2857143)), ('9', (0.36144578, 0.0, 0.5301205, 0.2795031)), ('9', (0.58433735, 0.01863354, 0.7409639, 0.3167702)), ('3', (0.8313253, 0.0124223605, 0.94578314, 0.24223602)), ('7', (0.072289154, 0.6832298, 0.22891566, 1.0)), ('8', (0.25301206, 0.6832298, 0.42771083, 0.9627329)), ('7', (0.48192772, 0.70186335, 0.686747, 0.98136646)), ('3', (0.8192771, 0.70186335, 1.0, 0.95652175)), ('-', (0.0, 0.42857143, 1.0, 0.50931674))])
# visualize([('z', (0.010610079, 0.20460358, 0.07029178, 0.39897698)), ('-', (0.043766577, 0.15601023, 0.080901854, 0.16368286)), ('1', (0.08355438, 0.051150896, 0.115384616, 0.1764706)), ('(', (0.13395226, 0.12276215, 0.1657825, 0.47826087)), ('1', (0.1816976, 0.18670076, 0.234748, 0.39641944)), ('+', (0.3050398, 0.23529412, 0.32095492, 0.37084398)), ('4', (0.403183, 0.16368286, 0.44164455, 0.32992327)), ('z', (0.5039788, 0.17391305, 0.5901857, 0.35549873)), ('-', (0.5570292, 0.09462915, 0.5875332, 0.10230179)), ('1', (0.61538464, 0.0, 0.6432361, 0.10485934)), ('+', (0.6657825, 0.29923275, 0.7228117, 0.3094629)), ('z', (0.7533156, 0.1483376, 0.8222812, 0.32225063)), ('-', (0.8076923, 0.06905371, 0.84615386, 0.0741688)), ('2', (0.8647215, 0.0051150895, 0.89522547, 0.12531969)), (')', (0.93501323, 0.03836317, 0.98673743, 0.39130434)), ('-', (0.0, 0.50639385, 1.0, 0.56777495)), ('(', (0.14854111, 0.71867007, 0.1790451, 1.0)), ('1', (0.22413793, 0.75191814, 0.24270557, 0.95907927)), ('-', (0.27984086, 0.86445016, 0.33819628, 0.8746803)), ('z', (0.40450928, 0.7058824, 0.47612733, 0.9130435)), ('-', (0.42307693, 0.65473145, 0.46551725, 0.65984654)), ('1', (0.4867374, 0.5498721, 0.5026525, 0.6803069)), (')', (0.561008, 0.5984655, 0.58488065, 0.97442454)), ('4', (0.61140585, 0.55754477, 0.68037134, 0.66751915))])
visualize([('y_1',
'y',
(5.1341953693292234e-05,
0.7413087747566254,
0.06280179497144817,
2.36630880285644)),
('x_1',
'x',
(0.5584301688628839,
0.8734516544895294,
0.6666602606082492,
1.502975444178176)),
('+_1',
'+',
(0.7094107854358058,
0.90392784496572,
0.7757859560430145,
1.4724993242270101)),
('2_1',
'2',
(0.9804125787241336,
0.010118321156196071,
1.0267877493313422,
0.6905945116323866)),
('=_1',
'=',
(0.23921947584569153,
0.6905945116323866,
0.33472041839314026,
1.2796421560249365)),
('A_1',
'A',
(0.4638460526235258,
0.27416594516260595,
0.5484301688628839,
1.3203563938042444)),
('A_2',
'A',
(0.8339948098685943,
0.00011832135420334106,
0.9485788955057625,
1.5844040607868413))])
if __name__ == '__main__':
main()
# search()