UNPKG

speech-rule-engine

Version:

A standalone speech rule engine for XML structures, based on the original engine from ChromeVox.

27 lines 1.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CaseCollapsedScript = void 0; const abstract_enrich_case_js_1 = require("./abstract_enrich_case.js"); const enrich_mathml_js_1 = require("./enrich_mathml.js"); const enrich_attr_js_1 = require("./enrich_attr.js"); class CaseCollapsedScript extends abstract_enrich_case_js_1.AbstractEnrichCase { static test(semantic) { var _a, _b; const ann = semantic.getAnnotation('collapsed'); if (!ann.length) { return false; } return ((_b = (_a = semantic.mathmlTree) === null || _a === void 0 ? void 0 : _a.parentNode) === null || _b === void 0 ? void 0 : _b.childNodes.length) > 2; } getMathml() { (0, enrich_mathml_js_1.walkTree)(this.semantic.childNodes[0]); (0, enrich_mathml_js_1.walkTree)(this.semantic.childNodes[1]); const collapsed = this.semantic.mathmlTree; const script = this.semantic.childNodes[0].mathmlTree; const newNode = (0, enrich_mathml_js_1.introduceNewLayer)([script, collapsed], this.semantic); (0, enrich_attr_js_1.setAttributes)(newNode, this.semantic); return newNode; } } exports.CaseCollapsedScript = CaseCollapsedScript; //# sourceMappingURL=case_collapsed_script.js.map