Warning: session_start(): open(/var/lib/php/sessions/sess_be3m3a01450lo52m0e0b1undfc, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
sclass PTElement {
AI_BottomUpParser1.Word word;
double weight = 1, totalWeight;
L children;
PTElement parent;
S plusWeight(S s) {
if (weight == 1 && totalWeight == 1) ret s;
S a = formatDouble(weight, 2), b = formatDouble(totalWeight, 2);
ret s + " [" + a + (eq(a, b) ? "" : ", total " + b) + "]";
}
S text() { ret word == null ? null : word.text(); }
}
sclass ChooseCategory extends PTElement {
L categories;
*(AI_BottomUpParser1.Word *word, L *categories) {}
toString { ret plusWeight(word.text() + " (" + n2(categories, "category", "categories") + ")"); }
}
sclass HaveCategory extends PTElement {
S category;
ai_Reconstructed reconstruction; // optional
*(AI_BottomUpParser1.Word *word, S *category) {}
*(AI_BottomUpParser1.Word *word, S *category, ai_Reconstructed *reconstruction) {}
toString { ret plusWeight(quote(word.text()) + " as " + category); }
}
sclass ChoosePart extends PTElement {
ai_Reconstructed reconstruction;
*(AI_BottomUpParser1.Word *word, ai_Reconstructed *reconstruction) {}
toString {
S hint = reconstruction.production.simplificationHint;
ret plusWeight(
reconstruction.a.text() + " + " + reconstruction.b.text()
+ " [" + reconstruction.production + "]");
}
}