Commit 3905c26b0a9b89875faf4b2cb6c2fb2e46ee4c42
1 parent
eb3dd976
usunięcie powtórzeń lematu wieloczłonowego z listy 'zmień jednostki leksykalne'
Showing
1 changed file
with
19 additions
and
9 deletions
semantics/static/js/semantics_lexical_units.js
@@ -276,15 +276,16 @@ function getMeaningsSelectionForFrame(frame_id) { | @@ -276,15 +276,16 @@ function getMeaningsSelectionForFrame(frame_id) { | ||
276 | } | 276 | } |
277 | 277 | ||
278 | function getFormForLexicalisation(lexicalisation) { | 278 | function getFormForLexicalisation(lexicalisation) { |
279 | - var result = ""; | 279 | + var options = []; |
280 | var i; | 280 | var i; |
281 | for (i = 0; i < lexicalisation.length; i++) { | 281 | for (i = 0; i < lexicalisation.length; i++) { |
282 | var perms = permute(lexicalisation[i].args); | 282 | var perms = permute(lexicalisation[i].args); |
283 | var j; | 283 | var j; |
284 | for (j = 0; j < perms.length; j++) { | 284 | for (j = 0; j < perms.length; j++) { |
285 | - result += lexicalisationForm(lexicalisation[i].lemma, lexicalisation[i].pre, cartesian(perms[j])); | 285 | + options.push({lemma: lexicalisation[i].lemma, pre: lexicalisation[i].pre, post: cartesian(perms[j])}); |
286 | } | 286 | } |
287 | } | 287 | } |
288 | + result = lexicalisationForm(options); | ||
288 | return result; | 289 | return result; |
289 | } | 290 | } |
290 | 291 | ||
@@ -332,19 +333,28 @@ function cartesian(llist) { | @@ -332,19 +333,28 @@ function cartesian(llist) { | ||
332 | return result; | 333 | return result; |
333 | } | 334 | } |
334 | 335 | ||
335 | -function lexicalisationForm(lemma, pre, tokenised) { | ||
336 | - var list; | ||
337 | - if (pre.length == 0) { | ||
338 | - list = noSubjUnits(lemma, tokenised); | ||
339 | - } else { | ||
340 | - list = subjUnits(pre, lemma, tokenised); | 336 | +function lexicalisationForm(lemmalist) { |
337 | + var i; | ||
338 | + var options = []; | ||
339 | + for (k = 0; k < lemmalist.length; k++) { | ||
340 | + var lemma = lemmalist[k].lemma; | ||
341 | + var pre = lemmalist[k].pre; | ||
342 | + var tokenised = lemmalist[k].post; | ||
343 | + var list; | ||
344 | + if (pre.length == 0) { | ||
345 | + list = noSubjUnits(lemma, tokenised); | ||
346 | + } else { | ||
347 | + list = subjUnits(pre, lemma, tokenised); | ||
348 | + } | ||
349 | + options = options.concat(list); | ||
341 | } | 350 | } |
342 | 351 | ||
352 | + | ||
343 | $.ajax({ | 353 | $.ajax({ |
344 | type: "POST", | 354 | type: "POST", |
345 | dataType: "json", | 355 | dataType: "json", |
346 | url: ajax_get_mwes, | 356 | url: ajax_get_mwes, |
347 | - data: {"options": JSON.stringify(list)}, | 357 | + data: {"options": JSON.stringify(options)}, |
348 | success: function(data){ | 358 | success: function(data){ |
349 | list = data.mwes; | 359 | list = data.mwes; |
350 | }, | 360 | }, |