PGF service & minibar: put a limit on the number of parse trees

+ In the PGF web service API, the commands parse, translate and translategroup
  now accept a limit parameter. It limits the number of parse trees returned.
  If no limit is given, the behaviour is backwards compatible, i.e. no limit
  is applied.
+ In minibar, the limit is now set to 25 by default.

This change is based on a suggestion by Kaarel Kaljurand.
This commit is contained in:
hallgren
2012-09-30 15:35:25 +00:00
parent 94e6ee62ec
commit ca58233bf7
3 changed files with 20 additions and 16 deletions

View File

@@ -14,7 +14,8 @@ function Translations(server,opts) {
tree_img_format: "png", // format for trees & alignment images,
// can be "gif", "png" or "svg"
show_grouped_translations: true,
show_brackets: false // show bracketed string
show_brackets: false, // show bracketed string
translate_limit: 25 // maximum number of parse trees to retrieve
}
// Apply supplied options
@@ -53,6 +54,7 @@ Translations.prototype.get_translations=function() {
with(this) {
var c=current;
var args={from:c.from,input:gf_unlex(c.input),cat:startcat}
if(options.translate_limit) args.limit=options.translate_limit
if(options.show_grouped_translations)
server.translategroup(args,bind(show_groupedtranslations,this));
else