Newer
Older
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
function PlWordnet(data) {
console.log(data);
PlWordnet.data = data;
this.analyseData(data);
}
PlWordnet.wordClick = function(ev) {
Lexp.target = PlWordnet.id;
var target = ev.target.getAttribute('href');
Lexp.go2URL(target)
return false;
}
PlWordnet.prototype.sortUnits = function(_units) {
// console.log(_units);
var i;
_units.sort(function(a, b) {
if (a.synset == b.synset) {
return a.unitid > b.unitid ? 1 : -1;
}
return a.synset > b.synset ? 1 : -1;
});
for (i = 0; i < _units.length - 1; i++) {
if (_units[i].synset == _units[i + 1].synset) {
_units[i + 1].smallestunitid = _units[i].smallestunitid;
}
}
_units.sort(function(a, b) {
if (a.smallestunitid == b.smallestunitid) {
return a.unitid > b.unitid ? 1 : -1;
}
return a.smallestunitid > b.smallestunitid ? 1 : -1;
});
var i = 0,
num = 0,
first = -1,
ind = 0;
while (i < _units.length) {
_units[i].rowspan = 0;
if (_units[i].synset != ind) {
if (first >= 0) {
_units[first].rowspan = num;
}
first = i;
num = 1;
ind = _units[i].synset;
} else {
num += 1;
}
i += 1;
}
_units[first].rowspan = num;
}
PlWordnet.fullQualifiermapa = {"og.":"ogólne","pot.":"potoczne","wulg.":"wulgarne","posp.":"pospolite","książk.":"książkowe","urz.":"urzędowe","daw.":"dawne","specj.":"specjalistyczne","nienorm.":"nienormatywne","środ.":"środowiskowe","reg.":"regionalne"}
PlWordnet.fullQualifiermapaEnglish = {"og.":"general","pot.":"colloquial","wulg.":"vulgar","posp.":"common","książk.":"bookish","urz.":"official","daw.":"former","specj.":"special","nienorm.":"imprescriptive","środ.":"environmental","reg.":"regional"}
PlWordnet.fullQualifier = function(str) {
if (str in PlWordnet.fullQualifiermapa) {
if(document.body.className == 'pl') {
return PlWordnet.fullQualifiermapa[str];
} else {
return PlWordnet.fullQualifiermapaEnglish[str];
}
}
return "";
}
PlWordnet.citeSourcemapa = {
"P":"przykład spreparowany przez lingwistę mający formę zdania",
"W":"przykład z Wikipedii",
"WN":"cytat z WikiNews",
"Z":"zasłyszane albo wymyślone, teksty z języka mówionego"
}
PlWordnet.citeSourcemapaEnglish = {
"P":"example developed by linguist having form of a sentence",
"W":"example from Wikipedia",
"WN":"quote from WikiNews",
"Z":"overheard or made-up, texts from spoken language"
}
PlWordnet.citeSource = function(str) {
if (str in PlWordnet.citeSourcemapa) {
if(document.body.className == 'pl') {
return PlWordnet.citeSourcemapa[str];
} else {
return PlWordnet.citeSourcemapaEnglish[str];
}
}
return "";
}
PlWordnet.prototype.analyseData = function(data) {
// console.log(data);
function clean(str) {
if (str != null) {
return str.slice(0, -1)
}
return "";
}
var _units = [];
let language = window.location.href.split("/")[4];
for (var rid in data.synsets) {
var synset = data.synsets[rid];
var synsetDescription = data.synsets[rid].definition;
for (var uid in synset.units) {
var unit = synset.units[uid];
var _unit = new Object();
_unit.unitname = unit.str.split("(")[0];
_unit.unitid = unit.id;
_unit.smallestunitid = unit.id;
_unit.synset = synset.id;
_unit.url = "/lemma/" + language + "/" + unit.lemma;
_unit.definition = clean(unit.definition);
if (!_unit.definition) {
_unit.definition = synsetDescription;
}
// console.log(_unit.definition);
_unit.qualifier = unit.usage_notes;
_unit.link = "";
_unit.islemma = unit.lemma == Lexp.element.lemma;
if (unit.external_links.length == 0) {
_unit.link += ' ';
} else {
for (var elid in unit.external_links) {
var link = unit.external_links[elid];
if (link.length > 0) {
_unit.link += '<a href="' + link + '" style="color: inherit;">' +
'<span lang="pl" data-toggle="tooltip" data-placement="top" title="Link do zasobu zewnętrznego" class="source glyphicon glyphicon glyphicon-link"></span></a>' +
'<span lang="en" data-toggle="tooltip" data-placement="top" title="Link for external resource" class="source glyphicon glyphicon glyphicon-link"></span></a>';
}
}
}
_unit.examples = "";
for (var seid in unit.sense_examples) {
if (unit.sense_examples[seid].length > 0)
_unit.examples += unit.sense_examples[seid] +
'<span rel="tooltip" data-original-title="' + PlWordnet.citeSource(unit.sense_examples_sources[seid]) +
'"> #' + unit.sense_examples_sources[seid] + "</span><br>";
}
_units.push(_unit);
}
}
if($('#type').val() == 'synsetid') {
/* Synset way */
this.sortUnits(data.units);
this.data = data.units;
} else {
/* Normal way */
this.sortUnits(_units);
this.data = _units;
}
}
PlWordnet.prototype.createAdditionalInfo = function(jsonData, title, titleEn, lang = 'pl') {
let textData = '',
quantity = 0;
$(jsonData).each(function(index, element) {
$(element[2].units).each(function(index2, element2) {
let definition = '',
horizontalLine = '<hr />';
quantity++;
if (element2.definition !== null && element2.definition !== ',' && element2.definition !== '.') {
definition = '<p class="description">' + element2.definition + '</p>';
}
if (jsonData.length - 1 == index) {
if (element[2].units.length - 1 == index2) {
horizontalLine = '';
}
}
textData +=
// '<a href="http://plwordnet.pwr.wroc.pl/wordnet/lemma/' + element2.lemma + '" title="lemma" target="_blank">' +
'<a href="/synsetid/plwordnet/' + element2.synset + '">' +
'<p class="title">' + element2.lemma + '</p>' +
'</a>' +
`<img width="40" height="20" class="img-responsive show-icon" src="/img/lang-${lang}-32.png" alt="Language1" />` +
definition +
horizontalLine;
});
});
if (quantity != 0) {
let data =
'<div class="plwordnet-box">' +
'<h2>' +
'<img class="img-responsive show-icon" src="/img/lang-' + lang + '-32.png" alt="Language2" />' +
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
'<span lang="pl">' + title + ' (' + quantity + ')' + '</span>' +
'<span lang="en">' + titleEn + ' (' + quantity + ')' + '</span>' +
'</h2>' +
textData +
'</div>';
$('#lexpelement_plwordnet #plwordnet-box-left').append(data);
}
}
PlWordnet.emotionMap = {
"+ s":"weak positive", "+ m":"strong positive"
};
PlWordnet.prototype.showHTMLForSynset = function() {
let synsetID = this.data[0].synset;
$('#lexpelement_plwordnet').append(
'<div class="plwordnet-container">' +
'<div id="plwordnet-box-right"></div>' +
'<div id="plwordnet-box-left"></div>' +
'</div>');
this.createAdditionalInfo(PlWordnet.data.related.fuzzynimia_synsetów, 'Fuzzynimia synsetów', 'Fuzzyimia of synsets');
this.createAdditionalInfo(PlWordnet.data.related.hiperonimia, 'Hiperonimia', 'Hiperonimia');
this.createAdditionalInfo(PlWordnet.data.related.hiponimia, 'Hiponimia', 'Hyponymy');
this.createAdditionalInfo(PlWordnet.data.related["holonimia/część"], 'Holonimia część', 'Holonimia part');
this.createAdditionalInfo(PlWordnet.data.related["holonimia/miejsce"], 'Holonimia miejsce', 'Holonimia place');
this.createAdditionalInfo(PlWordnet.data.related["synonimia_międzyjęzykowa/Syn_plWN-PWN"], 'Synonimia', 'Synonymy', 'en');
this.createAdditionalInfo(PlWordnet.data.related["Hyponym"], 'Hiponim', 'Hyponymy', 'en');
this.createAdditionalInfo(PlWordnet.data.related["synonimia_międzyjęzykowa/Syn_PWN-plWN"], 'Synonimia', 'Synonymy');
$(PlWordnet.data.units).each(function(index, element) {
let examples = '',
definition = element.definition || PlWordnet.data.definition || '-',
language = (element.pos.indexOf('en') > -1) ? 'en' : 'pl';
$(element.sense_examples).each(function(index2, element2) {
if (element2 != '') {
examples += '<p class="description">"' + element2 + '" - <i>' + PlWordnet.citeSource(element.sense_examples_sources[index2]) + '</i></p>';
}
});
if (examples == '') { examples = '-'; }
let data =
'<div class="plwordnet-box slides">' +
'<div class="fixed-space category"><span lang="pl">Słowo</span><span lang="en">Word</span></div>' +
'<div class="fixed-space">' +
'<h2 class="lemma">' + element.lemma + '</h2>' +
'<img class="img-responsive show-icon" src="/img/lang-' + language + '-32.png" alt="Language3" />' +
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
'<p class="description">' + definition + '</p>' +
'</div>' +
'<hr />' +
'<div class="fixed-space category"><span lang="pl">Domena</span><span lang="en">Domain</span></div>' +
'<div class="fixed-space">' +
'<p class="description">' + element.domain + '</p>' +
'</div>' +
'<hr />' +
'<div class="fixed-space category"><span lang="pl">Przykłady</span><span lang="en">Examples</span></div>' +
'<div class="fixed-space">' +
examples +
'</div>' +
'<hr />' +
'<div class="fixed-space category"><span lang="pl">Hiperonimy</span><span lang="en">Hiperonims</span></div>' +
'<div class="fixed-space">' +
'<p id="show-path" class="description" data-toggle="modal" data-target="#path-modal"><span lang="pl">Pokaż ścieżkę do najwyższego hiperonimu</span><span lang="en">Show path to the highest hiperonim</span></p>' +
'</div>' +
'<hr />' +
showEmotion(element) +
'</div>';
$('#lexpelement_plwordnet #plwordnet-box-right').append(data);
});
addArrows();
showSlides(slideIndex);
$('#lexpelement_plwordnet #plwordnet-box-right').append(
// '<p id="show-graph" class="description" data-toggle="modal" data-target="#graph-modal" onClick="PlWordnet.showGraph"><span lang="pl">Wyświetl wizualizację graficzną</span><span lang="en">Show graphic visualization</span></p>'
'<div class="fixed-space category"><span lang="pl">Graf</span><span lang="en">Graph</span></div>' +
'<div class="fixed-space">' +
'<p id="show-graph" class="description" data-toggle="modal" data-target="#graph-modal" onClick="PlWordnet.showGraph"><span lang="pl">Wyświetl wizualizację graficzną</span><span lang="en">Show graphic visualization</span></p>' +
'</div>'
);
$('#lexpelement_plwordnet').append(
'<div id="graph-visualisation">' +
'<div class="modal fade" id="graph-modal" role="dialog">' +
'<div class="modal-content">' +
'<div class="modal-header">' +
'<span data-dismiss="modal" class="close" id="aboutAppClose">×</span>' +
'<h2 lang="pl">Wizualizacja graficzna</h2>' +
'<h2 lang="en">Graphic visualisation</h2>' +
'</div>' +
'<div id="graph" class="modal-body"></div>' +
'<div class="modal-footer">webserwisy@clarin-pl.eu</div>' +
'</div>' +
'</div>' +
'</div>');
$('#lexpelement_plwordnet').append(
'<div id="path-visualisation">' +
'<div class="modal fade" id="path-modal" role="dialog">' +
'<div class="modal-content">' +
'<div class="modal-header">' +
'<span data-dismiss="modal" class="close" id="aboutAppClose">×</span>' +
'<h2 lang="pl">Wizualizacja graficzna</h2>' +
'<h2 lang="en">Graphic visualisation</h2>' +
'</div>' +
'<div id="path" class="modal-body">' +
'<svg id="path-to-highest-hiperonim"></svg>' +
// '<svg id="path-to-highest-hiperonim" viewBox="0 0 793 1122"></svg>' +
'</div>' +
'<div class="modal-footer">webserwisy@clarin-pl.eu</div>' +
'</div>' +
'</div>' +
'</div>');
$('#show-graph').on('click', function() {
setTimeout(function() {
showGraph(synsetID);
}, 200);
});
}
function showEmotion(element) {
let emotionEmotions = '',
emotionValuations = '',
emotionPolarity = element.emotion_markedness || '-',
emotionExamples = element.emotion_example || '-';
if (emotionPolarity in PlWordnet.emotionMap) {
emotionPolarity = PlWordnet.emotionMap[emotionPolarity];
}
$(element.emotion_names).each(function(index2, element2) {
if (element2 != '') {
emotionEmotions += (index2 == element.emotion_names.length - 1) ? element2 : element2 + ', ';
}
});
$(element.emotion_valuations).each(function(index2, element2) {
if (element2 != '') {
emotionValuations += (index2 == element.emotion_valuations.length - 1) ? element2 : element2 + ', ';
}
});
if (emotionEmotions == '' && emotionValuations == '' && emotionPolarity == '-' && emotionExamples == '-') {
return '';
}
if (emotionEmotions == '') { emotionEmotions = '-'; }
if (emotionValuations == '') { emotionValuations = '-'; }
let emotionHTML =
'<div class="fixed-space category"><span lang="pl">Annotacje emocjonalne</span><span lang="en">Emotional annotations</span></div>' +
'<div class="fixed-space">' +
'<div class="emotion-box">' +
'<div class="fixed-space-emotion category d-inline-block"><span lang="pl">Nacechowanie</span><span lang="en">Polarity</span></div>' +
'<div class="d-inline-block emotion-description">' + emotionPolarity + '</div>' +
'</div>' +
'<div class="emotion-box">' +
'<div class="fixed-space-emotion category d-inline-block"><span lang="pl">Emocje</span><span lang="en">Emotions</span></div>' +
'<div class="d-inline-block emotion-description">' + emotionEmotions + '</div>' +
'</div>' +
'<div class="emotion-box">' +
'<div class="fixed-space-emotion category d-inline-block"><span lang="pl">Wartościowanie</span><span lang="en">Valuations</span></div>' +
'<div class="d-inline-block emotion-description">' + emotionValuations + '</div>' +
'</div>' +
'<div class="emotion-box">' +
'<div class="fixed-space-emotion category d-inline-block"><span lang="pl">Przykłady</span><span lang="en">Examples</span></div>' +
'<div class="d-inline-block emotion-description">' + emotionExamples + '</div>' +
'</div>' +
'</div>' +
'<hr />';
return emotionHTML;
}
function showGraph(synsetID) {
let width = window.innerWidth - 200 || docEl.clientWidth - 200 || bodyEl.clientWidth - 200,
height = window.innerHeight - 200 || docEl.clientHeight - 200 || bodyEl.clientHeight - 200;
width = document.getElementById('graph').offsetWidth;
const graph = new GraphCreator.GraphCreator('graph', false, width, height);
graph.showMiniMap(.25, null, 0, 0);
graph.initializeFromSynsetId(synsetID);
}
function createNetworkGraph() {
console.log(PlWordnet.data.path);
let graph = PlWordnet.data.path;
let width = window.innerWidth - 200 || docEl.clientWidth - 200 || bodyEl.clientWidth - 200;
let height = window.innerHeight - 200 || docEl.clientHeight - 200 || bodyEl.clientHeight - 200;
let svg = d3.select("svg#path-to-highest-hiperonim")
.attr("width", width)
.attr("height", height)
.call(d3.zoom().on("zoom", function () {
svg.attr("transform", d3.event.transform);
}));
let simulation = d3.forceSimulation()
.force("link", d3.forceLink().id(function(d) { return d.id; }))
// .force("charge", d3.forceManyBody().strength(-5000).distanceMax(900).distanceMin(100))
.force("charge", d3.forceManyBody().strength(-2000).distanceMax(900).distanceMin(100))
.force("center", d3.forceCenter(width / 2, height / 2));
graph.links.forEach(function(d) {
d.source = d.source_id;
d.target = d.target_id;
});
let link = svg.append("g")
.style("stroke", "#AAA")
.selectAll("line")
.data(graph.links)
.enter().append("line");
let node = svg.append("g")
.attr("class", "nodes")
.selectAll("rect")
.data(graph.nodes)
.enter()
.append("rect")
.attr("x", function(d) { return d.x; })
.attr("y", function(d) { return d.y; })
.attr("width", 200)
.attr("height", 50)
.call(d3.drag()
.on("start", dragstarted)
.on("drag", dragged)
.on("end", dragended));
let label = svg.append("g")
.attr("class", "labels")
.selectAll("text")
.data(graph.nodes)
.enter().append("text")
.attr("class", "label")
.text(function(d) { return d.name; });
simulation.nodes(graph.nodes).on("tick", ticked);
simulation.force("link").links(graph.links);
function ticked() {
link.attr("x1", function(d) { return d.source.x + 100; })
.attr("y1", function(d) { return d.source.y; })
.attr("x2", function(d) { return d.target.x + 100; })
.attr("y2", function(d) { return d.target.y; });
node.style("fill", "#D9D9D9")
.style("stroke", "#969696")
.style("stroke-width", "1px")
.attr("x", function(d) { return d.x; })
.attr("y", function(d) { return d.y; })
.attr("width", 200)
.attr("height", 50)
label.attr("x", function(d) { return d.x + 20; })
.attr("y", function (d) { return d.y + 30; })
.style("font-size", "18px").style("fill", "#4393C3");
}
function dragstarted(d) {
if (!d3.event.active) {
simulation.alphaTarget(0.3).restart();
}
d.fx = d.x;
d.fy = d.y;
}
function dragged(d) {
d.fx = d3.event.x;
d.fy = d3.event.y;
}
function dragended(d) {
if (!d3.event.active) {
simulation.alphaTarget(0);
}
}
}
function addArrows() {
$('#plwordnet-box-right').append(
'<div id="arrow-left" onClick="plusSlides(-1)"><</div>' +
'<div id="arrow-right" onClick="plusSlides(1)">></div>'
);
}
var slideIndex = 1;
function plusSlides(n) {
showSlides(slideIndex += n);
}
function currentSlide(n) {
showSlides(slideIndex = n);
}
function showSlides(n) {
let i, slides = $(".slides");
if (n > slides.length) {slideIndex = 1}
if (n < 1) {slideIndex = slides.length}
for (i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
}
slides[slideIndex - 1].style.display = "block";
}
PlWordnet.prototype.showHTML = function(tag) {
if($('#type').val() == 'synsetid') {
this.showHTMLForSynset();
$('#lexpelement_plwordnet img').hide();
// Append Network Graph
createNetworkGraph();
} else {
tag.html("");
var _html =
'<div class="table-responsive" align="left">' +
'<table class="table">' +
'<thead>' +
'<tr>' +
'<th style="min-width: 110px">Synset ID</th>' +
'<th><span lang="pl">Jednostka</span><span lang="en">Lexical unit</span></th>' +
'<th><span lang="pl">Kwalifikator</span><span lang="en">Qualifier</span></th>' +
'<th><span lang="pl">Glosa</span><span lang="en">Gloss</span></th>' +
'<th> </th>' +
'<th><span lang="pl">Przykład użycia</span><span lang="en">Usage example</span></th>' +
'</tr>' +
'</thead>' +
'<tbody>';
for (var uid in this.data) {
var unit = this.data[uid];
// console.log(unit);
var spanb = "";
var spane = "";
if (unit.islemma) {
spanb = '<span style="color:green;">';
spane = '</span>';
}
_html += '<tr>';
if (unit.rowspan > 0) {
// _html += '<td rowspan=' + unit.rowspan + '>' + unit.synset +'</td>';
_html += '<td rowspan=' + unit.rowspan + '><a type="lexp" href="/synsetid/plwordnet/' + unit.synset +'">' + unit.synset + '</a></td>';
}
_html += '<td>' + spanb;
if (unit.islemma) {
_html += unit.unitname;
} else {
if($('#type').val() == 'synsetid') {
/* Synset way */
let language = window.location.href.split("/")[4];
x = unit.str.substr(0, unit.str.indexOf('('));
_html += '<a type="lexp" href="/lemma/' + language + '/' + unit.lemma + '">' + x + '</a>';
} else {
/* Normal way */
_html += '<a type="lexp" href="' + unit.url + '">' + unit.unitname + '</a>';
}
}
// console.log(unit);
var glosaLink = '';
if($('#type').val() == 'synsetid') {
/* Synset way */
if (unit.external_links.length > 0) {
glosaLink +=
'<a type="lexp" href="' + unit.external_links[0] + '" style="color: inherit;">' +
'<span lang="pl" data-toggle="tooltip" data-placement="top" title="ALink do zasobu zewnętrznego" class="source glyphicon glyphicon glyphicon-link"></span></a>' +
'<span lang="en" data-toggle="tooltip" data-placement="top" title="ALink for external resource" class="source glyphicon glyphicon glyphicon-link"></span></a>';
}
} else {
/* Normal way */
glosaLink = unit.link;
}
if($('#type').val() == 'synsetid') {
let definition = '',
example = '',
exampleLink = '',
qualifier = '';
if (unit.definition != null) {
definition = unit.definition;
}
if (unit.sense_examples[0] != undefined && unit.sense_examples[0] != null && unit.sense_examples[0].length != 0) {
example = unit.sense_examples[0];
}
if (unit.usage_notes[0] != undefined && unit.usage_notes[0] != null && unit.usage_notes[0].length != 0) {
qualifier = unit.usage_notes[0];
}
if (unit.sense_examples_sources != null && unit.sense_examples_sources.length != 0) {
exampleLink = unit.sense_examples_sources[0];
}
/* Synset way */
_html += spane + '</td>';
_html += '<td>' + spanb + '<span rel="tooltip" data-original-title="' + PlWordnet.fullQualifier(unit.qualifier)+'">' + qualifier + '</span>' + spane + '</td>';
_html += '<td>' + spanb + definition + spane + '</td>';
_html += '<td>' + glosaLink + '</td>';
_html += '<td>' + spanb + example + " #" + exampleLink + spane + '</td>';
_html += '</tr>';
} else {
let definition = '-',
examples = '-',
qualifier = '-';
console.log(unit);
if (unit.definition != null && unit.definition != '') {
definition = unit.definition;
}
if (unit.examples != null && unit.examples != '') {
examples = unit.examples;
}
if (unit.qualifier != null && unit.qualifier.length != 0) {
qualifier = unit.qualifier[0];
}
/* Normal way */
// console.log(unit.examples);
_html += spane + '</td>';
_html += '<td>' + spanb + '<span rel="tooltip" data-original-title="' + PlWordnet.fullQualifier(unit.qualifier)+'">'+ qualifier + '</span>' + spane + '</td>';
_html += '<td>' + spanb + definition + spane + '</td>';
_html += '<td>' + glosaLink + '</td>';
_html += '<td>' + spanb + examples + spane + '</td>';
_html += '</tr>';
}
}
_html += '</tbody></table></div>';
tag.html(_html);
tag.find("a[type='lexp']" ).click(PlWordnet.wordClick);
tag.find('[rel=tooltip]').tooltip();
}
}
PlWordnet.id = "plwordnet";
$(function () {
Element.addVisualizer(PlWordnet.id, PlWordnet);
$('#lexp_results').on('mouseup', '#lexpelement_plwordnet', function(event) {
let lemma = selectWord() || '',
lang = $('#lang').val(),
data = new Object();
data.lemma = lemma;
data.lang = lang || 'pl';
data.left = event.originalEvent.clientX - 80 || 0;
data.top = event.originalEvent.clientY - 55 || 0;
if (lemma.length < 10) {
data.left = event.originalEvent.clientX - 65 || 0;
}
positionTooltip(data);
});
});