diff --git a/semantics/static/js/semantics_lexical_units.js b/semantics/static/js/semantics_lexical_units.js index 9c15e85..ea4e33e 100644 --- a/semantics/static/js/semantics_lexical_units.js +++ b/semantics/static/js/semantics_lexical_units.js @@ -276,15 +276,16 @@ function getMeaningsSelectionForFrame(frame_id) { } function getFormForLexicalisation(lexicalisation) { - var result = ""; + var options = []; var i; for (i = 0; i < lexicalisation.length; i++) { var perms = permute(lexicalisation[i].args); var j; for (j = 0; j < perms.length; j++) { - result += lexicalisationForm(lexicalisation[i].lemma, lexicalisation[i].pre, cartesian(perms[j])); + options.push({lemma: lexicalisation[i].lemma, pre: lexicalisation[i].pre, post: cartesian(perms[j])}); } } + result = lexicalisationForm(options); return result; } @@ -332,19 +333,28 @@ function cartesian(llist) { return result; } -function lexicalisationForm(lemma, pre, tokenised) { - var list; - if (pre.length == 0) { - list = noSubjUnits(lemma, tokenised); - } else { - list = subjUnits(pre, lemma, tokenised); +function lexicalisationForm(lemmalist) { + var i; + var options = []; + for (k = 0; k < lemmalist.length; k++) { + var lemma = lemmalist[k].lemma; + var pre = lemmalist[k].pre; + var tokenised = lemmalist[k].post; + var list; + if (pre.length == 0) { + list = noSubjUnits(lemma, tokenised); + } else { + list = subjUnits(pre, lemma, tokenised); + } + options = options.concat(list); } + $.ajax({ type: "POST", dataType: "json", url: ajax_get_mwes, - data: {"options": JSON.stringify(list)}, + data: {"options": JSON.stringify(options)}, success: function(data){ list = data.mwes; },