semantics_connections.js
1.26 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
var connected = {}; // dictionaries of connections and disconnections between frames and schemas
var connected_reverse = {};
function getConnected(frame_id) { /* TODO */
return [];
}
function removeFrameConnections(frame_id) { /* TODO */
return;
}
function memorizeConnections(arguments_connected, frames_connection){
connected = arguments_connected;
connected_reverse = frames_connection;
}
function addConnections(arguments_connected, frames_connection){
var i;
for (i = 0; i < arguments_connected.length; i++) {
var argument = arguments_connected[i];
if (!connected.hasOwnProperty(argument)) {
connected[argument] = [];
}
}
}
function removeArgumentConnections(frame_id, complement_id) {
for (var argument in connected) {
if (argument == 'frame_' + frame_id + '_comp_' + complement_id + '_' ||
argument == 'frame_' + frame_id + '_comp_' + complement_id + '_lemma_') {
var i;
for (i = 0; i < connected[argument].length; i++) {
var idx = connected_reverse[connected[argument][i]].indexOf('frame_' + frame_id + '_');
connected_reverse[connected[argument][i]].splice(idx, 1);
}
connected[argument] = [];
}
}
return;
}