-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconnectivity_visualization.html
More file actions
122 lines (111 loc) · 19.6 KB
/
Copy pathconnectivity_visualization.html
File metadata and controls
122 lines (111 loc) · 19.6 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<html>
<head>
<meta charset="UTF-8">
<title>Connectivity Visualization</title>
<script src="jquery.min.js"></script>
<script>
var weight = []
var sourceText = []
var targetText = []
weight[0] = [[0.0032847821712493896, 0.2296004593372345, 0.7646315693855286, 0.0012368332827463746, 0.00017225272313226014, 0.00021184011711739004, 6.138680328149348e-05, 0.0003189865092281252, 0.00030102996970526874, 5.8304060075897723e-05, 6.902588211232796e-05, 2.7340402652953344e-07, 9.089211744139902e-06, 1.3009175745537505e-06, 2.645409040269442e-06, 1.20816357593867e-05, 1.2771999536198564e-05, 1.3979667983221589e-06, 3.0991429866844555e-07, 3.36558194646841e-08, 2.5746551557404018e-08, 6.81919445355561e-08], [0.0017690400127321482, 0.010268510319292545, 0.0337715744972229, 0.7021039128303528, 0.18640293180942535, 0.022299328818917274, 0.0056951288133859634, 0.021407172083854675, 0.013470261357724667, 0.0006556065054610372, 0.0012398975668475032, 5.8952475228579715e-05, 0.0004770216764882207, 0.00013833190314471722, 2.5896340957842767e-05, 5.168306961422786e-05, 2.2354932298185304e-05, 2.6334555514040403e-06, 1.5761160057081725e-06, 1.1035598390662926e-06, 4.384097849197133e-07, 1.0224930946378663e-07], [0.0033187163062393665, 0.0050453124567866325, 0.0157680232077837, 0.03802186995744705, 0.3032141327857971, 0.38966113328933716, 0.027046553790569305, 0.05210695415735245, 0.15187515318393707, 0.009054605849087238, 0.004070758819580078, 0.00018137616280000657, 0.00043755306978709996, 2.6152301870752126e-05, 3.617656329879537e-05, 1.9151048036292195e-05, 3.466739144641906e-05, 1.090985915652709e-05, 3.577073130145436e-06, 1.744525320646062e-06, 1.1019207022400224e-06, 3.168783280216303e-07], [0.001696155872195959, 0.0024137096479535103, 0.0024865460582077503, 0.0014188506174832582, 0.002977643860504031, 0.005568051245063543, 0.30546972155570984, 0.3811597228050232, 0.25099900364875793, 0.019439151510596275, 0.022289754822850227, 0.00022199636441655457, 0.0021301950328052044, 0.0010218475945293903, 0.0004088741261512041, 0.00014625709445681423, 5.306159073370509e-05, 1.4271168993218453e-06, 1.5578521924908273e-05, 1.2230055290274322e-05, 1.0605433544697007e-06, 8.505530786351301e-07], [0.02690817229449749, 0.013211759738624096, 0.02839474007487297, 0.010918548330664635, 0.008726370520889759, 0.015804732218384743, 0.011374756693840027, 0.2628478407859802, 0.27726173400878906, 0.1575973629951477, 0.11449509859085083, 0.00864759273827076, 0.05818764865398407, 0.002961676102131605, 0.0014489886816591024, 0.00019490903650876135, 0.0003354230138938874, 0.00019706528109963983, 0.00010208738240180537, 8.59628344187513e-05, 4.4792664994020015e-05, 8.497069757140707e-06], [0.016299176961183548, 0.004277439787983894, 0.012483791448175907, 0.001199142774567008, 0.0008762623183429241, 0.007474036887288094, 0.0015729820588603616, 0.0027046408504247665, 0.00813053734600544, 0.1462361216545105, 0.093549445271492, 0.5545674562454224, 0.10571061819791794, 0.008463081903755665, 0.00915635097771883, 0.007227006368339062, 0.0049634454771876335, 0.005228585563600063, 0.002682082587853074, 0.0010656054364517331, 0.0007510054274462163, 0.00017275505524594337], [0.002678383607417345, 0.00415815319865942, 0.002304408233612776, 0.0002679853932932019, 5.260148464003578e-05, 7.960620132507756e-05, 0.0026325727812945843, 0.004805144853889942, 0.004704540129750967, 0.01700129359960556, 0.9316962361335754, 0.006167768966406584, 0.012966332957148552, 0.0024753452744334936, 0.0010098695056512952, 0.00264604389667511, 0.003234906354919076, 0.00023280578898265958, 0.0004884654190391302, 0.00021637002646457404, 1.932135273818858e-05, 1.3209346434450708e-05], [0.005324703641235828, 0.002177013549953699, 0.005198962055146694, 0.0015210328856483102, 0.003062434261664748, 0.00250058900564909, 0.00017768351244740188, 0.0006646494730375707, 0.002901331288740039, 0.01000683568418026, 0.030422573909163475, 0.44256967306137085, 0.4284352660179138, 0.02204601652920246, 0.0013107453705742955, 0.0018619626061990857, 0.004631620831787586, 0.010741788893938065, 0.012764537706971169, 0.005861558020114899, 0.0008417338831350207, 0.00033302573137916625], [0.0005315198213793337, 0.0004563323163893074, 0.0006543438648805022, 0.00013733420928474516, 8.185864862753078e-05, 4.888963667326607e-05, 0.0002785901306197047, 0.0010307830525562167, 0.001676032436080277, 0.0003637244226410985, 0.001739657949656248, 0.004580578301101923, 0.9005792140960693, 0.08058059960603714, 0.002721634693443775, 0.00023120416153687984, 0.00044502527453005314, 0.00013884551299270242, 0.0019218410598114133, 0.0013355654664337635, 3.711602766998112e-05, 1.252953279617941e-05], [0.002439189702272415, 0.002197780180722475, 0.002546673873439431, 0.0009117820300161839, 0.000655234616715461, 0.00034837168641388416, 0.0002489596663508564, 0.001607038197107613, 0.002413633046671748, 0.006068989634513855, 0.0020078641828149557, 0.007229027803987265, 0.04514481499791145, 0.23926474153995514, 0.44957730174064636, 0.05348185449838638, 0.1100376695394516, 0.015545949339866638, 0.003640029113739729, 0.01929692178964615, 0.017349442467093468, 0.003691398771479726], [0.0046965270303189754, 0.01108688022941351, 0.010592147707939148, 0.0026525231078267097, 0.0020522999111562967, 0.0027471475768834352, 0.00022099395573604852, 0.0007259860285557806, 0.0014493911294266582, 0.002781681949272752, 0.001966295763850212, 0.007320091128349304, 0.0014148744521662593, 0.0019510230049490929, 0.03151239827275276, 0.037094540894031525, 0.19939149916172028, 0.38853511214256287, 0.11942844837903976, 0.11022292077541351, 0.03550247102975845, 0.0075860945507884026], [0.0013424897333607078, 0.0029671178199350834, 0.0024860568810254335, 0.0009907640051096678, 0.0002713888243306428, 9.921856690198183e-05, 0.00028489952092058957, 0.0017468197038397193, 0.0011515099322423339, 0.0008824546821415424, 0.01135831605643034, 0.008909370750188828, 0.0041387262754142284, 0.006454336456954479, 0.03689955547451973, 0.31897303462028503, 0.5668619871139526, 0.012968474067747593, 0.005336995702236891, 0.00864261481910944, 0.0008622662862762809, 0.00022692895436193794], [0.005251508671790361, 0.004960294347256422, 0.009935226291418076, 0.0037506737280637026, 0.0035970518365502357, 0.00264168088324368, 0.0004727570340037346, 0.0021250371355563402, 0.002203035866841674, 0.00218655145727098, 0.002434434834867716, 0.05891215056180954, 0.0026971136685460806, 0.000914512958843261, 0.0036040942650288343, 0.019284890964627266, 0.12602166831493378, 0.6561875939369202, 0.03376055881381035, 0.027118835598230362, 0.0178918968886137, 0.0025485639926046133], [0.0009518956649117172, 0.0004835939616896212, 0.0004827300435863435, 0.0001445351808797568, 0.00017221183225046843, 0.00011468313459772617, 9.954241249943152e-05, 0.00043787056347355247, 0.00043069731327705085, 0.000987923122011125, 0.002410409040749073, 0.040042974054813385, 0.061778806149959564, 0.016242394223809242, 0.005894747097045183, 0.005860705394297838, 0.032537512481212616, 0.17183132469654083, 0.390565425157547, 0.2098696380853653, 0.024476682767271996, 0.010203107260167599], [0.00038707611383870244, 0.0003250720619689673, 0.0003933102125301957, 0.00016577915812376887, 0.00019670190522447228, 0.00013308247434906662, 4.169478779658675e-05, 0.00014081991685088724, 0.00018862774595618248, 0.0002707592211663723, 0.00047019144403748214, 0.0007057305192574859, 0.0004833647981286049, 0.0008697364246472716, 0.0008169856737367809, 0.0006792512140236795, 0.010797831229865551, 0.03651159629225731, 0.006212179083377123, 0.08182574808597565, 0.6835542321205139, 0.13705454766750336], [0.0004198871611151844, 0.00042974099051207304, 0.00038508381112478673, 0.0002827169664669782, 0.0001869129773695022, 0.0001940559159265831, 0.00011319116310914978, 0.0002796740736812353, 0.00023231390514411032, 0.0006020189612172544, 0.0008426639251410961, 0.002912132767960429, 0.0021840371191501617, 0.0014808994019404054, 0.0015988246304914355, 0.0018513810355216265, 0.04973607882857323, 0.07672364264726639, 0.05114082247018814, 0.04438814893364906, 0.10771918296813965, 0.4865627884864807], [0.0023053220938891172, 0.0031090034171938896, 0.005549916066229343, 0.002704811980947852, 0.002348881447687745, 0.002268413081765175, 0.00025037405430339277, 0.0003114186110906303, 0.000464729149825871, 0.0011885357089340687, 0.0008696581935510039, 0.00564406905323267, 0.0016202883562073112, 0.0017260863678529859, 0.004206313285976648, 0.004214202985167503, 0.007491258904337883, 0.049699816852808, 0.016040725633502007, 0.0241002906113863, 0.16371755301952362, 0.2839548587799072]]
sourceText[0] = '\tsudhanthirappoaraali\n'
targetText[0] = ['ச', 'ு', 'த', 'ந', '்', 'த', 'ி', 'ர', 'ப', '்', 'ப', 'ோ', 'ர', 'ா', 'ல', 'ி', '\n']
weight[1] = [[0.0012920189183205366, 0.039390601217746735, 0.03859572485089302, 0.9188075065612793, 0.0008323091315105557, 0.00040712658665142953, 3.17740959872026e-05, 7.60507674613109e-08], [0.00016543698438908905, 0.0014447524445131421, 0.004720231983810663, 0.06043631210923195, 0.9039931297302246, 0.01825578324496746, 0.009192777797579765, 6.130949623184279e-05], [0.010779572650790215, 0.004378992598503828, 0.009260652586817741, 0.014157364144921303, 0.020518282428383827, 0.6966767907142639, 0.18508027493953705, 0.004430010914802551], [0.02630891650915146, 0.03359552472829819, 0.015826478600502014, 0.007779994513839483, 0.009233362041413784, 0.031131168827414513, 0.6456692218780518, 0.10873745381832123], [0.03244953975081444, 0.018027761951088905, 0.006830153055489063, 0.008520349860191345, 0.0023435475304722786, 0.009363353252410889, 0.009594561532139778, 0.13470883667469025]]
sourceText[1] = '\tdhosai\n'
targetText[1] = ['த', 'ோ', 'ச', 'ை', '\n']
weight[2] = [[0.006940068677067757, 0.12796424329280853, 0.8259971141815186, 0.023018728941679, 0.0005079268594272435, 2.3935835997690447e-05, 0.00010860383918043226, 3.4365541523584398e-06, 3.6821322282776237e-05, 1.3837966434948612e-06, 1.525592239204343e-07, 2.068501999019645e-06], [0.0009464112808927894, 0.003064083633944392, 0.004667057655751705, 0.8534460067749023, 0.11456744372844696, 0.007302089594304562, 0.0014838377246633172, 0.0003913030377589166, 0.002802223199978471, 7.210200419649482e-05, 1.759969563863706e-05, 1.2156947377661709e-05], [0.00529209291562438, 0.005297551862895489, 0.0025071995332837105, 0.02606012485921383, 0.3948628306388855, 0.4473118782043457, 0.047774139791727066, 0.0008233654662035406, 0.0032653145026415586, 0.00018599657050799578, 0.00032716250279918313, 0.00017839432985056192], [0.0016994366887956858, 0.001233462244272232, 0.0015100082382559776, 0.0012547315564006567, 0.0030474395025521517, 0.07095791399478912, 0.8980076313018799, 0.014479381963610649, 0.0017850992735475302, 0.0001837835879996419, 0.00011009041918441653, 6.159362237667665e-05], [0.004821854643523693, 0.0014771311543881893, 0.0013757194392383099, 0.0006250196602195501, 0.004759964067488909, 0.010681167244911194, 0.8653510808944702, 0.06720058619976044, 0.03606702387332916, 0.0009317349758930504, 0.0005058814422227442, 0.0006852462538518012], [0.0163281112909317, 0.007148430682718754, 0.01294949371367693, 0.001819916651584208, 0.005534288007766008, 0.027973012998700142, 0.118499256670475, 0.5040175318717957, 0.08994483947753906, 0.06220239773392677, 0.05394989624619484, 0.03040844015777111], [0.010428505018353462, 0.009576554410159588, 0.004506944678723812, 0.0012942126486450434, 0.0006913304096087813, 0.00028956771711818874, 0.008950120769441128, 0.04238372668623924, 0.6635028719902039, 0.05219601094722748, 0.031917642802000046, 0.13543765246868134], [0.008187445811927319, 0.005864163860678673, 0.006163639482110739, 0.0004689286870416254, 0.00036090181674808264, 0.0008416629279963672, 0.004313609097152948, 0.01393140759319067, 0.030245622619986534, 0.08584335446357727, 0.209610715508461, 0.41886356472969055], [0.010454095900058746, 0.012205907143652439, 0.0159879419952631, 0.0036685632076114416, 0.003986047115176916, 0.00750063406303525, 0.008767002262175083, 0.011487013660371304, 0.0033634009305387735, 0.02781067229807377, 0.15195876359939575, 0.11153801530599594], [0.023024369031190872, 0.028501538559794426, 0.05180716514587402, 0.009627441875636578, 0.007809686940163374, 0.0152095016092062, 0.017023729160428047, 0.027303621172904968, 0.006276780739426613, 0.037800442427396774, 0.03418067470192909, 0.024408657103776932]]
sourceText[2] = '\ttamilmakan\n'
targetText[2] = ['த', 'ம', 'ி', 'ழ', '்', 'ம', 'க', 'ன', '்', '\n']
weight[3] = [[0.01553106028586626, 0.42294183373451233, 0.5315407514572144, 0.001481291837990284, 0.0034168334677815437, 0.0006667361012659967, 9.361663251183927e-05, 7.483097579097375e-05, 0.016263447701931, 4.4679694838123396e-05], [0.0006449944921769202, 0.008339453488588333, 0.008011030964553356, 0.14851318299770355, 0.808946967124939, 0.016709834337234497, 0.000431967549957335, 6.414070230675861e-05, 0.0030992054380476475, 1.4779863704461604e-05], [0.013805006630718708, 0.03325209394097328, 0.020357424393296242, 0.03637422248721123, 0.37584689259529114, 0.406942754983902, 0.02856290154159069, 0.0022929201368242502, 0.0037994044832885265, 0.00030710033024661243], [0.03174137324094772, 0.015169751830399036, 0.010095948353409767, 0.0033025008160620928, 0.008317075669765472, 0.16135162115097046, 0.3773627281188965, 0.1937551498413086, 0.07470075786113739, 0.005620511248707771], [0.003028247505426407, 0.009576060809195042, 0.001400065142661333, 0.0016375352861359715, 0.004442512057721615, 0.014687320217490196, 0.9349193572998047, 0.008038467727601528, 0.010557633824646473, 0.0008429393637925386], [0.025640156120061874, 0.018780281767249107, 0.017741473391652107, 0.0017595948884263635, 0.003212040290236473, 0.029589293524622917, 0.23973284661769867, 0.454913467168808, 0.06189103052020073, 0.006917097140103579], [0.012398491613566875, 0.00943211279809475, 0.005014543421566486, 0.002279743319377303, 0.002015009755268693, 0.002137794392183423, 0.01204001810401678, 0.025417400524020195, 0.8208113312721252, 0.03883090242743492], [0.009533872827887535, 0.004303347319364548, 0.002925876760855317, 0.0011084286961704493, 0.001777641475200653, 0.0017162017757073045, 0.0033905452582985163, 0.005634133238345385, 0.008974481374025345, 0.1514958143234253]]
sourceText[3] = '\tmalligai\n'
targetText[3] = ['ம', 'ல', '்', 'ல', 'ி', 'க', 'ை', '\n']
weight[4] = [[0.012876464053988457, 0.8253827691078186, 0.15824303030967712, 0.000616739213000983, 0.0001338032743660733, 3.1049443350639194e-05, 2.346267592656659e-06], [0.0005452820332720876, 0.004793981555849314, 0.03182484954595566, 0.9506607055664062, 0.005069841630756855, 0.0020934089552611113, 0.00013681681593880057], [0.0008359073544852436, 0.0023740248288959265, 0.0112542062997818, 0.22862760722637177, 0.5985974073410034, 0.07726670801639557, 0.004319791682064533], [0.001351102371700108, 0.0017417310737073421, 0.0023416720796376467, 0.02353290095925331, 0.025190211832523346, 0.8783963918685913, 0.032405730336904526], [0.025589201599359512, 0.01123465970158577, 0.007419441360980272, 0.007595787290483713, 0.01212060172110796, 0.02109663374722004, 0.11919717490673065], [0.053999729454517365, 0.019555550068616867, 0.013313558883965015, 0.009400795213878155, 0.018112847581505775, 0.003494494827464223, 0.010622691363096237]]
sourceText[4] = '\tvijay\n'
targetText[4] = ['வ', 'ி', 'ஜ', 'ய', '்', '\n']
$(document).ready(function() {
// print target text
//$('#connectivity').html('<div id="target" style="display:inline"> </div> <div id="source" style="display:inline"> </div>');
for(k=0;k<targetText.length;k++) {
$('#tab').append(`<tr>
<td><div id="target_readable_${k}" style="display:inline"> </div></td>
<td><div id="target_${k}" style="display:inline"> </div></td>
<td><div id="source_${k}" style="display:inline"> </div></td>
</tr>`)
target_string = ''
for(i=0;i<targetText[k].length;i++) {
if(targetText[k][i] == '\t' || targetText[k][i] == '\n') {
continue
}
target_string += targetText[k][i]
}
$(`#target_readable_${k}`).text(target_string)
html = ''
for(i=0;i<targetText[k].length;i++) {
if(targetText[k][i] == '\t') {
html += `<span id="t_${k}_${i}" style="display: inline-block;">` + '[start]' + '</span> ';
} else if (targetText[k][i] == '\n') {
html += `<span id="t_${k}_${i}" style="display: inline-block;">` + '[end]' + '</span> ';
} else {
html += `<span id="t_${k}_${i}" style="display: inline-block;">` + targetText[k][i] + '</span> ';
}
}
$(`#target_${k}`).html(html);
//print source text
html = ''
for(i=0;i<sourceText[k].length;i++) {
if(sourceText[k][i] == '\t') {
html += `<span id="s_${k}_${i}" style="display: inline-block;">` + '[start]' + '</span> ';
} else if (sourceText[k][i] == '\n') {
html += `<span id="s_${k}_${i}" style="display: inline-block;">` + '[end]' + '</span> ';
} else {
html += `<span id="s_${k}_${i}" style="display: inline-block;">` + sourceText[k][i] + '</span> ';
}
}
$(`#source_${k}`).html(html);
// add hover effect for target text
for(i=0;i<targetText[k].length;i++) {
$(`#t_${k}_${i}`).hover(function() {
$(this).css('background-color', '#fff200')
id = $(this).attr('id')
index = id.split("_")[2]
parid = $(this).parent().attr('id')
wordIndex = parid.split("_")[1]
for(j=0;j<weight[wordIndex][index].length;j++) {
$(`#s_${wordIndex}_${j}`).css('background-color', `rgba(0,255,0,${weight[wordIndex][index][j]})`)
}
}, function() {
$(this).css('background-color', '#ffffff')
//reset all background color to white for all source text
parid = $(this).parent().attr('id')
wordIndex = parid.split("_")[1]
for(j=0;j<weight[0][0].length;j++) {
$(`#s_${wordIndex}_${j}`).css('background-color', '#ffffff')
}
});
}
}
});
</script>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th {
text-align: left;
}
th,td {
padding: 5px;
}
</style>
</head>
<body>
<table id='tab'>
<tr>
<th>Target text in readable format</th>
<th>Target text</th>
<th>Source text</th>
</tr>
</table>
</body>
</html>