semantics_preferences.js
3.1 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
var predefined = [];
var relations = [];
var synsets = [];
function predefinedSelect() {
var display = "";
var i;
for (i = 0; i < predefined.length; i++) {
display += "<input type = \"checkbox\" name = \"predef\" value = \"" + predefined[i].id + "\">" + predefined[i].content + "<br>";
}
return display;
}
function getPredefinedSelections() {
$.ajax({
url: ajax_predefined_preferences,
success: function(data){
predefined = data.predefined;
},
async: false
});
}
function memorizeRelations(new_relations) {
relations = new_relations;
}
function relationsSelect() {
var display = "<select name = \"rel\">";
var i;
for (i = 0; i < relations.length; i++) {
display += "<option value = \"" + relations[i].id + "\">" + relations[i].content + "</option>";
}
display += "</select>"
return display;
}
function argumentSelect(argument) {
var frame_id = parseInt(argument.split('_')[1]);
var complement_id = parseInt(argument.split('_')[3]);
var display = "<select name = \"arg\">";
var i;
for (i = 0; i < frame_content[frame_id].display.roles.length; i++) {
var local_complement_id = parseInt(frame_content[frame_id].display.roles[i].csv_class.split('_')[3]);
if (local_complement_id != complement_id) {
var list = frame_content[frame_id].display.roles[i].argument;
var text = [];
var j;
for (j = 0; j < list.length; j++) {
text.push(role_name[list[j]]);
}
display += "<option value = \"" + list + "\">" + text + "</option>";
}
}
display += "</select>"
return display;
}
function getSynsets(context, pos) {
if ((typeof pos) == 'undefined') {
pos = '_';
}
$.ajax({
dataType: "json",
url: ajax_synsets,
data: {base: context, pos: pos},
success: function(data){ synsets = data.synsets },
async: false
});
var display = "";
var i;
for (i = 0; i < synsets.length; i++) {
display += "<input type = \"radio\" name = \"synset\" value = \"" + synsets[i].id + "\"><div>";
var j;
for (j = 0; j < synsets[i].content.length; j++) {
var lexical_unit = synsets[i].content[j];
display += lexical_unit.base + "-" + lexical_unit.sense + ": <i>" + lexical_unit.glossa + "</i><br>";
}
display += "</div>";
}
return display;
}
function relationArgument(argument) {
return relationsSelect() + "<br><br>" + argumentSelect(argument);
}
function attachPlWNContextAutocomplete() {
$('#plWN_context_selection').autocomplete({
select: function(event, ui){
},
source: function(req, add){
$.getJSON(ajax_plWN_context_lookup, req, function(data) {
var suggestions = [];
$.each(data['result'], function(i, val){
suggestions.push(val);
});
add(suggestions);
});
},
});
}