26301 lines
964 KiB
JavaScript
26301 lines
964 KiB
JavaScript
// Copyright 2014-2019 Volker Sorge
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
/*
|
|
|
|
Copyright The Closure Library Authors.
|
|
SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
var $jscomp = $jscomp || {};
|
|
$jscomp.scope = {};
|
|
$jscomp.arrayIteratorImpl = function (a) {
|
|
var b = 0;
|
|
return function () {
|
|
return b < a.length ? { done: !1, value: a[b++] } : { done: !0 };
|
|
};
|
|
};
|
|
$jscomp.arrayIterator = function (a) {
|
|
return { next: $jscomp.arrayIteratorImpl(a) };
|
|
};
|
|
$jscomp.makeIterator = function (a) {
|
|
var b = "undefined" != typeof Symbol && Symbol.iterator && a[Symbol.iterator];
|
|
return b ? b.call(a) : $jscomp.arrayIterator(a);
|
|
};
|
|
$jscomp.arrayFromIterator = function (a) {
|
|
for (var b, c = []; !(b = a.next()).done; ) c.push(b.value);
|
|
return c;
|
|
};
|
|
$jscomp.ASSUME_ES5 = !1;
|
|
$jscomp.ASSUME_NO_NATIVE_MAP = !1;
|
|
$jscomp.ASSUME_NO_NATIVE_SET = !1;
|
|
$jscomp.SIMPLE_FROUND_POLYFILL = !1;
|
|
$jscomp.ISOLATE_POLYFILLS = !1;
|
|
$jscomp.defineProperty =
|
|
$jscomp.ASSUME_ES5 || "function" == typeof Object.defineProperties
|
|
? Object.defineProperty
|
|
: function (a, b, c) {
|
|
if (a == Array.prototype || a == Object.prototype) return a;
|
|
a[b] = c.value;
|
|
return a;
|
|
};
|
|
$jscomp.getGlobal = function (a) {
|
|
a = [
|
|
"object" == typeof globalThis && globalThis,
|
|
a,
|
|
"object" == typeof window && window,
|
|
"object" == typeof self && self,
|
|
"object" == typeof global && global,
|
|
];
|
|
for (var b = 0; b < a.length; ++b) {
|
|
var c = a[b];
|
|
if (c && c.Math == Math) return c;
|
|
}
|
|
throw Error("Cannot find global object");
|
|
};
|
|
$jscomp.global = $jscomp.getGlobal(this);
|
|
$jscomp.IS_SYMBOL_NATIVE =
|
|
"function" === typeof Symbol && "symbol" === typeof Symbol("x");
|
|
$jscomp.TRUST_ES6_POLYFILLS =
|
|
!$jscomp.ISOLATE_POLYFILLS || $jscomp.IS_SYMBOL_NATIVE;
|
|
$jscomp.polyfills = {};
|
|
$jscomp.propertyToPolyfillSymbol = {};
|
|
$jscomp.POLYFILL_PREFIX = "$jscp$";
|
|
var $jscomp$lookupPolyfilledValue = function (a, b) {
|
|
var c = $jscomp.propertyToPolyfillSymbol[b];
|
|
if (null == c) return a[b];
|
|
c = a[c];
|
|
return void 0 !== c ? c : a[b];
|
|
};
|
|
$jscomp.polyfill = function (a, b, c, d) {
|
|
b &&
|
|
($jscomp.ISOLATE_POLYFILLS
|
|
? $jscomp.polyfillIsolated(a, b, c, d)
|
|
: $jscomp.polyfillUnisolated(a, b, c, d));
|
|
};
|
|
$jscomp.polyfillUnisolated = function (a, b, c, d) {
|
|
c = $jscomp.global;
|
|
a = a.split(".");
|
|
for (d = 0; d < a.length - 1; d++) {
|
|
var e = a[d];
|
|
if (!(e in c)) return;
|
|
c = c[e];
|
|
}
|
|
a = a[a.length - 1];
|
|
d = c[a];
|
|
b = b(d);
|
|
b != d &&
|
|
null != b &&
|
|
$jscomp.defineProperty(c, a, { configurable: !0, writable: !0, value: b });
|
|
};
|
|
$jscomp.polyfillIsolated = function (a, b, c, d) {
|
|
var e = a.split(".");
|
|
a = 1 === e.length;
|
|
d = e[0];
|
|
d = !a && d in $jscomp.polyfills ? $jscomp.polyfills : $jscomp.global;
|
|
for (var f = 0; f < e.length - 1; f++) {
|
|
var g = e[f];
|
|
if (!(g in d)) return;
|
|
d = d[g];
|
|
}
|
|
e = e[e.length - 1];
|
|
c = $jscomp.IS_SYMBOL_NATIVE && "es6" === c ? d[e] : null;
|
|
b = b(c);
|
|
null != b &&
|
|
(a
|
|
? $jscomp.defineProperty($jscomp.polyfills, e, {
|
|
configurable: !0,
|
|
writable: !0,
|
|
value: b,
|
|
})
|
|
: b !== c &&
|
|
(($jscomp.propertyToPolyfillSymbol[e] = $jscomp.IS_SYMBOL_NATIVE
|
|
? $jscomp.global.Symbol(e)
|
|
: $jscomp.POLYFILL_PREFIX + e),
|
|
(e = $jscomp.propertyToPolyfillSymbol[e]),
|
|
$jscomp.defineProperty(d, e, {
|
|
configurable: !0,
|
|
writable: !0,
|
|
value: b,
|
|
})));
|
|
};
|
|
$jscomp.initSymbol = function () {};
|
|
$jscomp.polyfill(
|
|
"Symbol",
|
|
function (a) {
|
|
if (a) return a;
|
|
var b = function (e, f) {
|
|
this.$jscomp$symbol$id_ = e;
|
|
$jscomp.defineProperty(this, "description", {
|
|
configurable: !0,
|
|
writable: !0,
|
|
value: f,
|
|
});
|
|
};
|
|
b.prototype.toString = function () {
|
|
return this.$jscomp$symbol$id_;
|
|
};
|
|
var c = 0,
|
|
d = function (e) {
|
|
if (this instanceof d)
|
|
throw new TypeError("Symbol is not a constructor");
|
|
return new b("jscomp_symbol_" + (e || "") + "_" + c++, e);
|
|
};
|
|
return d;
|
|
},
|
|
"es6",
|
|
"es3",
|
|
);
|
|
$jscomp.initSymbolIterator = function () {};
|
|
$jscomp.polyfill(
|
|
"Symbol.iterator",
|
|
function (a) {
|
|
if (a) return a;
|
|
a = Symbol("Symbol.iterator");
|
|
for (
|
|
var b =
|
|
"Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(
|
|
" ",
|
|
),
|
|
c = 0;
|
|
c < b.length;
|
|
c++
|
|
) {
|
|
var d = $jscomp.global[b[c]];
|
|
"function" === typeof d &&
|
|
"function" != typeof d.prototype[a] &&
|
|
$jscomp.defineProperty(d.prototype, a, {
|
|
configurable: !0,
|
|
writable: !0,
|
|
value: function () {
|
|
return $jscomp.iteratorPrototype($jscomp.arrayIteratorImpl(this));
|
|
},
|
|
});
|
|
}
|
|
return a;
|
|
},
|
|
"es6",
|
|
"es3",
|
|
);
|
|
$jscomp.initSymbolAsyncIterator = function () {};
|
|
$jscomp.iteratorPrototype = function (a) {
|
|
a = { next: a };
|
|
a[Symbol.iterator] = function () {
|
|
return this;
|
|
};
|
|
return a;
|
|
};
|
|
$jscomp.iteratorFromArray = function (a, b) {
|
|
a instanceof String && (a += "");
|
|
var c = 0,
|
|
d = {
|
|
next: function () {
|
|
if (c < a.length) {
|
|
var e = c++;
|
|
return { value: b(e, a[e]), done: !1 };
|
|
}
|
|
d.next = function () {
|
|
return { done: !0, value: void 0 };
|
|
};
|
|
return d.next();
|
|
},
|
|
};
|
|
d[Symbol.iterator] = function () {
|
|
return d;
|
|
};
|
|
return d;
|
|
};
|
|
$jscomp.polyfill(
|
|
"Array.prototype.keys",
|
|
function (a) {
|
|
return a
|
|
? a
|
|
: function () {
|
|
return $jscomp.iteratorFromArray(this, function (b) {
|
|
return b;
|
|
});
|
|
};
|
|
},
|
|
"es6",
|
|
"es3",
|
|
);
|
|
$jscomp.findInternal = function (a, b, c) {
|
|
a instanceof String && (a = String(a));
|
|
for (var d = a.length, e = 0; e < d; e++) {
|
|
var f = a[e];
|
|
if (b.call(c, f, e, a)) return { i: e, v: f };
|
|
}
|
|
return { i: -1, v: void 0 };
|
|
};
|
|
$jscomp.polyfill(
|
|
"Array.prototype.find",
|
|
function (a) {
|
|
return a
|
|
? a
|
|
: function (b, c) {
|
|
return $jscomp.findInternal(this, b, c).v;
|
|
};
|
|
},
|
|
"es6",
|
|
"es3",
|
|
);
|
|
$jscomp.checkStringArgs = function (a, b, c) {
|
|
if (null == a)
|
|
throw new TypeError(
|
|
"The 'this' value for String.prototype." +
|
|
c +
|
|
" must not be null or undefined",
|
|
);
|
|
if (b instanceof RegExp)
|
|
throw new TypeError(
|
|
"First argument to String.prototype." +
|
|
c +
|
|
" must not be a regular expression",
|
|
);
|
|
return a + "";
|
|
};
|
|
$jscomp.polyfill(
|
|
"String.prototype.repeat",
|
|
function (a) {
|
|
return a
|
|
? a
|
|
: function (b) {
|
|
var c = $jscomp.checkStringArgs(this, null, "repeat");
|
|
if (0 > b || 1342177279 < b)
|
|
throw new RangeError("Invalid count value");
|
|
b |= 0;
|
|
for (var d = ""; b; ) if ((b & 1 && (d += c), (b >>>= 1))) c += c;
|
|
return d;
|
|
};
|
|
},
|
|
"es6",
|
|
"es3",
|
|
);
|
|
var COMPILED = !0,
|
|
goog = goog || {};
|
|
goog.global = this || self;
|
|
goog.exportPath_ = function (a, b, c) {
|
|
a = a.split(".");
|
|
c = c || goog.global;
|
|
a[0] in c ||
|
|
"undefined" == typeof c.execScript ||
|
|
c.execScript("var " + a[0]);
|
|
for (var d; a.length && (d = a.shift()); )
|
|
a.length || void 0 === b
|
|
? (c = c[d] && c[d] !== Object.prototype[d] ? c[d] : (c[d] = {}))
|
|
: (c[d] = b);
|
|
};
|
|
goog.define = function (a, b) {
|
|
if (!COMPILED) {
|
|
var c = goog.global.CLOSURE_UNCOMPILED_DEFINES,
|
|
d = goog.global.CLOSURE_DEFINES;
|
|
c && void 0 === c.nodeType && Object.prototype.hasOwnProperty.call(c, a)
|
|
? (b = c[a])
|
|
: d &&
|
|
void 0 === d.nodeType &&
|
|
Object.prototype.hasOwnProperty.call(d, a) &&
|
|
(b = d[a]);
|
|
}
|
|
return b;
|
|
};
|
|
goog.FEATURESET_YEAR = 2012;
|
|
goog.DEBUG = !0;
|
|
goog.LOCALE = "en";
|
|
goog.TRUSTED_SITE = !0;
|
|
goog.STRICT_MODE_COMPATIBLE = !1;
|
|
goog.DISALLOW_TEST_ONLY_CODE = COMPILED && !goog.DEBUG;
|
|
goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING = !1;
|
|
goog.provide = function (a) {
|
|
if (goog.isInModuleLoader_())
|
|
throw Error("goog.provide cannot be used within a module.");
|
|
if (!COMPILED && goog.isProvided_(a))
|
|
throw Error('Namespace "' + a + '" already declared.');
|
|
goog.constructNamespace_(a);
|
|
};
|
|
goog.constructNamespace_ = function (a, b) {
|
|
if (!COMPILED) {
|
|
delete goog.implicitNamespaces_[a];
|
|
for (
|
|
var c = a;
|
|
(c = c.substring(0, c.lastIndexOf("."))) && !goog.getObjectByName(c);
|
|
)
|
|
goog.implicitNamespaces_[c] = !0;
|
|
}
|
|
goog.exportPath_(a, b);
|
|
};
|
|
goog.getScriptNonce = function (a) {
|
|
if (a && a != goog.global) return goog.getScriptNonce_(a.document);
|
|
null === goog.cspNonce_ &&
|
|
(goog.cspNonce_ = goog.getScriptNonce_(goog.global.document));
|
|
return goog.cspNonce_;
|
|
};
|
|
goog.NONCE_PATTERN_ = /^[\w+/_-]+[=]{0,2}$/;
|
|
goog.cspNonce_ = null;
|
|
goog.getScriptNonce_ = function (a) {
|
|
return (a = a.querySelector && a.querySelector("script[nonce]")) &&
|
|
(a = a.nonce || a.getAttribute("nonce")) &&
|
|
goog.NONCE_PATTERN_.test(a)
|
|
? a
|
|
: "";
|
|
};
|
|
goog.VALID_MODULE_RE_ = /^[a-zA-Z_$][a-zA-Z0-9._$]*$/;
|
|
goog.module = function (a) {
|
|
if ("string" !== typeof a || !a || -1 == a.search(goog.VALID_MODULE_RE_))
|
|
throw Error("Invalid module identifier");
|
|
if (!goog.isInGoogModuleLoader_())
|
|
throw Error(
|
|
"Module " +
|
|
a +
|
|
" has been loaded incorrectly. Note, modules cannot be loaded as normal scripts. They require some kind of pre-processing step. You're likely trying to load a module via a script tag or as a part of a concatenated bundle without rewriting the module. For more info see: https://github.com/google/closure-library/wiki/goog.module:-an-ES6-module-like-alternative-to-goog.provide.",
|
|
);
|
|
if (goog.moduleLoaderState_.moduleName)
|
|
throw Error("goog.module may only be called once per module.");
|
|
goog.moduleLoaderState_.moduleName = a;
|
|
if (!COMPILED) {
|
|
if (goog.isProvided_(a))
|
|
throw Error('Namespace "' + a + '" already declared.');
|
|
delete goog.implicitNamespaces_[a];
|
|
}
|
|
};
|
|
goog.module.get = function (a) {
|
|
return goog.module.getInternal_(a);
|
|
};
|
|
goog.module.getInternal_ = function (a) {
|
|
if (!COMPILED) {
|
|
if (a in goog.loadedModules_) return goog.loadedModules_[a].exports;
|
|
if (!goog.implicitNamespaces_[a])
|
|
return (a = goog.getObjectByName(a)), null != a ? a : null;
|
|
}
|
|
return null;
|
|
};
|
|
goog.ModuleType = { ES6: "es6", GOOG: "goog" };
|
|
goog.moduleLoaderState_ = null;
|
|
goog.isInModuleLoader_ = function () {
|
|
return goog.isInGoogModuleLoader_() || goog.isInEs6ModuleLoader_();
|
|
};
|
|
goog.isInGoogModuleLoader_ = function () {
|
|
return (
|
|
!!goog.moduleLoaderState_ &&
|
|
goog.moduleLoaderState_.type == goog.ModuleType.GOOG
|
|
);
|
|
};
|
|
goog.isInEs6ModuleLoader_ = function () {
|
|
if (
|
|
goog.moduleLoaderState_ &&
|
|
goog.moduleLoaderState_.type == goog.ModuleType.ES6
|
|
)
|
|
return !0;
|
|
var a = goog.global.$jscomp;
|
|
return a
|
|
? "function" != typeof a.getCurrentModulePath
|
|
? !1
|
|
: !!a.getCurrentModulePath()
|
|
: !1;
|
|
};
|
|
goog.module.declareLegacyNamespace = function () {
|
|
if (!COMPILED && !goog.isInGoogModuleLoader_())
|
|
throw Error(
|
|
"goog.module.declareLegacyNamespace must be called from within a goog.module",
|
|
);
|
|
if (!COMPILED && !goog.moduleLoaderState_.moduleName)
|
|
throw Error(
|
|
"goog.module must be called prior to goog.module.declareLegacyNamespace.",
|
|
);
|
|
goog.moduleLoaderState_.declareLegacyNamespace = !0;
|
|
};
|
|
goog.declareModuleId = function (a) {
|
|
if (!COMPILED) {
|
|
if (!goog.isInEs6ModuleLoader_())
|
|
throw Error(
|
|
"goog.declareModuleId may only be called from within an ES6 module",
|
|
);
|
|
if (goog.moduleLoaderState_ && goog.moduleLoaderState_.moduleName)
|
|
throw Error("goog.declareModuleId may only be called once per module.");
|
|
if (a in goog.loadedModules_)
|
|
throw Error('Module with namespace "' + a + '" already exists.');
|
|
}
|
|
if (goog.moduleLoaderState_) goog.moduleLoaderState_.moduleName = a;
|
|
else {
|
|
var b = goog.global.$jscomp;
|
|
if (!b || "function" != typeof b.getCurrentModulePath)
|
|
throw Error(
|
|
'Module with namespace "' + a + '" has been loaded incorrectly.',
|
|
);
|
|
b = b.require(b.getCurrentModulePath());
|
|
goog.loadedModules_[a] = {
|
|
exports: b,
|
|
type: goog.ModuleType.ES6,
|
|
moduleId: a,
|
|
};
|
|
}
|
|
};
|
|
goog.setTestOnly = function (a) {
|
|
if (goog.DISALLOW_TEST_ONLY_CODE)
|
|
throw (
|
|
((a = a || ""),
|
|
Error(
|
|
"Importing test-only code into non-debug environment" +
|
|
(a ? ": " + a : "."),
|
|
))
|
|
);
|
|
};
|
|
goog.forwardDeclare = function (a) {};
|
|
COMPILED ||
|
|
((goog.isProvided_ = function (a) {
|
|
return (
|
|
a in goog.loadedModules_ ||
|
|
(!goog.implicitNamespaces_[a] && null != goog.getObjectByName(a))
|
|
);
|
|
}),
|
|
(goog.implicitNamespaces_ = { "goog.module": !0 }));
|
|
goog.getObjectByName = function (a, b) {
|
|
a = a.split(".");
|
|
b = b || goog.global;
|
|
for (var c = 0; c < a.length; c++)
|
|
if (((b = b[a[c]]), null == b)) return null;
|
|
return b;
|
|
};
|
|
goog.globalize = function (a, b) {
|
|
b = b || goog.global;
|
|
for (var c in a) b[c] = a[c];
|
|
};
|
|
goog.addDependency = function (a, b, c, d) {
|
|
!COMPILED &&
|
|
goog.DEPENDENCIES_ENABLED &&
|
|
goog.debugLoader_.addDependency(a, b, c, d);
|
|
};
|
|
goog.ENABLE_DEBUG_LOADER = !0;
|
|
goog.logToConsole_ = function (a) {
|
|
goog.global.console && goog.global.console.error(a);
|
|
};
|
|
goog.require = function (a) {
|
|
if (!COMPILED) {
|
|
goog.ENABLE_DEBUG_LOADER && goog.debugLoader_.requested(a);
|
|
if (goog.isProvided_(a)) {
|
|
if (goog.isInModuleLoader_()) return goog.module.getInternal_(a);
|
|
} else if (goog.ENABLE_DEBUG_LOADER) {
|
|
var b = goog.moduleLoaderState_;
|
|
goog.moduleLoaderState_ = null;
|
|
try {
|
|
goog.debugLoader_.load_(a);
|
|
} finally {
|
|
goog.moduleLoaderState_ = b;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
};
|
|
goog.requireType = function (a) {
|
|
return {};
|
|
};
|
|
goog.basePath = "";
|
|
goog.nullFunction = function () {};
|
|
goog.abstractMethod = function () {
|
|
throw Error("unimplemented abstract method");
|
|
};
|
|
goog.addSingletonGetter = function (a) {
|
|
a.instance_ = void 0;
|
|
a.getInstance = function () {
|
|
if (a.instance_) return a.instance_;
|
|
goog.DEBUG &&
|
|
(goog.instantiatedSingletons_[goog.instantiatedSingletons_.length] = a);
|
|
return (a.instance_ = new a());
|
|
};
|
|
};
|
|
goog.instantiatedSingletons_ = [];
|
|
goog.LOAD_MODULE_USING_EVAL = !0;
|
|
goog.SEAL_MODULE_EXPORTS = goog.DEBUG;
|
|
goog.loadedModules_ = {};
|
|
goog.DEPENDENCIES_ENABLED = !COMPILED && goog.ENABLE_DEBUG_LOADER;
|
|
goog.TRANSPILE = "detect";
|
|
goog.ASSUME_ES_MODULES_TRANSPILED = !1;
|
|
goog.TRANSPILE_TO_LANGUAGE = "";
|
|
goog.TRANSPILER = "transpile.js";
|
|
goog.hasBadLetScoping = null;
|
|
goog.useSafari10Workaround = function () {
|
|
if (null == goog.hasBadLetScoping) {
|
|
try {
|
|
var a = !eval(
|
|
'"use strict";let x = 1; function f() { return typeof x; };f() == "number";',
|
|
);
|
|
} catch (b) {
|
|
a = !1;
|
|
}
|
|
goog.hasBadLetScoping = a;
|
|
}
|
|
return goog.hasBadLetScoping;
|
|
};
|
|
goog.workaroundSafari10EvalBug = function (a) {
|
|
return "(function(){" + a + "\n;})();\n";
|
|
};
|
|
goog.loadModule = function (a) {
|
|
var b = goog.moduleLoaderState_;
|
|
try {
|
|
goog.moduleLoaderState_ = {
|
|
moduleName: "",
|
|
declareLegacyNamespace: !1,
|
|
type: goog.ModuleType.GOOG,
|
|
};
|
|
if (goog.isFunction(a)) var c = a.call(void 0, {});
|
|
else if ("string" === typeof a)
|
|
goog.useSafari10Workaround() && (a = goog.workaroundSafari10EvalBug(a)),
|
|
(c = goog.loadModuleFromSource_.call(void 0, a));
|
|
else throw Error("Invalid module definition");
|
|
var d = goog.moduleLoaderState_.moduleName;
|
|
if ("string" === typeof d && d)
|
|
goog.moduleLoaderState_.declareLegacyNamespace
|
|
? goog.constructNamespace_(d, c)
|
|
: goog.SEAL_MODULE_EXPORTS &&
|
|
Object.seal &&
|
|
"object" == typeof c &&
|
|
null != c &&
|
|
Object.seal(c),
|
|
(goog.loadedModules_[d] = {
|
|
exports: c,
|
|
type: goog.ModuleType.GOOG,
|
|
moduleId: goog.moduleLoaderState_.moduleName,
|
|
});
|
|
else throw Error('Invalid module name "' + d + '"');
|
|
} finally {
|
|
goog.moduleLoaderState_ = b;
|
|
}
|
|
};
|
|
goog.loadModuleFromSource_ = function (a) {
|
|
eval(a);
|
|
return {};
|
|
};
|
|
goog.normalizePath_ = function (a) {
|
|
a = a.split("/");
|
|
for (var b = 0; b < a.length; )
|
|
"." == a[b]
|
|
? a.splice(b, 1)
|
|
: b && ".." == a[b] && a[b - 1] && ".." != a[b - 1]
|
|
? a.splice(--b, 2)
|
|
: b++;
|
|
return a.join("/");
|
|
};
|
|
goog.loadFileSync_ = function (a) {
|
|
if (goog.global.CLOSURE_LOAD_FILE_SYNC)
|
|
return goog.global.CLOSURE_LOAD_FILE_SYNC(a);
|
|
try {
|
|
var b = new goog.global.XMLHttpRequest();
|
|
b.open("get", a, !1);
|
|
b.send();
|
|
return 0 == b.status || 200 == b.status ? b.responseText : null;
|
|
} catch (c) {
|
|
return null;
|
|
}
|
|
};
|
|
goog.transpile_ = function (a, b, c) {
|
|
var d = goog.global.$jscomp;
|
|
d || (goog.global.$jscomp = d = {});
|
|
var e = d.transpile;
|
|
if (!e) {
|
|
var f = goog.basePath + goog.TRANSPILER,
|
|
g = goog.loadFileSync_(f);
|
|
if (g) {
|
|
(function () {
|
|
(0, eval)(g + "\n//# sourceURL=" + f);
|
|
}).call(goog.global);
|
|
if (
|
|
goog.global.$gwtExport &&
|
|
goog.global.$gwtExport.$jscomp &&
|
|
!goog.global.$gwtExport.$jscomp.transpile
|
|
)
|
|
throw Error(
|
|
'The transpiler did not properly export the "transpile" method. $gwtExport: ' +
|
|
JSON.stringify(goog.global.$gwtExport),
|
|
);
|
|
goog.global.$jscomp.transpile = goog.global.$gwtExport.$jscomp.transpile;
|
|
d = goog.global.$jscomp;
|
|
e = d.transpile;
|
|
}
|
|
}
|
|
e ||
|
|
(e = d.transpile =
|
|
function (h, k) {
|
|
goog.logToConsole_(
|
|
k + " requires transpilation but no transpiler was found.",
|
|
);
|
|
return h;
|
|
});
|
|
return e(a, b, c);
|
|
};
|
|
goog.typeOf = function (a) {
|
|
var b = typeof a;
|
|
if ("object" == b)
|
|
if (a) {
|
|
if (a instanceof Array) return "array";
|
|
if (a instanceof Object) return b;
|
|
var c = Object.prototype.toString.call(a);
|
|
if ("[object Window]" == c) return "object";
|
|
if (
|
|
"[object Array]" == c ||
|
|
("number" == typeof a.length &&
|
|
"undefined" != typeof a.splice &&
|
|
"undefined" != typeof a.propertyIsEnumerable &&
|
|
!a.propertyIsEnumerable("splice"))
|
|
)
|
|
return "array";
|
|
if (
|
|
"[object Function]" == c ||
|
|
("undefined" != typeof a.call &&
|
|
"undefined" != typeof a.propertyIsEnumerable &&
|
|
!a.propertyIsEnumerable("call"))
|
|
)
|
|
return "function";
|
|
} else return "null";
|
|
else if ("function" == b && "undefined" == typeof a.call) return "object";
|
|
return b;
|
|
};
|
|
goog.isArray = function (a) {
|
|
return Array.isArray(a);
|
|
};
|
|
goog.isArrayLike = function (a) {
|
|
var b = goog.typeOf(a);
|
|
return "array" == b || ("object" == b && "number" == typeof a.length);
|
|
};
|
|
goog.isDateLike = function (a) {
|
|
return goog.isObject(a) && "function" == typeof a.getFullYear;
|
|
};
|
|
goog.isFunction = function (a) {
|
|
return "function" == goog.typeOf(a);
|
|
};
|
|
goog.isObject = function (a) {
|
|
var b = typeof a;
|
|
return ("object" == b && null != a) || "function" == b;
|
|
};
|
|
goog.getUid = function (a) {
|
|
return (
|
|
(Object.prototype.hasOwnProperty.call(a, goog.UID_PROPERTY_) &&
|
|
a[goog.UID_PROPERTY_]) ||
|
|
(a[goog.UID_PROPERTY_] = ++goog.uidCounter_)
|
|
);
|
|
};
|
|
goog.hasUid = function (a) {
|
|
return !!a[goog.UID_PROPERTY_];
|
|
};
|
|
goog.removeUid = function (a) {
|
|
null !== a && "removeAttribute" in a && a.removeAttribute(goog.UID_PROPERTY_);
|
|
try {
|
|
delete a[goog.UID_PROPERTY_];
|
|
} catch (b) {}
|
|
};
|
|
goog.UID_PROPERTY_ = "closure_uid_" + ((1e9 * Math.random()) >>> 0);
|
|
goog.uidCounter_ = 0;
|
|
goog.getHashCode = goog.getUid;
|
|
goog.removeHashCode = goog.removeUid;
|
|
goog.cloneObject = function (a) {
|
|
var b = goog.typeOf(a);
|
|
if ("object" == b || "array" == b) {
|
|
if ("function" === typeof a.clone) return a.clone();
|
|
b = "array" == b ? [] : {};
|
|
for (var c in a) b[c] = goog.cloneObject(a[c]);
|
|
return b;
|
|
}
|
|
return a;
|
|
};
|
|
goog.bindNative_ = function (a, b, c) {
|
|
return a.call.apply(a.bind, arguments);
|
|
};
|
|
goog.bindJs_ = function (a, b, c) {
|
|
if (!a) throw Error();
|
|
if (2 < arguments.length) {
|
|
var d = Array.prototype.slice.call(arguments, 2);
|
|
return function () {
|
|
var e = Array.prototype.slice.call(arguments);
|
|
Array.prototype.unshift.apply(e, d);
|
|
return a.apply(b, e);
|
|
};
|
|
}
|
|
return function () {
|
|
return a.apply(b, arguments);
|
|
};
|
|
};
|
|
goog.bind = function (a, b, c) {
|
|
Function.prototype.bind &&
|
|
-1 != Function.prototype.bind.toString().indexOf("native code")
|
|
? (goog.bind = goog.bindNative_)
|
|
: (goog.bind = goog.bindJs_);
|
|
return goog.bind.apply(null, arguments);
|
|
};
|
|
goog.partial = function (a, b) {
|
|
var c = Array.prototype.slice.call(arguments, 1);
|
|
return function () {
|
|
var d = c.slice();
|
|
d.push.apply(d, arguments);
|
|
return a.apply(this, d);
|
|
};
|
|
};
|
|
goog.mixin = function (a, b) {
|
|
for (var c in b) a[c] = b[c];
|
|
};
|
|
goog.now =
|
|
(goog.TRUSTED_SITE && Date.now) ||
|
|
function () {
|
|
return +new Date();
|
|
};
|
|
goog.globalEval = function (a) {
|
|
if (goog.global.execScript) goog.global.execScript(a, "JavaScript");
|
|
else if (goog.global.eval) {
|
|
if (null == goog.evalWorks_)
|
|
try {
|
|
goog.global.eval(""), (goog.evalWorks_ = !0);
|
|
} catch (d) {
|
|
goog.evalWorks_ = !1;
|
|
}
|
|
if (goog.evalWorks_) goog.global.eval(a);
|
|
else {
|
|
var b = goog.global.document,
|
|
c = b.createElement("script");
|
|
c.type = "text/javascript";
|
|
c.defer = !1;
|
|
c.appendChild(b.createTextNode(a));
|
|
b.head.appendChild(c);
|
|
b.head.removeChild(c);
|
|
}
|
|
} else throw Error("goog.globalEval not available");
|
|
};
|
|
goog.evalWorks_ = null;
|
|
goog.getCssName = function (a, b) {
|
|
if ("." == String(a).charAt(0))
|
|
throw Error(
|
|
'className passed in goog.getCssName must not start with ".". You passed: ' +
|
|
a,
|
|
);
|
|
var c = function (e) {
|
|
return goog.cssNameMapping_[e] || e;
|
|
},
|
|
d = function (e) {
|
|
e = e.split("-");
|
|
for (var f = [], g = 0; g < e.length; g++) f.push(c(e[g]));
|
|
return f.join("-");
|
|
};
|
|
d = goog.cssNameMapping_
|
|
? "BY_WHOLE" == goog.cssNameMappingStyle_
|
|
? c
|
|
: d
|
|
: function (e) {
|
|
return e;
|
|
};
|
|
a = b ? a + "-" + d(b) : d(a);
|
|
return goog.global.CLOSURE_CSS_NAME_MAP_FN
|
|
? goog.global.CLOSURE_CSS_NAME_MAP_FN(a)
|
|
: a;
|
|
};
|
|
goog.setCssNameMapping = function (a, b) {
|
|
goog.cssNameMapping_ = a;
|
|
goog.cssNameMappingStyle_ = b;
|
|
};
|
|
!COMPILED &&
|
|
goog.global.CLOSURE_CSS_NAME_MAPPING &&
|
|
(goog.cssNameMapping_ = goog.global.CLOSURE_CSS_NAME_MAPPING);
|
|
goog.getMsg = function (a, b, c) {
|
|
c && c.html && (a = a.replace(/</g, "<"));
|
|
b &&
|
|
(a = a.replace(/\{\$([^}]+)}/g, function (d, e) {
|
|
return null != b && e in b ? b[e] : d;
|
|
}));
|
|
return a;
|
|
};
|
|
goog.getMsgWithFallback = function (a, b) {
|
|
return a;
|
|
};
|
|
goog.exportSymbol = function (a, b, c) {
|
|
goog.exportPath_(a, b, c);
|
|
};
|
|
goog.exportProperty = function (a, b, c) {
|
|
a[b] = c;
|
|
};
|
|
goog.inherits = function (a, b) {
|
|
function c() {}
|
|
c.prototype = b.prototype;
|
|
a.superClass_ = b.prototype;
|
|
a.prototype = new c();
|
|
a.prototype.constructor = a;
|
|
a.base = function (d, e, f) {
|
|
for (var g = Array(arguments.length - 2), h = 2; h < arguments.length; h++)
|
|
g[h - 2] = arguments[h];
|
|
return b.prototype[e].apply(d, g);
|
|
};
|
|
};
|
|
goog.scope = function (a) {
|
|
if (goog.isInModuleLoader_())
|
|
throw Error("goog.scope is not supported within a module.");
|
|
a.call(goog.global);
|
|
};
|
|
COMPILED || (goog.global.COMPILED = COMPILED);
|
|
goog.defineClass = function (a, b) {
|
|
var c = b.constructor,
|
|
d = b.statics;
|
|
(c && c != Object.prototype.constructor) ||
|
|
(c = function () {
|
|
throw Error("cannot instantiate an interface (no constructor defined).");
|
|
});
|
|
c = goog.defineClass.createSealingConstructor_(c, a);
|
|
a && goog.inherits(c, a);
|
|
delete b.constructor;
|
|
delete b.statics;
|
|
goog.defineClass.applyProperties_(c.prototype, b);
|
|
null != d &&
|
|
(d instanceof Function ? d(c) : goog.defineClass.applyProperties_(c, d));
|
|
return c;
|
|
};
|
|
goog.defineClass.SEAL_CLASS_INSTANCES = goog.DEBUG;
|
|
goog.defineClass.createSealingConstructor_ = function (a, b) {
|
|
return goog.defineClass.SEAL_CLASS_INSTANCES
|
|
? function () {
|
|
var c = a.apply(this, arguments) || this;
|
|
c[goog.UID_PROPERTY_] = c[goog.UID_PROPERTY_];
|
|
return c;
|
|
}
|
|
: a;
|
|
};
|
|
goog.defineClass.OBJECT_PROTOTYPE_FIELDS_ =
|
|
"constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(
|
|
" ",
|
|
);
|
|
goog.defineClass.applyProperties_ = function (a, b) {
|
|
for (var c in b) Object.prototype.hasOwnProperty.call(b, c) && (a[c] = b[c]);
|
|
for (var d = 0; d < goog.defineClass.OBJECT_PROTOTYPE_FIELDS_.length; d++)
|
|
(c = goog.defineClass.OBJECT_PROTOTYPE_FIELDS_[d]),
|
|
Object.prototype.hasOwnProperty.call(b, c) && (a[c] = b[c]);
|
|
};
|
|
!COMPILED &&
|
|
goog.DEPENDENCIES_ENABLED &&
|
|
((goog.inHtmlDocument_ = function () {
|
|
var a = goog.global.document;
|
|
return null != a && "write" in a;
|
|
}),
|
|
(goog.isDocumentLoading_ = function () {
|
|
var a = goog.global.document;
|
|
return a.attachEvent
|
|
? "complete" != a.readyState
|
|
: "loading" == a.readyState;
|
|
}),
|
|
(goog.findBasePath_ = function () {
|
|
if (
|
|
void 0 != goog.global.CLOSURE_BASE_PATH &&
|
|
"string" === typeof goog.global.CLOSURE_BASE_PATH
|
|
)
|
|
goog.basePath = goog.global.CLOSURE_BASE_PATH;
|
|
else if (goog.inHtmlDocument_()) {
|
|
var a = goog.global.document,
|
|
b = a.currentScript;
|
|
a = b ? [b] : a.getElementsByTagName("SCRIPT");
|
|
for (b = a.length - 1; 0 <= b; --b) {
|
|
var c = a[b].src,
|
|
d = c.lastIndexOf("?");
|
|
d = -1 == d ? c.length : d;
|
|
if ("base.js" == c.substr(d - 7, 7)) {
|
|
goog.basePath = c.substr(0, d - 7);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}),
|
|
goog.findBasePath_(),
|
|
(goog.Transpiler = function () {
|
|
this.requiresTranspilation_ = null;
|
|
this.transpilationTarget_ = goog.TRANSPILE_TO_LANGUAGE;
|
|
}),
|
|
(goog.Transpiler.prototype.createRequiresTranspilation_ = function () {
|
|
function a(g, h) {
|
|
e ? (d[g] = !0) : h() ? ((c = g), (d[g] = !1)) : (e = d[g] = !0);
|
|
}
|
|
function b(g) {
|
|
try {
|
|
return !!eval(g);
|
|
} catch (h) {
|
|
return !1;
|
|
}
|
|
}
|
|
var c = "es3",
|
|
d = { es3: !1 },
|
|
e = !1,
|
|
f =
|
|
goog.global.navigator && goog.global.navigator.userAgent
|
|
? goog.global.navigator.userAgent
|
|
: "";
|
|
a("es5", function () {
|
|
return b("[1,].length==1");
|
|
});
|
|
a("es6", function () {
|
|
return f.match(/Edge\/(\d+)(\.\d)*/i)
|
|
? !1
|
|
: b(
|
|
'(()=>{"use strict";class X{constructor(){if(new.target!=String)throw 1;this.x=42}}let q=Reflect.construct(X,[],String);if(q.x!=42||!(q instanceof String))throw 1;for(const a of[2,3]){if(a==2)continue;function f(z={a}){let a=0;return z.a}{function f(){return 0;}}return f()==3}})()',
|
|
);
|
|
});
|
|
a("es7", function () {
|
|
return b("2 ** 2 == 4");
|
|
});
|
|
a("es8", function () {
|
|
return b("async () => 1, true");
|
|
});
|
|
a("es9", function () {
|
|
return b("({...rest} = {}), true");
|
|
});
|
|
a("es_next", function () {
|
|
return !1;
|
|
});
|
|
return { target: c, map: d };
|
|
}),
|
|
(goog.Transpiler.prototype.needsTranspile = function (a, b) {
|
|
if ("always" == goog.TRANSPILE) return !0;
|
|
if ("never" == goog.TRANSPILE) return !1;
|
|
if (!this.requiresTranspilation_) {
|
|
var c = this.createRequiresTranspilation_();
|
|
this.requiresTranspilation_ = c.map;
|
|
this.transpilationTarget_ = this.transpilationTarget_ || c.target;
|
|
}
|
|
if (a in this.requiresTranspilation_)
|
|
return this.requiresTranspilation_[a]
|
|
? !0
|
|
: !goog.inHtmlDocument_() ||
|
|
"es6" != b ||
|
|
"noModule" in goog.global.document.createElement("script")
|
|
? !1
|
|
: !0;
|
|
throw Error("Unknown language mode: " + a);
|
|
}),
|
|
(goog.Transpiler.prototype.transpile = function (a, b) {
|
|
return goog.transpile_(a, b, this.transpilationTarget_);
|
|
}),
|
|
(goog.transpiler_ = new goog.Transpiler()),
|
|
(goog.protectScriptTag_ = function (a) {
|
|
return a.replace(/<\/(SCRIPT)/gi, "\\x3c/$1");
|
|
}),
|
|
(goog.DebugLoader_ = function () {
|
|
this.dependencies_ = {};
|
|
this.idToPath_ = {};
|
|
this.written_ = {};
|
|
this.loadingDeps_ = [];
|
|
this.depsToLoad_ = [];
|
|
this.paused_ = !1;
|
|
this.factory_ = new goog.DependencyFactory(goog.transpiler_);
|
|
this.deferredCallbacks_ = {};
|
|
this.deferredQueue_ = [];
|
|
}),
|
|
(goog.DebugLoader_.prototype.bootstrap = function (a, b) {
|
|
function c() {
|
|
d && (goog.global.setTimeout(d, 0), (d = null));
|
|
}
|
|
var d = b;
|
|
if (a.length) {
|
|
b = [];
|
|
for (var e = 0; e < a.length; e++) {
|
|
var f = this.getPathFromDeps_(a[e]);
|
|
if (!f) throw Error("Unregonized namespace: " + a[e]);
|
|
b.push(this.dependencies_[f]);
|
|
}
|
|
f = goog.require;
|
|
var g = 0;
|
|
for (e = 0; e < a.length; e++)
|
|
f(a[e]),
|
|
b[e].onLoad(function () {
|
|
++g == a.length && c();
|
|
});
|
|
} else c();
|
|
}),
|
|
(goog.DebugLoader_.prototype.loadClosureDeps = function () {
|
|
this.depsToLoad_.push(
|
|
this.factory_.createDependency(
|
|
goog.normalizePath_(goog.basePath + "deps.js"),
|
|
"deps.js",
|
|
[],
|
|
[],
|
|
{},
|
|
!1,
|
|
),
|
|
);
|
|
this.loadDeps_();
|
|
}),
|
|
(goog.DebugLoader_.prototype.requested = function (a, b) {
|
|
(a = this.getPathFromDeps_(a)) &&
|
|
(b || this.areDepsLoaded_(this.dependencies_[a].requires)) &&
|
|
(b = this.deferredCallbacks_[a]) &&
|
|
(delete this.deferredCallbacks_[a], b());
|
|
}),
|
|
(goog.DebugLoader_.prototype.setDependencyFactory = function (a) {
|
|
this.factory_ = a;
|
|
}),
|
|
(goog.DebugLoader_.prototype.load_ = function (a) {
|
|
if (this.getPathFromDeps_(a)) {
|
|
var b = this,
|
|
c = [],
|
|
d = function (e) {
|
|
var f = b.getPathFromDeps_(e);
|
|
if (!f) throw Error("Bad dependency path or symbol: " + e);
|
|
if (!b.written_[f]) {
|
|
b.written_[f] = !0;
|
|
e = b.dependencies_[f];
|
|
for (f = 0; f < e.requires.length; f++)
|
|
goog.isProvided_(e.requires[f]) || d(e.requires[f]);
|
|
c.push(e);
|
|
}
|
|
};
|
|
d(a);
|
|
a = !!this.depsToLoad_.length;
|
|
this.depsToLoad_ = this.depsToLoad_.concat(c);
|
|
this.paused_ || a || this.loadDeps_();
|
|
} else
|
|
throw (
|
|
((a = "goog.require could not find: " + a),
|
|
goog.logToConsole_(a),
|
|
Error(a))
|
|
);
|
|
}),
|
|
(goog.DebugLoader_.prototype.loadDeps_ = function () {
|
|
for (var a = this, b = this.paused_; this.depsToLoad_.length && !b; )
|
|
(function () {
|
|
var c = !1,
|
|
d = a.depsToLoad_.shift(),
|
|
e = !1;
|
|
a.loading_(d);
|
|
var f = {
|
|
pause: function () {
|
|
if (c) throw Error("Cannot call pause after the call to load.");
|
|
b = !0;
|
|
},
|
|
resume: function () {
|
|
c ? a.resume_() : (b = !1);
|
|
},
|
|
loaded: function () {
|
|
if (e) throw Error("Double call to loaded.");
|
|
e = !0;
|
|
a.loaded_(d);
|
|
},
|
|
pending: function () {
|
|
for (var g = [], h = 0; h < a.loadingDeps_.length; h++)
|
|
g.push(a.loadingDeps_[h]);
|
|
return g;
|
|
},
|
|
setModuleState: function (g) {
|
|
goog.moduleLoaderState_ = {
|
|
type: g,
|
|
moduleName: "",
|
|
declareLegacyNamespace: !1,
|
|
};
|
|
},
|
|
registerEs6ModuleExports: function (g, h, k) {
|
|
k &&
|
|
(goog.loadedModules_[k] = {
|
|
exports: h,
|
|
type: goog.ModuleType.ES6,
|
|
moduleId: k || "",
|
|
});
|
|
},
|
|
registerGoogModuleExports: function (g, h) {
|
|
goog.loadedModules_[g] = {
|
|
exports: h,
|
|
type: goog.ModuleType.GOOG,
|
|
moduleId: g,
|
|
};
|
|
},
|
|
clearModuleState: function () {
|
|
goog.moduleLoaderState_ = null;
|
|
},
|
|
defer: function (g) {
|
|
if (c)
|
|
throw Error("Cannot register with defer after the call to load.");
|
|
a.defer_(d, g);
|
|
},
|
|
areDepsLoaded: function () {
|
|
return a.areDepsLoaded_(d.requires);
|
|
},
|
|
};
|
|
try {
|
|
d.load(f);
|
|
} finally {
|
|
c = !0;
|
|
}
|
|
})();
|
|
b && this.pause_();
|
|
}),
|
|
(goog.DebugLoader_.prototype.pause_ = function () {
|
|
this.paused_ = !0;
|
|
}),
|
|
(goog.DebugLoader_.prototype.resume_ = function () {
|
|
this.paused_ && ((this.paused_ = !1), this.loadDeps_());
|
|
}),
|
|
(goog.DebugLoader_.prototype.loading_ = function (a) {
|
|
this.loadingDeps_.push(a);
|
|
}),
|
|
(goog.DebugLoader_.prototype.loaded_ = function (a) {
|
|
for (var b = 0; b < this.loadingDeps_.length; b++)
|
|
if (this.loadingDeps_[b] == a) {
|
|
this.loadingDeps_.splice(b, 1);
|
|
break;
|
|
}
|
|
for (b = 0; b < this.deferredQueue_.length; b++)
|
|
if (this.deferredQueue_[b] == a.path) {
|
|
this.deferredQueue_.splice(b, 1);
|
|
break;
|
|
}
|
|
if (
|
|
this.loadingDeps_.length == this.deferredQueue_.length &&
|
|
!this.depsToLoad_.length
|
|
)
|
|
for (; this.deferredQueue_.length; )
|
|
this.requested(this.deferredQueue_.shift(), !0);
|
|
a.loaded();
|
|
}),
|
|
(goog.DebugLoader_.prototype.areDepsLoaded_ = function (a) {
|
|
for (var b = 0; b < a.length; b++) {
|
|
var c = this.getPathFromDeps_(a[b]);
|
|
if (!c || !(c in this.deferredCallbacks_ || goog.isProvided_(a[b])))
|
|
return !1;
|
|
}
|
|
return !0;
|
|
}),
|
|
(goog.DebugLoader_.prototype.getPathFromDeps_ = function (a) {
|
|
return a in this.idToPath_
|
|
? this.idToPath_[a]
|
|
: a in this.dependencies_
|
|
? a
|
|
: null;
|
|
}),
|
|
(goog.DebugLoader_.prototype.defer_ = function (a, b) {
|
|
this.deferredCallbacks_[a.path] = b;
|
|
this.deferredQueue_.push(a.path);
|
|
}),
|
|
(goog.LoadController = function () {}),
|
|
(goog.LoadController.prototype.pause = function () {}),
|
|
(goog.LoadController.prototype.resume = function () {}),
|
|
(goog.LoadController.prototype.loaded = function () {}),
|
|
(goog.LoadController.prototype.pending = function () {}),
|
|
(goog.LoadController.prototype.registerEs6ModuleExports = function (
|
|
a,
|
|
b,
|
|
c,
|
|
) {}),
|
|
(goog.LoadController.prototype.setModuleState = function (a) {}),
|
|
(goog.LoadController.prototype.clearModuleState = function () {}),
|
|
(goog.LoadController.prototype.defer = function (a) {}),
|
|
(goog.LoadController.prototype.areDepsLoaded = function () {}),
|
|
(goog.Dependency = function (a, b, c, d, e) {
|
|
this.path = a;
|
|
this.relativePath = b;
|
|
this.provides = c;
|
|
this.requires = d;
|
|
this.loadFlags = e;
|
|
this.loaded_ = !1;
|
|
this.loadCallbacks_ = [];
|
|
}),
|
|
(goog.Dependency.prototype.getPathName = function () {
|
|
var a = this.path,
|
|
b = a.indexOf("://");
|
|
0 <= b &&
|
|
((a = a.substring(b + 3)),
|
|
(b = a.indexOf("/")),
|
|
0 <= b && (a = a.substring(b + 1)));
|
|
return a;
|
|
}),
|
|
(goog.Dependency.prototype.onLoad = function (a) {
|
|
this.loaded_ ? a() : this.loadCallbacks_.push(a);
|
|
}),
|
|
(goog.Dependency.prototype.loaded = function () {
|
|
this.loaded_ = !0;
|
|
var a = this.loadCallbacks_;
|
|
this.loadCallbacks_ = [];
|
|
for (var b = 0; b < a.length; b++) a[b]();
|
|
}),
|
|
(goog.Dependency.defer_ = !1),
|
|
(goog.Dependency.callbackMap_ = {}),
|
|
(goog.Dependency.registerCallback_ = function (a) {
|
|
var b = Math.random().toString(32);
|
|
goog.Dependency.callbackMap_[b] = a;
|
|
return b;
|
|
}),
|
|
(goog.Dependency.unregisterCallback_ = function (a) {
|
|
delete goog.Dependency.callbackMap_[a];
|
|
}),
|
|
(goog.Dependency.callback_ = function (a, b) {
|
|
if (a in goog.Dependency.callbackMap_) {
|
|
for (
|
|
var c = goog.Dependency.callbackMap_[a], d = [], e = 1;
|
|
e < arguments.length;
|
|
e++
|
|
)
|
|
d.push(arguments[e]);
|
|
c.apply(void 0, d);
|
|
} else
|
|
throw Error(
|
|
"Callback key " +
|
|
a +
|
|
" does not exist (was base.js loaded more than once?).",
|
|
);
|
|
}),
|
|
(goog.Dependency.prototype.load = function (a) {
|
|
if (goog.global.CLOSURE_IMPORT_SCRIPT)
|
|
goog.global.CLOSURE_IMPORT_SCRIPT(this.path) ? a.loaded() : a.pause();
|
|
else if (goog.inHtmlDocument_()) {
|
|
var b = goog.global.document;
|
|
if (
|
|
"complete" == b.readyState &&
|
|
!goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING
|
|
) {
|
|
if (/\bdeps.js$/.test(this.path)) {
|
|
a.loaded();
|
|
return;
|
|
}
|
|
throw Error('Cannot write "' + this.path + '" after document load');
|
|
}
|
|
if (
|
|
!goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING &&
|
|
goog.isDocumentLoading_()
|
|
) {
|
|
var c = goog.Dependency.registerCallback_(function (f) {
|
|
(goog.DebugLoader_.IS_OLD_IE_ && "complete" != f.readyState) ||
|
|
(goog.Dependency.unregisterCallback_(c), a.loaded());
|
|
}),
|
|
d =
|
|
!goog.DebugLoader_.IS_OLD_IE_ && goog.getScriptNonce()
|
|
? ' nonce="' + goog.getScriptNonce() + '"'
|
|
: "";
|
|
d =
|
|
'<script src="' +
|
|
this.path +
|
|
'" ' +
|
|
(goog.DebugLoader_.IS_OLD_IE_ ? "onreadystatechange" : "onload") +
|
|
"=\"goog.Dependency.callback_('" +
|
|
c +
|
|
'\', this)" type="text/javascript" ' +
|
|
(goog.Dependency.defer_ ? "defer" : "") +
|
|
d +
|
|
">\x3c/script>";
|
|
b.write(
|
|
goog.TRUSTED_TYPES_POLICY_
|
|
? goog.TRUSTED_TYPES_POLICY_.createHTML(d)
|
|
: d,
|
|
);
|
|
} else {
|
|
var e = b.createElement("script");
|
|
e.defer = goog.Dependency.defer_;
|
|
e.async = !1;
|
|
e.type = "text/javascript";
|
|
(d = goog.getScriptNonce()) && e.setAttribute("nonce", d);
|
|
goog.DebugLoader_.IS_OLD_IE_
|
|
? (a.pause(),
|
|
(e.onreadystatechange = function () {
|
|
if ("loaded" == e.readyState || "complete" == e.readyState)
|
|
a.loaded(), a.resume();
|
|
}))
|
|
: (e.onload = function () {
|
|
e.onload = null;
|
|
a.loaded();
|
|
});
|
|
e.src = goog.TRUSTED_TYPES_POLICY_
|
|
? goog.TRUSTED_TYPES_POLICY_.createScriptURL(this.path)
|
|
: this.path;
|
|
b.head.appendChild(e);
|
|
}
|
|
} else
|
|
goog.logToConsole_(
|
|
"Cannot use default debug loader outside of HTML documents.",
|
|
),
|
|
"deps.js" == this.relativePath
|
|
? (goog.logToConsole_(
|
|
"Consider setting CLOSURE_IMPORT_SCRIPT before loading base.js, or setting CLOSURE_NO_DEPS to true.",
|
|
),
|
|
a.loaded())
|
|
: a.pause();
|
|
}),
|
|
(goog.Es6ModuleDependency = function (a, b, c, d, e) {
|
|
goog.Dependency.call(this, a, b, c, d, e);
|
|
}),
|
|
goog.inherits(goog.Es6ModuleDependency, goog.Dependency),
|
|
(goog.Es6ModuleDependency.prototype.load = function (a) {
|
|
function b(l, m) {
|
|
l = m
|
|
? '<script type="module" crossorigin>' + m + "\x3c/script>"
|
|
: '<script type="module" crossorigin src="' + l + '">\x3c/script>';
|
|
d.write(
|
|
goog.TRUSTED_TYPES_POLICY_
|
|
? goog.TRUSTED_TYPES_POLICY_.createHTML(l)
|
|
: l,
|
|
);
|
|
}
|
|
function c(l, m) {
|
|
var n = d.createElement("script");
|
|
n.defer = !0;
|
|
n.async = !1;
|
|
n.type = "module";
|
|
n.setAttribute("crossorigin", !0);
|
|
var p = goog.getScriptNonce();
|
|
p && n.setAttribute("nonce", p);
|
|
m
|
|
? (n.textContent = goog.TRUSTED_TYPES_POLICY_
|
|
? goog.TRUSTED_TYPES_POLICY_.createScript(m)
|
|
: m)
|
|
: (n.src = goog.TRUSTED_TYPES_POLICY_
|
|
? goog.TRUSTED_TYPES_POLICY_.createScriptURL(l)
|
|
: l);
|
|
d.head.appendChild(n);
|
|
}
|
|
if (goog.global.CLOSURE_IMPORT_SCRIPT)
|
|
goog.global.CLOSURE_IMPORT_SCRIPT(this.path) ? a.loaded() : a.pause();
|
|
else if (goog.inHtmlDocument_()) {
|
|
var d = goog.global.document,
|
|
e = this;
|
|
if (goog.isDocumentLoading_()) {
|
|
var f = b;
|
|
goog.Dependency.defer_ = !0;
|
|
} else f = c;
|
|
var g = goog.Dependency.registerCallback_(function () {
|
|
goog.Dependency.unregisterCallback_(g);
|
|
a.setModuleState(goog.ModuleType.ES6);
|
|
});
|
|
f(void 0, 'goog.Dependency.callback_("' + g + '")');
|
|
f(this.path, void 0);
|
|
var h = goog.Dependency.registerCallback_(function (l) {
|
|
goog.Dependency.unregisterCallback_(h);
|
|
a.registerEs6ModuleExports(
|
|
e.path,
|
|
l,
|
|
goog.moduleLoaderState_.moduleName,
|
|
);
|
|
});
|
|
f(
|
|
void 0,
|
|
'import * as m from "' +
|
|
this.path +
|
|
'"; goog.Dependency.callback_("' +
|
|
h +
|
|
'", m)',
|
|
);
|
|
var k = goog.Dependency.registerCallback_(function () {
|
|
goog.Dependency.unregisterCallback_(k);
|
|
a.clearModuleState();
|
|
a.loaded();
|
|
});
|
|
f(void 0, 'goog.Dependency.callback_("' + k + '")');
|
|
} else
|
|
goog.logToConsole_(
|
|
"Cannot use default debug loader outside of HTML documents.",
|
|
),
|
|
a.pause();
|
|
}),
|
|
(goog.TransformedDependency = function (a, b, c, d, e) {
|
|
goog.Dependency.call(this, a, b, c, d, e);
|
|
this.contents_ = null;
|
|
this.lazyFetch_ =
|
|
!goog.inHtmlDocument_() ||
|
|
!("noModule" in goog.global.document.createElement("script"));
|
|
}),
|
|
goog.inherits(goog.TransformedDependency, goog.Dependency),
|
|
(goog.TransformedDependency.prototype.load = function (a) {
|
|
function b() {
|
|
e.contents_ = goog.loadFileSync_(e.path);
|
|
e.contents_ &&
|
|
((e.contents_ = e.transform(e.contents_)),
|
|
e.contents_ && (e.contents_ += "\n//# sourceURL=" + e.path));
|
|
}
|
|
function c() {
|
|
e.lazyFetch_ && b();
|
|
if (e.contents_) {
|
|
f && a.setModuleState(goog.ModuleType.ES6);
|
|
try {
|
|
var m = e.contents_;
|
|
e.contents_ = null;
|
|
goog.globalEval(m);
|
|
if (f) var n = goog.moduleLoaderState_.moduleName;
|
|
} finally {
|
|
f && a.clearModuleState();
|
|
}
|
|
f &&
|
|
goog.global.$jscomp.require.ensure([e.getPathName()], function () {
|
|
a.registerEs6ModuleExports(
|
|
e.path,
|
|
goog.global.$jscomp.require(e.getPathName()),
|
|
n,
|
|
);
|
|
});
|
|
a.loaded();
|
|
}
|
|
}
|
|
function d() {
|
|
var m = goog.global.document,
|
|
n = goog.Dependency.registerCallback_(function () {
|
|
goog.Dependency.unregisterCallback_(n);
|
|
c();
|
|
}),
|
|
p =
|
|
'<script type="text/javascript">' +
|
|
goog.protectScriptTag_('goog.Dependency.callback_("' + n + '");') +
|
|
"\x3c/script>";
|
|
m.write(
|
|
goog.TRUSTED_TYPES_POLICY_
|
|
? goog.TRUSTED_TYPES_POLICY_.createHTML(p)
|
|
: p,
|
|
);
|
|
}
|
|
var e = this;
|
|
if (goog.global.CLOSURE_IMPORT_SCRIPT)
|
|
b(),
|
|
this.contents_ && goog.global.CLOSURE_IMPORT_SCRIPT("", this.contents_)
|
|
? ((this.contents_ = null), a.loaded())
|
|
: a.pause();
|
|
else {
|
|
var f = this.loadFlags.module == goog.ModuleType.ES6;
|
|
this.lazyFetch_ || b();
|
|
var g = 1 < a.pending().length,
|
|
h = g && goog.DebugLoader_.IS_OLD_IE_;
|
|
g = goog.Dependency.defer_ && (g || goog.isDocumentLoading_());
|
|
if (h || g)
|
|
a.defer(function () {
|
|
c();
|
|
});
|
|
else {
|
|
var k = goog.global.document;
|
|
h = goog.inHtmlDocument_() && "ActiveXObject" in goog.global;
|
|
if (f && goog.inHtmlDocument_() && goog.isDocumentLoading_() && !h) {
|
|
goog.Dependency.defer_ = !0;
|
|
a.pause();
|
|
var l = k.onreadystatechange;
|
|
k.onreadystatechange = function () {
|
|
"interactive" == k.readyState &&
|
|
((k.onreadystatechange = l), c(), a.resume());
|
|
goog.isFunction(l) && l.apply(void 0, arguments);
|
|
};
|
|
} else
|
|
!goog.DebugLoader_.IS_OLD_IE_ &&
|
|
goog.inHtmlDocument_() &&
|
|
goog.isDocumentLoading_()
|
|
? d()
|
|
: c();
|
|
}
|
|
}
|
|
}),
|
|
(goog.TransformedDependency.prototype.transform = function (a) {}),
|
|
(goog.TranspiledDependency = function (a, b, c, d, e, f) {
|
|
goog.TransformedDependency.call(this, a, b, c, d, e);
|
|
this.transpiler = f;
|
|
}),
|
|
goog.inherits(goog.TranspiledDependency, goog.TransformedDependency),
|
|
(goog.TranspiledDependency.prototype.transform = function (a) {
|
|
return this.transpiler.transpile(a, this.getPathName());
|
|
}),
|
|
(goog.PreTranspiledEs6ModuleDependency = function (a, b, c, d, e) {
|
|
goog.TransformedDependency.call(this, a, b, c, d, e);
|
|
}),
|
|
goog.inherits(
|
|
goog.PreTranspiledEs6ModuleDependency,
|
|
goog.TransformedDependency,
|
|
),
|
|
(goog.PreTranspiledEs6ModuleDependency.prototype.transform = function (a) {
|
|
return a;
|
|
}),
|
|
(goog.GoogModuleDependency = function (a, b, c, d, e, f, g) {
|
|
goog.TransformedDependency.call(this, a, b, c, d, e);
|
|
this.needsTranspile_ = f;
|
|
this.transpiler_ = g;
|
|
}),
|
|
goog.inherits(goog.GoogModuleDependency, goog.TransformedDependency),
|
|
(goog.GoogModuleDependency.prototype.transform = function (a) {
|
|
this.needsTranspile_ &&
|
|
(a = this.transpiler_.transpile(a, this.getPathName()));
|
|
return goog.LOAD_MODULE_USING_EVAL && void 0 !== goog.global.JSON
|
|
? "goog.loadModule(" +
|
|
goog.global.JSON.stringify(
|
|
a + "\n//# sourceURL=" + this.path + "\n",
|
|
) +
|
|
");"
|
|
: 'goog.loadModule(function(exports) {"use strict";' +
|
|
a +
|
|
"\n;return exports});\n//# sourceURL=" +
|
|
this.path +
|
|
"\n";
|
|
}),
|
|
(goog.DebugLoader_.IS_OLD_IE_ = !(
|
|
goog.global.atob ||
|
|
!goog.global.document ||
|
|
!goog.global.document.all
|
|
)),
|
|
(goog.DebugLoader_.prototype.addDependency = function (a, b, c, d) {
|
|
b = b || [];
|
|
a = a.replace(/\\/g, "/");
|
|
var e = goog.normalizePath_(goog.basePath + a);
|
|
(d && "boolean" !== typeof d) ||
|
|
(d = d ? { module: goog.ModuleType.GOOG } : {});
|
|
c = this.factory_.createDependency(
|
|
e,
|
|
a,
|
|
b,
|
|
c,
|
|
d,
|
|
goog.transpiler_.needsTranspile(d.lang || "es3", d.module),
|
|
);
|
|
this.dependencies_[e] = c;
|
|
for (c = 0; c < b.length; c++) this.idToPath_[b[c]] = e;
|
|
this.idToPath_[a] = e;
|
|
}),
|
|
(goog.DependencyFactory = function (a) {
|
|
this.transpiler = a;
|
|
}),
|
|
(goog.DependencyFactory.prototype.createDependency = function (
|
|
a,
|
|
b,
|
|
c,
|
|
d,
|
|
e,
|
|
f,
|
|
) {
|
|
return e.module == goog.ModuleType.GOOG
|
|
? new goog.GoogModuleDependency(a, b, c, d, e, f, this.transpiler)
|
|
: f
|
|
? new goog.TranspiledDependency(a, b, c, d, e, this.transpiler)
|
|
: e.module == goog.ModuleType.ES6
|
|
? "never" == goog.TRANSPILE && goog.ASSUME_ES_MODULES_TRANSPILED
|
|
? new goog.PreTranspiledEs6ModuleDependency(a, b, c, d, e)
|
|
: new goog.Es6ModuleDependency(a, b, c, d, e)
|
|
: new goog.Dependency(a, b, c, d, e);
|
|
}),
|
|
(goog.debugLoader_ = new goog.DebugLoader_()),
|
|
(goog.loadClosureDeps = function () {
|
|
goog.debugLoader_.loadClosureDeps();
|
|
}),
|
|
(goog.setDependencyFactory = function (a) {
|
|
goog.debugLoader_.setDependencyFactory(a);
|
|
}),
|
|
(goog.TRUSTED_TYPES_POLICY_ = goog.TRUSTED_TYPES_POLICY_NAME
|
|
? goog.createTrustedTypesPolicy(goog.TRUSTED_TYPES_POLICY_NAME + "#base")
|
|
: null),
|
|
goog.global.CLOSURE_NO_DEPS || goog.debugLoader_.loadClosureDeps(),
|
|
(goog.bootstrap = function (a, b) {
|
|
goog.debugLoader_.bootstrap(a, b);
|
|
}));
|
|
goog.TRUSTED_TYPES_POLICY_NAME = "";
|
|
goog.identity_ = function (a) {
|
|
return a;
|
|
};
|
|
goog.createTrustedTypesPolicy = function (a) {
|
|
var b = null,
|
|
c = goog.global.trustedTypes;
|
|
if (!c || !c.createPolicy) return b;
|
|
try {
|
|
b = c.createPolicy(a, {
|
|
createHTML: goog.identity_,
|
|
createScript: goog.identity_,
|
|
createScriptURL: goog.identity_,
|
|
});
|
|
} catch (d) {
|
|
goog.logToConsole_(d.message);
|
|
}
|
|
return b;
|
|
};
|
|
var sre = { Variables: function () {} };
|
|
sre.Variables.VERSION = "3.1.1";
|
|
sre.Variables.LOCALES = ["de", "en", "es", "fr", "nemeth"];
|
|
sre.Variables.mathjaxVersion = "3.0.0";
|
|
sre.Variables.url =
|
|
"https://cdn.jsdelivr.net/npm/speech-rule-engine@" +
|
|
sre.Variables.VERSION +
|
|
"/lib/mathmaps";
|
|
sre.Variables.WGXpath =
|
|
"https://cdn.jsdelivr.net/npm/wicked-good-xpath@1.3.0/dist/wgxpath.install.js";
|
|
sre.SystemExternal = function () {};
|
|
sre.SystemExternal.require = function (a) {
|
|
return "undefined" !== typeof process && "undefined" !== typeof require
|
|
? require(a)
|
|
: null;
|
|
};
|
|
sre.SystemExternal.documentSupported = function () {
|
|
return "undefined" != typeof document;
|
|
};
|
|
sre.SystemExternal.process = sre.SystemExternal.require("process");
|
|
sre.SystemExternal.xmldom = sre.SystemExternal.documentSupported()
|
|
? window
|
|
: sre.SystemExternal.require("xmldom-sre");
|
|
sre.SystemExternal.document = sre.SystemExternal.documentSupported()
|
|
? document
|
|
: new sre.SystemExternal.xmldom.DOMImplementation().createDocument("", "", 0);
|
|
sre.SystemExternal.xpath = sre.SystemExternal.documentSupported()
|
|
? document
|
|
: (function () {
|
|
var a = { document: {}, XPathResult: {} };
|
|
sre.SystemExternal.require("wicked-good-xpath").install(a);
|
|
a.document.XPathResult = a.XPathResult;
|
|
return a.document;
|
|
})();
|
|
sre.SystemExternal.commander = sre.SystemExternal.documentSupported()
|
|
? null
|
|
: sre.SystemExternal.require("commander");
|
|
sre.SystemExternal.fs = sre.SystemExternal.documentSupported()
|
|
? null
|
|
: sre.SystemExternal.require("fs");
|
|
sre.SystemExternal.url = sre.Variables.url;
|
|
sre.SystemExternal.jsonPath = (function () {
|
|
return (
|
|
(sre.SystemExternal.process && "undefined" !== typeof global
|
|
? sre.SystemExternal.process.env.SRE_JSON_PATH ||
|
|
global.SRE_JSON_PATH ||
|
|
sre.SystemExternal.process.cwd()
|
|
: sre.SystemExternal.url) + "/"
|
|
);
|
|
})();
|
|
sre.SystemExternal.WGXpath = sre.Variables.WGXpath;
|
|
sre.SystemExternal.wgxpath = null;
|
|
sre.BrowserUtil = {};
|
|
sre.BrowserUtil.detectIE = function () {
|
|
if (
|
|
!(
|
|
"undefined" !== typeof window &&
|
|
"ActiveXObject" in window &&
|
|
"clipboardData" in window
|
|
)
|
|
)
|
|
return !1;
|
|
sre.BrowserUtil.loadMapsForIE_();
|
|
sre.BrowserUtil.loadWGXpath_();
|
|
return !0;
|
|
};
|
|
sre.BrowserUtil.detectEdge = function () {
|
|
if (
|
|
!(
|
|
"undefined" !== typeof window &&
|
|
"MSGestureEvent" in window &&
|
|
"chrome" in window &&
|
|
null == window.chrome.loadTimes
|
|
)
|
|
)
|
|
return !1;
|
|
document.evaluate = null;
|
|
sre.BrowserUtil.loadWGXpath_(!0);
|
|
return !0;
|
|
};
|
|
sre.BrowserUtil.mapsForIE = null;
|
|
sre.BrowserUtil.loadWGXpath_ = function (a) {
|
|
sre.BrowserUtil.loadScript(sre.SystemExternal.WGXpath);
|
|
sre.BrowserUtil.installWGXpath_(a);
|
|
};
|
|
sre.BrowserUtil.installWGXpath_ = function (a, b) {
|
|
var c = b || 1;
|
|
"undefined" === typeof wgxpath && 10 > c
|
|
? setTimeout(function () {
|
|
sre.BrowserUtil.installWGXpath_(a, c++);
|
|
}, 200)
|
|
: 10 <= c ||
|
|
((sre.SystemExternal.wgxpath = wgxpath),
|
|
a
|
|
? sre.SystemExternal.wgxpath.install({ document: document })
|
|
: sre.SystemExternal.wgxpath.install(),
|
|
(sre.XpathUtil.xpathEvaluate = document.evaluate),
|
|
(sre.XpathUtil.xpathResult = XPathResult),
|
|
(sre.XpathUtil.createNSResolver = document.createNSResolver));
|
|
};
|
|
sre.BrowserUtil.loadMapsForIE_ = function () {
|
|
sre.BrowserUtil.loadScript(sre.SystemExternal.jsonPath + "mathmaps_ie.js");
|
|
};
|
|
sre.BrowserUtil.loadScript = function (a) {
|
|
var b = sre.SystemExternal.document.createElement("script");
|
|
b.type = "text/javascript";
|
|
b.src = a;
|
|
sre.SystemExternal.document.head
|
|
? sre.SystemExternal.document.head.appendChild(b)
|
|
: sre.SystemExternal.document.body.appendChild(b);
|
|
};
|
|
sre.DynamicProperties = function (a, b) {
|
|
this.properties_ = a;
|
|
this.order_ = b || Object.keys(a);
|
|
};
|
|
sre.DynamicProperties.prototype.getProperties = function () {
|
|
return this.properties_;
|
|
};
|
|
sre.DynamicProperties.prototype.getOrder = function () {
|
|
return this.order_;
|
|
};
|
|
sre.DynamicProperties.prototype.getAxes = function () {
|
|
return this.order_;
|
|
};
|
|
sre.DynamicProperties.prototype.getProperty = function (a) {
|
|
return this.properties_[a];
|
|
};
|
|
sre.DynamicProperties.prototype.updateProperties = function (a) {
|
|
this.properties_ = a;
|
|
};
|
|
sre.DynamicProperties.prototype.allProperties = function () {
|
|
var a = [];
|
|
this.order_.forEach(
|
|
goog.bind(function (b) {
|
|
a.push(this.getProperty(b).slice());
|
|
}, this),
|
|
);
|
|
return a;
|
|
};
|
|
sre.DynamicProperties.prototype.toString = function () {
|
|
var a = [];
|
|
this.order_.forEach(
|
|
goog.bind(function (b) {
|
|
a.push(b + ": " + this.getProperty(b).toString());
|
|
}, this),
|
|
);
|
|
return a.join("\n");
|
|
};
|
|
sre.DynamicCstr = function (a, b) {
|
|
this.components_ = a;
|
|
var c = {},
|
|
d;
|
|
for (d in a) {
|
|
var e = a[d];
|
|
c[d] = [e];
|
|
sre.DynamicCstr.Values_.getInstance().add(d, e);
|
|
}
|
|
sre.DynamicProperties.call(this, c, b);
|
|
};
|
|
goog.inherits(sre.DynamicCstr, sre.DynamicProperties);
|
|
sre.DynamicCstr.prototype.getComponents = function () {
|
|
return this.components_;
|
|
};
|
|
sre.DynamicCstr.prototype.getValue = function (a) {
|
|
return this.components_[a];
|
|
};
|
|
sre.DynamicCstr.prototype.getValues = function () {
|
|
var a = [];
|
|
this.order_.forEach(
|
|
goog.bind(function (b) {
|
|
a.push(this.getValue(b));
|
|
}, this),
|
|
);
|
|
return a;
|
|
};
|
|
sre.DynamicCstr.prototype.allProperties = function () {
|
|
for (
|
|
var a = sre.DynamicCstr.superClass_.allProperties.call(this), b = 0, c, d;
|
|
(c = a[b]), (d = this.order_[b]);
|
|
b++
|
|
)
|
|
(d = this.getValue(d)), -1 === c.indexOf(d) && c.unshift(d);
|
|
return a;
|
|
};
|
|
sre.DynamicCstr.prototype.toString = function () {
|
|
return this.getValues().join(".");
|
|
};
|
|
sre.DynamicCstr.prototype.equal = function (a) {
|
|
var b = a.getAxes();
|
|
if (this.order_.length !== b.length) return !1;
|
|
for (var c = 0, d; (d = b[c]); c++) {
|
|
var e = this.getValue(d);
|
|
if (!e || a.getValue(d) !== e) return !1;
|
|
}
|
|
return !0;
|
|
};
|
|
sre.DynamicCstr.Axis = {
|
|
DOMAIN: "domain",
|
|
STYLE: "style",
|
|
LOCALE: "locale",
|
|
TOPIC: "topic",
|
|
MODALITY: "modality",
|
|
};
|
|
sre.DynamicCstr.Values_ = function () {
|
|
this.axisToValues = sre.DynamicCstr.Values_.makeAxisValueObject_();
|
|
};
|
|
goog.addSingletonGetter(sre.DynamicCstr.Values_);
|
|
sre.DynamicCstr.Values_.prototype.add = function (a, b) {
|
|
this.axisToValues[a][b] = !0;
|
|
};
|
|
sre.DynamicCstr.Values_.prototype.get = function () {
|
|
var a = {},
|
|
b = sre.DynamicCstr.Values_.getInstance().axisToValues,
|
|
c;
|
|
for (c in b) a[c] = Object.keys(b[c]);
|
|
return a;
|
|
};
|
|
sre.DynamicCstr.Values_.makeAxisValueObject_ = function () {
|
|
var a = {},
|
|
b;
|
|
for (b in sre.DynamicCstr.Axis) a[sre.DynamicCstr.Axis[b]] = {};
|
|
return a;
|
|
};
|
|
sre.DynamicCstr.getAxisValues = function () {
|
|
return sre.DynamicCstr.Values_.getInstance().get();
|
|
};
|
|
sre.DynamicCstr.DEFAULT_ORDER = [
|
|
sre.DynamicCstr.Axis.LOCALE,
|
|
sre.DynamicCstr.Axis.MODALITY,
|
|
sre.DynamicCstr.Axis.DOMAIN,
|
|
sre.DynamicCstr.Axis.STYLE,
|
|
sre.DynamicCstr.Axis.TOPIC,
|
|
];
|
|
sre.DynamicCstr.DEFAULT_VALUE = "default";
|
|
sre.DynamicCstr.DEFAULT_VALUES = {};
|
|
sre.DynamicCstr.DEFAULT_VALUES[sre.DynamicCstr.Axis.LOCALE] = "en";
|
|
sre.DynamicCstr.DEFAULT_VALUES[sre.DynamicCstr.Axis.DOMAIN] =
|
|
sre.DynamicCstr.DEFAULT_VALUE;
|
|
sre.DynamicCstr.DEFAULT_VALUES[sre.DynamicCstr.Axis.STYLE] =
|
|
sre.DynamicCstr.DEFAULT_VALUE;
|
|
sre.DynamicCstr.DEFAULT_VALUES[sre.DynamicCstr.Axis.TOPIC] =
|
|
sre.DynamicCstr.DEFAULT_VALUE;
|
|
sre.DynamicCstr.DEFAULT_VALUES[sre.DynamicCstr.Axis.MODALITY] = "speech";
|
|
sre.DynamicCstr.Parser = function (a) {
|
|
this.order_ = a;
|
|
};
|
|
sre.DynamicCstr.Parser.prototype.parse = function (a) {
|
|
a = a.split(".");
|
|
var b = {};
|
|
if (a.length > this.order_.length)
|
|
throw Error("Invalid dynamic constraint: " + b);
|
|
for (var c = 0, d; (d = this.order_[c]), a.length; c++) {
|
|
var e = a.shift();
|
|
b[d] = e;
|
|
}
|
|
return new sre.DynamicCstr(b, this.order_.slice(0, c));
|
|
};
|
|
sre.DynamicCstr.Comparator = function () {};
|
|
sre.DynamicCstr.Comparator.prototype.getReference = function () {};
|
|
sre.DynamicCstr.Comparator.prototype.setReference = function (a, b) {};
|
|
sre.DynamicCstr.Comparator.prototype.match = function (a) {};
|
|
sre.DynamicCstr.Comparator.prototype.compare = function (a, b) {};
|
|
sre.DynamicCstr.DefaultComparator = function (a, b) {
|
|
this.reference_ = a;
|
|
this.fallback_ =
|
|
b || new sre.DynamicProperties(a.getProperties(), a.getOrder());
|
|
this.order_ = this.reference_.getOrder();
|
|
};
|
|
sre.DynamicCstr.DefaultComparator.prototype.getReference = function () {
|
|
return this.reference_;
|
|
};
|
|
sre.DynamicCstr.DefaultComparator.prototype.setReference = function (a, b) {
|
|
this.reference_ = a;
|
|
this.fallback_ =
|
|
b || new sre.DynamicProperties(a.getProperties(), a.getOrder());
|
|
this.order_ = this.reference_.getOrder();
|
|
};
|
|
sre.DynamicCstr.DefaultComparator.prototype.match = function (a) {
|
|
var b = a.getAxes();
|
|
return (
|
|
b.length === this.reference_.getAxes().length &&
|
|
b.every(
|
|
goog.bind(function (c) {
|
|
var d = a.getValue(c);
|
|
return (
|
|
d === this.reference_.getValue(c) ||
|
|
-1 !== this.fallback_.getProperty(c).indexOf(d)
|
|
);
|
|
}, this),
|
|
)
|
|
);
|
|
};
|
|
sre.DynamicCstr.DefaultComparator.prototype.compare = function (a, b) {
|
|
for (var c = !1, d = 0, e; (e = this.order_[d]); d++) {
|
|
var f = a.getValue(e),
|
|
g = b.getValue(e);
|
|
if (!c) {
|
|
var h = this.reference_.getValue(e);
|
|
if (h === f && h !== g) return -1;
|
|
if (h === g && h !== f) return 1;
|
|
if (h === f && h === g) continue;
|
|
h !== f && h !== g && (c = !0);
|
|
}
|
|
e = this.fallback_.getProperty(e);
|
|
f = e.indexOf(f);
|
|
g = e.indexOf(g);
|
|
if (f < g) return -1;
|
|
if (g < f) return 1;
|
|
}
|
|
return 0;
|
|
};
|
|
sre.DynamicCstr.DefaultComparator.prototype.toString = function () {
|
|
return this.reference_.toString() + "\n" + this.fallback_.toString();
|
|
};
|
|
sre.DynamicProperties.create = function (a) {
|
|
for (
|
|
var b = sre.DynamicCstr.DEFAULT_ORDER,
|
|
c = {},
|
|
d = Array.prototype.slice.call(arguments, 0),
|
|
e = 0,
|
|
f = d.length,
|
|
g = b.length;
|
|
e < f && e < g;
|
|
e++
|
|
)
|
|
c[b[e]] = d[e];
|
|
return new sre.DynamicProperties(c);
|
|
};
|
|
sre.DynamicCstr.create = function (a) {
|
|
for (
|
|
var b = sre.DynamicCstr.DEFAULT_ORDER,
|
|
c = {},
|
|
d = Array.prototype.slice.call(arguments, 0),
|
|
e = 0,
|
|
f = d.length,
|
|
g = b.length;
|
|
e < f && e < g;
|
|
e++
|
|
)
|
|
c[b[e]] = d[e];
|
|
return new sre.DynamicCstr(c);
|
|
};
|
|
sre.DynamicCstr.defaultCstr = function () {
|
|
return sre.DynamicCstr.create.apply(
|
|
null,
|
|
sre.DynamicCstr.DEFAULT_ORDER.map(function (a) {
|
|
return sre.DynamicCstr.DEFAULT_VALUES[a];
|
|
}),
|
|
);
|
|
};
|
|
sre.DynamicCstr.validOrder = function (a) {
|
|
var b = sre.DynamicCstr.DEFAULT_ORDER.slice();
|
|
return a.every(function (c) {
|
|
c = b.indexOf(c);
|
|
return -1 !== c && b.splice(c, 1);
|
|
});
|
|
};
|
|
sre.Engine = function () {
|
|
this.evaluator = sre.Engine.defaultEvaluator;
|
|
this.parser = this.defaultParser = new sre.DynamicCstr.Parser(
|
|
sre.DynamicCstr.DEFAULT_ORDER,
|
|
);
|
|
this.parsers = {};
|
|
this.dynamicCstr = sre.DynamicCstr.defaultCstr();
|
|
this.comparator = null;
|
|
this.comparators = {};
|
|
this.domain = sre.DynamicCstr.DEFAULT_VALUES[sre.DynamicCstr.Axis.DOMAIN];
|
|
this.style = sre.DynamicCstr.DEFAULT_VALUES[sre.DynamicCstr.Axis.STYLE];
|
|
this.locale = sre.DynamicCstr.DEFAULT_VALUES[sre.DynamicCstr.Axis.LOCALE];
|
|
this.modality = sre.DynamicCstr.DEFAULT_VALUES[sre.DynamicCstr.Axis.MODALITY];
|
|
this.walker = "Table";
|
|
this.mode = sre.Engine.Mode.SYNC;
|
|
this.speech = sre.Engine.Speech.NONE;
|
|
this.structure = !1;
|
|
this.ruleSets = [];
|
|
this.cache = !0;
|
|
this.markup = sre.Engine.Markup.NONE;
|
|
this.isEdge = this.isIE = this.strict = !1;
|
|
this.rate = "100";
|
|
this.pprint = !1;
|
|
this.setupTests_ = [];
|
|
this.config = !1;
|
|
};
|
|
goog.addSingletonGetter(sre.Engine);
|
|
sre.Engine.personalityProps = {
|
|
PITCH: "pitch",
|
|
RATE: "rate",
|
|
VOLUME: "volume",
|
|
PAUSE: "pause",
|
|
JOIN: "join",
|
|
};
|
|
sre.Engine.Mode = { SYNC: "sync", ASYNC: "async", HTTP: "http" };
|
|
sre.Engine.Speech = { NONE: "none", SHALLOW: "shallow", DEEP: "deep" };
|
|
sre.Engine.Markup = {
|
|
NONE: "none",
|
|
PUNCTUATION: "punctuation",
|
|
SSML: "ssml",
|
|
SSML_STEP: "ssml_step",
|
|
ACSS: "acss",
|
|
SABLE: "sable",
|
|
VOICEXML: "voicexml",
|
|
};
|
|
sre.Engine.registerTest = function (a) {
|
|
sre.Engine.getInstance().setupTests_.push(a);
|
|
};
|
|
sre.Engine.isReady = function () {
|
|
return sre.Engine.getInstance().setupTests_.every(function (a) {
|
|
return a();
|
|
});
|
|
};
|
|
sre.Engine.prototype.setupBrowsers = function () {
|
|
this.isIE = sre.BrowserUtil.detectIE();
|
|
this.isEdge = sre.BrowserUtil.detectEdge();
|
|
};
|
|
sre.Engine.prototype.getAxisValues = function () {
|
|
return sre.DynamicCstr.getAxisValues();
|
|
};
|
|
sre.Engine.defaultEvaluator = function (a, b) {
|
|
return a;
|
|
};
|
|
sre.Engine.prototype.getRate = function () {
|
|
var a = parseInt(this.rate, 10);
|
|
return isNaN(a) ? 100 : a;
|
|
};
|
|
sre.Engine.Error = function (a) {
|
|
Error.call(this);
|
|
this.message = a || "";
|
|
this.name = "SRE Error";
|
|
};
|
|
goog.inherits(sre.Engine.Error, Error);
|
|
sre.Engine.BINARY_FEATURES = ["strict", "cache", "structure", "pprint"];
|
|
sre.Engine.STRING_FEATURES =
|
|
"markup style domain speech walker locale modality rate".split(" ");
|
|
sre.Engine.prototype.setDynamicCstr = function (a) {
|
|
if (a)
|
|
for (var b = Object.keys(a), c = 0; c < b.length; c++) {
|
|
var d = b[c];
|
|
-1 !== sre.DynamicCstr.DEFAULT_ORDER.indexOf(d) && (this[d] = a[d]);
|
|
}
|
|
sre.Engine.DOMAIN_TO_STYLES[this.domain] = this.style;
|
|
a = [this.locale, this.modality, this.domain, this.style].join(".");
|
|
b = sre.DynamicProperties.create(
|
|
[sre.DynamicCstr.DEFAULT_VALUES[sre.DynamicCstr.Axis.LOCALE]],
|
|
[sre.DynamicCstr.DEFAULT_VALUES[sre.DynamicCstr.Axis.MODALITY]],
|
|
[sre.DynamicCstr.DEFAULT_VALUES[sre.DynamicCstr.Axis.DOMAIN]],
|
|
[sre.DynamicCstr.DEFAULT_VALUES[sre.DynamicCstr.Axis.STYLE]],
|
|
);
|
|
c = this.comparators[this.domain];
|
|
this.parser = (d = this.parsers[this.domain]) ? d : this.defaultParser;
|
|
this.dynamicCstr = this.parser.parse(a);
|
|
this.dynamicCstr.updateProperties(b.getProperties());
|
|
this.comparator = c
|
|
? c()
|
|
: new sre.DynamicCstr.DefaultComparator(this.dynamicCstr);
|
|
};
|
|
sre.Engine.DOMAIN_TO_STYLES = { mathspeak: "default", clearspeak: "default" };
|
|
sre.BaseUtil = {};
|
|
sre.BaseUtil.removeEmpty = function (a) {
|
|
return a.filter(function (b) {
|
|
return b;
|
|
});
|
|
};
|
|
sre.BaseUtil.interleaveLists = function (a, b) {
|
|
for (var c = []; a.length || b.length; )
|
|
a.length && c.push(a.shift()), b.length && c.push(b.shift());
|
|
return c;
|
|
};
|
|
sre.BaseUtil.setdifference = function (a, b) {
|
|
return a
|
|
? b
|
|
? a.filter(function (c) {
|
|
return 0 > b.indexOf(c);
|
|
})
|
|
: a
|
|
: [];
|
|
};
|
|
sre.BaseUtil.union = function (a, b) {
|
|
return a && b ? a.concat(sre.BaseUtil.setdifference(b, a)) : a || b || [];
|
|
};
|
|
sre.BaseUtil.makePath = function (a) {
|
|
return a.match("/$") ? a : a + "/";
|
|
};
|
|
sre.Debugger = function () {
|
|
this.isActive_ = !1;
|
|
this.outputFunction_ = console.info;
|
|
this.stream_ = null;
|
|
};
|
|
goog.addSingletonGetter(sre.Debugger);
|
|
sre.Debugger.prototype.init = function (a) {
|
|
a && this.startDebugFile_(a);
|
|
this.isActive_ = !0;
|
|
};
|
|
sre.Debugger.prototype.startDebugFile_ = function (a) {
|
|
this.stream_ = sre.SystemExternal.fs.createWriteStream(a);
|
|
this.outputFunction_ = goog.bind(function (b) {
|
|
var c = Array.prototype.slice.call(arguments, 0);
|
|
this.stream_.write(c.join(" "));
|
|
this.stream_.write("\n");
|
|
}, this);
|
|
this.stream_.on(
|
|
"error",
|
|
goog.bind(function (b) {
|
|
console.info("Invalid log file. Debug information sent to console.");
|
|
this.outputFunction_ = console.info;
|
|
}, this),
|
|
);
|
|
this.stream_.on("finish", function () {
|
|
console.info("Finalizing debug file.");
|
|
});
|
|
};
|
|
sre.Debugger.prototype.output_ = function (a) {
|
|
this.outputFunction_.apply(
|
|
console.info === this.outputFunction_ ? console : this.outputFunction_,
|
|
["Speech Rule Engine Debugger:"].concat(a),
|
|
);
|
|
};
|
|
sre.Debugger.prototype.output = function (a) {
|
|
this.isActive_ && this.output_(Array.prototype.slice.call(arguments, 0));
|
|
};
|
|
sre.Debugger.prototype.generateOutput = function (a) {
|
|
this.isActive_ && this.output_(a.apply(a, []));
|
|
};
|
|
sre.Debugger.prototype.exit = function (a) {
|
|
this.isActive_ &&
|
|
this.stream_ &&
|
|
this.stream_.end("", "", a || function () {});
|
|
};
|
|
sre.Grammar = function () {
|
|
this.parameters_ = {};
|
|
this.corrections_ = {};
|
|
this.preprocessors_ = {};
|
|
this.stateStack_ = [];
|
|
this.currentFlags = {};
|
|
};
|
|
goog.addSingletonGetter(sre.Grammar);
|
|
sre.Grammar.ATTRIBUTE = "grammar";
|
|
sre.Grammar.prototype.clear = function () {
|
|
this.parameters_ = {};
|
|
this.stateStack_ = [];
|
|
};
|
|
sre.Grammar.prototype.setParameter = function (a, b) {
|
|
var c = this.parameters_[a];
|
|
b ? (this.parameters_[a] = b) : delete this.parameters_[a];
|
|
return c;
|
|
};
|
|
sre.Grammar.prototype.getParameter = function (a) {
|
|
return this.parameters_[a];
|
|
};
|
|
sre.Grammar.prototype.setCorrection = function (a, b) {
|
|
this.corrections_[a] = b;
|
|
};
|
|
sre.Grammar.prototype.setPreprocessor = function (a, b) {
|
|
this.preprocessors_[a] = b;
|
|
};
|
|
sre.Grammar.prototype.getCorrection = function (a) {
|
|
return this.corrections_[a];
|
|
};
|
|
sre.Grammar.prototype.getState = function () {
|
|
var a = [],
|
|
b;
|
|
for (b in this.parameters_) {
|
|
var c = this.parameters_[b];
|
|
a.push("string" === typeof c ? b + ":" + c : b);
|
|
}
|
|
return a.join(" ");
|
|
};
|
|
sre.Grammar.prototype.pushState = function (a) {
|
|
for (var b in a) a[b] = this.setParameter(b, a[b]);
|
|
this.stateStack_.push(a);
|
|
};
|
|
sre.Grammar.prototype.popState = function () {
|
|
var a = this.stateStack_.pop(),
|
|
b;
|
|
for (b in a) this.setParameter(b, a[b]);
|
|
};
|
|
sre.Grammar.prototype.setAttribute = function (a) {
|
|
if (a && a.nodeType === sre.DomUtil.NodeType.ELEMENT_NODE) {
|
|
var b = this.getState();
|
|
b && a.setAttribute(sre.Grammar.ATTRIBUTE, b);
|
|
}
|
|
};
|
|
sre.Grammar.prototype.preprocess = function (a) {
|
|
return this.runProcessors_(a, this.preprocessors_);
|
|
};
|
|
sre.Grammar.prototype.correct = function (a) {
|
|
return this.runProcessors_(a, this.corrections_);
|
|
};
|
|
sre.Grammar.prototype.runProcessors_ = function (a, b) {
|
|
for (var c in this.parameters_) {
|
|
var d = b[c];
|
|
if (d) {
|
|
var e = this.parameters_[c];
|
|
a = !0 === e ? d(a) : d(a, e);
|
|
}
|
|
}
|
|
return a;
|
|
};
|
|
sre.Grammar.translateString_ = function (a) {
|
|
a = sre.Grammar.prepareUnit_(a);
|
|
var b = sre.Engine.getInstance();
|
|
a = b.evaluator(a, b.dynamicCstr) || a;
|
|
return sre.Grammar.cleanUnit_(a);
|
|
};
|
|
sre.Grammar.prepareUnit_ = function (a) {
|
|
var b = a.match(/:unit$/);
|
|
return b ? a.slice(0, b.index).replace(/\s+/g, " ") + a.slice(b.index) : a;
|
|
};
|
|
sre.Grammar.cleanUnit_ = function (a) {
|
|
return a.match(/:unit$/)
|
|
? (sre.Grammar.getInstance().setParameter("plural", !1),
|
|
a.replace(/:unit$/, ""))
|
|
: a;
|
|
};
|
|
sre.Grammar.prototype.apply = function (a, b) {
|
|
this.currentFlags = b || {};
|
|
a =
|
|
this.currentFlags.adjust || this.currentFlags.preprocess
|
|
? sre.Grammar.getInstance().preprocess(a)
|
|
: a;
|
|
if (this.parameters_.translate || this.currentFlags.translate)
|
|
a = sre.Grammar.translateString_(a);
|
|
a =
|
|
this.currentFlags.adjust || this.currentFlags.correct
|
|
? sre.Grammar.getInstance().correct(a)
|
|
: a;
|
|
this.currentFlags = {};
|
|
return a;
|
|
};
|
|
sre.Grammar.parseState = function (a) {
|
|
var b = {};
|
|
a = a.split(" ");
|
|
for (var c = 0, d = a.length; c < d; c++) {
|
|
var e = a[c].split(":"),
|
|
f = e[1];
|
|
b[e[0]] = f ? f : !0;
|
|
}
|
|
return b;
|
|
};
|
|
sre.Grammar.parseInput = function (a) {
|
|
var b = {};
|
|
a = a.split(":");
|
|
for (var c = 0, d = a.length; c < d; c++) {
|
|
var e = a[c].split("="),
|
|
f = e[0].trim();
|
|
e[1]
|
|
? (b[f] = e[1].trim())
|
|
: f.match(/^!/)
|
|
? (b[f.slice(1)] = !1)
|
|
: (b[f] = !0);
|
|
}
|
|
return b;
|
|
};
|
|
sre.Grammar.correctFont_ = function (a, b) {
|
|
if (!b || !a) return a;
|
|
b = sre.Messages.MS_FUNC.FONT_REGEXP(sre.Locale.localFont(b));
|
|
return a.replace(b, "");
|
|
};
|
|
sre.Grammar.addAnnotation_ = function (a, b) {
|
|
return a + ":" + b;
|
|
};
|
|
sre.Grammar.noTranslateText_ = function (a) {
|
|
a.match(new RegExp("^[" + sre.Messages.REGEXP.TEXT + "]+$")) &&
|
|
(sre.Grammar.getInstance().currentFlags.translate = !1);
|
|
return a;
|
|
};
|
|
sre.Grammar.getInstance().setCorrection("ignoreFont", sre.Grammar.correctFont_);
|
|
sre.Grammar.getInstance().setPreprocessor(
|
|
"annotation",
|
|
sre.Grammar.addAnnotation_,
|
|
);
|
|
sre.Grammar.getInstance().setPreprocessor(
|
|
"noTranslateText",
|
|
sre.Grammar.noTranslateText_,
|
|
);
|
|
sre.Grammar.getInstance().setCorrection("ignoreCaps", sre.Grammar.correctFont_);
|
|
sre.XpathUtil = {};
|
|
sre.XpathUtil.xpathSupported = function () {
|
|
return "undefined" == typeof XPathResult ? !1 : !0;
|
|
};
|
|
sre.XpathUtil.currentDocument = null;
|
|
sre.XpathUtil.xpathEvaluate = sre.XpathUtil.xpathSupported()
|
|
? document.evaluate
|
|
: sre.SystemExternal.xpath.evaluate;
|
|
sre.XpathUtil.xpathResult = sre.XpathUtil.xpathSupported()
|
|
? XPathResult
|
|
: sre.SystemExternal.xpath.XPathResult;
|
|
sre.XpathUtil.createNSResolver = sre.XpathUtil.xpathSupported()
|
|
? document.createNSResolver
|
|
: sre.SystemExternal.xpath.createNSResolver;
|
|
sre.XpathUtil.nameSpaces_ = {
|
|
xhtml: "http://www.w3.org/1999/xhtml",
|
|
mathml: "http://www.w3.org/1998/Math/MathML",
|
|
mml: "http://www.w3.org/1998/Math/MathML",
|
|
svg: "http://www.w3.org/2000/svg",
|
|
};
|
|
sre.XpathUtil.resolveNameSpace = function (a) {
|
|
return sre.XpathUtil.nameSpaces_[a] || null;
|
|
};
|
|
sre.XpathUtil.resolver_ = function () {
|
|
this.lookupNamespaceURI = sre.XpathUtil.resolveNameSpace;
|
|
};
|
|
sre.XpathUtil.evaluateXpath_ = function (a, b, c) {
|
|
var d = sre.Engine.getInstance();
|
|
return d.mode !== sre.Engine.Mode.HTTP || d.isIE || d.isEdge
|
|
? sre.XpathUtil.xpathEvaluate(a, b, new sre.XpathUtil.resolver_(), c, null)
|
|
: sre.XpathUtil.currentDocument.evaluate(
|
|
a,
|
|
b,
|
|
sre.XpathUtil.resolveNameSpace,
|
|
c,
|
|
null,
|
|
);
|
|
};
|
|
sre.XpathUtil.evalXPath = function (a, b) {
|
|
try {
|
|
var c = sre.XpathUtil.evaluateXpath_(
|
|
a,
|
|
b,
|
|
sre.XpathUtil.xpathResult.ORDERED_NODE_ITERATOR_TYPE,
|
|
);
|
|
} catch (d) {
|
|
return [];
|
|
}
|
|
a = [];
|
|
for (b = c.iterateNext(); b; b = c.iterateNext()) a.push(b);
|
|
return a;
|
|
};
|
|
sre.XpathUtil.getLeafNodes = function (a) {
|
|
return sre.XpathUtil.evalXPath(".//*[count(*)=0]", a);
|
|
};
|
|
sre.XpathUtil.evaluateBoolean = function (a, b) {
|
|
try {
|
|
var c = sre.XpathUtil.evaluateXpath_(
|
|
a,
|
|
b,
|
|
sre.XpathUtil.xpathResult.BOOLEAN_TYPE,
|
|
);
|
|
} catch (d) {
|
|
return !1;
|
|
}
|
|
return c.booleanValue;
|
|
};
|
|
sre.XpathUtil.evaluateString = function (a, b) {
|
|
try {
|
|
var c = sre.XpathUtil.evaluateXpath_(
|
|
a,
|
|
b,
|
|
sre.XpathUtil.xpathResult.STRING_TYPE,
|
|
);
|
|
} catch (d) {
|
|
return "";
|
|
}
|
|
return c.stringValue;
|
|
};
|
|
sre.DomUtil = {};
|
|
sre.DomUtil.toArray = function (a) {
|
|
for (var b = [], c = 0, d = a.length; c < d; c++) b.push(a[c]);
|
|
return b;
|
|
};
|
|
sre.DomUtil.trimInput_ = function (a) {
|
|
a = a.replace(/ /g, "\u00a0");
|
|
return a.replace(/>[ \f\n\r\t\v\u200b]+</g, "><").trim();
|
|
};
|
|
sre.DomUtil.XML_ENTITIES = {
|
|
"<": !0,
|
|
">": !0,
|
|
"&": !0,
|
|
""": !0,
|
|
"'": !0,
|
|
};
|
|
sre.DomUtil.parseInput = function (a, b) {
|
|
b = b || sre.Engine.Error;
|
|
var c = new sre.SystemExternal.xmldom.DOMParser();
|
|
a = sre.DomUtil.trimInput_(a);
|
|
var d = !!a.match(/&(?!lt|gt|amp|quot|apos)\w+;/g);
|
|
if (!a) throw new b("Empty input!");
|
|
try {
|
|
var e = c.parseFromString(a, d ? "text/html" : "text/xml");
|
|
return sre.Engine.getInstance().mode === sre.Engine.Mode.HTTP
|
|
? ((sre.XpathUtil.currentDocument = e),
|
|
d ? e.body.childNodes[0] : e.documentElement)
|
|
: e.documentElement;
|
|
} catch (f) {
|
|
throw new b("Illegal input: " + f.message);
|
|
}
|
|
};
|
|
sre.DomUtil.NodeType = {
|
|
ELEMENT_NODE: 1,
|
|
ATTRIBUTE_NODE: 2,
|
|
TEXT_NODE: 3,
|
|
CDATA_SECTION_NODE: 4,
|
|
ENTITY_REFERENCE_NODE: 5,
|
|
ENTITY_NODE: 6,
|
|
PROCESSING_INSTRUCTION_NODE: 7,
|
|
COMMENT_NODE: 8,
|
|
DOCUMENT_NODE: 9,
|
|
DOCUMENT_TYPE_NODE: 10,
|
|
DOCUMENT_FRAGMENT_NODE: 11,
|
|
NOTATION_NODE: 12,
|
|
};
|
|
sre.DomUtil.replaceNode = function (a, b) {
|
|
a.parentNode &&
|
|
(a.parentNode.insertBefore(b, a), a.parentNode.removeChild(a));
|
|
};
|
|
sre.DomUtil.createElement = function (a) {
|
|
return sre.SystemExternal.document.createElement(a);
|
|
};
|
|
sre.DomUtil.createElementNS = function (a, b) {
|
|
return sre.SystemExternal.document.createElementNS(a, b);
|
|
};
|
|
sre.DomUtil.createTextNode = function (a) {
|
|
return sre.SystemExternal.document.createTextNode(a);
|
|
};
|
|
sre.DomUtil.formatXml = function (a) {
|
|
var b = "",
|
|
c = /(>)(<)(\/*)/g;
|
|
a = a.replace(c, "$1\r\n$2$3");
|
|
var d = 0;
|
|
a = a.split("\r\n");
|
|
c = /(\.)*(<)(\/*)/g;
|
|
for (
|
|
a = a
|
|
.map(function (h) {
|
|
return h.replace(c, "$1\r\n$2$3").split("\r\n");
|
|
})
|
|
.reduce(function (h, k) {
|
|
return h.concat(k);
|
|
}, []);
|
|
a.length;
|
|
) {
|
|
var e = a.shift();
|
|
if (e) {
|
|
var f = 0;
|
|
if (e.match(/^<\w[^>\/]*>[^>]+$/)) {
|
|
var g = sre.DomUtil.matchingStartEnd_(e, a[0]);
|
|
g[0]
|
|
? g[1]
|
|
? ((e += a.shift().slice(0, -g[1].length)),
|
|
g[1].trim() && a.unshift(g[1]))
|
|
: (e += a.shift())
|
|
: (f = 1);
|
|
} else
|
|
e.match(/^<\/\w/)
|
|
? 0 != d && --d
|
|
: e.match(/^<\w[^>]*[^\/]>.*$/)
|
|
? (f = 1)
|
|
: e.match(/^<\w[^>]*\/>.+$/)
|
|
? ((g = e.indexOf(">") + 1),
|
|
e.slice(g).trim() && a.unshift(),
|
|
(e = e.slice(0, g)))
|
|
: (f = 0);
|
|
b += Array(d + 1).join(" ") + e + "\r\n";
|
|
d += f;
|
|
}
|
|
}
|
|
return b;
|
|
};
|
|
sre.DomUtil.matchingStartEnd_ = function (a, b) {
|
|
if (!b) return [!1, ""];
|
|
a = a.match(/^<([^> ]+).*>/);
|
|
b = b.match(/^<\/([^>]+)>(.*)/);
|
|
return a && b && a[1] === b[1] ? [!0, b[2]] : [!1, ""];
|
|
};
|
|
sre.DomUtil.dataAttribute = function (a) {
|
|
a.match(/^data-/) && (a = a.substr(5));
|
|
return a.replace(/-([a-z])/g, function (b, c) {
|
|
return c.toUpperCase();
|
|
});
|
|
};
|
|
sre.DomUtil.getDataAttribute = function (a, b) {
|
|
return a.dataset
|
|
? a.dataset[sre.DomUtil.dataAttribute(b)]
|
|
: a.getAttribute(b);
|
|
};
|
|
sre.DomUtil.querySelectorAllByAttr = function (a, b) {
|
|
return a.querySelectorAll
|
|
? sre.DomUtil.toArray(a.querySelectorAll("[" + b + "]"))
|
|
: sre.XpathUtil.evalXPath(".//*[@" + b + "]", a);
|
|
};
|
|
sre.DomUtil.querySelectorAllByAttrValue = function (a, b, c) {
|
|
return a.querySelectorAll
|
|
? sre.DomUtil.toArray(a.querySelectorAll("[" + b + '="' + c + '"]'))
|
|
: sre.XpathUtil.evalXPath(".//*[@" + b + '="' + c + '"]', a);
|
|
};
|
|
sre.DomUtil.querySelectorAll = function (a, b) {
|
|
return a.querySelectorAll
|
|
? sre.DomUtil.toArray(a.querySelectorAll(b))
|
|
: sre.XpathUtil.evalXPath(".//" + b, a);
|
|
};
|
|
sre.DomUtil.tagName = function (a) {
|
|
return a.tagName.toUpperCase();
|
|
};
|
|
sre.Numbers = {};
|
|
sre.Numbers.identityTransformer_ = function (a) {
|
|
return a.toString();
|
|
};
|
|
sre.Numbers.pluralTransformer_ = function (a, b) {
|
|
return a.toString();
|
|
};
|
|
sre.Numbers.NUMBERS = {
|
|
wordOrdinal: sre.Numbers.identityTransformer_,
|
|
simpleOrdinal: sre.Numbers.identityTransformer_,
|
|
numberToWords: sre.Numbers.identityTransformer_,
|
|
numberToOrdinal: sre.Numbers.pluralTransformer_,
|
|
vulgarSep: " ",
|
|
numSep: " ",
|
|
};
|
|
sre.Messages = {};
|
|
sre.Messages.MS = {
|
|
START: "",
|
|
FRAC_V: "",
|
|
FRAC_B: "",
|
|
FRAC_S: "",
|
|
END: "",
|
|
FRAC_OVER: "",
|
|
TWICE: "",
|
|
NEST_FRAC: "",
|
|
ENDFRAC: "",
|
|
SUPER: "",
|
|
SUB: "",
|
|
SUP: "",
|
|
SUPERSCRIPT: "",
|
|
SUBSCRIPT: "",
|
|
BASELINE: "",
|
|
BASE: "",
|
|
NESTED: "",
|
|
NEST_ROOT: "",
|
|
STARTROOT: "",
|
|
ENDROOT: "",
|
|
ROOTINDEX: "",
|
|
ROOT: "",
|
|
INDEX: "",
|
|
UNDER: "",
|
|
UNDERSCRIPT: "",
|
|
OVER: "",
|
|
OVERSCRIPT: "",
|
|
};
|
|
sre.Messages.MS_FUNC = {
|
|
FRAC_NEST_DEPTH: function (a) {
|
|
return !1;
|
|
},
|
|
RADICAL_NEST_DEPTH: function (a) {
|
|
return "";
|
|
},
|
|
COMBINE_ROOT_INDEX: function (a, b) {
|
|
return a;
|
|
},
|
|
};
|
|
sre.Messages.MS_ROOT_INDEX = {};
|
|
sre.Messages.FONT = {
|
|
bold: "",
|
|
"bold-fraktur": "",
|
|
"bold-italic": "",
|
|
"bold-script": "",
|
|
caligraphic: "",
|
|
"caligraphic-bold": "",
|
|
"double-struck": "",
|
|
"double-struck-italic": "",
|
|
fraktur: "",
|
|
italic: "",
|
|
monospace: "",
|
|
normal: "",
|
|
oldstyle: "",
|
|
"oldstyle-bold": "",
|
|
script: "",
|
|
"sans-serif": "",
|
|
"sans-serif-italic": "",
|
|
"sans-serif-bold": "",
|
|
"sans-serif-bold-italic": "",
|
|
unknown: "",
|
|
};
|
|
sre.Messages.EMBELLISH = {
|
|
super: "",
|
|
sub: "",
|
|
circled: "",
|
|
parenthesized: "",
|
|
period: "",
|
|
"negative-circled": "",
|
|
"double-circled": "",
|
|
"circled-sans-serif": "",
|
|
"negative-circled-sans-serif": "",
|
|
blackboard: "",
|
|
comma: "",
|
|
squared: "",
|
|
"negative-squared": "",
|
|
};
|
|
sre.Messages.ROLE = {
|
|
addition: "",
|
|
multiplication: "",
|
|
subtraction: "",
|
|
division: "",
|
|
equality: "",
|
|
inequality: "",
|
|
element: "",
|
|
arrow: "",
|
|
determinant: "",
|
|
rowvector: "",
|
|
binomial: "",
|
|
squarematrix: "",
|
|
"set empty": "",
|
|
"set extended": "",
|
|
"set singleton": "",
|
|
"set collection": "",
|
|
label: "",
|
|
multiline: "",
|
|
matrix: "",
|
|
vector: "",
|
|
cases: "",
|
|
table: "",
|
|
unknown: "",
|
|
};
|
|
sre.Messages.ENCLOSE = {
|
|
longdiv: "",
|
|
actuarial: "",
|
|
radical: "",
|
|
box: "",
|
|
roundedbox: "",
|
|
circle: "",
|
|
left: "",
|
|
right: "",
|
|
top: "",
|
|
bottom: "",
|
|
updiagonalstrike: "",
|
|
downdiagonalstrike: "",
|
|
verticalstrike: "",
|
|
horizontalstrike: "",
|
|
madruwb: "",
|
|
updiagonalarrow: "",
|
|
phasorangle: "",
|
|
unknown: "",
|
|
};
|
|
sre.Messages.NAVIGATE = { COLLAPSIBLE: "", EXPANDABLE: "", LEVEL: "" };
|
|
sre.Messages.REGEXP = {
|
|
TEXT: "a-zA-Z",
|
|
NUMBER: "",
|
|
DECIMAL_MARK: "",
|
|
DIGIT_GROUP: "",
|
|
JOINER_SUBSUPER: " ",
|
|
};
|
|
sre.Messages.PLURAL_UNIT = {};
|
|
sre.Messages.PLURAL = function (a) {
|
|
return /.*s$/.test(a) ? a : a + "s";
|
|
};
|
|
sre.Messages.UNIT_TIMES = "";
|
|
sre.Messages.NUMBERS = sre.Numbers.NUMBERS;
|
|
sre.Messages.ALPHABETS = {
|
|
latinSmall: [],
|
|
latinCap: [],
|
|
greekSmall: [],
|
|
greekCap: [],
|
|
};
|
|
sre.Messages.ALPHABET_PREFIXES = {
|
|
capPrefix: { default: "" },
|
|
smallPrefix: { default: "" },
|
|
digitPrefix: { default: "" },
|
|
};
|
|
sre.Messages.identityTransformer_ = function (a) {
|
|
return a.toString();
|
|
};
|
|
sre.Messages.ALPHABET_TRANSFORMERS = {
|
|
digit: { default: sre.Messages.identityTransformer_ },
|
|
letter: { default: sre.Messages.identityTransformer_ },
|
|
};
|
|
sre.Messages.ALPHABET_COMBINER = function (a, b, c) {
|
|
return a;
|
|
};
|
|
sre.NumbersUtil = {};
|
|
sre.NumbersUtil.ordinalCounter = function (a, b) {
|
|
var c = 0;
|
|
return function () {
|
|
return sre.Messages.NUMBERS.simpleOrdinal(++c) + " " + b;
|
|
};
|
|
};
|
|
sre.NumbersUtil.convertVulgarFraction_ = function (a) {
|
|
if (
|
|
!a.childNodes ||
|
|
!a.childNodes[0] ||
|
|
!a.childNodes[0].childNodes ||
|
|
2 > a.childNodes[0].childNodes.length ||
|
|
a.childNodes[0].childNodes[0].tagName !== sre.SemanticAttr.Type.NUMBER ||
|
|
a.childNodes[0].childNodes[0].getAttribute("role") !==
|
|
sre.SemanticAttr.Role.INTEGER ||
|
|
a.childNodes[0].childNodes[1].tagName !== sre.SemanticAttr.Type.NUMBER ||
|
|
a.childNodes[0].childNodes[1].getAttribute("role") !==
|
|
sre.SemanticAttr.Role.INTEGER
|
|
)
|
|
return { convertible: !1, content: a.textContent };
|
|
var b = a.childNodes[0].childNodes[1].textContent;
|
|
a = a.childNodes[0].childNodes[0].textContent;
|
|
var c = Number(b),
|
|
d = Number(a);
|
|
return isNaN(c) || isNaN(d)
|
|
? {
|
|
convertible: !1,
|
|
content: a + " " + sre.Messages.MS.FRAC_OVER + " " + b,
|
|
}
|
|
: { convertible: !0, enumerator: d, denominator: c };
|
|
};
|
|
sre.NumbersUtil.vulgarFraction = function (a) {
|
|
a = sre.NumbersUtil.convertVulgarFraction_(a);
|
|
return a.convertible && a.enumerator && a.denominator
|
|
? sre.Messages.NUMBERS.numberToWords(a.enumerator) +
|
|
sre.Messages.NUMBERS.vulgarSep +
|
|
sre.Messages.NUMBERS.numberToOrdinal(a.denominator, 1 !== a.enumerator)
|
|
: a.content || "";
|
|
};
|
|
sre.NumbersUtil.vulgarFractionSmall = function (a, b, c) {
|
|
var d = sre.NumbersUtil.convertVulgarFraction_(a);
|
|
return d.convertible
|
|
? ((a = d.enumerator),
|
|
(d = d.denominator),
|
|
0 < a && a < b && 0 < d && d < c)
|
|
: !1;
|
|
};
|
|
sre.NumbersUtil.ordinalPosition = function (a) {
|
|
var b = sre.DomUtil.toArray(a.parentNode.childNodes);
|
|
return sre.Messages.NUMBERS.simpleOrdinal(b.indexOf(a) + 1).toString();
|
|
};
|
|
sre.SemanticUtil = function () {};
|
|
sre.SemanticUtil.objectsToKeys = function (a) {
|
|
a = Array.prototype.slice.call(arguments, 0);
|
|
var b = [];
|
|
return b.concat.apply(b, a.map(Object.keys));
|
|
};
|
|
sre.SemanticUtil.objectsToValues = function (a) {
|
|
a = Array.prototype.slice.call(arguments, 0);
|
|
var b = [];
|
|
a.forEach(function (c) {
|
|
for (var d in c) b.push(c[d]);
|
|
});
|
|
return b;
|
|
};
|
|
sre.SemanticUtil.unicodeToNumber = function (a) {
|
|
if (!a || 2 < a.length) return null;
|
|
if (2 == a.length) {
|
|
var b = a.charCodeAt(0);
|
|
a = a.charCodeAt(1);
|
|
return 55296 <= b && 56319 >= b && !isNaN(a)
|
|
? 1024 * (b - 55296) + (a - 56320) + 65536
|
|
: null;
|
|
}
|
|
return a.charCodeAt(0);
|
|
};
|
|
sre.SemanticUtil.numberToUnicode = function (a) {
|
|
return 65536 > a
|
|
? String.fromCharCode(a)
|
|
: String.fromCharCode(
|
|
(a - 65536) / 1024 + 55296,
|
|
((a - 65536) % 1024) + 56320,
|
|
);
|
|
};
|
|
sre.SemanticUtil.splitUnicode = function (a) {
|
|
a = a.split("");
|
|
for (var b = [], c = 0, d; (d = a[c]); c++)
|
|
"\ud800" <= d && "\udbff" >= d && a[c + 1] ? b.push(d + a[++c]) : b.push(d);
|
|
return b;
|
|
};
|
|
sre.SemanticUtil.LEAFTAGS = ["MO", "MI", "MN", "MTEXT", "MS"];
|
|
sre.SemanticUtil.IGNORETAGS =
|
|
"MERROR MPHANTOM MSPACE MALIGNGROUP MALIGNMARK MPRESCRIPTS ANNOTATION ANNOTATION-XML".split(
|
|
" ",
|
|
);
|
|
sre.SemanticUtil.EMPTYTAGS =
|
|
"MATH MROW MPADDED MACTION NONE MSTYLE SEMANTICS".split(" ");
|
|
sre.SemanticUtil.hasMathTag = function (a) {
|
|
return !!a && "MATH" === sre.DomUtil.tagName(a);
|
|
};
|
|
sre.SemanticUtil.hasIgnoreTag = function (a) {
|
|
return (
|
|
!!a && -1 !== sre.SemanticUtil.IGNORETAGS.indexOf(sre.DomUtil.tagName(a))
|
|
);
|
|
};
|
|
sre.SemanticUtil.hasEmptyTag = function (a) {
|
|
return (
|
|
!!a && -1 !== sre.SemanticUtil.EMPTYTAGS.indexOf(sre.DomUtil.tagName(a))
|
|
);
|
|
};
|
|
sre.SemanticUtil.purgeNodes = function (a) {
|
|
for (var b = [], c = 0, d; (d = a[c]); c++) {
|
|
var e = sre.DomUtil.tagName(d);
|
|
-1 != sre.SemanticUtil.IGNORETAGS.indexOf(e) ||
|
|
(-1 != sre.SemanticUtil.EMPTYTAGS.indexOf(e) &&
|
|
0 == d.childNodes.length) ||
|
|
b.push(d);
|
|
}
|
|
return b;
|
|
};
|
|
sre.SemanticUtil.isZeroLength = function (a) {
|
|
return a
|
|
? -1 !==
|
|
"negativeveryverythinmathspace negativeverythinmathspace negativethinmathspace negativemediummathspace negativethickmathspace negativeverythickmathspace negativeveryverythickmathspace"
|
|
.split(" ")
|
|
.indexOf(a)
|
|
? !0
|
|
: (a = a.match(/[0-9\.]+/))
|
|
? 0 === parseFloat(a)
|
|
? !0
|
|
: !1
|
|
: !1
|
|
: !1;
|
|
};
|
|
sre.SemanticUtil.directSpeechKeys = ["aria-label", "exact-speech", "alt"];
|
|
sre.SemanticUtil.addAttributes = function (a, b) {
|
|
if (b.hasAttributes()) {
|
|
b = b.attributes;
|
|
for (var c = b.length - 1; 0 <= c; c--) {
|
|
var d = b[c].name;
|
|
d.match(/^ext/) && (a.attributes[d] = b[c].value);
|
|
-1 !== sre.SemanticUtil.directSpeechKeys.indexOf(d) &&
|
|
(a.attributes["ext-speech"] = b[c].value);
|
|
}
|
|
}
|
|
};
|
|
sre.SemanticAttr = function () {
|
|
this.generalPunctuations =
|
|
'!"#%&:;?@\\\u00a1\u00a7\u00b6\u00bf\u2017\u2020\u2021\u2022\u2023\u2024\u2025\u2027\u2030\u2031\u2038\u203b\u203c\u203d\u203e\u2041\u2042\u2043\u2047\u2048\u2049\u204b\u204c\u204d\u204e\u204f\u2050\u2051\u2053\u2055\u2056\u2058\u2059\u205a\u205b\u205c\u205d\u205e\ufe10\ufe13\ufe14\ufe15\ufe16\ufe30\ufe45\ufe46\ufe49\ufe4a\ufe4b\ufe4c\ufe50\ufe54\ufe55\ufe56\ufe57\ufe5f\ufe60\ufe61\ufe68\ufe6a\ufe6b\uff01\uff02\uff03\uff05\uff06\uff07\uff0a\uff0c\uff0f\uff1a\uff1b\uff1f\uff20\uff3c'.split(
|
|
"",
|
|
);
|
|
this.colons = [":", "\uff1a", "\ufe55"];
|
|
this.invisibleComma_ = sre.SemanticUtil.numberToUnicode(8291);
|
|
this.commas = [",", this.invisibleComma_];
|
|
this.ellipses = "\u2026\u22ee\u22ef\u22f0\u22f1\ufe19".split("");
|
|
this.fullStops = [".", "\ufe52", "\uff0e"];
|
|
this.dashes = "\u2012\u2013\u2014\u2015\u301c\ufe31\ufe32\ufe58".split("");
|
|
this.primes = "'\u2032\u2033\u2034\u2035\u2036\u2037\u2057".split("");
|
|
this.degrees = ["\u00b0"];
|
|
this.openClosePairs = {
|
|
"(": ")",
|
|
"[": "]",
|
|
"{": "}",
|
|
"\u2045": "\u2046",
|
|
"\u2329": "\u232a",
|
|
"\u2768": "\u2769",
|
|
"\u276a": "\u276b",
|
|
"\u276c": "\u276d",
|
|
"\u276e": "\u276f",
|
|
"\u2770": "\u2771",
|
|
"\u2772": "\u2773",
|
|
"\u2774": "\u2775",
|
|
"\u27c5": "\u27c6",
|
|
"\u27e6": "\u27e7",
|
|
"\u27e8": "\u27e9",
|
|
"\u27ea": "\u27eb",
|
|
"\u27ec": "\u27ed",
|
|
"\u27ee": "\u27ef",
|
|
"\u2983": "\u2984",
|
|
"\u2985": "\u2986",
|
|
"\u2987": "\u2988",
|
|
"\u2989": "\u298a",
|
|
"\u298b": "\u298c",
|
|
"\u298d": "\u298e",
|
|
"\u298f": "\u2990",
|
|
"\u2991": "\u2992",
|
|
"\u2993": "\u2994",
|
|
"\u2995": "\u2996",
|
|
"\u2997": "\u2998",
|
|
"\u29d8": "\u29d9",
|
|
"\u29da": "\u29db",
|
|
"\u29fc": "\u29fd",
|
|
"\u2e22": "\u2e23",
|
|
"\u2e24": "\u2e25",
|
|
"\u2e26": "\u2e27",
|
|
"\u2e28": "\u2e29",
|
|
"\u3008": "\u3009",
|
|
"\u300a": "\u300b",
|
|
"\u300c": "\u300d",
|
|
"\u300e": "\u300f",
|
|
"\u3010": "\u3011",
|
|
"\u3014": "\u3015",
|
|
"\u3016": "\u3017",
|
|
"\u3018": "\u3019",
|
|
"\u301a": "\u301b",
|
|
"\u301d": "\u301e",
|
|
"\ufd3e": "\ufd3f",
|
|
"\ufe17": "\ufe18",
|
|
"\ufe59": "\ufe5a",
|
|
"\ufe5b": "\ufe5c",
|
|
"\ufe5d": "\ufe5e",
|
|
"\uff08": "\uff09",
|
|
"\uff3b": "\uff3d",
|
|
"\uff5b": "\uff5d",
|
|
"\uff5f": "\uff60",
|
|
"\uff62": "\uff63",
|
|
"\u2308": "\u2309",
|
|
"\u230a": "\u230b",
|
|
"\u230c": "\u230d",
|
|
"\u230e": "\u230f",
|
|
"\u231c": "\u231d",
|
|
"\u231e": "\u231f",
|
|
"\u239b": "\u239e",
|
|
"\u239c": "\u239f",
|
|
"\u239d": "\u23a0",
|
|
"\u23a1": "\u23a4",
|
|
"\u23a2": "\u23a5",
|
|
"\u23a3": "\u23a6",
|
|
"\u23a7": "\u23ab",
|
|
"\u23a8": "\u23ac",
|
|
"\u23a9": "\u23ad",
|
|
"\u23b0": "\u23b1",
|
|
"\u23b8": "\u23b9",
|
|
};
|
|
this.topBottomPairs = {
|
|
"\u23b4": "\u23b5",
|
|
"\u23dc": "\u23dd",
|
|
"\u23de": "\u23df",
|
|
"\u23e0": "\u23e1",
|
|
"\ufe35": "\ufe36",
|
|
"\ufe37": "\ufe38",
|
|
"\ufe39": "\ufe3a",
|
|
"\ufe3b": "\ufe3c",
|
|
"\ufe3d": "\ufe3e",
|
|
"\ufe3f": "\ufe40",
|
|
"\ufe41": "\ufe42",
|
|
"\ufe43": "\ufe44",
|
|
"\ufe47": "\ufe48",
|
|
};
|
|
this.leftFences = sre.SemanticUtil.objectsToKeys(this.openClosePairs);
|
|
this.rightFences = sre.SemanticUtil.objectsToValues(this.openClosePairs);
|
|
this.rightFences.push("\u301f");
|
|
this.topFences = sre.SemanticUtil.objectsToKeys(this.topBottomPairs);
|
|
this.bottomFences = sre.SemanticUtil.objectsToValues(this.topBottomPairs);
|
|
this.neutralFences =
|
|
"|\u00a6\u2016\u2758\u2980\u2af4\uffe4\uff5c\u2223".split("");
|
|
this.allFences = this.neutralFences.concat(
|
|
this.leftFences,
|
|
this.rightFences,
|
|
this.topFences,
|
|
this.bottomFences,
|
|
);
|
|
this.capitalLatin = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("");
|
|
this.smallLatin = "abcdefghijklmnopqrstuvwxyz\u0131\u0237".split("");
|
|
this.capitalLatinFullWidth =
|
|
"\uff21\uff22\uff23\uff24\uff25\uff26\uff27\uff28\uff29\uff2a\uff2b\uff2c\uff2d\uff2e\uff2f\uff30\uff31\uff32\uff33\uff34\uff35\uff36\uff37\uff38\uff39\uff3a".split(
|
|
"",
|
|
);
|
|
this.smallLatinFullWidth =
|
|
"\uff41\uff42\uff43\uff44\uff45\uff46\uff47\uff48\uff49\uff4a\uff4b\uff4c\uff4d\uff4e\uff4f\uff50\uff51\uff52\uff53\uff54\uff55\uff56\uff57\uff58\uff59\uff5a".split(
|
|
"",
|
|
);
|
|
this.capitalLatinBold =
|
|
"\ud835\udc00 \ud835\udc01 \ud835\udc02 \ud835\udc03 \ud835\udc04 \ud835\udc05 \ud835\udc06 \ud835\udc07 \ud835\udc08 \ud835\udc09 \ud835\udc0a \ud835\udc0b \ud835\udc0c \ud835\udc0d \ud835\udc0e \ud835\udc0f \ud835\udc10 \ud835\udc11 \ud835\udc12 \ud835\udc13 \ud835\udc14 \ud835\udc15 \ud835\udc16 \ud835\udc17 \ud835\udc18 \ud835\udc19".split(
|
|
" ",
|
|
);
|
|
this.smallLatinBold =
|
|
"\ud835\udc1a \ud835\udc1b \ud835\udc1c \ud835\udc1d \ud835\udc1e \ud835\udc1f \ud835\udc20 \ud835\udc21 \ud835\udc22 \ud835\udc23 \ud835\udc24 \ud835\udc25 \ud835\udc26 \ud835\udc27 \ud835\udc28 \ud835\udc29 \ud835\udc2a \ud835\udc2b \ud835\udc2c \ud835\udc2d \ud835\udc2e \ud835\udc2f \ud835\udc30 \ud835\udc31 \ud835\udc32 \ud835\udc33".split(
|
|
" ",
|
|
);
|
|
this.capitalLatinItalic =
|
|
"\ud835\udc34 \ud835\udc35 \ud835\udc36 \ud835\udc37 \ud835\udc38 \ud835\udc39 \ud835\udc3a \ud835\udc3b \ud835\udc3c \ud835\udc3d \ud835\udc3e \ud835\udc3f \ud835\udc40 \ud835\udc41 \ud835\udc42 \ud835\udc43 \ud835\udc44 \ud835\udc45 \ud835\udc46 \ud835\udc47 \ud835\udc48 \ud835\udc49 \ud835\udc4a \ud835\udc4b \ud835\udc4c \ud835\udc4d".split(
|
|
" ",
|
|
);
|
|
this.smallLatinItalic =
|
|
"\ud835\udc4e \ud835\udc4f \ud835\udc50 \ud835\udc51 \ud835\udc52 \ud835\udc53 \ud835\udc54 \u210e \ud835\udc56 \ud835\udc57 \ud835\udc58 \ud835\udc59 \ud835\udc5a \ud835\udc5b \ud835\udc5c \ud835\udc5d \ud835\udc5e \ud835\udc5f \ud835\udc60 \ud835\udc61 \ud835\udc62 \ud835\udc63 \ud835\udc64 \ud835\udc65 \ud835\udc66 \ud835\udc67 \ud835\udea4 \ud835\udea5".split(
|
|
" ",
|
|
);
|
|
this.capitalLatinBoldItalic =
|
|
"\ud835\udc68 \ud835\udc69 \ud835\udc6a \ud835\udc6b \ud835\udc6c \ud835\udc6d \ud835\udc6e \ud835\udc6f \ud835\udc70 \ud835\udc71 \ud835\udc72 \ud835\udc73 \ud835\udc74 \ud835\udc75 \ud835\udc76 \ud835\udc77 \ud835\udc78 \ud835\udc79 \ud835\udc7a \ud835\udc7b \ud835\udc7c \ud835\udc7d \ud835\udc7e \ud835\udc7f \ud835\udc80 \ud835\udc81".split(
|
|
" ",
|
|
);
|
|
this.smallLatinBoldItalic =
|
|
"\ud835\udc82 \ud835\udc83 \ud835\udc84 \ud835\udc85 \ud835\udc86 \ud835\udc87 \ud835\udc88 \ud835\udc89 \ud835\udc8a \ud835\udc8b \ud835\udc8c \ud835\udc8d \ud835\udc8e \ud835\udc8f \ud835\udc90 \ud835\udc91 \ud835\udc92 \ud835\udc93 \ud835\udc94 \ud835\udc95 \ud835\udc96 \ud835\udc97 \ud835\udc98 \ud835\udc99 \ud835\udc9a \ud835\udc9b".split(
|
|
" ",
|
|
);
|
|
this.capitalLatinScript =
|
|
"\ud835\udc9c \u212c \ud835\udc9e \ud835\udc9f \u2130 \u2131 \ud835\udca2 \u210b \u2110 \ud835\udca5 \ud835\udca6 \u2112 \u2133 \ud835\udca9 \ud835\udcaa \ud835\udcab \ud835\udcac \u211b \ud835\udcae \ud835\udcaf \ud835\udcb0 \ud835\udcb1 \ud835\udcb2 \ud835\udcb3 \ud835\udcb4 \ud835\udcb5 \u2118".split(
|
|
" ",
|
|
);
|
|
this.smallLatinScript =
|
|
"\ud835\udcb6 \ud835\udcb7 \ud835\udcb8 \ud835\udcb9 \u212f \ud835\udcbb \u210a \ud835\udcbd \ud835\udcbe \ud835\udcbf \ud835\udcc0 \ud835\udcc1 \ud835\udcc2 \ud835\udcc3 \u2134 \ud835\udcc5 \ud835\udcc6 \ud835\udcc7 \ud835\udcc8 \ud835\udcc9 \ud835\udcca \ud835\udccb \ud835\udccc \ud835\udccd \ud835\udcce \ud835\udccf \u2113".split(
|
|
" ",
|
|
);
|
|
this.capitalLatinBoldScript =
|
|
"\ud835\udcd0 \ud835\udcd1 \ud835\udcd2 \ud835\udcd3 \ud835\udcd4 \ud835\udcd5 \ud835\udcd6 \ud835\udcd7 \ud835\udcd8 \ud835\udcd9 \ud835\udcda \ud835\udcdb \ud835\udcdc \ud835\udcdd \ud835\udcde \ud835\udcdf \ud835\udce0 \ud835\udce1 \ud835\udce2 \ud835\udce3 \ud835\udce4 \ud835\udce5 \ud835\udce6 \ud835\udce7 \ud835\udce8 \ud835\udce9".split(
|
|
" ",
|
|
);
|
|
this.smallLatinBoldScript =
|
|
"\ud835\udcea \ud835\udceb \ud835\udcec \ud835\udced \ud835\udcee \ud835\udcef \ud835\udcf0 \ud835\udcf1 \ud835\udcf2 \ud835\udcf3 \ud835\udcf4 \ud835\udcf5 \ud835\udcf6 \ud835\udcf7 \ud835\udcf8 \ud835\udcf9 \ud835\udcfa \ud835\udcfb \ud835\udcfc \ud835\udcfd \ud835\udcfe \ud835\udcff \ud835\udd00 \ud835\udd01 \ud835\udd02 \ud835\udd03".split(
|
|
" ",
|
|
);
|
|
this.capitalLatinFraktur =
|
|
"\ud835\udd04 \ud835\udd05 \u212d \ud835\udd07 \ud835\udd08 \ud835\udd09 \ud835\udd0a \u210c \u2111 \ud835\udd0d \ud835\udd0e \ud835\udd0f \ud835\udd10 \ud835\udd11 \ud835\udd12 \ud835\udd13 \ud835\udd14 \u211c \ud835\udd16 \ud835\udd17 \ud835\udd18 \ud835\udd19 \ud835\udd1a \ud835\udd1b \ud835\udd1c \u2128".split(
|
|
" ",
|
|
);
|
|
this.smallLatinFraktur =
|
|
"\ud835\udd1e \ud835\udd1f \ud835\udd20 \ud835\udd21 \ud835\udd22 \ud835\udd23 \ud835\udd24 \ud835\udd25 \ud835\udd26 \ud835\udd27 \ud835\udd28 \ud835\udd29 \ud835\udd2a \ud835\udd2b \ud835\udd2c \ud835\udd2d \ud835\udd2e \ud835\udd2f \ud835\udd30 \ud835\udd31 \ud835\udd32 \ud835\udd33 \ud835\udd34 \ud835\udd35 \ud835\udd36 \ud835\udd37".split(
|
|
" ",
|
|
);
|
|
this.capitalLatinDoubleStruck =
|
|
"\ud835\udd38 \ud835\udd39 \u2102 \ud835\udd3b \ud835\udd3c \ud835\udd3d \ud835\udd3e \u210d \ud835\udd40 \ud835\udd41 \ud835\udd42 \ud835\udd43 \ud835\udd44 \u2115 \ud835\udd46 \u2119 \u211a \u211d \ud835\udd4a \ud835\udd4b \ud835\udd4c \ud835\udd4d \ud835\udd4e \ud835\udd4f \ud835\udd50 \u2124".split(
|
|
" ",
|
|
);
|
|
this.smallLatinDoubleStruck =
|
|
"\ud835\udd52 \ud835\udd53 \ud835\udd54 \ud835\udd55 \ud835\udd56 \ud835\udd57 \ud835\udd58 \ud835\udd59 \ud835\udd5a \ud835\udd5b \ud835\udd5c \ud835\udd5d \ud835\udd5e \ud835\udd5f \ud835\udd60 \ud835\udd61 \ud835\udd62 \ud835\udd63 \ud835\udd64 \ud835\udd65 \ud835\udd66 \ud835\udd67 \ud835\udd68 \ud835\udd69 \ud835\udd6a \ud835\udd6b".split(
|
|
" ",
|
|
);
|
|
this.capitalLatinBoldFraktur =
|
|
"\ud835\udd6c \ud835\udd6d \ud835\udd6e \ud835\udd6f \ud835\udd70 \ud835\udd71 \ud835\udd72 \ud835\udd73 \ud835\udd74 \ud835\udd75 \ud835\udd76 \ud835\udd77 \ud835\udd78 \ud835\udd79 \ud835\udd7a \ud835\udd7b \ud835\udd7c \ud835\udd7d \ud835\udd7e \ud835\udd7f \ud835\udd80 \ud835\udd81 \ud835\udd82 \ud835\udd83 \ud835\udd84 \ud835\udd85".split(
|
|
" ",
|
|
);
|
|
this.smallLatinBoldFraktur =
|
|
"\ud835\udd86 \ud835\udd87 \ud835\udd88 \ud835\udd89 \ud835\udd8a \ud835\udd8b \ud835\udd8c \ud835\udd8d \ud835\udd8e \ud835\udd8f \ud835\udd90 \ud835\udd91 \ud835\udd92 \ud835\udd93 \ud835\udd94 \ud835\udd95 \ud835\udd96 \ud835\udd97 \ud835\udd98 \ud835\udd99 \ud835\udd9a \ud835\udd9b \ud835\udd9c \ud835\udd9d \ud835\udd9e \ud835\udd9f".split(
|
|
" ",
|
|
);
|
|
this.capitalLatinSansSerif =
|
|
"\ud835\udda0 \ud835\udda1 \ud835\udda2 \ud835\udda3 \ud835\udda4 \ud835\udda5 \ud835\udda6 \ud835\udda7 \ud835\udda8 \ud835\udda9 \ud835\uddaa \ud835\uddab \ud835\uddac \ud835\uddad \ud835\uddae \ud835\uddaf \ud835\uddb0 \ud835\uddb1 \ud835\uddb2 \ud835\uddb3 \ud835\uddb4 \ud835\uddb5 \ud835\uddb6 \ud835\uddb7 \ud835\uddb8 \ud835\uddb9".split(
|
|
" ",
|
|
);
|
|
this.smallLatinSansSerif =
|
|
"\ud835\uddba \ud835\uddbb \ud835\uddbc \ud835\uddbd \ud835\uddbe \ud835\uddbf \ud835\uddc0 \ud835\uddc1 \ud835\uddc2 \ud835\uddc3 \ud835\uddc4 \ud835\uddc5 \ud835\uddc6 \ud835\uddc7 \ud835\uddc8 \ud835\uddc9 \ud835\uddca \ud835\uddcb \ud835\uddcc \ud835\uddcd \ud835\uddce \ud835\uddcf \ud835\uddd0 \ud835\uddd1 \ud835\uddd2 \ud835\uddd3".split(
|
|
" ",
|
|
);
|
|
this.capitalLatinSansSerifBold =
|
|
"\ud835\uddd4 \ud835\uddd5 \ud835\uddd6 \ud835\uddd7 \ud835\uddd8 \ud835\uddd9 \ud835\uddda \ud835\udddb \ud835\udddc \ud835\udddd \ud835\uddde \ud835\udddf \ud835\udde0 \ud835\udde1 \ud835\udde2 \ud835\udde3 \ud835\udde4 \ud835\udde5 \ud835\udde6 \ud835\udde7 \ud835\udde8 \ud835\udde9 \ud835\uddea \ud835\uddeb \ud835\uddec \ud835\udded".split(
|
|
" ",
|
|
);
|
|
this.smallLatinSansSerifBold =
|
|
"\ud835\uddee \ud835\uddef \ud835\uddf0 \ud835\uddf1 \ud835\uddf2 \ud835\uddf3 \ud835\uddf4 \ud835\uddf5 \ud835\uddf6 \ud835\uddf7 \ud835\uddf8 \ud835\uddf9 \ud835\uddfa \ud835\uddfb \ud835\uddfc \ud835\uddfd \ud835\uddfe \ud835\uddff \ud835\ude00 \ud835\ude01 \ud835\ude02 \ud835\ude03 \ud835\ude04 \ud835\ude05 \ud835\ude06 \ud835\ude07".split(
|
|
" ",
|
|
);
|
|
this.capitalLatinSansSerifItalic =
|
|
"\ud835\ude08 \ud835\ude09 \ud835\ude0a \ud835\ude0b \ud835\ude0c \ud835\ude0d \ud835\ude0e \ud835\ude0f \ud835\ude10 \ud835\ude11 \ud835\ude12 \ud835\ude13 \ud835\ude14 \ud835\ude15 \ud835\ude16 \ud835\ude17 \ud835\ude18 \ud835\ude19 \ud835\ude1a \ud835\ude1b \ud835\ude1c \ud835\ude1d \ud835\ude1e \ud835\ude1f \ud835\ude20 \ud835\ude21".split(
|
|
" ",
|
|
);
|
|
this.smallLatinSansSerifItalic =
|
|
"\ud835\ude22 \ud835\ude23 \ud835\ude24 \ud835\ude25 \ud835\ude26 \ud835\ude27 \ud835\ude28 \ud835\ude29 \ud835\ude2a \ud835\ude2b \ud835\ude2c \ud835\ude2d \ud835\ude2e \ud835\ude2f \ud835\ude30 \ud835\ude31 \ud835\ude32 \ud835\ude33 \ud835\ude34 \ud835\ude35 \ud835\ude36 \ud835\ude37 \ud835\ude38 \ud835\ude39 \ud835\ude3a \ud835\ude3b".split(
|
|
" ",
|
|
);
|
|
this.capitalLatinSansSerifBoldItalic =
|
|
"\ud835\ude3c \ud835\ude3d \ud835\ude3e \ud835\ude3f \ud835\ude40 \ud835\ude41 \ud835\ude42 \ud835\ude43 \ud835\ude44 \ud835\ude45 \ud835\ude46 \ud835\ude47 \ud835\ude48 \ud835\ude49 \ud835\ude4a \ud835\ude4b \ud835\ude4c \ud835\ude4d \ud835\ude4e \ud835\ude4f \ud835\ude50 \ud835\ude51 \ud835\ude52 \ud835\ude53 \ud835\ude54 \ud835\ude55".split(
|
|
" ",
|
|
);
|
|
this.smallLatinSansSerifBoldItalic =
|
|
"\ud835\ude56 \ud835\ude57 \ud835\ude58 \ud835\ude59 \ud835\ude5a \ud835\ude5b \ud835\ude5c \ud835\ude5d \ud835\ude5e \ud835\ude5f \ud835\ude60 \ud835\ude61 \ud835\ude62 \ud835\ude63 \ud835\ude64 \ud835\ude65 \ud835\ude66 \ud835\ude67 \ud835\ude68 \ud835\ude69 \ud835\ude6a \ud835\ude6b \ud835\ude6c \ud835\ude6d \ud835\ude6e \ud835\ude6f".split(
|
|
" ",
|
|
);
|
|
this.capitalLatinMonospace =
|
|
"\ud835\ude70 \ud835\ude71 \ud835\ude72 \ud835\ude73 \ud835\ude74 \ud835\ude75 \ud835\ude76 \ud835\ude77 \ud835\ude78 \ud835\ude79 \ud835\ude7a \ud835\ude7b \ud835\ude7c \ud835\ude7d \ud835\ude7e \ud835\ude7f \ud835\ude80 \ud835\ude81 \ud835\ude82 \ud835\ude83 \ud835\ude84 \ud835\ude85 \ud835\ude86 \ud835\ude87 \ud835\ude88 \ud835\ude89".split(
|
|
" ",
|
|
);
|
|
this.smallLatinMonospace =
|
|
"\ud835\ude8a \ud835\ude8b \ud835\ude8c \ud835\ude8d \ud835\ude8e \ud835\ude8f \ud835\ude90 \ud835\ude91 \ud835\ude92 \ud835\ude93 \ud835\ude94 \ud835\ude95 \ud835\ude96 \ud835\ude97 \ud835\ude98 \ud835\ude99 \ud835\ude9a \ud835\ude9b \ud835\ude9c \ud835\ude9d \ud835\ude9e \ud835\ude9f \ud835\udea0 \ud835\udea1 \ud835\udea2 \ud835\udea3".split(
|
|
" ",
|
|
);
|
|
this.latinDoubleStruckItalic = [
|
|
"\u2145",
|
|
"\u2146",
|
|
"\u2147",
|
|
"\u2148",
|
|
"\u2149",
|
|
];
|
|
this.capitalGreek =
|
|
"\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9".split(
|
|
"",
|
|
);
|
|
this.smallGreek =
|
|
"\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9".split(
|
|
"",
|
|
);
|
|
this.capitalGreekBold =
|
|
"\ud835\udea8 \ud835\udea9 \ud835\udeaa \ud835\udeab \ud835\udeac \ud835\udead \ud835\udeae \ud835\udeaf \ud835\udeb0 \ud835\udeb1 \ud835\udeb2 \ud835\udeb3 \ud835\udeb4 \ud835\udeb5 \ud835\udeb6 \ud835\udeb7 \ud835\udeb8 \ud835\udeba \ud835\udebb \ud835\udebc \ud835\udebd \ud835\udebe \ud835\udebf \ud835\udec0".split(
|
|
" ",
|
|
);
|
|
this.smallGreekBold =
|
|
"\ud835\udec2 \ud835\udec3 \ud835\udec4 \ud835\udec5 \ud835\udec6 \ud835\udec7 \ud835\udec8 \ud835\udec9 \ud835\udeca \ud835\udecb \ud835\udecc \ud835\udecd \ud835\udece \ud835\udecf \ud835\uded0 \ud835\uded1 \ud835\uded2 \ud835\uded3 \ud835\uded4 \ud835\uded5 \ud835\uded6 \ud835\uded7 \ud835\uded8 \ud835\uded9 \ud835\udeda".split(
|
|
" ",
|
|
);
|
|
this.capitalGreekItalic =
|
|
"\ud835\udee2 \ud835\udee3 \ud835\udee4 \ud835\udee5 \ud835\udee6 \ud835\udee7 \ud835\udee8 \ud835\udee9 \ud835\udeea \ud835\udeeb \ud835\udeec \ud835\udeed \ud835\udeee \ud835\udeef \ud835\udef0 \ud835\udef1 \ud835\udef2 \ud835\udef4 \ud835\udef5 \ud835\udef6 \ud835\udef7 \ud835\udef8 \ud835\udef9 \ud835\udefa".split(
|
|
" ",
|
|
);
|
|
this.smallGreekItalic =
|
|
"\ud835\udefc \ud835\udefd \ud835\udefe \ud835\udeff \ud835\udf00 \ud835\udf01 \ud835\udf02 \ud835\udf03 \ud835\udf04 \ud835\udf05 \ud835\udf06 \ud835\udf07 \ud835\udf08 \ud835\udf09 \ud835\udf0a \ud835\udf0b \ud835\udf0c \ud835\udf0d \ud835\udf0e \ud835\udf0f \ud835\udf10 \ud835\udf11 \ud835\udf12 \ud835\udf13 \ud835\udf14".split(
|
|
" ",
|
|
);
|
|
this.capitalGreekBoldItalic =
|
|
"\ud835\udf1c \ud835\udf1d \ud835\udf1e \ud835\udf1f \ud835\udf20 \ud835\udf21 \ud835\udf22 \ud835\udf23 \ud835\udf24 \ud835\udf25 \ud835\udf26 \ud835\udf27 \ud835\udf28 \ud835\udf29 \ud835\udf2a \ud835\udf2b \ud835\udf2c \ud835\udf2e \ud835\udf2f \ud835\udf30 \ud835\udf31 \ud835\udf32 \ud835\udf33 \ud835\udf34".split(
|
|
" ",
|
|
);
|
|
this.smallGreekBoldItalic =
|
|
"\ud835\udf36 \ud835\udf37 \ud835\udf38 \ud835\udf39 \ud835\udf3a \ud835\udf3b \ud835\udf3c \ud835\udf3d \ud835\udf3e \ud835\udf3f \ud835\udf40 \ud835\udf41 \ud835\udf42 \ud835\udf43 \ud835\udf44 \ud835\udf45 \ud835\udf46 \ud835\udf47 \ud835\udf48 \ud835\udf49 \ud835\udf4a \ud835\udf4b \ud835\udf4c \ud835\udf4d \ud835\udf4e".split(
|
|
" ",
|
|
);
|
|
this.capitalGreekSansSerifBold =
|
|
"\ud835\udf56 \ud835\udf57 \ud835\udf58 \ud835\udf59 \ud835\udf5a \ud835\udf5b \ud835\udf5c \ud835\udf5d \ud835\udf5e \ud835\udf5f \ud835\udf60 \ud835\udf61 \ud835\udf62 \ud835\udf63 \ud835\udf64 \ud835\udf65 \ud835\udf66 \ud835\udf68 \ud835\udf69 \ud835\udf6a \ud835\udf6b \ud835\udf6c \ud835\udf6d \ud835\udf6e".split(
|
|
" ",
|
|
);
|
|
this.smallGreekSansSerifBold =
|
|
"\ud835\udf70 \ud835\udf71 \ud835\udf72 \ud835\udf73 \ud835\udf74 \ud835\udf75 \ud835\udf76 \ud835\udf77 \ud835\udf78 \ud835\udf79 \ud835\udf7a \ud835\udf7b \ud835\udf7c \ud835\udf7d \ud835\udf7e \ud835\udf7f \ud835\udf80 \ud835\udf81 \ud835\udf82 \ud835\udf83 \ud835\udf84 \ud835\udf85 \ud835\udf86 \ud835\udf87 \ud835\udf88".split(
|
|
" ",
|
|
);
|
|
this.capitalGreekSansSerifBoldItalic =
|
|
"\ud835\udf90 \ud835\udf91 \ud835\udf92 \ud835\udf93 \ud835\udf94 \ud835\udf95 \ud835\udf96 \ud835\udf97 \ud835\udf98 \ud835\udf99 \ud835\udf9a \ud835\udf9b \ud835\udf9c \ud835\udf9d \ud835\udf9e \ud835\udf9f \ud835\udfa0 \ud835\udfa2 \ud835\udfa3 \ud835\udfa4 \ud835\udfa5 \ud835\udfa6 \ud835\udfa7 \ud835\udfa8".split(
|
|
" ",
|
|
);
|
|
this.smallGreekSansSerifBoldItalic =
|
|
"\ud835\udfaa \ud835\udfab \ud835\udfac \ud835\udfad \ud835\udfae \ud835\udfaf \ud835\udfb0 \ud835\udfb1 \ud835\udfb2 \ud835\udfb3 \ud835\udfb4 \ud835\udfb5 \ud835\udfb6 \ud835\udfb7 \ud835\udfb8 \ud835\udfb9 \ud835\udfba \ud835\udfbb \ud835\udfbc \ud835\udfbd \ud835\udfbe \ud835\udfbf \ud835\udfc0 \ud835\udfc1 \ud835\udfc2".split(
|
|
" ",
|
|
);
|
|
this.greekDoubleStruck = ["\u213c", "\u213d", "\u213e", "\u213f"];
|
|
this.greekSpecial =
|
|
"\u03d0\u03d1\u03d5\u03d6\u03d7\u03f0\u03f1\u03f5\u03f6\u03f4".split("");
|
|
this.greekSpecialBold =
|
|
"\ud835\udedc \ud835\udedd \ud835\udede \ud835\udedf \ud835\udee0 \ud835\udee1".split(
|
|
" ",
|
|
);
|
|
this.greekSpecialItalic =
|
|
"\ud835\udf16 \ud835\udf17 \ud835\udf18 \ud835\udf19 \ud835\udf1a \ud835\udf1b".split(
|
|
" ",
|
|
);
|
|
this.greekSpecialSansSerifBold =
|
|
"\ud835\udf8a \ud835\udf8b \ud835\udf8c \ud835\udf8d \ud835\udf8e \ud835\udf8f".split(
|
|
" ",
|
|
);
|
|
this.hebrewLetters = ["\u2135", "\u2136", "\u2137", "\u2138"];
|
|
this.allLetters = this.capitalLatin.concat(
|
|
this.smallLatin,
|
|
this.capitalLatinFullWidth,
|
|
this.smallLatinFullWidth,
|
|
this.capitalLatinBold,
|
|
this.smallLatinBold,
|
|
this.capitalLatinItalic,
|
|
this.capitalLatinBoldItalic,
|
|
this.smallLatinBoldItalic,
|
|
this.smallLatinItalic,
|
|
this.capitalLatinScript,
|
|
this.smallLatinScript,
|
|
this.capitalLatinBoldScript,
|
|
this.smallLatinBoldScript,
|
|
this.capitalLatinFraktur,
|
|
this.smallLatinFraktur,
|
|
this.capitalLatinDoubleStruck,
|
|
this.smallLatinDoubleStruck,
|
|
this.capitalLatinBoldFraktur,
|
|
this.smallLatinBoldFraktur,
|
|
this.capitalLatinSansSerif,
|
|
this.smallLatinSansSerif,
|
|
this.capitalLatinSansSerifBold,
|
|
this.smallLatinSansSerifBold,
|
|
this.capitalLatinSansSerifItalic,
|
|
this.smallLatinSansSerifItalic,
|
|
this.capitalLatinSansSerifBoldItalic,
|
|
this.smallLatinSansSerifBoldItalic,
|
|
this.capitalLatinMonospace,
|
|
this.smallLatinMonospace,
|
|
this.latinDoubleStruckItalic,
|
|
this.capitalGreek,
|
|
this.smallGreek,
|
|
this.capitalGreekBold,
|
|
this.smallGreekBold,
|
|
this.capitalGreekItalic,
|
|
this.smallGreekItalic,
|
|
this.capitalGreekBoldItalic,
|
|
this.smallGreekBoldItalic,
|
|
this.capitalGreekSansSerifBold,
|
|
this.smallGreekSansSerifBold,
|
|
this.greekDoubleStruck,
|
|
this.greekSpecial,
|
|
this.capitalGreekSansSerifBoldItalic,
|
|
this.smallGreekSansSerifBoldItalic,
|
|
this.greekSpecialBold,
|
|
this.greekSpecialItalic,
|
|
this.greekSpecialSansSerifBold,
|
|
this.hebrewLetters,
|
|
);
|
|
this.additions =
|
|
"+\u00b1\u2213\u2214\u2227\u2228\u2229\u222a\u228c\u2293\u2294\u229d\u229e\u22a4\u22a5\u22ba\u22bb\u22bc\u22c4\u22ce\u22cf\u22d2\u22d3\u25b3\u25b7\u25bd\u25c1\u2a5e\u2295".split(
|
|
"",
|
|
);
|
|
this.invisiblePlus_ = sre.SemanticUtil.numberToUnicode(8292);
|
|
this.additions.push(this.invisiblePlus_);
|
|
this.multiplications =
|
|
"\u2020\u2021\u2210\u2217\u2218\u2219\u2240\u229a\u229b\u22a0\u22a1\u22c5\u22c6\u22c7\u22c9\u22ca\u22cb\u22cc\u25cb\u00b7*".split(
|
|
"",
|
|
);
|
|
this.invisibleTimes_ = sre.SemanticUtil.numberToUnicode(8290);
|
|
this.multiplications.push(this.invisibleTimes_);
|
|
this.subtractions =
|
|
"-\u2052\u207b\u208b\u2212\u2216\u2238\u2242\u2296\u229f\u2796\u2a29\u2a2a\u2a2b\u2a2c\u2a3a\u2a41\u2a6c\ufe63\uff0d\u2010\u2011".split(
|
|
"",
|
|
);
|
|
this.divisions = "/\u00f7\u2044\u2215\u2298\u27cc\u29bc\u2a38".split("");
|
|
this.functionApplication_ = sre.SemanticUtil.numberToUnicode(8289);
|
|
this.equalities =
|
|
"=~\u207c\u208c\u223c\u223d\u2243\u2245\u2248\u224a\u224b\u224c\u224d\u224e\u2251\u2252\u2253\u2254\u2255\u2256\u2257\u2258\u2259\u225a\u225b\u225c\u225d\u225e\u225f\u2261\u2263\u29e4\u2a66\u2a6e\u2a6f\u2a70\u2a71\u2a72\u2a73\u2a74\u2a75\u2a76\u2a77\u2a78\u22d5\u2a6d\u2a6a\u2a6b\u2a6c\ufe66\uff1d".split(
|
|
"",
|
|
);
|
|
this.inequalities =
|
|
"<>\u2241\u2242\u2244\u2246\u2247\u2249\u224f\u2250\u2260\u2262\u2264\u2265\u2266\u2267\u2268\u2269\u226a\u226b\u226c\u226d\u226e\u226f\u2270\u2271\u2272\u2273\u2274\u2275\u2276\u2277\u2278\u2279\u227a\u227b\u227c\u227d\u227e\u227f\u2280\u2281\u22d6\u22d7\u22d8\u22d9\u22da\u22db\u22dc\u22dd\u22de\u22df\u22e0\u22e1\u22e2\u22e3\u22e4\u22e5\u22e6\u22e7\u22e8\u22e9\u2a79\u2a7a\u2a7b\u2a7c\u2a7d\u2a7e\u2a7f\u2a80\u2a81\u2a82\u2a83\u2a84\u2a85\u2a86\u2a87\u2a88\u2a89\u2a8a\u2a8b\u2a8c\u2a8d\u2a8e\u2a8f\u2a90\u2a91\u2a92\u2a93\u2a94\u2a95\u2a96\u2a97\u2a98\u2a99\u2a9a\u2a9b\u2a9c\u2a9d\u2a9e\u2a9f\u2aa0\u2aa1\u2aa2\u2aa3\u2aa4\u2aa5\u2aa6\u2aa7\u2aa8\u2aa9\u2aaa\u2aab\u2aac\u2aad\u2aae\u2aaf\u2ab0\u2ab1\u2ab2\u2ab3\u2ab4\u2ab5\u2ab6\u2ab7\u2ab8\u2ab9\u2aba\u2abb\u2abc\u2af7\u2af8\u2af9\u2afa\u29c0\u29c1\ufe64\ufe65\uff1c\uff1e".split(
|
|
"",
|
|
);
|
|
this.relations = [];
|
|
this.arrows =
|
|
"\u2190\u2191\u2192\u2193\u2194\u2195\u2196\u2197\u2198\u2199\u219a\u219b\u219c\u219d\u219e\u219f\u21a0\u21a1\u21a2\u21a3\u21a4\u21a5\u21a6\u21a7\u21a8\u21a9\u21aa\u21ab\u21ac\u21ad\u21ae\u21af\u21b0\u21b1\u21b2\u21b3\u21b4\u21b5\u21b6\u21b7\u21b8\u21b9\u21ba\u21bb\u21c4\u21c5\u21c6\u21c7\u21c8\u21c9\u21ca\u21cd\u21ce\u21cf\u21d0\u21d1\u21d2\u21d3\u21d4\u21d5\u21d6\u21d7\u21d8\u21d9\u21da\u21db\u21dc\u21dd\u21de\u21df\u21e0\u21e1\u21e2\u21e3\u21e4\u21e5\u21e6\u21e7\u21e8\u21e9\u21ea\u21eb\u21ec\u21ed\u21ee\u21ef\u21f0\u21f1\u21f2\u21f3\u21f4\u21f5\u21f6\u21f7\u21f8\u21f9\u21fa\u21fb\u21fc\u21fd\u21fe\u21ff\u2301\u2303\u2304\u2324\u238b\u2794\u2798\u2799\u279a\u279b\u279c\u279d\u279e\u279f\u27a0\u27a1\u27a2\u27a3\u27a4\u27a5\u27a6\u27a7\u27a8\u27a9\u27aa\u27ab\u27ac\u27ad\u27ae\u27af\u27b1\u27b2\u27b3\u27b4\u27b5\u27b6\u27b7\u27b8\u27b9\u27ba\u27bb\u27bc\u27bd\u27be\u27f0\u27f1\u27f2\u27f3\u27f4\u27f5\u27f6\u27f7\u27f8\u27f9\u27fa\u27fb\u27fc\u27fd\u27fe\u27ff\u2900\u2901\u2902\u2903\u2904\u2905\u2906\u2907\u2908\u2909\u290a\u290b\u290c\u290d\u290e\u290f\u2910\u2911\u2912\u2913\u2914\u2915\u2916\u2917\u2918\u2919\u291a\u291b\u291c\u291d\u291e\u291f\u2920\u2921\u2922\u2923\u2924\u2925\u2926\u2927\u2928\u2929\u292a\u292d\u292e\u292f\u2930\u2931\u2932\u2933\u2934\u2935\u2936\u2937\u2938\u2939\u293a\u293b\u293c\u293d\u293e\u293f\u2940\u2941\u2942\u2943\u2944\u2945\u2946\u2947\u2948\u2949\u2970\u2971\u2972\u2973\u2974\u2975\u2976\u2977\u2978\u2979\u297a\u297b\u29b3\u29b4\u29bd\u29ea\u29ec\u29ed\u2a17\u2b00\u2b01\u2b02\u2b03\u2b04\u2b05\u2b06\u2b07\u2b08\u2b09\u2b0a\u2b0b\u2b0c\u2b0d\u2b0e\u2b0f\u2b10\u2b11\u2b30\u2b31\u2b32\u2b33\u2b34\u2b35\u2b36\u2b37\u2b38\u2b39\u2b3a\u2b3b\u2b3c\u2b3d\u2b3e\u2b3f\u2b40\u2b41\u2b42\u2b43\u2b44\u2b45\u2b46\u2b47\u2b48\u2b49\u2b4a\u2b4b\u2b4c\uffe9\uffea\uffeb\uffec\u21bc\u21bd\u21be\u21bf\u21c0\u21c1\u21c2\u21c3\u21cb\u21cc\u294a\u294b\u294c\u294d\u294e\u294f\u2950\u2951\u2952\u2953\u2954\u2955\u2956\u2957\u2958\u2959\u295a\u295b\u295c\u295d\u295e\u295f\u2960\u2961\u2962\u2963\u2964\u2965\u2966\u2967\u2968\u2969\u296a\u296b\u296c\u296d\u296e\u296f\u297c\u297d\u297e\u297f".split(
|
|
"",
|
|
);
|
|
this.sumOps =
|
|
"\u2140\u220f\u2210\u2211\u22c0\u22c1\u22c2\u22c3\u2a00\u2a01\u2a02\u2a03\u2a04\u2a05\u2a06\u2a07\u2a08\u2a09\u2a0a\u2a0b\u2afc\u2aff".split(
|
|
"",
|
|
);
|
|
this.intOps =
|
|
"\u222b\u222c\u222d\u222e\u222f\u2230\u2231\u2232\u2233\u2a0c\u2a0d\u2a0e\u2a0f\u2a10\u2a11\u2a12\u2a13\u2a14\u2a15\u2a16\u2a17\u2a18\u2a19\u2a1a\u2a1b\u2a1c".split(
|
|
"",
|
|
);
|
|
this.prefixOps = "\u2200\u2203\u2206\u2207\u2202\u2201\u2204".split("");
|
|
this.prefixOpsBold = [
|
|
"\ud835\udec1",
|
|
"\ud835\udedb",
|
|
"\ud835\udfca",
|
|
"\ud835\udfcb",
|
|
];
|
|
this.prefixOpsItalic = ["\ud835\udefb", "\ud835\udf15"];
|
|
this.prefixOpsSansSerifBold = ["\ud835\udf6f", "\ud835\udf89"];
|
|
this.operatorBits =
|
|
"\u2320\u2321\u23b6\u23aa\u23ae\u23af\u23b2\u23b3\u23b7".split("");
|
|
this.digitsNormal = "0123456789".split("");
|
|
this.digitsFullWidth =
|
|
"\uff10\uff11\uff12\uff13\uff14\uff15\uff16\uff17\uff18\uff19".split("");
|
|
this.digitsBold =
|
|
"\ud835\udfce \ud835\udfcf \ud835\udfd0 \ud835\udfd1 \ud835\udfd2 \ud835\udfd3 \ud835\udfd4 \ud835\udfd5 \ud835\udfd6 \ud835\udfd7".split(
|
|
" ",
|
|
);
|
|
this.digitsDoubleStruck =
|
|
"\ud835\udfd8 \ud835\udfd9 \ud835\udfda \ud835\udfdb \ud835\udfdc \ud835\udfdd \ud835\udfde \ud835\udfdf \ud835\udfe0 \ud835\udfe1".split(
|
|
" ",
|
|
);
|
|
this.digitsSansSerif =
|
|
"\ud835\udfe2 \ud835\udfe3 \ud835\udfe4 \ud835\udfe5 \ud835\udfe6 \ud835\udfe7 \ud835\udfe8 \ud835\udfe9 \ud835\udfea \ud835\udfeb".split(
|
|
" ",
|
|
);
|
|
this.digitsSansSerifBold =
|
|
"\ud835\udfec \ud835\udfed \ud835\udfee \ud835\udfef \ud835\udff0 \ud835\udff1 \ud835\udff2 \ud835\udff3 \ud835\udff4 \ud835\udff5".split(
|
|
" ",
|
|
);
|
|
this.digitsMonospace =
|
|
"\ud835\udff6 \ud835\udff7 \ud835\udff8 \ud835\udff9 \ud835\udffa \ud835\udffb \ud835\udffc \ud835\udffd \ud835\udffe \ud835\udfff".split(
|
|
" ",
|
|
);
|
|
this.digitsSuperscript =
|
|
"\u00b2\u00b3\u00b9\u2070\u2074\u2075\u2076\u2077\u2078\u2079".split("");
|
|
this.digitsSubscript =
|
|
"\u2080\u2081\u2082\u2083\u2084\u2085\u2086\u2087\u2088\u2089".split("");
|
|
this.fractions =
|
|
"\u00bc\u00bd\u00be\u2150\u2151\u2152\u2153\u2154\u2155\u2156\u2157\u2158\u2159\u215a\u215b\u215c\u215d\u215e\u215f\u2189".split(
|
|
"",
|
|
);
|
|
this.enclosedNumbers =
|
|
"\u2460\u2461\u2462\u2463\u2464\u2465\u2466\u2467\u2468\u2469\u246a\u246b\u246c\u246d\u246e\u246f\u2470\u2471\u2472\u2473\u24ea\u24eb\u24ec\u24ed\u24ee\u24ef\u24f0\u24f1\u24f2\u24f3\u24f4\u24f5\u24f6\u24f7\u24f8\u24f9\u24fa\u24fb\u24fc\u24fd\u24fe\u24ff\u2776\u2777\u2778\u2779\u277a\u277b\u277c\u277d\u277e\u277f\u2780\u2781\u2782\u2783\u2784\u2785\u2786\u2787\u2788\u2789\u278a\u278b\u278c\u278d\u278e\u278f\u2790\u2791\u2792\u2793\u3248\u3249\u324a\u324b\u324c\u324d\u324e\u324f\u3251\u3252\u3253\u3254\u3255\u3256\u3257\u3258\u3259\u325a\u325b\u325c\u325d\u325e\u325f\u32b1\u32b2\u32b3\u32b4\u32b5\u32b6\u32b7\u32b8\u32b9\u32ba\u32bb\u32bc\u32bd\u32be\u32bf".split(
|
|
"",
|
|
);
|
|
this.fencedNumbers =
|
|
"\u2474\u2475\u2476\u2477\u2478\u2479\u247a\u247b\u247c\u247d\u247e\u247f\u2480\u2481\u2482\u2483\u2484\u2485\u2486\u2487".split(
|
|
"",
|
|
);
|
|
this.punctuatedNumbers =
|
|
"\u2488 \u2489 \u248a \u248b \u248c \u248d \u248e \u248f \u2490 \u2491 \u2492 \u2493 \u2494 \u2495 \u2496 \u2497 \u2498 \u2499 \u249a \u249b \ud83c\udd00 \ud83c\udd01 \ud83c\udd02 \ud83c\udd03 \ud83c\udd04 \ud83c\udd05 \ud83c\udd06 \ud83c\udd07 \ud83c\udd08 \ud83c\udd09 \ud83c\udd0a".split(
|
|
" ",
|
|
);
|
|
this.digits = this.digitsNormal.concat(
|
|
this.digitsFullWidth,
|
|
this.digitsBold,
|
|
this.digitsDoubleStruck,
|
|
this.digitsSansSerif,
|
|
this.digitsSansSerifBold,
|
|
this.digitsMonospace,
|
|
);
|
|
this.numbers = this.fractions.concat(
|
|
this.digitsSuperscript,
|
|
this.digitsSubscript,
|
|
this.enclosedNumbers,
|
|
this.fencedNumbers,
|
|
this.punctuatedNumbers,
|
|
);
|
|
this.allNumbers = this.digits.concat(this.numbers);
|
|
this.trigonometricFunctions =
|
|
"cos cot csc sec sin tan arccos arccot arccsc arcsec arcsin arctan".split(
|
|
" ",
|
|
);
|
|
this.hyperbolicFunctions =
|
|
"cosh coth csch sech sinh tanh arcosh arcoth arcsch arsech arsinh artanh arccosh arccoth arccsch arcsech arcsinh arctanh".split(
|
|
" ",
|
|
);
|
|
this.algebraicFunctions = "deg det dim hom ker Tr tr".split(" ");
|
|
this.elementaryFunctions = "log ln lg exp expt gcd gcd arg im re Pr".split(
|
|
" ",
|
|
);
|
|
this.prefixFunctions = this.trigonometricFunctions.concat(
|
|
this.hyperbolicFunctions,
|
|
this.algebraicFunctions,
|
|
this.elementaryFunctions,
|
|
);
|
|
this.limitFunctions =
|
|
"inf lim liminf limsup max min sup injlim projlim".split(" ");
|
|
this.infixFunctions = ["mod", "rem"];
|
|
this.symbolSetToSemantic_ = [
|
|
{
|
|
set: this.generalPunctuations,
|
|
type: sre.SemanticAttr.Type.PUNCTUATION,
|
|
role: sre.SemanticAttr.Role.UNKNOWN,
|
|
},
|
|
{
|
|
set: this.colons,
|
|
type: sre.SemanticAttr.Type.PUNCTUATION,
|
|
role: sre.SemanticAttr.Role.COLON,
|
|
},
|
|
{
|
|
set: this.commas,
|
|
type: sre.SemanticAttr.Type.PUNCTUATION,
|
|
role: sre.SemanticAttr.Role.COMMA,
|
|
},
|
|
{
|
|
set: this.ellipses,
|
|
type: sre.SemanticAttr.Type.PUNCTUATION,
|
|
role: sre.SemanticAttr.Role.ELLIPSIS,
|
|
},
|
|
{
|
|
set: this.fullStops,
|
|
type: sre.SemanticAttr.Type.PUNCTUATION,
|
|
role: sre.SemanticAttr.Role.FULLSTOP,
|
|
},
|
|
{
|
|
set: this.dashes,
|
|
type: sre.SemanticAttr.Type.PUNCTUATION,
|
|
role: sre.SemanticAttr.Role.DASH,
|
|
},
|
|
{
|
|
set: this.primes,
|
|
type: sre.SemanticAttr.Type.PUNCTUATION,
|
|
role: sre.SemanticAttr.Role.PRIME,
|
|
},
|
|
{
|
|
set: this.degrees,
|
|
type: sre.SemanticAttr.Type.PUNCTUATION,
|
|
role: sre.SemanticAttr.Role.DEGREE,
|
|
},
|
|
{
|
|
set: this.leftFences,
|
|
type: sre.SemanticAttr.Type.FENCE,
|
|
role: sre.SemanticAttr.Role.OPEN,
|
|
},
|
|
{
|
|
set: this.rightFences,
|
|
type: sre.SemanticAttr.Type.FENCE,
|
|
role: sre.SemanticAttr.Role.CLOSE,
|
|
},
|
|
{
|
|
set: this.topFences,
|
|
type: sre.SemanticAttr.Type.FENCE,
|
|
role: sre.SemanticAttr.Role.TOP,
|
|
},
|
|
{
|
|
set: this.bottomFences,
|
|
type: sre.SemanticAttr.Type.FENCE,
|
|
role: sre.SemanticAttr.Role.BOTTOM,
|
|
},
|
|
{
|
|
set: this.neutralFences,
|
|
type: sre.SemanticAttr.Type.FENCE,
|
|
role: sre.SemanticAttr.Role.NEUTRAL,
|
|
},
|
|
{
|
|
set: this.smallLatin,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.LATINLETTER,
|
|
font: sre.SemanticAttr.Font.NORMAL,
|
|
},
|
|
{
|
|
set: this.capitalLatin,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.LATINLETTER,
|
|
font: sre.SemanticAttr.Font.NORMAL,
|
|
},
|
|
{
|
|
set: this.smallLatinFullWidth,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.LATINLETTER,
|
|
font: sre.SemanticAttr.Font.NORMAL,
|
|
},
|
|
{
|
|
set: this.capitalLatinFullWidth,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.LATINLETTER,
|
|
font: sre.SemanticAttr.Font.NORMAL,
|
|
},
|
|
{
|
|
set: this.smallLatinBold,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.LATINLETTER,
|
|
font: sre.SemanticAttr.Font.BOLD,
|
|
},
|
|
{
|
|
set: this.capitalLatinBold,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.LATINLETTER,
|
|
font: sre.SemanticAttr.Font.BOLD,
|
|
},
|
|
{
|
|
set: this.smallLatinItalic,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.LATINLETTER,
|
|
font: sre.SemanticAttr.Font.ITALIC,
|
|
},
|
|
{
|
|
set: this.capitalLatinItalic,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.LATINLETTER,
|
|
font: sre.SemanticAttr.Font.ITALIC,
|
|
},
|
|
{
|
|
set: this.smallLatinBoldItalic,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.LATINLETTER,
|
|
font: sre.SemanticAttr.Font.BOLDITALIC,
|
|
},
|
|
{
|
|
set: this.capitalLatinBoldItalic,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.LATINLETTER,
|
|
font: sre.SemanticAttr.Font.BOLDITALIC,
|
|
},
|
|
{
|
|
set: this.smallLatinScript,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.LATINLETTER,
|
|
font: sre.SemanticAttr.Font.SCRIPT,
|
|
},
|
|
{
|
|
set: this.capitalLatinScript,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.LATINLETTER,
|
|
font: sre.SemanticAttr.Font.SCRIPT,
|
|
},
|
|
{
|
|
set: this.smallLatinBoldScript,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.LATINLETTER,
|
|
font: sre.SemanticAttr.Font.BOLDSCRIPT,
|
|
},
|
|
{
|
|
set: this.capitalLatinBoldScript,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.LATINLETTER,
|
|
font: sre.SemanticAttr.Font.BOLDSCRIPT,
|
|
},
|
|
{
|
|
set: this.smallLatinFraktur,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.LATINLETTER,
|
|
font: sre.SemanticAttr.Font.FRAKTUR,
|
|
},
|
|
{
|
|
set: this.capitalLatinFraktur,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.LATINLETTER,
|
|
font: sre.SemanticAttr.Font.FRAKTUR,
|
|
},
|
|
{
|
|
set: this.smallLatinDoubleStruck,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.LATINLETTER,
|
|
font: sre.SemanticAttr.Font.DOUBLESTRUCK,
|
|
},
|
|
{
|
|
set: this.capitalLatinDoubleStruck,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.LATINLETTER,
|
|
font: sre.SemanticAttr.Font.DOUBLESTRUCK,
|
|
},
|
|
{
|
|
set: this.smallLatinBoldFraktur,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.LATINLETTER,
|
|
font: sre.SemanticAttr.Font.BOLDFRAKTUR,
|
|
},
|
|
{
|
|
set: this.capitalLatinBoldFraktur,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.LATINLETTER,
|
|
font: sre.SemanticAttr.Font.BOLDFRAKTUR,
|
|
},
|
|
{
|
|
set: this.smallLatinSansSerif,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.LATINLETTER,
|
|
font: sre.SemanticAttr.Font.SANSSERIF,
|
|
},
|
|
{
|
|
set: this.capitalLatinSansSerif,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.LATINLETTER,
|
|
font: sre.SemanticAttr.Font.SANSSERIF,
|
|
},
|
|
{
|
|
set: this.smallLatinSansSerifBold,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.LATINLETTER,
|
|
font: sre.SemanticAttr.Font.SANSSERIFBOLD,
|
|
},
|
|
{
|
|
set: this.capitalLatinSansSerifBold,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.LATINLETTER,
|
|
font: sre.SemanticAttr.Font.SANSSERIFBOLD,
|
|
},
|
|
{
|
|
set: this.smallLatinSansSerifItalic,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.LATINLETTER,
|
|
font: sre.SemanticAttr.Font.SANSSERIFITALIC,
|
|
},
|
|
{
|
|
set: this.capitalLatinSansSerifItalic,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.LATINLETTER,
|
|
font: sre.SemanticAttr.Font.SANSSERIFITALIC,
|
|
},
|
|
{
|
|
set: this.smallLatinSansSerifBoldItalic,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.LATINLETTER,
|
|
font: sre.SemanticAttr.Font.SANSSERIFBOLDITALIC,
|
|
},
|
|
{
|
|
set: this.capitalLatinSansSerifBoldItalic,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.LATINLETTER,
|
|
font: sre.SemanticAttr.Font.SANSSERIFBOLDITALIC,
|
|
},
|
|
{
|
|
set: this.smallLatinMonospace,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.LATINLETTER,
|
|
font: sre.SemanticAttr.Font.MONOSPACE,
|
|
},
|
|
{
|
|
set: this.capitalLatinMonospace,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.LATINLETTER,
|
|
font: sre.SemanticAttr.Font.MONOSPACE,
|
|
},
|
|
{
|
|
set: this.latinDoubleStruckItalic,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.LATINLETTER,
|
|
font: sre.SemanticAttr.Font.DOUBLESTRUCKITALIC,
|
|
},
|
|
{
|
|
set: this.smallGreek,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.GREEKLETTER,
|
|
font: sre.SemanticAttr.Font.NORMAL,
|
|
},
|
|
{
|
|
set: this.capitalGreek,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.GREEKLETTER,
|
|
font: sre.SemanticAttr.Font.NORMAL,
|
|
},
|
|
{
|
|
set: this.smallGreekBold,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.GREEKLETTER,
|
|
font: sre.SemanticAttr.Font.BOLD,
|
|
},
|
|
{
|
|
set: this.capitalGreekBold,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.GREEKLETTER,
|
|
font: sre.SemanticAttr.Font.BOLD,
|
|
},
|
|
{
|
|
set: this.smallGreekItalic,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.GREEKLETTER,
|
|
font: sre.SemanticAttr.Font.ITALIC,
|
|
},
|
|
{
|
|
set: this.capitalGreekItalic,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.GREEKLETTER,
|
|
font: sre.SemanticAttr.Font.ITALIC,
|
|
},
|
|
{
|
|
set: this.smallGreekBoldItalic,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.GREEKLETTER,
|
|
font: sre.SemanticAttr.Font.BOLDITALIC,
|
|
},
|
|
{
|
|
set: this.capitalGreekBoldItalic,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.GREEKLETTER,
|
|
font: sre.SemanticAttr.Font.BOLDITALIC,
|
|
},
|
|
{
|
|
set: this.smallGreekSansSerifBold,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.GREEKLETTER,
|
|
font: sre.SemanticAttr.Font.SANSSERIFBOLD,
|
|
},
|
|
{
|
|
set: this.capitalGreekSansSerifBold,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.GREEKLETTER,
|
|
font: sre.SemanticAttr.Font.SANSSERIFBOLD,
|
|
},
|
|
{
|
|
set: this.capitalGreekSansSerifBoldItalic,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.GREEKLETTER,
|
|
font: sre.SemanticAttr.Font.SANSSERIFBOLDITALIC,
|
|
},
|
|
{
|
|
set: this.smallGreekSansSerifBoldItalic,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.GREEKLETTER,
|
|
font: sre.SemanticAttr.Font.SANSSERIFBOLDITALIC,
|
|
},
|
|
{
|
|
set: this.greekDoubleStruck,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.GREEKLETTER,
|
|
font: sre.SemanticAttr.Font.DOUBLESTRUCK,
|
|
},
|
|
{
|
|
set: this.greekSpecial,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.GREEKLETTER,
|
|
font: sre.SemanticAttr.Font.NORMAL,
|
|
},
|
|
{
|
|
set: this.greekSpecialBold,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.GREEKLETTER,
|
|
font: sre.SemanticAttr.Font.BOLD,
|
|
},
|
|
{
|
|
set: this.greekSpecialItalic,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.GREEKLETTER,
|
|
font: sre.SemanticAttr.Font.ITALIC,
|
|
},
|
|
{
|
|
set: this.greekSpecialSansSerifBold,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.GREEKLETTER,
|
|
font: sre.SemanticAttr.Font.SANSSERIFBOLD,
|
|
},
|
|
{
|
|
set: this.hebrewLetters,
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.OTHERLETTER,
|
|
font: sre.SemanticAttr.Font.NORMAL,
|
|
},
|
|
{
|
|
set: this.digitsNormal,
|
|
type: sre.SemanticAttr.Type.NUMBER,
|
|
role: sre.SemanticAttr.Role.INTEGER,
|
|
font: sre.SemanticAttr.Font.NORMAL,
|
|
},
|
|
{
|
|
set: this.digitsFullWidth,
|
|
type: sre.SemanticAttr.Type.NUMBER,
|
|
role: sre.SemanticAttr.Role.INTEGER,
|
|
font: sre.SemanticAttr.Font.NORMAL,
|
|
},
|
|
{
|
|
set: this.digitsBold,
|
|
type: sre.SemanticAttr.Type.NUMBER,
|
|
role: sre.SemanticAttr.Role.INTEGER,
|
|
font: sre.SemanticAttr.Font.BOLD,
|
|
},
|
|
{
|
|
set: this.digitsDoubleStruck,
|
|
type: sre.SemanticAttr.Type.NUMBER,
|
|
role: sre.SemanticAttr.Role.INTEGER,
|
|
font: sre.SemanticAttr.Font.DOUBLESTRUCK,
|
|
},
|
|
{
|
|
set: this.digitsSansSerif,
|
|
type: sre.SemanticAttr.Type.NUMBER,
|
|
role: sre.SemanticAttr.Role.INTEGER,
|
|
font: sre.SemanticAttr.Font.SANSSERIF,
|
|
},
|
|
{
|
|
set: this.digitsSansSerifBold,
|
|
type: sre.SemanticAttr.Type.NUMBER,
|
|
role: sre.SemanticAttr.Role.INTEGER,
|
|
font: sre.SemanticAttr.Font.SANSSERIFBOLD,
|
|
},
|
|
{
|
|
set: this.digitsMonospace,
|
|
type: sre.SemanticAttr.Type.NUMBER,
|
|
role: sre.SemanticAttr.Role.INTEGER,
|
|
font: sre.SemanticAttr.Font.MONOSPACE,
|
|
},
|
|
{
|
|
set: this.numbers,
|
|
type: sre.SemanticAttr.Type.NUMBER,
|
|
role: sre.SemanticAttr.Role.FLOAT,
|
|
},
|
|
{
|
|
set: this.additions,
|
|
type: sre.SemanticAttr.Type.OPERATOR,
|
|
role: sre.SemanticAttr.Role.ADDITION,
|
|
},
|
|
{
|
|
set: this.multiplications,
|
|
type: sre.SemanticAttr.Type.OPERATOR,
|
|
role: sre.SemanticAttr.Role.MULTIPLICATION,
|
|
},
|
|
{
|
|
set: this.subtractions,
|
|
type: sre.SemanticAttr.Type.OPERATOR,
|
|
role: sre.SemanticAttr.Role.SUBTRACTION,
|
|
},
|
|
{
|
|
set: this.divisions,
|
|
type: sre.SemanticAttr.Type.OPERATOR,
|
|
role: sre.SemanticAttr.Role.DIVISION,
|
|
},
|
|
{
|
|
set: this.prefixOps,
|
|
type: sre.SemanticAttr.Type.OPERATOR,
|
|
role: sre.SemanticAttr.Role.PREFIXOP,
|
|
},
|
|
{
|
|
set: this.prefixOpsBold,
|
|
type: sre.SemanticAttr.Type.OPERATOR,
|
|
role: sre.SemanticAttr.Role.PREFIXOP,
|
|
font: sre.SemanticAttr.Font.BOLD,
|
|
},
|
|
{
|
|
set: this.prefixOpsItalic,
|
|
type: sre.SemanticAttr.Type.OPERATOR,
|
|
role: sre.SemanticAttr.Role.PREFIXOP,
|
|
font: sre.SemanticAttr.Font.ITALIC,
|
|
},
|
|
{
|
|
set: this.prefixOpsSansSerifBold,
|
|
type: sre.SemanticAttr.Type.OPERATOR,
|
|
role: sre.SemanticAttr.Role.PREFIXOP,
|
|
font: sre.SemanticAttr.Font.SANSSERIFBOLD,
|
|
},
|
|
{
|
|
set: this.equalities,
|
|
type: sre.SemanticAttr.Type.RELATION,
|
|
role: sre.SemanticAttr.Role.EQUALITY,
|
|
},
|
|
{
|
|
set: this.inequalities,
|
|
type: sre.SemanticAttr.Type.RELATION,
|
|
role: sre.SemanticAttr.Role.INEQUALITY,
|
|
},
|
|
{
|
|
set: this.relations,
|
|
type: sre.SemanticAttr.Type.RELATION,
|
|
role: sre.SemanticAttr.Role.UNKNOWN,
|
|
},
|
|
{
|
|
set: this.arrows,
|
|
type: sre.SemanticAttr.Type.RELATION,
|
|
role: sre.SemanticAttr.Role.ARROW,
|
|
},
|
|
{
|
|
set: this.sumOps,
|
|
type: sre.SemanticAttr.Type.LARGEOP,
|
|
role: sre.SemanticAttr.Role.SUM,
|
|
},
|
|
{
|
|
set: this.intOps,
|
|
type: sre.SemanticAttr.Type.LARGEOP,
|
|
role: sre.SemanticAttr.Role.INTEGRAL,
|
|
},
|
|
{
|
|
set: this.limitFunctions,
|
|
type: sre.SemanticAttr.Type.FUNCTION,
|
|
role: sre.SemanticAttr.Role.LIMFUNC,
|
|
},
|
|
{
|
|
set: this.prefixFunctions,
|
|
type: sre.SemanticAttr.Type.FUNCTION,
|
|
role: sre.SemanticAttr.Role.PREFIXFUNC,
|
|
},
|
|
{
|
|
set: this.infixFunctions,
|
|
type: sre.SemanticAttr.Type.OPERATOR,
|
|
role: sre.SemanticAttr.Role.INFIXFUNC,
|
|
},
|
|
];
|
|
this.meaning_ = this.initMeaning_();
|
|
};
|
|
goog.addSingletonGetter(sre.SemanticAttr);
|
|
sre.SemanticAttr.Type = {
|
|
PUNCTUATION: "punctuation",
|
|
FENCE: "fence",
|
|
NUMBER: "number",
|
|
IDENTIFIER: "identifier",
|
|
TEXT: "text",
|
|
OPERATOR: "operator",
|
|
RELATION: "relation",
|
|
LARGEOP: "largeop",
|
|
FUNCTION: "function",
|
|
ACCENT: "accent",
|
|
FENCED: "fenced",
|
|
FRACTION: "fraction",
|
|
PUNCTUATED: "punctuated",
|
|
RELSEQ: "relseq",
|
|
MULTIREL: "multirel",
|
|
INFIXOP: "infixop",
|
|
PREFIXOP: "prefixop",
|
|
POSTFIXOP: "postfixop",
|
|
APPL: "appl",
|
|
INTEGRAL: "integral",
|
|
BIGOP: "bigop",
|
|
SQRT: "sqrt",
|
|
ROOT: "root",
|
|
LIMUPPER: "limupper",
|
|
LIMLOWER: "limlower",
|
|
LIMBOTH: "limboth",
|
|
SUBSCRIPT: "subscript",
|
|
SUPERSCRIPT: "superscript",
|
|
UNDERSCORE: "underscore",
|
|
OVERSCORE: "overscore",
|
|
TENSOR: "tensor",
|
|
TABLE: "table",
|
|
MULTILINE: "multiline",
|
|
MATRIX: "matrix",
|
|
VECTOR: "vector",
|
|
CASES: "cases",
|
|
ROW: "row",
|
|
LINE: "line",
|
|
CELL: "cell",
|
|
ENCLOSE: "enclose",
|
|
INFERENCE: "inference",
|
|
RULELABEL: "rulelabel",
|
|
CONCLUSION: "conclusion",
|
|
PREMISES: "premises",
|
|
UNKNOWN: "unknown",
|
|
EMPTY: "empty",
|
|
};
|
|
sre.SemanticAttr.Role = {
|
|
COMMA: "comma",
|
|
ELLIPSIS: "ellipsis",
|
|
FULLSTOP: "fullstop",
|
|
DASH: "dash",
|
|
PRIME: "prime",
|
|
DEGREE: "degree",
|
|
VBAR: "vbar",
|
|
COLON: "colon",
|
|
OPENFENCE: "openfence",
|
|
CLOSEFENCE: "closefence",
|
|
APPLICATION: "application",
|
|
DUMMY: "dummy",
|
|
UNIT: "unit",
|
|
LABEL: "label",
|
|
OPEN: "open",
|
|
CLOSE: "close",
|
|
TOP: "top",
|
|
BOTTOM: "bottom",
|
|
NEUTRAL: "neutral",
|
|
LATINLETTER: "latinletter",
|
|
GREEKLETTER: "greekletter",
|
|
OTHERLETTER: "otherletter",
|
|
NUMBERSET: "numbersetletter",
|
|
INTEGER: "integer",
|
|
FLOAT: "float",
|
|
OTHERNUMBER: "othernumber",
|
|
MIXED: "mixed",
|
|
MULTIACCENT: "multiaccent",
|
|
OVERACCENT: "overaccent",
|
|
UNDERACCENT: "underaccent",
|
|
UNDEROVER: "underover",
|
|
SUBSUP: "subsup",
|
|
LEFTSUB: "leftsub",
|
|
LEFTSUPER: "leftsuper",
|
|
RIGHTSUB: "rightsub",
|
|
RIGHTSUPER: "rightsuper",
|
|
LEFTRIGHT: "leftright",
|
|
ABOVEBELOW: "abovebelow",
|
|
SETEMPTY: "set empty",
|
|
SETEXT: "set extended",
|
|
SETSINGLE: "set singleton",
|
|
SETCOLLECT: "set collection",
|
|
STRING: "string",
|
|
SEQUENCE: "sequence",
|
|
ENDPUNCT: "endpunct",
|
|
STARTPUNCT: "startpunct",
|
|
TEXT: "text",
|
|
NEGATIVE: "negative",
|
|
POSITIVE: "positive",
|
|
NEGATION: "negation",
|
|
MULTIOP: "multiop",
|
|
PREFIXOP: "prefix operator",
|
|
POSTFIXOP: "postfix operator",
|
|
LIMFUNC: "limit function",
|
|
INFIXFUNC: "infix function",
|
|
PREFIXFUNC: "prefix function",
|
|
POSTFIXFUNC: "postfix function",
|
|
SIMPLEFUNC: "simple function",
|
|
COMPFUNC: "composed function",
|
|
SUM: "sum",
|
|
INTEGRAL: "integral",
|
|
ADDITION: "addition",
|
|
MULTIPLICATION: "multiplication",
|
|
SUBTRACTION: "subtraction",
|
|
IMPLICIT: "implicit",
|
|
DIVISION: "division",
|
|
VULGAR: "vulgar",
|
|
EQUALITY: "equality",
|
|
INEQUALITY: "inequality",
|
|
ELEMENT: "element",
|
|
ARROW: "arrow",
|
|
DETERMINANT: "determinant",
|
|
ROWVECTOR: "rowvector",
|
|
BINOMIAL: "binomial",
|
|
SQUAREMATRIX: "squarematrix",
|
|
MULTILINE: "multiline",
|
|
MATRIX: "matrix",
|
|
VECTOR: "vector",
|
|
CASES: "cases",
|
|
TABLE: "table",
|
|
PROOF: "proof",
|
|
LEFT: "left",
|
|
RIGHT: "right",
|
|
UP: "up",
|
|
DOWN: "down",
|
|
FINAL: "final",
|
|
SINGLE: "single",
|
|
HYP: "hyp",
|
|
AXIOM: "axiom",
|
|
UNKNOWN: "unknown",
|
|
};
|
|
sre.SemanticAttr.Font = {
|
|
BOLD: "bold",
|
|
BOLDFRAKTUR: "bold-fraktur",
|
|
BOLDITALIC: "bold-italic",
|
|
BOLDSCRIPT: "bold-script",
|
|
CALIGRAPHIC: "caligraphic",
|
|
CALIGRAPHICBOLD: "caligraphic-bold",
|
|
DOUBLESTRUCK: "double-struck",
|
|
DOUBLESTRUCKITALIC: "double-struck-italic",
|
|
FRAKTUR: "fraktur",
|
|
ITALIC: "italic",
|
|
MONOSPACE: "monospace",
|
|
NORMAL: "normal",
|
|
OLDSTYLE: "oldstyle",
|
|
OLDSTYLEBOLD: "oldstyle-bold",
|
|
SCRIPT: "script",
|
|
SANSSERIF: "sans-serif",
|
|
SANSSERIFITALIC: "sans-serif-italic",
|
|
SANSSERIFBOLD: "sans-serif-bold",
|
|
SANSSERIFBOLDITALIC: "sans-serif-bold-italic",
|
|
UNKNOWN: "unknown",
|
|
};
|
|
sre.SemanticAttr.equal = function (a, b) {
|
|
return a.type === b.type && a.role === b.role && a.font === b.font;
|
|
};
|
|
sre.SemanticAttr.prototype.lookupType = function (a) {
|
|
return sre.SemanticAttr.Type.UNKNOWN;
|
|
};
|
|
sre.SemanticAttr.prototype.lookupRole = function (a) {
|
|
return sre.SemanticAttr.Role.UNKNOWN;
|
|
};
|
|
sre.SemanticAttr.lookupMeaning = function (a) {
|
|
return sre.SemanticAttr.getInstance().lookupMeaning_(a);
|
|
};
|
|
sre.SemanticAttr.invisibleTimes = function () {
|
|
return sre.SemanticAttr.getInstance().invisibleTimes_;
|
|
};
|
|
sre.SemanticAttr.invisiblePlus = function () {
|
|
return sre.SemanticAttr.getInstance().invisiblePlus_;
|
|
};
|
|
sre.SemanticAttr.invisibleComma = function () {
|
|
return sre.SemanticAttr.getInstance().invisibleComma_;
|
|
};
|
|
sre.SemanticAttr.functionApplication = function () {
|
|
return sre.SemanticAttr.getInstance().functionApplication_;
|
|
};
|
|
sre.SemanticAttr.isMatchingFenceRole = function (a, b) {
|
|
return (
|
|
(a == sre.SemanticAttr.Role.OPEN && b == sre.SemanticAttr.Role.CLOSE) ||
|
|
(a == sre.SemanticAttr.Role.NEUTRAL &&
|
|
b == sre.SemanticAttr.Role.NEUTRAL) ||
|
|
(a == sre.SemanticAttr.Role.TOP && b == sre.SemanticAttr.Role.BOTTOM)
|
|
);
|
|
};
|
|
sre.SemanticAttr.isMatchingFence = function (a, b) {
|
|
return sre.SemanticAttr.getInstance().isMatchingFence_(a, b);
|
|
};
|
|
sre.SemanticAttr.isOpeningFence = function (a) {
|
|
return a == sre.SemanticAttr.Role.OPEN || a == sre.SemanticAttr.Role.NEUTRAL;
|
|
};
|
|
sre.SemanticAttr.isClosingFence = function (a) {
|
|
return a == sre.SemanticAttr.Role.CLOSE || a == sre.SemanticAttr.Role.NEUTRAL;
|
|
};
|
|
sre.SemanticAttr.isEmbellishedType = function (a) {
|
|
return (
|
|
a === sre.SemanticAttr.Type.OPERATOR ||
|
|
a === sre.SemanticAttr.Type.RELATION ||
|
|
a === sre.SemanticAttr.Type.FENCE ||
|
|
a === sre.SemanticAttr.Type.PUNCTUATION
|
|
);
|
|
};
|
|
sre.SemanticAttr.isCharacterD = function (a) {
|
|
return (
|
|
-1 !=
|
|
"d \u2146 \uff44 \ud835\udc1d \ud835\udc51 \ud835\udcb9 \ud835\udced \ud835\udd21 \ud835\udd55 \ud835\udd89 \ud835\uddbd \ud835\uddf1 \ud835\ude25 \ud835\ude8d"
|
|
.split(" ")
|
|
.indexOf(a)
|
|
);
|
|
};
|
|
sre.SemanticAttr.prototype.isMatchingFence_ = function (a, b) {
|
|
return -1 != this.neutralFences.indexOf(a)
|
|
? a == b
|
|
: this.openClosePairs[a] == b || this.topBottomPairs[a] == b;
|
|
};
|
|
sre.SemanticAttr.prototype.initMeaning_ = function () {
|
|
for (var a = {}, b = 0, c; (c = this.symbolSetToSemantic_[b]); b++)
|
|
c.set.forEach(function (d) {
|
|
a[d] = {
|
|
role: c.role || sre.SemanticAttr.Role.UNKNOWN,
|
|
type: c.type || sre.SemanticAttr.Type.UNKNOWN,
|
|
font: c.font || sre.SemanticAttr.Font.UNKNOWN,
|
|
};
|
|
});
|
|
return a;
|
|
};
|
|
sre.SemanticAttr.prototype.lookupMeaning_ = function (a) {
|
|
return (
|
|
this.meaning_[a] || {
|
|
role: sre.SemanticAttr.Role.UNKNOWN,
|
|
type: sre.SemanticAttr.Type.UNKNOWN,
|
|
font: sre.SemanticAttr.Font.UNKNOWN,
|
|
}
|
|
);
|
|
};
|
|
sre.SemanticNode = function (a) {
|
|
this.id = a;
|
|
this.mathml = [];
|
|
this.parent = null;
|
|
this.type = sre.SemanticAttr.Type.UNKNOWN;
|
|
this.role = sre.SemanticAttr.Role.UNKNOWN;
|
|
this.font = sre.SemanticAttr.Font.UNKNOWN;
|
|
this.embellished = null;
|
|
this.fencePointer = "";
|
|
this.childNodes = [];
|
|
this.textContent = "";
|
|
this.mathmlTree = null;
|
|
this.contentNodes = [];
|
|
this.annotation = {};
|
|
this.attributes = {};
|
|
};
|
|
sre.SemanticNode.prototype.querySelectorAll = function (a) {
|
|
for (var b = [], c = 0, d; (d = this.childNodes[c]); c++)
|
|
b = b.concat(d.querySelectorAll(a));
|
|
for (c = 0; (d = this.contentNodes[c]); c++)
|
|
b = b.concat(d.querySelectorAll(a));
|
|
a(this) && b.unshift(this);
|
|
return b;
|
|
};
|
|
sre.SemanticNode.Attribute = {
|
|
EMBELLISHED: "embellished",
|
|
FENCEPOINTER: "fencepointer",
|
|
FONT: "font",
|
|
ID: "id",
|
|
ANNOTATION: "annotation",
|
|
ROLE: "role",
|
|
TYPE: "type",
|
|
CHILDREN: "children",
|
|
CONTENT: "content",
|
|
TEXT: "$t",
|
|
};
|
|
sre.SemanticNode.prototype.xml = function (a, b) {
|
|
var c = function (e, f) {
|
|
f = f.map(function (k) {
|
|
return k.xml(a, b);
|
|
});
|
|
e = a.createElementNS("", e);
|
|
for (var g = 0, h; (h = f[g]); g++) e.appendChild(h);
|
|
return e;
|
|
},
|
|
d = a.createElementNS("", this.type);
|
|
b || this.xmlAttributes_(d);
|
|
d.textContent = this.textContent;
|
|
0 < this.contentNodes.length &&
|
|
d.appendChild(c(sre.SemanticNode.Attribute.CONTENT, this.contentNodes));
|
|
0 < this.childNodes.length &&
|
|
d.appendChild(c(sre.SemanticNode.Attribute.CHILDREN, this.childNodes));
|
|
return d;
|
|
};
|
|
sre.SemanticNode.prototype.toString = function (a) {
|
|
var b = new sre.SystemExternal.xmldom.XMLSerializer(),
|
|
c = new sre.SystemExternal.xmldom.DOMParser().parseFromString(
|
|
"<snode/>",
|
|
"text/xml",
|
|
);
|
|
return b.serializeToString(this.xml(c, a));
|
|
};
|
|
sre.SemanticNode.prototype.xmlAttributes_ = function (a) {
|
|
for (var b = this.allAttributes(), c = 0, d; (d = b[c]); c++)
|
|
a.setAttribute(d[0], d[1]);
|
|
this.addExternalAttributes_(a);
|
|
};
|
|
sre.SemanticNode.prototype.allAttributes = function () {
|
|
var a = [];
|
|
a.push([sre.SemanticNode.Attribute.ROLE, this.role]);
|
|
this.font != sre.SemanticAttr.Font.UNKNOWN &&
|
|
a.push([sre.SemanticNode.Attribute.FONT, this.font]);
|
|
Object.keys(this.annotation).length &&
|
|
a.push([sre.SemanticNode.Attribute.ANNOTATION, this.xmlAnnotation()]);
|
|
this.embellished &&
|
|
a.push([sre.SemanticNode.Attribute.EMBELLISHED, this.embellished]);
|
|
this.fencePointer &&
|
|
a.push([sre.SemanticNode.Attribute.FENCEPOINTER, this.fencePointer]);
|
|
a.push([sre.SemanticNode.Attribute.ID, this.id]);
|
|
return a;
|
|
};
|
|
sre.SemanticNode.prototype.addExternalAttributes_ = function (a) {
|
|
for (var b in this.attributes) a.setAttribute(b, this.attributes[b]);
|
|
};
|
|
sre.SemanticNode.prototype.xmlAnnotation = function () {
|
|
var a = [],
|
|
b;
|
|
for (b in this.annotation)
|
|
this.annotation[b].forEach(function (c) {
|
|
a.push(b + ":" + c);
|
|
});
|
|
return a.join(";");
|
|
};
|
|
sre.SemanticNode.prototype.toJson = function () {
|
|
var a = {};
|
|
a[sre.SemanticNode.Attribute.TYPE] = this.type;
|
|
for (var b = this.allAttributes(), c = 0, d; (d = b[c]); c++)
|
|
a[d[0]] = d[1].toString();
|
|
this.textContent && (a[sre.SemanticNode.Attribute.TEXT] = this.textContent);
|
|
this.childNodes.length &&
|
|
(a[sre.SemanticNode.Attribute.CHILDREN] = this.childNodes.map(function (e) {
|
|
return e.toJson();
|
|
}));
|
|
this.contentNodes.length &&
|
|
(a[sre.SemanticNode.Attribute.CONTENT] = this.contentNodes.map(
|
|
function (e) {
|
|
return e.toJson();
|
|
},
|
|
));
|
|
return a;
|
|
};
|
|
sre.SemanticNode.prototype.updateContent = function (a, b) {
|
|
b = b
|
|
? a
|
|
.replace(/^[ \f\n\r\t\v\u200b]*/, "")
|
|
.replace(/[ \f\n\r\t\v\u200b]*$/, "")
|
|
: a.trim();
|
|
a = a && !b ? a : b;
|
|
this.textContent != a &&
|
|
((b = sre.SemanticAttr.lookupMeaning(a)),
|
|
(this.textContent = a),
|
|
(this.role = b.role),
|
|
(this.type = b.type),
|
|
(this.font = b.font));
|
|
};
|
|
sre.SemanticNode.prototype.addMathmlNodes = function (a) {
|
|
for (var b = 0, c; (c = a[b]); b++)
|
|
-1 == this.mathml.indexOf(c) && this.mathml.push(c);
|
|
};
|
|
sre.SemanticNode.prototype.removeMathmlNodes_ = function (a) {
|
|
for (var b = this.mathml, c = 0, d; (d = a[c]); c++)
|
|
(d = b.indexOf(d)), -1 != d && b.splice(d, 1);
|
|
this.mathml = b;
|
|
};
|
|
sre.SemanticNode.prototype.appendChild = function (a) {
|
|
this.childNodes.push(a);
|
|
this.addMathmlNodes(a.mathml);
|
|
a.parent = this;
|
|
};
|
|
sre.SemanticNode.prototype.replaceChild = function (a, b) {
|
|
var c = this.childNodes.indexOf(a);
|
|
if (-1 != c) {
|
|
a.parent = null;
|
|
b.parent = this;
|
|
this.childNodes[c] = b;
|
|
c = a.mathml.filter(function (e) {
|
|
return -1 == b.mathml.indexOf(e);
|
|
});
|
|
var d = b.mathml.filter(function (e) {
|
|
return -1 == a.mathml.indexOf(e);
|
|
});
|
|
this.removeMathmlNodes_(c);
|
|
this.addMathmlNodes(d);
|
|
}
|
|
};
|
|
sre.SemanticNode.prototype.appendContentNode = function (a) {
|
|
a &&
|
|
(this.contentNodes.push(a),
|
|
this.addMathmlNodes(a.mathml),
|
|
(a.parent = this));
|
|
};
|
|
sre.SemanticNode.prototype.removeContentNode = function (a) {
|
|
a &&
|
|
((a = this.contentNodes.indexOf(a)),
|
|
-1 != a && this.contentNodes.slice(a, 1));
|
|
};
|
|
sre.SemanticNode.prototype.equals = function (a) {
|
|
if (
|
|
!a ||
|
|
this.type !== a.type ||
|
|
this.role !== a.role ||
|
|
this.textContent !== a.textContent ||
|
|
this.childNodes.length !== a.childNodes.length ||
|
|
this.contentNodes.length !== a.contentNodes.length
|
|
)
|
|
return !1;
|
|
for (var b = 0, c, d; (c = this.childNodes[b]), (d = a.childNodes[b]); b++)
|
|
if (!c.equals(d)) return !1;
|
|
for (b = 0; (c = this.contentNodes[b]), (d = a.contentNodes[b]); b++)
|
|
if (!c.equals(d)) return !1;
|
|
return !0;
|
|
};
|
|
sre.SemanticNode.prototype.displayTree = function () {
|
|
console.info(this.displayTree_(0));
|
|
};
|
|
sre.SemanticNode.prototype.displayTree_ = function (a) {
|
|
a++;
|
|
var b = Array(a).join(" "),
|
|
c = "";
|
|
c += "\n" + b + this.toString();
|
|
c += "\n" + b + "MathmlTree:";
|
|
c += "\n" + b + this.mathmlTreeString_();
|
|
c += "\n" + b + "MathML:";
|
|
for (var d = 0, e; (e = this.mathml[d]); d++) c += "\n" + b + e.toString();
|
|
c += "\n" + b + "Begin Content";
|
|
this.contentNodes.forEach(function (f) {
|
|
c += f.displayTree_(a);
|
|
});
|
|
c += "\n" + b + "End Content";
|
|
c += "\n" + b + "Begin Children";
|
|
this.childNodes.forEach(function (f) {
|
|
c += f.displayTree_(a);
|
|
});
|
|
return (c += "\n" + b + "End Children");
|
|
};
|
|
sre.SemanticNode.prototype.mathmlTreeString_ = function () {
|
|
return this.mathmlTree ? this.mathmlTree.toString() : "EMPTY";
|
|
};
|
|
sre.SemanticNode.prototype.addAnnotation = function (a, b) {
|
|
b && this.addAnnotation_(a, b);
|
|
};
|
|
sre.SemanticNode.prototype.addAnnotation_ = function (a, b) {
|
|
var c = this.annotation[a];
|
|
c ? c.push(b) : (this.annotation[a] = [b]);
|
|
};
|
|
sre.SemanticNode.prototype.getAnnotation = function (a) {
|
|
return (a = this.annotation[a]) ? a : [];
|
|
};
|
|
sre.SemanticNode.prototype.hasAnnotation = function (a, b) {
|
|
return (a = this.annotation[a]) ? -1 !== a.indexOf(b) : !1;
|
|
};
|
|
sre.SemanticNode.prototype.parseAnnotation = function (a) {
|
|
a = a.split(";");
|
|
for (var b = 0, c = a.length; b < c; b++) {
|
|
var d = a[b].split(":");
|
|
this.addAnnotation(d[0], d[1]);
|
|
}
|
|
};
|
|
sre.SemanticNode.prototype.meaning = function () {
|
|
return { type: this.type, role: this.role, font: this.font };
|
|
};
|
|
sre.SemanticAnnotator = function (a, b) {
|
|
this.domain = a;
|
|
this.func = b;
|
|
this.name = a;
|
|
};
|
|
sre.SemanticAnnotator.prototype.annotate = function (a) {
|
|
a.childNodes.forEach(goog.bind(this.annotate, this));
|
|
a.addAnnotation(this.domain, this.func(a));
|
|
};
|
|
sre.SemanticVisitor = function (a, b, c) {
|
|
this.domain = a;
|
|
this.func = b;
|
|
this.name = a;
|
|
this.def = c || {};
|
|
};
|
|
sre.SemanticVisitor.prototype.visit = function (a, b) {
|
|
b = this.func(a, b);
|
|
a.addAnnotation(this.domain, b[0]);
|
|
for (var c = 0, d; (d = a.childNodes[c]); c++) b = this.visit(d, b[1]);
|
|
return b;
|
|
};
|
|
sre.SemanticAnnotations = function () {
|
|
this.annotators = {};
|
|
this.visitors = {};
|
|
this.counter = 0;
|
|
};
|
|
goog.addSingletonGetter(sre.SemanticAnnotations);
|
|
sre.SemanticAnnotations.prototype.register = function (a) {
|
|
a.name = a.domain + this.counter++;
|
|
(a instanceof sre.SemanticAnnotator ? this.annotators : this.visitors)[
|
|
a.name
|
|
] = a;
|
|
};
|
|
sre.SemanticAnnotations.prototype.unregister = function (a) {
|
|
delete this.annotators[a];
|
|
delete this.visitors[a];
|
|
};
|
|
sre.SemanticAnnotations.prototype.annotate = function (a) {
|
|
for (var b in this.annotators) this.annotators[b].annotate(a);
|
|
for (var c in this.visitors) this.visitors[c].visit(a, this.visitors[c].def);
|
|
};
|
|
sre.SemanticOrdering = function () {
|
|
this.comparators = [];
|
|
};
|
|
goog.addSingletonGetter(sre.SemanticOrdering);
|
|
sre.SemanticOrdering.prototype.add = function (a) {
|
|
this.comparators.push(a);
|
|
};
|
|
sre.SemanticOrdering.prototype.apply = function (a, b) {
|
|
for (var c = 0, d; (d = this.comparators[c]); c++)
|
|
if (((d = d.compare(a, b)), 0 !== d)) return d;
|
|
return 0;
|
|
};
|
|
sre.SemanticOrdering.prototype.sort = function (a) {
|
|
a.sort(goog.bind(this.apply, this));
|
|
};
|
|
sre.SemanticOrdering.prototype.reduce = function (a) {
|
|
if (1 >= a.length) return a;
|
|
a = a.slice();
|
|
this.sort(a);
|
|
var b = [];
|
|
do {
|
|
var c = a.pop();
|
|
b.push(c);
|
|
} while (c && a.length && 0 === this.apply(a[a.length - 1], c));
|
|
return b;
|
|
};
|
|
sre.SemanticComparator = function (a, b) {
|
|
this.comparator = a;
|
|
this.type = b || null;
|
|
sre.SemanticOrdering.getInstance().add(this);
|
|
};
|
|
sre.SemanticComparator.prototype.compare = function (a, b) {
|
|
return this.type && this.type === a.type && this.type === b.type
|
|
? this.comparator(a, b)
|
|
: 0;
|
|
};
|
|
sre.SemanticOrdering.simpleFunction = function (a, b) {
|
|
return a.role === sre.SemanticAttr.Role.SIMPLEFUNC
|
|
? 1
|
|
: b.role === sre.SemanticAttr.Role.SIMPLEFUNC
|
|
? -1
|
|
: 0;
|
|
};
|
|
new sre.SemanticComparator(
|
|
sre.SemanticOrdering.simpleFunction,
|
|
sre.SemanticAttr.Type.IDENTIFIER,
|
|
);
|
|
sre.SemanticDefault = function () {
|
|
this.map_ = {};
|
|
};
|
|
sre.SemanticDefault.prototype.add = function (a, b) {
|
|
this.map_[sre.SemanticDefault.key_(a, b.font)] = b;
|
|
};
|
|
sre.SemanticDefault.prototype.addNode = function (a) {
|
|
this.add(a.textContent, a.meaning());
|
|
};
|
|
sre.SemanticDefault.prototype.retrieve = function (a, b) {
|
|
return this.map_[sre.SemanticDefault.key_(a, b)];
|
|
};
|
|
sre.SemanticDefault.prototype.retrieveNode = function (a) {
|
|
return this.retrieve(a.textContent, a.font);
|
|
};
|
|
sre.SemanticDefault.key_ = function (a, b) {
|
|
return b ? a + ":" + b : a;
|
|
};
|
|
sre.SemanticDefault.prototype.size = function () {
|
|
return Object.keys(this.map_).length;
|
|
};
|
|
sre.SemanticCollator_ = function () {
|
|
this.map_ = {};
|
|
};
|
|
sre.SemanticCollator_.prototype.add = function (a, b) {
|
|
a = sre.SemanticDefault.key_(a, b.font);
|
|
var c = this.map_[a];
|
|
c ? c.push(b) : (this.map_[a] = [b]);
|
|
};
|
|
sre.SemanticCollator_.prototype.addNode = function (a) {
|
|
this.add(a.textContent, a);
|
|
};
|
|
sre.SemanticCollator_.prototype.retrieve = function (a, b) {
|
|
return this.map_[sre.SemanticDefault.key_(a, b)];
|
|
};
|
|
sre.SemanticCollator_.prototype.retrieveNode = function (a) {
|
|
return this.retrieve(a.textContent, a.font);
|
|
};
|
|
sre.SemanticCollator_.prototype.copyCollator = goog.abstractMethod;
|
|
sre.SemanticCollator_.prototype.copy = function () {
|
|
var a = this.copyCollator(),
|
|
b;
|
|
for (b in this.map_) a.map_[b] = this.map_[b];
|
|
return a;
|
|
};
|
|
sre.SemanticCollator_.prototype.minimize = function () {
|
|
for (var a in this.map_) 1 === this.map_[a].length && delete this.map_[a];
|
|
};
|
|
sre.SemanticCollator_.prototype.reduce = function () {
|
|
for (var a in this.map_)
|
|
1 !== this.map_[a].length &&
|
|
(this.map_[a] = sre.SemanticOrdering.getInstance().reduce(this.map_[a]));
|
|
};
|
|
sre.SemanticCollator_.prototype.minimalCollator = function () {
|
|
var a = this.copy(),
|
|
b;
|
|
for (b in a.map_) 1 === a.map_[b].length && delete a.map_[b];
|
|
return a;
|
|
};
|
|
sre.SemanticCollator_.prototype.isMultiValued = function () {
|
|
for (var a in this.map_) if (1 < this.map_[a].length) return !0;
|
|
return !1;
|
|
};
|
|
sre.SemanticCollator_.prototype.isEmpty = function () {
|
|
return !Object.keys(this.map_).length;
|
|
};
|
|
sre.SemanticNodeCollator = function () {
|
|
sre.SemanticCollator_.call(this);
|
|
};
|
|
goog.inherits(sre.SemanticNodeCollator, sre.SemanticCollator_);
|
|
sre.SemanticNodeCollator.prototype.copyCollator = function () {
|
|
return new sre.SemanticNodeCollator();
|
|
};
|
|
sre.SemanticNodeCollator.prototype.toString = function () {
|
|
var a = [],
|
|
b;
|
|
for (b in this.map_) {
|
|
for (
|
|
var c = Array(b.length + 3).join(" "), d = this.map_[b], e = [], f = 0, g;
|
|
(g = d[f]);
|
|
f++
|
|
)
|
|
e.push(g.toString());
|
|
a.push(b + ": " + e.join("\n" + c));
|
|
}
|
|
return a.join("\n");
|
|
};
|
|
sre.SemanticNodeCollator.prototype.collateMeaning = function () {
|
|
var a = new sre.SemanticMeaningCollator(),
|
|
b;
|
|
for (b in this.map_)
|
|
a.map_[b] = this.map_[b].map(function (c) {
|
|
return c.meaning();
|
|
});
|
|
return a;
|
|
};
|
|
sre.SemanticMeaningCollator = function () {
|
|
sre.SemanticCollator_.call(this);
|
|
};
|
|
goog.inherits(sre.SemanticMeaningCollator, sre.SemanticCollator_);
|
|
sre.SemanticMeaningCollator.prototype.copyCollator = function () {
|
|
return new sre.SemanticMeaningCollator();
|
|
};
|
|
sre.SemanticMeaningCollator.prototype.add = function (a, b) {
|
|
var c = this.retrieve(a, b.font);
|
|
(c &&
|
|
c.find(function (d) {
|
|
return sre.SemanticAttr.equal(d, b);
|
|
})) ||
|
|
sre.SemanticMeaningCollator.superClass_.add.call(this, a, b);
|
|
};
|
|
sre.SemanticMeaningCollator.prototype.addNode = function (a) {
|
|
this.add(a.textContent, a.meaning());
|
|
};
|
|
sre.SemanticMeaningCollator.prototype.toString = function () {
|
|
var a = [],
|
|
b;
|
|
for (b in this.map_) {
|
|
for (
|
|
var c = Array(b.length + 3).join(" "), d = this.map_[b], e = [], f = 0, g;
|
|
(g = d[f]);
|
|
f++
|
|
)
|
|
e.push(
|
|
"{type: " + g.type + ", role: " + g.role + ", font: " + g.font + "}",
|
|
);
|
|
a.push(b + ": " + e.join("\n" + c));
|
|
}
|
|
return a.join("\n");
|
|
};
|
|
sre.SemanticMeaningCollator.prototype.default = function () {
|
|
var a = new sre.SemanticDefault(),
|
|
b;
|
|
for (b in this.map_)
|
|
1 === this.map_[b].length && (a.map_[b] = this.map_[b][0]);
|
|
return a;
|
|
};
|
|
sre.SemanticMeaningCollator.prototype.newDefault = function () {
|
|
var a = this.default();
|
|
this.reduce();
|
|
var b = this.default();
|
|
return a.size() !== b.size() ? b : null;
|
|
};
|
|
sre.SemanticNodeFactory = function () {
|
|
this.idCounter_ = -1;
|
|
this.leafMap = new sre.SemanticNodeCollator();
|
|
this.defaultMap = new sre.SemanticDefault();
|
|
};
|
|
sre.SemanticNodeFactory.prototype.createNode_ = function (a) {
|
|
"undefined" !== typeof a
|
|
? (this.idCounter_ = Math.max(this.idCounter_, a))
|
|
: (a = ++this.idCounter_);
|
|
return new sre.SemanticNode(a);
|
|
};
|
|
sre.SemanticNodeFactory.prototype.makeNode = function (a) {
|
|
return this.createNode_(a);
|
|
};
|
|
sre.SemanticNodeFactory.prototype.makeUnprocessed = function (a) {
|
|
var b = this.createNode_();
|
|
b.mathml = [a];
|
|
return b;
|
|
};
|
|
sre.SemanticNodeFactory.prototype.makeEmptyNode = function () {
|
|
var a = this.createNode_();
|
|
a.type = sre.SemanticAttr.Type.EMPTY;
|
|
return a;
|
|
};
|
|
sre.SemanticNodeFactory.prototype.makeContentNode = function (a) {
|
|
var b = this.createNode_();
|
|
b.updateContent(a);
|
|
return b;
|
|
};
|
|
sre.SemanticNodeFactory.prototype.makeMultipleContentNodes = function (a, b) {
|
|
for (var c = [], d = 0; d < a; d++) c.push(this.makeContentNode(b));
|
|
return c;
|
|
};
|
|
sre.SemanticNodeFactory.prototype.makeLeafNode = function (a, b) {
|
|
if (!a) return this.makeEmptyNode();
|
|
a = this.makeContentNode(a);
|
|
a.font = b || a.font;
|
|
if ((b = this.defaultMap.retrieveNode(a)))
|
|
(a.type = b.type), (a.role = b.role), (a.font = b.font);
|
|
this.leafMap.addNode(a);
|
|
return a;
|
|
};
|
|
sre.SemanticNodeFactory.prototype.makeBranchNode = function (a, b, c, d) {
|
|
var e = this.createNode_();
|
|
d && e.updateContent(d);
|
|
e.type = a;
|
|
e.childNodes = b;
|
|
e.contentNodes = c;
|
|
b.concat(c).forEach(function (f) {
|
|
f.parent = e;
|
|
e.addMathmlNodes(f.mathml);
|
|
});
|
|
return e;
|
|
};
|
|
sre.SemanticParser = function () {};
|
|
sre.SemanticParser.prototype.parse = function (a) {};
|
|
sre.SemanticParser.prototype.parseList = function (a) {};
|
|
sre.SemanticParser.prototype.getFactory = function () {};
|
|
sre.SemanticParser.prototype.setFactory = function (a) {};
|
|
sre.SemanticParser.prototype.getType = function () {};
|
|
sre.SemanticAbstractParser = function (a) {
|
|
this.type_ = a;
|
|
this.factory_ = new sre.SemanticNodeFactory();
|
|
};
|
|
sre.SemanticAbstractParser.prototype.getFactory = function () {
|
|
return this.factory_;
|
|
};
|
|
sre.SemanticAbstractParser.prototype.setFactory = function (a) {
|
|
this.factory_ = a;
|
|
};
|
|
sre.SemanticAbstractParser.prototype.getType = function () {
|
|
return this.type_;
|
|
};
|
|
sre.SemanticAbstractParser.prototype.parse = goog.abstractMethod;
|
|
sre.SemanticAbstractParser.prototype.parseList = function (a) {
|
|
for (var b = [], c = 0, d; (d = a[c]); c++) b.push(this.parse(d));
|
|
return b;
|
|
};
|
|
sre.SemanticPred = {};
|
|
sre.SemanticPred.isAttribute = function (a, b) {
|
|
return function (c) {
|
|
c = c[a];
|
|
a: switch (a) {
|
|
case "role":
|
|
var d = sre.SemanticAttr.Role[b];
|
|
break a;
|
|
case "font":
|
|
d = sre.SemanticAttr.Font[b];
|
|
break a;
|
|
default:
|
|
d = sre.SemanticAttr.Type[b];
|
|
}
|
|
return c === d;
|
|
};
|
|
};
|
|
sre.SemanticPred.isAccent = function (a) {
|
|
return (
|
|
sre.SemanticPred.isAttribute("type", "FENCE")(a) ||
|
|
sre.SemanticPred.isAttribute("type", "PUNCTUATION")(a) ||
|
|
sre.SemanticPred.isAttribute("type", "OPERATOR")(a) ||
|
|
sre.SemanticPred.isAttribute("type", "RELATION")(a) ||
|
|
(sre.SemanticPred.isAttribute("type", "IDENTIFIER")(a) &&
|
|
sre.SemanticPred.isAttribute("role", "UNKNOWN")(a) &&
|
|
!a.textContent.match(
|
|
new RegExp(sre.SemanticAttr.getInstance().allLetters.join("|")),
|
|
))
|
|
);
|
|
};
|
|
sre.SemanticPred.isSimpleFunctionScope = function (a) {
|
|
a = a.childNodes;
|
|
if (0 === a.length) return !0;
|
|
if (1 < a.length) return !1;
|
|
a = a[0];
|
|
return a.type !== sre.SemanticAttr.Type.INFIXOP ||
|
|
(a.role === sre.SemanticAttr.Role.IMPLICIT &&
|
|
!a.childNodes.some(sre.SemanticPred.isAttribute("type", "INFIXOP")))
|
|
? !0
|
|
: !1;
|
|
};
|
|
sre.SemanticPred.isPrefixFunctionBoundary = function (a) {
|
|
return (
|
|
sre.SemanticPred.isOperator(a) ||
|
|
sre.SemanticPred.isAttribute("type", "APPL")(a) ||
|
|
sre.SemanticPred.isGeneralFunctionBoundary(a)
|
|
);
|
|
};
|
|
sre.SemanticPred.isBigOpBoundary = function (a) {
|
|
return (
|
|
sre.SemanticPred.isOperator(a) ||
|
|
sre.SemanticPred.isGeneralFunctionBoundary(a)
|
|
);
|
|
};
|
|
sre.SemanticPred.isIntegralDxBoundary = function (a, b) {
|
|
return (
|
|
!!b &&
|
|
sre.SemanticPred.isAttribute("type", "IDENTIFIER")(b) &&
|
|
sre.SemanticAttr.isCharacterD(a.textContent)
|
|
);
|
|
};
|
|
sre.SemanticPred.isIntegralDxBoundarySingle = function (a) {
|
|
if (sre.SemanticPred.isAttribute("type", "IDENTIFIER")(a)) {
|
|
var b = a.textContent[0];
|
|
return b && a.textContent[1] && sre.SemanticAttr.isCharacterD(b);
|
|
}
|
|
return !1;
|
|
};
|
|
sre.SemanticPred.isGeneralFunctionBoundary = function (a) {
|
|
return sre.SemanticPred.isRelation(a) || sre.SemanticPred.isPunctuation(a);
|
|
};
|
|
sre.SemanticPred.isEmbellished = function (a) {
|
|
return a.embellished
|
|
? a.embellished
|
|
: sre.SemanticAttr.isEmbellishedType(a.type)
|
|
? a.type
|
|
: null;
|
|
};
|
|
sre.SemanticPred.isOperator = function (a) {
|
|
return (
|
|
sre.SemanticPred.isAttribute("type", "OPERATOR")(a) ||
|
|
sre.SemanticPred.isAttribute("embellished", "OPERATOR")(a)
|
|
);
|
|
};
|
|
sre.SemanticPred.isRelation = function (a) {
|
|
return (
|
|
sre.SemanticPred.isAttribute("type", "RELATION")(a) ||
|
|
sre.SemanticPred.isAttribute("embellished", "RELATION")(a)
|
|
);
|
|
};
|
|
sre.SemanticPred.isPunctuation = function (a) {
|
|
return (
|
|
sre.SemanticPred.isAttribute("type", "PUNCTUATION")(a) ||
|
|
sre.SemanticPred.isAttribute("embellished", "PUNCTUATION")(a)
|
|
);
|
|
};
|
|
sre.SemanticPred.isFence = function (a) {
|
|
return (
|
|
sre.SemanticPred.isAttribute("type", "FENCE")(a) ||
|
|
sre.SemanticPred.isAttribute("embellished", "FENCE")(a)
|
|
);
|
|
};
|
|
sre.SemanticPred.isElligibleEmbellishedFence = function (a) {
|
|
if (!a || !sre.SemanticPred.isFence(a)) return !1;
|
|
if (!a.embellished) return !0;
|
|
var b = function (c) {
|
|
return c.embellished
|
|
? !(
|
|
!sre.SemanticPred.isAttribute("type", "TENSOR")(c) ||
|
|
(sre.SemanticPred.isAttribute("type", "EMPTY")(c.childNodes[1]) &&
|
|
sre.SemanticPred.isAttribute("type", "EMPTY")(c.childNodes[2])) ||
|
|
(sre.SemanticPred.isAttribute("type", "EMPTY")(c.childNodes[3]) &&
|
|
sre.SemanticPred.isAttribute("type", "EMPTY")(c.childNodes[4]))
|
|
) ||
|
|
(sre.SemanticPred.isAttribute("role", "CLOSE")(c) &&
|
|
sre.SemanticPred.isAttribute("type", "TENSOR")(c)) ||
|
|
(sre.SemanticPred.isAttribute("role", "OPEN")(c) &&
|
|
(sre.SemanticPred.isAttribute("type", "SUBSCRIPT")(c) ||
|
|
sre.SemanticPred.isAttribute("type", "SUPERSCRIPT")(c)))
|
|
? !1
|
|
: b(c.childNodes[0])
|
|
: !0;
|
|
};
|
|
return b(a);
|
|
};
|
|
sre.SemanticPred.isTableOrMultiline = function (a) {
|
|
return (
|
|
!!a &&
|
|
(sre.SemanticPred.isAttribute("type", "TABLE")(a) ||
|
|
sre.SemanticPred.isAttribute("type", "MULTILINE")(a))
|
|
);
|
|
};
|
|
sre.SemanticPred.tableIsMatrixOrVector = function (a) {
|
|
return (
|
|
!!a &&
|
|
sre.SemanticPred.isFencedElement(a) &&
|
|
sre.SemanticPred.isTableOrMultiline(a.childNodes[0])
|
|
);
|
|
};
|
|
sre.SemanticPred.isFencedElement = function (a) {
|
|
return (
|
|
!!a &&
|
|
sre.SemanticPred.isAttribute("type", "FENCED")(a) &&
|
|
(sre.SemanticPred.isAttribute("role", "LEFTRIGHT")(a) ||
|
|
sre.SemanticPred.isAttribute("role", "NEUTRAL")(a)) &&
|
|
1 === a.childNodes.length
|
|
);
|
|
};
|
|
sre.SemanticPred.tableIsCases = function (a, b) {
|
|
return (
|
|
0 < b.length &&
|
|
sre.SemanticPred.isAttribute("role", "OPENFENCE")(b[b.length - 1])
|
|
);
|
|
};
|
|
sre.SemanticPred.tableIsMultiline = function (a) {
|
|
return a.childNodes.every(function (b) {
|
|
return 1 >= b.childNodes.length;
|
|
});
|
|
};
|
|
sre.SemanticPred.isBinomial = function (a) {
|
|
return 2 === a.childNodes.length;
|
|
};
|
|
sre.SemanticPred.isLimitBase = function (a) {
|
|
return (
|
|
sre.SemanticPred.isAttribute("type", "LARGEOP")(a) ||
|
|
sre.SemanticPred.isAttribute("type", "LIMBOTH")(a) ||
|
|
sre.SemanticPred.isAttribute("type", "LIMLOWER")(a) ||
|
|
sre.SemanticPred.isAttribute("type", "LIMUPPER")(a) ||
|
|
(sre.SemanticPred.isAttribute("type", "FUNCTION")(a) &&
|
|
sre.SemanticPred.isAttribute("role", "LIMFUNC")(a))
|
|
);
|
|
};
|
|
sre.SemanticPred.isSimpleFunctionHead = function (a) {
|
|
return (
|
|
a.type === sre.SemanticAttr.Type.IDENTIFIER ||
|
|
a.role === sre.SemanticAttr.Role.LATINLETTER ||
|
|
a.role === sre.SemanticAttr.Role.GREEKLETTER ||
|
|
a.role === sre.SemanticAttr.Role.OTHERLETTER
|
|
);
|
|
};
|
|
sre.SemanticPred.singlePunctAtPosition = function (a, b, c) {
|
|
return (
|
|
1 === b.length &&
|
|
(a[c].type === sre.SemanticAttr.Type.PUNCTUATION ||
|
|
a[c].embellished === sre.SemanticAttr.Type.PUNCTUATION) &&
|
|
a[c] === b[0]
|
|
);
|
|
};
|
|
sre.SemanticPred.isSimpleFunction = function (a) {
|
|
return (
|
|
sre.SemanticPred.isAttribute("type", "IDENTIFIER")(a) &&
|
|
sre.SemanticPred.isAttribute("role", "SIMPLEFUNC")(a)
|
|
);
|
|
};
|
|
sre.SemanticPred.isLeftBrace = function (a) {
|
|
var b = ["{", "\ufe5b", "\uff5b"];
|
|
return !!a && -1 !== b.indexOf(a.textContent);
|
|
};
|
|
sre.SemanticPred.isRightBrace = function (a) {
|
|
var b = ["}", "\ufe5c", "\uff5d"];
|
|
return !!a && -1 !== b.indexOf(a.textContent);
|
|
};
|
|
sre.SemanticPred.isSetNode = function (a) {
|
|
return (
|
|
sre.SemanticPred.isLeftBrace(a.contentNodes[0]) &&
|
|
sre.SemanticPred.isRightBrace(a.contentNodes[1])
|
|
);
|
|
};
|
|
sre.SemanticPred.illegalSingleton_ = [
|
|
sre.SemanticAttr.Type.PUNCTUATION,
|
|
sre.SemanticAttr.Type.PUNCTUATED,
|
|
sre.SemanticAttr.Type.RELSEQ,
|
|
sre.SemanticAttr.Type.MULTIREL,
|
|
sre.SemanticAttr.Type.TABLE,
|
|
sre.SemanticAttr.Type.MULTILINE,
|
|
sre.SemanticAttr.Type.CASES,
|
|
sre.SemanticAttr.Type.INFERENCE,
|
|
];
|
|
sre.SemanticPred.scriptedElement_ = [
|
|
sre.SemanticAttr.Type.LIMUPPER,
|
|
sre.SemanticAttr.Type.LIMLOWER,
|
|
sre.SemanticAttr.Type.LIMBOTH,
|
|
sre.SemanticAttr.Type.SUBSCRIPT,
|
|
sre.SemanticAttr.Type.SUPERSCRIPT,
|
|
sre.SemanticAttr.Type.UNDERSCORE,
|
|
sre.SemanticAttr.Type.OVERSCORE,
|
|
sre.SemanticAttr.Type.TENSOR,
|
|
];
|
|
sre.SemanticPred.isSingletonSetContent = function (a) {
|
|
var b = a.type;
|
|
return -1 !== sre.SemanticPred.illegalSingleton_.indexOf(b) ||
|
|
(b === sre.SemanticAttr.Type.INFIXOP &&
|
|
a.role !== sre.SemanticAttr.Role.IMPLICIT)
|
|
? !1
|
|
: b === sre.SemanticAttr.Type.FENCED
|
|
? a.role === sre.SemanticAttr.Role.LEFTRIGHT
|
|
? sre.SemanticPred.isSingletonSetContent(a.childNodes[0])
|
|
: !0
|
|
: -1 !== sre.SemanticPred.scriptedElement_.indexOf(b)
|
|
? sre.SemanticPred.isSingletonSetContent(a.childNodes[0])
|
|
: !0;
|
|
};
|
|
sre.SemanticPred.isNumber = function (a) {
|
|
return (
|
|
a.type === sre.SemanticAttr.Type.NUMBER &&
|
|
(a.role === sre.SemanticAttr.Role.INTEGER ||
|
|
a.role === sre.SemanticAttr.Role.FLOAT)
|
|
);
|
|
};
|
|
sre.SemanticPred.isUnitCounter = function (a) {
|
|
return (
|
|
sre.SemanticPred.isNumber(a) ||
|
|
a.role === sre.SemanticAttr.Role.VULGAR ||
|
|
a.role === sre.SemanticAttr.Role.MIXED
|
|
);
|
|
};
|
|
sre.SemanticPred.isPureUnit = function (a) {
|
|
var b = a.childNodes;
|
|
return (
|
|
a.role === sre.SemanticAttr.Role.UNIT &&
|
|
(!b.length || b[0].role === sre.SemanticAttr.Role.UNIT)
|
|
);
|
|
};
|
|
sre.SemanticPred.isImplicit = function (a) {
|
|
return (
|
|
a.role === sre.SemanticAttr.Role.IMPLICIT ||
|
|
(a.role === sre.SemanticAttr.Role.UNIT &&
|
|
!!a.contentNodes.length &&
|
|
a.contentNodes[0].textContent === sre.SemanticAttr.invisibleTimes())
|
|
);
|
|
};
|
|
sre.SemanticProcessor = function () {
|
|
this.factory_ = new sre.SemanticNodeFactory();
|
|
};
|
|
goog.addSingletonGetter(sre.SemanticProcessor);
|
|
sre.SemanticProcessor.prototype.setNodeFactory = function (a) {
|
|
this.factory_ = a;
|
|
};
|
|
sre.SemanticProcessor.prototype.getNodeFactory = function () {
|
|
return this.factory_;
|
|
};
|
|
sre.SemanticProcessor.prototype.identifierNode = function (a, b, c) {
|
|
if ("MathML-Unit" === c)
|
|
(a.type = sre.SemanticAttr.Type.IDENTIFIER),
|
|
(a.role = sre.SemanticAttr.Role.UNIT);
|
|
else if (
|
|
!b &&
|
|
1 === a.textContent.length &&
|
|
(a.role === sre.SemanticAttr.Role.INTEGER ||
|
|
a.role === sre.SemanticAttr.Role.LATINLETTER ||
|
|
a.role === sre.SemanticAttr.Role.GREEKLETTER) &&
|
|
a.font === sre.SemanticAttr.Font.NORMAL
|
|
)
|
|
return (a.font = sre.SemanticAttr.Font.ITALIC), a;
|
|
a.type === sre.SemanticAttr.Type.UNKNOWN &&
|
|
(a.type = sre.SemanticAttr.Type.IDENTIFIER);
|
|
sre.SemanticProcessor.exprFont_(a);
|
|
return a;
|
|
};
|
|
sre.SemanticProcessor.prototype.implicitNode_ = function (a) {
|
|
var b = sre.SemanticProcessor.getInstance().factory_.makeMultipleContentNodes(
|
|
a.length - 1,
|
|
sre.SemanticAttr.invisibleTimes(),
|
|
),
|
|
c = sre.SemanticProcessor.getInstance().infixNode_(a, b[0]);
|
|
c.role = sre.SemanticAttr.Role.IMPLICIT;
|
|
b.forEach(function (d) {
|
|
d.parent = c;
|
|
});
|
|
c.contentNodes = b;
|
|
return c;
|
|
};
|
|
sre.SemanticProcessor.prototype.implicitNode = function (a) {
|
|
a = sre.SemanticProcessor.getInstance().getMixedNumbers_(a);
|
|
a = sre.SemanticProcessor.getInstance().combineUnits_(a);
|
|
return 1 === a.length
|
|
? a[0]
|
|
: sre.SemanticProcessor.getInstance().implicitNode_(a);
|
|
};
|
|
sre.SemanticProcessor.prototype.infixNode_ = function (a, b) {
|
|
a = sre.SemanticProcessor.getInstance().factory_.makeBranchNode(
|
|
sre.SemanticAttr.Type.INFIXOP,
|
|
a,
|
|
[b],
|
|
sre.SemanticProcessor.getEmbellishedInner_(b).textContent,
|
|
);
|
|
a.role = b.role;
|
|
this.propagateSimpleFunction(a);
|
|
return a;
|
|
};
|
|
sre.SemanticProcessor.prototype.explicitMixed_ = function (a) {
|
|
var b = sre.SemanticProcessor.partitionNodes_(a, function (h) {
|
|
return h.textContent === sre.SemanticAttr.invisiblePlus();
|
|
});
|
|
if (!b.rel.length) return a;
|
|
a = [];
|
|
for (var c = 0, d; (d = b.rel[c]); c++) {
|
|
var e = b.comp[c],
|
|
f = b.comp[c + 1],
|
|
g = e.length - 1;
|
|
e[g] &&
|
|
f[0] &&
|
|
sre.SemanticPred.isAttribute("type", "NUMBER")(e[g]) &&
|
|
!sre.SemanticPred.isAttribute("role", "MIXED")(e[g]) &&
|
|
sre.SemanticPred.isAttribute("type", "FRACTION")(f[0])
|
|
? ((d = sre.SemanticProcessor.getInstance().factory_.makeBranchNode(
|
|
sre.SemanticAttr.Type.NUMBER,
|
|
[e[g], f[0]],
|
|
[],
|
|
)),
|
|
(d.role = sre.SemanticAttr.Role.MIXED),
|
|
(a = a.concat(e.slice(0, g))),
|
|
a.push(d),
|
|
f.shift())
|
|
: ((a = a.concat(e)), a.push(d));
|
|
}
|
|
return a.concat(b.comp[b.comp.length - 1]);
|
|
};
|
|
sre.SemanticProcessor.prototype.concatNode_ = function (a, b, c) {
|
|
if (0 === b.length) return a;
|
|
var d = b
|
|
.map(function (e) {
|
|
return sre.SemanticProcessor.getEmbellishedInner_(e).textContent;
|
|
})
|
|
.join(" ");
|
|
a = sre.SemanticProcessor.getInstance().factory_.makeBranchNode(c, [a], b, d);
|
|
1 < b.length && (a.role = sre.SemanticAttr.Role.MULTIOP);
|
|
return a;
|
|
};
|
|
sre.SemanticProcessor.prototype.prefixNode_ = function (a, b) {
|
|
b = sre.SemanticProcessor.partitionNodes_(
|
|
b,
|
|
sre.SemanticPred.isAttribute("role", "SUBTRACTION"),
|
|
);
|
|
a = sre.SemanticProcessor.getInstance().concatNode_(
|
|
a,
|
|
b.comp.pop(),
|
|
sre.SemanticAttr.Type.PREFIXOP,
|
|
);
|
|
1 === a.contentNodes.length &&
|
|
a.contentNodes[0].role === sre.SemanticAttr.Role.ADDITION &&
|
|
"+" === a.contentNodes[0].textContent &&
|
|
(a.role = sre.SemanticAttr.Role.POSITIVE);
|
|
for (; 0 < b.rel.length; )
|
|
(a = sre.SemanticProcessor.getInstance().concatNode_(
|
|
a,
|
|
[b.rel.pop()],
|
|
sre.SemanticAttr.Type.PREFIXOP,
|
|
)),
|
|
(a.role = sre.SemanticAttr.Role.NEGATIVE),
|
|
(a = sre.SemanticProcessor.getInstance().concatNode_(
|
|
a,
|
|
b.comp.pop(),
|
|
sre.SemanticAttr.Type.PREFIXOP,
|
|
));
|
|
return a;
|
|
};
|
|
sre.SemanticProcessor.prototype.postfixNode_ = function (a, b) {
|
|
return b.length
|
|
? sre.SemanticProcessor.getInstance().concatNode_(
|
|
a,
|
|
b,
|
|
sre.SemanticAttr.Type.POSTFIXOP,
|
|
)
|
|
: a;
|
|
};
|
|
sre.SemanticProcessor.prototype.text = function (a, b) {
|
|
a.type = sre.SemanticAttr.Type.TEXT;
|
|
"MS" === b && (a.role = sre.SemanticAttr.Role.STRING);
|
|
sre.SemanticProcessor.exprFont_(a);
|
|
return a;
|
|
};
|
|
sre.SemanticProcessor.prototype.row = function (a) {
|
|
a = a.filter(function (b) {
|
|
return !sre.SemanticPred.isAttribute("type", "EMPTY")(b);
|
|
});
|
|
if (0 === a.length)
|
|
return sre.SemanticProcessor.getInstance().factory_.makeEmptyNode();
|
|
a = sre.SemanticProcessor.getInstance().getFencesInRow_(a);
|
|
a = sre.SemanticProcessor.getInstance().tablesInRow(a);
|
|
a = sre.SemanticProcessor.getInstance().getPunctuationInRow_(a);
|
|
a = sre.SemanticProcessor.getInstance().getTextInRow_(a);
|
|
a = sre.SemanticProcessor.getInstance().getFunctionsInRow_(a);
|
|
return sre.SemanticProcessor.getInstance().relationsInRow_(a);
|
|
};
|
|
sre.SemanticProcessor.prototype.combineUnits_ = function (a) {
|
|
var b = sre.SemanticProcessor.partitionNodes_(a, function (g) {
|
|
return !sre.SemanticPred.isAttribute("role", "UNIT")(g);
|
|
});
|
|
if (a.length === b.rel.length) return b.rel;
|
|
a = [];
|
|
do {
|
|
var c = b.comp.shift(),
|
|
d = b.rel.shift(),
|
|
e = null,
|
|
f = a.pop();
|
|
f &&
|
|
(c.length && sre.SemanticPred.isUnitCounter(f)
|
|
? c.unshift(f)
|
|
: a.push(f));
|
|
1 === c.length && (e = c.pop());
|
|
1 < c.length &&
|
|
((e = sre.SemanticProcessor.getInstance().implicitNode_(c)),
|
|
(e.role = sre.SemanticAttr.Role.UNIT));
|
|
e && a.push(e);
|
|
d && a.push(d);
|
|
} while (d);
|
|
return a;
|
|
};
|
|
sre.SemanticProcessor.prototype.getMixedNumbers_ = function (a) {
|
|
var b = sre.SemanticProcessor.partitionNodes_(a, function (g) {
|
|
return (
|
|
sre.SemanticPred.isAttribute("type", "FRACTION")(g) &&
|
|
sre.SemanticPred.isAttribute("role", "VULGAR")(g)
|
|
);
|
|
});
|
|
if (!b.rel.length) return a;
|
|
a = [];
|
|
for (var c = 0, d; (d = b.rel[c]); c++) {
|
|
var e = b.comp[c],
|
|
f = e.length - 1;
|
|
e[f] &&
|
|
sre.SemanticPred.isAttribute("type", "NUMBER")(e[f]) &&
|
|
(sre.SemanticPred.isAttribute("role", "INTEGER")(e[f]) ||
|
|
sre.SemanticPred.isAttribute("role", "FLOAT")(e[f]))
|
|
? ((d = sre.SemanticProcessor.getInstance().factory_.makeBranchNode(
|
|
sre.SemanticAttr.Type.NUMBER,
|
|
[e[f], d],
|
|
[],
|
|
)),
|
|
(d.role = sre.SemanticAttr.Role.MIXED),
|
|
(a = a.concat(e.slice(0, f))),
|
|
a.push(d))
|
|
: ((a = a.concat(e)), a.push(d));
|
|
}
|
|
return a.concat(b.comp[b.comp.length - 1]);
|
|
};
|
|
sre.SemanticProcessor.prototype.getTextInRow_ = function (a) {
|
|
if (1 >= a.length) return a;
|
|
var b = sre.SemanticProcessor.partitionNodes_(
|
|
a,
|
|
sre.SemanticPred.isAttribute("type", "TEXT"),
|
|
);
|
|
if (0 === b.rel.length) return a;
|
|
a = [];
|
|
var c = b.comp[0];
|
|
0 < c.length && a.push(sre.SemanticProcessor.getInstance().row(c));
|
|
for (var d = 0; (c = b.rel[d]); d++)
|
|
a.push(c),
|
|
(c = b.comp[d + 1]),
|
|
0 < c.length && a.push(sre.SemanticProcessor.getInstance().row(c));
|
|
return [sre.SemanticProcessor.getInstance().dummyNode_(a)];
|
|
};
|
|
sre.SemanticProcessor.prototype.relationsInRow_ = function (a) {
|
|
var b = sre.SemanticProcessor.partitionNodes_(a, sre.SemanticPred.isRelation),
|
|
c = b.rel[0];
|
|
if (!c) return sre.SemanticProcessor.getInstance().operationsInRow_(a);
|
|
if (1 === a.length) return a[0];
|
|
a = b.comp.map(
|
|
goog.bind(sre.SemanticProcessor.getInstance().operationsInRow_, this),
|
|
);
|
|
if (
|
|
b.rel.some(function (d) {
|
|
return !d.equals(c);
|
|
})
|
|
)
|
|
return (
|
|
(a = sre.SemanticProcessor.getInstance().factory_.makeBranchNode(
|
|
sre.SemanticAttr.Type.MULTIREL,
|
|
a,
|
|
b.rel,
|
|
)),
|
|
b.rel.every(function (d) {
|
|
return d.role === c.role;
|
|
}) && (a.role = c.role),
|
|
a
|
|
);
|
|
a = sre.SemanticProcessor.getInstance().factory_.makeBranchNode(
|
|
sre.SemanticAttr.Type.RELSEQ,
|
|
a,
|
|
b.rel,
|
|
sre.SemanticProcessor.getEmbellishedInner_(c).textContent,
|
|
);
|
|
a.role = c.role;
|
|
return a;
|
|
};
|
|
sre.SemanticProcessor.prototype.operationsInRow_ = function (a) {
|
|
if (0 === a.length)
|
|
return sre.SemanticProcessor.getInstance().factory_.makeEmptyNode();
|
|
a = this.explicitMixed_(a);
|
|
if (1 === a.length) return a[0];
|
|
for (var b = []; 0 < a.length && sre.SemanticPred.isOperator(a[0]); )
|
|
b.push(a.shift());
|
|
if (0 === a.length)
|
|
return sre.SemanticProcessor.getInstance().prefixNode_(b.pop(), b);
|
|
if (1 === a.length)
|
|
return sre.SemanticProcessor.getInstance().prefixNode_(a[0], b);
|
|
a = sre.SemanticProcessor.sliceNodes_(a, sre.SemanticPred.isOperator);
|
|
b = sre.SemanticProcessor.getInstance().prefixNode_(
|
|
sre.SemanticProcessor.getInstance().implicitNode(a.head),
|
|
b,
|
|
);
|
|
return a.div
|
|
? sre.SemanticProcessor.getInstance().operationsTree_(a.tail, b, a.div)
|
|
: b;
|
|
};
|
|
sre.SemanticProcessor.prototype.operationsTree_ = function (a, b, c, d) {
|
|
d = d || [];
|
|
if (0 === a.length)
|
|
return (
|
|
d.unshift(c),
|
|
b.type === sre.SemanticAttr.Type.INFIXOP
|
|
? ((d = sre.SemanticProcessor.getInstance().postfixNode_(
|
|
b.childNodes.pop(),
|
|
d,
|
|
)),
|
|
b.appendChild(d),
|
|
b)
|
|
: sre.SemanticProcessor.getInstance().postfixNode_(b, d)
|
|
);
|
|
a = sre.SemanticProcessor.sliceNodes_(a, sre.SemanticPred.isOperator);
|
|
if (0 === a.head.length)
|
|
return (
|
|
d.push(a.div),
|
|
sre.SemanticProcessor.getInstance().operationsTree_(a.tail, b, c, d)
|
|
);
|
|
d = sre.SemanticProcessor.getInstance().prefixNode_(
|
|
sre.SemanticProcessor.getInstance().implicitNode(a.head),
|
|
d,
|
|
);
|
|
b = sre.SemanticProcessor.getInstance().appendOperand_(b, c, d);
|
|
return a.div
|
|
? sre.SemanticProcessor.getInstance().operationsTree_(a.tail, b, a.div, [])
|
|
: b;
|
|
};
|
|
sre.SemanticProcessor.prototype.appendOperand_ = function (a, b, c) {
|
|
if (a.type !== sre.SemanticAttr.Type.INFIXOP)
|
|
return sre.SemanticProcessor.getInstance().infixNode_([a, c], b);
|
|
var d = this.appendDivisionOp_(a, b, c);
|
|
return d
|
|
? d
|
|
: sre.SemanticProcessor.getInstance().appendExistingOperator_(a, b, c)
|
|
? a
|
|
: b.role === sre.SemanticAttr.Role.MULTIPLICATION
|
|
? sre.SemanticProcessor.getInstance().appendMultiplicativeOp_(a, b, c)
|
|
: sre.SemanticProcessor.getInstance().appendAdditiveOp_(a, b, c);
|
|
};
|
|
sre.SemanticProcessor.prototype.appendDivisionOp_ = function (a, b, c) {
|
|
return b.role === sre.SemanticAttr.Role.DIVISION
|
|
? sre.SemanticPred.isImplicit(a)
|
|
? sre.SemanticProcessor.getInstance().infixNode_([a, c], b)
|
|
: this.appendLastOperand_(a, b, c)
|
|
: a.role === sre.SemanticAttr.Role.DIVISION
|
|
? this.infixNode_([a, c], b)
|
|
: null;
|
|
};
|
|
sre.SemanticProcessor.prototype.appendLastOperand_ = function (a, b, c) {
|
|
for (
|
|
var d = a, e = a.childNodes[a.childNodes.length - 1];
|
|
e &&
|
|
e.type === sre.SemanticAttr.Type.INFIXOP &&
|
|
!sre.SemanticPred.isImplicit(e);
|
|
)
|
|
(d = e), (e = d.childNodes[a.childNodes.length - 1]);
|
|
b = sre.SemanticProcessor.getInstance().infixNode_(
|
|
[d.childNodes.pop(), c],
|
|
b,
|
|
);
|
|
d.appendChild(b);
|
|
return a;
|
|
};
|
|
sre.SemanticProcessor.prototype.appendMultiplicativeOp_ = function (a, b, c) {
|
|
if (sre.SemanticPred.isImplicit(a))
|
|
return sre.SemanticProcessor.getInstance().infixNode_([a, c], b);
|
|
for (
|
|
var d = a, e = a.childNodes[a.childNodes.length - 1];
|
|
e &&
|
|
e.type === sre.SemanticAttr.Type.INFIXOP &&
|
|
!sre.SemanticPred.isImplicit(e);
|
|
)
|
|
(d = e), (e = d.childNodes[a.childNodes.length - 1]);
|
|
b = sre.SemanticProcessor.getInstance().infixNode_(
|
|
[d.childNodes.pop(), c],
|
|
b,
|
|
);
|
|
d.appendChild(b);
|
|
return a;
|
|
};
|
|
sre.SemanticProcessor.prototype.appendAdditiveOp_ = function (a, b, c) {
|
|
return sre.SemanticProcessor.getInstance().infixNode_([a, c], b);
|
|
};
|
|
sre.SemanticProcessor.prototype.appendExistingOperator_ = function (a, b, c) {
|
|
return !a ||
|
|
a.type !== sre.SemanticAttr.Type.INFIXOP ||
|
|
sre.SemanticPred.isImplicit(a)
|
|
? !1
|
|
: a.contentNodes[0].equals(b)
|
|
? (a.appendContentNode(b), a.appendChild(c), !0)
|
|
: sre.SemanticProcessor.getInstance().appendExistingOperator_(
|
|
a.childNodes[a.childNodes.length - 1],
|
|
b,
|
|
c,
|
|
);
|
|
};
|
|
sre.SemanticProcessor.prototype.getFencesInRow_ = function (a) {
|
|
a = sre.SemanticProcessor.partitionNodes_(a, sre.SemanticPred.isFence);
|
|
a = sre.SemanticProcessor.purgeFences_(a);
|
|
var b = a.comp.shift();
|
|
return sre.SemanticProcessor.getInstance().fences_(a.rel, a.comp, [], [b]);
|
|
};
|
|
sre.SemanticProcessor.prototype.fences_ = function (a, b, c, d) {
|
|
if (0 === a.length && 0 === c.length) return d[0];
|
|
var e = sre.SemanticPred.isAttribute("role", "OPEN");
|
|
if (0 === a.length) {
|
|
for (a = d.shift(); 0 < c.length; ) {
|
|
if (e(c[0]))
|
|
(b = c.shift()), sre.SemanticProcessor.fenceToPunct_(b), a.push(b);
|
|
else {
|
|
c = sre.SemanticProcessor.sliceNodes_(c, e);
|
|
var f = c.head.length - 1,
|
|
g = sre.SemanticProcessor.getInstance().neutralFences_(
|
|
c.head,
|
|
d.slice(0, f),
|
|
);
|
|
d = d.slice(f);
|
|
a.push.apply(a, g);
|
|
c.div && c.tail.unshift(c.div);
|
|
c = c.tail;
|
|
}
|
|
a.push.apply(a, d.shift());
|
|
}
|
|
return a;
|
|
}
|
|
f = c[c.length - 1];
|
|
g = a[0].role;
|
|
if (
|
|
g === sre.SemanticAttr.Role.OPEN ||
|
|
(g === sre.SemanticAttr.Role.NEUTRAL &&
|
|
(!f || a[0].textContent !== f.textContent))
|
|
)
|
|
return (
|
|
c.push(a.shift()),
|
|
(e = b.shift()) && d.push(e),
|
|
sre.SemanticProcessor.getInstance().fences_(a, b, c, d)
|
|
);
|
|
if (
|
|
f &&
|
|
((g === sre.SemanticAttr.Role.CLOSE &&
|
|
f.role === sre.SemanticAttr.Role.OPEN) ||
|
|
(g === sre.SemanticAttr.Role.NEUTRAL &&
|
|
a[0].textContent === f.textContent))
|
|
)
|
|
return (
|
|
(e = sre.SemanticProcessor.getInstance().horizontalFencedNode_(
|
|
c.pop(),
|
|
a.shift(),
|
|
d.pop(),
|
|
)),
|
|
d.push(d.pop().concat([e], b.shift())),
|
|
sre.SemanticProcessor.getInstance().fences_(a, b, c, d)
|
|
);
|
|
if (
|
|
f &&
|
|
g === sre.SemanticAttr.Role.CLOSE &&
|
|
f.role === sre.SemanticAttr.Role.NEUTRAL &&
|
|
c.some(e)
|
|
)
|
|
return (
|
|
(c = sre.SemanticProcessor.sliceNodes_(c, e, !0)),
|
|
(e = d.pop()),
|
|
(f = d.length - c.tail.length + 1),
|
|
(g = sre.SemanticProcessor.getInstance().neutralFences_(
|
|
c.tail,
|
|
d.slice(f),
|
|
)),
|
|
(d = d.slice(0, f)),
|
|
(e = sre.SemanticProcessor.getInstance().horizontalFencedNode_(
|
|
c.div,
|
|
a.shift(),
|
|
d.pop().concat(g, e),
|
|
)),
|
|
d.push(d.pop().concat([e], b.shift())),
|
|
sre.SemanticProcessor.getInstance().fences_(a, b, c.head, d)
|
|
);
|
|
e = a.shift();
|
|
sre.SemanticProcessor.fenceToPunct_(e);
|
|
d.push(d.pop().concat([e], b.shift()));
|
|
return sre.SemanticProcessor.getInstance().fences_(a, b, c, d);
|
|
};
|
|
sre.SemanticProcessor.prototype.neutralFences_ = function (a, b) {
|
|
if (0 === a.length) return a;
|
|
if (1 === a.length) return sre.SemanticProcessor.fenceToPunct_(a[0]), a;
|
|
var c = a.shift(),
|
|
d = sre.SemanticProcessor.sliceNodes_(a, function (e) {
|
|
return (
|
|
sre.SemanticProcessor.getEmbellishedInner_(e).textContent ==
|
|
sre.SemanticProcessor.getEmbellishedInner_(c).textContent
|
|
);
|
|
});
|
|
if (!d.div)
|
|
return (
|
|
sre.SemanticProcessor.fenceToPunct_(c),
|
|
(d = b.shift()),
|
|
d.unshift(c),
|
|
d.concat(sre.SemanticProcessor.getInstance().neutralFences_(a, b))
|
|
);
|
|
b = sre.SemanticProcessor.getInstance().combineFencedContent_(
|
|
c,
|
|
d.div,
|
|
d.head,
|
|
b,
|
|
);
|
|
return 0 < d.tail.length
|
|
? ((a = b.shift()),
|
|
(d = sre.SemanticProcessor.getInstance().neutralFences_(d.tail, b)),
|
|
a.concat(d))
|
|
: b[0];
|
|
};
|
|
sre.SemanticProcessor.prototype.combineFencedContent_ = function (a, b, c, d) {
|
|
if (0 === c.length)
|
|
return (
|
|
(a = sre.SemanticProcessor.getInstance().horizontalFencedNode_(
|
|
a,
|
|
b,
|
|
d.shift(),
|
|
)),
|
|
0 < d.length ? d[0].unshift(a) : (d = [[a]]),
|
|
d
|
|
);
|
|
var e = d.shift(),
|
|
f = c.length - 1,
|
|
g = d.slice(0, f);
|
|
d = d.slice(f);
|
|
f = d.shift();
|
|
c = sre.SemanticProcessor.getInstance().neutralFences_(c, g);
|
|
e.push.apply(e, c);
|
|
e.push.apply(e, f);
|
|
a = sre.SemanticProcessor.getInstance().horizontalFencedNode_(a, b, e);
|
|
0 < d.length ? d[0].unshift(a) : (d = [[a]]);
|
|
return d;
|
|
};
|
|
sre.SemanticProcessor.FENCE_TO_PUNCT_ = {};
|
|
sre.SemanticProcessor.FENCE_TO_PUNCT_[sre.SemanticAttr.Role.NEUTRAL] =
|
|
sre.SemanticAttr.Role.VBAR;
|
|
sre.SemanticProcessor.FENCE_TO_PUNCT_[sre.SemanticAttr.Role.OPEN] =
|
|
sre.SemanticAttr.Role.OPENFENCE;
|
|
sre.SemanticProcessor.FENCE_TO_PUNCT_[sre.SemanticAttr.Role.CLOSE] =
|
|
sre.SemanticAttr.Role.CLOSEFENCE;
|
|
sre.SemanticProcessor.fenceToPunct_ = function (a) {
|
|
var b = sre.SemanticProcessor.FENCE_TO_PUNCT_[a.role];
|
|
if (b) {
|
|
for (; a.embellished; )
|
|
(a.embellished = sre.SemanticAttr.Type.PUNCTUATION),
|
|
(a.role = b),
|
|
(a = a.childNodes[0]);
|
|
a.type = sre.SemanticAttr.Type.PUNCTUATION;
|
|
a.role = b;
|
|
}
|
|
};
|
|
sre.SemanticProcessor.prototype.horizontalFencedNode_ = function (a, b, c) {
|
|
c = sre.SemanticProcessor.getInstance().row(c);
|
|
b = sre.SemanticProcessor.getInstance().factory_.makeBranchNode(
|
|
sre.SemanticAttr.Type.FENCED,
|
|
[c],
|
|
[a, b],
|
|
);
|
|
a.role === sre.SemanticAttr.Role.OPEN
|
|
? (this.classifyHorizontalFence_(b), this.propagateComposedFunction(b))
|
|
: (b.role = a.role);
|
|
return sre.SemanticProcessor.rewriteFencedNode_(b);
|
|
};
|
|
sre.SemanticProcessor.prototype.classifyHorizontalFence_ = function (a) {
|
|
a.role = sre.SemanticAttr.Role.LEFTRIGHT;
|
|
var b = a.childNodes;
|
|
if (sre.SemanticPred.isSetNode(a) && !(1 < b.length))
|
|
if (0 === b.length || b[0].type === sre.SemanticAttr.Type.EMPTY)
|
|
a.role = sre.SemanticAttr.Role.SETEMPTY;
|
|
else {
|
|
var c = b[0].type;
|
|
if (1 === b.length && sre.SemanticPred.isSingletonSetContent(b[0]))
|
|
a.role = sre.SemanticAttr.Role.SETSINGLE;
|
|
else {
|
|
var d = b[0].role;
|
|
c === sre.SemanticAttr.Type.PUNCTUATED &&
|
|
d === sre.SemanticAttr.Role.SEQUENCE &&
|
|
(b[0].contentNodes[0].role === sre.SemanticAttr.Role.COMMA
|
|
? (a.role = sre.SemanticAttr.Role.SETCOLLECT)
|
|
: 1 !== b[0].contentNodes.length ||
|
|
(b[0].contentNodes[0].role !== sre.SemanticAttr.Role.VBAR &&
|
|
b[0].contentNodes[0].role !== sre.SemanticAttr.Role.COLON) ||
|
|
((a.role = sre.SemanticAttr.Role.SETEXT), this.setExtension_(a)));
|
|
}
|
|
}
|
|
};
|
|
sre.SemanticProcessor.prototype.setExtension_ = function (a) {
|
|
(a = a.childNodes[0].childNodes[0]) &&
|
|
a.type === sre.SemanticAttr.Type.INFIXOP &&
|
|
1 === a.contentNodes.length &&
|
|
a.contentNodes[0].role === sre.SemanticAttr.Role.UNKNOWN &&
|
|
(a.contentNodes[0].role = sre.SemanticAttr.Role.SETEXT);
|
|
};
|
|
sre.SemanticProcessor.prototype.getPunctuationInRow_ = function (a) {
|
|
if (1 >= a.length) return a;
|
|
var b = function (g) {
|
|
g = g.type;
|
|
return (
|
|
"punctuation" === g ||
|
|
"text" === g ||
|
|
"operator" === g ||
|
|
"relation" === g
|
|
);
|
|
},
|
|
c = sre.SemanticProcessor.partitionNodes_(a, function (g) {
|
|
if (!sre.SemanticPred.isPunctuation(g)) return !1;
|
|
if (
|
|
sre.SemanticPred.isPunctuation(g) &&
|
|
!sre.SemanticPred.isAttribute("role", "ELLIPSIS")(g)
|
|
)
|
|
return !0;
|
|
var h = a.indexOf(g);
|
|
if (0 === h) return a[1] && b(a[1]) ? !1 : !0;
|
|
g = a[h - 1];
|
|
if (h === a.length - 1) return b(g) ? !1 : !0;
|
|
h = a[h + 1];
|
|
return b(g) && b(h) ? !1 : !0;
|
|
});
|
|
if (0 === c.rel.length) return a;
|
|
var d = [],
|
|
e = c.comp.shift();
|
|
0 < e.length && d.push(sre.SemanticProcessor.getInstance().row(e));
|
|
for (var f = 0; 0 < c.comp.length; )
|
|
d.push(c.rel[f++]),
|
|
(e = c.comp.shift()),
|
|
0 < e.length && d.push(sre.SemanticProcessor.getInstance().row(e));
|
|
return [sre.SemanticProcessor.getInstance().punctuatedNode_(d, c.rel)];
|
|
};
|
|
sre.SemanticProcessor.prototype.punctuatedNode_ = function (a, b) {
|
|
var c = sre.SemanticProcessor.getInstance().factory_.makeBranchNode(
|
|
sre.SemanticAttr.Type.PUNCTUATED,
|
|
a,
|
|
b,
|
|
);
|
|
if (b.length === a.length) {
|
|
var d = b[0].role;
|
|
if (
|
|
d !== sre.SemanticAttr.Role.UNKNOWN &&
|
|
b.every(function (e) {
|
|
return e.role === d;
|
|
})
|
|
)
|
|
return (c.role = d), c;
|
|
}
|
|
sre.SemanticPred.singlePunctAtPosition(a, b, 0)
|
|
? (c.role = sre.SemanticAttr.Role.STARTPUNCT)
|
|
: sre.SemanticPred.singlePunctAtPosition(a, b, a.length - 1)
|
|
? (c.role = sre.SemanticAttr.Role.ENDPUNCT)
|
|
: b.every(sre.SemanticPred.isAttribute("role", "DUMMY"))
|
|
? (c.role = sre.SemanticAttr.Role.TEXT)
|
|
: (c.role = sre.SemanticAttr.Role.SEQUENCE);
|
|
return c;
|
|
};
|
|
sre.SemanticProcessor.prototype.dummyNode_ = function (a) {
|
|
var b = sre.SemanticProcessor.getInstance().factory_.makeMultipleContentNodes(
|
|
a.length - 1,
|
|
sre.SemanticAttr.invisibleComma(),
|
|
);
|
|
b.forEach(function (c) {
|
|
c.role = sre.SemanticAttr.Role.DUMMY;
|
|
});
|
|
return sre.SemanticProcessor.getInstance().punctuatedNode_(a, b);
|
|
};
|
|
sre.SemanticProcessor.MML_TO_LIMIT_ = {
|
|
MSUB: sre.SemanticAttr.Type.LIMLOWER,
|
|
MUNDER: sre.SemanticAttr.Type.LIMLOWER,
|
|
MSUP: sre.SemanticAttr.Type.LIMUPPER,
|
|
MOVER: sre.SemanticAttr.Type.LIMUPPER,
|
|
MSUBSUP: sre.SemanticAttr.Type.LIMBOTH,
|
|
MUNDEROVER: sre.SemanticAttr.Type.LIMBOTH,
|
|
};
|
|
sre.SemanticProcessor.prototype.limitNode = function (a, b) {
|
|
var c = b[0];
|
|
if (sre.SemanticPred.isLimitBase(c))
|
|
a = sre.SemanticProcessor.MML_TO_LIMIT_[a];
|
|
else
|
|
switch (a) {
|
|
case "MSUB":
|
|
a = sre.SemanticAttr.Type.SUBSCRIPT;
|
|
break;
|
|
case "MSUP":
|
|
a = sre.SemanticAttr.Type.SUPERSCRIPT;
|
|
break;
|
|
case "MSUBSUP":
|
|
var d = sre.SemanticProcessor.getInstance().factory_.makeBranchNode(
|
|
sre.SemanticAttr.Type.SUBSCRIPT,
|
|
[c, b[1]],
|
|
[],
|
|
);
|
|
d.role = sre.SemanticAttr.Role.SUBSUP;
|
|
b = [d, b[2]];
|
|
a = sre.SemanticAttr.Type.SUPERSCRIPT;
|
|
break;
|
|
case "MOVER":
|
|
a = sre.SemanticAttr.Type.OVERSCORE;
|
|
sre.SemanticPred.isAccent(b[1]) &&
|
|
(b[1].role = sre.SemanticAttr.Role.OVERACCENT);
|
|
break;
|
|
case "MUNDER":
|
|
a = sre.SemanticAttr.Type.UNDERSCORE;
|
|
sre.SemanticPred.isAccent(b[1]) &&
|
|
(b[1].role = sre.SemanticAttr.Role.UNDERACCENT);
|
|
break;
|
|
default:
|
|
(d = sre.SemanticPred.isAccent(b[1])),
|
|
(a = sre.SemanticPred.isAccent(b[2])),
|
|
d && (b[1].role = sre.SemanticAttr.Role.UNDERACCENT),
|
|
a && (b[2].role = sre.SemanticAttr.Role.OVERACCENT),
|
|
a && !d
|
|
? ((d = sre.SemanticProcessor.getInstance().factory_.makeBranchNode(
|
|
sre.SemanticAttr.Type.OVERSCORE,
|
|
[c, b[2]],
|
|
[],
|
|
)),
|
|
(b = [d, b[1]]),
|
|
(a = sre.SemanticAttr.Type.UNDERSCORE))
|
|
: ((d = sre.SemanticProcessor.getInstance().factory_.makeBranchNode(
|
|
sre.SemanticAttr.Type.UNDERSCORE,
|
|
[c, b[1]],
|
|
[],
|
|
)),
|
|
(b = [d, b[2]]),
|
|
(a = sre.SemanticAttr.Type.OVERSCORE)),
|
|
(d.role = sre.SemanticAttr.Role.UNDEROVER);
|
|
}
|
|
b = sre.SemanticProcessor.getInstance().factory_.makeBranchNode(a, b, []);
|
|
a = sre.SemanticPred.isEmbellished(c);
|
|
d && (d.embellished = a);
|
|
b.embellished = a;
|
|
b.role = c.role;
|
|
return b;
|
|
};
|
|
sre.SemanticProcessor.prototype.getFunctionsInRow_ = function (a, b) {
|
|
b = b || [];
|
|
if (0 === a.length) return b;
|
|
var c = a.shift(),
|
|
d = sre.SemanticProcessor.classifyFunction_(c, a);
|
|
if (!d)
|
|
return (
|
|
b.push(c), sre.SemanticProcessor.getInstance().getFunctionsInRow_(a, b)
|
|
);
|
|
a = sre.SemanticProcessor.getInstance().getFunctionsInRow_(a, []);
|
|
a = sre.SemanticProcessor.getInstance().getFunctionArgs_(c, a, d);
|
|
return b.concat(a);
|
|
};
|
|
sre.SemanticProcessor.CLASSIFY_FUNCTION_ = {};
|
|
sre.SemanticProcessor.CLASSIFY_FUNCTION_[sre.SemanticAttr.Role.INTEGRAL] =
|
|
"integral";
|
|
sre.SemanticProcessor.CLASSIFY_FUNCTION_[sre.SemanticAttr.Role.SUM] = "bigop";
|
|
sre.SemanticProcessor.CLASSIFY_FUNCTION_[sre.SemanticAttr.Role.PREFIXFUNC] =
|
|
"prefix";
|
|
sre.SemanticProcessor.CLASSIFY_FUNCTION_[sre.SemanticAttr.Role.LIMFUNC] =
|
|
"prefix";
|
|
sre.SemanticProcessor.CLASSIFY_FUNCTION_[sre.SemanticAttr.Role.SIMPLEFUNC] =
|
|
"prefix";
|
|
sre.SemanticProcessor.CLASSIFY_FUNCTION_[sre.SemanticAttr.Role.COMPFUNC] =
|
|
"prefix";
|
|
sre.SemanticProcessor.classifyFunction_ = function (a, b) {
|
|
if (
|
|
a.type === sre.SemanticAttr.Type.APPL ||
|
|
a.type === sre.SemanticAttr.Type.BIGOP ||
|
|
a.type === sre.SemanticAttr.Type.INTEGRAL
|
|
)
|
|
return "";
|
|
if (b[0] && b[0].textContent === sre.SemanticAttr.functionApplication()) {
|
|
b.shift();
|
|
b = sre.SemanticAttr.Role.SIMPLEFUNC;
|
|
if (
|
|
a.role === sre.SemanticAttr.Role.PREFIXFUNC ||
|
|
a.role === sre.SemanticAttr.Role.LIMFUNC
|
|
)
|
|
b = a.role;
|
|
sre.SemanticProcessor.propagateFunctionRole_(a, b);
|
|
return "prefix";
|
|
}
|
|
return (b = sre.SemanticProcessor.CLASSIFY_FUNCTION_[a.role])
|
|
? b
|
|
: sre.SemanticPred.isSimpleFunctionHead(a)
|
|
? "simple"
|
|
: "";
|
|
};
|
|
sre.SemanticProcessor.propagateFunctionRole_ = function (a, b) {
|
|
a &&
|
|
(sre.SemanticPred.isAttribute("role", "SUBSUP")(a) || (a.role = b),
|
|
sre.SemanticProcessor.propagateFunctionRole_(a.childNodes[0], b));
|
|
};
|
|
sre.SemanticProcessor.prototype.getFunctionArgs_ = function (a, b, c) {
|
|
switch (c) {
|
|
case "integral":
|
|
b = sre.SemanticProcessor.getInstance().getIntegralArgs_(b);
|
|
if (!b.intvar && !b.integrand.length) return b.rest.unshift(a), b.rest;
|
|
c = sre.SemanticProcessor.getInstance().row(b.integrand);
|
|
a = sre.SemanticProcessor.getInstance().integralNode_(a, c, b.intvar);
|
|
b.rest.unshift(a);
|
|
return b.rest;
|
|
case "prefix":
|
|
if (b[0] && b[0].type === sre.SemanticAttr.Type.FENCED) {
|
|
var d = b.shift();
|
|
d.role !== sre.SemanticAttr.Role.NEUTRAL &&
|
|
(d.role = sre.SemanticAttr.Role.LEFTRIGHT);
|
|
a = sre.SemanticProcessor.getInstance().functionNode_(a, d);
|
|
b.unshift(a);
|
|
return b;
|
|
}
|
|
c = sre.SemanticProcessor.sliceNodes_(
|
|
b,
|
|
sre.SemanticPred.isPrefixFunctionBoundary,
|
|
);
|
|
if (c.head.length)
|
|
(d = sre.SemanticProcessor.getInstance().row(c.head)),
|
|
c.div && c.tail.unshift(c.div);
|
|
else {
|
|
if (!c.div || !sre.SemanticPred.isAttribute("type", "APPL")(c.div))
|
|
return b.unshift(a), b;
|
|
d = c.div;
|
|
}
|
|
a = sre.SemanticProcessor.getInstance().functionNode_(a, d);
|
|
c.tail.unshift(a);
|
|
return c.tail;
|
|
case "bigop":
|
|
c = sre.SemanticProcessor.sliceNodes_(
|
|
b,
|
|
sre.SemanticPred.isBigOpBoundary,
|
|
);
|
|
if (!c.head.length) return b.unshift(a), b;
|
|
d = sre.SemanticProcessor.getInstance().row(c.head);
|
|
a = sre.SemanticProcessor.getInstance().bigOpNode_(a, d);
|
|
c.div && c.tail.unshift(c.div);
|
|
c.tail.unshift(a);
|
|
return c.tail;
|
|
default:
|
|
if (0 === b.length) return [a];
|
|
c = b[0];
|
|
if (
|
|
c.type === sre.SemanticAttr.Type.FENCED &&
|
|
c.role !== sre.SemanticAttr.Role.NEUTRAL &&
|
|
sre.SemanticPred.isSimpleFunctionScope(c)
|
|
)
|
|
return (
|
|
(c.role = sre.SemanticAttr.Role.LEFTRIGHT),
|
|
sre.SemanticProcessor.propagateFunctionRole_(
|
|
a,
|
|
sre.SemanticAttr.Role.SIMPLEFUNC,
|
|
),
|
|
(a = sre.SemanticProcessor.getInstance().functionNode_(a, b.shift())),
|
|
b.unshift(a),
|
|
b
|
|
);
|
|
b.unshift(a);
|
|
return b;
|
|
}
|
|
};
|
|
sre.SemanticProcessor.prototype.getIntegralArgs_ = function (a, b) {
|
|
b = b || [];
|
|
if (0 === a.length) return { integrand: b, intvar: null, rest: a };
|
|
var c = a[0];
|
|
if (sre.SemanticPred.isGeneralFunctionBoundary(c))
|
|
return { integrand: b, intvar: null, rest: a };
|
|
if (sre.SemanticPred.isIntegralDxBoundarySingle(c))
|
|
return { integrand: b, intvar: c, rest: a.slice(1) };
|
|
if (a[1] && sre.SemanticPred.isIntegralDxBoundary(c, a[1]))
|
|
return (
|
|
(c = sre.SemanticProcessor.getInstance().prefixNode_(a[1], [c])),
|
|
(c.role = sre.SemanticAttr.Role.INTEGRAL),
|
|
{ integrand: b, intvar: c, rest: a.slice(2) }
|
|
);
|
|
b.push(a.shift());
|
|
return sre.SemanticProcessor.getInstance().getIntegralArgs_(a, b);
|
|
};
|
|
sre.SemanticProcessor.prototype.functionNode_ = function (a, b) {
|
|
var c = sre.SemanticProcessor.getInstance().factory_.makeContentNode(
|
|
sre.SemanticAttr.functionApplication(),
|
|
);
|
|
c.type = sre.SemanticAttr.Type.PUNCTUATION;
|
|
c.role = sre.SemanticAttr.Role.APPLICATION;
|
|
var d = sre.SemanticProcessor.getFunctionOp_(a, function (e) {
|
|
return (
|
|
sre.SemanticPred.isAttribute("type", "FUNCTION")(e) ||
|
|
(sre.SemanticPred.isAttribute("type", "IDENTIFIER")(e) &&
|
|
sre.SemanticPred.isAttribute("role", "SIMPLEFUNC")(e))
|
|
);
|
|
});
|
|
return sre.SemanticProcessor.getInstance().functionalNode_(
|
|
sre.SemanticAttr.Type.APPL,
|
|
[a, b],
|
|
d,
|
|
[c],
|
|
);
|
|
};
|
|
sre.SemanticProcessor.prototype.bigOpNode_ = function (a, b) {
|
|
var c = sre.SemanticProcessor.getFunctionOp_(
|
|
a,
|
|
sre.SemanticPred.isAttribute("type", "LARGEOP"),
|
|
);
|
|
return sre.SemanticProcessor.getInstance().functionalNode_(
|
|
sre.SemanticAttr.Type.BIGOP,
|
|
[a, b],
|
|
c,
|
|
[],
|
|
);
|
|
};
|
|
sre.SemanticProcessor.prototype.integralNode_ = function (a, b, c) {
|
|
b = b || sre.SemanticProcessor.getInstance().factory_.makeEmptyNode();
|
|
c = c || sre.SemanticProcessor.getInstance().factory_.makeEmptyNode();
|
|
var d = sre.SemanticProcessor.getFunctionOp_(
|
|
a,
|
|
sre.SemanticPred.isAttribute("type", "LARGEOP"),
|
|
);
|
|
return sre.SemanticProcessor.getInstance().functionalNode_(
|
|
sre.SemanticAttr.Type.INTEGRAL,
|
|
[a, b, c],
|
|
d,
|
|
[],
|
|
);
|
|
};
|
|
sre.SemanticProcessor.prototype.functionalNode_ = function (a, b, c, d) {
|
|
var e = b[0];
|
|
if (c) {
|
|
var f = c.parent;
|
|
d.push(c);
|
|
}
|
|
a = sre.SemanticProcessor.getInstance().factory_.makeBranchNode(a, b, d);
|
|
a.role = e.role;
|
|
f && (c.parent = f);
|
|
return a;
|
|
};
|
|
sre.SemanticProcessor.getFunctionOp_ = function (a, b) {
|
|
if (b(a)) return a;
|
|
for (var c = 0, d; (d = a.childNodes[c]); c++)
|
|
if ((d = sre.SemanticProcessor.getFunctionOp_(d, b))) return d;
|
|
return null;
|
|
};
|
|
sre.SemanticProcessor.prototype.tablesInRow = function (a) {
|
|
a = sre.SemanticProcessor.partitionNodes_(
|
|
a,
|
|
sre.SemanticPred.tableIsMatrixOrVector,
|
|
);
|
|
for (var b = [], c = 0, d; (d = a.rel[c]); c++)
|
|
(b = b.concat(a.comp.shift())),
|
|
b.push(sre.SemanticProcessor.tableToMatrixOrVector_(d));
|
|
b = b.concat(a.comp.shift());
|
|
a = sre.SemanticProcessor.partitionNodes_(
|
|
b,
|
|
sre.SemanticPred.isTableOrMultiline,
|
|
);
|
|
b = [];
|
|
for (c = 0; (d = a.rel[c]); c++) {
|
|
var e = a.comp.shift();
|
|
sre.SemanticPred.tableIsCases(d, e) &&
|
|
sre.SemanticProcessor.tableToCases_(d, e.pop());
|
|
b = b.concat(e);
|
|
b.push(d);
|
|
}
|
|
return b.concat(a.comp.shift());
|
|
};
|
|
sre.SemanticProcessor.tableToMatrixOrVector_ = function (a) {
|
|
var b = a.childNodes[0];
|
|
sre.SemanticPred.isAttribute("type", "MULTILINE")(b)
|
|
? sre.SemanticProcessor.tableToVector_(a)
|
|
: sre.SemanticProcessor.tableToMatrix_(a);
|
|
a.contentNodes.forEach(goog.bind(b.appendContentNode, b));
|
|
a = 0;
|
|
for (var c; (c = b.childNodes[a]); a++)
|
|
sre.SemanticProcessor.assignRoleToRow_(
|
|
c,
|
|
sre.SemanticProcessor.getComponentRoles_(b),
|
|
);
|
|
b.parent = null;
|
|
return b;
|
|
};
|
|
sre.SemanticProcessor.tableToVector_ = function (a) {
|
|
var b = a.childNodes[0];
|
|
b.type = sre.SemanticAttr.Type.VECTOR;
|
|
1 === b.childNodes.length
|
|
? sre.SemanticProcessor.tableToSquare_(a)
|
|
: sre.SemanticProcessor.binomialForm_(b);
|
|
};
|
|
sre.SemanticProcessor.binomialForm_ = function (a) {
|
|
sre.SemanticPred.isBinomial(a) &&
|
|
((a.role = sre.SemanticAttr.Role.BINOMIAL),
|
|
(a.childNodes[0].role = sre.SemanticAttr.Role.BINOMIAL),
|
|
(a.childNodes[1].role = sre.SemanticAttr.Role.BINOMIAL));
|
|
};
|
|
sre.SemanticProcessor.tableToMatrix_ = function (a) {
|
|
var b = a.childNodes[0];
|
|
b.type = sre.SemanticAttr.Type.MATRIX;
|
|
b.childNodes &&
|
|
0 < b.childNodes.length &&
|
|
b.childNodes[0].childNodes &&
|
|
b.childNodes.length === b.childNodes[0].childNodes.length
|
|
? sre.SemanticProcessor.tableToSquare_(a)
|
|
: b.childNodes &&
|
|
1 === b.childNodes.length &&
|
|
(b.role = sre.SemanticAttr.Role.ROWVECTOR);
|
|
};
|
|
sre.SemanticProcessor.tableToSquare_ = function (a) {
|
|
var b = a.childNodes[0];
|
|
sre.SemanticPred.isAttribute("role", "NEUTRAL")(a)
|
|
? (b.role = sre.SemanticAttr.Role.DETERMINANT)
|
|
: (b.role = sre.SemanticAttr.Role.SQUAREMATRIX);
|
|
};
|
|
sre.SemanticProcessor.getComponentRoles_ = function (a) {
|
|
var b = a.role;
|
|
return b && b !== sre.SemanticAttr.Role.UNKNOWN
|
|
? b
|
|
: sre.SemanticAttr.Role[a.type.toUpperCase()] ||
|
|
sre.SemanticAttr.Role.UNKNOWN;
|
|
};
|
|
sre.SemanticProcessor.tableToCases_ = function (a, b) {
|
|
for (var c = 0, d; (d = a.childNodes[c]); c++)
|
|
sre.SemanticProcessor.assignRoleToRow_(d, sre.SemanticAttr.Role.CASES);
|
|
a.type = sre.SemanticAttr.Type.CASES;
|
|
a.appendContentNode(b);
|
|
sre.SemanticPred.tableIsMultiline(a) &&
|
|
sre.SemanticProcessor.binomialForm_(a);
|
|
return a;
|
|
};
|
|
sre.SemanticProcessor.tableToMultiline = function (a) {
|
|
if (sre.SemanticPred.tableIsMultiline(a)) {
|
|
a.type = sre.SemanticAttr.Type.MULTILINE;
|
|
for (var b = 0, c; (c = a.childNodes[b]); b++)
|
|
sre.SemanticProcessor.rowToLine_(c, sre.SemanticAttr.Role.MULTILINE);
|
|
1 === a.childNodes.length &&
|
|
sre.SemanticPred.isFencedElement(a.childNodes[0].childNodes[0]) &&
|
|
sre.SemanticProcessor.tableToMatrixOrVector_(
|
|
sre.SemanticProcessor.rewriteFencedLine_(a),
|
|
);
|
|
sre.SemanticProcessor.binomialForm_(a);
|
|
sre.SemanticProcessor.classifyMultiline(a);
|
|
} else sre.SemanticProcessor.classifyTable(a);
|
|
};
|
|
sre.SemanticProcessor.rewriteFencedLine_ = function (a) {
|
|
var b = a.childNodes[0],
|
|
c = a.childNodes[0].childNodes[0],
|
|
d = a.childNodes[0].childNodes[0].childNodes[0];
|
|
c.parent = a.parent;
|
|
a.parent = c;
|
|
d.parent = b;
|
|
c.childNodes = [a];
|
|
b.childNodes = [d];
|
|
return c;
|
|
};
|
|
sre.SemanticProcessor.rowToLine_ = function (a, b) {
|
|
b = b || sre.SemanticAttr.Role.UNKNOWN;
|
|
sre.SemanticPred.isAttribute("type", "ROW")(a) &&
|
|
((a.type = sre.SemanticAttr.Type.LINE),
|
|
(a.role = b),
|
|
1 === a.childNodes.length &&
|
|
sre.SemanticPred.isAttribute("type", "CELL")(a.childNodes[0]) &&
|
|
((a.childNodes = a.childNodes[0].childNodes),
|
|
a.childNodes.forEach(function (c) {
|
|
c.parent = a;
|
|
})));
|
|
};
|
|
sre.SemanticProcessor.assignRoleToRow_ = function (a, b) {
|
|
if (sre.SemanticPred.isAttribute("type", "LINE")(a)) a.role = b;
|
|
else if (sre.SemanticPred.isAttribute("type", "ROW")(a)) {
|
|
a.role = b;
|
|
var c = sre.SemanticPred.isAttribute("type", "CELL");
|
|
a.childNodes.forEach(function (d) {
|
|
c(d) && (d.role = b);
|
|
});
|
|
}
|
|
};
|
|
sre.SemanticProcessor.sliceNodes_ = function (a, b, c) {
|
|
c && a.reverse();
|
|
for (var d = [], e = 0, f; (f = a[e]); e++) {
|
|
if (b(f))
|
|
return c
|
|
? { head: a.slice(e + 1).reverse(), div: f, tail: d.reverse() }
|
|
: { head: d, div: f, tail: a.slice(e + 1) };
|
|
d.push(f);
|
|
}
|
|
return c
|
|
? { head: [], div: null, tail: d.reverse() }
|
|
: { head: d, div: null, tail: [] };
|
|
};
|
|
sre.SemanticProcessor.partitionNodes_ = function (a, b) {
|
|
var c = [],
|
|
d = [];
|
|
do {
|
|
var e = sre.SemanticProcessor.sliceNodes_(a, b);
|
|
d.push(e.head);
|
|
c.push(e.div);
|
|
a = e.tail;
|
|
} while (e.div);
|
|
c.pop();
|
|
return { rel: c, comp: d };
|
|
};
|
|
sre.SemanticProcessor.prototype.mfenced = function (a, b, c, d) {
|
|
if (c && 0 < d.length) {
|
|
var e = sre.SemanticProcessor.nextSeparatorFunction_(c),
|
|
f = [d.shift()];
|
|
d.forEach(
|
|
goog.bind(function (g) {
|
|
f.push(
|
|
sre.SemanticProcessor.getInstance().factory_.makeContentNode(e()),
|
|
);
|
|
f.push(g);
|
|
}, this),
|
|
);
|
|
d = f;
|
|
}
|
|
if (a && b)
|
|
return sre.SemanticProcessor.getInstance().horizontalFencedNode_(
|
|
sre.SemanticProcessor.getInstance().factory_.makeContentNode(a),
|
|
sre.SemanticProcessor.getInstance().factory_.makeContentNode(b),
|
|
d,
|
|
);
|
|
a &&
|
|
d.unshift(sre.SemanticProcessor.getInstance().factory_.makeContentNode(a));
|
|
b && d.push(sre.SemanticProcessor.getInstance().factory_.makeContentNode(b));
|
|
return sre.SemanticProcessor.getInstance().row(d);
|
|
};
|
|
sre.SemanticProcessor.nextSeparatorFunction_ = function (a) {
|
|
if (a) {
|
|
if (a.match(/^\s+$/)) return null;
|
|
var b = a
|
|
.replace(/\s/g, "")
|
|
.split("")
|
|
.filter(function (c) {
|
|
return c;
|
|
});
|
|
} else b = [","];
|
|
return function () {
|
|
return 1 < b.length ? b.shift() : b[0];
|
|
};
|
|
};
|
|
sre.SemanticProcessor.number = function (a) {
|
|
if (
|
|
a.type === sre.SemanticAttr.Type.UNKNOWN ||
|
|
a.type === sre.SemanticAttr.Type.IDENTIFIER
|
|
)
|
|
a.type = sre.SemanticAttr.Type.NUMBER;
|
|
sre.SemanticProcessor.numberRole_(a);
|
|
sre.SemanticProcessor.exprFont_(a);
|
|
};
|
|
sre.SemanticProcessor.numberRole_ = function (a) {
|
|
if (a.role === sre.SemanticAttr.Role.UNKNOWN) {
|
|
var b = sre.SemanticUtil.splitUnicode(a.textContent).map(
|
|
sre.SemanticAttr.lookupMeaning,
|
|
);
|
|
b.every(function (c) {
|
|
return (
|
|
(c.type === sre.SemanticAttr.Type.NUMBER &&
|
|
c.role === sre.SemanticAttr.Role.INTEGER) ||
|
|
(c.type === sre.SemanticAttr.Type.PUNCTUATION &&
|
|
c.role === sre.SemanticAttr.Role.COMMA)
|
|
);
|
|
})
|
|
? (a.role = sre.SemanticAttr.Role.INTEGER)
|
|
: b.every(function (c) {
|
|
return (
|
|
(c.type === sre.SemanticAttr.Type.NUMBER &&
|
|
c.role === sre.SemanticAttr.Role.INTEGER) ||
|
|
c.type === sre.SemanticAttr.Type.PUNCTUATION
|
|
);
|
|
})
|
|
? (a.role = sre.SemanticAttr.Role.FLOAT)
|
|
: (a.role = sre.SemanticAttr.Role.OTHERNUMBER);
|
|
}
|
|
};
|
|
sre.SemanticProcessor.exprFont_ = function (a) {
|
|
if (a.font === sre.SemanticAttr.Font.UNKNOWN) {
|
|
var b = sre.SemanticUtil.splitUnicode(a.textContent)
|
|
.map(sre.SemanticAttr.lookupMeaning)
|
|
.reduce(function (c, d) {
|
|
return c &&
|
|
d.font &&
|
|
d.font !== sre.SemanticAttr.Font.UNKNOWN &&
|
|
d.font !== c
|
|
? c === sre.SemanticAttr.Font.UNKNOWN
|
|
? d.font
|
|
: null
|
|
: c;
|
|
}, sre.SemanticAttr.Font.UNKNOWN);
|
|
b && (a.font = b);
|
|
}
|
|
};
|
|
sre.SemanticProcessor.prototype.fractionLikeNode = function (a, b, c, d) {
|
|
!d && sre.SemanticUtil.isZeroLength(c)
|
|
? ((d = sre.SemanticProcessor.getInstance().factory_.makeBranchNode(
|
|
sre.SemanticAttr.Type.LINE,
|
|
[a],
|
|
[],
|
|
)),
|
|
(b = sre.SemanticProcessor.getInstance().factory_.makeBranchNode(
|
|
sre.SemanticAttr.Type.LINE,
|
|
[b],
|
|
[],
|
|
)),
|
|
(b = sre.SemanticProcessor.getInstance().factory_.makeBranchNode(
|
|
sre.SemanticAttr.Type.MULTILINE,
|
|
[d, b],
|
|
[],
|
|
)),
|
|
sre.SemanticProcessor.binomialForm_(b),
|
|
sre.SemanticProcessor.classifyMultiline(b))
|
|
: ((b = sre.SemanticProcessor.getInstance().fractionNode_(a, b)),
|
|
d && b.addAnnotation("general", "bevelled"));
|
|
return b;
|
|
};
|
|
sre.SemanticProcessor.prototype.fractionNode_ = function (a, b) {
|
|
a = sre.SemanticProcessor.getInstance().factory_.makeBranchNode(
|
|
sre.SemanticAttr.Type.FRACTION,
|
|
[a, b],
|
|
[],
|
|
);
|
|
a.role = a.childNodes.every(function (c) {
|
|
return (
|
|
sre.SemanticPred.isAttribute("type", "NUMBER")(c) &&
|
|
sre.SemanticPred.isAttribute("role", "INTEGER")(c)
|
|
);
|
|
})
|
|
? sre.SemanticAttr.Role.VULGAR
|
|
: a.childNodes.every(sre.SemanticPred.isPureUnit)
|
|
? sre.SemanticAttr.Role.UNIT
|
|
: sre.SemanticAttr.Role.DIVISION;
|
|
this.propagateSimpleFunction(a);
|
|
return a;
|
|
};
|
|
sre.SemanticProcessor.prototype.tensor = function (a, b, c, d, e) {
|
|
b = sre.SemanticProcessor.getInstance().factory_.makeBranchNode(
|
|
sre.SemanticAttr.Type.TENSOR,
|
|
[
|
|
a,
|
|
sre.SemanticProcessor.getInstance().scriptNode_(
|
|
b,
|
|
sre.SemanticAttr.Role.LEFTSUB,
|
|
),
|
|
sre.SemanticProcessor.getInstance().scriptNode_(
|
|
c,
|
|
sre.SemanticAttr.Role.LEFTSUPER,
|
|
),
|
|
sre.SemanticProcessor.getInstance().scriptNode_(
|
|
d,
|
|
sre.SemanticAttr.Role.RIGHTSUB,
|
|
),
|
|
sre.SemanticProcessor.getInstance().scriptNode_(
|
|
e,
|
|
sre.SemanticAttr.Role.RIGHTSUPER,
|
|
),
|
|
],
|
|
[],
|
|
);
|
|
b.role = a.role;
|
|
b.embellished = sre.SemanticPred.isEmbellished(a);
|
|
return b;
|
|
};
|
|
sre.SemanticProcessor.prototype.pseudoTensor = function (a, b, c) {
|
|
var d = function (g) {
|
|
return !sre.SemanticPred.isAttribute("type", "EMPTY")(g);
|
|
},
|
|
e = b.filter(d).length;
|
|
d = c.filter(d).length;
|
|
if (!e && !d) return a;
|
|
var f = e ? (d ? "MSUBSUP" : "MSUB") : "MSUP";
|
|
a = [a];
|
|
e &&
|
|
a.push(
|
|
sre.SemanticProcessor.getInstance().scriptNode_(
|
|
b,
|
|
sre.SemanticAttr.Role.RIGHTSUB,
|
|
!0,
|
|
),
|
|
);
|
|
d &&
|
|
a.push(
|
|
sre.SemanticProcessor.getInstance().scriptNode_(
|
|
c,
|
|
sre.SemanticAttr.Role.RIGHTSUPER,
|
|
!0,
|
|
),
|
|
);
|
|
return sre.SemanticProcessor.getInstance().limitNode(f, a);
|
|
};
|
|
sre.SemanticProcessor.prototype.scriptNode_ = function (a, b, c) {
|
|
switch (a.length) {
|
|
case 0:
|
|
a = sre.SemanticProcessor.getInstance().factory_.makeEmptyNode();
|
|
break;
|
|
case 1:
|
|
a = a[0];
|
|
if (c) return a;
|
|
break;
|
|
default:
|
|
a = sre.SemanticProcessor.getInstance().dummyNode_(a);
|
|
}
|
|
a.role = b;
|
|
return a;
|
|
};
|
|
sre.SemanticProcessor.getEmbellishedInner_ = function (a) {
|
|
return a && a.embellished && 0 < a.childNodes.length
|
|
? sre.SemanticProcessor.getEmbellishedInner_(a.childNodes[0])
|
|
: a;
|
|
};
|
|
sre.SemanticProcessor.purgeFences_ = function (a) {
|
|
var b = a.rel;
|
|
a = a.comp;
|
|
for (var c = [], d = []; 0 < b.length; ) {
|
|
var e = b.shift(),
|
|
f = a.shift();
|
|
sre.SemanticPred.isElligibleEmbellishedFence(e)
|
|
? (c.push(e), d.push(f))
|
|
: (sre.SemanticProcessor.fenceToPunct_(e),
|
|
f.push(e),
|
|
(f = f.concat(a.shift())),
|
|
a.unshift(f));
|
|
}
|
|
d.push(a.shift());
|
|
return { rel: c, comp: d };
|
|
};
|
|
sre.SemanticProcessor.rewriteFencedNode_ = function (a) {
|
|
var b = a.contentNodes[1],
|
|
c = sre.SemanticProcessor.rewriteFence_(a, a.contentNodes[0]);
|
|
a.contentNodes[0] = c.fence;
|
|
c = sre.SemanticProcessor.rewriteFence_(c.node, b);
|
|
a.contentNodes[1] = c.fence;
|
|
a.contentNodes[0].parent = a;
|
|
a.contentNodes[1].parent = a;
|
|
c.node.parent = null;
|
|
return c.node;
|
|
};
|
|
sre.SemanticProcessor.rewriteFence_ = function (a, b) {
|
|
if (!b.embellished) return { node: a, fence: b };
|
|
var c = b.childNodes[0],
|
|
d = sre.SemanticProcessor.rewriteFence_(a, c);
|
|
if (
|
|
sre.SemanticPred.isAttribute("type", "SUPERSCRIPT")(b) ||
|
|
sre.SemanticPred.isAttribute("type", "SUBSCRIPT")(b) ||
|
|
sre.SemanticPred.isAttribute("type", "TENSOR")(b)
|
|
)
|
|
return (
|
|
sre.SemanticPred.isAttribute("role", "SUBSUP")(b) || (b.role = a.role),
|
|
c !== d.node && (b.replaceChild(c, d.node), (c.parent = a)),
|
|
sre.SemanticProcessor.propagateFencePointer_(b, c),
|
|
{ node: b, fence: d.fence }
|
|
);
|
|
b.replaceChild(c, d.fence);
|
|
b.mathmlTree &&
|
|
-1 === b.mathml.indexOf(b.mathmlTree) &&
|
|
b.mathml.push(b.mathmlTree);
|
|
return { node: d.node, fence: b };
|
|
};
|
|
sre.SemanticProcessor.propagateFencePointer_ = function (a, b) {
|
|
a.fencePointer = b.fencePointer || b.id.toString();
|
|
a.embellished = null;
|
|
};
|
|
sre.SemanticProcessor.classifyMultiline = function (a) {
|
|
for (
|
|
var b = 0, c = a.childNodes.length, d;
|
|
b < c && (!(d = a.childNodes[b]) || !d.childNodes.length);
|
|
)
|
|
b++;
|
|
if (!(b >= c)) {
|
|
var e = d.childNodes[0].role;
|
|
e !== sre.SemanticAttr.Role.UNKNOWN &&
|
|
a.childNodes.every(function (f) {
|
|
f = f.childNodes[0];
|
|
return (
|
|
!f ||
|
|
(f.role === e &&
|
|
(sre.SemanticPred.isAttribute("type", "RELATION")(f) ||
|
|
sre.SemanticPred.isAttribute("type", "RELSEQ")(f)))
|
|
);
|
|
}) &&
|
|
(a.role = e);
|
|
}
|
|
};
|
|
sre.SemanticProcessor.classifyTable = function (a) {
|
|
var b = sre.SemanticProcessor.computeColumns_(a);
|
|
sre.SemanticProcessor.classifyByColumns_(a, b, "EQUALITY") ||
|
|
sre.SemanticProcessor.classifyByColumns_(a, b, "INEQUALITY", [
|
|
"EQUALITY",
|
|
]) ||
|
|
sre.SemanticProcessor.classifyByColumns_(a, b, "ARROW");
|
|
};
|
|
sre.SemanticProcessor.classifyByColumns_ = function (a, b, c, d) {
|
|
d = function (g) {
|
|
return sre.SemanticProcessor.isPureRelation_(g, c);
|
|
};
|
|
var e = function (g) {
|
|
return (
|
|
sre.SemanticProcessor.isEndRelation_(g, c) ||
|
|
sre.SemanticProcessor.isPureRelation_(g, c)
|
|
);
|
|
},
|
|
f = function (g) {
|
|
return (
|
|
sre.SemanticProcessor.isEndRelation_(g, c, !0) ||
|
|
sre.SemanticProcessor.isPureRelation_(g, c)
|
|
);
|
|
};
|
|
return (3 === b.length && sre.SemanticProcessor.testColumns_(b, 1, d)) ||
|
|
(2 === b.length &&
|
|
(sre.SemanticProcessor.testColumns_(b, 1, e) ||
|
|
sre.SemanticProcessor.testColumns_(b, 0, f)))
|
|
? ((a.role = sre.SemanticAttr.Role[c]), !0)
|
|
: !1;
|
|
};
|
|
sre.SemanticProcessor.isEndRelation_ = function (a, b, c) {
|
|
c = c ? a.childNodes.length - 1 : 0;
|
|
return (
|
|
sre.SemanticPred.isAttribute("type", "RELSEQ")(a) &&
|
|
sre.SemanticPred.isAttribute("role", b)(a) &&
|
|
sre.SemanticPred.isAttribute("type", "EMPTY")(a.childNodes[c])
|
|
);
|
|
};
|
|
sre.SemanticProcessor.isPureRelation_ = function (a, b) {
|
|
return (
|
|
sre.SemanticPred.isAttribute("type", "RELATION")(a) &&
|
|
sre.SemanticPred.isAttribute("role", b)(a)
|
|
);
|
|
};
|
|
sre.SemanticProcessor.computeColumns_ = function (a) {
|
|
for (var b = [], c = 0, d; (d = a.childNodes[c]); c++)
|
|
for (var e = 0, f; (f = d.childNodes[e]); e++)
|
|
b[e] ? b[e].push(f) : (b[e] = [f]);
|
|
return b;
|
|
};
|
|
sre.SemanticProcessor.testColumns_ = function (a, b, c) {
|
|
return (a = a[b])
|
|
? a.some(function (d) {
|
|
return d.childNodes.length && c(d.childNodes[0]);
|
|
}) &&
|
|
a.every(function (d) {
|
|
return !d.childNodes.length || c(d.childNodes[0]);
|
|
})
|
|
: !1;
|
|
};
|
|
sre.SemanticProcessor.MATHJAX_FONTS = {
|
|
"-tex-caligraphic": sre.SemanticAttr.Font.CALIGRAPHIC,
|
|
"-tex-caligraphic-bold": sre.SemanticAttr.Font.CALIGRAPHICBOLD,
|
|
"-tex-calligraphic": sre.SemanticAttr.Font.CALIGRAPHIC,
|
|
"-tex-calligraphic-bold": sre.SemanticAttr.Font.CALIGRAPHICBOLD,
|
|
"-tex-oldstyle": sre.SemanticAttr.Font.OLDSTYLE,
|
|
"-tex-oldstyle-bold": sre.SemanticAttr.Font.OLDSTYLEBOLD,
|
|
"-tex-mathit": sre.SemanticAttr.Font.ITALIC,
|
|
};
|
|
sre.SemanticProcessor.prototype.font = function (a) {
|
|
var b = sre.SemanticProcessor.MATHJAX_FONTS[a];
|
|
return b ? b : a;
|
|
};
|
|
sre.SemanticProcessor.prototype.propagateSimpleFunction = function (a) {
|
|
"clearspeak" !== sre.Engine.getInstance().domain ||
|
|
(a.type !== sre.SemanticAttr.Type.INFIXOP &&
|
|
a.type !== sre.SemanticAttr.Type.FRACTION) ||
|
|
!a.childNodes.every(sre.SemanticPred.isSimpleFunction) ||
|
|
(a.role = sre.SemanticAttr.Role.COMPFUNC);
|
|
};
|
|
sre.SemanticProcessor.prototype.propagateComposedFunction = function (a) {
|
|
"clearspeak" === sre.Engine.getInstance().domain &&
|
|
a.type === sre.SemanticAttr.Type.FENCED &&
|
|
a.childNodes[0].role === sre.SemanticAttr.Role.COMPFUNC &&
|
|
(a.role = sre.SemanticAttr.Role.COMPFUNC);
|
|
};
|
|
sre.SemanticProcessor.proof = function (a, b, c) {
|
|
b = sre.SemanticProcessor.separateSemantics(b);
|
|
return sre.SemanticProcessor.getInstance().proof(a, b, c);
|
|
};
|
|
sre.SemanticProcessor.prototype.proof = function (a, b, c) {
|
|
b.inference || b.axiom || console.log("Noise");
|
|
if (b.axiom)
|
|
return (
|
|
(b = this.cleanInference(a.childNodes)),
|
|
(b = b.length
|
|
? this.factory_.makeBranchNode(
|
|
sre.SemanticAttr.Type.INFERENCE,
|
|
c(b),
|
|
[],
|
|
)
|
|
: this.factory_.makeEmptyNode()),
|
|
(b.role = sre.SemanticAttr.Role.AXIOM),
|
|
(b.mathmlTree = a),
|
|
b
|
|
);
|
|
a = this.inference(a, b, c);
|
|
b.proof &&
|
|
((a.role = sre.SemanticAttr.Role.PROOF),
|
|
(a.childNodes[0].role = sre.SemanticAttr.Role.FINAL));
|
|
return a;
|
|
};
|
|
sre.SemanticProcessor.prototype.inference = function (a, b, c) {
|
|
if (b.inferenceRule)
|
|
return (
|
|
(c = this.getFormulas(a, [], c)),
|
|
(c = this.factory_.makeBranchNode(
|
|
sre.SemanticAttr.Type.INFERENCE,
|
|
[c.conclusion, c.premises],
|
|
[],
|
|
))
|
|
);
|
|
var d = b.labelledRule,
|
|
e = sre.DomUtil.toArray(a.childNodes);
|
|
b = [];
|
|
("left" !== d && "both" !== d) ||
|
|
b.push(this.getLabel(a, e, c, sre.SemanticAttr.Role.LEFT));
|
|
("right" !== d && "both" !== d) ||
|
|
b.push(this.getLabel(a, e, c, sre.SemanticAttr.Role.RIGHT));
|
|
c = this.getFormulas(a, e, c);
|
|
c = this.factory_.makeBranchNode(
|
|
sre.SemanticAttr.Type.INFERENCE,
|
|
[c.conclusion, c.premises],
|
|
b,
|
|
);
|
|
c.mathmlTree = a;
|
|
return c;
|
|
};
|
|
sre.SemanticProcessor.prototype.getLabel = function (a, b, c, d) {
|
|
a = this.findNestedRow(b, "prooflabel", d);
|
|
c = this.factory_.makeBranchNode(
|
|
sre.SemanticAttr.Type.RULELABEL,
|
|
c(sre.DomUtil.toArray(a.childNodes)),
|
|
[],
|
|
);
|
|
c.role = d;
|
|
c.mathmlTree = a;
|
|
return c;
|
|
};
|
|
sre.SemanticProcessor.prototype.getFormulas = function (a, b, c) {
|
|
b = b.length ? this.findNestedRow(b, "inferenceRule") : a;
|
|
var d = "up" === sre.SemanticProcessor.getSemantics(b).inferenceRule;
|
|
a = d ? b.childNodes[0] : b.childNodes[1];
|
|
b = (d ? b.childNodes[1] : b.childNodes[0]).childNodes[0].childNodes[0];
|
|
var e = sre.DomUtil.toArray(b.childNodes[0].childNodes);
|
|
d = [];
|
|
var f = 1;
|
|
e = $jscomp.makeIterator(e);
|
|
for (var g = e.next(); !g.done; g = e.next())
|
|
(g = g.value), f % 2 && d.push(g.childNodes[0]), f++;
|
|
d = c(d);
|
|
c = c(sre.DomUtil.toArray(a.childNodes[0].childNodes))[0];
|
|
d = this.factory_.makeBranchNode(sre.SemanticAttr.Type.PREMISES, d, []);
|
|
d.mathmlTree = b;
|
|
c = this.factory_.makeBranchNode(sre.SemanticAttr.Type.CONCLUSION, [c], []);
|
|
c.mathmlTree = a.childNodes[0].childNodes[0];
|
|
return { conclusion: c, premises: d };
|
|
};
|
|
sre.SemanticProcessor.prototype.findNestedRow = function (a, b, c) {
|
|
return this.findNestedRow_(a, b, 0, c);
|
|
};
|
|
sre.SemanticProcessor.prototype.findNestedRow_ = function (a, b, c, d) {
|
|
if (3 < c) return null;
|
|
for (var e = 0, f; (f = a[e]); e++) {
|
|
var g = sre.DomUtil.tagName(f);
|
|
if ("MSPACE" !== g) {
|
|
if ("MROW" === g)
|
|
return this.findNestedRow_(
|
|
sre.DomUtil.toArray(f.childNodes),
|
|
b,
|
|
c + 1,
|
|
d,
|
|
);
|
|
if (sre.SemanticProcessor.findSemantics(f, b, d)) return f;
|
|
}
|
|
}
|
|
return null;
|
|
};
|
|
sre.SemanticProcessor.prototype.cleanInference = function (a) {
|
|
return sre.DomUtil.toArray(a).filter(function (b) {
|
|
return "MSPACE" !== sre.DomUtil.tagName(b);
|
|
});
|
|
};
|
|
sre.SemanticProcessor.findSemantics = function (a, b, c) {
|
|
c = null == c ? null : c;
|
|
return (a = sre.SemanticProcessor.getSemantics(a)) && a[b]
|
|
? null == c
|
|
? !0
|
|
: a[b] === c
|
|
: !1;
|
|
};
|
|
sre.SemanticProcessor.getSemantics = function (a) {
|
|
return (a = a.getAttribute("semantics"))
|
|
? sre.SemanticProcessor.separateSemantics(a)
|
|
: null;
|
|
};
|
|
sre.SemanticProcessor.removePrefix = function (a) {
|
|
a = $jscomp.makeIterator(a.split("_"));
|
|
a.next();
|
|
return $jscomp.arrayFromIterator(a).join("_");
|
|
};
|
|
sre.SemanticProcessor.separateSemantics = function (a) {
|
|
var b = {};
|
|
a.split(";").forEach(function (c) {
|
|
var d = $jscomp.makeIterator(c.split(":"));
|
|
c = d.next().value;
|
|
d = d.next().value;
|
|
b[sre.SemanticProcessor.removePrefix(c)] = d;
|
|
});
|
|
return b;
|
|
};
|
|
sre.SemanticMathml = function () {
|
|
sre.SemanticAbstractParser.call(this, "MathML");
|
|
this.parseMap_ = {
|
|
SEMANTICS: goog.bind(this.semantics_, this),
|
|
MATH: goog.bind(this.rows_, this),
|
|
MROW: goog.bind(this.rows_, this),
|
|
MPADDED: goog.bind(this.rows_, this),
|
|
MSTYLE: goog.bind(this.rows_, this),
|
|
MFRAC: goog.bind(this.fraction_, this),
|
|
MSUB: goog.bind(this.limits_, this),
|
|
MSUP: goog.bind(this.limits_, this),
|
|
MSUBSUP: goog.bind(this.limits_, this),
|
|
MOVER: goog.bind(this.limits_, this),
|
|
MUNDER: goog.bind(this.limits_, this),
|
|
MUNDEROVER: goog.bind(this.limits_, this),
|
|
MROOT: goog.bind(this.root_, this),
|
|
MSQRT: goog.bind(this.sqrt_, this),
|
|
MTABLE: goog.bind(this.table_, this),
|
|
MLABELEDTR: goog.bind(this.tableLabeledRow_, this),
|
|
MTR: goog.bind(this.tableRow_, this),
|
|
MTD: goog.bind(this.tableCell_, this),
|
|
MS: goog.bind(this.text_, this),
|
|
MTEXT: goog.bind(this.text_, this),
|
|
"ANNOTATION-XML": goog.bind(this.text_, this),
|
|
MI: goog.bind(this.identifier_, this),
|
|
MN: goog.bind(this.number_, this),
|
|
MO: goog.bind(this.operator_, this),
|
|
MFENCED: goog.bind(this.fenced_, this),
|
|
MENCLOSE: goog.bind(this.enclosed_, this),
|
|
MMULTISCRIPTS: goog.bind(this.multiscripts_, this),
|
|
ANNOTATION: goog.bind(this.empty_, this),
|
|
NONE: goog.bind(this.empty_, this),
|
|
MACTION: goog.bind(this.action_, this),
|
|
};
|
|
var a = {
|
|
type: sre.SemanticAttr.Type.IDENTIFIER,
|
|
role: sre.SemanticAttr.Role.NUMBERSET,
|
|
font: sre.SemanticAttr.Font.DOUBLESTRUCK,
|
|
};
|
|
"CHNPQRZ\u2102\u210d\u2115\u2119\u211a\u211d\u2124".split("").forEach(
|
|
function (b) {
|
|
this.getFactory().defaultMap.add(b, a);
|
|
}.bind(this),
|
|
);
|
|
};
|
|
goog.inherits(sre.SemanticMathml, sre.SemanticAbstractParser);
|
|
sre.SemanticMathml.prototype.parse = function (a) {
|
|
sre.SemanticProcessor.getInstance().setNodeFactory(this.getFactory());
|
|
var b = sre.DomUtil.toArray(a.childNodes),
|
|
c = sre.DomUtil.tagName(a),
|
|
d = this.parseMap_[c];
|
|
b = (d ? d : goog.bind(this.dummy_, this))(a, b);
|
|
sre.SemanticUtil.addAttributes(b, a);
|
|
if (-1 !== ["MATH", "MROW", "MPADDED", "MSTYLE", "SEMANTICS"].indexOf(c))
|
|
return b;
|
|
b.mathml.unshift(a);
|
|
b.mathmlTree = a;
|
|
return b;
|
|
};
|
|
sre.SemanticMathml.prototype.semantics_ = function (a, b) {
|
|
return b.length ? this.parse(b[0]) : this.getFactory().makeEmptyNode();
|
|
};
|
|
sre.SemanticMathml.prototype.rows_ = function (a, b) {
|
|
var c = a.getAttribute("semantics");
|
|
if (c && c.match("bspr_"))
|
|
return sre.SemanticProcessor.proof(a, c, goog.bind(this.parseList, this));
|
|
b = sre.SemanticUtil.purgeNodes(b);
|
|
b =
|
|
1 === b.length
|
|
? this.parse(b[0])
|
|
: sre.SemanticProcessor.getInstance().row(this.parseList(b));
|
|
b.mathml.unshift(a);
|
|
return b;
|
|
};
|
|
sre.SemanticMathml.prototype.fraction_ = function (a, b) {
|
|
return sre.SemanticProcessor.getInstance().fractionLikeNode(
|
|
this.parse(b[0]),
|
|
this.parse(b[1]),
|
|
a.getAttribute("linethickness"),
|
|
"true" === a.getAttribute("bevelled"),
|
|
);
|
|
};
|
|
sre.SemanticMathml.prototype.limits_ = function (a, b) {
|
|
return sre.SemanticProcessor.getInstance().limitNode(
|
|
sre.DomUtil.tagName(a),
|
|
this.parseList(b),
|
|
);
|
|
};
|
|
sre.SemanticMathml.prototype.root_ = function (a, b) {
|
|
return this.getFactory().makeBranchNode(
|
|
sre.SemanticAttr.Type.ROOT,
|
|
[this.parse(b[1]), this.parse(b[0])],
|
|
[],
|
|
);
|
|
};
|
|
sre.SemanticMathml.prototype.sqrt_ = function (a, b) {
|
|
a = this.parseList(sre.SemanticUtil.purgeNodes(b));
|
|
return this.getFactory().makeBranchNode(
|
|
sre.SemanticAttr.Type.SQRT,
|
|
[sre.SemanticProcessor.getInstance().row(a)],
|
|
[],
|
|
);
|
|
};
|
|
sre.SemanticMathml.prototype.table_ = function (a, b) {
|
|
var c = a.getAttribute("semantics");
|
|
if (c && c.match("bspr_"))
|
|
return sre.SemanticProcessor.proof(a, c, goog.bind(this.parseList, this));
|
|
a = this.getFactory().makeBranchNode(
|
|
sre.SemanticAttr.Type.TABLE,
|
|
this.parseList(b),
|
|
[],
|
|
);
|
|
sre.SemanticProcessor.tableToMultiline(a);
|
|
return a;
|
|
};
|
|
sre.SemanticMathml.prototype.tableRow_ = function (a, b) {
|
|
a = this.getFactory().makeBranchNode(
|
|
sre.SemanticAttr.Type.ROW,
|
|
this.parseList(b),
|
|
[],
|
|
);
|
|
a.role = sre.SemanticAttr.Role.TABLE;
|
|
return a;
|
|
};
|
|
sre.SemanticMathml.prototype.tableLabeledRow_ = function (a, b) {
|
|
if (!b.length) return this.tableRow_(a, b);
|
|
a = this.parse(b[0]);
|
|
a.role = sre.SemanticAttr.Role.LABEL;
|
|
b = this.getFactory().makeBranchNode(
|
|
sre.SemanticAttr.Type.ROW,
|
|
this.parseList(b.slice(1)),
|
|
[a],
|
|
);
|
|
b.role = sre.SemanticAttr.Role.TABLE;
|
|
return b;
|
|
};
|
|
sre.SemanticMathml.prototype.tableCell_ = function (a, b) {
|
|
a = this.parseList(sre.SemanticUtil.purgeNodes(b));
|
|
a = a.length
|
|
? 1 === a.length && sre.SemanticPred.isAttribute("type", "EMPTY")(a[0])
|
|
? a
|
|
: [sre.SemanticProcessor.getInstance().row(a)]
|
|
: [];
|
|
a = this.getFactory().makeBranchNode(sre.SemanticAttr.Type.CELL, a, []);
|
|
a.role = sre.SemanticAttr.Role.TABLE;
|
|
return a;
|
|
};
|
|
sre.SemanticMathml.prototype.text_ = function (a, b) {
|
|
b = this.leaf_(a, b);
|
|
if (!a.textContent) return b;
|
|
b.updateContent(a.textContent, !0);
|
|
return sre.SemanticProcessor.getInstance().text(b, sre.DomUtil.tagName(a));
|
|
};
|
|
sre.SemanticMathml.prototype.identifier_ = function (a, b) {
|
|
b = this.leaf_(a, b);
|
|
a = sre.SemanticProcessor.getInstance().identifierNode(
|
|
b,
|
|
sre.SemanticProcessor.getInstance().font(a.getAttribute("mathvariant")),
|
|
a.getAttribute("class"),
|
|
);
|
|
if ("clearspeak" !== sre.Engine.getInstance().domain) return a;
|
|
-1 !== "fghFGH".split("").indexOf(a.textContent) &&
|
|
(a.role = sre.SemanticAttr.Role.SIMPLEFUNC);
|
|
return a;
|
|
};
|
|
sre.SemanticMathml.prototype.number_ = function (a, b) {
|
|
a = this.leaf_(a, b);
|
|
sre.SemanticProcessor.number(a);
|
|
return a;
|
|
};
|
|
sre.SemanticMathml.prototype.operator_ = function (a, b) {
|
|
a = this.leaf_(a, b);
|
|
a.type === sre.SemanticAttr.Type.UNKNOWN &&
|
|
(a.type = sre.SemanticAttr.Type.OPERATOR);
|
|
return a;
|
|
};
|
|
sre.SemanticMathml.prototype.fenced_ = function (a, b) {
|
|
b = this.parseList(sre.SemanticUtil.purgeNodes(b));
|
|
var c = sre.SemanticMathml.getAttribute_(a, "separators", ","),
|
|
d = sre.SemanticMathml.getAttribute_(a, "open", "(");
|
|
a = sre.SemanticMathml.getAttribute_(a, "close", ")");
|
|
a = sre.SemanticProcessor.getInstance().mfenced(d, a, c, b);
|
|
return sre.SemanticProcessor.getInstance().tablesInRow([a])[0];
|
|
};
|
|
sre.SemanticMathml.prototype.enclosed_ = function (a, b) {
|
|
b = this.parseList(sre.SemanticUtil.purgeNodes(b));
|
|
b = this.getFactory().makeBranchNode(
|
|
sre.SemanticAttr.Type.ENCLOSE,
|
|
[sre.SemanticProcessor.getInstance().row(b)],
|
|
[],
|
|
);
|
|
b.role = a.getAttribute("notation") || sre.SemanticAttr.Role.UNKNOWN;
|
|
return b;
|
|
};
|
|
sre.SemanticMathml.prototype.multiscripts_ = function (a, b) {
|
|
if (!b.length) return this.getFactory().makeEmptyNode();
|
|
a = this.parse(b.shift());
|
|
if (!b.length) return a;
|
|
for (
|
|
var c = [], d = [], e = [], f = [], g = !1, h = 0, k = 0, l;
|
|
(l = b[k]);
|
|
k++
|
|
)
|
|
"MPRESCRIPTS" === sre.DomUtil.tagName(l)
|
|
? ((g = !0), (h = 0))
|
|
: (g ? (h & 1 ? c.push(l) : d.push(l)) : h & 1 ? e.push(l) : f.push(l),
|
|
h++);
|
|
return sre.SemanticUtil.purgeNodes(c).length ||
|
|
sre.SemanticUtil.purgeNodes(d).length
|
|
? sre.SemanticProcessor.getInstance().tensor(
|
|
a,
|
|
this.parseList(d),
|
|
this.parseList(c),
|
|
this.parseList(f),
|
|
this.parseList(e),
|
|
)
|
|
: sre.SemanticProcessor.getInstance().pseudoTensor(
|
|
a,
|
|
this.parseList(f),
|
|
this.parseList(e),
|
|
);
|
|
};
|
|
sre.SemanticMathml.prototype.empty_ = function (a, b) {
|
|
return this.getFactory().makeEmptyNode();
|
|
};
|
|
sre.SemanticMathml.prototype.action_ = function (a, b) {
|
|
return 1 < b.length ? this.parse(b[1]) : this.getFactory().makeUnprocessed(a);
|
|
};
|
|
sre.SemanticMathml.prototype.dummy_ = function (a, b) {
|
|
b = this.getFactory().makeUnprocessed(a);
|
|
b.role = a.tagName;
|
|
return b;
|
|
};
|
|
sre.SemanticMathml.prototype.leaf_ = function (a, b) {
|
|
return 1 === b.length && b[0].nodeType !== sre.DomUtil.NodeType.TEXT_NODE
|
|
? ((a = this.getFactory().makeUnprocessed(a)),
|
|
sre.SemanticUtil.addAttributes(a, b[0]),
|
|
a)
|
|
: this.getFactory().makeLeafNode(
|
|
a.textContent,
|
|
sre.SemanticProcessor.getInstance().font(a.getAttribute("mathvariant")),
|
|
);
|
|
};
|
|
sre.SemanticMathml.getAttribute_ = function (a, b, c) {
|
|
if (!a.hasAttribute(b)) return c;
|
|
a = a.getAttribute(b);
|
|
return a.match(/^\s*$/) ? null : a;
|
|
};
|
|
sre.SemanticTree = function (a) {
|
|
this.mathml = a;
|
|
this.parser = new sre.SemanticMathml();
|
|
this.root = this.parser.parse(a);
|
|
this.collator = this.parser.getFactory().leafMap.collateMeaning();
|
|
var b = this.collator.newDefault();
|
|
b &&
|
|
((this.parser = new sre.SemanticMathml()),
|
|
(this.parser.getFactory().defaultMap = b),
|
|
(this.root = this.parser.parse(a)));
|
|
sre.SemanticTree.implicitVisitor_.visit(this.root, {});
|
|
sre.SemanticTree.unitVisitor_.visit(this.root, {});
|
|
sre.SemanticAnnotations.getInstance().annotate(this.root);
|
|
};
|
|
sre.SemanticTree.implicitVisitor_ = new sre.SemanticVisitor(
|
|
"general",
|
|
function (a, b) {
|
|
a.type === sre.SemanticAttr.Type.INFIXOP &&
|
|
a.role === sre.SemanticAttr.Role.MULTIPLICATION &&
|
|
a.contentNodes.every(function (c) {
|
|
return (
|
|
!c.embellished && c.textContent === sre.SemanticAttr.invisibleTimes()
|
|
);
|
|
}) &&
|
|
(a.role = sre.SemanticAttr.Role.IMPLICIT);
|
|
return !1;
|
|
},
|
|
);
|
|
sre.SemanticTree.unitVisitor_ = new sre.SemanticVisitor(
|
|
"general",
|
|
function (a, b) {
|
|
a.type === sre.SemanticAttr.Type.INFIXOP &&
|
|
a.role === sre.SemanticAttr.Role.MULTIPLICATION &&
|
|
((b = a.childNodes),
|
|
b.length &&
|
|
(sre.SemanticPred.isPureUnit(b[0]) ||
|
|
sre.SemanticPred.isUnitCounter(b[0])) &&
|
|
a.childNodes.slice(1).every(sre.SemanticPred.isPureUnit) &&
|
|
(a.role = sre.SemanticAttr.Role.UNIT));
|
|
return !1;
|
|
},
|
|
);
|
|
sre.SemanticTree.empty = function () {
|
|
var a = sre.DomUtil.parseInput("<math/>"),
|
|
b = new sre.SemanticTree(a);
|
|
b.mathml = a;
|
|
return b;
|
|
};
|
|
sre.SemanticTree.fromNode = function (a, b) {
|
|
var c = sre.SemanticTree.empty();
|
|
c.root = a;
|
|
b && (c.mathml = b);
|
|
return c;
|
|
};
|
|
sre.SemanticTree.fromRoot = function (a, b) {
|
|
for (; a.parent; ) a = a.parent;
|
|
a = sre.SemanticTree.fromNode(a);
|
|
b && (a.mathml = b);
|
|
return a;
|
|
};
|
|
sre.SemanticTree.prototype.xml = function (a) {
|
|
var b = sre.DomUtil.parseInput("<stree></stree>");
|
|
a = this.root.xml(b.ownerDocument, a);
|
|
b.appendChild(a);
|
|
return b;
|
|
};
|
|
sre.SemanticTree.prototype.toString = function (a) {
|
|
return new sre.SystemExternal.xmldom.XMLSerializer().serializeToString(
|
|
this.xml(a),
|
|
);
|
|
};
|
|
sre.SemanticTree.prototype.formatXml = function (a) {
|
|
a = this.toString(a);
|
|
return sre.DomUtil.formatXml(a);
|
|
};
|
|
sre.SemanticTree.prototype.displayTree = function () {
|
|
this.root.displayTree();
|
|
};
|
|
sre.SemanticTree.prototype.replaceNode = function (a, b) {
|
|
var c = a.parent;
|
|
c ? c.replaceChild(a, b) : (this.root = b);
|
|
};
|
|
sre.SemanticTree.prototype.toJson = function () {
|
|
var a = {};
|
|
a.stree = this.root.toJson();
|
|
return a;
|
|
};
|
|
sre.Semantic = {};
|
|
sre.Semantic.Font = sre.SemanticAttr.Font;
|
|
sre.Semantic.Role = sre.SemanticAttr.Role;
|
|
sre.Semantic.Type = sre.SemanticAttr.Type;
|
|
sre.Semantic.xmlTree = function (a) {
|
|
return sre.Semantic.getTree(a).xml();
|
|
};
|
|
sre.Semantic.getTree = function (a) {
|
|
return new sre.SemanticTree(a);
|
|
};
|
|
sre.Semantic.getTreeFromString = function (a) {
|
|
a = sre.DomUtil.parseInput(a);
|
|
return sre.Semantic.getTree(a);
|
|
};
|
|
sre.MathspeakUtil = {};
|
|
sre.MathspeakUtil.spaceoutText = function (a) {
|
|
return a.textContent.split("").join(" ");
|
|
};
|
|
sre.MathspeakUtil.spaceoutNodes = function (a, b) {
|
|
var c = a.textContent.split(""),
|
|
d = [],
|
|
e = sre.SemanticProcessor.getInstance();
|
|
a = a.ownerDocument;
|
|
for (var f = 0, g; (g = c[f]); f++)
|
|
(g = e.getNodeFactory().makeLeafNode(g, sre.Semantic.Font.UNKNOWN)),
|
|
(g = e.identifierNode(g, sre.Semantic.Font.UNKNOWN, "")),
|
|
b(g),
|
|
d.push(g.xml(a));
|
|
return d;
|
|
};
|
|
sre.MathspeakUtil.spaceoutNumber = function (a) {
|
|
return sre.MathspeakUtil.spaceoutNodes(a, function (b) {
|
|
b.textContent.match(/\W/) || (b.type = sre.Semantic.Type.NUMBER);
|
|
});
|
|
};
|
|
sre.MathspeakUtil.spaceoutIdentifier = function (a) {
|
|
return sre.MathspeakUtil.spaceoutNodes(a, function (b) {
|
|
b.font = sre.Semantic.Font.UNKNOWN;
|
|
b.type = sre.Semantic.Type.IDENTIFIER;
|
|
});
|
|
};
|
|
sre.MathspeakUtil.nestingBarriers = [
|
|
sre.Semantic.Type.CASES,
|
|
sre.Semantic.Type.CELL,
|
|
sre.Semantic.Type.INTEGRAL,
|
|
sre.Semantic.Type.LINE,
|
|
sre.Semantic.Type.MATRIX,
|
|
sre.Semantic.Type.MULTILINE,
|
|
sre.Semantic.Type.OVERSCORE,
|
|
sre.Semantic.Type.ROOT,
|
|
sre.Semantic.Type.ROW,
|
|
sre.Semantic.Type.SQRT,
|
|
sre.Semantic.Type.SUBSCRIPT,
|
|
sre.Semantic.Type.SUPERSCRIPT,
|
|
sre.Semantic.Type.TABLE,
|
|
sre.Semantic.Type.UNDERSCORE,
|
|
sre.Semantic.Type.VECTOR,
|
|
];
|
|
sre.MathspeakUtil.nestingDepth = {};
|
|
sre.MathspeakUtil.resetNestingDepth = function (a) {
|
|
sre.MathspeakUtil.nestingDepth = {};
|
|
return [a];
|
|
};
|
|
sre.MathspeakUtil.getNestingDepth = function (a, b, c, d, e, f) {
|
|
d = d || sre.MathspeakUtil.nestingBarriers;
|
|
e = e || {};
|
|
f =
|
|
f ||
|
|
function (h) {
|
|
return !1;
|
|
};
|
|
var g = new sre.SystemExternal.xmldom.XMLSerializer().serializeToString(b);
|
|
sre.MathspeakUtil.nestingDepth[a] || (sre.MathspeakUtil.nestingDepth[a] = {});
|
|
if (sre.MathspeakUtil.nestingDepth[a][g])
|
|
return sre.MathspeakUtil.nestingDepth[a][g];
|
|
if (f(b) || 0 > c.indexOf(b.tagName)) return 0;
|
|
b = sre.MathspeakUtil.computeNestingDepth_(
|
|
b,
|
|
c,
|
|
sre.BaseUtil.setdifference(d, c),
|
|
e,
|
|
f,
|
|
0,
|
|
);
|
|
return (sre.MathspeakUtil.nestingDepth[a][g] = b);
|
|
};
|
|
sre.MathspeakUtil.containsAttr = function (a, b) {
|
|
if (!a.attributes) return !1;
|
|
a = sre.DomUtil.toArray(a.attributes);
|
|
for (var c = 0, d; (d = a[c]); c++)
|
|
if (b[d.nodeName] === d.nodeValue) return !0;
|
|
return !1;
|
|
};
|
|
sre.MathspeakUtil.computeNestingDepth_ = function (a, b, c, d, e, f) {
|
|
if (e(a) || -1 < c.indexOf(a.tagName) || sre.MathspeakUtil.containsAttr(a, d))
|
|
return f;
|
|
-1 < b.indexOf(a.tagName) && f++;
|
|
if (!a.childNodes || 0 === a.childNodes.length) return f;
|
|
a = sre.DomUtil.toArray(a.childNodes);
|
|
return Math.max.apply(
|
|
null,
|
|
a.map(function (g) {
|
|
return sre.MathspeakUtil.computeNestingDepth_(g, b, c, d, e, f);
|
|
}),
|
|
);
|
|
};
|
|
sre.MathspeakUtil.fractionNestingDepth = function (a) {
|
|
return sre.MathspeakUtil.getNestingDepth(
|
|
"fraction",
|
|
a,
|
|
["fraction"],
|
|
sre.MathspeakUtil.nestingBarriers,
|
|
{},
|
|
sre.Messages.MS_FUNC.FRAC_NEST_DEPTH,
|
|
);
|
|
};
|
|
sre.MathspeakUtil.nestedFraction = function (a, b, c) {
|
|
a = sre.MathspeakUtil.fractionNestingDepth(a);
|
|
a = Array.apply(null, Array(a)).map(function (d) {
|
|
return b;
|
|
});
|
|
c && a.push(c);
|
|
return a.join(sre.Messages.REGEXP.JOINER_FRAC);
|
|
};
|
|
sre.MathspeakUtil.openingFractionVerbose = function (a) {
|
|
return sre.MathspeakUtil.nestedFraction(
|
|
a,
|
|
sre.Messages.MS.START,
|
|
sre.Messages.MS.FRAC_V,
|
|
);
|
|
};
|
|
sre.MathspeakUtil.closingFractionVerbose = function (a) {
|
|
return sre.MathspeakUtil.nestedFraction(
|
|
a,
|
|
sre.Messages.MS.END,
|
|
sre.Messages.MS.FRAC_V,
|
|
);
|
|
};
|
|
sre.MathspeakUtil.overFractionVerbose = function (a) {
|
|
return sre.MathspeakUtil.nestedFraction(a, sre.Messages.MS.FRAC_OVER);
|
|
};
|
|
sre.MathspeakUtil.openingFractionBrief = function (a) {
|
|
return sre.MathspeakUtil.nestedFraction(
|
|
a,
|
|
sre.Messages.MS.START,
|
|
sre.Messages.MS.FRAC_B,
|
|
);
|
|
};
|
|
sre.MathspeakUtil.closingFractionBrief = function (a) {
|
|
return sre.MathspeakUtil.nestedFraction(
|
|
a,
|
|
sre.Messages.MS.END,
|
|
sre.Messages.MS.FRAC_B,
|
|
);
|
|
};
|
|
sre.MathspeakUtil.openingFractionSbrief = function (a) {
|
|
a = sre.MathspeakUtil.fractionNestingDepth(a);
|
|
return 1 === a
|
|
? sre.Messages.MS.FRAC_S
|
|
: sre.Messages.MS_FUNC.COMBINE_NESTED_FRACTION(
|
|
sre.Messages.MS.NEST_FRAC,
|
|
sre.Messages.MS_FUNC.RADICAL_NEST_DEPTH(a - 1),
|
|
sre.Messages.MS.FRAC_S,
|
|
);
|
|
};
|
|
sre.MathspeakUtil.closingFractionSbrief = function (a) {
|
|
a = sre.MathspeakUtil.fractionNestingDepth(a);
|
|
return 1 === a
|
|
? sre.Messages.MS.ENDFRAC
|
|
: sre.Messages.MS_FUNC.COMBINE_NESTED_FRACTION(
|
|
sre.Messages.MS.NEST_FRAC,
|
|
sre.Messages.MS_FUNC.RADICAL_NEST_DEPTH(a - 1),
|
|
sre.Messages.MS.ENDFRAC,
|
|
);
|
|
};
|
|
sre.MathspeakUtil.overFractionSbrief = function (a) {
|
|
a = sre.MathspeakUtil.fractionNestingDepth(a);
|
|
return 1 === a
|
|
? sre.Messages.MS.FRAC_OVER
|
|
: sre.Messages.MS_FUNC.COMBINE_NESTED_FRACTION(
|
|
sre.Messages.MS.NEST_FRAC,
|
|
sre.Messages.MS_FUNC.RADICAL_NEST_DEPTH(a - 1),
|
|
sre.Messages.MS.FRAC_OVER,
|
|
);
|
|
};
|
|
sre.MathspeakUtil.isSmallVulgarFraction = function (a) {
|
|
return sre.NumbersUtil.vulgarFractionSmall(a, 10, 100) ? [a] : [];
|
|
};
|
|
sre.MathspeakUtil.nestedSubSuper = function (a, b, c) {
|
|
for (; a.parentNode; ) {
|
|
var d = a.parentNode,
|
|
e = d.parentNode,
|
|
f = a.getAttribute && a.getAttribute("role");
|
|
if (
|
|
(e.tagName === sre.Semantic.Type.SUBSCRIPT && a === d.childNodes[1]) ||
|
|
(e.tagName === sre.Semantic.Type.TENSOR &&
|
|
f &&
|
|
(f === sre.Semantic.Role.LEFTSUB || f === sre.Semantic.Role.RIGHTSUB))
|
|
)
|
|
b = c.sub + sre.Messages.REGEXP.JOINER_SUBSUPER + b;
|
|
if (
|
|
(e.tagName === sre.Semantic.Type.SUPERSCRIPT && a === d.childNodes[1]) ||
|
|
(e.tagName === sre.Semantic.Type.TENSOR &&
|
|
f &&
|
|
(f === sre.Semantic.Role.LEFTSUPER ||
|
|
f === sre.Semantic.Role.RIGHTSUPER))
|
|
)
|
|
b = c.sup + sre.Messages.REGEXP.JOINER_SUBSUPER + b;
|
|
a = e;
|
|
}
|
|
return b.trim();
|
|
};
|
|
sre.MathspeakUtil.subscriptVerbose = function (a) {
|
|
return sre.MathspeakUtil.nestedSubSuper(a, sre.Messages.MS.SUBSCRIPT, {
|
|
sup: sre.Messages.MS.SUPER,
|
|
sub: sre.Messages.MS.SUB,
|
|
});
|
|
};
|
|
sre.MathspeakUtil.subscriptBrief = function (a) {
|
|
return sre.MathspeakUtil.nestedSubSuper(a, sre.Messages.MS.SUB, {
|
|
sup: sre.Messages.MS.SUP,
|
|
sub: sre.Messages.MS.SUB,
|
|
});
|
|
};
|
|
sre.MathspeakUtil.superscriptVerbose = function (a) {
|
|
return sre.MathspeakUtil.nestedSubSuper(a, sre.Messages.MS.SUPERSCRIPT, {
|
|
sup: sre.Messages.MS.SUPER,
|
|
sub: sre.Messages.MS.SUB,
|
|
});
|
|
};
|
|
sre.MathspeakUtil.superscriptBrief = function (a) {
|
|
return sre.MathspeakUtil.nestedSubSuper(a, sre.Messages.MS.SUP, {
|
|
sup: sre.Messages.MS.SUP,
|
|
sub: sre.Messages.MS.SUB,
|
|
});
|
|
};
|
|
sre.MathspeakUtil.baselineVerbose = function (a) {
|
|
return (a = sre.MathspeakUtil.nestedSubSuper(a, "", {
|
|
sup: sre.Messages.MS.SUPER,
|
|
sub: sre.Messages.MS.SUB,
|
|
}))
|
|
? a
|
|
.replace(
|
|
new RegExp(sre.Messages.MS.SUB + "$"),
|
|
sre.Messages.MS.SUBSCRIPT,
|
|
)
|
|
.replace(
|
|
new RegExp(sre.Messages.MS.SUPER + "$"),
|
|
sre.Messages.MS.SUPERSCRIPT,
|
|
)
|
|
: sre.Messages.MS.BASELINE;
|
|
};
|
|
sre.MathspeakUtil.baselineBrief = function (a) {
|
|
return (
|
|
sre.MathspeakUtil.nestedSubSuper(a, "", {
|
|
sup: sre.Messages.MS.SUP,
|
|
sub: sre.Messages.MS.SUB,
|
|
}) || sre.Messages.MS.BASE
|
|
);
|
|
};
|
|
sre.MathspeakUtil.radicalNestingDepth = function (a) {
|
|
return sre.MathspeakUtil.getNestingDepth(
|
|
"radical",
|
|
a,
|
|
["sqrt", "root"],
|
|
sre.MathspeakUtil.nestingBarriers,
|
|
{},
|
|
);
|
|
};
|
|
sre.MathspeakUtil.nestedRadical = function (a, b, c) {
|
|
var d = sre.MathspeakUtil.radicalNestingDepth(a);
|
|
c = (a = sre.MathspeakUtil.getRootIndex(a))
|
|
? sre.Messages.MS_FUNC.COMBINE_ROOT_INDEX(c, a)
|
|
: c;
|
|
return 1 === d
|
|
? c
|
|
: sre.Messages.MS_FUNC.COMBINE_NESTED_RADICAL(
|
|
b,
|
|
sre.Messages.MS_FUNC.RADICAL_NEST_DEPTH(d - 1),
|
|
c,
|
|
);
|
|
};
|
|
sre.MathspeakUtil.getRootIndex = function (a) {
|
|
a =
|
|
"sqrt" === a.tagName
|
|
? "2"
|
|
: sre.XpathUtil.evalXPath("children/*[1]", a)[0].textContent.trim();
|
|
return sre.Messages.MS_ROOT_INDEX[a] || "";
|
|
};
|
|
sre.MathspeakUtil.openingRadicalVerbose = function (a) {
|
|
return sre.MathspeakUtil.nestedRadical(
|
|
a,
|
|
sre.Messages.MS.NESTED,
|
|
sre.Messages.MS.STARTROOT,
|
|
);
|
|
};
|
|
sre.MathspeakUtil.closingRadicalVerbose = function (a) {
|
|
return sre.MathspeakUtil.nestedRadical(
|
|
a,
|
|
sre.Messages.MS.NESTED,
|
|
sre.Messages.MS.ENDROOT,
|
|
);
|
|
};
|
|
sre.MathspeakUtil.indexRadicalVerbose = function (a) {
|
|
return sre.MathspeakUtil.nestedRadical(
|
|
a,
|
|
sre.Messages.MS.NESTED,
|
|
sre.Messages.MS.ROOTINDEX,
|
|
);
|
|
};
|
|
sre.MathspeakUtil.openingRadicalBrief = function (a) {
|
|
return sre.MathspeakUtil.nestedRadical(
|
|
a,
|
|
sre.Messages.MS.NEST_ROOT,
|
|
sre.Messages.MS.STARTROOT,
|
|
);
|
|
};
|
|
sre.MathspeakUtil.closingRadicalBrief = function (a) {
|
|
return sre.MathspeakUtil.nestedRadical(
|
|
a,
|
|
sre.Messages.MS.NEST_ROOT,
|
|
sre.Messages.MS.ENDROOT,
|
|
);
|
|
};
|
|
sre.MathspeakUtil.indexRadicalBrief = function (a) {
|
|
return sre.MathspeakUtil.nestedRadical(
|
|
a,
|
|
sre.Messages.MS.NEST_ROOT,
|
|
sre.Messages.MS.ROOTINDEX,
|
|
);
|
|
};
|
|
sre.MathspeakUtil.openingRadicalSbrief = function (a) {
|
|
return sre.MathspeakUtil.nestedRadical(
|
|
a,
|
|
sre.Messages.MS.NEST_ROOT,
|
|
sre.Messages.MS.ROOT,
|
|
);
|
|
};
|
|
sre.MathspeakUtil.indexRadicalSbrief = function (a) {
|
|
return sre.MathspeakUtil.nestedRadical(
|
|
a,
|
|
sre.Messages.MS.NEST_ROOT,
|
|
sre.Messages.MS.INDEX,
|
|
);
|
|
};
|
|
sre.MathspeakUtil.underscoreNestingDepth = function (a) {
|
|
return sre.MathspeakUtil.getNestingDepth(
|
|
"underscore",
|
|
a,
|
|
["underscore"],
|
|
sre.MathspeakUtil.nestingBarriers,
|
|
{},
|
|
function (b) {
|
|
return (
|
|
b.tagName &&
|
|
b.tagName === sre.Semantic.Type.UNDERSCORE &&
|
|
b.childNodes[0].childNodes[1].getAttribute("role") ===
|
|
sre.Semantic.Role.UNDERACCENT
|
|
);
|
|
},
|
|
);
|
|
};
|
|
sre.MathspeakUtil.nestedUnderscore = function (a) {
|
|
a = sre.MathspeakUtil.underscoreNestingDepth(a);
|
|
return Array(a).join(sre.Messages.MS.UNDER) + sre.Messages.MS.UNDERSCRIPT;
|
|
};
|
|
sre.MathspeakUtil.overscoreNestingDepth = function (a) {
|
|
return sre.MathspeakUtil.getNestingDepth(
|
|
"overscore",
|
|
a,
|
|
["overscore"],
|
|
sre.MathspeakUtil.nestingBarriers,
|
|
{},
|
|
function (b) {
|
|
return (
|
|
b.tagName &&
|
|
b.tagName === sre.Semantic.Type.OVERSCORE &&
|
|
b.childNodes[0].childNodes[1].getAttribute("role") ===
|
|
sre.Semantic.Role.OVERACCENT
|
|
);
|
|
},
|
|
);
|
|
};
|
|
sre.MathspeakUtil.nestedOverscore = function (a) {
|
|
a = sre.MathspeakUtil.overscoreNestingDepth(a);
|
|
return Array(a).join(sre.Messages.MS.OVER) + sre.Messages.MS.OVERSCRIPT;
|
|
};
|
|
sre.MathspeakUtil.determinantIsSimple = function (a) {
|
|
if (
|
|
a.tagName !== sre.Semantic.Type.MATRIX ||
|
|
a.getAttribute("role") !== sre.Semantic.Role.DETERMINANT
|
|
)
|
|
return [];
|
|
for (
|
|
var b = sre.XpathUtil.evalXPath("children/row/children/cell/children/*", a),
|
|
c = 0,
|
|
d;
|
|
(d = b[c]);
|
|
c++
|
|
)
|
|
if (d.tagName !== sre.Semantic.Type.NUMBER) {
|
|
if (
|
|
d.tagName === sre.Semantic.Type.IDENTIFIER &&
|
|
((d = d.getAttribute("role")),
|
|
d === sre.Semantic.Role.LATINLETTER ||
|
|
d === sre.Semantic.Role.GREEKLETTER ||
|
|
d === sre.Semantic.Role.OTHERLETTER)
|
|
)
|
|
continue;
|
|
return [];
|
|
}
|
|
return [a];
|
|
};
|
|
sre.MathspeakUtil.generateBaselineConstraint = function () {
|
|
var a = function (g) {
|
|
return g.map(function (h) {
|
|
return "ancestor::" + h;
|
|
});
|
|
},
|
|
b = "not(" + a(["subscript", "superscript", "tensor"]).join(" or ") + ")",
|
|
c = a(["relseq", "multrel"]);
|
|
a = a(["fraction", "punctuation", "fenced", "sqrt", "root"]);
|
|
for (var d = [], e = 0, f; (f = a[e]); e++)
|
|
d = d.concat(
|
|
c.map(function (g) {
|
|
return f + "/" + g;
|
|
}),
|
|
);
|
|
c = "not(" + d.join(" | ") + ")";
|
|
return ["ancestor::*/following-sibling::*", b, c].join(" and ");
|
|
};
|
|
sre.MathspeakUtil.removeParens = function (a) {
|
|
if (
|
|
!a.childNodes.length ||
|
|
!a.childNodes[0].childNodes.length ||
|
|
!a.childNodes[0].childNodes[0].childNodes.length
|
|
)
|
|
return "";
|
|
a = a.childNodes[0].childNodes[0].childNodes[0].textContent;
|
|
return a.match(/^\(.+\)$/) ? a.slice(1, -1) : a;
|
|
};
|
|
sre.MathspeakUtil.componentString_ = {
|
|
3: "CSFleftsuperscript",
|
|
4: "CSFleftsubscript",
|
|
2: "CSFbaseline",
|
|
1: "CSFrightsubscript",
|
|
0: "CSFrightsuperscript",
|
|
};
|
|
sre.MathspeakUtil.childNumber_ = { 4: 2, 3: 3, 2: 1, 1: 4, 0: 5 };
|
|
sre.MathspeakUtil.generateTensorRuleStrings_ = function (a) {
|
|
var b = [],
|
|
c = "",
|
|
d = "";
|
|
a = parseInt(a, 2);
|
|
for (var e = 0; 5 > e; e++) {
|
|
var f = "children/*[" + sre.MathspeakUtil.childNumber_[e] + "]";
|
|
if (a & 1) {
|
|
var g = sre.MathspeakUtil.componentString_[e % 5];
|
|
c = "[t] " + g + "Verbose; [n] " + f + ";" + c;
|
|
d = "[t] " + g + "Brief; [n] " + f + ";" + d;
|
|
} else b.unshift("name(" + f + ')="empty"');
|
|
a >>= 1;
|
|
}
|
|
b.push(c);
|
|
b.push(d);
|
|
return b;
|
|
};
|
|
sre.MathspeakUtil.generateTensorRules = function (a) {
|
|
var b = goog.bind(a.defineRule, a),
|
|
c = goog.bind(a.defineRulesAlias, a);
|
|
a = goog.bind(a.defineSpecialisedRule, a);
|
|
for (
|
|
var d =
|
|
"11111 11110 11101 11100 10111 10110 10101 10100 01111 01110 01101 01100".split(
|
|
" ",
|
|
),
|
|
e = 0,
|
|
f;
|
|
(f = d[e]);
|
|
e++
|
|
) {
|
|
var g = "tensor" + f;
|
|
f = sre.MathspeakUtil.generateTensorRuleStrings_(f);
|
|
var h = f.pop(),
|
|
k = f.pop(),
|
|
l = [g, "default", k, "self::tensor"].concat(f),
|
|
m = [g, "brief", h, "self::tensor"].concat(f);
|
|
b.apply(null, l);
|
|
b.apply(null, m);
|
|
a(g, "brief", "sbrief");
|
|
l = sre.MathspeakUtil.componentString_[2];
|
|
k += "; [t]" + l + "Verbose";
|
|
h += "; [t]" + l + "Brief";
|
|
g += "-baseline";
|
|
l = [g, "default", k, "self::tensor", "following-sibling::*"].concat(f);
|
|
m = [g, "brief", h, "self::tensor", "following-sibling::*"].concat(f);
|
|
b.apply(null, l);
|
|
b.apply(null, m);
|
|
a(g, "brief", "sbrief");
|
|
g = [
|
|
g,
|
|
"self::tensor",
|
|
"not(following-sibling::*)",
|
|
"ancestor::fraction|ancestor::punctuated|ancestor::fenced|ancestor::root|ancestor::sqrt|ancestor::relseq|ancestor::multirel|@embellished",
|
|
].concat(f);
|
|
c.apply(null, g);
|
|
}
|
|
};
|
|
sre.Locale = {};
|
|
sre.Locale.nestingToString = function (a) {
|
|
switch (a) {
|
|
case 1:
|
|
return sre.Messages.MS.ONCE || "";
|
|
case 2:
|
|
return sre.Messages.MS.TWICE;
|
|
default:
|
|
return a.toString();
|
|
}
|
|
};
|
|
sre.Locale.vulgarNestingDepth = function (a) {
|
|
return !!sre.MathspeakUtil.isSmallVulgarFraction(a).length;
|
|
};
|
|
sre.Locale.combinePostfixIndex = function (a, b) {
|
|
return a === sre.Messages.MS.ROOTINDEX || a === sre.Messages.MS.INDEX
|
|
? a
|
|
: a + " " + b;
|
|
};
|
|
sre.Locale.localFont = function (a) {
|
|
var b = sre.Messages.FONT[a];
|
|
void 0 === b && (b = a || "");
|
|
return "string" === typeof b ? b : b[0];
|
|
};
|
|
sre.Grammar.getInstance().setCorrection("localFont", sre.Locale.localFont);
|
|
sre.Locale.localRole = function (a) {
|
|
return sre.Messages.ROLE[a] || a;
|
|
};
|
|
sre.Grammar.getInstance().setCorrection("localRole", sre.Locale.localRole);
|
|
sre.Locale.localEnclose = function (a) {
|
|
return sre.Messages.ENCLOSE[a] || a;
|
|
};
|
|
sre.Grammar.getInstance().setCorrection(
|
|
"localEnclose",
|
|
sre.Locale.localEnclose,
|
|
);
|
|
sre.Locale.makePlural = function (a) {
|
|
var b = sre.Messages.PLURAL_UNIT[a];
|
|
return b ? b : sre.Messages.PLURAL(a);
|
|
};
|
|
sre.Grammar.getInstance().setCorrection("plural", sre.Locale.makePlural);
|
|
sre.Locale.prefixCombiner = function (a, b, c) {
|
|
a = c ? c + " " + a : a;
|
|
return b ? b + " " + a : a;
|
|
};
|
|
sre.Locale.postfixCombiner = function (a, b, c) {
|
|
a = c ? c + " " + a : a;
|
|
return b ? a + " " + b : a;
|
|
};
|
|
sre.Numbers.de = {};
|
|
sre.Numbers.de.onesNumbers_ =
|
|
" eins zwei drei vier f\u00fcnf sechs sieben acht neun zehn elf zw\u00f6lf dreizehn vierzehn f\u00fcnfzehn sechzehn siebzehn achtzehn neunzehn".split(
|
|
" ",
|
|
);
|
|
sre.Numbers.de.tensNumbers_ =
|
|
" zwanzig drei\u00dfig vierzig f\u00fcnfzig sechzig siebzig achtzig neunzig".split(
|
|
" ",
|
|
);
|
|
sre.Numbers.de.largeNumbers_ =
|
|
" tausend million milliarde billion billiarde trillion trilliard quadrillion quadrilliard quintillion quintilliarde sextillion sextilliarde".split(
|
|
" ",
|
|
);
|
|
sre.Numbers.de.onePrefix_ = function (a) {
|
|
return a === sre.Numbers.de.onesNumbers_[1] ? "ein" : a;
|
|
};
|
|
sre.Numbers.de.hundredsToWords_ = function (a) {
|
|
a %= 1e3;
|
|
var b = sre.Numbers.de.onesNumbers_[Math.floor(a / 100)];
|
|
var c = b ? sre.Numbers.de.onePrefix_(b) + "hundert" : "";
|
|
if ((a %= 100))
|
|
if (
|
|
((c += c ? sre.Numbers.de.NUMBERS.numSep : ""),
|
|
(b = sre.Numbers.de.onesNumbers_[a]))
|
|
)
|
|
c += b;
|
|
else {
|
|
var d = sre.Numbers.de.tensNumbers_[Math.floor(a / 10)];
|
|
b = sre.Numbers.de.onesNumbers_[a % 10];
|
|
c += b ? sre.Numbers.de.onePrefix_(b) + "und" + d : d;
|
|
}
|
|
return c;
|
|
};
|
|
sre.Numbers.de.numberToWords = function (a) {
|
|
if (a >= Math.pow(10, 36)) return a.toString();
|
|
for (var b = 0, c = ""; 0 < a; ) {
|
|
if (a % 1e3) {
|
|
var d = sre.Numbers.de.hundredsToWords_(a % 1e3);
|
|
c =
|
|
sre.Numbers.de.onePrefix_(d) +
|
|
(b ? sre.Numbers.de.largeNumbers_[b] : "") +
|
|
c;
|
|
}
|
|
a = Math.floor(a / 1e3);
|
|
b++;
|
|
}
|
|
return c.replace(/ein$/, "eins");
|
|
};
|
|
sre.Numbers.de.numberToOrdinal = function (a, b) {
|
|
return 1 === a
|
|
? "eintel"
|
|
: 2 === a
|
|
? b
|
|
? "halbe"
|
|
: "halb"
|
|
: sre.Numbers.de.wordOrdinal(a) + "l";
|
|
};
|
|
sre.Numbers.de.wordOrdinal = function (a) {
|
|
return 1 === a
|
|
? "erste"
|
|
: 3 === a
|
|
? "dritte"
|
|
: 7 === a
|
|
? "siebte"
|
|
: 8 === a
|
|
? "achte"
|
|
: sre.Numbers.de.numberToWords(a) + (19 > a ? "te" : "ste");
|
|
};
|
|
sre.Numbers.de.simpleOrdinal = function (a) {
|
|
return a.toString() + ".";
|
|
};
|
|
sre.Numbers.de.NUMBERS = {
|
|
wordOrdinal: sre.Numbers.de.wordOrdinal,
|
|
simpleOrdinal: sre.Numbers.de.simpleOrdinal,
|
|
numberToWords: sre.Numbers.de.numberToWords,
|
|
numberToOrdinal: sre.Numbers.de.numberToOrdinal,
|
|
vulgarSep: " ",
|
|
numSep: "",
|
|
};
|
|
var germanPrefixCombiner = function (a, b, c) {
|
|
"s" === c &&
|
|
((b = b
|
|
.split(" ")
|
|
.map(function (d) {
|
|
return d.replace(/s$/, "");
|
|
})
|
|
.join(" ")),
|
|
(c = ""));
|
|
a = c ? c + " " + a : a;
|
|
return b ? b + " " + a : a;
|
|
},
|
|
germanPostfixCombiner = function (a, b, c) {
|
|
a = c && "s" !== c ? c + " " + a : a;
|
|
return b ? a + " " + b : a;
|
|
};
|
|
sre.Locale.de = {
|
|
MS: {
|
|
START: "Anfang",
|
|
FRAC_V: "Bruch",
|
|
FRAC_B: "Bruch",
|
|
FRAC_S: "Bruch",
|
|
END: "Ende",
|
|
FRAC_OVER: "durch",
|
|
TWICE: "Twice",
|
|
NEST_FRAC: "geschachtelt",
|
|
ENDFRAC: "Ende Bruch",
|
|
SUPER: "hoch",
|
|
SUB: "Index",
|
|
SUP: "hoch",
|
|
SUPERSCRIPT: "hoch",
|
|
SUBSCRIPT: "Index",
|
|
BASELINE: "Grundlinie",
|
|
BASE: "Grund",
|
|
NESTED: "geschachtelte",
|
|
NEST_ROOT: "geschachtelte",
|
|
STARTROOT: "Anfang Wurzel",
|
|
ENDROOT: "Ende Wurzel",
|
|
ROOTINDEX: "Wurzelexponent",
|
|
ROOT: "Wurzel",
|
|
INDEX: "Exponent",
|
|
UNDER: "Unter",
|
|
UNDERSCRIPT: "Unterschrift",
|
|
OVER: "\u00dcber",
|
|
OVERSCRIPT: "\u00dcberschrift",
|
|
},
|
|
MS_FUNC: {
|
|
FRAC_NEST_DEPTH: sre.Locale.vulgarNestingDepth,
|
|
RADICAL_NEST_DEPTH: function (a) {
|
|
return 1 < a ? sre.Numbers.de.NUMBERS.numberToWords(a) + "fach" : "";
|
|
},
|
|
COMBINE_ROOT_INDEX: function (a, b) {
|
|
return a.replace("Wurzel", b ? b + "wurzel" : "");
|
|
},
|
|
COMBINE_NESTED_FRACTION: function (a, b, c) {
|
|
return a + b + c;
|
|
},
|
|
COMBINE_NESTED_RADICAL: function (a, b, c) {
|
|
a = c.match(/exponent$/) ? a + "r" : a;
|
|
a = (b ? b + " " : "") + a;
|
|
return c.match(/ /) ? c.replace(/ /, " " + a + " ") : a + " " + c;
|
|
},
|
|
FONT_REGEXP: function (a) {
|
|
a = a
|
|
.split(" ")
|
|
.map(function (b) {
|
|
return b.replace(/s$/, "(|s)");
|
|
})
|
|
.join(" ");
|
|
return new RegExp("((^" + a + " )|( " + a + "$))");
|
|
},
|
|
},
|
|
MS_ROOT_INDEX: { 2: "Quadrat", 3: "Kubik" },
|
|
FONT: {
|
|
bold: "fettes",
|
|
"bold-fraktur": "fettes Fraktur",
|
|
"bold-italic": "fettkursives",
|
|
"bold-script": "fettes Schreibschrift",
|
|
caligraphic: "kalligrafisches",
|
|
"caligraphic-bold": "fettes kalligrafisches",
|
|
"double-struck": ["mit Doppelstrich", germanPostfixCombiner],
|
|
"double-struck-italic": ["kursiv mit Doppelstrich", germanPostfixCombiner],
|
|
fraktur: "Fraktur",
|
|
fullwidth: "vollbreites",
|
|
italic: "kursives",
|
|
monospace: "nichtproportionales",
|
|
normal: "normales",
|
|
oldstyle: "antiquiertes",
|
|
"oldstyle-bold": "antiquiertes fettes",
|
|
script: "Schreibschrift",
|
|
"sans-serif": "serifenloses",
|
|
"sans-serif-italic": "serifenloses kursives",
|
|
"sans-serif-bold": "serifenloses fettes",
|
|
"sans-serif-bold-italic": "serifenloses fettkursives",
|
|
unknown: "unbekannt",
|
|
},
|
|
EMBELLISH: {
|
|
super: "hoch",
|
|
sub: "Index",
|
|
circled: "eingekreistes",
|
|
parenthesized: "eingeklammertes",
|
|
period: ["Punkt", germanPostfixCombiner],
|
|
"negative-circled": "schwarz eingekreistes",
|
|
"double-circled": "doppelt eingekreistes",
|
|
"circled-sans-serif": "eingekreistes serifenloses",
|
|
"negative-circled-sans-serif": "schwarz eingekreistes serifenloses",
|
|
comma: ["Komma", germanPostfixCombiner],
|
|
squared: "umrahmtes",
|
|
"negative-squared": "schwarz umrahmtes",
|
|
},
|
|
ROLE: {
|
|
addition: "Addition",
|
|
multiplication: "Multiplikation",
|
|
subtraction: "Subtraktion",
|
|
division: "Division",
|
|
equality: "Gleichung",
|
|
inequality: "Ungleichung",
|
|
element: "Element",
|
|
arrow: "Pfeil",
|
|
determinant: "Determinante",
|
|
rowvector: "Zeilenvektor",
|
|
binomial: "Binomialkoeffizient",
|
|
squarematrix: "quadratische Matrize",
|
|
multiline: "mehrzeiligem Ausdruck",
|
|
matrix: "Matrize",
|
|
vector: "Vektor",
|
|
cases: "Fallunterscheidung",
|
|
table: "Tabelle",
|
|
unknown: "unbekannt",
|
|
},
|
|
ENCLOSE: {
|
|
longdiv: "langer Bruchstrich",
|
|
actuarial: "Bilanzsumme",
|
|
radical: "Quadratwurzel",
|
|
box: "rechteckige Umrandung",
|
|
roundedbox: "abgerundete rechteckige Umrandung",
|
|
circle: "kreis\u00e4hnliche Umrandung",
|
|
left: "senkrechte Linie links",
|
|
right: "senkrechte Linie rechts",
|
|
top: "waagerechte Linie oberhalb",
|
|
bottom: "waagerechte Linie unterhalb",
|
|
updiagonalstrike: "durchgestrichen",
|
|
downdiagonalstrike: "durchgestrichen",
|
|
verticalstrike: "senkrecht durchgestrichen",
|
|
horizontalstrike: "durchgestrichen",
|
|
madruwb: "arabisches Fakult\u00e4tssymbol",
|
|
updiagonalarrow: "Pfeil von links unten nach rechts oben",
|
|
phasorangle: "phasor angle",
|
|
unknown: "langer Bruchstrich",
|
|
},
|
|
NAVIGATE: {
|
|
COLLAPSIBLE: "kollabierbar",
|
|
EXPANDABLE: "ausfaltbar",
|
|
LEVEL: "Niveau",
|
|
},
|
|
REGEXP: {
|
|
TEXT: "a-zA-Z\u00e4\u00f6\u00fc\u00c4\u00d6\u00dc\u00df",
|
|
NUMBER: "((\\d{1,3})(?=(.| ))((.| )\\d{3})*(\\,\\d+)?)|^\\d*\\,\\d+|^\\d+",
|
|
DECIMAL_MARK: ",",
|
|
DIGIT_GROUP: "\\.",
|
|
JOINER_SUBSUPER: " ",
|
|
JOINER_FRAC: " ",
|
|
},
|
|
PLURAL_UNIT: {
|
|
Meile: "Meilen",
|
|
Yard: "Yards",
|
|
Joule: "Joules",
|
|
Gallone: "Gallonen",
|
|
Unze: "Unzen",
|
|
Tonne: "Tonnen",
|
|
Minute: "Minuten",
|
|
Stunde: "Stunden",
|
|
Sekunde: "Sekunden",
|
|
},
|
|
PLURAL: function (a) {
|
|
return a.match(/(B|b)yte$/) ? a.replace(/yte$/, "ytes") : a;
|
|
},
|
|
NUMBERS: sre.Numbers.de.NUMBERS,
|
|
ALPHABETS: {
|
|
latinSmall: "abcdefghijklmnopqrstuvwxyz".split(""),
|
|
latinCap: "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),
|
|
greekSmall:
|
|
"nabla;alpha;beta;gamma;delta;epsilon;zeta;eta;theta;iota;kappa;lambda;my;ny;xi;omikron;pi;rho;abschlie\u00dfendes sigma;sigma;tau;ypsilon;phi;chi;psi;omega;partielle Ableitung;epsilon;theta;kappa;phi;rho;pi".split(
|
|
";",
|
|
),
|
|
greekCap:
|
|
"Alpha Beta Gamma Delta Epsilon Zeta Eta Theta Iota Kappa Lambda My Ny Xi Omikron Pi Rho Theta Sigma Tau Ypsilon Phi Chi Psi Omega".split(
|
|
" ",
|
|
),
|
|
},
|
|
ALPHABET_TRANSFORMERS: {
|
|
digit: {
|
|
default: function (a) {
|
|
return 0 === a ? "null" : sre.Numbers.de.numberToWords(a);
|
|
},
|
|
mathspeak: function (a) {
|
|
return a.toString();
|
|
},
|
|
clearspeak: function (a) {
|
|
return a.toString();
|
|
},
|
|
},
|
|
letter: {
|
|
default: function (a) {
|
|
return a;
|
|
},
|
|
},
|
|
},
|
|
ALPHABET_PREFIXES: {
|
|
capPrefix: { default: "gro\u00dfes" },
|
|
smallPrefix: { default: "" },
|
|
digitPrefix: { default: "s" },
|
|
},
|
|
ALPHABET_COMBINER: germanPrefixCombiner,
|
|
};
|
|
sre.Grammar.getInstance().setCorrection("correctOne", function (a) {
|
|
return a.replace(/^eins /, "ein ");
|
|
});
|
|
sre.Grammar.getInstance().setCorrection("localFontNumber", function (a) {
|
|
var b = sre.Messages.FONT[a];
|
|
void 0 === b && (b = a || "");
|
|
b = "string" === typeof b ? b : b[0];
|
|
return b
|
|
.split(" ")
|
|
.map(function (c) {
|
|
return c.replace(/s$/, "");
|
|
})
|
|
.join(" ");
|
|
});
|
|
sre.Grammar.getInstance().setCorrection("lowercase", function (a) {
|
|
return a.toLowerCase();
|
|
});
|
|
sre.Grammar.getInstance().setCorrection("article", function (a) {
|
|
return "dative" === sre.Grammar.getInstance().getParameter("case")
|
|
? { der: "dem", die: "der", das: "dem" }[a]
|
|
: a;
|
|
});
|
|
sre.Grammar.getInstance().setCorrection("masculine", function (a) {
|
|
return "dative" === sre.Grammar.getInstance().getParameter("case")
|
|
? a + "n"
|
|
: a;
|
|
});
|
|
sre.Numbers.en = {};
|
|
sre.Numbers.en.onesNumbers_ =
|
|
" one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen".split(
|
|
" ",
|
|
);
|
|
sre.Numbers.en.tensNumbers_ =
|
|
" twenty thirty forty fifty sixty seventy eighty ninety".split(" ");
|
|
sre.Numbers.en.largeNumbers_ =
|
|
" thousand million billion trillion quadrillion quintillion sextillion septillion octillion nonillion decillion".split(
|
|
" ",
|
|
);
|
|
sre.Numbers.en.hundredsToWords_ = function (a) {
|
|
a %= 1e3;
|
|
var b = sre.Numbers.en.onesNumbers_[Math.floor(a / 100)]
|
|
? sre.Numbers.en.onesNumbers_[Math.floor(a / 100)] +
|
|
sre.Numbers.en.NUMBERS.numSep +
|
|
"hundred"
|
|
: "";
|
|
if ((a %= 100))
|
|
(b += b ? sre.Numbers.en.NUMBERS.numSep : ""),
|
|
(b +=
|
|
sre.Numbers.en.onesNumbers_[a] ||
|
|
sre.Numbers.en.tensNumbers_[Math.floor(a / 10)] +
|
|
(a % 10
|
|
? sre.Numbers.en.NUMBERS.numSep +
|
|
sre.Numbers.en.onesNumbers_[a % 10]
|
|
: ""));
|
|
return b;
|
|
};
|
|
sre.Numbers.en.numberToWords = function (a) {
|
|
if (a >= Math.pow(10, 36)) return a.toString();
|
|
for (var b = 0, c = ""; 0 < a; )
|
|
a % 1e3 &&
|
|
(c =
|
|
sre.Numbers.en.hundredsToWords_(a % 1e3) +
|
|
(b ? "-" + sre.Numbers.en.largeNumbers_[b] + "-" : "") +
|
|
c),
|
|
(a = Math.floor(a / 1e3)),
|
|
b++;
|
|
return c.replace(/-$/, "");
|
|
};
|
|
sre.Numbers.en.numberToOrdinal = function (a, b) {
|
|
if (1 === a) return b ? "oneths" : "oneth";
|
|
if (2 === a) return b ? "halves" : "half";
|
|
a = sre.Numbers.en.wordOrdinal(a);
|
|
return b ? a + "s" : a;
|
|
};
|
|
sre.Numbers.en.wordOrdinal = function (a) {
|
|
a = sre.Numbers.en.numberToWords(a);
|
|
return (a = a.match(/one$/)
|
|
? a.slice(0, -3) + "first"
|
|
: a.match(/two$/)
|
|
? a.slice(0, -3) + "second"
|
|
: a.match(/three$/)
|
|
? a.slice(0, -5) + "third"
|
|
: a.match(/five$/)
|
|
? a.slice(0, -4) + "fifth"
|
|
: a.match(/eight$/)
|
|
? a.slice(0, -5) + "eighth"
|
|
: a.match(/nine$/)
|
|
? a.slice(0, -4) + "ninth"
|
|
: a.match(/twelve$/)
|
|
? a.slice(0, -6) + "twelfth"
|
|
: a.match(/ty$/)
|
|
? a.slice(0, -2) + "tieth"
|
|
: a + "th");
|
|
};
|
|
sre.Numbers.en.simpleOrdinal = function (a) {
|
|
var b = a % 100,
|
|
c = a.toString();
|
|
if (10 < b && 20 > b) return c + "th";
|
|
switch (a % 10) {
|
|
case 1:
|
|
return c + "st";
|
|
case 2:
|
|
return c + "nd";
|
|
case 3:
|
|
return c + "rd";
|
|
default:
|
|
return c + "th";
|
|
}
|
|
};
|
|
sre.Numbers.en.NUMBERS = {
|
|
wordOrdinal: sre.Numbers.en.wordOrdinal,
|
|
simpleOrdinal: sre.Numbers.en.simpleOrdinal,
|
|
numberToWords: sre.Numbers.en.numberToWords,
|
|
numberToOrdinal: sre.Numbers.en.numberToOrdinal,
|
|
vulgarSep: " ",
|
|
numSep: " ",
|
|
};
|
|
sre.Locale.en = {
|
|
MS: {
|
|
START: "Start",
|
|
FRAC_V: "Fraction",
|
|
FRAC_B: "Frac",
|
|
FRAC_S: "Frac",
|
|
END: "End",
|
|
FRAC_OVER: "Over",
|
|
TWICE: "Twice",
|
|
NEST_FRAC: "Nest",
|
|
ENDFRAC: "EndFrac",
|
|
SUPER: "Super",
|
|
SUB: "Sub",
|
|
SUP: "Sup",
|
|
SUPERSCRIPT: "Superscript",
|
|
SUBSCRIPT: "Subscript",
|
|
BASELINE: "Baseline",
|
|
BASE: "Base",
|
|
NESTED: "Nested",
|
|
NEST_ROOT: "Nest",
|
|
STARTROOT: "StartRoot",
|
|
ENDROOT: "EndRoot",
|
|
ROOTINDEX: "RootIndex",
|
|
ROOT: "Root",
|
|
INDEX: "Index",
|
|
UNDER: "Under",
|
|
UNDERSCRIPT: "Underscript",
|
|
OVER: "Over",
|
|
OVERSCRIPT: "Overscript",
|
|
},
|
|
MS_FUNC: {
|
|
FRAC_NEST_DEPTH: sre.Locale.vulgarNestingDepth,
|
|
RADICAL_NEST_DEPTH: sre.Locale.nestingToString,
|
|
COMBINE_ROOT_INDEX: function (a, b) {
|
|
return a;
|
|
},
|
|
COMBINE_NESTED_FRACTION: function (a, b, c) {
|
|
return a + b + c;
|
|
},
|
|
COMBINE_NESTED_RADICAL: function (a, b, c) {
|
|
return a + b + c;
|
|
},
|
|
FONT_REGEXP: function (a) {
|
|
return new RegExp("^" + a.split(/ |-/).join("( |-)") + "( |-)");
|
|
},
|
|
},
|
|
MS_ROOT_INDEX: {},
|
|
FONT: {
|
|
bold: "bold",
|
|
"bold-fraktur": "bold fraktur",
|
|
"bold-italic": "bold italic",
|
|
"bold-script": "bold script",
|
|
caligraphic: "calligraphic",
|
|
"caligraphic-bold": "calligraphic bold",
|
|
"double-struck": "double struck",
|
|
"double-struck-italic": "double struck italic",
|
|
fraktur: "fraktur",
|
|
fullwidth: "fullwidth",
|
|
italic: "italic",
|
|
monospace: "monospace",
|
|
normal: "normal",
|
|
oldstyle: "oldstyle",
|
|
"oldstyle-bold": "oldstyle bold",
|
|
script: "script",
|
|
"sans-serif": "sans serif",
|
|
"sans-serif-italic": "sans serif italic",
|
|
"sans-serif-bold": "sans serif bold",
|
|
"sans-serif-bold-italic": "sans serif bold italic",
|
|
unknown: "unknown",
|
|
},
|
|
EMBELLISH: {
|
|
super: "super",
|
|
sub: "sub",
|
|
circled: "circled",
|
|
parenthesized: "parenthesized",
|
|
period: ["period", sre.Locale.postfixCombiner],
|
|
"negative-circled": "black circled",
|
|
"double-circled": "double circled",
|
|
"circled-sans-serif": "circled sans serif",
|
|
"negative-circled-sans-serif": "black circled sans serif",
|
|
comma: ["comma", sre.Locale.postfixCombiner],
|
|
squared: "squared",
|
|
"negative-squared": "black squared",
|
|
},
|
|
ROLE: {
|
|
addition: "addition",
|
|
multiplication: "multiplication",
|
|
subtraction: "subtraction",
|
|
division: "division",
|
|
equality: "equality",
|
|
inequality: "inequality",
|
|
element: "element",
|
|
arrow: "arrow",
|
|
determinant: "determinant",
|
|
rowvector: "row vector",
|
|
binomial: "binomial",
|
|
squarematrix: "square matrix",
|
|
multiline: "multiple lines",
|
|
matrix: "matrix",
|
|
vector: "vector",
|
|
cases: "case statement",
|
|
table: "table",
|
|
unknown: "unknown",
|
|
},
|
|
ENCLOSE: {
|
|
longdiv: "long division",
|
|
actuarial: "actuarial symbol",
|
|
radical: "square root",
|
|
box: "box",
|
|
roundedbox: "rounded box",
|
|
circle: "circle",
|
|
left: "left vertical-line",
|
|
right: "right vertical-line",
|
|
top: "overbar",
|
|
bottom: "underbar",
|
|
updiagonalstrike: "crossout",
|
|
downdiagonalstrike: "crossout",
|
|
verticalstrike: "vertical strikeout",
|
|
horizontalstrike: "crossout",
|
|
madruwb: "Arabic factorial symbol",
|
|
updiagonalarrow: "diagonal arrow",
|
|
phasorangle: "phasor angle",
|
|
unknown: "long division",
|
|
},
|
|
NAVIGATE: {
|
|
COLLAPSIBLE: "collapsible",
|
|
EXPANDABLE: "expandable",
|
|
LEVEL: "Level",
|
|
},
|
|
REGEXP: {
|
|
TEXT: "a-zA-Z",
|
|
NUMBER: "((\\d{1,3})(?=(,| ))((,| )\\d{3})*(\\.\\d+)?)|^\\d*\\.\\d+|^\\d+",
|
|
DECIMAL_MARK: "\\.",
|
|
DIGIT_GROUP: ",",
|
|
JOINER_SUBSUPER: " ",
|
|
JOINER_FRAC: "",
|
|
},
|
|
PLURAL_UNIT: {
|
|
foot: "feet",
|
|
inch: "inches",
|
|
"square foot": "square feet",
|
|
"square inch": "square inches",
|
|
"cubic foot": "cubic feet",
|
|
"cubic inch": "cubic inches",
|
|
},
|
|
NUMBERS: sre.Numbers.en.NUMBERS,
|
|
ALPHABETS: {
|
|
latinSmall: "abcdefghijklmnopqrstuvwxyz".split(""),
|
|
latinCap: "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),
|
|
greekSmall:
|
|
"nabla;alpha;beta;gamma;delta;epsilon;zeta;eta;theta;iota;kappa;lamda;mu;nu;xi;omicron;pi;rho;final sigma;sigma;tau;upsilon;phi;chi;psi;omega;partial differential;epsilon;theta;kappa;phi;rho;pi".split(
|
|
";",
|
|
),
|
|
greekCap:
|
|
"Alpha Beta Gamma Delta Epsilon Zeta Eta Theta Iota Kappa Lamda Mu Nu Xi Omicron Pi Rho Theta Sigma Tau Upsilon Phi Chi Psi Omega".split(
|
|
" ",
|
|
),
|
|
},
|
|
ALPHABET_TRANSFORMERS: {
|
|
digit: {
|
|
default: function (a) {
|
|
return 0 === a ? "zero" : sre.Numbers.en.numberToWords(a);
|
|
},
|
|
mathspeak: function (a) {
|
|
return a.toString();
|
|
},
|
|
clearspeak: function (a) {
|
|
return a.toString();
|
|
},
|
|
},
|
|
letter: {
|
|
default: function (a) {
|
|
return a;
|
|
},
|
|
},
|
|
},
|
|
ALPHABET_PREFIXES: {
|
|
capPrefix: { default: "cap", mathspeak: "upper" },
|
|
smallPrefix: { default: "" },
|
|
digitPrefix: { default: "" },
|
|
},
|
|
ALPHABET_COMBINER: sre.Locale.prefixCombiner,
|
|
};
|
|
sre.Numbers.es = {};
|
|
sre.Numbers.es.onesNumbers_ =
|
|
" uno dos tres cuatro cinco seis siete ocho nueve diez once doce trece catorce quince diecis\u00e9is diecisiete dieciocho diecinueve veinte veintiuno veintid\u00f3s veintitr\u00e9s veinticuatro veinticinco veintis\u00e9is veintisiete veintiocho veintinueve".split(
|
|
" ",
|
|
);
|
|
sre.Numbers.es.tensNumbers_ =
|
|
" treinta cuarenta cincuenta sesenta setenta ochenta noventa".split(" ");
|
|
sre.Numbers.es.hundredsNumbers_ =
|
|
" cien doscientos trescientos cuatrocientos quinientos seiscientos setecientos ochocientos novecientos".split(
|
|
" ",
|
|
);
|
|
sre.Numbers.es.largeNumbers_ =
|
|
";mil;mill\u00f3n;mil mill\u00f3nes;bill\u00f3n;mil bill\u00f3nes;trill\u00f3n;mil trill\u00f3nes;cuatrill\u00f3;mil cuatrill\u00f3es;quintill\u00f3n;mil quintill\u00f3nes;sextill\u00f3n;mil sextill\u00f3nes;septill\u00f3n;mil septill\u00f3nes;octill\u00f3n;mil octill\u00f3nes;nonill\u00f3n;mil nonill\u00f3nes;decill\u00f3n;mil decill\u00f3nes".split(
|
|
";",
|
|
);
|
|
sre.Numbers.es.tensToWords_ = function (a) {
|
|
var b = a % 100;
|
|
if (30 > b) return sre.Numbers.es.onesNumbers_[b];
|
|
a = sre.Numbers.es.tensNumbers_[Math.floor(b / 10)];
|
|
b = sre.Numbers.es.onesNumbers_[b % 10];
|
|
return a && b ? a + " y " + b : a || b;
|
|
};
|
|
sre.Numbers.es.hundredsToWords_ = function (a) {
|
|
var b = a % 1e3;
|
|
a = Math.floor(b / 100);
|
|
var c = sre.Numbers.es.hundredsNumbers_[a];
|
|
b = sre.Numbers.es.tensToWords_(b % 100);
|
|
return 1 === a ? (b ? c + "to " + b : c) : c && b ? c + " " + b : c || b;
|
|
};
|
|
sre.Numbers.es.numberToWords = function (a) {
|
|
if (a >= Math.pow(10, 36)) return a.toString();
|
|
for (var b = 0, c = ""; 0 < a; ) {
|
|
var d = a % 1e3;
|
|
if (d) {
|
|
var e = sre.Numbers.es.largeNumbers_[b],
|
|
f = sre.Numbers.es.hundredsToWords_(d);
|
|
b
|
|
? 1 === d
|
|
? ((e = e.match("/^mil( |$)/") ? e : "un " + e),
|
|
(c = e + (c ? " " + c : "")))
|
|
: ((e = e.replace(/\u00f3n$/, "ones")),
|
|
(c =
|
|
sre.Numbers.es.hundredsToWords_(d) +
|
|
" " +
|
|
e +
|
|
(c ? " " + c : "")))
|
|
: (c = f);
|
|
}
|
|
a = Math.floor(a / 1e3);
|
|
b++;
|
|
}
|
|
return c;
|
|
};
|
|
sre.Numbers.es.onesOrdinals_ =
|
|
"primera segunda tercera cuarta quinta sexta s\u00e9ptima octava novena d\u00e9cima und\u00e9cima duod\u00e9cima".split(
|
|
" ",
|
|
);
|
|
sre.Numbers.es.tensOrdinals_ =
|
|
"d\u00e9cima vig\u00e9sima trig\u00e9sima cuadrag\u00e9sima quincuag\u00e9sima sexag\u00e9sima septuag\u00e9sima octog\u00e9sima nonag\u00e9sima".split(
|
|
" ",
|
|
);
|
|
sre.Numbers.es.hundredsOrdinals_ =
|
|
"cent\u00e9sima ducent\u00e9sima tricent\u00e9sima cuadringent\u00e9sima quingent\u00e9sima sexcent\u00e9sima septingent\u00e9sima octingent\u00e9sima noningent\u00e9sima".split(
|
|
" ",
|
|
);
|
|
sre.Numbers.es.numberToOrdinal = function (a, b) {
|
|
if (1999 < a) return a.toString() + "a";
|
|
if (12 >= a) return sre.Numbers.es.onesOrdinals_[a - 1];
|
|
b = [];
|
|
1e3 <= a && ((a -= 1e3), b.push("mil\u00e9sima"));
|
|
if (!a) return b.join(" ");
|
|
var c = Math.floor(a / 100);
|
|
0 < c && (b.push(sre.Numbers.es.hundredsOrdinals_[c - 1]), (a %= 100));
|
|
12 >= a
|
|
? b.push(sre.Numbers.es.onesOrdinals_[a - 1])
|
|
: ((c = Math.floor(a / 10)),
|
|
0 < c && (b.push(sre.Numbers.es.tensOrdinals_[c - 1]), (a %= 10)),
|
|
0 < a && b.push(sre.Numbers.es.onesOrdinals_[a - 1]));
|
|
return b.join(" ");
|
|
};
|
|
sre.Numbers.es.simpleOrdinal = function (a) {
|
|
var b = sre.Grammar.getInstance().getParameter("gender");
|
|
return a.toString() + ("female" === b ? "a" : "o");
|
|
};
|
|
sre.Numbers.es.NUMBERS = {
|
|
simpleOrdinal: sre.Numbers.es.simpleOrdinal,
|
|
numberToWords: sre.Numbers.es.numberToWords,
|
|
numberToOrdinal: sre.Numbers.es.numberToOrdinal,
|
|
vulgarSep: "-",
|
|
};
|
|
var sansserifCombiner = function (a, b, c) {
|
|
a = "sans serif " + (c ? c + " " + a : a);
|
|
return b ? a + " " + b : a;
|
|
};
|
|
sre.Locale.es = {
|
|
MS: {
|
|
START: "empezar",
|
|
FRAC_V: "fracci\u00f3n",
|
|
FRAC_B: "frac",
|
|
FRAC_S: "frac",
|
|
END: "finalizar",
|
|
FRAC_OVER: "entre",
|
|
TWICE: "",
|
|
NEST_FRAC: "",
|
|
ENDFRAC: "",
|
|
SUPER: "super",
|
|
SUB: "sub",
|
|
SUP: "sup",
|
|
SUPERSCRIPT: "super\u00edndice",
|
|
SUBSCRIPT: "sub\u00edndice",
|
|
BASELINE: "l\u00ednea base",
|
|
BASE: "",
|
|
NESTED: "",
|
|
NEST_ROOT: "",
|
|
STARTROOT: "empezar ra\u00edz",
|
|
ENDROOT: "finalizar ra\u00edz",
|
|
ROOTINDEX: "\u00edndice de ra\u00edz",
|
|
ROOT: "ra\u00edz",
|
|
INDEX: "",
|
|
UNDER: "bajo",
|
|
UNDERSCRIPT: "bajo\u00edndice",
|
|
OVER: "sobre",
|
|
OVERSCRIPT: "sobre\u00edndice",
|
|
},
|
|
MS_FUNC: {
|
|
FRAC_NEST_DEPTH: function (a) {
|
|
return !1;
|
|
},
|
|
RADICAL_NEST_DEPTH: function (a) {
|
|
return "";
|
|
},
|
|
COMBINE_ROOT_INDEX: sre.Locale.combinePostfixIndex,
|
|
COMBINE_NESTED_FRACTION: function (a, b, c) {
|
|
return a + b + c;
|
|
},
|
|
COMBINE_NESTED_RADICAL: function (a, b, c) {
|
|
return a + c;
|
|
},
|
|
FONT_REGEXP: function (a) {
|
|
return RegExp("^" + a + " ");
|
|
},
|
|
},
|
|
MS_ROOT_INDEX: {
|
|
2: "cuadrada",
|
|
3: "c\u00fabica",
|
|
4: "a la cuarta",
|
|
5: "a la quinta",
|
|
6: "a la sexta",
|
|
7: "a la s\u00e9ptima",
|
|
8: "a la octava",
|
|
9: "a la novena",
|
|
10: "a la d\u00e9cima",
|
|
},
|
|
FONT: {
|
|
bold: "negrita",
|
|
"bold-fraktur": "negrita Fraktur",
|
|
"bold-italic": "negrita cursiva",
|
|
"bold-script": "negrita script",
|
|
caligraphic: "caligr\u00e1fica",
|
|
"caligraphic-bold": "caligr\u00e1fica negrita",
|
|
"double-struck": "negrita de pizarra",
|
|
"double-struck-italic": "negrita de pizarra cursiva",
|
|
fraktur: "Fraktur",
|
|
fullwidth: "ancho completo",
|
|
italic: "cursiva",
|
|
monospace: "monoespacio",
|
|
normal: "normal",
|
|
oldstyle: "estilo antiguo",
|
|
"oldstyle-bold": "estilo antiguo negrita",
|
|
script: "script",
|
|
"sans-serif": "sans serif",
|
|
"sans-serif-italic": "sans serif cursiva",
|
|
"sans-serif-bold": "sans serif negrita",
|
|
"sans-serif-bold-italic": "sans serif negrita cursiva",
|
|
unknown: "desconocida",
|
|
},
|
|
ROLE: {
|
|
addition: "adici\u00f3n",
|
|
multiplication: "multiplicaci\u00f3n",
|
|
subtraction: "resta",
|
|
division: "divisi\u00f3n",
|
|
equality: "igualdad",
|
|
inequality: "desigualdad",
|
|
element: "elemento",
|
|
arrow: "flecha",
|
|
determinant: "determinante",
|
|
rowvector: "fila vector",
|
|
binomial: "binomial",
|
|
squarematrix: "matriz cuadrada",
|
|
multiline: "l\u00edneas m\u00faltiples",
|
|
matrix: "matriz",
|
|
vector: "vector",
|
|
cases: "declaraci\u00f3n de caso",
|
|
table: "mesa",
|
|
unknown: "desconocida",
|
|
},
|
|
ENCLOSE: {
|
|
longdiv: "divisi\u00f3n larga",
|
|
actuarial: "s\u00edmbolo actuarial",
|
|
radical: "ra\u00edz cuadrada",
|
|
box: "caja",
|
|
roundedbox: "caja redondeada",
|
|
circle: "c\u00edrculo",
|
|
left: "barra vertical izquierda",
|
|
right: "barra vertical derecha",
|
|
top: "barra",
|
|
bottom: "subbarra",
|
|
updiagonalstrike: "tachadura",
|
|
downdiagonalstrike: "tachadura",
|
|
verticalstrike: "ponchado vertical",
|
|
horizontalstrike: "cruce",
|
|
madruwb: "s\u00edmbolo factorial \u00e1rabe",
|
|
updiagonalarrow: "flecha diagonal",
|
|
phasorangle: "\u00e1ngulo de fasores",
|
|
unknown: "divisi\u00f3n larga",
|
|
},
|
|
EMBELLISH: {
|
|
super: "super\u00edndice",
|
|
sub: "sub\u00edndice",
|
|
circled: ["en circulo", sre.Locale.postfixCombiner],
|
|
parenthesized: ["entre par\u00e9ntesis", sre.Locale.postfixCombiner],
|
|
period: ["punto", sre.Locale.postfixCombiner],
|
|
"negative-circled": ["en circulo negro", sre.Locale.postfixCombiner],
|
|
"double-circled": ["en doble circulo", sre.Locale.postfixCombiner],
|
|
"circled-sans-serif": ["en circulo", sansserifCombiner],
|
|
"negative-circled-sans-serif": ["en circulo negro", sansserifCombiner],
|
|
comma: ["coma", sre.Locale.postfixCombiner],
|
|
squared: ["en cuadrado", sre.Locale.postfixCombiner],
|
|
"negative-squared": ["en cuadrado negro", sre.Locale.postfixCombiner],
|
|
},
|
|
NAVIGATE: {
|
|
COLLAPSIBLE: "plegable",
|
|
EXPANDABLE: "ampliable",
|
|
LEVEL: "nivel",
|
|
},
|
|
REGEXP: {
|
|
TEXT: "a-zA-Z\u00e1\u00e9\u00ed\u00f3\u00fa\u00f1\u00c1\u00c9\u00cd\u00d3\u00da\u00d1",
|
|
NUMBER: "((\\d{1,3})(?=( ))(( )\\d{3})*(,\\d+)?)|^\\d*,\\d+|^\\d+",
|
|
DECIMAL_MARK: ",",
|
|
DIGIT_GROUP: "",
|
|
JOINER_SUBSUPER: " ",
|
|
JOINER_FRAC: " ",
|
|
},
|
|
PLURAL_UNIT: {},
|
|
PLURAL: function (a) {
|
|
return /.*s$/.test(a) ? a : a + "s";
|
|
},
|
|
NUMBERS: sre.Numbers.es.NUMBERS,
|
|
ALPHABETS: {
|
|
latinSmall: "abcdefghijklmnopqrstuvwxyz".split(""),
|
|
latinCap: "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),
|
|
greekSmall:
|
|
"nabla;alfa;beta;gamma;delta;\u00e9psilon;zeta;eta;theta;iota;kappa;lambda;mi;ni;xi;\u00f3micron;pi;rho;sigma final;sigma;tau;\u00edpsilon;phi;ji;psi;omega;diferencial parcial;\u00e9psilon;theta;kappa;phi;rho;pi".split(
|
|
";",
|
|
),
|
|
greekCap:
|
|
"Alfa Beta Gamma Delta \u00c9psilon Zeta Eta Theta Iota Kappa Lambda Mi Ni Xi \u00d3micron Pi Rho Theta Sigma Tau \u00cdpsilon Phi Ji Psi Omega".split(
|
|
" ",
|
|
),
|
|
},
|
|
ALPHABET_TRANSFORMERS: {
|
|
digit: {
|
|
default: function (a) {
|
|
return 0 === a ? "cero" : sre.Numbers.es.numberToWords(a);
|
|
},
|
|
mathspeak: function (a) {
|
|
return a.toString();
|
|
},
|
|
clearspeak: function (a) {
|
|
return a.toString();
|
|
},
|
|
},
|
|
letter: {
|
|
default: function (a) {
|
|
return a;
|
|
},
|
|
},
|
|
},
|
|
ALPHABET_PREFIXES: {
|
|
capPrefix: { default: "may\u00fascula" },
|
|
smallPrefix: { default: "" },
|
|
digitPrefix: { default: "" },
|
|
},
|
|
ALPHABET_COMBINER: sre.Locale.prefixCombiner,
|
|
UNIT_TIMES: "por",
|
|
};
|
|
sre.Numbers.fr = {};
|
|
sre.Numbers.fr.SUB_ISO = "fr";
|
|
sre.Numbers.fr.onesNumbers_ =
|
|
" un deux trois quatre cinq six sept huit neuf dix onze douze treize quatorze quinze seize dix-sept dix-huit dix-neuf".split(
|
|
" ",
|
|
);
|
|
sre.Numbers.fr.tensNumbers_ = {
|
|
fr: " vingt trente quarante cinquante soixante soixante-dix quatre-vingts quatre-vingt-dix".split(
|
|
" ",
|
|
),
|
|
be: " vingt trente quarante cinquante soixante septante quatre-vingts nonante".split(
|
|
" ",
|
|
),
|
|
sw: " vingt trente quarante cinquante soixante septante huitante nonante".split(
|
|
" ",
|
|
),
|
|
};
|
|
sre.Numbers.fr.largeNumbers_ =
|
|
";mille;millions;milliards;billions;mille billions;trillions;mille trillions;quadrillions;mille quadrillions;quintillions;mille quintillions".split(
|
|
";",
|
|
);
|
|
sre.Numbers.fr.hundredsToWords_ = function (a) {
|
|
var b = a % 1e3;
|
|
a = sre.Numbers.fr.onesNumbers_[Math.floor(b / 100)]
|
|
? sre.Numbers.fr.onesNumbers_[Math.floor(b / 100)] + "-cent"
|
|
: "";
|
|
if ((b %= 100)) {
|
|
a += a ? "-" : "";
|
|
var c = sre.Numbers.fr.onesNumbers_[b];
|
|
if (c) a += c;
|
|
else {
|
|
var d =
|
|
sre.Numbers.fr.tensNumbers_[sre.Numbers.fr.SUB_ISO][Math.floor(b / 10)];
|
|
d.match(/\-dix$/)
|
|
? ((c = sre.Numbers.fr.onesNumbers_[(b % 10) + 10]),
|
|
(a += d.replace(/\-dix$/, "") + "-" + c))
|
|
: (a += d + (b % 10 ? "-" + sre.Numbers.fr.onesNumbers_[b % 10] : ""));
|
|
}
|
|
}
|
|
return (b = a.match(/s\-\w+$/))
|
|
? a.replace(/s\-\w+$/, b[0].slice(1))
|
|
: a.replace(/\-un$/, "-et-un");
|
|
};
|
|
sre.Numbers.fr.numberToWords = function (a) {
|
|
if (a >= Math.pow(10, 36)) return a.toString();
|
|
for (var b = 0, c = ""; 0 < a; ) {
|
|
var d = a % 1e3;
|
|
if (d) {
|
|
var e = sre.Numbers.fr.largeNumbers_[b],
|
|
f = sre.Numbers.fr.hundredsToWords_(d);
|
|
e && e.match(/^mille /)
|
|
? ((d = e.replace(/^mille /, "")),
|
|
(c = c.match(RegExp(d))
|
|
? f + (b ? "-mille-" : "") + c
|
|
: c.match(RegExp(d.replace(/s$/, "")))
|
|
? f + (b ? "-mille-" : "") + c.replace(d.replace(/s$/, ""), d)
|
|
: f + (b ? "-" + e + "-" : "") + c))
|
|
: ((e = 1 === d && e ? e.replace(/s$/, "") : e),
|
|
(c = f + (b ? "-" + e + "-" : "") + c));
|
|
}
|
|
a = Math.floor(a / 1e3);
|
|
b++;
|
|
}
|
|
return c.replace(/-$/, "");
|
|
};
|
|
sre.Numbers.fr.SMALL_ORDINAL = {
|
|
1: "uni\u00e8me",
|
|
2: "demi",
|
|
3: "tiers",
|
|
4: "quart",
|
|
};
|
|
sre.Numbers.fr.numberToOrdinal = function (a, b) {
|
|
var c = sre.Numbers.fr.SMALL_ORDINAL[a] || sre.Numbers.fr.wordOrdinal(a);
|
|
return 3 === a ? c : b ? c + "s" : c;
|
|
};
|
|
sre.Numbers.fr.wordOrdinal = function (a) {
|
|
if (1 === a) return "premi\u00e8re";
|
|
a = sre.Numbers.fr.numberToWords(a);
|
|
a.match(/^neuf$/)
|
|
? (a = a.slice(0, -1) + "v")
|
|
: a.match(/cinq$/)
|
|
? (a += "u")
|
|
: a.match(/trois$/) ||
|
|
(!a.match(/e$/) && !a.match(/s$/)) ||
|
|
(a = a.slice(0, -1));
|
|
return a + "i\u00e8me";
|
|
};
|
|
sre.Numbers.fr.simpleOrdinal = function (a) {
|
|
var b = sre.Grammar.getInstance().getParameter("gender");
|
|
return 1 === a
|
|
? a.toString() + ("male" === b ? "er" : "re")
|
|
: a.toString() + "e";
|
|
};
|
|
sre.Numbers.fr.NUMBERS = {
|
|
wordOrdinal: sre.Numbers.fr.wordOrdinal,
|
|
simpleOrdinal: sre.Numbers.fr.simpleOrdinal,
|
|
numberToWords: sre.Numbers.fr.numberToWords,
|
|
numberToOrdinal: sre.Numbers.fr.numberToOrdinal,
|
|
vulgarSep: "-",
|
|
};
|
|
sre.Locale.fr = {
|
|
MS: {
|
|
START: "d\u00e9but",
|
|
FRAC_V: "fraction",
|
|
FRAC_B: "frac",
|
|
FRAC_S: "frac",
|
|
END: "fin",
|
|
FRAC_OVER: "sur",
|
|
ONCE: "1",
|
|
TWICE: "2",
|
|
NEST_FRAC: "imbriqu\u00e9e",
|
|
ENDFRAC: "fin frac",
|
|
SUPER: "sup",
|
|
SUB: "sub",
|
|
SUP: "sup",
|
|
SUPERSCRIPT: "exposant",
|
|
SUBSCRIPT: "indice",
|
|
BASELINE: "position de base",
|
|
BASE: "position de base",
|
|
NESTED: "imbriqu\u00e9e",
|
|
NEST_ROOT: "imbriqu\u00e9e",
|
|
STARTROOT: "d\u00e9but racine",
|
|
ENDROOT: "fin racine",
|
|
ROOTINDEX: "indice du radical",
|
|
ROOT: "racine",
|
|
INDEX: "indice",
|
|
UNDER: "sous",
|
|
UNDERSCRIPT: "souscript",
|
|
OVER: "sus",
|
|
OVERSCRIPT: "suscript",
|
|
},
|
|
MS_FUNC: {
|
|
FRAC_NEST_DEPTH: function (a) {
|
|
return !1;
|
|
},
|
|
RADICAL_NEST_DEPTH: sre.Locale.nestingToString,
|
|
COMBINE_ROOT_INDEX: sre.Locale.combinePostfixIndex,
|
|
COMBINE_NESTED_FRACTION: function (a, b, c) {
|
|
return c.replace(/ $/g, "") + b + a;
|
|
},
|
|
COMBINE_NESTED_RADICAL: function (a, b, c) {
|
|
return c + " " + a;
|
|
},
|
|
FONT_REGEXP: function (a) {
|
|
return RegExp(" (en |)" + a + "$");
|
|
},
|
|
},
|
|
MS_ROOT_INDEX: { 2: "carr\u00e9e", 3: "cubique" },
|
|
FONT: {
|
|
bold: "en gras",
|
|
"bold-fraktur": "en gothique gras",
|
|
"bold-italic": "en italique gras",
|
|
"bold-script": "de ronde en gras",
|
|
caligraphic: "en calligraphique",
|
|
"caligraphic-bold": "en calligraphique gras",
|
|
"double-struck": "ajour\u00e9",
|
|
"double-struck-italic": "ajour\u00e9 en italique",
|
|
fraktur: "en gothique",
|
|
fullwidth: "en pleine largeur",
|
|
italic: "en italique",
|
|
monospace: "en chasse fixe",
|
|
normal: "en normal",
|
|
oldstyle: "en ancien",
|
|
"oldstyle-bold": "en ancien gras",
|
|
script: "de ronde",
|
|
"sans-serif": "sans empattement",
|
|
"sans-serif-italic": "en italique sans empattement",
|
|
"sans-serif-bold": "en gras sans empattement",
|
|
"sans-serif-bold-italic": "en italique gras sans empattement",
|
|
unknown: "inconnu",
|
|
},
|
|
EMBELLISH: {
|
|
super: ["exposant", sre.Locale.prefixCombiner],
|
|
sub: ["indice", sre.Locale.prefixCombiner],
|
|
circled: "encercl\u00e9",
|
|
parenthesized: "entre parenth\u00e8ses",
|
|
period: "un point",
|
|
"negative-circled": "encercl\u00e9 noir",
|
|
"double-circled": "encercl\u00e9 double",
|
|
"circled-sans-serif": "sans empattement encercl\u00e9",
|
|
"negative-circled-sans-serif": "sans empattement encercl\u00e9 noir",
|
|
comma: "virgule",
|
|
squared: "encadr\u00e9",
|
|
"negative-squared": "encadr\u00e9 inverse",
|
|
},
|
|
ROLE: {
|
|
addition: "addition",
|
|
multiplication: "multiplication",
|
|
subtraction: "soustraction",
|
|
division: "division",
|
|
equality: "\u00e9galit\u00e9",
|
|
inequality: "in\u00e9galit\u00e9",
|
|
element: "\u00e9l\u00e9ment",
|
|
arrow: "fl\u00e8che",
|
|
determinant: "d\u00e9terminant",
|
|
rowvector: "vecteur-rang\u00e9e",
|
|
binomial: "binomial",
|
|
squarematrix: "matrice carr\u00e9e",
|
|
"set empty": "ensemble vide",
|
|
"set extended": "extension",
|
|
"set singleton": "singleton",
|
|
"set collection": "collection",
|
|
label: "\u00e9tiquette",
|
|
multiline: "multi-ligne",
|
|
matrix: "matrice",
|
|
vector: "vecteur",
|
|
cases: "d\u00e9claration de cas",
|
|
table: "tableau",
|
|
unknown: "inconnu",
|
|
},
|
|
ENCLOSE: {
|
|
longdiv: "longue division",
|
|
actuarial: "notation actuarielle",
|
|
radical: "radical",
|
|
box: "bo\u00eete",
|
|
roundedbox: "bo\u00eete arrondie",
|
|
circle: "cercle",
|
|
left: "barre verticale gauche",
|
|
right: "barre verticale droite",
|
|
top: "trait suscrit",
|
|
bottom: "trait souscrit",
|
|
updiagonalstrike: "texte biff\u00e9 diagonal montant",
|
|
downdiagonalstrike: "texte biff\u00e9 diagonal descendant",
|
|
verticalstrike: "texte biff\u00e9 vertical",
|
|
horizontalstrike: "texte biff\u00e9 horizontal",
|
|
madruwb: "symbole factorielle arabe",
|
|
updiagonalarrow: "fl\u00e8che diagonale montante",
|
|
phasorangle: "angle de phase",
|
|
unknown: "division longue",
|
|
},
|
|
NAVIGATE: {
|
|
COLLAPSIBLE: "compressible",
|
|
EXPANDABLE: "d\u00e9compressible",
|
|
LEVEL: "niveau",
|
|
},
|
|
REGEXP: {
|
|
TEXT: "a-zA-Z\u00e0\u00e2\u00e6\u00e7\u00e9\u00e8\u00ea\u00eb\u00ee\u00ef\u00f4\u0153\u00f9\u00fb\u00fc\u00ff\u00c0\u00c2\u00c6\u00c7\u00c9\u00c8\u00ca\u00cb\u00ce\u00cf\u00d4\u0152\u00d9\u00db\u00dc\u0178",
|
|
NUMBER: "((\\d{1,3})(?=( ))(( )\\d{3})*(,\\d+)?)|^\\d*,\\d+|^\\d+",
|
|
DECIMAL_MARK: ",",
|
|
DIGIT_GROUP: "",
|
|
JOINER_SUBSUPER: "-",
|
|
JOINER_FRAC: " ",
|
|
},
|
|
PLURAL_UNIT: { foot: "feet", inch: "inches" },
|
|
NUMBERS: sre.Numbers.fr.NUMBERS,
|
|
ALPHABETS: {
|
|
latinSmall: "abcdefghijklmnopqrstuvwxyz".split(""),
|
|
latinCap: "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),
|
|
greekSmall:
|
|
"nabla;alpha;b\u00eata;gamma;delta;epsilon;z\u00eata;\u00eata;th\u00eata;iota;kappa;lambda;m\u00fb;n\u00fb;xi;omicron;pi;rh\u00f4;sigma final;sigma;tau;upsilon;phi;chi;psi;om\u00e9ga;d\u00e9riv\u00e9e partielle;epsilon;th\u00eata;kappa;phi;rh\u00f4;pi".split(
|
|
";",
|
|
),
|
|
greekCap:
|
|
"Alpha B\u00eata Gamma Delta Epsilon Z\u00eata \u00cata Th\u00eata Iota Kappa Lambda M\u00fb N\u00fb Xi Omicron Pi Rh\u00f4 Th\u00eata Sigma Tau Upsilon Phi Chi Psi Om\u00e9ga".split(
|
|
" ",
|
|
),
|
|
},
|
|
ALPHABET_TRANSFORMERS: {
|
|
digit: {
|
|
default: function (a) {
|
|
return 0 === a ? "zero" : sre.Numbers.fr.numberToWords(a);
|
|
},
|
|
mathspeak: function (a) {
|
|
return a.toString();
|
|
},
|
|
clearspeak: function (a) {
|
|
return a.toString();
|
|
},
|
|
},
|
|
letter: {
|
|
default: function (a) {
|
|
return a;
|
|
},
|
|
},
|
|
},
|
|
ALPHABET_PREFIXES: {
|
|
capPrefix: { default: "majuscule" },
|
|
smallPrefix: { default: "" },
|
|
digitPrefix: { default: "" },
|
|
},
|
|
ALPHABET_COMBINER: function (a, b, c) {
|
|
a = c ? a + " " + c : a;
|
|
return b ? a + " " + b : a;
|
|
},
|
|
};
|
|
sre.Numbers.nemeth = {};
|
|
sre.Numbers.nemeth.oneNumbers_ =
|
|
"\u2834\u2802\u2806\u2812\u2832\u2822\u2816\u2836\u2826\u2814".split("");
|
|
sre.Numbers.nemeth.numberToWords = function (a) {
|
|
return a
|
|
.toString()
|
|
.split("")
|
|
.map(function (b) {
|
|
return sre.Numbers.nemeth.oneNumbers_[parseInt(b, 10)];
|
|
})
|
|
.join("");
|
|
};
|
|
sre.Numbers.nemeth.NUMBERS = {
|
|
numberToWords: sre.Numbers.nemeth.numberToWords,
|
|
simpleOrdinal: sre.Numbers.nemeth.numberToWords,
|
|
};
|
|
var postfixCombiner = function (a, b, c) {
|
|
return b ? a + b : a;
|
|
},
|
|
embellishCombiner = function (a, b, c) {
|
|
return b + (c ? c : "\u2830") + a + "\u283b";
|
|
},
|
|
doubleEmbellishCombiner = function (a, b, c) {
|
|
return b + (c ? c : "\u2830") + a + "\u283b\u283b";
|
|
},
|
|
parensCombiner = function (a, b, c) {
|
|
return b + (c ? c : "\u2830") + a + "\u283e";
|
|
};
|
|
sre.Locale.nemeth = {
|
|
MS: {
|
|
FRACTION_REPEAT: "\u2820",
|
|
FRACTION_START: "\u2839",
|
|
FRAC_V: "\u2839",
|
|
FRAC_B: "Frac",
|
|
FRAC_S: "Frac",
|
|
END: "\u2820",
|
|
FRACTION_OVER: "\u280c",
|
|
TWICE: "Twice",
|
|
NEST_FRAC: "Nest",
|
|
ENDFRAC: "\u283c",
|
|
FRACTION_END: "\u283c",
|
|
SUPER: "\u2818",
|
|
SUB: "\u2830",
|
|
SUP: "\u2818",
|
|
SUPERSCRIPT: "\u2818",
|
|
SUBSCRIPT: "\u2830",
|
|
BASELINE: "\u2810",
|
|
BASE: "\u2810",
|
|
NESTED: "\u2828",
|
|
NEST_ROOT: "Nest",
|
|
STARTROOT: "\u281c",
|
|
ENDROOT: "\u283b",
|
|
ROOTINDEX: "\u2823",
|
|
ROOT: "\u2828",
|
|
INDEX: "\u2823",
|
|
UNDER: "\u2829",
|
|
UNDERSCRIPT: "\u2829",
|
|
OVER: "\u2823",
|
|
OVERSCRIPT: "\u2823",
|
|
},
|
|
MS_FUNC: {
|
|
FRAC_NEST_DEPTH: function (a) {
|
|
return !1;
|
|
},
|
|
RADICAL_NEST_DEPTH: function (a) {
|
|
return "";
|
|
},
|
|
COMBINE_ROOT_INDEX: function (a, b) {
|
|
return a;
|
|
},
|
|
FONT_REGEXP: function (a) {
|
|
return RegExp("^" + a);
|
|
},
|
|
},
|
|
MS_ROOT_INDEX: {},
|
|
FONT: {
|
|
bold: "\u2838",
|
|
"bold-fraktur": "\u2838\u2800\u2838",
|
|
"bold-italic": "\u2838\u2828",
|
|
"bold-script": "\u2838\u2808",
|
|
caligraphic: "\u2808",
|
|
"caligraphic-bold": "\u2808\u2838",
|
|
"double-struck": "\u2838",
|
|
"double-struck-italic": "\u2838\u2828",
|
|
fraktur: "\u2838",
|
|
italic: "\u2828",
|
|
monospace: "",
|
|
normal: "",
|
|
oldstyle: "",
|
|
"oldstyle-bold": "\u2838",
|
|
script: "\u2808",
|
|
"sans-serif": "\u2820\u2828",
|
|
"sans-serif-italic": "\u2820\u2828\u2828",
|
|
"sans-serif-bold": "\u2820\u2828\u2838",
|
|
"sans-serif-bold-italic": "\u2820\u2828\u2838\u2828",
|
|
unknown: "",
|
|
},
|
|
EMBELLISH: {
|
|
super: "\u2818",
|
|
sub: "\u2830",
|
|
circled: ["\u282b\u2809\u2838\u282b", embellishCombiner],
|
|
parenthesized: ["\u2837", parensCombiner],
|
|
period: ["\u2838\u2832", postfixCombiner],
|
|
"negative-circled": ["\u282b\u2838\u2809\u2838\u282b", embellishCombiner],
|
|
"double-circled": [
|
|
"\u282b\u2809\u2838\u282b\u282b\u2809\u2838\u282b",
|
|
doubleEmbellishCombiner,
|
|
],
|
|
"circled-sans-serif": [
|
|
"\u282b\u2809\u2838\u282b\u2820\u2828",
|
|
embellishCombiner,
|
|
],
|
|
"negative-circled-sans-serif": [
|
|
"\u282b\u2838\u2809\u2838\u282b\u2820\u2828",
|
|
embellishCombiner,
|
|
],
|
|
comma: ["\u2820", postfixCombiner],
|
|
squared: ["\u282b\u2832\u2838\u282b", embellishCombiner],
|
|
"negative-squared": ["\u282b\u2838\u2832\u2838\u282b", embellishCombiner],
|
|
},
|
|
ROLE: {
|
|
addition: "addition",
|
|
multiplication: "multiplication",
|
|
subtraction: "subtraction",
|
|
division: "division",
|
|
equality: "equality",
|
|
inequality: "inequality",
|
|
element: "element",
|
|
arrow: "arrow",
|
|
determinant: "determinant",
|
|
rowvector: "row vector",
|
|
binomial: "binomial",
|
|
squarematrix: "square matrix",
|
|
multiline: "multiple lines",
|
|
matrix: "matrix",
|
|
vector: "vector",
|
|
cases: "case statement",
|
|
table: "table",
|
|
unknown: "unknown",
|
|
},
|
|
ENCLOSE: {
|
|
longdiv: "long division",
|
|
actuarial: "actuarial symbol",
|
|
radical: "square root",
|
|
box: "box",
|
|
roundedbox: "rounded box",
|
|
circle: "circle",
|
|
left: "left vertical-line",
|
|
right: "right vertical-line",
|
|
top: "overbar",
|
|
bottom: "underbar",
|
|
updiagonalstrike: "crossout",
|
|
downdiagonalstrike: "crossout",
|
|
verticalstrike: "vertical strikeout",
|
|
horizontalstrike: "crossout",
|
|
madruwb: "Arabic factorial symbol",
|
|
updiagonalarrow: "diagonal arrow",
|
|
phasorangle: "phasor angle",
|
|
unknown: "long division",
|
|
},
|
|
REGEXP: {
|
|
TEXT: "a-zA-Z",
|
|
NUMBER: "((\\d{1,3})(?=(,| ))((,| )\\d{3})*(\\.\\d+)?)|^\\d*\\.\\d+|^\\d+",
|
|
DECIMAL_MARK: ".",
|
|
DIGIT_GROUP: ",",
|
|
JOINER_SUBSUPER: "",
|
|
JOINER_FRAC: "",
|
|
},
|
|
NAVIGATE: {
|
|
COLLAPSIBLE: "collapsible",
|
|
EXPANDABLE: "expandable",
|
|
LEVEL: "Level",
|
|
},
|
|
NUMBERS: sre.Numbers.nemeth.NUMBERS,
|
|
ALPHABETS: {
|
|
latinSmall:
|
|
"\u2801\u2803\u2809\u2819\u2811\u280b\u281b\u2813\u280a\u281a\u2805\u2807\u280d\u281d\u2815\u280f\u281f\u2817\u280e\u281e\u2825\u2827\u283a\u282d\u283d\u2835".split(
|
|
"",
|
|
),
|
|
latinCap:
|
|
"\u2820\u2801 \u2820\u2803 \u2820\u2809 \u2820\u2819 \u2820\u2811 \u2820\u280b \u2820\u281b \u2820\u2813 \u2820\u280a \u2820\u281a \u2820\u2805 \u2820\u2807 \u2820\u280d \u2820\u281d \u2820\u2815 \u2820\u280f \u2820\u281f \u2820\u2817 \u2820\u280e \u2820\u281e \u2820\u2825 \u2820\u2827 \u2820\u283a \u2820\u282d \u2820\u283d \u2820\u2835".split(
|
|
" ",
|
|
),
|
|
greekSmall:
|
|
"\u2828\u282b \u2828\u2801 \u2828\u2803 \u2828\u281b \u2828\u2819 \u2828\u2811 \u2828\u2831 \u2828\u2826 \u2828\u2839 \u2828\u280a \u2828\u2805 \u2828\u2807 \u2828\u280d \u2828\u281d \u2828\u282d \u2828\u2815 \u2828\u280f \u2828\u2817 \u2828\u2812 \u2828\u280e \u2828\u281e \u2828\u2825 \u2828\u280b \u2828\u282f \u2828\u2813 \u2828\u2815 \u2808\u2819 \u2828\u2811 \u2828\u2839 \u2828\u2805 \u2828\u280b \u2828\u2817 \u2828\u280f".split(
|
|
" ",
|
|
),
|
|
greekCap:
|
|
"\u2828\u2820\u2801 \u2828\u2820\u2803 \u2828\u2820\u281b \u2828\u2820\u2819 \u2828\u2820\u2811 \u2828\u2820\u2831 \u2828\u2820\u2823 \u2828\u2820\u2839 \u2828\u2820\u280a \u2828\u2820\u2805 \u2828\u2820\u2807 \u2828\u2820\u280d \u2828\u2820\u281d \u2828\u2820\u282d \u2828\u2820\u2815 \u2828\u2820\u280f \u2828\u2820\u2817 \u2828\u2820\u2839 \u2828\u2820\u280e \u2828\u2820\u2825 \u2828\u2820\u2825 \u2828\u2820\u280b \u2828\u2820\u282f \u2828\u2820\u282b \u2828\u2820\u283a".split(
|
|
" ",
|
|
),
|
|
},
|
|
ALPHABET_TRANSFORMERS: {
|
|
digit: { default: sre.Numbers.nemeth.numberToWords },
|
|
letter: {
|
|
default: function (a) {
|
|
return a;
|
|
},
|
|
},
|
|
},
|
|
ALPHABET_PREFIXES: {
|
|
capPrefix: { default: "" },
|
|
smallPrefix: { default: "" },
|
|
digitPrefix: { default: "\u283c" },
|
|
},
|
|
ALPHABET_COMBINER: function (a, b, c) {
|
|
return b ? b + a : a;
|
|
},
|
|
};
|
|
sre.L10n = {};
|
|
sre.L10n.setLocale = function () {
|
|
var a = sre.L10n.getLocale();
|
|
if (a) for (var b in a) sre.Messages[b] = a[b];
|
|
};
|
|
sre.L10n.getLocale = function () {
|
|
var a = sre.Engine.getInstance().locale;
|
|
-1 === sre.Variables.LOCALES.indexOf(a) &&
|
|
(console.error("Locale " + a + " does not exist! Using en instead."),
|
|
(sre.Engine.getInstance().locale = "en"));
|
|
return sre.Locale[sre.Engine.getInstance().locale] || sre.Locale.en;
|
|
};
|
|
sre.EnrichCase = function () {};
|
|
sre.EnrichCase.prototype.getMathml = function () {};
|
|
sre.AbstractEnrichCase = function (a) {
|
|
this.semantic = a;
|
|
};
|
|
sre.AbstractEnrichCase.prototype.getMathml = goog.abstractMethod;
|
|
sre.EnrichCaseFactory = function () {};
|
|
sre.EnrichCaseFactory.cases = [];
|
|
sre.EnrichCaseFactory.getCase = function (a) {
|
|
for (var b = 0, c; (c = sre.EnrichCaseFactory.cases[b]); b++)
|
|
if (c.test(a)) return new c.constr(a);
|
|
return null;
|
|
};
|
|
sre.SemanticSkeleton = function (a) {
|
|
this.array = a = 0 === a ? a : a || [];
|
|
this.levelsMap = this.parents = null;
|
|
};
|
|
sre.SemanticSkeleton.prototype.populate = function () {
|
|
(this.parents && this.levelsMap) ||
|
|
((this.parents = {}),
|
|
(this.levelsMap = {}),
|
|
this.populate_(this.array, this.array, []));
|
|
};
|
|
sre.SemanticSkeleton.prototype.populate_ = function (a, b, c) {
|
|
if (sre.SemanticSkeleton.simpleCollapseStructure(a))
|
|
(this.levelsMap[a] = b), (this.parents[a] = a === c[0] ? c.slice(1) : c);
|
|
else {
|
|
b = sre.SemanticSkeleton.contentCollapseStructure(a) ? a.slice(1) : a;
|
|
c = [b[0]].concat(c);
|
|
for (var d = 0, e = b.length; d < e; d++) this.populate_(b[d], a, c);
|
|
}
|
|
};
|
|
sre.SemanticSkeleton.prototype.toString = function () {
|
|
return sre.SemanticSkeleton.makeSexp_(this.array);
|
|
};
|
|
sre.SemanticSkeleton.makeSexp_ = function (a) {
|
|
return sre.SemanticSkeleton.simpleCollapseStructure(a)
|
|
? a.toString()
|
|
: sre.SemanticSkeleton.contentCollapseStructure(a)
|
|
? "(c " + a.slice(1).map(sre.SemanticSkeleton.makeSexp_).join(" ") + ")"
|
|
: "(" + a.map(sre.SemanticSkeleton.makeSexp_).join(" ") + ")";
|
|
};
|
|
sre.SemanticSkeleton.fromTree = function (a) {
|
|
return sre.SemanticSkeleton.fromNode(a.root);
|
|
};
|
|
sre.SemanticSkeleton.fromNode = function (a) {
|
|
return new sre.SemanticSkeleton(sre.SemanticSkeleton.fromNode_(a));
|
|
};
|
|
sre.SemanticSkeleton.fromString = function (a) {
|
|
return new sre.SemanticSkeleton(sre.SemanticSkeleton.fromString_(a));
|
|
};
|
|
sre.SemanticSkeleton.fromString_ = function (a) {
|
|
a = a.replace(/\(/g, "[");
|
|
a = a.replace(/\)/g, "]");
|
|
a = a.replace(/ /g, ",");
|
|
a = a.replace(/c/g, '"c"');
|
|
return JSON.parse(a);
|
|
};
|
|
sre.SemanticSkeleton.fromNode_ = function (a) {
|
|
if (!a) return [];
|
|
var b = a.contentNodes;
|
|
if (b.length) {
|
|
var c = b.map(sre.SemanticSkeleton.fromNode_);
|
|
c.unshift("c");
|
|
}
|
|
var d = a.childNodes;
|
|
if (!d.length) return b.length ? [a.id, c] : a.id;
|
|
d = d.map(sre.SemanticSkeleton.fromNode_);
|
|
b.length && d.unshift(c);
|
|
d.unshift(a.id);
|
|
return d;
|
|
};
|
|
sre.SemanticSkeleton.simpleCollapseStructure = function (a) {
|
|
return "number" === typeof a;
|
|
};
|
|
sre.SemanticSkeleton.contentCollapseStructure = function (a) {
|
|
return (
|
|
!!a && !sre.SemanticSkeleton.simpleCollapseStructure(a) && "c" === a[0]
|
|
);
|
|
};
|
|
sre.SemanticSkeleton.interleaveIds = function (a, b) {
|
|
return sre.BaseUtil.interleaveLists(
|
|
sre.SemanticSkeleton.collapsedLeafs(a),
|
|
sre.SemanticSkeleton.collapsedLeafs(b),
|
|
);
|
|
};
|
|
sre.SemanticSkeleton.collapsedLeafs = function (a) {
|
|
var b = function (c) {
|
|
return sre.SemanticSkeleton.simpleCollapseStructure(c)
|
|
? [c]
|
|
: sre.SemanticSkeleton.contentCollapseStructure(c[1])
|
|
? c.slice(2)
|
|
: c.slice(1);
|
|
};
|
|
return Array.prototype.slice.call(arguments, 0).reduce(function (c, d) {
|
|
return c.concat(b(d));
|
|
}, []);
|
|
};
|
|
sre.SemanticSkeleton.fromStructure = function (a, b) {
|
|
return new sre.SemanticSkeleton(sre.SemanticSkeleton.tree_(a, b.root));
|
|
};
|
|
sre.SemanticSkeleton.tree_ = function (a, b) {
|
|
if (!b) return [];
|
|
if (!b.childNodes.length) return b.id;
|
|
var c = b.id,
|
|
d = [c];
|
|
c = sre.XpathUtil.evalXPath(
|
|
".//self::*[@" + sre.EnrichMathml.Attribute.ID + "=" + c + "]",
|
|
a,
|
|
)[0];
|
|
b = sre.SemanticSkeleton.combineContentChildren(
|
|
b,
|
|
b.contentNodes.map(function (f) {
|
|
return f;
|
|
}),
|
|
b.childNodes.map(function (f) {
|
|
return f;
|
|
}),
|
|
);
|
|
c &&
|
|
c.setAttribute(
|
|
sre.EnrichMathml.Attribute.OWNS,
|
|
b
|
|
.map(function (f) {
|
|
return f.id;
|
|
})
|
|
.join(" "),
|
|
);
|
|
c = 0;
|
|
for (var e; (e = b[c]); c++) d.push(sre.SemanticSkeleton.tree_(a, e));
|
|
return d;
|
|
};
|
|
sre.SemanticSkeleton.combineContentChildren = function (a, b, c) {
|
|
switch (a.type) {
|
|
case sre.Semantic.Type.RELSEQ:
|
|
case sre.Semantic.Type.INFIXOP:
|
|
case sre.Semantic.Type.MULTIREL:
|
|
return sre.BaseUtil.interleaveLists(c, b);
|
|
case sre.Semantic.Type.PREFIXOP:
|
|
return b.concat(c);
|
|
case sre.Semantic.Type.POSTFIXOP:
|
|
return c.concat(b);
|
|
case sre.Semantic.Type.FENCED:
|
|
return c.unshift(b[0]), c.push(b[1]), c;
|
|
case sre.Semantic.Type.APPL:
|
|
return [c[0], b[0], c[1]];
|
|
case sre.Semantic.Type.ROOT:
|
|
return [c[1], c[0]];
|
|
case sre.Semantic.Type.ROW:
|
|
case sre.Semantic.Type.LINE:
|
|
return b.length && c.unshift(b[0]), c;
|
|
default:
|
|
return c;
|
|
}
|
|
};
|
|
sre.EnrichMathml = {};
|
|
sre.EnrichMathml.Error = function (a) {
|
|
Error.call(this);
|
|
this.message = a || "";
|
|
this.name = "MathML Enrichment Error";
|
|
};
|
|
goog.inherits(sre.EnrichMathml.Error, Error);
|
|
sre.EnrichMathml.SETTINGS = { collapsed: !0, implicit: !0 };
|
|
sre.EnrichMathml.ATTRIBUTE_PREFIX_ = "data-semantic-";
|
|
sre.EnrichMathml.Attribute = {
|
|
ADDED: sre.EnrichMathml.ATTRIBUTE_PREFIX_ + "added",
|
|
ALTERNATIVE: sre.EnrichMathml.ATTRIBUTE_PREFIX_ + "alternative",
|
|
CHILDREN: sre.EnrichMathml.ATTRIBUTE_PREFIX_ + "children",
|
|
COLLAPSED: sre.EnrichMathml.ATTRIBUTE_PREFIX_ + "collapsed",
|
|
CONTENT: sre.EnrichMathml.ATTRIBUTE_PREFIX_ + "content",
|
|
EMBELLISHED: sre.EnrichMathml.ATTRIBUTE_PREFIX_ + "embellished",
|
|
FENCEPOINTER: sre.EnrichMathml.ATTRIBUTE_PREFIX_ + "fencepointer",
|
|
FONT: sre.EnrichMathml.ATTRIBUTE_PREFIX_ + "font",
|
|
ID: sre.EnrichMathml.ATTRIBUTE_PREFIX_ + "id",
|
|
ANNOTATION: sre.EnrichMathml.ATTRIBUTE_PREFIX_ + "annotation",
|
|
OPERATOR: sre.EnrichMathml.ATTRIBUTE_PREFIX_ + "operator",
|
|
OWNS: sre.EnrichMathml.ATTRIBUTE_PREFIX_ + "owns",
|
|
PARENT: sre.EnrichMathml.ATTRIBUTE_PREFIX_ + "parent",
|
|
PREFIX: sre.EnrichMathml.ATTRIBUTE_PREFIX_ + "prefix",
|
|
ROLE: sre.EnrichMathml.ATTRIBUTE_PREFIX_ + "role",
|
|
SPEECH: sre.EnrichMathml.ATTRIBUTE_PREFIX_ + "speech",
|
|
STRUCTURE: sre.EnrichMathml.ATTRIBUTE_PREFIX_ + "structure",
|
|
TYPE: sre.EnrichMathml.ATTRIBUTE_PREFIX_ + "type",
|
|
};
|
|
sre.EnrichMathml.enrich = function (a, b) {
|
|
var c = a.cloneNode(!0);
|
|
sre.EnrichMathml.walkTree(b.root);
|
|
sre.Engine.getInstance().structure &&
|
|
a.setAttribute(
|
|
sre.EnrichMathml.Attribute.STRUCTURE,
|
|
sre.SemanticSkeleton.fromStructure(a, b).toString(),
|
|
);
|
|
sre.Debugger.getInstance().generateOutput(function () {
|
|
sre.EnrichMathml.formattedOutput(c, a, b, !0);
|
|
return [];
|
|
});
|
|
return a;
|
|
};
|
|
sre.EnrichMathml.walkTree = function (a) {
|
|
var b = sre.EnrichCaseFactory.getCase(a);
|
|
if (b) return (b = b.getMathml()), sre.EnrichMathml.ascendNewNode(b);
|
|
if (1 === a.mathml.length)
|
|
return (
|
|
sre.Debugger.getInstance().output("Walktree Case 0"),
|
|
(b = a.mathml[0]),
|
|
sre.EnrichMathml.setAttributes(b, a),
|
|
sre.EnrichMathml.ascendNewNode(b)
|
|
);
|
|
b = a.contentNodes.map(sre.EnrichMathml.cloneContentNode);
|
|
sre.EnrichMathml.setOperatorAttribute_(a, b);
|
|
var c = a.childNodes.map(sre.EnrichMathml.walkTree);
|
|
c = sre.SemanticSkeleton.combineContentChildren(a, b, c);
|
|
b = a.mathmlTree;
|
|
if (null === b)
|
|
sre.Debugger.getInstance().output("Walktree Case 1"),
|
|
(b = sre.EnrichMathml.introduceNewLayer(c));
|
|
else {
|
|
var d = sre.EnrichMathml.attachedElement_(c);
|
|
sre.Debugger.getInstance().output("Walktree Case 2");
|
|
d
|
|
? (sre.Debugger.getInstance().output("Walktree Case 2.1"),
|
|
(b = d.parentNode))
|
|
: (sre.Debugger.getInstance().output("Walktree Case 2.2"),
|
|
(b = sre.EnrichMathml.getInnerNode(b)));
|
|
}
|
|
b = sre.EnrichMathml.rewriteMfenced(b);
|
|
sre.EnrichMathml.mergeChildren_(b, c);
|
|
sre.EnrichMathml.setAttributes(b, a);
|
|
return sre.EnrichMathml.ascendNewNode(b);
|
|
};
|
|
sre.EnrichMathml.introduceNewLayer = function (a) {
|
|
var b = sre.EnrichMathml.mathmlLca_(a),
|
|
c = b.node,
|
|
d = b.type;
|
|
(d === sre.EnrichMathml.lcaType.VALID && sre.SemanticUtil.hasEmptyTag(c)) ||
|
|
(sre.Debugger.getInstance().output("Walktree Case 1.1"),
|
|
(c = sre.DomUtil.createElement("mrow")),
|
|
d === sre.EnrichMathml.lcaType.PRUNED
|
|
? (sre.Debugger.getInstance().output("Walktree Case 1.1.0"),
|
|
(c = sre.EnrichMathml.introduceLayerAboveLca(c, b.node, a)))
|
|
: a[0] &&
|
|
(sre.Debugger.getInstance().output("Walktree Case 1.1.1"),
|
|
(b = sre.EnrichMathml.attachedElement_(a)),
|
|
(a = sre.EnrichMathml.childrenSubset_(b.parentNode, a)),
|
|
sre.DomUtil.replaceNode(b, c),
|
|
a.forEach(function (e) {
|
|
c.appendChild(e);
|
|
})));
|
|
return c;
|
|
};
|
|
sre.EnrichMathml.introduceLayerAboveLca = function (a, b, c) {
|
|
var d = sre.EnrichMathml.descendNode_(b);
|
|
if (sre.SemanticUtil.hasMathTag(d)) {
|
|
sre.Debugger.getInstance().output("Walktree Case 1.1.0.0");
|
|
sre.EnrichMathml.moveSemanticAttributes_(d, a);
|
|
sre.DomUtil.toArray(d.childNodes).forEach(function (f) {
|
|
a.appendChild(f);
|
|
});
|
|
var e = a;
|
|
a = d;
|
|
d = e;
|
|
}
|
|
b = c.indexOf(b);
|
|
c[b] = d;
|
|
sre.DomUtil.replaceNode(d, a);
|
|
a.appendChild(d);
|
|
c.forEach(function (f) {
|
|
a.appendChild(f);
|
|
});
|
|
return a;
|
|
};
|
|
sre.EnrichMathml.moveSemanticAttributes_ = function (a, b) {
|
|
for (var c in sre.EnrichMathml.Attribute) {
|
|
var d = sre.EnrichMathml.Attribute[c];
|
|
a.hasAttribute(d) &&
|
|
(b.setAttribute(d, a.getAttribute(d)), a.removeAttribute(d));
|
|
}
|
|
};
|
|
sre.EnrichMathml.childrenSubset_ = function (a, b) {
|
|
var c = sre.DomUtil.toArray(a.childNodes),
|
|
d = Infinity,
|
|
e = -Infinity;
|
|
b.forEach(function (f) {
|
|
f = c.indexOf(f);
|
|
-1 !== f && ((d = Math.min(d, f)), (e = Math.max(e, f)));
|
|
});
|
|
return c.slice(d, e + 1);
|
|
};
|
|
sre.EnrichMathml.mergeChildren_ = function (a, b) {
|
|
var c = a.childNodes;
|
|
if (c.length)
|
|
for (var d = 0; b.length; )
|
|
c[d] === b[0] || sre.EnrichMathml.functionApplication_(c[d], b[0])
|
|
? (b.shift(), d++)
|
|
: c[d] && -1 === b.indexOf(c[d])
|
|
? d++
|
|
: (sre.EnrichMathml.isDescendant_(b[0], a) ||
|
|
a.insertBefore(b[0], c[d] || null),
|
|
b.shift());
|
|
else
|
|
b.forEach(function (e) {
|
|
a.appendChild(e);
|
|
});
|
|
};
|
|
sre.EnrichMathml.isDescendant_ = function (a, b) {
|
|
if (!a) return !1;
|
|
do if (((a = a.parentNode), a === b)) return !0;
|
|
while (a);
|
|
return !1;
|
|
};
|
|
sre.EnrichMathml.functionApplication_ = function (a, b) {
|
|
var c = sre.SemanticAttr.functionApplication();
|
|
if (
|
|
a &&
|
|
b &&
|
|
a.textContent &&
|
|
b.textContent &&
|
|
a.textContent === c &&
|
|
b.textContent === c &&
|
|
"true" === b.getAttribute(sre.EnrichMathml.Attribute.ADDED)
|
|
) {
|
|
c = 0;
|
|
for (var d; (d = a.attributes[c]); c++)
|
|
b.hasAttribute(d.nodeName) || b.setAttribute(d.nodeName, d.nodeValue);
|
|
sre.DomUtil.replaceNode(a, b);
|
|
return !0;
|
|
}
|
|
return !1;
|
|
};
|
|
sre.EnrichMathml.lcaType = {
|
|
VALID: "valid",
|
|
INVALID: "invalid",
|
|
PRUNED: "pruned",
|
|
};
|
|
sre.EnrichMathml.mathmlLca_ = function (a) {
|
|
var b = sre.EnrichMathml.attachedElement_(a);
|
|
if (!b) return { type: sre.EnrichMathml.lcaType.INVALID, node: null };
|
|
var c = sre.EnrichMathml.attachedElement_(a.slice().reverse());
|
|
if (b === c) return { type: sre.EnrichMathml.lcaType.VALID, node: b };
|
|
b = sre.EnrichMathml.pathToRoot_(b);
|
|
var d = sre.EnrichMathml.prunePath_(b, a);
|
|
a = sre.EnrichMathml.pathToRoot_(c, function (f) {
|
|
return -1 !== d.indexOf(f);
|
|
});
|
|
c = a[0];
|
|
var e = d.indexOf(c);
|
|
return -1 === e
|
|
? { type: sre.EnrichMathml.lcaType.INVALID, node: null }
|
|
: {
|
|
type:
|
|
d.length !== b.length
|
|
? sre.EnrichMathml.lcaType.PRUNED
|
|
: sre.EnrichMathml.validLca_(d[e + 1], a[1])
|
|
? sre.EnrichMathml.lcaType.VALID
|
|
: sre.EnrichMathml.lcaType.INVALID,
|
|
node: c,
|
|
};
|
|
};
|
|
sre.EnrichMathml.prunePath_ = function (a, b) {
|
|
for (var c = 0; a[c] && -1 === b.indexOf(a[c]); ) c++;
|
|
return a.slice(0, c + 1);
|
|
};
|
|
sre.EnrichMathml.attachedElement_ = function (a) {
|
|
for (var b = 0, c = null; !c && b < a.length; )
|
|
a[b].parentNode && (c = a[b]), b++;
|
|
return c;
|
|
};
|
|
sre.EnrichMathml.pathToRoot_ = function (a, b) {
|
|
b =
|
|
b ||
|
|
function (d) {
|
|
return !1;
|
|
};
|
|
for (var c = [a]; !b(a) && !sre.SemanticUtil.hasMathTag(a) && a.parentNode; )
|
|
(a = sre.EnrichMathml.parentNode_(a)), c.unshift(a);
|
|
return c;
|
|
};
|
|
sre.EnrichMathml.validLca_ = function (a, b) {
|
|
return !(!a || !b || a.previousSibling || b.nextSibling);
|
|
};
|
|
sre.EnrichMathml.ascendNewNode = function (a) {
|
|
for (; !sre.SemanticUtil.hasMathTag(a) && sre.EnrichMathml.unitChild_(a); )
|
|
a = sre.EnrichMathml.parentNode_(a);
|
|
return a;
|
|
};
|
|
sre.EnrichMathml.descendNode_ = function (a) {
|
|
var b = sre.DomUtil.toArray(a.childNodes);
|
|
if (!b) return a;
|
|
b = b.filter(function (c) {
|
|
return (
|
|
c.nodeType === sre.DomUtil.NodeType.ELEMENT_NODE &&
|
|
!sre.SemanticUtil.hasIgnoreTag(c)
|
|
);
|
|
});
|
|
return 1 === b.length &&
|
|
sre.SemanticUtil.hasEmptyTag(b[0]) &&
|
|
!b[0].hasAttribute(sre.EnrichMathml.Attribute.TYPE)
|
|
? sre.EnrichMathml.descendNode_(b[0])
|
|
: a;
|
|
};
|
|
sre.EnrichMathml.unitChild_ = function (a) {
|
|
var b = sre.EnrichMathml.parentNode_(a);
|
|
return b && sre.SemanticUtil.hasEmptyTag(b)
|
|
? sre.DomUtil.toArray(b.childNodes).every(function (c) {
|
|
return c === a || sre.EnrichMathml.isIgnorable_(c);
|
|
})
|
|
: !1;
|
|
};
|
|
sre.EnrichMathml.isIgnorable_ = function (a) {
|
|
if (!a || sre.SemanticUtil.hasIgnoreTag(a)) return !0;
|
|
var b = sre.DomUtil.toArray(a.childNodes);
|
|
return !sre.SemanticUtil.hasEmptyTag(a) && b.length
|
|
? !1
|
|
: sre.DomUtil.toArray(a.childNodes).every(sre.EnrichMathml.isIgnorable_);
|
|
};
|
|
sre.EnrichMathml.parentNode_ = function (a) {
|
|
return a.parentNode;
|
|
};
|
|
sre.EnrichMathml.addCollapsedAttribute = function (a, b) {
|
|
b = new sre.SemanticSkeleton(b);
|
|
a.setAttribute(sre.EnrichMathml.Attribute.COLLAPSED, b.toString());
|
|
};
|
|
sre.EnrichMathml.cloneContentNode = function (a) {
|
|
if (a.mathml.length) return sre.EnrichMathml.walkTree(a);
|
|
var b = sre.EnrichMathml.SETTINGS.implicit
|
|
? sre.EnrichMathml.createInvisibleOperator_(a)
|
|
: sre.DomUtil.createElement("mrow");
|
|
a.mathml = [b];
|
|
return b;
|
|
};
|
|
sre.EnrichMathml.makeIdList = function (a) {
|
|
return a
|
|
.map(function (b) {
|
|
return b.id;
|
|
})
|
|
.join(",");
|
|
};
|
|
sre.EnrichMathml.setAttributes = function (a, b) {
|
|
a.setAttribute(sre.EnrichMathml.Attribute.TYPE, b.type);
|
|
for (var c = b.allAttributes(), d = 0, e; (e = c[d]); d++)
|
|
a.setAttribute(sre.EnrichMathml.Attribute[e[0].toUpperCase()], e[1]);
|
|
b.childNodes.length &&
|
|
a.setAttribute(
|
|
sre.EnrichMathml.Attribute.CHILDREN,
|
|
sre.EnrichMathml.makeIdList(b.childNodes),
|
|
);
|
|
b.contentNodes.length &&
|
|
a.setAttribute(
|
|
sre.EnrichMathml.Attribute.CONTENT,
|
|
sre.EnrichMathml.makeIdList(b.contentNodes),
|
|
);
|
|
b.parent && a.setAttribute(sre.EnrichMathml.Attribute.PARENT, b.parent.id);
|
|
};
|
|
sre.EnrichMathml.rewriteMfenced = function (a) {
|
|
if ("MFENCED" !== sre.DomUtil.tagName(a)) return a;
|
|
for (
|
|
var b = sre.DomUtil.createElement("mrow"), c = 0, d;
|
|
(d = a.attributes[c]);
|
|
c++
|
|
)
|
|
-1 === ["open", "close", "separators"].indexOf(d.name) &&
|
|
b.setAttribute(d.name, d.value);
|
|
sre.DomUtil.toArray(a.childNodes).forEach(function (e) {
|
|
b.appendChild(e);
|
|
});
|
|
sre.DomUtil.replaceNode(a, b);
|
|
return b;
|
|
};
|
|
sre.EnrichMathml.createInvisibleOperator_ = function (a) {
|
|
var b = sre.DomUtil.createElement("mo"),
|
|
c = sre.DomUtil.createTextNode(a.textContent);
|
|
b.appendChild(c);
|
|
sre.EnrichMathml.setAttributes(b, a);
|
|
b.setAttribute(sre.EnrichMathml.Attribute.ADDED, "true");
|
|
return b;
|
|
};
|
|
sre.EnrichMathml.setOperatorAttribute_ = function (a, b) {
|
|
var c = a.type + (a.textContent ? "," + a.textContent : "");
|
|
b.forEach(function (d) {
|
|
sre.EnrichMathml.getInnerNode(d).setAttribute(
|
|
sre.EnrichMathml.Attribute.OPERATOR,
|
|
c,
|
|
);
|
|
});
|
|
};
|
|
sre.EnrichMathml.getInnerNode = function (a) {
|
|
var b = sre.DomUtil.toArray(a.childNodes);
|
|
if (!b) return a;
|
|
b = b.filter(function (g) {
|
|
return (
|
|
g.nodeType === sre.DomUtil.NodeType.ELEMENT_NODE &&
|
|
!sre.EnrichMathml.isIgnorable_(g)
|
|
);
|
|
});
|
|
for (var c = [], d = 0, e; (e = b[d]); d++)
|
|
if (sre.SemanticUtil.hasEmptyTag(e)) {
|
|
var f = sre.EnrichMathml.getInnerNode(e);
|
|
f && f !== e && c.push(f);
|
|
} else c.push(e);
|
|
return 1 === c.length ? c[0] : a;
|
|
};
|
|
sre.EnrichMathml.formattedOutput = function (a, b, c, d) {
|
|
d = d || !1;
|
|
sre.EnrichMathml.formattedOutput_(a, "Original MathML", d);
|
|
sre.EnrichMathml.formattedOutput_(c, "Semantic Tree", d);
|
|
sre.EnrichMathml.formattedOutput_(b, "Semantically enriched MathML", d);
|
|
};
|
|
sre.EnrichMathml.formattedOutput_ = function (a, b, c) {
|
|
a = sre.DomUtil.formatXml(a.toString());
|
|
c
|
|
? console.info(
|
|
b +
|
|
":\n```html\n" +
|
|
sre.EnrichMathml.removeAttributePrefix(a) +
|
|
"\n```\n",
|
|
)
|
|
: console.info(a);
|
|
};
|
|
sre.EnrichMathml.removeAttributePrefix = function (a) {
|
|
return a
|
|
.toString()
|
|
.replace(new RegExp(sre.EnrichMathml.ATTRIBUTE_PREFIX_, "g"), "");
|
|
};
|
|
sre.EnrichMathml.addPrefix = function (a) {
|
|
var b = a.toUpperCase();
|
|
return (
|
|
sre.EnrichMathml.Attribute[b] || sre.EnrichMathml.ATTRIBUTE_PREFIX_ + a
|
|
);
|
|
};
|
|
sre.EnrichMathml.collapsePunctuated = function (a, b) {
|
|
var c = !!b;
|
|
b = b || [];
|
|
var d = a.parent,
|
|
e = a.contentNodes.map(function (k) {
|
|
return k.id;
|
|
});
|
|
e.unshift("c");
|
|
e = [a.id, e];
|
|
for (var f = 0, g; (g = a.childNodes[f]); f++) {
|
|
var h = sre.EnrichMathml.walkTree(g);
|
|
b.push(h);
|
|
h = sre.EnrichMathml.getInnerNode(h);
|
|
d && !c && h.setAttribute(sre.EnrichMathml.Attribute.PARENT, d.id);
|
|
e.push(g.id);
|
|
}
|
|
return e;
|
|
};
|
|
sre.EnrichMathml.printNodeList__ = function (a, b) {
|
|
console.info(a);
|
|
sre.DomUtil.toArray(b).forEach(function (c) {
|
|
console.info(c.toString());
|
|
});
|
|
console.info("<<<<<<<<<<<<<<<<<");
|
|
};
|
|
sre.CaseBinomial = function (a) {
|
|
sre.AbstractEnrichCase.call(this, a);
|
|
this.mml = a.mathmlTree;
|
|
};
|
|
goog.inherits(sre.CaseBinomial, sre.AbstractEnrichCase);
|
|
sre.CaseBinomial.test = function (a) {
|
|
return (
|
|
!a.mathmlTree &&
|
|
a.type === sre.SemanticAttr.Type.LINE &&
|
|
a.role === sre.SemanticAttr.Role.BINOMIAL
|
|
);
|
|
};
|
|
sre.CaseBinomial.prototype.getMathml = function () {
|
|
if (!this.semantic.childNodes.length) return this.mml;
|
|
this.mml = sre.EnrichMathml.walkTree(this.semantic.childNodes[0]);
|
|
if (this.mml.hasAttribute(sre.EnrichMathml.Attribute.TYPE)) {
|
|
var a = sre.DomUtil.createElement("mrow");
|
|
a.setAttribute(sre.EnrichMathml.Attribute.ADDED, "true");
|
|
sre.DomUtil.replaceNode(this.mml, a);
|
|
a.appendChild(this.mml);
|
|
this.mml = a;
|
|
}
|
|
sre.EnrichMathml.setAttributes(this.mml, this.semantic);
|
|
return this.mml;
|
|
};
|
|
sre.CaseDoubleScript = function (a) {
|
|
sre.AbstractEnrichCase.call(this, a);
|
|
this.mml = a.mathmlTree;
|
|
};
|
|
goog.inherits(sre.CaseDoubleScript, sre.AbstractEnrichCase);
|
|
sre.CaseDoubleScript.test = function (a) {
|
|
if (!a.mathmlTree || !a.childNodes.length) return !1;
|
|
var b = sre.DomUtil.tagName(a.mathmlTree);
|
|
a = a.childNodes[0].role;
|
|
return (
|
|
("MSUBSUP" === b && a === sre.SemanticAttr.Role.SUBSUP) ||
|
|
("MUNDEROVER" === b && a === sre.SemanticAttr.Role.UNDEROVER)
|
|
);
|
|
};
|
|
sre.CaseDoubleScript.prototype.getMathml = function () {
|
|
var a = this.semantic.childNodes[0],
|
|
b = a.childNodes[0],
|
|
c = this.semantic.childNodes[1],
|
|
d = a.childNodes[1],
|
|
e = sre.EnrichMathml.walkTree(c),
|
|
f = sre.EnrichMathml.walkTree(b),
|
|
g = sre.EnrichMathml.walkTree(d);
|
|
sre.EnrichMathml.setAttributes(this.mml, this.semantic);
|
|
this.mml.setAttribute(
|
|
sre.EnrichMathml.Attribute.CHILDREN,
|
|
sre.EnrichMathml.makeIdList([b, d, c]),
|
|
);
|
|
[f, g, e].forEach(
|
|
goog.bind(function (h) {
|
|
sre.EnrichMathml.getInnerNode(h).setAttribute(
|
|
sre.EnrichMathml.Attribute.PARENT,
|
|
this.mml.getAttribute(sre.EnrichMathml.Attribute.ID),
|
|
);
|
|
}, this),
|
|
);
|
|
this.mml.setAttribute(sre.EnrichMathml.Attribute.TYPE, a.role);
|
|
sre.EnrichMathml.addCollapsedAttribute(this.mml, [
|
|
this.semantic.id,
|
|
[a.id, b.id, d.id],
|
|
c.id,
|
|
]);
|
|
return this.mml;
|
|
};
|
|
sre.CaseMultiindex = function (a) {
|
|
sre.AbstractEnrichCase.call(this, a);
|
|
this.mml = a.mathmlTree;
|
|
};
|
|
goog.inherits(sre.CaseMultiindex, sre.AbstractEnrichCase);
|
|
sre.CaseMultiindex.prototype.completeMultiscript = function (a, b) {
|
|
var c = sre.DomUtil.toArray(this.mml.childNodes).slice(1),
|
|
d = 0,
|
|
e = goog.bind(function (f) {
|
|
for (var g = 0, h; (h = f[g]); g++) {
|
|
var k = c[d];
|
|
if (
|
|
k &&
|
|
h ==
|
|
sre.EnrichMathml.getInnerNode(k).getAttribute(
|
|
sre.EnrichMathml.Attribute.ID,
|
|
)
|
|
)
|
|
sre.EnrichMathml.getInnerNode(k).setAttribute(
|
|
sre.EnrichMathml.Attribute.PARENT,
|
|
this.semantic.id,
|
|
),
|
|
d++;
|
|
else {
|
|
var l = this.semantic.querySelectorAll(function (m) {
|
|
return m.id === h;
|
|
});
|
|
this.mml.insertBefore(
|
|
sre.CaseMultiindex.createNone_(l[0]),
|
|
k || null,
|
|
);
|
|
}
|
|
}
|
|
}, this);
|
|
e(a);
|
|
c[d] && "MPRESCRIPTS" !== sre.DomUtil.tagName(c[d])
|
|
? this.mml.insertBefore(c[d], sre.DomUtil.createElement("mprescripts"))
|
|
: d++;
|
|
e(b);
|
|
};
|
|
sre.CaseMultiindex.createNone_ = function (a) {
|
|
var b = sre.DomUtil.createElement("none");
|
|
a && sre.EnrichMathml.setAttributes(b, a);
|
|
b.setAttribute(sre.EnrichMathml.Attribute.ADDED, "true");
|
|
return b;
|
|
};
|
|
sre.CaseMultiindex.multiscriptIndex = function (a) {
|
|
if (
|
|
a.type === sre.SemanticAttr.Type.PUNCTUATED &&
|
|
a.contentNodes[0].role === sre.SemanticAttr.Role.DUMMY
|
|
)
|
|
return sre.EnrichMathml.collapsePunctuated(a);
|
|
sre.EnrichMathml.walkTree(a);
|
|
return a.id;
|
|
};
|
|
sre.CaseMultiscripts = function (a) {
|
|
sre.CaseMultiindex.call(this, a);
|
|
};
|
|
goog.inherits(sre.CaseMultiscripts, sre.CaseMultiindex);
|
|
sre.CaseMultiscripts.test = function (a) {
|
|
return a.mathmlTree
|
|
? "MMULTISCRIPTS" === sre.DomUtil.tagName(a.mathmlTree) &&
|
|
(a.type === sre.SemanticAttr.Type.SUPERSCRIPT ||
|
|
a.type === sre.SemanticAttr.Type.SUBSCRIPT)
|
|
: !1;
|
|
};
|
|
sre.CaseMultiscripts.prototype.getMathml = function () {
|
|
sre.EnrichMathml.setAttributes(this.mml, this.semantic);
|
|
if (
|
|
this.semantic.childNodes[0] &&
|
|
this.semantic.childNodes[0].role === sre.SemanticAttr.Role.SUBSUP
|
|
) {
|
|
var a = this.semantic.childNodes[0],
|
|
b = a.childNodes[0],
|
|
c = sre.CaseMultiindex.multiscriptIndex(this.semantic.childNodes[1]),
|
|
d = sre.CaseMultiindex.multiscriptIndex(a.childNodes[1]),
|
|
e = [this.semantic.id, [a.id, b.id, d], c];
|
|
sre.EnrichMathml.addCollapsedAttribute(this.mml, e);
|
|
this.mml.setAttribute(sre.EnrichMathml.Attribute.TYPE, a.role);
|
|
this.completeMultiscript(sre.SemanticSkeleton.interleaveIds(d, c), []);
|
|
} else
|
|
(b = this.semantic.childNodes[0]),
|
|
(c = sre.CaseMultiindex.multiscriptIndex(this.semantic.childNodes[1])),
|
|
(e = [this.semantic.id, b.id, c]),
|
|
sre.EnrichMathml.addCollapsedAttribute(this.mml, e);
|
|
a = sre.SemanticSkeleton.collapsedLeafs(d || [], c);
|
|
c = sre.EnrichMathml.walkTree(b);
|
|
sre.EnrichMathml.getInnerNode(c).setAttribute(
|
|
sre.EnrichMathml.Attribute.PARENT,
|
|
this.semantic.id,
|
|
);
|
|
a.unshift(b.id);
|
|
this.mml.setAttribute(sre.EnrichMathml.Attribute.CHILDREN, a.join(","));
|
|
return this.mml;
|
|
};
|
|
sre.CaseEmbellished = function (a) {
|
|
sre.AbstractEnrichCase.call(this, a);
|
|
this.ofenceMml = this.ofence = this.fencedMml = this.fenced = null;
|
|
this.ofenceMap = {};
|
|
this.cfenceMml = this.cfence = null;
|
|
this.cfenceMap = {};
|
|
this.parentCleanup = [];
|
|
};
|
|
goog.inherits(sre.CaseEmbellished, sre.AbstractEnrichCase);
|
|
sre.CaseEmbellished.test = function (a) {
|
|
return !(!a.mathmlTree || !a.fencePointer);
|
|
};
|
|
sre.CaseEmbellished.prototype.getMathml = function () {
|
|
this.getFenced_();
|
|
this.fencedMml = sre.EnrichMathml.walkTree(this.fenced);
|
|
this.getFencesMml_();
|
|
return this.rewrite_();
|
|
};
|
|
sre.CaseEmbellished.prototype.getFenced_ = function () {
|
|
for (var a = this.semantic; a.type !== sre.SemanticAttr.Type.FENCED; )
|
|
a = a.childNodes[0];
|
|
this.fenced = a.childNodes[0];
|
|
this.ofence = a.contentNodes[0];
|
|
this.cfence = a.contentNodes[1];
|
|
sre.CaseEmbellished.fencedMap_(this.ofence, this.ofenceMap);
|
|
sre.CaseEmbellished.fencedMap_(this.cfence, this.cfenceMap);
|
|
};
|
|
sre.CaseEmbellished.fencedMap_ = function (a, b) {
|
|
b[a.id] = a.mathmlTree;
|
|
a.embellished && sre.CaseEmbellished.fencedMap_(a.childNodes[0], b);
|
|
};
|
|
sre.CaseEmbellished.prototype.getFencesMml_ = function () {
|
|
for (
|
|
var a = this.semantic,
|
|
b = Object.keys(this.ofenceMap),
|
|
c = Object.keys(this.cfenceMap);
|
|
!((this.ofenceMml && this.cfenceMml) || a === this.fenced);
|
|
)
|
|
-1 === b.indexOf(a.fencePointer) ||
|
|
this.ofenceMml ||
|
|
(this.ofenceMml = a.mathmlTree),
|
|
-1 === c.indexOf(a.fencePointer) ||
|
|
this.cfenceMml ||
|
|
(this.cfenceMml = a.mathmlTree),
|
|
(a = a.childNodes[0]);
|
|
this.ofenceMml || (this.ofenceMml = this.ofence.mathmlTree);
|
|
this.cfenceMml || (this.cfenceMml = this.cfence.mathmlTree);
|
|
this.ofenceMml &&
|
|
(this.ofenceMml = sre.EnrichMathml.ascendNewNode(this.ofenceMml));
|
|
this.cfenceMml &&
|
|
(this.cfenceMml = sre.EnrichMathml.ascendNewNode(this.cfenceMml));
|
|
};
|
|
sre.CaseEmbellished.prototype.rewrite_ = function () {
|
|
var a = this.semantic,
|
|
b = null,
|
|
c = this.introduceNewLayer_();
|
|
for (
|
|
sre.EnrichMathml.setAttributes(c, this.fenced.parent);
|
|
a.type !== sre.SemanticAttr.Type.FENCED;
|
|
) {
|
|
var d = a.mathmlTree,
|
|
e = this.specialCase_(a, d);
|
|
if (e) a = e;
|
|
else {
|
|
sre.EnrichMathml.setAttributes(d, a);
|
|
e = [];
|
|
for (var f = 1, g; (g = a.childNodes[f]); f++)
|
|
e.push(sre.EnrichMathml.walkTree(g));
|
|
a = a.childNodes[0];
|
|
}
|
|
e = sre.DomUtil.createElement("dummy");
|
|
f = c.parentNode;
|
|
g = d.childNodes[0];
|
|
sre.DomUtil.replaceNode(d, e);
|
|
sre.DomUtil.replaceNode(c, d);
|
|
sre.DomUtil.replaceNode(d.childNodes[0], c);
|
|
sre.DomUtil.replaceNode(e, g);
|
|
d.parentNode = f;
|
|
c = d.childNodes[0];
|
|
b || (b = d);
|
|
}
|
|
sre.EnrichMathml.walkTree(this.ofence);
|
|
sre.EnrichMathml.walkTree(this.cfence);
|
|
this.cleanupParents_();
|
|
return b || c;
|
|
};
|
|
sre.CaseEmbellished.prototype.specialCase_ = function (a, b) {
|
|
var c = sre.DomUtil.tagName(b),
|
|
d = null;
|
|
if ("MSUBSUP" === c) {
|
|
d = a.childNodes[0];
|
|
var e = sre.CaseDoubleScript;
|
|
} else
|
|
"MMULTISCRIPTS" === c &&
|
|
(a.type === sre.SemanticAttr.Type.SUPERSCRIPT ||
|
|
a.type === sre.SemanticAttr.Type.SUBSCRIPT
|
|
? (e = sre.CaseMultiscripts)
|
|
: a.type === sre.SemanticAttr.Type.TENSOR && (e = sre.CaseTensor),
|
|
(d =
|
|
e &&
|
|
a.childNodes[0] &&
|
|
a.childNodes[0].role === sre.SemanticAttr.Role.SUBSUP
|
|
? a.childNodes[0]
|
|
: a));
|
|
if (!d) return null;
|
|
c = d.childNodes[0];
|
|
b = sre.CaseEmbellished.makeEmptyNode_(c.id);
|
|
d.childNodes[0] = b;
|
|
b = new e(a).getMathml();
|
|
d.childNodes[0] = c;
|
|
this.parentCleanup.push(b);
|
|
return d.childNodes[0];
|
|
};
|
|
sre.CaseEmbellished.makeEmptyNode_ = function (a) {
|
|
var b = sre.DomUtil.createElement("mrow");
|
|
a = new sre.SemanticNode(a);
|
|
a.type = sre.SemanticAttr.Type.EMPTY;
|
|
a.mathmlTree = b;
|
|
return a;
|
|
};
|
|
sre.CaseEmbellished.prototype.introduceNewLayer_ = function () {
|
|
var a = this.fullFence(this.ofenceMml),
|
|
b = this.fullFence(this.cfenceMml),
|
|
c = sre.DomUtil.createElement("mrow");
|
|
sre.DomUtil.replaceNode(this.fencedMml, c);
|
|
c.appendChild(this.fencedMml);
|
|
c.insertBefore(a, this.fencedMml);
|
|
c.appendChild(b);
|
|
if (!c.parentNode) {
|
|
for (a = sre.DomUtil.createElement("mrow"); 0 < c.childNodes.length; )
|
|
a.appendChild(c.childNodes[0]);
|
|
c.appendChild(a);
|
|
c = a;
|
|
}
|
|
return c;
|
|
};
|
|
sre.CaseEmbellished.prototype.fullFence = function (a) {
|
|
for (var b = this.fencedMml.parentNode; a.parentNode && a.parentNode !== b; )
|
|
a = a.parentNode;
|
|
return a;
|
|
};
|
|
sre.CaseEmbellished.prototype.cleanupParents_ = function () {
|
|
this.parentCleanup.forEach(function (a) {
|
|
var b = a.childNodes[1].getAttribute(sre.EnrichMathml.Attribute.PARENT);
|
|
a.childNodes[0].setAttribute(sre.EnrichMathml.Attribute.PARENT, b);
|
|
});
|
|
};
|
|
sre.CaseLine = function (a) {
|
|
sre.AbstractEnrichCase.call(this, a);
|
|
this.mml = a.mathmlTree;
|
|
};
|
|
goog.inherits(sre.CaseLine, sre.AbstractEnrichCase);
|
|
sre.CaseLine.test = function (a) {
|
|
return !!a.mathmlTree && a.type === sre.SemanticAttr.Type.LINE;
|
|
};
|
|
sre.CaseLine.prototype.getMathml = function () {
|
|
this.semantic.contentNodes.length &&
|
|
sre.EnrichMathml.walkTree(this.semantic.contentNodes[0]);
|
|
this.semantic.childNodes.length &&
|
|
sre.EnrichMathml.walkTree(this.semantic.childNodes[0]);
|
|
sre.EnrichMathml.setAttributes(this.mml, this.semantic);
|
|
return this.mml;
|
|
};
|
|
sre.CaseProof = function (a) {
|
|
sre.AbstractEnrichCase.call(this, a);
|
|
this.mml = a.mathmlTree;
|
|
};
|
|
goog.inherits(sre.CaseProof, sre.AbstractEnrichCase);
|
|
sre.CaseProof.test = function (a) {
|
|
return (
|
|
!!a.mathmlTree &&
|
|
(a.type === sre.SemanticAttr.Type.INFERENCE ||
|
|
a.type === sre.SemanticAttr.Type.PREMISES)
|
|
);
|
|
};
|
|
sre.CaseProof.prototype.getMathml = function () {
|
|
if (!this.semantic.childNodes.length) return this.mml;
|
|
this.semantic.contentNodes.forEach(function (a) {
|
|
sre.EnrichMathml.walkTree(a);
|
|
sre.EnrichMathml.setAttributes(a.mathmlTree, a);
|
|
});
|
|
this.semantic.childNodes.forEach(function (a) {
|
|
sre.EnrichMathml.walkTree(a);
|
|
});
|
|
sre.EnrichMathml.setAttributes(this.mml, this.semantic);
|
|
this.mml.getAttribute("data-semantic-id") ===
|
|
this.mml.getAttribute("data-semantic-parent") &&
|
|
this.mml.removeAttribute("data-semantic-parent");
|
|
return this.mml;
|
|
};
|
|
sre.CaseTable = function (a) {
|
|
sre.AbstractEnrichCase.call(this, a);
|
|
this.mml = a.mathmlTree;
|
|
this.inner = [];
|
|
};
|
|
goog.inherits(sre.CaseTable, sre.AbstractEnrichCase);
|
|
sre.CaseTable.test = function (a) {
|
|
return (
|
|
!!a.mathmlTree &&
|
|
(a.type === sre.SemanticAttr.Type.MATRIX ||
|
|
a.type === sre.SemanticAttr.Type.VECTOR ||
|
|
a.type === sre.SemanticAttr.Type.CASES)
|
|
);
|
|
};
|
|
sre.CaseTable.prototype.getMathml = function () {
|
|
var a = sre.EnrichMathml.cloneContentNode(this.semantic.contentNodes[0]),
|
|
b = this.semantic.contentNodes[1]
|
|
? sre.EnrichMathml.cloneContentNode(this.semantic.contentNodes[1])
|
|
: null;
|
|
this.inner = this.semantic.childNodes.map(sre.EnrichMathml.walkTree);
|
|
"MFENCED" === sre.DomUtil.tagName(this.mml)
|
|
? (this.mml.insertBefore(a, this.mml.childNodes[0] || null),
|
|
b && this.mml.appendChild(b),
|
|
(this.mml = sre.EnrichMathml.rewriteMfenced(this.mml)))
|
|
: ((a = [a, this.mml]),
|
|
b && a.push(b),
|
|
(this.mml = sre.EnrichMathml.introduceNewLayer(a)));
|
|
sre.EnrichMathml.setAttributes(this.mml, this.semantic);
|
|
return this.mml;
|
|
};
|
|
sre.CaseTensor = function (a) {
|
|
sre.CaseMultiindex.call(this, a);
|
|
};
|
|
goog.inherits(sre.CaseTensor, sre.CaseMultiindex);
|
|
sre.CaseTensor.test = function (a) {
|
|
return !!a.mathmlTree && a.type === sre.SemanticAttr.Type.TENSOR;
|
|
};
|
|
sre.CaseTensor.prototype.getMathml = function () {
|
|
sre.EnrichMathml.walkTree(this.semantic.childNodes[0]);
|
|
var a = sre.CaseMultiindex.multiscriptIndex(this.semantic.childNodes[1]),
|
|
b = sre.CaseMultiindex.multiscriptIndex(this.semantic.childNodes[2]),
|
|
c = sre.CaseMultiindex.multiscriptIndex(this.semantic.childNodes[3]),
|
|
d = sre.CaseMultiindex.multiscriptIndex(this.semantic.childNodes[4]);
|
|
sre.EnrichMathml.setAttributes(this.mml, this.semantic);
|
|
sre.EnrichMathml.addCollapsedAttribute(this.mml, [
|
|
this.semantic.id,
|
|
this.semantic.childNodes[0].id,
|
|
a,
|
|
b,
|
|
c,
|
|
d,
|
|
]);
|
|
var e = sre.SemanticSkeleton.collapsedLeafs(a, b, c, d);
|
|
e.unshift(this.semantic.childNodes[0].id);
|
|
this.mml.setAttribute(sre.EnrichMathml.Attribute.CHILDREN, e.join(","));
|
|
this.completeMultiscript(
|
|
sre.SemanticSkeleton.interleaveIds(c, d),
|
|
sre.SemanticSkeleton.interleaveIds(a, b),
|
|
);
|
|
return this.mml;
|
|
};
|
|
sre.CaseText = function (a) {
|
|
sre.AbstractEnrichCase.call(this, a);
|
|
this.mml = a.mathmlTree;
|
|
};
|
|
goog.inherits(sre.CaseText, sre.AbstractEnrichCase);
|
|
sre.CaseText.test = function (a) {
|
|
return (
|
|
a.type === sre.SemanticAttr.Type.PUNCTUATED &&
|
|
(a.role === sre.SemanticAttr.Role.TEXT ||
|
|
a.contentNodes.every(function (b) {
|
|
return b.role === sre.SemanticAttr.Role.DUMMY;
|
|
}))
|
|
);
|
|
};
|
|
sre.CaseText.prototype.getMathml = function () {
|
|
var a = [],
|
|
b = sre.EnrichMathml.collapsePunctuated(this.semantic, a);
|
|
this.mml = sre.EnrichMathml.introduceNewLayer(a);
|
|
sre.EnrichMathml.setAttributes(this.mml, this.semantic);
|
|
this.mml.removeAttribute(sre.EnrichMathml.Attribute.CONTENT);
|
|
sre.EnrichMathml.addCollapsedAttribute(this.mml, b);
|
|
return this.mml;
|
|
};
|
|
sre.EnrichCases = function () {};
|
|
sre.EnrichCaseFactory.cases.push(
|
|
{ test: sre.CaseEmbellished.test, constr: sre.CaseEmbellished },
|
|
{ test: sre.CaseDoubleScript.test, constr: sre.CaseDoubleScript },
|
|
{ test: sre.CaseTensor.test, constr: sre.CaseTensor },
|
|
{ test: sre.CaseMultiscripts.test, constr: sre.CaseMultiscripts },
|
|
{ test: sre.CaseLine.test, constr: sre.CaseLine },
|
|
{ test: sre.CaseBinomial.test, constr: sre.CaseBinomial },
|
|
{ test: sre.CaseProof.test, constr: sre.CaseProof },
|
|
{ test: sre.CaseTable.test, constr: sre.CaseTable },
|
|
{ test: sre.CaseText.test, constr: sre.CaseText },
|
|
);
|
|
sre.Enrich = {};
|
|
sre.Enrich.semanticMathmlNode = function (a) {
|
|
a = a.cloneNode(!0);
|
|
var b = sre.Semantic.getTree(a);
|
|
return sre.EnrichMathml.enrich(a, b);
|
|
};
|
|
sre.Enrich.semanticMathmlSync = function (a) {
|
|
a = sre.DomUtil.parseInput(a);
|
|
return sre.Enrich.semanticMathmlNode(a);
|
|
};
|
|
sre.Enrich.semanticMathml = function (a, b) {
|
|
if (sre.Engine.isReady()) {
|
|
var c = sre.DomUtil.parseInput(a);
|
|
b(sre.Enrich.semanticMathmlNode(c));
|
|
} else
|
|
setTimeout(function () {
|
|
sre.Enrich.semanticMathml(a, b);
|
|
}, 500);
|
|
};
|
|
sre.Enrich.testTranslation__ = function (a) {
|
|
new sre.EnrichCases();
|
|
sre.Debugger.getInstance().init();
|
|
a = sre.Enrich.semanticMathmlSync(sre.Enrich.prepareMmlString(a)).toString();
|
|
sre.EnrichMathml.removeAttributePrefix(a);
|
|
sre.Debugger.getInstance().exit();
|
|
return a;
|
|
};
|
|
sre.Enrich.prepareMmlString = function (a) {
|
|
a.match(/^<math/) || (a = "<math>" + a);
|
|
a.match(/\/math>$/) || (a += "</math>");
|
|
return a;
|
|
};
|
|
sre.ColorPicker = function (a, b) {
|
|
this.foreground = sre.ColorPicker.getChannelColor_(
|
|
b,
|
|
sre.ColorPicker.DEFAULT_FOREGROUND_,
|
|
);
|
|
this.background = sre.ColorPicker.getChannelColor_(
|
|
a,
|
|
sre.ColorPicker.DEFAULT_BACKGROUND_,
|
|
);
|
|
};
|
|
sre.ColorPicker.DEFAULT_BACKGROUND_ = "blue";
|
|
sre.ColorPicker.DEFAULT_FOREGROUND_ = "black";
|
|
sre.ColorPicker.namedColors_ = {
|
|
red: { red: 255, green: 0, blue: 0 },
|
|
green: { red: 0, green: 255, blue: 0 },
|
|
blue: { red: 0, green: 0, blue: 255 },
|
|
yellow: { red: 255, green: 255, blue: 0 },
|
|
cyan: { red: 0, green: 255, blue: 255 },
|
|
magenta: { red: 255, green: 0, blue: 255 },
|
|
white: { red: 255, green: 255, blue: 255 },
|
|
black: { red: 0, green: 0, blue: 0 },
|
|
};
|
|
sre.ColorPicker.getChannelColor_ = function (a, b) {
|
|
a = a || { color: b };
|
|
var c = a.color ? sre.ColorPicker.namedColors_[a.color] : a;
|
|
c || (c = sre.ColorPicker.namedColors_[b]);
|
|
c.alpha = a.hasOwnProperty("alpha") ? a.alpha : 1;
|
|
return sre.ColorPicker.normalizeColor_(c);
|
|
};
|
|
sre.ColorPicker.normalizeColor_ = function (a) {
|
|
var b = function (c) {
|
|
c = Math.max(c, 0);
|
|
c = Math.min(255, c);
|
|
return Math.round(c);
|
|
};
|
|
a.red = b(a.red);
|
|
a.green = b(a.green);
|
|
a.blue = b(a.blue);
|
|
a.alpha = Math.max(a.alpha, 0);
|
|
a.alpha = Math.min(1, a.alpha);
|
|
return a;
|
|
};
|
|
sre.ColorPicker.prototype.rgba = function () {
|
|
var a = function (b) {
|
|
return "rgba(" + b.red + "," + b.green + "," + b.blue + "," + b.alpha + ")";
|
|
};
|
|
return { background: a(this.background), foreground: a(this.foreground) };
|
|
};
|
|
sre.ColorPicker.prototype.rgb = function () {
|
|
var a = function (b) {
|
|
return "rgb(" + b.red + "," + b.green + "," + b.blue + ")";
|
|
};
|
|
return {
|
|
background: a(this.background),
|
|
alphaback: this.background.alpha.toString(),
|
|
foreground: a(this.foreground),
|
|
alphafore: this.foreground.alpha.toString(),
|
|
};
|
|
};
|
|
sre.ColorPicker.prototype.hex = function () {
|
|
var a = function (b) {
|
|
return (
|
|
"#" +
|
|
sre.ColorPicker.toHex_(b.red) +
|
|
sre.ColorPicker.toHex_(b.green) +
|
|
sre.ColorPicker.toHex_(b.blue)
|
|
);
|
|
};
|
|
return {
|
|
background: a(this.background),
|
|
alphaback: this.background.alpha.toString(),
|
|
foreground: a(this.foreground),
|
|
alphafore: this.foreground.alpha.toString(),
|
|
};
|
|
};
|
|
sre.ColorPicker.toHex_ = function (a) {
|
|
a = a.toString(16);
|
|
return 1 === a.length ? "0" + a : a;
|
|
};
|
|
sre.ContrastPicker = function () {
|
|
this.hue = 10;
|
|
this.sat = 100;
|
|
this.incr = this.light = 50;
|
|
};
|
|
sre.ContrastPicker.prototype.generate = function () {
|
|
return sre.ColorPicker.RGB2hex_(
|
|
sre.ColorPicker.rgb2RGB_(
|
|
sre.ColorPicker.hsl2rgb_(this.hue, this.sat, this.light),
|
|
),
|
|
);
|
|
};
|
|
sre.ContrastPicker.prototype.increment = function () {
|
|
this.hue = (this.hue + this.incr) % 360;
|
|
};
|
|
sre.ColorPicker.hsl2rgb_ = function (a, b, c) {
|
|
c = 1 < c ? c / 100 : c;
|
|
var d = (1 - Math.abs(2 * c - 1)) * (1 < b ? b / 100 : b),
|
|
e = d * (1 - Math.abs(((a / 60) % 2) - 1));
|
|
c -= d / 2;
|
|
var f = (b = 0),
|
|
g = 0;
|
|
0 <= a && 60 > a
|
|
? ((a = $jscomp.makeIterator([d, e, 0])),
|
|
(b = a.next().value),
|
|
(f = a.next().value),
|
|
(g = a.next().value))
|
|
: 60 <= a && 120 > a
|
|
? ((a = $jscomp.makeIterator([e, d, 0])),
|
|
(b = a.next().value),
|
|
(f = a.next().value),
|
|
(g = a.next().value))
|
|
: 120 <= a && 180 > a
|
|
? ((a = $jscomp.makeIterator([0, d, e])),
|
|
(b = a.next().value),
|
|
(f = a.next().value),
|
|
(g = a.next().value))
|
|
: 180 <= a && 240 > a
|
|
? ((a = $jscomp.makeIterator([0, e, d])),
|
|
(b = a.next().value),
|
|
(f = a.next().value),
|
|
(g = a.next().value))
|
|
: 240 <= a && 300 > a
|
|
? ((a = $jscomp.makeIterator([e, 0, d])),
|
|
(b = a.next().value),
|
|
(f = a.next().value),
|
|
(g = a.next().value))
|
|
: 300 <= a &&
|
|
360 > a &&
|
|
((a = $jscomp.makeIterator([d, 0, e])),
|
|
(b = a.next().value),
|
|
(f = a.next().value),
|
|
(g = a.next().value));
|
|
return { red: b + c, green: f + c, blue: g + c };
|
|
};
|
|
sre.ColorPicker.rgb2RGB_ = function (a) {
|
|
return {
|
|
red: Math.round(255 * a.red),
|
|
green: Math.round(255 * a.green),
|
|
blue: Math.round(255 * a.blue),
|
|
};
|
|
};
|
|
sre.ColorPicker.RGB2hex_ = function (a) {
|
|
return "rgb(" + a.red + "," + a.green + "," + a.blue + ")";
|
|
};
|
|
sre.Highlighter = function () {};
|
|
sre.Highlighter.prototype.highlight = function (a) {};
|
|
sre.Highlighter.prototype.unhighlight = function () {};
|
|
sre.Highlighter.prototype.highlightAll = function (a) {};
|
|
sre.Highlighter.prototype.unhighlightAll = function () {};
|
|
sre.Highlighter.prototype.setColor = function (a) {};
|
|
sre.Highlighter.prototype.addEvents = function (a, b) {};
|
|
sre.AbstractHighlighter = function () {
|
|
this.currentHighlights_ = [];
|
|
this.color = null;
|
|
this.mactionName = "";
|
|
};
|
|
sre.AbstractHighlighter.ATTR = "sre-highlight";
|
|
sre.AbstractHighlighter.prototype.highlight = function (a) {
|
|
this.currentHighlights_.push(
|
|
a.map(
|
|
goog.bind(function (b) {
|
|
var c = this.highlightNode(b);
|
|
this.setHighlighted(b);
|
|
return c;
|
|
}, this),
|
|
),
|
|
);
|
|
};
|
|
sre.AbstractHighlighter.prototype.highlightNode = goog.abstractMethod;
|
|
sre.AbstractHighlighter.prototype.highlightAll = function (a) {
|
|
a = this.getMactionNodes(a);
|
|
for (var b = 0, c; (c = a[b]); b++) this.highlight([c]);
|
|
};
|
|
sre.AbstractHighlighter.prototype.unhighlight = function () {
|
|
var a = this.currentHighlights_.pop();
|
|
a &&
|
|
a.forEach(
|
|
goog.bind(function (b) {
|
|
this.isHighlighted(b.node) &&
|
|
(this.unhighlightNode(b), this.unsetHighlighted(b.node));
|
|
}, this),
|
|
);
|
|
};
|
|
sre.AbstractHighlighter.prototype.unhighlightNode = goog.abstractMethod;
|
|
sre.AbstractHighlighter.prototype.unhighlightAll = function () {
|
|
for (; 0 < this.currentHighlights_.length; ) this.unhighlight();
|
|
};
|
|
sre.AbstractHighlighter.prototype.setColor = function (a) {
|
|
this.color = a;
|
|
};
|
|
sre.AbstractHighlighter.prototype.colorString = function () {
|
|
return this.color.rgba();
|
|
};
|
|
sre.AbstractHighlighter.prototype.addEvents = function (a, b) {
|
|
a = this.getMactionNodes(a);
|
|
for (var c = 0, d; (d = a[c]); c++)
|
|
for (var e in b) d.addEventListener(e, b[e]);
|
|
};
|
|
sre.AbstractHighlighter.prototype.getMactionNodes = function (a) {
|
|
return a.getElementsByClassName(this.mactionName);
|
|
};
|
|
sre.AbstractHighlighter.prototype.isMactionNode = function (a) {
|
|
return (a = a.className || a.getAttribute("class"))
|
|
? a.match(new RegExp(this.mactionName))
|
|
: !1;
|
|
};
|
|
sre.AbstractHighlighter.prototype.isHighlighted = function (a) {
|
|
return a.hasAttribute(sre.AbstractHighlighter.ATTR);
|
|
};
|
|
sre.AbstractHighlighter.prototype.setHighlighted = function (a) {
|
|
a.setAttribute(sre.AbstractHighlighter.ATTR, !0);
|
|
};
|
|
sre.AbstractHighlighter.prototype.unsetHighlighted = function (a) {
|
|
a.removeAttribute(sre.AbstractHighlighter.ATTR);
|
|
};
|
|
sre.AbstractHighlighter.prototype.colorizeAll = function (a) {
|
|
sre.XpathUtil.evalXPath(
|
|
".//*[@" + sre.EnrichMathml.Attribute.ID + "]",
|
|
a,
|
|
).forEach(
|
|
goog.bind(function (b) {
|
|
this.colorize(b);
|
|
}, this),
|
|
);
|
|
};
|
|
sre.AbstractHighlighter.prototype.uncolorizeAll = function (a) {
|
|
sre.XpathUtil.evalXPath(
|
|
".//*[@" + sre.EnrichMathml.Attribute.ID + "]",
|
|
a,
|
|
).forEach(
|
|
goog.bind(function (b) {
|
|
this.uncolorize(b);
|
|
}, this),
|
|
);
|
|
};
|
|
sre.AbstractHighlighter.prototype.colorize = function (a) {
|
|
var b = sre.EnrichMathml.addPrefix("foreground");
|
|
a.hasAttribute(b) &&
|
|
(a.setAttribute(b + "-old", a.style.color),
|
|
(a.style.color = a.getAttribute(b)));
|
|
};
|
|
sre.AbstractHighlighter.prototype.uncolorize = function (a) {
|
|
var b = sre.EnrichMathml.addPrefix("foreground") + "-old";
|
|
a.hasAttribute(b) && (a.style.color = a.getAttribute(b));
|
|
};
|
|
sre.CssHighlighter = function () {
|
|
sre.AbstractHighlighter.call(this);
|
|
this.mactionName = "mjx-maction";
|
|
};
|
|
goog.inherits(sre.CssHighlighter, sre.AbstractHighlighter);
|
|
sre.CssHighlighter.prototype.highlightNode = function (a) {
|
|
var b = {
|
|
node: a,
|
|
background: a.style.backgroundColor,
|
|
foreground: a.style.color,
|
|
},
|
|
c = this.colorString();
|
|
a.style.backgroundColor = c.background;
|
|
a.style.color = c.foreground;
|
|
return b;
|
|
};
|
|
sre.CssHighlighter.prototype.unhighlightNode = function (a) {
|
|
a.node.style.backgroundColor = a.background;
|
|
a.node.style.color = a.foreground;
|
|
};
|
|
sre.ChtmlHighlighter = function () {
|
|
sre.CssHighlighter.call(this);
|
|
};
|
|
goog.inherits(sre.ChtmlHighlighter, sre.CssHighlighter);
|
|
sre.ChtmlHighlighter.prototype.isMactionNode = function (a) {
|
|
return a.tagName.toUpperCase() === this.mactionName.toUpperCase();
|
|
};
|
|
sre.ChtmlHighlighter.prototype.getMactionNodes = function (a) {
|
|
return a.getElementsByTagName(this.mactionName);
|
|
};
|
|
sre.HtmlHighlighter = function () {
|
|
sre.AbstractHighlighter.call(this);
|
|
this.mactionName = "maction";
|
|
};
|
|
goog.inherits(sre.HtmlHighlighter, sre.AbstractHighlighter);
|
|
sre.HtmlHighlighter.prototype.setMode = function (a) {
|
|
this.mode = a;
|
|
};
|
|
sre.HtmlHighlighter.prototype.highlightNode = function (a) {
|
|
var b = { node: a, foreground: a.style.color, position: a.style.position },
|
|
c = this.color.rgb();
|
|
a.style.color = c.foreground;
|
|
a.style.position = "relative";
|
|
var d = a.bbox;
|
|
if (d && d.w) {
|
|
var e = sre.DomUtil.createElement("span"),
|
|
f = parseFloat(a.style.paddingLeft || "0");
|
|
e.style.backgroundColor = c.background;
|
|
e.style.opacity = c.alphaback.toString();
|
|
e.style.display = "inline-block";
|
|
e.style.height = d.h + d.d + 0.1 + "em";
|
|
e.style.verticalAlign = -d.d + "em";
|
|
e.style.marginTop = e.style.marginBottom = "-0.05em";
|
|
e.style.width = d.w + 0 + "em";
|
|
e.style.marginLeft = f - 0 + "em";
|
|
e.style.marginRight = -d.w - f + "em";
|
|
a.parentNode.insertBefore(e, a);
|
|
b.box = e;
|
|
}
|
|
return b;
|
|
};
|
|
sre.HtmlHighlighter.prototype.unhighlightNode = function (a) {
|
|
var b = a.node;
|
|
b.style.color = a.foreground;
|
|
b.style.position = a.position;
|
|
a.box && a.box.parentNode.removeChild(a.box);
|
|
};
|
|
sre.MmlCssHighlighter = function () {
|
|
sre.CssHighlighter.call(this);
|
|
this.mactionName = "maction";
|
|
};
|
|
goog.inherits(sre.MmlCssHighlighter, sre.CssHighlighter);
|
|
sre.MmlCssHighlighter.prototype.getMactionNodes = function (a) {
|
|
return a.getElementsByTagName(this.mactionName);
|
|
};
|
|
sre.MmlCssHighlighter.prototype.isMactionNode = function (a) {
|
|
return a.tagName === this.mactionName;
|
|
};
|
|
sre.MmlHighlighter = function () {
|
|
sre.AbstractHighlighter.call(this);
|
|
this.mactionName = "maction";
|
|
};
|
|
goog.inherits(sre.MmlHighlighter, sre.AbstractHighlighter);
|
|
sre.MmlHighlighter.prototype.highlightNode = function (a) {
|
|
var b = a.getAttribute("style");
|
|
b += ";background-color: " + this.colorString().background;
|
|
b += ";color: " + this.colorString().foreground;
|
|
a.setAttribute("style", b);
|
|
return { node: a };
|
|
};
|
|
sre.MmlHighlighter.prototype.unhighlightNode = function (a) {
|
|
var b = a.node.getAttribute("style");
|
|
b = b.replace(";background-color: " + this.colorString().background, "");
|
|
b = b.replace(";color: " + this.colorString().foreground, "");
|
|
a.node.setAttribute("style", b);
|
|
};
|
|
sre.MmlHighlighter.prototype.colorString = function () {
|
|
return this.color.rgba();
|
|
};
|
|
sre.MmlHighlighter.prototype.getMactionNodes = function (a) {
|
|
return a.getElementsByTagName(this.mactionName);
|
|
};
|
|
sre.MmlHighlighter.prototype.isMactionNode = function (a) {
|
|
return a.tagName === this.mactionName;
|
|
};
|
|
sre.SvgHighlighter = function () {
|
|
sre.AbstractHighlighter.call(this);
|
|
this.mactionName = "mjx-svg-maction";
|
|
};
|
|
goog.inherits(sre.SvgHighlighter, sre.AbstractHighlighter);
|
|
sre.SvgHighlighter.prototype.highlightNode = function (a) {
|
|
if (this.isHighlighted(a))
|
|
return {
|
|
node: a.previousSibling || a,
|
|
background: a.style.backgroundColor,
|
|
foreground: a.style.color,
|
|
};
|
|
if ("svg" === a.tagName) {
|
|
var b = {
|
|
node: a,
|
|
background: a.style.backgroundColor,
|
|
foreground: a.style.color,
|
|
};
|
|
a.style.backgroundColor = this.colorString().background;
|
|
a.style.color = this.colorString().foreground;
|
|
return b;
|
|
}
|
|
b = sre.DomUtil.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
if ("use" === a.nodeName) {
|
|
var c = sre.DomUtil.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
a.parentNode.insertBefore(c, a);
|
|
c.appendChild(a);
|
|
var d = c.getBBox();
|
|
c.parentNode.replaceChild(a, c);
|
|
} else d = a.getBBox();
|
|
b.setAttribute("x", d.x - 40);
|
|
b.setAttribute("y", d.y - 40);
|
|
b.setAttribute("width", d.width + 80);
|
|
b.setAttribute("height", d.height + 80);
|
|
(d = a.getAttribute("transform")) && b.setAttribute("transform", d);
|
|
b.setAttribute("fill", this.colorString().background);
|
|
b.setAttribute(sre.AbstractHighlighter.ATTR, !0);
|
|
a.parentNode.insertBefore(b, a);
|
|
b = { node: b, foreground: a.getAttribute("fill") };
|
|
a.setAttribute("fill", this.colorString().foreground);
|
|
return b;
|
|
};
|
|
sre.SvgHighlighter.prototype.setHighlighted = function (a) {
|
|
"svg" === a.tagName &&
|
|
sre.SvgHighlighter.superClass_.setHighlighted.call(this, a);
|
|
};
|
|
sre.SvgHighlighter.prototype.unhighlightNode = function (a) {
|
|
"background" in a
|
|
? ((a.node.style.backgroundColor = a.background),
|
|
(a.node.style.color = a.foreground))
|
|
: (a.foreground
|
|
? a.node.nextSibling.setAttribute("fill", a.foreground)
|
|
: a.node.nextSibling.removeAttribute("fill"),
|
|
a.node.parentNode.removeChild(a.node));
|
|
};
|
|
sre.SvgHighlighter.prototype.isMactionNode = function (a) {
|
|
a = a.className || a.getAttribute("class");
|
|
return (a = void 0 !== a.baseVal ? a.baseVal : a)
|
|
? a.match(new RegExp(this.mactionName))
|
|
: !1;
|
|
};
|
|
sre.SvgV3Highlighter = function () {
|
|
sre.SvgHighlighter.call(this);
|
|
this.mactionName = "maction";
|
|
};
|
|
goog.inherits(sre.SvgV3Highlighter, sre.SvgHighlighter);
|
|
sre.SvgV3Highlighter.prototype.highlightNode = function (a) {
|
|
if (this.isHighlighted(a))
|
|
return {
|
|
node: a,
|
|
background: this.colorString().background,
|
|
foreground: this.colorString().foreground,
|
|
};
|
|
if ("svg" === a.tagName || "MJX-CONTAINER" === a.tagName) {
|
|
var b = {
|
|
node: a,
|
|
background: a.style.backgroundColor,
|
|
foreground: a.style.color,
|
|
};
|
|
a.style.backgroundColor = this.colorString().background;
|
|
a.style.color = this.colorString().foreground;
|
|
return b;
|
|
}
|
|
b = sre.DomUtil.createElementNS("http://www.w3.org/2000/svg", "rect");
|
|
b.setAttribute("sre-highlighter-added", !0);
|
|
var c = a.getBBox();
|
|
b.setAttribute("x", c.x - 40);
|
|
b.setAttribute("y", c.y - 40);
|
|
b.setAttribute("width", c.width + 80);
|
|
b.setAttribute("height", c.height + 80);
|
|
(c = a.getAttribute("transform")) && b.setAttribute("transform", c);
|
|
b.setAttribute("fill", this.colorString().background);
|
|
a.setAttribute(sre.AbstractHighlighter.ATTR, !0);
|
|
a.parentNode.insertBefore(b, a);
|
|
b = { node: a, foreground: a.getAttribute("fill") };
|
|
"rect" === a.nodeName
|
|
? ((c = new sre.ColorPicker({ alpha: 0, color: "black" })),
|
|
a.setAttribute("fill", c.rgba().foreground))
|
|
: a.setAttribute("fill", this.colorString().foreground);
|
|
return b;
|
|
};
|
|
sre.SvgV3Highlighter.prototype.unhighlightNode = function (a) {
|
|
var b = a.node.previousSibling;
|
|
b && b.hasAttribute("sre-highlighter-added")
|
|
? (a.foreground
|
|
? a.node.setAttribute("fill", a.foreground)
|
|
: a.node.removeAttribute("fill"),
|
|
a.node.parentNode.removeChild(b))
|
|
: ((a.node.style.backgroundColor = a.background),
|
|
(a.node.style.color = a.foreground));
|
|
};
|
|
sre.SvgV3Highlighter.prototype.isMactionNode = function (a) {
|
|
return a.getAttribute("data-mml-node") === this.mactionName;
|
|
};
|
|
sre.SvgV3Highlighter.prototype.getMactionNodes = function (a) {
|
|
return sre.XpathUtil.evalXPath(
|
|
'.//*[@data-mml-node="' + this.mactionName + '"]',
|
|
a,
|
|
);
|
|
};
|
|
sre.HighlighterFactory = {};
|
|
sre.HighlighterFactory.highlighter = function (a, b, c) {
|
|
a = new sre.ColorPicker(a, b);
|
|
c = new (
|
|
sre.HighlighterFactory.highlighterMapping_[
|
|
"NativeMML" === c.renderer && "Safari" === c.browser
|
|
? "MML-CSS"
|
|
: "SVG" === c.renderer && "v3" === c.browser
|
|
? "SVG-V3"
|
|
: c.renderer
|
|
] || sre.HighlighterFactory.highlighterMapping_.NativeMML
|
|
)();
|
|
c.setColor(a);
|
|
return c;
|
|
};
|
|
sre.HighlighterFactory.addEvents = function (a, b, c) {
|
|
(c = sre.HighlighterFactory.highlighterMapping_[c.renderer]) &&
|
|
new c().addEvents(a, b);
|
|
};
|
|
sre.HighlighterFactory.highlighterMapping_ = {
|
|
SVG: sre.SvgHighlighter,
|
|
"SVG-V3": sre.SvgV3Highlighter,
|
|
NativeMML: sre.MmlHighlighter,
|
|
"HTML-CSS": sre.HtmlHighlighter,
|
|
"MML-CSS": sre.MmlCssHighlighter,
|
|
CommonHTML: sre.CssHighlighter,
|
|
CHTML: sre.ChtmlHighlighter,
|
|
};
|
|
sre.Span = function (a, b) {
|
|
this.string = a;
|
|
this.attributes = b;
|
|
};
|
|
sre.AudioUtil = {};
|
|
sre.AudioUtil.mergePause = function (a, b, c) {
|
|
return a ? { pause: sre.AudioUtil.mergePause_(a.pause, b.pause, c) } : b;
|
|
};
|
|
sre.AudioUtil.mergePause_ = function (a, b, c) {
|
|
return (
|
|
c ||
|
|
function (d, e) {
|
|
return "number" === typeof d || "number" === typeof e
|
|
? d + e
|
|
: "number" === typeof d
|
|
? e
|
|
: "number" === typeof e
|
|
? d
|
|
: [a, b].sort()[0];
|
|
}
|
|
).call(null, a, b);
|
|
};
|
|
sre.AudioUtil.mergeMarkup = function (a, b) {
|
|
delete a.open;
|
|
b.close.forEach(function (d) {
|
|
delete a[d];
|
|
});
|
|
b.open.forEach(function (d) {
|
|
a[d] = b[d];
|
|
});
|
|
var c = Object.keys(a);
|
|
a.open = c;
|
|
};
|
|
sre.AudioUtil.sortClose = function (a, b) {
|
|
if (1 >= a.length) return a;
|
|
for (var c = [], d = 0, e; (e = b[d]), a.length; d++)
|
|
e.close &&
|
|
e.close.length &&
|
|
e.close.forEach(function (f) {
|
|
var g = a.indexOf(f);
|
|
-1 !== g && (c.unshift(f), a.splice(g, 1));
|
|
});
|
|
return c;
|
|
};
|
|
sre.AudioUtil.PersonalityRanges_ = {};
|
|
sre.AudioUtil.LastOpen_ = [];
|
|
sre.AudioUtil.personalityMarkup = function (a) {
|
|
sre.AudioUtil.PersonalityRanges_ = {};
|
|
sre.AudioUtil.LastOpen_ = [];
|
|
for (var b = [], c = {}, d = 0, e; (e = a[d]); d++) {
|
|
var f = null,
|
|
g = e.descriptionSpan(),
|
|
h = e.personality;
|
|
e = h[sre.Engine.personalityProps.JOIN];
|
|
delete h[sre.Engine.personalityProps.JOIN];
|
|
"undefined" !== typeof h[sre.Engine.personalityProps.PAUSE] &&
|
|
((f = {}),
|
|
(f[sre.Engine.personalityProps.PAUSE] =
|
|
h[sre.Engine.personalityProps.PAUSE]),
|
|
delete h[sre.Engine.personalityProps.PAUSE]);
|
|
h = sre.AudioUtil.personalityDiff_(h, c);
|
|
sre.AudioUtil.appendMarkup_(b, g, h, e, f, !0);
|
|
}
|
|
b = b.concat(sre.AudioUtil.finaliseMarkup_());
|
|
return (b = sre.AudioUtil.simplifyMarkup_(b));
|
|
};
|
|
sre.AudioUtil.appendElement_ = function (a, b) {
|
|
var c = a[a.length - 1];
|
|
if (c)
|
|
if (sre.AudioUtil.isSpanElement(b) && sre.AudioUtil.isSpanElement(c))
|
|
if ("undefined" === typeof c.join) c.span = c.span.concat(b.span);
|
|
else {
|
|
a = c.span.pop();
|
|
var d = b.span.shift();
|
|
c.span.push(a + c.join + d);
|
|
c.span = c.span.concat(b.span);
|
|
c.join = b.join;
|
|
}
|
|
else
|
|
sre.AudioUtil.isPauseElement(b) && sre.AudioUtil.isPauseElement(c)
|
|
? (c.pause = sre.AudioUtil.mergePause_(c.pause, b.pause))
|
|
: a.push(b);
|
|
else a.push(b);
|
|
};
|
|
sre.AudioUtil.simplifyMarkup_ = function (a) {
|
|
for (var b = {}, c = [], d = 0, e; (e = a[d]); d++)
|
|
if (sre.AudioUtil.isMarkupElement(e))
|
|
if (!e.close || 1 !== e.close.length || e.open.length)
|
|
sre.AudioUtil.copyValues_(e, b), c.push(e);
|
|
else {
|
|
var f = a[d + 1];
|
|
if (!f || sre.AudioUtil.isSpanElement(f))
|
|
sre.AudioUtil.copyValues_(e, b), c.push(e);
|
|
else {
|
|
var g = sre.AudioUtil.isPauseElement(f) ? f : null;
|
|
g && (f = a[d + 2]);
|
|
f &&
|
|
sre.AudioUtil.isMarkupElement(f) &&
|
|
f.open[0] === e.close[0] &&
|
|
!f.close.length &&
|
|
f[f.open[0]] === b[f.open[0]]
|
|
? g
|
|
? (sre.AudioUtil.appendElement_(c, g), (d += 2))
|
|
: (d += 1)
|
|
: (sre.AudioUtil.copyValues_(e, b), c.push(e));
|
|
}
|
|
}
|
|
else sre.AudioUtil.appendElement_(c, e);
|
|
return c;
|
|
};
|
|
sre.AudioUtil.copyValues_ = function (a, b) {
|
|
a.rate && (b.rate = a.rate);
|
|
a.pitch && (b.pitch = a.pitch);
|
|
a.volume && (b.volume = a.volume);
|
|
};
|
|
sre.AudioUtil.finaliseMarkup_ = function () {
|
|
for (var a = [], b = sre.AudioUtil.LastOpen_.length - 1; 0 <= b; b--) {
|
|
var c = sre.AudioUtil.LastOpen_[b];
|
|
if (c.length) {
|
|
for (var d = { open: [], close: [] }, e = 0; e < c.length; e++) {
|
|
var f = c[e];
|
|
d.close.push(f);
|
|
d[f] = 0;
|
|
}
|
|
a.push(d);
|
|
}
|
|
}
|
|
return a;
|
|
};
|
|
sre.AudioUtil.isMarkupElement = function (a) {
|
|
return "object" === typeof a && a.open;
|
|
};
|
|
sre.AudioUtil.isPauseElement = function (a) {
|
|
return (
|
|
"object" === typeof a &&
|
|
1 === Object.keys(a).length &&
|
|
Object.keys(a)[0] === sre.Engine.personalityProps.PAUSE
|
|
);
|
|
};
|
|
sre.AudioUtil.isSpanElement = function (a) {
|
|
var b = Object.keys(a);
|
|
return (
|
|
"object" === typeof a &&
|
|
((1 === b.length && "span" === b[0]) ||
|
|
(2 === b.length &&
|
|
(("span" === b[0] && "join" === b[1]) ||
|
|
("span" === b[1] && "join" === b[0]))))
|
|
);
|
|
};
|
|
sre.AudioUtil.appendMarkup_ = function (a, b, c, d, e, f) {
|
|
if (f) {
|
|
if ((f = a[a.length - 1])) var g = f[sre.Engine.personalityProps.JOIN];
|
|
if (f && !b.string && e && sre.AudioUtil.isPauseElement(f)) {
|
|
var h = sre.Engine.personalityProps.PAUSE;
|
|
f[h] = sre.AudioUtil.mergePause_(f[h], e[h]);
|
|
e = null;
|
|
}
|
|
f &&
|
|
b.string &&
|
|
0 === Object.keys(c).length &&
|
|
sre.AudioUtil.isSpanElement(f) &&
|
|
("undefined" !== typeof g &&
|
|
((h = f.span.pop()),
|
|
(b = new sre.Span(h.string + g + b.string, h.attributes))),
|
|
f.span.push(b),
|
|
(b = new sre.Span("", {})),
|
|
(f[sre.Engine.personalityProps.JOIN] = d));
|
|
}
|
|
0 !== Object.keys(c).length && a.push(c);
|
|
b.string && a.push({ span: [b], join: d });
|
|
e && a.push(e);
|
|
};
|
|
sre.AudioUtil.personalityDiff_ = function (a, b) {
|
|
if (!b) return a;
|
|
var c = {};
|
|
for (h in sre.Engine.personalityProps) {
|
|
var d = sre.Engine.personalityProps[h],
|
|
e = a[d],
|
|
f = b[d];
|
|
if (!((!e && !f) || (e && f && e === f))) {
|
|
var g = e || 0;
|
|
sre.AudioUtil.isMarkupElement(c) || ((c.open = []), (c.close = []));
|
|
e || c.close.push(d);
|
|
f || c.open.push(d);
|
|
f && e && (c.close.push(d), c.open.push(d));
|
|
b[d] = g;
|
|
c[d] = g;
|
|
sre.AudioUtil.PersonalityRanges_[d]
|
|
? sre.AudioUtil.PersonalityRanges_[d].push(g)
|
|
: (sre.AudioUtil.PersonalityRanges_[d] = [g]);
|
|
}
|
|
}
|
|
if (sre.AudioUtil.isMarkupElement(c)) {
|
|
for (a = c.close.slice(); 0 < a.length; ) {
|
|
var h = sre.AudioUtil.LastOpen_.pop();
|
|
d = sre.BaseUtil.setdifference(h, a);
|
|
a = sre.BaseUtil.setdifference(a, h);
|
|
h = d;
|
|
if (0 === a.length) 0 !== h.length && sre.AudioUtil.LastOpen_.push(h);
|
|
else if (0 !== h.length)
|
|
for (
|
|
c.close = c.close.concat(h), c.open = c.open.concat(h), d = 0;
|
|
(e = h[d]);
|
|
d++
|
|
)
|
|
c[e] = b[e];
|
|
}
|
|
sre.AudioUtil.LastOpen_.push(c.open);
|
|
}
|
|
return c;
|
|
};
|
|
sre.AudioRenderer = function () {};
|
|
sre.AudioRenderer.prototype.setSeparator = function (a) {};
|
|
sre.AudioRenderer.prototype.getSeparator = function () {};
|
|
sre.AudioRenderer.prototype.markup = function (a) {};
|
|
sre.AudioRenderer.prototype.error = function (a) {};
|
|
sre.AudioRenderer.prototype.merge = function (a) {};
|
|
sre.AudioRenderer.prototype.finalize = function (a) {};
|
|
sre.AbstractAudioRenderer = function () {
|
|
this.separator_ = " ";
|
|
};
|
|
sre.AbstractAudioRenderer.prototype.setSeparator = function (a) {
|
|
this.separator_ = a;
|
|
};
|
|
sre.AbstractAudioRenderer.prototype.getSeparator = function () {
|
|
return this.separator_;
|
|
};
|
|
sre.AbstractAudioRenderer.prototype.markup = goog.abstractMethod;
|
|
sre.AbstractAudioRenderer.prototype.error = function (a) {
|
|
return null;
|
|
};
|
|
sre.AbstractAudioRenderer.prototype.merge = function (a) {
|
|
return a
|
|
.map(function (b) {
|
|
return b.string;
|
|
})
|
|
.join(this.getSeparator());
|
|
};
|
|
sre.AbstractAudioRenderer.prototype.finalize = function (a) {
|
|
return a;
|
|
};
|
|
sre.AbstractAudioRenderer.prototype.pauseValue = function (a) {
|
|
switch (a) {
|
|
case "long":
|
|
a = 750;
|
|
break;
|
|
case "medium":
|
|
a = 500;
|
|
break;
|
|
case "short":
|
|
a = 250;
|
|
break;
|
|
default:
|
|
a = parseInt(a, 10);
|
|
}
|
|
return Math.floor(
|
|
(a * parseInt(sre.Engine.getInstance().getRate(), 10)) / 100,
|
|
);
|
|
};
|
|
sre.MarkupRenderer = function () {
|
|
sre.AbstractAudioRenderer.call(this);
|
|
this.scaleFunction_ = null;
|
|
};
|
|
goog.inherits(sre.MarkupRenderer, sre.AbstractAudioRenderer);
|
|
sre.MarkupRenderer.prototype.setScaleFunction = function (a, b, c, d, e) {
|
|
var f = e || 0;
|
|
this.scaleFunction_ = function (g) {
|
|
g = (g - a) / (b - a);
|
|
return +(Math.round(c * (1 - g) + d * g + "e+" + f) + "e-" + f);
|
|
};
|
|
};
|
|
sre.MarkupRenderer.prototype.applyScaleFunction = function (a) {
|
|
return this.scaleFunction_ ? this.scaleFunction_(a) : a;
|
|
};
|
|
sre.MarkupRenderer.prototype.pause = goog.abstractMethod;
|
|
sre.MarkupRenderer.prototype.prosodyElement = goog.abstractMethod;
|
|
sre.AcssRenderer = function () {
|
|
sre.MarkupRenderer.call(this);
|
|
};
|
|
goog.inherits(sre.AcssRenderer, sre.MarkupRenderer);
|
|
sre.AcssRenderer.prototype.markup = function (a) {
|
|
this.setScaleFunction(-2, 2, 0, 10, 0);
|
|
a = sre.AudioUtil.personalityMarkup(a);
|
|
for (
|
|
var b = [], c = { open: [] }, d = null, e = !1, f = 0, g;
|
|
(g = a[f]);
|
|
f++
|
|
)
|
|
if (sre.AudioUtil.isMarkupElement(g)) sre.AudioUtil.mergeMarkup(c, g);
|
|
else if (sre.AudioUtil.isPauseElement(g))
|
|
e && (d = sre.AudioUtil.mergePause(d, g, Math.max));
|
|
else {
|
|
g = '"' + this.merge(g.span) + '"';
|
|
e = !0;
|
|
d && (b.push(this.pause(d)), (d = null));
|
|
var h = this.prosody_(c);
|
|
b.push(h ? "(text (" + h + ") " + g + ")" : g);
|
|
}
|
|
return "(exp " + b.join(" ") + ")";
|
|
};
|
|
sre.AcssRenderer.prototype.error = function (a) {
|
|
return '(error "' + sre.EventUtil.Move[a.toString()] + '")';
|
|
};
|
|
sre.AcssRenderer.prototype.prosody_ = function (a) {
|
|
for (var b = a.open, c = [], d = 0, e; (e = b[d]); d++)
|
|
c.push(this.prosodyElement(e, a[e]));
|
|
return c.join(" ");
|
|
};
|
|
sre.AcssRenderer.prototype.prosodyElement = function (a, b) {
|
|
b = this.applyScaleFunction(b);
|
|
switch (a) {
|
|
case sre.Engine.personalityProps.RATE:
|
|
return "(richness . " + b + ")";
|
|
case sre.Engine.personalityProps.PITCH:
|
|
return "(average-pitch . " + b + ")";
|
|
case sre.Engine.personalityProps.VOLUME:
|
|
return "(stress . " + b + ")";
|
|
}
|
|
return "(value . " + b + ")";
|
|
};
|
|
sre.AcssRenderer.prototype.pause = function (a) {
|
|
return (
|
|
"(pause . " + this.pauseValue(a[sre.Engine.personalityProps.PAUSE]) + ")"
|
|
);
|
|
};
|
|
sre.PunctuationRenderer = function () {
|
|
sre.AbstractAudioRenderer.call(this);
|
|
};
|
|
goog.inherits(sre.PunctuationRenderer, sre.AbstractAudioRenderer);
|
|
sre.PunctuationRenderer.prototype.markup = function (a) {
|
|
a = sre.AudioUtil.personalityMarkup(a);
|
|
for (var b = "", c = null, d = !1, e = 0, f; (f = a[e]); e++)
|
|
sre.AudioUtil.isMarkupElement(f) ||
|
|
(sre.AudioUtil.isPauseElement(f)
|
|
? d && (c = sre.AudioUtil.mergePause(c, f, Math.max))
|
|
: (c &&
|
|
((b += this.pause(c[sre.Engine.personalityProps.PAUSE])),
|
|
(c = null)),
|
|
(b += (d ? this.getSeparator() : "") + this.merge(f.span)),
|
|
(d = !0)));
|
|
return b;
|
|
};
|
|
sre.PunctuationRenderer.PAUSE_PUNCTUATION_ = {
|
|
short: ",",
|
|
medium: ";",
|
|
long: ".",
|
|
};
|
|
sre.PunctuationRenderer.prototype.pause = function (a) {
|
|
return (
|
|
sre.PunctuationRenderer.PAUSE_PUNCTUATION_[
|
|
"number" === typeof a
|
|
? 250 >= a
|
|
? "short"
|
|
: 500 >= a
|
|
? "medium"
|
|
: "long"
|
|
: a
|
|
] || ""
|
|
);
|
|
};
|
|
sre.XmlRenderer = function () {
|
|
sre.MarkupRenderer.call(this);
|
|
};
|
|
goog.inherits(sre.XmlRenderer, sre.MarkupRenderer);
|
|
sre.XmlRenderer.prototype.markup = function (a) {
|
|
this.setScaleFunction(-2, 2, -100, 100, 2);
|
|
a = sre.AudioUtil.personalityMarkup(a);
|
|
for (var b = [], c = [], d = 0, e; (e = a[d]); d++)
|
|
if (e.span) b.push(this.merge(e.span));
|
|
else if (sre.AudioUtil.isPauseElement(e)) b.push(this.pause(e));
|
|
else {
|
|
if (e.close.length)
|
|
for (var f = 0; f < e.close.length; f++) {
|
|
var g = c.pop();
|
|
if (-1 === e.close.indexOf(g))
|
|
throw new sre.Engine.Error("Unknown closing markup element: " + g);
|
|
b.push(this.closeTag(g));
|
|
}
|
|
e.open.length &&
|
|
sre.AudioUtil.sortClose(e.open.slice(), a.slice(d + 1)).forEach(
|
|
goog.bind(function (h) {
|
|
b.push(this.prosodyElement(h, e[h]));
|
|
c.push(h);
|
|
}, this),
|
|
);
|
|
}
|
|
return b.join(" ");
|
|
};
|
|
sre.XmlRenderer.prototype.closeTag = goog.abstractMethod;
|
|
sre.SableRenderer = function () {
|
|
sre.XmlRenderer.call(this);
|
|
};
|
|
goog.inherits(sre.SableRenderer, sre.XmlRenderer);
|
|
sre.SableRenderer.prototype.finalize = function (a) {
|
|
return (
|
|
'<?xml version="1.0"?><!DOCTYPE SABLE PUBLIC "-//SABLE//DTD SABLE speech mark up//EN" "Sable.v0_2.dtd" []><SABLE>' +
|
|
this.getSeparator() +
|
|
a +
|
|
this.getSeparator() +
|
|
"</SABLE>"
|
|
);
|
|
};
|
|
sre.SableRenderer.prototype.pause = function (a) {
|
|
return (
|
|
'<BREAK MSEC="' +
|
|
this.pauseValue(a[sre.Engine.personalityProps.PAUSE]) +
|
|
'"/>'
|
|
);
|
|
};
|
|
sre.SableRenderer.prototype.prosodyElement = function (a, b) {
|
|
b = this.applyScaleFunction(b);
|
|
switch (a) {
|
|
case sre.Engine.personalityProps.PITCH:
|
|
return '<PITCH RANGE="' + b + '%">';
|
|
case sre.Engine.personalityProps.RATE:
|
|
return '<RATE SPEED="' + b + '%">';
|
|
case sre.Engine.personalityProps.VOLUME:
|
|
return '<VOLUME LEVEL="' + b + '%">';
|
|
default:
|
|
return "<" + a.toUpperCase() + ' VALUE="' + b + '">';
|
|
}
|
|
};
|
|
sre.SableRenderer.prototype.closeTag = function (a) {
|
|
return "</" + a.toUpperCase() + ">";
|
|
};
|
|
sre.SsmlRenderer = function () {
|
|
sre.XmlRenderer.call(this);
|
|
};
|
|
goog.inherits(sre.SsmlRenderer, sre.XmlRenderer);
|
|
sre.SsmlRenderer.prototype.finalize = function (a) {
|
|
return (
|
|
'<?xml version="1.0"?><speak version="1.1" xmlns="http://www.w3.org/2001/10/synthesis"><prosody rate="' +
|
|
sre.Engine.getInstance().getRate() +
|
|
'%">' +
|
|
this.getSeparator() +
|
|
a +
|
|
this.getSeparator() +
|
|
"</prosody></speak>"
|
|
);
|
|
};
|
|
sre.SsmlRenderer.prototype.pause = function (a) {
|
|
return (
|
|
'<break time="' +
|
|
this.pauseValue(a[sre.Engine.personalityProps.PAUSE]) +
|
|
'ms"/>'
|
|
);
|
|
};
|
|
sre.SsmlRenderer.prototype.prosodyElement = function (a, b) {
|
|
b = Math.floor(this.applyScaleFunction(b));
|
|
b = 0 > b ? b.toString() : "+" + b.toString();
|
|
return (
|
|
"<prosody " +
|
|
a.toLowerCase() +
|
|
'="' +
|
|
b +
|
|
(a === sre.Engine.personalityProps.VOLUME ? ">" : '%">')
|
|
);
|
|
};
|
|
sre.SsmlRenderer.prototype.closeTag = function (a) {
|
|
return "</prosody>";
|
|
};
|
|
sre.SsmlStepRenderer = function () {
|
|
sre.SsmlRenderer.call(this);
|
|
};
|
|
goog.inherits(sre.SsmlStepRenderer, sre.SsmlRenderer);
|
|
sre.SsmlStepRenderer.prototype.markup = function (a) {
|
|
sre.SsmlStepRenderer.MARKS = {};
|
|
return sre.SsmlStepRenderer.superClass_.markup.call(this, a);
|
|
};
|
|
sre.SsmlStepRenderer.CHARACTER_ATTR_ = "character";
|
|
sre.SsmlStepRenderer.MARKS = {};
|
|
sre.SsmlStepRenderer.prototype.merge = function (a) {
|
|
for (var b = [], c = 0; c < a.length; c++) {
|
|
var d = a[c],
|
|
e = d.attributes.extid;
|
|
e &&
|
|
!sre.SsmlStepRenderer.MARKS[e] &&
|
|
(b.push('<mark name="' + e + '"/>'),
|
|
(sre.SsmlStepRenderer.MARKS[e] = !0));
|
|
1 === d.string.length && d.string.match(/[a-zA-Z]/)
|
|
? b.push(
|
|
'<say-as interpret-as="' +
|
|
sre.SsmlStepRenderer.CHARACTER_ATTR_ +
|
|
'">' +
|
|
d.string +
|
|
"</say-as>",
|
|
)
|
|
: b.push(d.string);
|
|
}
|
|
return b.join(this.getSeparator());
|
|
};
|
|
sre.StringRenderer = function () {
|
|
sre.AbstractAudioRenderer.call(this);
|
|
};
|
|
goog.inherits(sre.StringRenderer, sre.AbstractAudioRenderer);
|
|
sre.StringRenderer.prototype.markup = function (a) {
|
|
var b = "";
|
|
a = a.filter(function (g) {
|
|
return g.descriptionString();
|
|
});
|
|
if (!a.length) return b;
|
|
for (var c = 0; c < a.length - 1; c++) {
|
|
var d = a[c],
|
|
e = d.personality[sre.Engine.personalityProps.JOIN],
|
|
f =
|
|
"nemeth" === sre.Engine.getInstance().locale ? "" : this.getSeparator();
|
|
e = "undefined" === typeof e ? f : e;
|
|
b += d.descriptionString() + e;
|
|
}
|
|
return (b += a[c].descriptionString());
|
|
};
|
|
sre.AuralRendering = function () {};
|
|
goog.addSingletonGetter(sre.AuralRendering);
|
|
sre.AuralRendering.prototype.setSeparator = function (a) {
|
|
var b = sre.AuralRendering.rendererMapping_[sre.Engine.getInstance().markup];
|
|
b && b.setSeparator(a);
|
|
};
|
|
sre.AuralRendering.prototype.getSeparator = function () {
|
|
var a = sre.AuralRendering.rendererMapping_[sre.Engine.getInstance().markup];
|
|
return a ? a.getSeparator() : "";
|
|
};
|
|
sre.AuralRendering.prototype.markup = function (a) {
|
|
var b = sre.AuralRendering.rendererMapping_[sre.Engine.getInstance().markup];
|
|
return b ? b.markup(a) : "";
|
|
};
|
|
sre.AuralRendering.prototype.merge = function (a) {
|
|
var b = a.map(function (d) {
|
|
return { string: d, attributes: {} };
|
|
}),
|
|
c = sre.AuralRendering.rendererMapping_[sre.Engine.getInstance().markup];
|
|
return c ? c.merge(b) : a.join();
|
|
};
|
|
sre.AuralRendering.prototype.finalize = function (a) {
|
|
var b = sre.AuralRendering.rendererMapping_[sre.Engine.getInstance().markup];
|
|
return b ? b.finalize(a) : a;
|
|
};
|
|
sre.AuralRendering.prototype.error = function (a) {
|
|
var b = sre.AuralRendering.rendererMapping_[sre.Engine.getInstance().markup];
|
|
return b ? b.error(a) : "";
|
|
};
|
|
sre.AuralRendering.registerRenderer = function (a, b) {
|
|
sre.AuralRendering.rendererMapping_[a] = b;
|
|
};
|
|
sre.AuralRendering.ofType = function (a) {
|
|
return (
|
|
sre.AuralRendering.rendererMapping_[
|
|
sre.Engine.getInstance().markup
|
|
] instanceof a
|
|
);
|
|
};
|
|
sre.AuralRendering.rendererMapping_ = {};
|
|
sre.AuralRendering.registerRenderer(
|
|
sre.Engine.Markup.NONE,
|
|
new sre.StringRenderer(),
|
|
);
|
|
sre.AuralRendering.registerRenderer(
|
|
sre.Engine.Markup.PUNCTUATION,
|
|
new sre.PunctuationRenderer(),
|
|
);
|
|
sre.AuralRendering.registerRenderer(
|
|
sre.Engine.Markup.ACSS,
|
|
new sre.AcssRenderer(),
|
|
);
|
|
sre.AuralRendering.registerRenderer(
|
|
sre.Engine.Markup.SABLE,
|
|
new sre.SableRenderer(),
|
|
);
|
|
sre.AuralRendering.xmlInstance = new sre.SsmlRenderer();
|
|
sre.AuralRendering.registerRenderer(
|
|
sre.Engine.Markup.VOICEXML,
|
|
sre.AuralRendering.xmlInstance,
|
|
);
|
|
sre.AuralRendering.registerRenderer(
|
|
sre.Engine.Markup.SSML,
|
|
sre.AuralRendering.xmlInstance,
|
|
);
|
|
sre.AuralRendering.registerRenderer(
|
|
sre.Engine.Markup.SSML_STEP,
|
|
new sre.SsmlStepRenderer(),
|
|
);
|
|
sre.WalkerUtil = {};
|
|
sre.WalkerUtil.splitAttribute = function (a) {
|
|
return a ? a.split(/,/) : [];
|
|
};
|
|
sre.WalkerUtil.getAttribute = function (a, b) {
|
|
return sre.DomUtil.getDataAttribute(a, b);
|
|
};
|
|
sre.WalkerUtil.getSemanticRoot = function (a) {
|
|
if (
|
|
a.hasAttribute(sre.EnrichMathml.Attribute.TYPE) &&
|
|
!a.hasAttribute(sre.EnrichMathml.Attribute.PARENT)
|
|
)
|
|
return a;
|
|
for (
|
|
var b = sre.DomUtil.querySelectorAllByAttr(
|
|
a,
|
|
sre.EnrichMathml.Attribute.TYPE,
|
|
),
|
|
c = 0,
|
|
d;
|
|
(d = b[c]);
|
|
c++
|
|
)
|
|
if (!d.hasAttribute(sre.EnrichMathml.Attribute.PARENT)) return d;
|
|
return a;
|
|
};
|
|
sre.WalkerUtil.getBySemanticId = function (a, b) {
|
|
return a.getAttribute(sre.EnrichMathml.Attribute.ID) === b
|
|
? a
|
|
: sre.DomUtil.querySelectorAllByAttrValue(
|
|
a,
|
|
sre.EnrichMathml.Attribute.ID,
|
|
b,
|
|
)[0];
|
|
};
|
|
sre.RebuildStree = function (a) {
|
|
this.factory = new sre.SemanticNodeFactory();
|
|
this.nodeDict = {};
|
|
this.mathml = a;
|
|
this.mmlRoot = sre.WalkerUtil.getSemanticRoot(a);
|
|
this.streeRoot = this.assembleTree(this.mmlRoot);
|
|
this.stree = sre.SemanticTree.fromNode(this.streeRoot, this.mathml);
|
|
this.xml = this.stree.xml();
|
|
sre.SemanticProcessor.getInstance().setNodeFactory(this.factory);
|
|
};
|
|
sre.RebuildStree.prototype.getTree = function () {
|
|
return this.stree;
|
|
};
|
|
sre.RebuildStree.addAttributes = function (a, b, c) {
|
|
c &&
|
|
1 === b.childNodes.length &&
|
|
b.childNodes[0].nodeType !== sre.DomUtil.NodeType.TEXT_NODE &&
|
|
sre.SemanticUtil.addAttributes(a, b.childNodes[0]);
|
|
sre.SemanticUtil.addAttributes(a, b);
|
|
};
|
|
sre.RebuildStree.prototype.assembleTree = function (a) {
|
|
var b = this.makeNode(a),
|
|
c = sre.WalkerUtil.splitAttribute(
|
|
sre.WalkerUtil.getAttribute(a, sre.EnrichMathml.Attribute.CHILDREN),
|
|
),
|
|
d = sre.WalkerUtil.splitAttribute(
|
|
sre.WalkerUtil.getAttribute(a, sre.EnrichMathml.Attribute.CONTENT),
|
|
);
|
|
sre.RebuildStree.addAttributes(b, a, !(c.length || d.length));
|
|
if (0 === d.length && 0 === c.length)
|
|
return (b.textContent = a.textContent), b;
|
|
if (0 < d.length) {
|
|
var e = sre.WalkerUtil.getBySemanticId(a, d[0]);
|
|
e &&
|
|
((e = sre.WalkerUtil.splitAttribute(
|
|
sre.WalkerUtil.getAttribute(e, sre.EnrichMathml.Attribute.OPERATOR),
|
|
)),
|
|
1 < e.length && (b.textContent = e[1]));
|
|
}
|
|
e = function (f) {
|
|
f = sre.WalkerUtil.getBySemanticId(a, f);
|
|
f = this.assembleTree(f);
|
|
f.parent = b;
|
|
return f;
|
|
};
|
|
b.contentNodes = d.map(goog.bind(e, this));
|
|
b.childNodes = c.map(goog.bind(e, this));
|
|
return (c = sre.WalkerUtil.getAttribute(
|
|
a,
|
|
sre.EnrichMathml.Attribute.COLLAPSED,
|
|
))
|
|
? this.postProcess(b, c)
|
|
: b;
|
|
};
|
|
sre.RebuildStree.prototype.makeNode = function (a) {
|
|
var b = sre.WalkerUtil.getAttribute(a, sre.EnrichMathml.Attribute.TYPE),
|
|
c = sre.WalkerUtil.getAttribute(a, sre.EnrichMathml.Attribute.ROLE),
|
|
d = sre.WalkerUtil.getAttribute(a, sre.EnrichMathml.Attribute.FONT),
|
|
e =
|
|
sre.WalkerUtil.getAttribute(a, sre.EnrichMathml.Attribute.ANNOTATION) ||
|
|
"",
|
|
f = sre.WalkerUtil.getAttribute(a, sre.EnrichMathml.Attribute.ID),
|
|
g = sre.WalkerUtil.getAttribute(a, sre.EnrichMathml.Attribute.EMBELLISHED);
|
|
a = sre.WalkerUtil.getAttribute(a, sre.EnrichMathml.Attribute.FENCEPOINTER);
|
|
f = this.createNode(parseInt(f, 10));
|
|
f.type = b;
|
|
f.role = c;
|
|
f.font = d ? d : sre.SemanticAttr.Font.UNKNOWN;
|
|
f.parseAnnotation(e);
|
|
a && (f.fencePointer = a);
|
|
g && (f.embellished = g);
|
|
return f;
|
|
};
|
|
sre.RebuildStree.isPunctuated = function (a) {
|
|
return (
|
|
!sre.SemanticSkeleton.simpleCollapseStructure(a) &&
|
|
a[1] &&
|
|
sre.SemanticSkeleton.contentCollapseStructure(a[1])
|
|
);
|
|
};
|
|
sre.RebuildStree.prototype.makePunctuation = function (a) {
|
|
a = this.createNode(a);
|
|
a.updateContent(sre.SemanticAttr.invisibleComma());
|
|
a.role = sre.SemanticAttr.Role.DUMMY;
|
|
return a;
|
|
};
|
|
sre.RebuildStree.prototype.makePunctuated = function (a, b, c) {
|
|
var d = this.createNode(b[0]);
|
|
d.type = sre.SemanticAttr.Type.PUNCTUATED;
|
|
d.embellished = a.embellished;
|
|
d.fencePointer = a.fencePointer;
|
|
d.role = c;
|
|
a = b.splice(1, 1)[0].slice(1);
|
|
d.contentNodes = a.map(goog.bind(this.makePunctuation, this));
|
|
this.collapsedChildren_(b);
|
|
};
|
|
sre.RebuildStree.prototype.makeEmpty = function (a, b, c) {
|
|
b = this.createNode(b);
|
|
b.type = sre.SemanticAttr.Type.EMPTY;
|
|
b.embellished = a.embellished;
|
|
b.fencePointer = a.fencePointer;
|
|
b.role = c;
|
|
};
|
|
sre.RebuildStree.prototype.makeIndex = function (a, b, c) {
|
|
sre.RebuildStree.isPunctuated(b)
|
|
? this.makePunctuated(a, b, c)
|
|
: sre.SemanticSkeleton.simpleCollapseStructure(b) &&
|
|
!this.nodeDict[b.toString()] &&
|
|
this.makeEmpty(a, b, c);
|
|
};
|
|
sre.RebuildStree.prototype.postProcess = function (a, b) {
|
|
b = sre.SemanticSkeleton.fromString(b).array;
|
|
if (a.type === sre.SemanticAttr.Role.SUBSUP) {
|
|
var c = this.createNode(b[1][0]);
|
|
c.type = sre.SemanticAttr.Type.SUBSCRIPT;
|
|
c.role = sre.SemanticAttr.Role.SUBSUP;
|
|
a.type = sre.SemanticAttr.Type.SUPERSCRIPT;
|
|
c.embellished = a.embellished;
|
|
c.fencePointer = a.fencePointer;
|
|
this.makeIndex(a, b[1][2], sre.SemanticAttr.Role.RIGHTSUB);
|
|
this.makeIndex(a, b[2], sre.SemanticAttr.Role.RIGHTSUPER);
|
|
this.collapsedChildren_(b);
|
|
return a;
|
|
}
|
|
if (a.type === sre.SemanticAttr.Type.SUBSCRIPT)
|
|
return (
|
|
this.makeIndex(a, b[2], sre.SemanticAttr.Role.RIGHTSUB),
|
|
this.collapsedChildren_(b),
|
|
a
|
|
);
|
|
if (a.type === sre.SemanticAttr.Type.SUPERSCRIPT)
|
|
return (
|
|
this.makeIndex(a, b[2], sre.SemanticAttr.Role.RIGHTSUPER),
|
|
this.collapsedChildren_(b),
|
|
a
|
|
);
|
|
if (a.type === sre.SemanticAttr.Type.TENSOR)
|
|
return (
|
|
this.makeIndex(a, b[2], sre.SemanticAttr.Role.LEFTSUB),
|
|
this.makeIndex(a, b[3], sre.SemanticAttr.Role.LEFTSUPER),
|
|
this.makeIndex(a, b[4], sre.SemanticAttr.Role.RIGHTSUB),
|
|
this.makeIndex(a, b[5], sre.SemanticAttr.Role.RIGHTSUPER),
|
|
this.collapsedChildren_(b),
|
|
a
|
|
);
|
|
if (a.type === sre.SemanticAttr.Type.PUNCTUATED)
|
|
return (
|
|
sre.RebuildStree.isPunctuated(b) &&
|
|
((b = b.splice(1, 1)[0].slice(1)),
|
|
(a.contentNodes = b.map(goog.bind(this.makePunctuation, this)))),
|
|
a
|
|
);
|
|
a.type === sre.SemanticAttr.Role.UNDEROVER &&
|
|
((c = this.createNode(b[1][0])),
|
|
a.childNodes[1].role === sre.SemanticAttr.Role.OVERACCENT
|
|
? ((c.type = sre.SemanticAttr.Type.OVERSCORE),
|
|
(a.type = sre.SemanticAttr.Type.UNDERSCORE))
|
|
: ((c.type = sre.SemanticAttr.Type.UNDERSCORE),
|
|
(a.type = sre.SemanticAttr.Type.OVERSCORE)),
|
|
(c.role = sre.SemanticAttr.Role.UNDEROVER),
|
|
(c.embellished = a.embellished),
|
|
(c.fencePointer = a.fencePointer),
|
|
this.collapsedChildren_(b));
|
|
return a;
|
|
};
|
|
sre.RebuildStree.prototype.createNode = function (a) {
|
|
var b = this.factory.makeNode(a);
|
|
return (this.nodeDict[a.toString()] = b);
|
|
};
|
|
sre.RebuildStree.prototype.collapsedChildren_ = function (a) {
|
|
var b = goog.bind(function (c) {
|
|
var d = this.nodeDict[c[0]];
|
|
d.childNodes = [];
|
|
for (var e = 1, f = c.length; e < f; e++) {
|
|
var g = c[e];
|
|
d.childNodes.push(
|
|
sre.SemanticSkeleton.simpleCollapseStructure(g)
|
|
? this.nodeDict[g]
|
|
: b(g),
|
|
);
|
|
}
|
|
return d;
|
|
}, this);
|
|
b(a);
|
|
};
|
|
sre.SpeechGenerator = function () {};
|
|
sre.SpeechGenerator.prototype.getSpeech = function (a, b) {};
|
|
sre.SpeechGenerator.prototype.getRebuilt = function () {};
|
|
sre.SpeechGenerator.prototype.setRebuilt = function (a) {};
|
|
sre.SpeechGenerator.prototype.setOptions = function (a) {};
|
|
sre.SpeechGenerator.prototype.getOptions = function () {};
|
|
sre.SpeechGenerator.prototype.start = function () {};
|
|
sre.SpeechGenerator.prototype.end = function () {};
|
|
sre.AuditoryDescription = function (a) {
|
|
this.context = a.context || "";
|
|
this.text = a.text || "";
|
|
this.userValue = a.userValue || "";
|
|
this.annotation = a.annotation || "";
|
|
this.attributes = a.attributes || {};
|
|
this.personality = a.personality || {};
|
|
};
|
|
sre.AuditoryDescription.create = function (a, b) {
|
|
a.text = sre.Grammar.getInstance().apply(a.text, b || {});
|
|
return new sre.AuditoryDescription(a);
|
|
};
|
|
sre.AuditoryDescription.prototype.isEmpty = function () {
|
|
return (
|
|
0 == this.context.length &&
|
|
0 == this.text.length &&
|
|
0 == this.userValue.length &&
|
|
0 == this.annotation.length
|
|
);
|
|
};
|
|
sre.AuditoryDescription.prototype.clone = function () {
|
|
if (this.personality) {
|
|
var a = {};
|
|
for (var b in this.personality) a = this.personality[b];
|
|
}
|
|
if (this.attributes) {
|
|
var c = {};
|
|
for (b in this.attributes) c = this.attributes[b];
|
|
}
|
|
return new sre.AuditoryDescription({
|
|
context: this.context,
|
|
text: this.text,
|
|
userValue: this.userValue,
|
|
annotation: this.annotation,
|
|
personality: a,
|
|
attributes: c,
|
|
});
|
|
};
|
|
sre.AuditoryDescription.prototype.toString = function () {
|
|
return (
|
|
'AuditoryDescription(context="' +
|
|
this.context +
|
|
'" text="' +
|
|
this.text +
|
|
'" userValue="' +
|
|
this.userValue +
|
|
'" annotation="' +
|
|
this.annotation +
|
|
'")'
|
|
);
|
|
};
|
|
sre.AuditoryDescription.prototype.descriptionString = function () {
|
|
return this.context && this.text
|
|
? this.context + " " + this.text
|
|
: this.context || this.text;
|
|
};
|
|
sre.AuditoryDescription.prototype.descriptionSpan = function () {
|
|
return new sre.Span(this.descriptionString(), this.attributes);
|
|
};
|
|
sre.AuditoryDescription.prototype.equals = function (a) {
|
|
return (
|
|
this.context == a.context &&
|
|
this.text == a.text &&
|
|
this.userValue == a.userValue &&
|
|
this.annotation == a.annotation
|
|
);
|
|
};
|
|
sre.SpeechRule = function (a, b, c, d) {
|
|
this.name = a;
|
|
this.dynamicCstr = b;
|
|
this.precondition = c;
|
|
this.action = d;
|
|
this.context = null;
|
|
};
|
|
sre.SpeechRule.prototype.toString = function () {
|
|
return (
|
|
this.name +
|
|
" | " +
|
|
this.dynamicCstr.toString() +
|
|
" | " +
|
|
this.precondition.toString() +
|
|
" ==> " +
|
|
this.action.toString()
|
|
);
|
|
};
|
|
sre.SpeechRule.Type = {
|
|
NODE: "NODE",
|
|
MULTI: "MULTI",
|
|
TEXT: "TEXT",
|
|
PERSONALITY: "PERSONALITY",
|
|
};
|
|
sre.SpeechRule.Type.fromString = function (a) {
|
|
switch (a) {
|
|
case "[n]":
|
|
return sre.SpeechRule.Type.NODE;
|
|
case "[m]":
|
|
return sre.SpeechRule.Type.MULTI;
|
|
case "[t]":
|
|
return sre.SpeechRule.Type.TEXT;
|
|
case "[p]":
|
|
return sre.SpeechRule.Type.PERSONALITY;
|
|
default:
|
|
throw "Parse error: " + a;
|
|
}
|
|
};
|
|
sre.SpeechRule.Type.toString = function (a) {
|
|
switch (a) {
|
|
case sre.SpeechRule.Type.NODE:
|
|
return "[n]";
|
|
case sre.SpeechRule.Type.MULTI:
|
|
return "[m]";
|
|
case sre.SpeechRule.Type.TEXT:
|
|
return "[t]";
|
|
case sre.SpeechRule.Type.PERSONALITY:
|
|
return "[p]";
|
|
default:
|
|
throw "Unknown type error: " + a;
|
|
}
|
|
};
|
|
sre.SpeechRule.Component = function (a) {
|
|
this.type = a.type;
|
|
this.content = a.content;
|
|
this.attributes = a.attributes;
|
|
this.grammar = a.grammar;
|
|
};
|
|
sre.SpeechRule.Component.fromString = function (a) {
|
|
var b = {};
|
|
b.type = sre.SpeechRule.Type.fromString(a.substring(0, 3));
|
|
a = a.slice(3).trim();
|
|
if (!a) throw new sre.SpeechRule.OutputError("Missing content.");
|
|
switch (b.type) {
|
|
case sre.SpeechRule.Type.TEXT:
|
|
if ('"' == a[0]) {
|
|
var c = sre.SpeechRule.splitString_(a, "\\(")[0].trim();
|
|
if ('"' != c.slice(-1))
|
|
throw new sre.SpeechRule.OutputError("Invalid string syntax.");
|
|
b.content = c;
|
|
a = a.slice(c.length).trim();
|
|
-1 == a.indexOf("(") && (a = "");
|
|
break;
|
|
}
|
|
case sre.SpeechRule.Type.NODE:
|
|
case sre.SpeechRule.Type.MULTI:
|
|
(c = a.indexOf(" (")),
|
|
-1 == c
|
|
? ((b.content = a.trim()), (a = ""))
|
|
: ((b.content = a.substring(0, c).trim()), (a = a.slice(c).trim()));
|
|
}
|
|
a &&
|
|
((a = sre.SpeechRule.Component.attributesFromString(a)),
|
|
a.grammar && ((b.grammar = a.grammar), delete a.grammar),
|
|
Object.keys(a).length && (b.attributes = a));
|
|
return (b = new sre.SpeechRule.Component(b));
|
|
};
|
|
sre.SpeechRule.Component.prototype.toString = function () {
|
|
var a = "" + sre.SpeechRule.Type.toString(this.type);
|
|
a += this.content ? " " + this.content : "";
|
|
var b = this.attributesToString();
|
|
return a + (b ? " " + b : "");
|
|
};
|
|
sre.SpeechRule.Component.grammarFromString = function (a) {
|
|
return sre.Grammar.parseInput(a);
|
|
};
|
|
sre.SpeechRule.Component.prototype.grammarToString = function () {
|
|
return this.getGrammar().join(":");
|
|
};
|
|
sre.SpeechRule.Component.prototype.getGrammar = function () {
|
|
var a = [],
|
|
b;
|
|
for (b in this.grammar)
|
|
!0 === this.grammar[b]
|
|
? a.push(b)
|
|
: !1 === this.grammar[b]
|
|
? a.push("!" + b)
|
|
: a.push(b + "=" + this.grammar[b]);
|
|
return a;
|
|
};
|
|
sre.SpeechRule.Component.attributesFromString = function (a) {
|
|
if ("(" != a[0] || ")" != a.slice(-1))
|
|
throw new sre.SpeechRule.OutputError("Invalid attribute expression: " + a);
|
|
var b = {};
|
|
a = sre.SpeechRule.splitString_(a.slice(1, -1), ",");
|
|
for (var c = 0, d = a.length; c < d; c++) {
|
|
var e = a[c],
|
|
f = e.indexOf(":");
|
|
if (-1 == f) b[e.trim()] = "true";
|
|
else {
|
|
var g = e.substring(0, f).trim();
|
|
e = e.slice(f + 1).trim();
|
|
b[g] =
|
|
"grammar" === g
|
|
? sre.SpeechRule.Component.grammarFromString(e)
|
|
: (b[g] = e);
|
|
}
|
|
}
|
|
return b;
|
|
};
|
|
sre.SpeechRule.Component.prototype.attributesToString = function () {
|
|
var a = this.getAttributes(),
|
|
b = this.grammarToString();
|
|
b && a.push("grammar:" + b);
|
|
return 0 < a.length ? "(" + a.join(", ") + ")" : "";
|
|
};
|
|
sre.SpeechRule.Component.prototype.getAttributes = function () {
|
|
var a = [],
|
|
b;
|
|
for (b in this.attributes) {
|
|
var c = this.attributes[b];
|
|
"true" === c ? a.push(b) : a.push(b + ":" + c);
|
|
}
|
|
return a;
|
|
};
|
|
sre.SpeechRule.Action = function (a) {
|
|
this.components = a;
|
|
};
|
|
sre.SpeechRule.Action.fromString = function (a) {
|
|
a = sre.SpeechRule.splitString_(a, ";")
|
|
.filter(function (f) {
|
|
return f.match(/\S/);
|
|
})
|
|
.map(function (f) {
|
|
return f.trim();
|
|
});
|
|
for (var b = [], c = 0, d = a.length; c < d; c++) {
|
|
var e = sre.SpeechRule.Component.fromString(a[c]);
|
|
e && b.push(e);
|
|
}
|
|
return new sre.SpeechRule.Action(b);
|
|
};
|
|
sre.SpeechRule.Action.prototype.toString = function () {
|
|
return this.components
|
|
.map(function (a) {
|
|
return a.toString();
|
|
})
|
|
.join("; ");
|
|
};
|
|
sre.SpeechRule.Precondition = function (a, b) {
|
|
this.query = a;
|
|
this.constraints = b || [];
|
|
};
|
|
sre.SpeechRule.Precondition.prototype.toString = function () {
|
|
var a = this.constraints.join(", ");
|
|
return this.query + ", " + a;
|
|
};
|
|
sre.SpeechRule.splitString_ = function (a, b) {
|
|
for (var c = [], d = ""; "" != a; ) {
|
|
var e = a.search(b);
|
|
if (-1 == e) {
|
|
if (0 != (a.match(/"/g) || []).length % 2)
|
|
throw new sre.SpeechRule.OutputError(
|
|
"Invalid string in expression: " + a,
|
|
);
|
|
c.push(d + a);
|
|
a = d = "";
|
|
} else if (0 == (a.substring(0, e).match(/"/g) || []).length % 2)
|
|
c.push(d + a.substring(0, e)), (d = ""), (a = a.substring(e + 1));
|
|
else {
|
|
var f = a.substring(e).search('"');
|
|
if (-1 == f)
|
|
throw new sre.SpeechRule.OutputError(
|
|
"Invalid string in expression: " + a,
|
|
);
|
|
d += a.substring(0, e + f + 1);
|
|
a = a.substring(e + f + 1);
|
|
}
|
|
}
|
|
d && c.push(d);
|
|
return c;
|
|
};
|
|
sre.SpeechRule.OutputError = function (a) {
|
|
sre.Engine.Error.call(this, a);
|
|
this.name = "RuleError";
|
|
};
|
|
goog.inherits(sre.SpeechRule.OutputError, sre.Engine.Error);
|
|
sre.SpeechRuleFunctions = function () {};
|
|
sre.SpeechRuleFunctions.Store_ = function (a, b) {
|
|
this.prefix_ = a;
|
|
this.store_ = b;
|
|
};
|
|
sre.SpeechRuleFunctions.Store_.prototype.add = function (a, b) {
|
|
this.checkCustomFunctionSyntax_(a) && (this.store_[a] = b);
|
|
};
|
|
sre.SpeechRuleFunctions.Store_.prototype.addStore = function (a) {
|
|
for (var b = Object.keys(a.store_), c = 0, d; (d = b[c]); c++)
|
|
this.add(d, a.store_[d]);
|
|
};
|
|
sre.SpeechRuleFunctions.Store_.prototype.lookup = function (a) {
|
|
return this.store_[a];
|
|
};
|
|
sre.SpeechRuleFunctions.CustomQueries = function () {
|
|
sre.SpeechRuleFunctions.Store_.call(this, "CQF", {});
|
|
};
|
|
goog.inherits(
|
|
sre.SpeechRuleFunctions.CustomQueries,
|
|
sre.SpeechRuleFunctions.Store_,
|
|
);
|
|
sre.SpeechRuleFunctions.CustomStrings = function () {
|
|
sre.SpeechRuleFunctions.Store_.call(this, "CSF", {});
|
|
};
|
|
goog.inherits(
|
|
sre.SpeechRuleFunctions.CustomStrings,
|
|
sre.SpeechRuleFunctions.Store_,
|
|
);
|
|
sre.SpeechRuleFunctions.ContextFunctions = function () {
|
|
sre.SpeechRuleFunctions.Store_.call(this, "CTXF", {});
|
|
};
|
|
goog.inherits(
|
|
sre.SpeechRuleFunctions.ContextFunctions,
|
|
sre.SpeechRuleFunctions.Store_,
|
|
);
|
|
sre.SpeechRuleFunctions.Store_.prototype.checkCustomFunctionSyntax_ = function (
|
|
a,
|
|
) {
|
|
return a.match(new RegExp("^" + this.prefix_))
|
|
? !0
|
|
: (console.error(
|
|
"FunctionError: Invalid function name. Expected prefix " + this.prefix_,
|
|
),
|
|
!1);
|
|
};
|
|
sre.SpeechRuleContext = function () {
|
|
this.customQueries = new sre.SpeechRuleFunctions.CustomQueries();
|
|
this.customStrings = new sre.SpeechRuleFunctions.CustomStrings();
|
|
this.contextFunctions = new sre.SpeechRuleFunctions.ContextFunctions();
|
|
};
|
|
sre.SpeechRuleContext.prototype.applyCustomQuery = function (a, b) {
|
|
return (b = this.customQueries.lookup(b)) ? b(a) : null;
|
|
};
|
|
sre.SpeechRuleContext.prototype.applySelector = function (a, b) {
|
|
return this.applyCustomQuery(a, b) || sre.XpathUtil.evalXPath(b, a);
|
|
};
|
|
sre.SpeechRuleContext.prototype.applyQuery = function (a, b) {
|
|
a = this.applySelector(a, b);
|
|
return 0 < a.length ? a[0] : null;
|
|
};
|
|
sre.SpeechRuleContext.prototype.applyConstraint = function (a, b) {
|
|
return !!this.applyQuery(a, b) || sre.XpathUtil.evaluateBoolean(b, a);
|
|
};
|
|
sre.SpeechRuleContext.prototype.constructString = function (a, b) {
|
|
if (!b) return "";
|
|
if ('"' == b.charAt(0)) return b.slice(1, -1);
|
|
var c = this.customStrings.lookup(b);
|
|
return c ? c(a) : sre.XpathUtil.evaluateString(b, a);
|
|
};
|
|
sre.SpeechRuleContext.prototype.parse = function (a) {
|
|
for (var b = 0, c; (c = a[b]); b++)
|
|
({
|
|
CQF: this.customQueries,
|
|
CSF: this.customStrings,
|
|
CTXF: this.contextFunctions,
|
|
})[c[0]].add(c[1], c[2]);
|
|
};
|
|
sre.SpeechRuleEvaluator = function () {};
|
|
sre.SpeechRuleEvaluator.prototype.evaluateDefault = goog.abstractMethod;
|
|
sre.SpeechRuleStore = function () {};
|
|
sre.SpeechRuleStore.prototype.addRule = goog.abstractMethod;
|
|
sre.SpeechRuleStore.prototype.deleteRule = goog.abstractMethod;
|
|
sre.SpeechRuleStore.prototype.findRule = goog.abstractMethod;
|
|
sre.SpeechRuleStore.prototype.findAllRules = goog.abstractMethod;
|
|
sre.SpeechRuleStore.prototype.lookupRule = goog.abstractMethod;
|
|
sre.SpeechRuleStore.prototype.defineRule = goog.abstractMethod;
|
|
sre.TrieNode = function () {};
|
|
sre.TrieNode.prototype.getConstraint = function () {};
|
|
sre.TrieNode.prototype.getKind = function () {};
|
|
sre.TrieNode.prototype.applyTest = function (a) {};
|
|
sre.TrieNode.prototype.addChild = function (a) {};
|
|
sre.TrieNode.prototype.getChild = function (a) {};
|
|
sre.TrieNode.prototype.getChildren = function () {};
|
|
sre.TrieNode.prototype.findChildren = function (a) {};
|
|
sre.TrieNode.Kind = {
|
|
ROOT: "root",
|
|
DYNAMIC: "dynamic",
|
|
QUERY: "query",
|
|
BOOLEAN: "boolean",
|
|
STATIC: "static",
|
|
};
|
|
sre.AbstractTrieNode = function (a, b) {
|
|
this.constraint = a;
|
|
this.test = b;
|
|
this.children_ = {};
|
|
this.kind = sre.TrieNode.Kind.ROOT;
|
|
};
|
|
sre.AbstractTrieNode.prototype.getConstraint = function () {
|
|
return this.constraint;
|
|
};
|
|
sre.AbstractTrieNode.prototype.getKind = function () {
|
|
return this.kind;
|
|
};
|
|
sre.AbstractTrieNode.prototype.applyTest = function (a) {
|
|
return this.test(a);
|
|
};
|
|
sre.AbstractTrieNode.prototype.addChild = function (a) {
|
|
var b = a.getConstraint(),
|
|
c = this.children_[b];
|
|
this.children_[b] = a;
|
|
return c;
|
|
};
|
|
sre.AbstractTrieNode.prototype.getChild = function (a) {
|
|
return this.children_[a];
|
|
};
|
|
sre.AbstractTrieNode.prototype.getChildren = function () {
|
|
var a = [],
|
|
b;
|
|
for (b in this.children_) a.push(this.children_[b]);
|
|
return a;
|
|
};
|
|
sre.AbstractTrieNode.prototype.findChildren = function (a) {
|
|
var b = [],
|
|
c;
|
|
for (c in this.children_) {
|
|
var d = this.children_[c];
|
|
d.applyTest(a) && b.push(d);
|
|
}
|
|
return b;
|
|
};
|
|
sre.AbstractTrieNode.prototype.toString = function () {
|
|
return this.constraint;
|
|
};
|
|
sre.StaticTrieNode = function (a, b) {
|
|
sre.AbstractTrieNode.call(this, a, b);
|
|
this.kind = sre.TrieNode.Kind.STATIC;
|
|
this.rule_ = null;
|
|
};
|
|
goog.inherits(sre.StaticTrieNode, sre.AbstractTrieNode);
|
|
sre.StaticTrieNode.prototype.getRule = function () {
|
|
return this.rule_;
|
|
};
|
|
sre.StaticTrieNode.prototype.setRule = function (a) {
|
|
this.rule_ &&
|
|
sre.Debugger.getInstance().output(
|
|
"Replacing rule " + this.rule_ + " with " + a,
|
|
);
|
|
this.rule_ = a;
|
|
};
|
|
sre.StaticTrieNode.prototype.toString = function () {
|
|
return this.getRule()
|
|
? this.constraint + "\n==> " + this.getRule().action
|
|
: this.constraint;
|
|
};
|
|
sre.TrieNodeFactory = {};
|
|
sre.TrieNodeFactory.getNode = function (a, b, c) {
|
|
switch (a) {
|
|
case sre.TrieNode.Kind.ROOT:
|
|
return new sre.RootTrieNode();
|
|
case sre.TrieNode.Kind.DYNAMIC:
|
|
return new sre.DynamicTrieNode(b);
|
|
case sre.TrieNode.Kind.QUERY:
|
|
return new sre.QueryTrieNode(b, c);
|
|
case sre.TrieNode.Kind.BOOLEAN:
|
|
return new sre.BooleanTrieNode(b, c);
|
|
default:
|
|
return null;
|
|
}
|
|
};
|
|
sre.RootTrieNode = function () {
|
|
sre.AbstractTrieNode.call(this, "", function () {
|
|
return !0;
|
|
});
|
|
this.kind = sre.TrieNode.Kind.ROOT;
|
|
};
|
|
goog.inherits(sre.RootTrieNode, sre.AbstractTrieNode);
|
|
sre.DynamicTrieNode = function (a) {
|
|
sre.AbstractTrieNode.call(this, a, function (b) {
|
|
return b === a;
|
|
});
|
|
this.kind = sre.TrieNode.Kind.DYNAMIC;
|
|
};
|
|
goog.inherits(sre.DynamicTrieNode, sre.AbstractTrieNode);
|
|
sre.TrieNodeFactory.constraintTest_ = function (a) {
|
|
if (a.match(/^self::\*$/))
|
|
return function (f) {
|
|
return !0;
|
|
};
|
|
if (a.match(/^self::\w+$/)) {
|
|
var b = a.slice(6).toUpperCase();
|
|
return function (f) {
|
|
return f.tagName && sre.DomUtil.tagName(f) === b;
|
|
};
|
|
}
|
|
if (a.match(/^self::\w+:\w+$/)) {
|
|
a = a.split(":");
|
|
var c = sre.XpathUtil.resolveNameSpace(a[2]);
|
|
if (!c) return null;
|
|
b = a[3].toUpperCase();
|
|
return function (f) {
|
|
return (
|
|
f.localName && f.localName.toUpperCase() === b && f.namespaceURI === c
|
|
);
|
|
};
|
|
}
|
|
if (a.match(/^@\w+$/)) {
|
|
var d = a.slice(1);
|
|
return function (f) {
|
|
return f.hasAttribute && f.hasAttribute(d);
|
|
};
|
|
}
|
|
if (a.match(/^@\w+="[\w\d ]+"$/)) {
|
|
a = a.split("=");
|
|
d = a[0].slice(1);
|
|
var e = a[1].slice(1, -1);
|
|
return function (f) {
|
|
return f.hasAttribute && f.hasAttribute(d) && f.getAttribute(d) === e;
|
|
};
|
|
}
|
|
return a.match(/^@\w+!="[\w\d ]+"$/)
|
|
? ((a = a.split("!=")),
|
|
(d = a[0].slice(1)),
|
|
(e = a[1].slice(1, -1)),
|
|
function (f) {
|
|
return !f.hasAttribute || !f.hasAttribute(d) || f.getAttribute(d) !== e;
|
|
})
|
|
: a.match(/^contains\(\s*@grammar\s*,\s*"[\w\d ]+"\s*\)$/)
|
|
? ((a = a.split('"')),
|
|
(e = a[1]),
|
|
function (f) {
|
|
return sre.Grammar.getInstance().getParameter(e);
|
|
})
|
|
: a.match(/^not\(\s*contains\(\s*@grammar\s*,\s*"[\w\d ]+"\s*\)\s*\)$/)
|
|
? ((a = a.split('"')),
|
|
(e = a[1]),
|
|
function (f) {
|
|
return !sre.Grammar.getInstance().getParameter(e);
|
|
})
|
|
: null;
|
|
};
|
|
sre.QueryTrieNode = function (a, b) {
|
|
this.context_ = b;
|
|
sre.StaticTrieNode.call(this, a, sre.TrieNodeFactory.constraintTest_(a));
|
|
this.kind = sre.TrieNode.Kind.QUERY;
|
|
};
|
|
goog.inherits(sre.QueryTrieNode, sre.StaticTrieNode);
|
|
sre.QueryTrieNode.prototype.applyTest = function (a) {
|
|
return this.test
|
|
? this.test(a)
|
|
: this.context_.applyQuery(a, this.constraint) === a;
|
|
};
|
|
sre.BooleanTrieNode = function (a, b) {
|
|
this.context_ = b;
|
|
sre.StaticTrieNode.call(this, a, sre.TrieNodeFactory.constraintTest_(a));
|
|
this.kind = sre.TrieNode.Kind.BOOLEAN;
|
|
};
|
|
goog.inherits(sre.BooleanTrieNode, sre.StaticTrieNode);
|
|
sre.BooleanTrieNode.prototype.applyTest = function (a) {
|
|
return this.test
|
|
? this.test(a)
|
|
: this.context_.applyConstraint(a, this.constraint);
|
|
};
|
|
sre.Trie = function (a) {
|
|
this.store = a;
|
|
this.root = sre.TrieNodeFactory.getNode(
|
|
sre.TrieNode.Kind.ROOT,
|
|
"",
|
|
this.store.context,
|
|
);
|
|
};
|
|
sre.Trie.prototype.addRule = function (a) {
|
|
for (
|
|
var b = this.root,
|
|
c = a.context,
|
|
d = a.dynamicCstr.getValues(),
|
|
e = 0,
|
|
f = d.length;
|
|
e < f;
|
|
e++
|
|
)
|
|
b = this.addNode_(b, d[e], sre.TrieNode.Kind.DYNAMIC, c);
|
|
b = this.addNode_(b, a.precondition.query, sre.TrieNode.Kind.QUERY, c);
|
|
d = a.precondition.constraints;
|
|
e = 0;
|
|
for (f = d.length; e < f; e++)
|
|
b = this.addNode_(b, d[e], sre.TrieNode.Kind.BOOLEAN, c);
|
|
b.setRule(a);
|
|
};
|
|
sre.Trie.prototype.addNode_ = function (a, b, c, d) {
|
|
var e = a.getChild(b);
|
|
e || ((e = sre.TrieNodeFactory.getNode(c, b, d)), a.addChild(e));
|
|
return e;
|
|
};
|
|
sre.Trie.prototype.lookupRules = function (a, b) {
|
|
for (var c = [this.root], d = []; b.length; ) {
|
|
for (var e = b.shift(), f = []; c.length; ) {
|
|
var g = c.shift();
|
|
g = g.getChildren();
|
|
g.forEach(function (h) {
|
|
(h.getKind() === sre.TrieNode.Kind.DYNAMIC &&
|
|
-1 === e.indexOf(h.getConstraint())) ||
|
|
f.push(h);
|
|
});
|
|
}
|
|
c = f.slice();
|
|
}
|
|
for (; c.length; )
|
|
(g = c.shift()),
|
|
g.getRule && (b = g.getRule()) && d.push(b),
|
|
(g = g.findChildren(a)),
|
|
(c = c.concat(g));
|
|
return d;
|
|
};
|
|
sre.Trie.prototype.hasSubtrie = function (a) {
|
|
for (var b = this.root, c = 0, d = a.length; c < d; c++)
|
|
if (((b = b.getChild(a[c])), !b)) return !1;
|
|
return !0;
|
|
};
|
|
sre.Trie.prototype.toString = function () {
|
|
return sre.Trie.printWithDepth_(this.root, 0, "");
|
|
};
|
|
sre.Trie.prototype.collectRules = function () {
|
|
return sre.Trie.collectRules_(this.root);
|
|
};
|
|
sre.Trie.prototype.order = function () {
|
|
return sre.Trie.order_(this.root);
|
|
};
|
|
sre.Trie.printWithDepth_ = function (a, b, c) {
|
|
var d = Array(b + 2).join(b) + ": ";
|
|
c += d + a.toString() + "\n";
|
|
a = a.getChildren();
|
|
d = 0;
|
|
for (var e; (e = a[d]); d++) c = sre.Trie.printWithDepth_(e, b + 1, c);
|
|
return c;
|
|
};
|
|
sre.Trie.order_ = function (a) {
|
|
a = a.getChildren();
|
|
if (!a.length) return 0;
|
|
var b = Math.max.apply(null, a.map(sre.Trie.order_));
|
|
return Math.max(a.length, b);
|
|
};
|
|
sre.Trie.collectRules_ = function (a) {
|
|
var b = [];
|
|
for (a = [a]; a.length; ) {
|
|
var c = a.shift();
|
|
if (
|
|
c.getKind() === sre.TrieNode.Kind.QUERY ||
|
|
c.getKind() === sre.TrieNode.Kind.BOOLEAN
|
|
) {
|
|
var d = c.getRule();
|
|
d && b.unshift(d);
|
|
}
|
|
a = a.concat(c.getChildren());
|
|
}
|
|
return b;
|
|
};
|
|
sre.Trie.prototype.enumerate = function (a) {
|
|
return this.enumerate_(this.root, a);
|
|
};
|
|
sre.Trie.prototype.enumerate_ = function (a, b) {
|
|
b = b || {};
|
|
a = a.getChildren();
|
|
for (var c = 0, d; (d = a[c]); c++)
|
|
d.kind === sre.TrieNode.Kind.DYNAMIC &&
|
|
(b[d.getConstraint()] = this.enumerate_(d, b[d.getConstraint()]));
|
|
return b;
|
|
};
|
|
sre.BaseRuleStore = function () {
|
|
this.context = new sre.SpeechRuleContext();
|
|
this.customQueries = this.context.customQueries;
|
|
this.customStrings = this.context.customStrings;
|
|
this.contextFunctions = this.context.contextFunctions;
|
|
this.speechRules_ = [];
|
|
this.trie = new sre.Trie(this);
|
|
this.parseOrder = sre.DynamicCstr.DEFAULT_ORDER;
|
|
this.parser = new sre.DynamicCstr.Parser(this.parseOrder);
|
|
this.locale = sre.DynamicCstr.DEFAULT_VALUES[sre.DynamicCstr.Axis.LOCALE];
|
|
this.modality = sre.DynamicCstr.DEFAULT_VALUES[sre.DynamicCstr.Axis.MODALITY];
|
|
this.domain = null;
|
|
this.initialized = !1;
|
|
this.parseMethods = { Rule: goog.bind(this.defineRule, this) };
|
|
};
|
|
sre.BaseRuleStore.prototype.lookupRule = function (a, b) {
|
|
if (
|
|
!a ||
|
|
(a.nodeType != sre.DomUtil.NodeType.ELEMENT_NODE &&
|
|
a.nodeType != sre.DomUtil.NodeType.TEXT_NODE)
|
|
)
|
|
return null;
|
|
a = this.trie.lookupRules(a, b.allProperties());
|
|
return 0 < a.length ? this.pickMostConstraint_(b, a) : null;
|
|
};
|
|
sre.BaseRuleStore.prototype.defineRule = function (a, b, c, d, e) {
|
|
try {
|
|
var f = sre.SpeechRule.Action.fromString(c),
|
|
g = Array.prototype.slice.call(arguments, 4),
|
|
h = new sre.SpeechRule.Precondition(d, g),
|
|
k = this.parseCstr(b);
|
|
var l = new sre.SpeechRule(a, k, h, f);
|
|
} catch (m) {
|
|
if ("RuleError" == m.name)
|
|
return console.error("Rule Error ", d, "(" + b + "):", m.message), null;
|
|
throw m;
|
|
}
|
|
this.addRule(l);
|
|
return l;
|
|
};
|
|
sre.BaseRuleStore.prototype.addRule = function (a) {
|
|
a.context = this.context;
|
|
this.trie.addRule(a);
|
|
this.speechRules_.unshift(a);
|
|
};
|
|
sre.BaseRuleStore.prototype.deleteRule = function (a) {
|
|
a = this.speechRules_.indexOf(a);
|
|
-1 != a && this.speechRules_.splice(a, 1);
|
|
};
|
|
sre.BaseRuleStore.prototype.findRule = function (a) {
|
|
for (var b = 0, c; (c = this.speechRules_[b]); b++) if (a(c)) return c;
|
|
return null;
|
|
};
|
|
sre.BaseRuleStore.prototype.findAllRules = function (a) {
|
|
return this.speechRules_.filter(a);
|
|
};
|
|
sre.BaseRuleStore.prototype.evaluateDefault = function (a) {
|
|
return [sre.AuditoryDescription.create({ text: a.textContent })];
|
|
};
|
|
sre.BaseRuleStore.prototype.debugSpeechRule = function (a, b) {
|
|
var c = a.precondition,
|
|
d = a.context.applyQuery(b, c.query);
|
|
sre.Debugger.getInstance().output(c.query, d ? d.toString() : d);
|
|
c.constraints.forEach(
|
|
goog.bind(function (e) {
|
|
sre.Debugger.getInstance().output(e, a.context.applyConstraint(b, e));
|
|
}, this),
|
|
);
|
|
};
|
|
sre.BaseRuleStore.prototype.initialize = goog.abstractMethod;
|
|
sre.BaseRuleStore.prototype.removeDuplicates = function (a) {
|
|
for (var b = this.speechRules_.length - 1, c; (c = this.speechRules_[b]); b--)
|
|
c != a &&
|
|
a.dynamicCstr.equal(c.dynamicCstr) &&
|
|
sre.BaseRuleStore.comparePreconditions_(c, a) &&
|
|
this.speechRules_.splice(b, 1);
|
|
};
|
|
sre.BaseRuleStore.strongQuery_ = function (a, b) {
|
|
a = a.precondition.query;
|
|
b = b.precondition.query;
|
|
var c = a.match(/^self::\*\[@[\w-]+\]$/),
|
|
d = b.match(/^self::\*\[@[\w-]+\]$/);
|
|
if (c && d) return 0;
|
|
if (c) return (b = b.match(/^self::[\w-]+\[@[\w-]+\]$/)) ? 1 : -1;
|
|
if (d) return (a = a.match(/^self::[\w-]+\[@[\w-]+\]$/)) ? -1 : 1;
|
|
a = a.match(/^self::[\w-]+\[@[\w-]+\]$/);
|
|
b = b.match(/^self::[\w-]+\[@[\w-]+\]$/);
|
|
return a && b ? 0 : a ? -1 : b ? 1 : 0;
|
|
};
|
|
sre.BaseRuleStore.prototype.pickMostConstraint_ = function (a, b) {
|
|
var c = sre.Engine.getInstance().comparator;
|
|
b.sort(function (d, e) {
|
|
return (
|
|
c.compare(d.dynamicCstr, e.dynamicCstr) ||
|
|
sre.BaseRuleStore.strongQuery_(d, e) ||
|
|
e.precondition.constraints.length - d.precondition.constraints.length
|
|
);
|
|
});
|
|
sre.Debugger.getInstance().generateOutput(
|
|
goog.bind(function () {
|
|
return b.map(function (d) {
|
|
return d.name + "(" + d.dynamicCstr.toString() + ")";
|
|
});
|
|
}, this),
|
|
);
|
|
return b[0];
|
|
};
|
|
sre.BaseRuleStore.compareStaticConstraints_ = function (a, b) {
|
|
if (a.length != b.length) return !1;
|
|
for (var c = 0, d; (d = a[c]); c++) if (-1 == b.indexOf(d)) return !1;
|
|
return !0;
|
|
};
|
|
sre.BaseRuleStore.comparePreconditions_ = function (a, b) {
|
|
a = a.precondition;
|
|
b = b.precondition;
|
|
return a.query != b.query
|
|
? !1
|
|
: sre.BaseRuleStore.compareStaticConstraints_(a.constraints, b.constraints);
|
|
};
|
|
sre.BaseRuleStore.prototype.getSpeechRules = function () {
|
|
return this.speechRules_;
|
|
};
|
|
sre.BaseRuleStore.prototype.setSpeechRules = function (a) {
|
|
this.speechRules_ = a;
|
|
};
|
|
sre.BaseRuleStore.prototype.parseCstr = function (a) {
|
|
return this.parser.parse(
|
|
this.locale +
|
|
"." +
|
|
this.modality +
|
|
(this.domain ? "." + this.domain : "") +
|
|
"." +
|
|
a,
|
|
);
|
|
};
|
|
sre.BaseRuleStore.prototype.parse = function (a) {
|
|
this.modality = a.modality || this.modality;
|
|
this.locale = a.locale || this.locale;
|
|
this.domain = a.domain || this.domain;
|
|
this.context.parse(a.functions || []);
|
|
this.parseRules(a.rules || []);
|
|
};
|
|
sre.BaseRuleStore.prototype.parseRules = function (a) {
|
|
for (var b = 0, c; (c = a[b]); b++) {
|
|
var d = c[0],
|
|
e = this.parseMethods[d];
|
|
d && e && e.apply(this, c.slice(1));
|
|
}
|
|
};
|
|
sre.MathStore = function () {
|
|
sre.BaseRuleStore.call(this);
|
|
this.initializer = [];
|
|
this.parseMethods.Alias = goog.bind(this.defineRuleAlias, this);
|
|
this.parseMethods.Aliases = goog.bind(this.defineRulesAlias, this);
|
|
this.parseMethods.UniqueAlias = goog.bind(this.defineUniqueRuleAlias, this);
|
|
this.parseMethods.SpecializedRule = goog.bind(
|
|
this.defineSpecialisedRule,
|
|
this,
|
|
);
|
|
};
|
|
goog.inherits(sre.MathStore, sre.BaseRuleStore);
|
|
sre.MathStore.prototype.initialize = function () {
|
|
if (!this.initialized) {
|
|
for (var a = 0, b; (b = this.initializer[a]); a++) b(this);
|
|
this.setSpeechRules(this.trie.collectRules());
|
|
this.initialized = !0;
|
|
}
|
|
};
|
|
sre.MathStore.prototype.defineUniqueRuleAlias = function (a, b, c, d) {
|
|
var e = this.parseCstr(b),
|
|
f = this.findRule(
|
|
goog.bind(function (g) {
|
|
return g.name == a && e.equal(g.dynamicCstr);
|
|
}, this),
|
|
);
|
|
if (!f)
|
|
throw new sre.SpeechRule.OutputError(
|
|
"Rule named " + a + " with style " + b + " does not exist.",
|
|
);
|
|
this.addAlias_(f, c, Array.prototype.slice.call(arguments, 3));
|
|
};
|
|
sre.MathStore.prototype.defineRuleAlias = function (a, b, c) {
|
|
var d = this.findRule(function (e) {
|
|
return e.name == a;
|
|
});
|
|
if (!d)
|
|
throw new sre.SpeechRule.OutputError(
|
|
"Rule with named " + a + " does not exist.",
|
|
);
|
|
this.addAlias_(d, b, Array.prototype.slice.call(arguments, 2));
|
|
};
|
|
sre.MathStore.prototype.defineRulesAlias = function (a, b, c) {
|
|
var d = this.findAllRules(function (g) {
|
|
return g.name == a;
|
|
});
|
|
if (0 == d.length)
|
|
throw new sre.SpeechRule.OutputError(
|
|
"Rule with name " + a + " does not exist.",
|
|
);
|
|
var e = Array.prototype.slice.call(arguments, 2),
|
|
f = [];
|
|
d.forEach(
|
|
goog.bind(function (g) {
|
|
a: {
|
|
var h = g.dynamicCstr.toString();
|
|
for (var k = g.action.toString(), l = 0, m; (m = f[l]); l++)
|
|
if (m.action === k && m.cstr === h) {
|
|
h = !1;
|
|
break a;
|
|
}
|
|
f.push({ cstr: h, action: k });
|
|
h = !0;
|
|
}
|
|
h && this.addAlias_(g, b, e);
|
|
}, this),
|
|
);
|
|
};
|
|
sre.MathStore.prototype.addAlias_ = function (a, b, c) {
|
|
b = new sre.SpeechRule.Precondition(b, c);
|
|
b = new sre.SpeechRule(a.name, a.dynamicCstr, b, a.action);
|
|
b.name = a.name;
|
|
this.addRule(b);
|
|
};
|
|
sre.MathStore.prototype.defineSpecialisedRule = function (a, b, c, d) {
|
|
var e = this.parseCstr(b),
|
|
f = this.findRule(
|
|
goog.bind(function (g) {
|
|
return g.name == a && e.equal(g.dynamicCstr);
|
|
}, this),
|
|
);
|
|
if (!f)
|
|
throw new sre.SpeechRule.OutputError(
|
|
"Rule named " + a + " with style " + b + " does not exist.",
|
|
);
|
|
b = this.parseCstr(c);
|
|
d = d ? sre.SpeechRule.Action.fromString(d) : f.action;
|
|
f = new sre.SpeechRule(f.name, b, f.precondition, d);
|
|
this.addRule(f);
|
|
};
|
|
sre.MathStore.prototype.evaluateDefault = function (a) {
|
|
return this.evaluateString_(a.textContent);
|
|
};
|
|
sre.MathStore.prototype.evaluateString_ = function (a) {
|
|
var b = [];
|
|
if (a.match(/^\s+$/)) return b;
|
|
var c = this.matchNumber_(a);
|
|
if (c && c.length === a.length) return b.push(this.evaluate_(c.number)), b;
|
|
a = sre.BaseUtil.removeEmpty(a.replace(/\s/g, " ").split(" "));
|
|
for (var d = 0; (c = a[d]); d++)
|
|
if (1 == c.length) b.push(this.evaluate_(c));
|
|
else if (c.match(new RegExp("^[" + sre.Messages.REGEXP.TEXT + "]+$")))
|
|
b.push(this.evaluate_(c));
|
|
else
|
|
for (var e = c; e; ) {
|
|
c = this.matchNumber_(e);
|
|
var f = e.match(new RegExp("^[" + sre.Messages.REGEXP.TEXT + "]+"));
|
|
c
|
|
? (b.push(this.evaluate_(c.number)), (e = e.substring(c.length)))
|
|
: f
|
|
? (b.push(this.evaluate_(f[0])), (e = e.substring(f[0].length)))
|
|
: ((c = e[0].charCodeAt(0)),
|
|
55296 <= c &&
|
|
56319 >= c &&
|
|
1 < e.length &&
|
|
!isNaN(e.charCodeAt(1))
|
|
? (b.push(this.evaluate_(e.slice(0, 2))), (e = e.substring(2)))
|
|
: (b.push(this.evaluate_(e[0])), (e = e.substring(1))));
|
|
}
|
|
return b;
|
|
};
|
|
sre.MathStore.prototype.matchNumber_ = function (a) {
|
|
var b = a.match(new RegExp("^" + sre.Messages.REGEXP.NUMBER)),
|
|
c = a.match(new RegExp("^" + sre.Locale.en.REGEXP.NUMBER));
|
|
if (!b && !c) return null;
|
|
var d = c && c[0] === a;
|
|
return (b && b[0] === a) || !d
|
|
? { number: b[0], length: b[0].length }
|
|
: {
|
|
number: c[0]
|
|
.replace(new RegExp(sre.Locale.en.REGEXP.DIGIT_GROUP, "g"), "X")
|
|
.replace(
|
|
new RegExp(sre.Locale.en.REGEXP.DECIMAL_MARK, "g"),
|
|
sre.Messages.REGEXP.DECIMAL_MARK,
|
|
)
|
|
.replace(/X/g, sre.Messages.REGEXP.DIGIT_GROUP.replace(/\\/g, "")),
|
|
length: c[0].length,
|
|
};
|
|
};
|
|
sre.MathStore.prototype.evaluate_ = function (a) {
|
|
return sre.AuditoryDescription.create(
|
|
{ text: a },
|
|
{ adjust: !0, translate: !0 },
|
|
);
|
|
};
|
|
sre.MathStore.prototype.parse = function (a) {
|
|
sre.MathStore.superClass_.parse.call(this, a);
|
|
this.initializer = a.initialize || [];
|
|
};
|
|
sre.BrailleStore = function () {
|
|
sre.MathStore.call(this);
|
|
this.modality = "braille";
|
|
};
|
|
goog.inherits(sre.BrailleStore, sre.MathStore);
|
|
sre.BrailleStore.prototype.evaluateDefault = function (a) {
|
|
a = a.textContent.slice(0);
|
|
var b = [];
|
|
if (a.match(/^\s+$/)) return b;
|
|
for (; a; ) {
|
|
var c = a[0],
|
|
d = c.charCodeAt(0);
|
|
55296 <= d && 56319 >= d && 1 < a.length && !isNaN(a.charCodeAt(1))
|
|
? (b.push(
|
|
sre.AuditoryDescription.create(
|
|
{ text: a.slice(0, 2) },
|
|
{ adjust: !0, translate: !0 },
|
|
),
|
|
),
|
|
(a = a.substring(2)))
|
|
: (b.push(
|
|
sre.AuditoryDescription.create(
|
|
{ text: c },
|
|
{ adjust: !0, translate: !0 },
|
|
),
|
|
),
|
|
(a = a.substring(1)));
|
|
}
|
|
return b;
|
|
};
|
|
sre.ClearspeakPreferences = function (a, b) {
|
|
sre.DynamicCstr.call(this, a);
|
|
this.preference = b;
|
|
};
|
|
goog.inherits(sre.ClearspeakPreferences, sre.DynamicCstr);
|
|
sre.ClearspeakPreferences.prototype.equal = function (a) {
|
|
if (!sre.ClearspeakPreferences.superClass_.equal.call(this, a)) return !1;
|
|
var b = Object.keys(this.preference);
|
|
a = a.preference;
|
|
if (b.length !== Object.keys(a).length) return !1;
|
|
for (var c = 0, d; (d = b[c]); c++)
|
|
if (this.preference[d] !== a[d]) return !1;
|
|
return !0;
|
|
};
|
|
sre.ClearspeakPreferences.AUTO = "Auto";
|
|
sre.ClearspeakPreferences.PREFERENCES = new sre.DynamicProperties({
|
|
AbsoluteValue: ["Auto", "AbsEnd", "Cardinality", "Determinant"],
|
|
Bar: ["Auto", "Conjugate"],
|
|
Caps: ["Auto", "SayCaps"],
|
|
CombinationPermutation: ["Auto", "ChoosePermute"],
|
|
Currency: ["Auto", "Position", "Prefix"],
|
|
Ellipses: ["Auto", "AndSoOn"],
|
|
Exponent: ["Auto", "AfterPower", "Ordinal", "OrdinalPower", "Exponent"],
|
|
Fraction:
|
|
"Auto EndFrac FracOver General GeneralEndFrac Ordinal Over OverEndFrac Per".split(
|
|
" ",
|
|
),
|
|
Functions: ["Auto", "None", "Reciprocal"],
|
|
ImpliedTimes: ["Auto", "MoreImpliedTimes", "None"],
|
|
Log: ["Auto", "LnAsNaturalLog"],
|
|
Matrix:
|
|
"Auto Combinatoric EndMatrix EndVector SilentColNum SpeakColNum Vector".split(
|
|
" ",
|
|
),
|
|
MultiLineLabel: "Auto Case Constraint Equation Line None Row Step".split(" "),
|
|
MultiLineOverview: ["Auto", "None"],
|
|
MultiLinePausesBetweenColumns: ["Auto", "Long", "Short"],
|
|
MultsymbolDot: ["Auto", "Dot"],
|
|
MultsymbolX: ["Auto", "By", "Cross"],
|
|
Paren: "Auto CoordPoint Interval Silent Speak SpeakNestingLevel".split(" "),
|
|
Prime: ["Auto", "Angle", "Length"],
|
|
Roots: ["Auto", "PosNegSqRoot", "PosNegSqRootEnd", "RootEnd"],
|
|
SetMemberSymbol: ["Auto", "Belongs", "Element", "Member"],
|
|
Sets: ["Auto", "SilentBracket", "woAll"],
|
|
TriangleSymbol: ["Auto", "Delta"],
|
|
Trig: ["Auto", "ArcTrig", "TrigInverse", "Reciprocal"],
|
|
VerticalLine: ["Auto", "Divides", "Given", "SuchThat"],
|
|
});
|
|
sre.ClearspeakPreferences.comparator = function () {
|
|
return new sre.ClearspeakPreferences.Comparator(
|
|
sre.Engine.getInstance().dynamicCstr,
|
|
sre.DynamicProperties.create(
|
|
[sre.DynamicCstr.DEFAULT_VALUES[sre.DynamicCstr.Axis.LOCALE]],
|
|
[sre.DynamicCstr.DEFAULT_VALUES[sre.DynamicCstr.Axis.MODALITY]],
|
|
[sre.DynamicCstr.DEFAULT_VALUES[sre.DynamicCstr.Axis.DOMAIN]],
|
|
[sre.DynamicCstr.DEFAULT_VALUES[sre.DynamicCstr.Axis.STYLE]],
|
|
),
|
|
);
|
|
};
|
|
sre.ClearspeakPreferences.Comparator = function (a, b) {
|
|
sre.DynamicCstr.DefaultComparator.call(this, a, b);
|
|
this.preference = a.preference || {};
|
|
};
|
|
goog.inherits(
|
|
sre.ClearspeakPreferences.Comparator,
|
|
sre.DynamicCstr.DefaultComparator,
|
|
);
|
|
sre.ClearspeakPreferences.Comparator.prototype.match = function (a) {
|
|
if (!sre.ClearspeakPreferences.Comparator.superClass_.match.call(this, a))
|
|
return !1;
|
|
if (!a.preference) return !0;
|
|
for (var b = Object.keys(a.preference), c = 0, d; (d = b[c]); c++)
|
|
if (this.preference[d] !== a.preference[d]) return !1;
|
|
return !0;
|
|
};
|
|
sre.ClearspeakPreferences.Comparator.prototype.compare = function (a, b) {
|
|
var c = sre.ClearspeakPreferences.Comparator.superClass_.compare.call(
|
|
this,
|
|
a,
|
|
b,
|
|
);
|
|
if (0 !== c) return c;
|
|
if (!a.preference && b.preference) return 1;
|
|
if (a.preference && !b.preference) return -1;
|
|
if (!a.preference && !b.preference) return 0;
|
|
a = Object.keys(a.preference).length;
|
|
b = Object.keys(b.preference).length;
|
|
return a > b ? -1 : a < b ? 1 : 0;
|
|
};
|
|
sre.ClearspeakPreferences.Parser = function () {
|
|
sre.DynamicCstr.Parser.call(this, [
|
|
sre.DynamicCstr.Axis.LOCALE,
|
|
sre.DynamicCstr.Axis.MODALITY,
|
|
sre.DynamicCstr.Axis.DOMAIN,
|
|
sre.DynamicCstr.Axis.STYLE,
|
|
]);
|
|
};
|
|
goog.inherits(sre.ClearspeakPreferences.Parser, sre.DynamicCstr.Parser);
|
|
sre.ClearspeakPreferences.Parser.prototype.parse = function (a) {
|
|
var b = sre.ClearspeakPreferences.Parser.superClass_.parse.call(this, a);
|
|
a = b.getValue(sre.DynamicCstr.Axis.STYLE);
|
|
b = b.getValue(sre.DynamicCstr.Axis.LOCALE);
|
|
var c = {};
|
|
a !== sre.DynamicCstr.DEFAULT_VALUE &&
|
|
((c = this.fromPreference(a)), (a = this.toPreference(c)));
|
|
return new sre.ClearspeakPreferences(
|
|
{
|
|
locale: b,
|
|
modality: sre.DynamicCstr.DEFAULT_VALUES[sre.DynamicCstr.Axis.MODALITY],
|
|
domain: "clearspeak",
|
|
style: a,
|
|
},
|
|
c,
|
|
);
|
|
};
|
|
sre.ClearspeakPreferences.Parser.prototype.fromPreference = function (a) {
|
|
return sre.ClearspeakPreferences.fromPreference(a);
|
|
};
|
|
sre.ClearspeakPreferences.fromPreference = function (a) {
|
|
a = a.split(":");
|
|
for (
|
|
var b = {},
|
|
c = sre.ClearspeakPreferences.PREFERENCES.getProperties(),
|
|
d = Object.keys(c),
|
|
e = 0,
|
|
f;
|
|
(f = a[e]);
|
|
e++
|
|
)
|
|
if (((f = f.split("_")), -1 !== d.indexOf(f[0]))) {
|
|
var g = f[1];
|
|
g &&
|
|
g !== sre.ClearspeakPreferences.AUTO &&
|
|
-1 !== c[f[0]].indexOf(g) &&
|
|
(b[f[0]] = f[1]);
|
|
}
|
|
return b;
|
|
};
|
|
sre.ClearspeakPreferences.Parser.prototype.toPreference = function (a) {
|
|
return sre.ClearspeakPreferences.toPreference(a);
|
|
};
|
|
sre.ClearspeakPreferences.toPreference = function (a) {
|
|
for (var b = Object.keys(a), c = [], d = 0; d < b.length; d++)
|
|
c.push(b[d] + "_" + a[b[d]]);
|
|
return c.length ? c.join(":") : sre.DynamicCstr.DEFAULT_VALUE;
|
|
};
|
|
sre.ClearspeakPreferences.LOCALE_PREFERENCES = null;
|
|
sre.ClearspeakPreferences.getLocalePreferences = function (a) {
|
|
sre.ClearspeakPreferences.LOCALE_PREFERENCES ||
|
|
((a =
|
|
a ||
|
|
sre.MathCompoundStore.getInstance().enumerate(
|
|
sre.SpeechRuleEngine.getInstance().enumerate(),
|
|
)),
|
|
(sre.ClearspeakPreferences.LOCALE_PREFERENCES =
|
|
sre.ClearspeakPreferences.getLocalePreferences_(a)));
|
|
return sre.ClearspeakPreferences.LOCALE_PREFERENCES;
|
|
};
|
|
sre.ClearspeakPreferences.getLocalePreferences_ = function (a) {
|
|
var b = {},
|
|
c;
|
|
for (c in a)
|
|
if (a[c].speech && a[c].speech.clearspeak) {
|
|
var d = Object.keys(a[c].speech.clearspeak),
|
|
e = (b[c] = {}),
|
|
f;
|
|
for (f in sre.ClearspeakPreferences.PREFERENCES.getProperties()) {
|
|
var g = sre.ClearspeakPreferences.PREFERENCES.getProperties()[f],
|
|
h = [f + "_Auto"];
|
|
if (g) {
|
|
g = $jscomp.makeIterator(g);
|
|
for (var k = g.next(); !k.done; k = g.next())
|
|
(k = k.value), -1 !== d.indexOf(f + "_" + k) && h.push(f + "_" + k);
|
|
}
|
|
e[f] = h;
|
|
}
|
|
}
|
|
return b;
|
|
};
|
|
sre.ClearspeakPreferences.getSpeechExplorer = function (a) {
|
|
return (a = a.attached) && a.length
|
|
? a.find(function (b) {
|
|
return (
|
|
b.speechGenerator &&
|
|
"speech" === b.speechGenerator.getOptions().modality
|
|
);
|
|
})
|
|
: null;
|
|
};
|
|
sre.ClearspeakPreferences.smartPreferences = function (a, b) {
|
|
b = sre.ClearspeakPreferences.getLocalePreferences()[b];
|
|
if (!b) return [];
|
|
a = sre.ClearspeakPreferences.getSpeechExplorer(a);
|
|
if (!a)
|
|
return [
|
|
{
|
|
type: "radio",
|
|
content: "Standard",
|
|
id: "clearspeak-default",
|
|
variable: "speechRules",
|
|
},
|
|
];
|
|
a = sre.ClearspeakPreferences.relevantPreferences(
|
|
a.walker.getFocus().getSemanticPrimary(),
|
|
);
|
|
var c = sre.Engine.DOMAIN_TO_STYLES.clearspeak;
|
|
return [
|
|
{
|
|
type: "radio",
|
|
content: "No Preferences",
|
|
id: "clearspeak-default",
|
|
variable: "speechRules",
|
|
},
|
|
{
|
|
type: "radio",
|
|
content: "Current Preferences",
|
|
id: "clearspeak-" + c,
|
|
variable: "speechRules",
|
|
},
|
|
{ type: "rule" },
|
|
{ type: "label", content: "Preferences for " + a },
|
|
{ type: "rule" },
|
|
].concat(
|
|
b[a].map(function (d) {
|
|
d = d.split("_");
|
|
return {
|
|
type: "radio",
|
|
content: d[1],
|
|
id:
|
|
"clearspeak-" +
|
|
sre.ClearspeakPreferences.addPreference(c, d[0], d[1]),
|
|
variable: "speechRules",
|
|
};
|
|
}),
|
|
);
|
|
};
|
|
sre.ClearspeakPreferences.relevantPreferences = function (a) {
|
|
var b = sre.ClearspeakPreferences.SEMANTIC_MAPPING_[a.type];
|
|
return b ? b[a.role] || b[""] || "ImpliedTimes" : "ImpliedTimes";
|
|
};
|
|
sre.ClearspeakPreferences.REVERSE_MAPPING_ = [
|
|
[
|
|
"AbsoluteValue",
|
|
sre.SemanticAttr.Type.FENCED,
|
|
sre.SemanticAttr.Role.NEUTRAL,
|
|
],
|
|
["Bar", sre.SemanticAttr.Type.OVERSCORE, sre.SemanticAttr.Role.OVERACCENT],
|
|
["Caps", sre.SemanticAttr.Type.IDENTIFIER, sre.SemanticAttr.Role.LATINLETTER],
|
|
[
|
|
"CombinationPermutation",
|
|
sre.SemanticAttr.Type.APPL,
|
|
sre.SemanticAttr.Role.UNKNOWN,
|
|
],
|
|
[
|
|
"Ellipses",
|
|
sre.SemanticAttr.Type.PUNCTUATION,
|
|
sre.SemanticAttr.Role.ELLIPSIS,
|
|
],
|
|
["Exponent", sre.SemanticAttr.Type.SUPERSCRIPT, ""],
|
|
["Fraction", sre.SemanticAttr.Type.FRACTION, ""],
|
|
["Functions", sre.SemanticAttr.Type.APPL, sre.SemanticAttr.Role.SIMPLEFUNC],
|
|
[
|
|
"ImpliedTimes",
|
|
sre.SemanticAttr.Type.OPERATOR,
|
|
sre.SemanticAttr.Role.IMPLICIT,
|
|
],
|
|
["Log", sre.SemanticAttr.Type.APPL, sre.SemanticAttr.Role.PREFIXFUNC],
|
|
["Matrix", sre.SemanticAttr.Type.MATRIX, ""],
|
|
["Matrix", sre.SemanticAttr.Type.VECTOR, ""],
|
|
[
|
|
"MultiLineLabel",
|
|
sre.SemanticAttr.Type.MULTILINE,
|
|
sre.SemanticAttr.Role.LABEL,
|
|
],
|
|
[
|
|
"MultiLineOverview",
|
|
sre.SemanticAttr.Type.MULTILINE,
|
|
sre.SemanticAttr.Role.TABLE,
|
|
],
|
|
[
|
|
"MultiLinePausesBetweenColumns",
|
|
sre.SemanticAttr.Type.MULTILINE,
|
|
sre.SemanticAttr.Role.TABLE,
|
|
],
|
|
["MultiLineLabel", sre.SemanticAttr.Type.TABLE, sre.SemanticAttr.Role.LABEL],
|
|
[
|
|
"MultiLineOverview",
|
|
sre.SemanticAttr.Type.TABLE,
|
|
sre.SemanticAttr.Role.TABLE,
|
|
],
|
|
[
|
|
"MultiLinePausesBetweenColumns",
|
|
sre.SemanticAttr.Type.TABLE,
|
|
sre.SemanticAttr.Role.TABLE,
|
|
],
|
|
["MultiLineLabel", sre.SemanticAttr.Type.CASES, sre.SemanticAttr.Role.LABEL],
|
|
[
|
|
"MultiLineOverview",
|
|
sre.SemanticAttr.Type.CASES,
|
|
sre.SemanticAttr.Role.TABLE,
|
|
],
|
|
[
|
|
"MultiLinePausesBetweenColumns",
|
|
sre.SemanticAttr.Type.CASES,
|
|
sre.SemanticAttr.Role.TABLE,
|
|
],
|
|
[
|
|
"MultsymbolDot",
|
|
sre.SemanticAttr.Type.OPERATOR,
|
|
sre.SemanticAttr.Role.MULTIPLICATION,
|
|
],
|
|
[
|
|
"MultsymbolX",
|
|
sre.SemanticAttr.Type.OPERATOR,
|
|
sre.SemanticAttr.Role.MULTIPLICATION,
|
|
],
|
|
["Paren", sre.SemanticAttr.Type.FENCED, sre.SemanticAttr.Role.LEFTRIGHT],
|
|
["Prime", sre.SemanticAttr.Type.SUPERSCRIPT, sre.SemanticAttr.Role.PRIME],
|
|
["Roots", sre.SemanticAttr.Type.ROOT, ""],
|
|
["Roots", sre.SemanticAttr.Type.SQRT, ""],
|
|
[
|
|
"SetMemberSymbol",
|
|
sre.SemanticAttr.Type.RELATION,
|
|
sre.SemanticAttr.Role.ELEMENT,
|
|
],
|
|
["Sets", sre.SemanticAttr.Type.FENCED, sre.SemanticAttr.Role.SETEXT],
|
|
[
|
|
"TriangleSymbol",
|
|
sre.SemanticAttr.Type.IDENTIFIER,
|
|
sre.SemanticAttr.Role.GREEKLETTER,
|
|
],
|
|
["Trig", sre.SemanticAttr.Type.APPL, sre.SemanticAttr.Role.PREFIXFUNC],
|
|
[
|
|
"VerticalLine",
|
|
sre.SemanticAttr.Type.PUNCTUATED,
|
|
sre.SemanticAttr.Role.VBAR,
|
|
],
|
|
];
|
|
sre.ClearspeakPreferences.SEMANTIC_MAPPING_ = (function () {
|
|
for (
|
|
var a = {}, b = 0, c;
|
|
(c = sre.ClearspeakPreferences.REVERSE_MAPPING_[b]);
|
|
b++
|
|
) {
|
|
var d = c[0],
|
|
e = a[c[1]];
|
|
e || ((e = {}), (a[c[1]] = e));
|
|
e[c[2]] = d;
|
|
}
|
|
return a;
|
|
})();
|
|
sre.ClearspeakPreferences.findPreference = function (a, b) {
|
|
return "default" === a
|
|
? sre.ClearspeakPreferences.AUTO
|
|
: sre.ClearspeakPreferences.fromPreference(a)[b] ||
|
|
sre.ClearspeakPreferences.AUTO;
|
|
};
|
|
sre.ClearspeakPreferences.addPreference = function (a, b, c) {
|
|
if ("default" === a) return b + "_" + c;
|
|
a = sre.ClearspeakPreferences.fromPreference(a);
|
|
a[b] = c;
|
|
return sre.ClearspeakPreferences.toPreference(a);
|
|
};
|
|
sre.Engine.getInstance().comparators.clearspeak =
|
|
sre.ClearspeakPreferences.comparator;
|
|
sre.Engine.getInstance().parsers.clearspeak =
|
|
new sre.ClearspeakPreferences.Parser();
|
|
sre.AlphabetGenerator = {};
|
|
sre.AlphabetGenerator.Font = {
|
|
BOLD: "bold",
|
|
BOLDFRAKTUR: "bold-fraktur",
|
|
BOLDITALIC: "bold-italic",
|
|
BOLDSCRIPT: "bold-script",
|
|
DOUBLESTRUCK: "double-struck",
|
|
FULLWIDTH: "fullwidth",
|
|
FRAKTUR: "fraktur",
|
|
ITALIC: "italic",
|
|
MONOSPACE: "monospace",
|
|
NORMAL: "normal",
|
|
SCRIPT: "script",
|
|
SANSSERIF: "sans-serif",
|
|
SANSSERIFITALIC: "sans-serif-italic",
|
|
SANSSERIFBOLD: "sans-serif-bold",
|
|
SANSSERIFBOLDITALIC: "sans-serif-bold-italic",
|
|
};
|
|
sre.AlphabetGenerator.Embellish = {
|
|
SUPER: "super",
|
|
SUB: "sub",
|
|
CIRCLED: "circled",
|
|
PARENTHESIZED: "parenthesized",
|
|
PERIOD: "period",
|
|
NEGATIVECIRCLED: "negative-circled",
|
|
DOUBLECIRCLED: "double-circled",
|
|
CIRCLEDSANSSERIF: "circled-sans-serif",
|
|
NEGATIVECIRCLEDSANSSERIF: "negative-circled-sans-serif",
|
|
COMMA: "comma",
|
|
SQUARED: "squared",
|
|
NEGATIVESQUARED: "negative-squared",
|
|
};
|
|
sre.AlphabetGenerator.Base = {
|
|
LATINCAP: "latinCap",
|
|
LATINSMALL: "latinSmall",
|
|
GREEKCAP: "greekCap",
|
|
GREEKSMALL: "greekSmall",
|
|
DIGIT: "digit",
|
|
};
|
|
sre.AlphabetGenerator.Domains_ = {
|
|
small: ["default"],
|
|
capital: ["default"],
|
|
digit: ["default"],
|
|
};
|
|
sre.AlphabetGenerator.makeDomains_ = function () {
|
|
var a = sre.Messages.ALPHABET_PREFIXES,
|
|
b = sre.Messages.ALPHABET_TRANSFORMERS,
|
|
c = function (d, e) {
|
|
var f = {};
|
|
Object.keys(d).forEach(function (g) {
|
|
f[g] = !0;
|
|
});
|
|
Object.keys(e).forEach(function (g) {
|
|
f[g] = !0;
|
|
});
|
|
return Object.keys(f);
|
|
};
|
|
sre.AlphabetGenerator.Domains_.small = c(a.smallPrefix, b.letter);
|
|
sre.AlphabetGenerator.Domains_.capital = c(a.capPrefix, b.letter);
|
|
sre.AlphabetGenerator.Domains_.digit = c(a.digitPrefix, b.digit);
|
|
};
|
|
sre.AlphabetGenerator.generate = function (a, b) {
|
|
var c = sre.Engine.getInstance().locale;
|
|
sre.Engine.getInstance().locale = a;
|
|
sre.L10n.setLocale();
|
|
b.addSymbolRules({ locale: a });
|
|
sre.AlphabetGenerator.makeDomains_();
|
|
a = sre.AlphabetGenerator.INTERVALS;
|
|
for (var d = 0, e; (e = a[d]); d++) {
|
|
var f = sre.AlphabetGenerator.makeInterval(e.interval, e.subst),
|
|
g = f.map(function (h) {
|
|
return sre.SemanticUtil.numberToUnicode(parseInt(h, 16));
|
|
});
|
|
"offset" in e
|
|
? sre.AlphabetGenerator.numberRules(
|
|
b,
|
|
f,
|
|
g,
|
|
e.font,
|
|
e.category,
|
|
e.offset || 0,
|
|
)
|
|
: sre.AlphabetGenerator.alphabetRules(
|
|
b,
|
|
f,
|
|
g,
|
|
sre.Messages.ALPHABETS[e.base],
|
|
e.font,
|
|
e.category,
|
|
!!e.capital,
|
|
);
|
|
}
|
|
sre.Engine.getInstance().locale = c;
|
|
sre.L10n.setLocale();
|
|
};
|
|
sre.AlphabetGenerator.makeInterval = function (a, b) {
|
|
var c = parseInt(a[0], 16);
|
|
a = parseInt(a[1], 16);
|
|
for (var d = []; c <= a; c++) {
|
|
var e = c.toString(16).toUpperCase();
|
|
e = 3 < e.length ? e : ("000" + e).slice(-4);
|
|
!1 !== b[e] && ((e = b[e] || e), d.push(e));
|
|
}
|
|
return d;
|
|
};
|
|
sre.AlphabetGenerator.getFont = function (a) {
|
|
a =
|
|
"normal" === a || "fullwidth" === a
|
|
? ""
|
|
: sre.Messages.FONT[a] || sre.Messages.EMBELLISH[a] || "";
|
|
return "string" === typeof a
|
|
? { font: a, combiner: sre.Messages.ALPHABET_COMBINER }
|
|
: { font: a[0], combiner: a[1] };
|
|
};
|
|
sre.AlphabetGenerator.alphabetRules = function (a, b, c, d, e, f, g) {
|
|
e = sre.AlphabetGenerator.getFont(e);
|
|
for (var h = 0, k, l, m; (k = b[h]), (l = c[h]), (m = d[h]); h++)
|
|
sre.AlphabetGenerator.makeLetter(
|
|
a,
|
|
e.combiner,
|
|
k,
|
|
l,
|
|
m,
|
|
e.font,
|
|
g
|
|
? sre.Messages.ALPHABET_PREFIXES.capPrefix
|
|
: sre.Messages.ALPHABET_PREFIXES.smallPrefix,
|
|
f,
|
|
sre.Messages.ALPHABET_TRANSFORMERS.letter,
|
|
g
|
|
? sre.AlphabetGenerator.Domains_.capital
|
|
: sre.AlphabetGenerator.Domains_.small,
|
|
);
|
|
};
|
|
sre.AlphabetGenerator.numberRules = function (a, b, c, d, e, f) {
|
|
d = sre.AlphabetGenerator.getFont(d);
|
|
for (var g = 0, h, k; (h = b[g]), (k = c[g]); g++)
|
|
sre.AlphabetGenerator.makeLetter(
|
|
a,
|
|
d.combiner,
|
|
h,
|
|
k,
|
|
g + f,
|
|
d.font,
|
|
sre.Messages.ALPHABET_PREFIXES.digitPrefix,
|
|
e,
|
|
sre.Messages.ALPHABET_TRANSFORMERS.digit,
|
|
sre.AlphabetGenerator.Domains_.digit,
|
|
);
|
|
};
|
|
sre.AlphabetGenerator.makeLetter = function (a, b, c, d, e, f, g, h, k, l) {
|
|
for (var m = 0, n; (n = l[m]); m++) {
|
|
var p = n in g ? g[n] : g["default"];
|
|
a.defineRule(
|
|
c.toString(),
|
|
n,
|
|
"default",
|
|
h,
|
|
d,
|
|
b((n in k ? k[n] : k["default"])(e), f, p),
|
|
);
|
|
}
|
|
};
|
|
sre.AlphabetGenerator.INTERVALS = [
|
|
{
|
|
interval: ["1D400", "1D419"],
|
|
base: sre.AlphabetGenerator.Base.LATINCAP,
|
|
subst: {},
|
|
capital: !0,
|
|
category: "Lu",
|
|
font: sre.AlphabetGenerator.Font.BOLD,
|
|
},
|
|
{
|
|
interval: ["1D41A", "1D433"],
|
|
base: sre.AlphabetGenerator.Base.LATINSMALL,
|
|
subst: {},
|
|
capital: !1,
|
|
category: "Ll",
|
|
font: sre.AlphabetGenerator.Font.BOLD,
|
|
},
|
|
{
|
|
interval: ["1D56C", "1D585"],
|
|
base: sre.AlphabetGenerator.Base.LATINCAP,
|
|
subst: {},
|
|
capital: !0,
|
|
category: "Lu",
|
|
font: sre.AlphabetGenerator.Font.BOLDFRAKTUR,
|
|
},
|
|
{
|
|
interval: ["1D586", "1D59F"],
|
|
base: sre.AlphabetGenerator.Base.LATINSMALL,
|
|
subst: {},
|
|
capital: !1,
|
|
category: "Ll",
|
|
font: sre.AlphabetGenerator.Font.BOLDFRAKTUR,
|
|
},
|
|
{
|
|
interval: ["1D468", "1D481"],
|
|
base: sre.AlphabetGenerator.Base.LATINCAP,
|
|
subst: {},
|
|
capital: !0,
|
|
category: "Lu",
|
|
font: sre.AlphabetGenerator.Font.BOLDITALIC,
|
|
},
|
|
{
|
|
interval: ["1D482", "1D49B"],
|
|
base: sre.AlphabetGenerator.Base.LATINSMALL,
|
|
subst: {},
|
|
capital: !1,
|
|
category: "Ll",
|
|
font: sre.AlphabetGenerator.Font.BOLDITALIC,
|
|
},
|
|
{
|
|
interval: ["1D4D0", "1D4E9"],
|
|
base: sre.AlphabetGenerator.Base.LATINCAP,
|
|
subst: {},
|
|
capital: !0,
|
|
category: "Lu",
|
|
font: sre.AlphabetGenerator.Font.BOLDSCRIPT,
|
|
},
|
|
{
|
|
interval: ["1D4EA", "1D503"],
|
|
base: sre.AlphabetGenerator.Base.LATINSMALL,
|
|
subst: {},
|
|
capital: !1,
|
|
category: "Ll",
|
|
font: sre.AlphabetGenerator.Font.BOLDSCRIPT,
|
|
},
|
|
{
|
|
interval: ["1D538", "1D551"],
|
|
base: sre.AlphabetGenerator.Base.LATINCAP,
|
|
subst: {
|
|
"1D53A": "2102",
|
|
"1D53F": "210D",
|
|
"1D545": "2115",
|
|
"1D547": "2119",
|
|
"1D548": "211A",
|
|
"1D549": "211D",
|
|
"1D551": "2124",
|
|
},
|
|
capital: !0,
|
|
category: "Lu",
|
|
font: sre.AlphabetGenerator.Font.DOUBLESTRUCK,
|
|
},
|
|
{
|
|
interval: ["1D552", "1D56B"],
|
|
base: sre.AlphabetGenerator.Base.LATINSMALL,
|
|
subst: {},
|
|
capital: !1,
|
|
category: "Ll",
|
|
font: sre.AlphabetGenerator.Font.DOUBLESTRUCK,
|
|
},
|
|
{
|
|
interval: ["1D504", "1D51D"],
|
|
base: sre.AlphabetGenerator.Base.LATINCAP,
|
|
subst: {
|
|
"1D506": "212D",
|
|
"1D50B": "210C",
|
|
"1D50C": "2111",
|
|
"1D515": "211C",
|
|
"1D51D": "2128",
|
|
},
|
|
capital: !0,
|
|
category: "Lu",
|
|
font: sre.AlphabetGenerator.Font.FRAKTUR,
|
|
},
|
|
{
|
|
interval: ["1D51E", "1D537"],
|
|
base: sre.AlphabetGenerator.Base.LATINSMALL,
|
|
subst: {},
|
|
capital: !1,
|
|
category: "Ll",
|
|
font: sre.AlphabetGenerator.Font.FRAKTUR,
|
|
},
|
|
{
|
|
interval: ["FF21", "FF3A"],
|
|
base: sre.AlphabetGenerator.Base.LATINCAP,
|
|
subst: {},
|
|
capital: !0,
|
|
category: "Lu",
|
|
font: sre.AlphabetGenerator.Font.FULLWIDTH,
|
|
},
|
|
{
|
|
interval: ["FF41", "FF5A"],
|
|
base: sre.AlphabetGenerator.Base.LATINSMALL,
|
|
subst: {},
|
|
capital: !1,
|
|
category: "Ll",
|
|
font: sre.AlphabetGenerator.Font.FULLWIDTH,
|
|
},
|
|
{
|
|
interval: ["1D434", "1D44D"],
|
|
base: sre.AlphabetGenerator.Base.LATINCAP,
|
|
subst: {},
|
|
capital: !0,
|
|
category: "Lu",
|
|
font: sre.AlphabetGenerator.Font.ITALIC,
|
|
},
|
|
{
|
|
interval: ["1D44E", "1D467"],
|
|
base: sre.AlphabetGenerator.Base.LATINSMALL,
|
|
subst: { "1D455": "210E" },
|
|
capital: !1,
|
|
category: "Ll",
|
|
font: sre.AlphabetGenerator.Font.ITALIC,
|
|
},
|
|
{
|
|
interval: ["1D670", "1D689"],
|
|
base: sre.AlphabetGenerator.Base.LATINCAP,
|
|
subst: {},
|
|
capital: !0,
|
|
category: "Lu",
|
|
font: sre.AlphabetGenerator.Font.MONOSPACE,
|
|
},
|
|
{
|
|
interval: ["1D68A", "1D6A3"],
|
|
base: sre.AlphabetGenerator.Base.LATINSMALL,
|
|
subst: {},
|
|
capital: !1,
|
|
category: "Ll",
|
|
font: sre.AlphabetGenerator.Font.MONOSPACE,
|
|
},
|
|
{
|
|
interval: ["0041", "005A"],
|
|
base: sre.AlphabetGenerator.Base.LATINCAP,
|
|
subst: {},
|
|
capital: !0,
|
|
category: "Lu",
|
|
font: sre.AlphabetGenerator.Font.NORMAL,
|
|
},
|
|
{
|
|
interval: ["0061", "007A"],
|
|
base: sre.AlphabetGenerator.Base.LATINSMALL,
|
|
subst: {},
|
|
capital: !1,
|
|
category: "Ll",
|
|
font: sre.AlphabetGenerator.Font.NORMAL,
|
|
},
|
|
{
|
|
interval: ["1D49C", "1D4B5"],
|
|
base: sre.AlphabetGenerator.Base.LATINCAP,
|
|
subst: {
|
|
"1D49D": "212C",
|
|
"1D4A0": "2130",
|
|
"1D4A1": "2131",
|
|
"1D4A3": "210B",
|
|
"1D4A4": "2110",
|
|
"1D4A7": "2112",
|
|
"1D4A8": "2133",
|
|
"1D4AD": "211B",
|
|
},
|
|
capital: !0,
|
|
category: "Lu",
|
|
font: sre.AlphabetGenerator.Font.SCRIPT,
|
|
},
|
|
{
|
|
interval: ["1D4B6", "1D4CF"],
|
|
base: sre.AlphabetGenerator.Base.LATINSMALL,
|
|
subst: { "1D4BA": "212F", "1D4BC": "210A", "1D4C4": "2134" },
|
|
capital: !1,
|
|
category: "Ll",
|
|
font: sre.AlphabetGenerator.Font.SCRIPT,
|
|
},
|
|
{
|
|
interval: ["1D5A0", "1D5B9"],
|
|
base: sre.AlphabetGenerator.Base.LATINCAP,
|
|
subst: {},
|
|
capital: !0,
|
|
category: "Lu",
|
|
font: sre.AlphabetGenerator.Font.SANSSERIF,
|
|
},
|
|
{
|
|
interval: ["1D5BA", "1D5D3"],
|
|
base: sre.AlphabetGenerator.Base.LATINSMALL,
|
|
subst: {},
|
|
capital: !1,
|
|
category: "Ll",
|
|
font: sre.AlphabetGenerator.Font.SANSSERIF,
|
|
},
|
|
{
|
|
interval: ["1D608", "1D621"],
|
|
base: sre.AlphabetGenerator.Base.LATINCAP,
|
|
subst: {},
|
|
capital: !0,
|
|
category: "Lu",
|
|
font: sre.AlphabetGenerator.Font.SANSSERIFITALIC,
|
|
},
|
|
{
|
|
interval: ["1D622", "1D63B"],
|
|
base: sre.AlphabetGenerator.Base.LATINSMALL,
|
|
subst: {},
|
|
capital: !1,
|
|
category: "Ll",
|
|
font: sre.AlphabetGenerator.Font.SANSSERIFITALIC,
|
|
},
|
|
{
|
|
interval: ["1D5D4", "1D5ED"],
|
|
base: sre.AlphabetGenerator.Base.LATINCAP,
|
|
subst: {},
|
|
capital: !0,
|
|
category: "Lu",
|
|
font: sre.AlphabetGenerator.Font.SANSSERIFBOLD,
|
|
},
|
|
{
|
|
interval: ["1D5EE", "1D607"],
|
|
base: sre.AlphabetGenerator.Base.LATINSMALL,
|
|
subst: {},
|
|
capital: !1,
|
|
category: "Ll",
|
|
font: sre.AlphabetGenerator.Font.SANSSERIFBOLD,
|
|
},
|
|
{
|
|
interval: ["1D63C", "1D655"],
|
|
base: sre.AlphabetGenerator.Base.LATINCAP,
|
|
subst: {},
|
|
capital: !0,
|
|
category: "Lu",
|
|
font: sre.AlphabetGenerator.Font.SANSSERIFBOLDITALIC,
|
|
},
|
|
{
|
|
interval: ["1D656", "1D66F"],
|
|
base: sre.AlphabetGenerator.Base.LATINSMALL,
|
|
subst: {},
|
|
capital: !1,
|
|
category: "Ll",
|
|
font: sre.AlphabetGenerator.Font.SANSSERIFBOLDITALIC,
|
|
},
|
|
{
|
|
interval: ["0391", "03A9"],
|
|
base: sre.AlphabetGenerator.Base.GREEKCAP,
|
|
subst: { "03A2": "03F4" },
|
|
capital: !0,
|
|
category: "Lu",
|
|
font: sre.AlphabetGenerator.Font.NORMAL,
|
|
},
|
|
{
|
|
interval: ["03B0", "03D0"],
|
|
base: sre.AlphabetGenerator.Base.GREEKSMALL,
|
|
subst: {
|
|
"03B0": "2207",
|
|
"03CA": "2202",
|
|
"03CB": "03F5",
|
|
"03CC": "03D1",
|
|
"03CD": "03F0",
|
|
"03CE": "03D5",
|
|
"03CF": "03F1",
|
|
"03D0": "03D6",
|
|
},
|
|
capital: !1,
|
|
category: "Ll",
|
|
font: sre.AlphabetGenerator.Font.NORMAL,
|
|
},
|
|
{
|
|
interval: ["1D6A8", "1D6C0"],
|
|
base: sre.AlphabetGenerator.Base.GREEKCAP,
|
|
subst: {},
|
|
capital: !0,
|
|
category: "Lu",
|
|
font: sre.AlphabetGenerator.Font.BOLD,
|
|
},
|
|
{
|
|
interval: ["1D6C1", "1D6E1"],
|
|
base: sre.AlphabetGenerator.Base.GREEKSMALL,
|
|
subst: {},
|
|
capital: !1,
|
|
category: "Ll",
|
|
font: sre.AlphabetGenerator.Font.BOLD,
|
|
},
|
|
{
|
|
interval: ["1D6E2", "1D6FA"],
|
|
base: sre.AlphabetGenerator.Base.GREEKCAP,
|
|
subst: {},
|
|
capital: !0,
|
|
category: "Lu",
|
|
font: sre.AlphabetGenerator.Font.ITALIC,
|
|
},
|
|
{
|
|
interval: ["1D6FB", "1D71B"],
|
|
base: sre.AlphabetGenerator.Base.GREEKSMALL,
|
|
subst: {},
|
|
capital: !1,
|
|
category: "Ll",
|
|
font: sre.AlphabetGenerator.Font.ITALIC,
|
|
},
|
|
{
|
|
interval: ["1D71C", "1D734"],
|
|
base: sre.AlphabetGenerator.Base.GREEKCAP,
|
|
subst: {},
|
|
capital: !0,
|
|
category: "Lu",
|
|
font: sre.AlphabetGenerator.Font.BOLDITALIC,
|
|
},
|
|
{
|
|
interval: ["1D735", "1D755"],
|
|
base: sre.AlphabetGenerator.Base.GREEKSMALL,
|
|
subst: {},
|
|
capital: !1,
|
|
category: "Ll",
|
|
font: sre.AlphabetGenerator.Font.BOLDITALIC,
|
|
},
|
|
{
|
|
interval: ["1D756", "1D76E"],
|
|
base: sre.AlphabetGenerator.Base.GREEKCAP,
|
|
subst: {},
|
|
capital: !0,
|
|
category: "Lu",
|
|
font: sre.AlphabetGenerator.Font.SANSSERIFBOLD,
|
|
},
|
|
{
|
|
interval: ["1D76F", "1D78F"],
|
|
base: sre.AlphabetGenerator.Base.GREEKSMALL,
|
|
subst: {},
|
|
capital: !1,
|
|
category: "Ll",
|
|
font: sre.AlphabetGenerator.Font.SANSSERIFBOLD,
|
|
},
|
|
{
|
|
interval: ["1D790", "1D7A8"],
|
|
base: sre.AlphabetGenerator.Base.GREEKCAP,
|
|
subst: {},
|
|
capital: !0,
|
|
category: "Lu",
|
|
font: sre.AlphabetGenerator.Font.SANSSERIFBOLDITALIC,
|
|
},
|
|
{
|
|
interval: ["1D7A9", "1D7C9"],
|
|
base: sre.AlphabetGenerator.Base.GREEKSMALL,
|
|
subst: {},
|
|
capital: !1,
|
|
category: "Ll",
|
|
font: sre.AlphabetGenerator.Font.SANSSERIFBOLDITALIC,
|
|
},
|
|
{
|
|
interval: ["0030", "0039"],
|
|
base: sre.AlphabetGenerator.Base.DIGIT,
|
|
subst: {},
|
|
offset: 0,
|
|
category: "Nd",
|
|
font: sre.AlphabetGenerator.Font.NORMAL,
|
|
},
|
|
{
|
|
interval: ["2070", "2079"],
|
|
base: sre.AlphabetGenerator.Base.DIGIT,
|
|
subst: { 2071: "00B9", 2072: "00B2", 2073: "00B3" },
|
|
offset: 0,
|
|
category: "No",
|
|
font: sre.AlphabetGenerator.Embellish.SUPER,
|
|
},
|
|
{
|
|
interval: ["2080", "2089"],
|
|
base: sre.AlphabetGenerator.Base.DIGIT,
|
|
subst: {},
|
|
offset: 0,
|
|
category: "No",
|
|
font: sre.AlphabetGenerator.Embellish.SUB,
|
|
},
|
|
{
|
|
interval: ["245F", "2473"],
|
|
base: sre.AlphabetGenerator.Base.DIGIT,
|
|
subst: { "245F": "24EA" },
|
|
offset: 0,
|
|
category: "No",
|
|
font: sre.AlphabetGenerator.Embellish.CIRCLED,
|
|
},
|
|
{
|
|
interval: ["3251", "325F"],
|
|
base: sre.AlphabetGenerator.Base.DIGIT,
|
|
subst: {},
|
|
offset: 21,
|
|
category: "No",
|
|
font: sre.AlphabetGenerator.Embellish.CIRCLED,
|
|
},
|
|
{
|
|
interval: ["32B1", "32BF"],
|
|
base: sre.AlphabetGenerator.Base.DIGIT,
|
|
subst: {},
|
|
offset: 36,
|
|
category: "No",
|
|
font: sre.AlphabetGenerator.Embellish.CIRCLED,
|
|
},
|
|
{
|
|
interval: ["2474", "2487"],
|
|
base: sre.AlphabetGenerator.Base.DIGIT,
|
|
subst: {},
|
|
offset: 1,
|
|
category: "No",
|
|
font: sre.AlphabetGenerator.Embellish.PARENTHESIZED,
|
|
},
|
|
{
|
|
interval: ["2487", "249B"],
|
|
base: sre.AlphabetGenerator.Base.DIGIT,
|
|
subst: { 2487: "1F100" },
|
|
offset: 0,
|
|
category: "No",
|
|
font: sre.AlphabetGenerator.Embellish.PERIOD,
|
|
},
|
|
{
|
|
interval: ["2775", "277F"],
|
|
base: sre.AlphabetGenerator.Base.DIGIT,
|
|
subst: { 2775: "24FF" },
|
|
offset: 0,
|
|
category: "No",
|
|
font: sre.AlphabetGenerator.Embellish.NEGATIVECIRCLED,
|
|
},
|
|
{
|
|
interval: ["24EB", "24F4"],
|
|
base: sre.AlphabetGenerator.Base.DIGIT,
|
|
subst: {},
|
|
offset: 11,
|
|
category: "No",
|
|
font: sre.AlphabetGenerator.Embellish.NEGATIVECIRCLED,
|
|
},
|
|
{
|
|
interval: ["24F5", "24FE"],
|
|
base: sre.AlphabetGenerator.Base.DIGIT,
|
|
subst: {},
|
|
offset: 1,
|
|
category: "No",
|
|
font: sre.AlphabetGenerator.Embellish.DOUBLECIRCLED,
|
|
},
|
|
{
|
|
interval: ["277F", "2789"],
|
|
base: sre.AlphabetGenerator.Base.DIGIT,
|
|
subst: { "277F": "1F10B" },
|
|
offset: 0,
|
|
category: "No",
|
|
font: sre.AlphabetGenerator.Embellish.CIRCLEDSANSSERIF,
|
|
},
|
|
{
|
|
interval: ["2789", "2793"],
|
|
base: sre.AlphabetGenerator.Base.DIGIT,
|
|
subst: { 2789: "1F10C" },
|
|
offset: 0,
|
|
category: "No",
|
|
font: sre.AlphabetGenerator.Embellish.NEGATIVECIRCLEDSANSSERIF,
|
|
},
|
|
{
|
|
interval: ["FF10", "FF19"],
|
|
base: sre.AlphabetGenerator.Base.DIGIT,
|
|
subst: {},
|
|
offset: 0,
|
|
category: "Nd",
|
|
font: sre.AlphabetGenerator.Font.FULLWIDTH,
|
|
},
|
|
{
|
|
interval: ["1D7CE", "1D7D7"],
|
|
base: sre.AlphabetGenerator.Base.DIGIT,
|
|
subst: {},
|
|
offset: 0,
|
|
category: "Nd",
|
|
font: sre.AlphabetGenerator.Font.BOLD,
|
|
},
|
|
{
|
|
interval: ["1D7D8", "1D7E1"],
|
|
base: sre.AlphabetGenerator.Base.DIGIT,
|
|
subst: {},
|
|
offset: 0,
|
|
category: "Nd",
|
|
font: sre.AlphabetGenerator.Font.DOUBLESTRUCK,
|
|
},
|
|
{
|
|
interval: ["1D7E2", "1D7EB"],
|
|
base: sre.AlphabetGenerator.Base.DIGIT,
|
|
subst: {},
|
|
offset: 0,
|
|
category: "Nd",
|
|
font: sre.AlphabetGenerator.Font.SANSSERIF,
|
|
},
|
|
{
|
|
interval: ["1D7EC", "1D7F5"],
|
|
base: sre.AlphabetGenerator.Base.DIGIT,
|
|
subst: {},
|
|
offset: 0,
|
|
category: "Nd",
|
|
font: sre.AlphabetGenerator.Font.SANSSERIFBOLD,
|
|
},
|
|
{
|
|
interval: ["1D7F6", "1D7FF"],
|
|
base: sre.AlphabetGenerator.Base.DIGIT,
|
|
subst: {},
|
|
offset: 0,
|
|
category: "Nd",
|
|
font: sre.AlphabetGenerator.Font.MONOSPACE,
|
|
},
|
|
{
|
|
interval: ["1F101", "1F10A"],
|
|
base: sre.AlphabetGenerator.Base.DIGIT,
|
|
subst: {},
|
|
offset: 0,
|
|
category: "No",
|
|
font: sre.AlphabetGenerator.Embellish.COMMA,
|
|
},
|
|
{
|
|
interval: ["24B6", "24CF"],
|
|
base: sre.AlphabetGenerator.Base.LATINCAP,
|
|
subst: {},
|
|
capital: !0,
|
|
category: "So",
|
|
font: sre.AlphabetGenerator.Embellish.CIRCLED,
|
|
},
|
|
{
|
|
interval: ["24D0", "24E9"],
|
|
base: sre.AlphabetGenerator.Base.LATINSMALL,
|
|
subst: {},
|
|
capital: !1,
|
|
category: "So",
|
|
font: sre.AlphabetGenerator.Embellish.CIRCLED,
|
|
},
|
|
{
|
|
interval: ["1F110", "1F129"],
|
|
base: sre.AlphabetGenerator.Base.LATINCAP,
|
|
subst: {},
|
|
capital: !0,
|
|
category: "So",
|
|
font: sre.AlphabetGenerator.Embellish.PARENTHESIZED,
|
|
},
|
|
{
|
|
interval: ["249C", "24B5"],
|
|
base: sre.AlphabetGenerator.Base.LATINSMALL,
|
|
subst: {},
|
|
capital: !1,
|
|
category: "So",
|
|
font: sre.AlphabetGenerator.Embellish.PARENTHESIZED,
|
|
},
|
|
{
|
|
interval: ["1F130", "1F149"],
|
|
base: sre.AlphabetGenerator.Base.LATINCAP,
|
|
subst: {},
|
|
capital: !0,
|
|
category: "So",
|
|
font: sre.AlphabetGenerator.Embellish.SQUARED,
|
|
},
|
|
{
|
|
interval: ["1F170", "1F189"],
|
|
base: sre.AlphabetGenerator.Base.LATINCAP,
|
|
subst: {},
|
|
capital: !0,
|
|
category: "So",
|
|
font: sre.AlphabetGenerator.Embellish.NEGATIVESQUARED,
|
|
},
|
|
{
|
|
interval: ["1F150", "1F169"],
|
|
base: sre.AlphabetGenerator.Base.LATINCAP,
|
|
subst: {},
|
|
capital: !0,
|
|
category: "So",
|
|
font: sre.AlphabetGenerator.Embellish.NEGATIVECIRCLED,
|
|
},
|
|
];
|
|
sre.MathSimpleStore = function () {
|
|
sre.MathStore.call(this);
|
|
this.category = "";
|
|
};
|
|
goog.inherits(sre.MathSimpleStore, sre.MathStore);
|
|
sre.MathSimpleStore.prototype.defineRulesFromMappings = function (a, b, c) {
|
|
for (var d in c)
|
|
for (var e in c[d]) this.defineRuleFromStrings(a, d, e, b, c[d][e]);
|
|
};
|
|
sre.MathSimpleStore.prototype.defineRuleFromStrings = function (a, b, c, d, e) {
|
|
this.defineRule(
|
|
a,
|
|
b + "." + c,
|
|
'[t] "' + e + '"',
|
|
"self::text()",
|
|
'"' === d ? "self::text() = '" + d + "'" : 'self::text() = "' + d + '"',
|
|
);
|
|
};
|
|
sre.MathSimpleStore.prototype.lookupRule = function (a, b) {
|
|
a = this.getSpeechRules().filter(function (c) {
|
|
return sre.MathSimpleStore.testDynamicConstraints_(b, c);
|
|
});
|
|
return a.length
|
|
? a.sort(function (c, d) {
|
|
return sre.Engine.getInstance().comparator.compare(
|
|
c.dynamicCstr,
|
|
d.dynamicCstr,
|
|
);
|
|
})[0]
|
|
: null;
|
|
};
|
|
sre.MathSimpleStore.testDynamicConstraints_ = function (a, b) {
|
|
return sre.Engine.getInstance().strict
|
|
? b.dynamicCstr.equal(a)
|
|
: sre.Engine.getInstance().comparator.match(b.dynamicCstr);
|
|
};
|
|
sre.MathCompoundStore = function () {
|
|
this.subStores_ = {};
|
|
this.locale = sre.DynamicCstr.DEFAULT_VALUES[sre.DynamicCstr.Axis.LOCALE];
|
|
this.modality = sre.DynamicCstr.DEFAULT_VALUES[sre.DynamicCstr.Axis.MODALITY];
|
|
};
|
|
goog.addSingletonGetter(sre.MathCompoundStore);
|
|
sre.MathCompoundStore.prototype.getSubStore_ = function (a) {
|
|
var b = this.subStores_[a];
|
|
if (b) return sre.Debugger.getInstance().output("Store exists! " + a), b;
|
|
b = new sre.MathSimpleStore();
|
|
return (this.subStores_[a] = b);
|
|
};
|
|
sre.MathCompoundStore.prototype.setupStore_ = function (a, b) {
|
|
a.locale = this.locale;
|
|
a.modality = this.modality;
|
|
b && (a.category = b);
|
|
};
|
|
sre.MathCompoundStore.prototype.defineRules = function (a, b, c, d) {
|
|
var e = this.getSubStore_(b);
|
|
this.setupStore_(e, c);
|
|
e.defineRulesFromMappings(a, b, d);
|
|
};
|
|
sre.MathCompoundStore.prototype.defineRule = function (a, b, c, d, e, f) {
|
|
var g = this.getSubStore_(e);
|
|
this.setupStore_(g, d);
|
|
g.defineRuleFromStrings(a, b, c, e, f);
|
|
};
|
|
sre.MathCompoundStore.prototype.changeLocale_ = function (a) {
|
|
if (!a.locale && !a.modality) return !1;
|
|
this.locale = a.locale || this.locale;
|
|
this.modality = a.modality || this.modality;
|
|
return !0;
|
|
};
|
|
sre.MathCompoundStore.prototype.addSymbolRules = function (a) {
|
|
if (!this.changeLocale_(a)) {
|
|
var b = sre.MathSimpleStore.parseUnicode_(a.key);
|
|
this.defineRules(a.key, b, a.category, a.mappings);
|
|
}
|
|
};
|
|
sre.MathCompoundStore.prototype.addFunctionRules = function (a) {
|
|
if (!this.changeLocale_(a)) {
|
|
var b = a.names,
|
|
c = a.mappings;
|
|
a = a.category;
|
|
for (var d = 0, e; (e = b[d]); d++) this.defineRules(e, e, a, c);
|
|
}
|
|
};
|
|
sre.MathCompoundStore.prototype.addUnitRules = function (a) {
|
|
if (!this.changeLocale_(a)) {
|
|
var b = a.names;
|
|
b &&
|
|
(a.names = b.map(function (c) {
|
|
return c + ":unit";
|
|
}));
|
|
this.addFunctionRules(a);
|
|
}
|
|
};
|
|
sre.MathCompoundStore.prototype.lookupRule = function (a, b) {
|
|
return (a = this.subStores_[a]) ? a.lookupRule(null, b) : null;
|
|
};
|
|
sre.MathCompoundStore.prototype.lookupCategory = function (a) {
|
|
return (a = this.subStores_[a]) ? a.category : "";
|
|
};
|
|
sre.MathCompoundStore.prototype.lookupString = function (a, b) {
|
|
return (a = this.lookupRule(a, b))
|
|
? a.action.components
|
|
.map(function (c) {
|
|
return c.content.slice(1, -1);
|
|
})
|
|
.join(" ")
|
|
: "";
|
|
};
|
|
sre.MathCompoundStore.prototype.enumerate = function (a) {
|
|
a = a || {};
|
|
for (var b in this.subStores_) a = this.subStores_[b].trie.enumerate(a);
|
|
return a;
|
|
};
|
|
sre.MathSimpleStore.parseUnicode_ = function (a) {
|
|
a = parseInt(a, 16);
|
|
if (65536 > a) return String.fromCharCode(a);
|
|
a -= 65536;
|
|
return String.fromCharCode((a >> 10) + 55296, (a & 1023) + 56320);
|
|
};
|
|
sre.MathMap = function () {
|
|
this.store = sre.MathCompoundStore.getInstance();
|
|
this.loaded_ = [];
|
|
this.addRules = {
|
|
functions: goog.bind(this.store.addFunctionRules, this.store),
|
|
symbols: goog.bind(this.store.addSymbolRules, this.store),
|
|
units: goog.bind(this.store.addUnitRules, this.store),
|
|
};
|
|
};
|
|
goog.addSingletonGetter(sre.MathMap);
|
|
sre.MathMap.oldInst_ = sre.MathMap.getInstance;
|
|
sre.MathMap.getInstance = function () {
|
|
var a = sre.MathMap.oldInst_();
|
|
a.loadLocale();
|
|
return a;
|
|
};
|
|
sre.MathMap.prototype.loadLocale = function () {
|
|
var a = sre.Engine.getInstance().locale;
|
|
if (-1 === this.loaded_.indexOf(a)) {
|
|
var b = sre.Engine.getInstance().mode === sre.Engine.Mode.ASYNC;
|
|
b && (sre.Engine.getInstance().mode = sre.Engine.Mode.SYNC);
|
|
this.loaded_.push(a);
|
|
this.retrieveMaps(a);
|
|
b && (sre.Engine.getInstance().mode = sre.Engine.Mode.ASYNC);
|
|
}
|
|
};
|
|
sre.MathMap.toFetch_ = 0;
|
|
sre.Engine.registerTest(function () {
|
|
return sre.MathMap.getInstance() && !sre.MathMap.toFetch_;
|
|
});
|
|
sre.MathMap.prototype.retrieveFiles = function (a) {
|
|
a = sre.BaseUtil.makePath(sre.SystemExternal.jsonPath) + a + ".js";
|
|
switch (sre.Engine.getInstance().mode) {
|
|
case sre.Engine.Mode.ASYNC:
|
|
sre.MathMap.toFetch_++;
|
|
var b = goog.bind(this.parseMaps, this);
|
|
sre.MathMap.fromFile_(a, function (c, d) {
|
|
sre.MathMap.toFetch_--;
|
|
c || b(d);
|
|
});
|
|
break;
|
|
case sre.Engine.Mode.HTTP:
|
|
sre.MathMap.toFetch_++;
|
|
this.getJsonAjax_(a);
|
|
break;
|
|
default:
|
|
(a = sre.MathMap.loadFile(a)), this.parseMaps(a);
|
|
}
|
|
};
|
|
sre.MathMap.prototype.parseMaps = function (a) {
|
|
a = JSON.parse(a);
|
|
this.addMaps(a);
|
|
};
|
|
sre.MathMap.prototype.addMaps = function (a, b) {
|
|
for (var c = 0, d; (d = Object.keys(a)[c]); c++) {
|
|
var e = d.split("/");
|
|
(b && b !== e[0]) || a[d].forEach(this.addRules[e[1]]);
|
|
}
|
|
};
|
|
sre.MathMap.prototype.retrieveMaps = function (a) {
|
|
sre.AlphabetGenerator.generate(a, this.store);
|
|
sre.Engine.getInstance().isIE &&
|
|
sre.Engine.getInstance().mode === sre.Engine.Mode.HTTP
|
|
? this.getJsonIE_(a)
|
|
: this.retrieveFiles(a);
|
|
};
|
|
sre.MathMap.prototype.getJsonIE_ = function (a, b) {
|
|
var c = b || 1;
|
|
sre.BrowserUtil.mapsForIE
|
|
? this.addMaps(sre.BrowserUtil.mapsForIE, a)
|
|
: 5 >= c &&
|
|
setTimeout(
|
|
goog.bind(function () {
|
|
this.getJsonIE_(a, c++);
|
|
}, this),
|
|
300,
|
|
);
|
|
};
|
|
sre.MathMap.fromFile_ = function (a, b) {
|
|
return sre.SystemExternal.fs.readFile(a, "utf8", b);
|
|
};
|
|
sre.MathMap.loadFile = function (a) {
|
|
try {
|
|
return sre.MathMap.readJSON_(a);
|
|
} catch (b) {
|
|
console.error("Unable to load file: " + a + "\n" + b);
|
|
}
|
|
return "{}";
|
|
};
|
|
sre.MathMap.readJSON_ = function (a) {
|
|
return sre.SystemExternal.fs.readFileSync(a);
|
|
};
|
|
sre.MathMap.prototype.getJsonAjax_ = function (a) {
|
|
var b = new XMLHttpRequest(),
|
|
c = goog.bind(this.parseMaps, this);
|
|
b.onreadystatechange = function () {
|
|
4 === b.readyState &&
|
|
(sre.MathMap.toFetch_--, 200 === b.status && c(b.responseText));
|
|
};
|
|
b.open("GET", a, !0);
|
|
b.send();
|
|
};
|
|
sre.StoreUtil = {};
|
|
sre.StoreUtil.nodeCounter = function (a, b) {
|
|
var c = a.length,
|
|
d = 0,
|
|
e = b;
|
|
b || (e = "");
|
|
return function () {
|
|
d < c && (d += 1);
|
|
return e + " " + d;
|
|
};
|
|
};
|
|
sre.StoreUtil.pauseSeparator = function (a, b) {
|
|
a = parseFloat(b);
|
|
var c = isNaN(a) ? b : a;
|
|
return function () {
|
|
return [
|
|
sre.AuditoryDescription.create({ text: "", personality: { pause: c } }),
|
|
];
|
|
};
|
|
};
|
|
sre.StoreUtil.contentIterator = function (a, b) {
|
|
var c = 0 < a.length ? sre.XpathUtil.evalXPath("../../content/*", a[0]) : [];
|
|
return function () {
|
|
var d = c.shift(),
|
|
e = b
|
|
? [sre.AuditoryDescription.create({ text: b }, { translate: !0 })]
|
|
: [];
|
|
if (!d) return e;
|
|
d = sre.SpeechRuleEngine.getInstance().evaluateNode(d);
|
|
return e.concat(d);
|
|
};
|
|
};
|
|
sre.ClearspeakUtil = {};
|
|
sre.ClearspeakUtil.numbersToAlpha = function (a) {
|
|
return a.match(/\d+/)
|
|
? sre.Messages.NUMBERS.numberToWords(parseInt(a, 10))
|
|
: a;
|
|
};
|
|
sre.ClearspeakUtil.nodeCounter = function (a, b) {
|
|
b = b.split("-");
|
|
var c = sre.StoreUtil.nodeCounter(a, b[0] || ""),
|
|
d = b[1] || "",
|
|
e = b[2] || "",
|
|
f = !0;
|
|
return function () {
|
|
var g = c();
|
|
return f ? ((f = !1), e + g + d) : g + d;
|
|
};
|
|
};
|
|
sre.ClearspeakUtil.isSimpleExpression = function (a) {
|
|
return (
|
|
sre.ClearspeakUtil.isSimpleNumber_(a) ||
|
|
sre.ClearspeakUtil.isSimpleLetters_(a) ||
|
|
sre.ClearspeakUtil.isSimpleDegree_(a) ||
|
|
sre.ClearspeakUtil.isSimpleNegative_(a) ||
|
|
sre.ClearspeakUtil.isSimpleFunction_(a)
|
|
);
|
|
};
|
|
sre.ClearspeakUtil.isSimpleFunction_ = function (a) {
|
|
return (
|
|
a.type === sre.SemanticAttr.Type.APPL &&
|
|
(a.childNodes[0].role === sre.SemanticAttr.Role.PREFIXFUNC ||
|
|
a.childNodes[0].role === sre.SemanticAttr.Role.SIMPLEFUNC) &&
|
|
(sre.ClearspeakUtil.isSimple_(a.childNodes[1]) ||
|
|
(a.childNodes[1].type === sre.SemanticAttr.Type.FENCED &&
|
|
sre.ClearspeakUtil.isSimple_(a.childNodes[1].childNodes[0])))
|
|
);
|
|
};
|
|
sre.ClearspeakUtil.isSimpleNegative_ = function (a) {
|
|
return (
|
|
a.type === sre.SemanticAttr.Type.PREFIXOP &&
|
|
a.role === sre.SemanticAttr.Role.NEGATIVE &&
|
|
sre.ClearspeakUtil.isSimple_(a.childNodes[0]) &&
|
|
a.childNodes[0].type !== sre.SemanticAttr.Type.PREFIXOP &&
|
|
a.childNodes[0].type !== sre.SemanticAttr.Type.APPL &&
|
|
a.childNodes[0].type !== sre.SemanticAttr.Type.PUNCTUATED
|
|
);
|
|
};
|
|
sre.ClearspeakUtil.isSimpleDegree_ = function (a) {
|
|
return (
|
|
a.type === sre.SemanticAttr.Type.PUNCTUATED &&
|
|
a.role === sre.SemanticAttr.Role.ENDPUNCT &&
|
|
2 === a.childNodes.length &&
|
|
a.childNodes[1].role === sre.SemanticAttr.Role.DEGREE &&
|
|
(sre.ClearspeakUtil.isLetter_(a.childNodes[0]) ||
|
|
sre.ClearspeakUtil.isNumber_(a.childNodes[0]) ||
|
|
(a.childNodes[0].type === sre.SemanticAttr.Type.PREFIXOP &&
|
|
a.childNodes[0].role === sre.SemanticAttr.Role.NEGATIVE &&
|
|
(sre.ClearspeakUtil.isLetter_(a.childNodes[0].childNodes[0]) ||
|
|
sre.ClearspeakUtil.isNumber_(a.childNodes[0].childNodes[0]))))
|
|
);
|
|
};
|
|
sre.ClearspeakUtil.isSimpleLetters_ = function (a) {
|
|
return (
|
|
sre.ClearspeakUtil.isLetter_(a) ||
|
|
(a.type === sre.SemanticAttr.Type.INFIXOP &&
|
|
a.role === sre.SemanticAttr.Role.IMPLICIT &&
|
|
((2 === a.childNodes.length &&
|
|
(sre.ClearspeakUtil.isLetter_(a.childNodes[0]) ||
|
|
sre.ClearspeakUtil.isSimpleNumber_(a.childNodes[0])) &&
|
|
sre.ClearspeakUtil.isLetter_(a.childNodes[1])) ||
|
|
(3 === a.childNodes.length &&
|
|
sre.ClearspeakUtil.isSimpleNumber_(a.childNodes[0]) &&
|
|
sre.ClearspeakUtil.isLetter_(a.childNodes[1]) &&
|
|
sre.ClearspeakUtil.isLetter_(a.childNodes[2]))))
|
|
);
|
|
};
|
|
sre.ClearspeakUtil.isSimple_ = function (a) {
|
|
return a.hasAnnotation("clearspeak", "simple");
|
|
};
|
|
sre.ClearspeakUtil.isLetter_ = function (a) {
|
|
return (
|
|
a.type === sre.SemanticAttr.Type.IDENTIFIER &&
|
|
(a.role === sre.SemanticAttr.Role.LATINLETTER ||
|
|
a.role === sre.SemanticAttr.Role.GREEKLETTER ||
|
|
a.role === sre.SemanticAttr.Role.OTHERLETTER ||
|
|
a.role === sre.SemanticAttr.Role.SIMPLEFUNC)
|
|
);
|
|
};
|
|
sre.ClearspeakUtil.isNumber_ = function (a) {
|
|
return (
|
|
a.type === sre.SemanticAttr.Type.NUMBER &&
|
|
(a.role === sre.SemanticAttr.Role.INTEGER ||
|
|
a.role === sre.SemanticAttr.Role.FLOAT)
|
|
);
|
|
};
|
|
sre.ClearspeakUtil.isSimpleNumber_ = function (a) {
|
|
return (
|
|
sre.ClearspeakUtil.isNumber_(a) || sre.ClearspeakUtil.isSimpleFraction_(a)
|
|
);
|
|
};
|
|
sre.ClearspeakUtil.isSimpleFraction_ = function (a) {
|
|
if (
|
|
sre.ClearspeakUtil.hasPreference("Fraction_Over") ||
|
|
sre.ClearspeakUtil.hasPreference("Fraction_FracOver") ||
|
|
a.type !== sre.SemanticAttr.Type.FRACTION ||
|
|
a.role !== sre.SemanticAttr.Role.VULGAR
|
|
)
|
|
return !1;
|
|
if (sre.ClearspeakUtil.hasPreference("Fraction_Ordinal")) return !0;
|
|
var b = parseInt(a.childNodes[0].textContent, 10);
|
|
a = parseInt(a.childNodes[1].textContent, 10);
|
|
return 0 < b && 20 > b && 0 < a && 11 > a;
|
|
};
|
|
sre.ClearspeakUtil.hasPreference = function (a) {
|
|
return sre.Engine.getInstance().style === a;
|
|
};
|
|
sre.ClearspeakUtil.simpleExpression = function () {
|
|
return new sre.SemanticAnnotator("clearspeak", function (a) {
|
|
return sre.ClearspeakUtil.isSimpleExpression(a) ? "simple" : "";
|
|
});
|
|
};
|
|
sre.ClearspeakUtil.simpleNode = function (a) {
|
|
if (!a.hasAttribute("annotation")) return !1;
|
|
a = a.getAttribute("annotation");
|
|
return !!/clearspeak:simple$|clearspeak:simple;/.exec(a);
|
|
};
|
|
sre.ClearspeakUtil.simpleCell_ = function (a) {
|
|
if (sre.ClearspeakUtil.simpleNode(a)) return !0;
|
|
if (a.tagName !== sre.SemanticAttr.Type.SUBSCRIPT) return !1;
|
|
a = a.childNodes[0].childNodes;
|
|
var b = a[1];
|
|
return (
|
|
a[0].tagName === sre.SemanticAttr.Type.IDENTIFIER &&
|
|
(sre.ClearspeakUtil.isInteger_(b) ||
|
|
(b.tagName === sre.SemanticAttr.Type.INFIXOP &&
|
|
b.hasAttribute("role") &&
|
|
b.getAttribute("role") === sre.SemanticAttr.Role.IMPLICIT &&
|
|
sre.ClearspeakUtil.allIndices_(b)))
|
|
);
|
|
};
|
|
sre.ClearspeakUtil.isInteger_ = function (a) {
|
|
return (
|
|
a.tagName === sre.SemanticAttr.Type.NUMBER &&
|
|
a.hasAttribute("role") &&
|
|
a.getAttribute("role") === sre.SemanticAttr.Role.INTEGER
|
|
);
|
|
};
|
|
sre.ClearspeakUtil.allIndices_ = function (a) {
|
|
return sre.XpathUtil.evalXPath("children/*", a).every(function (b) {
|
|
return (
|
|
sre.ClearspeakUtil.isInteger_(b) ||
|
|
b.tagName === sre.SemanticAttr.Type.IDENTIFIER
|
|
);
|
|
});
|
|
};
|
|
sre.ClearspeakUtil.allCellsSimple = function (a) {
|
|
return sre.XpathUtil.evalXPath(
|
|
a.tagName === sre.SemanticAttr.Type.MATRIX
|
|
? "children/row/children/cell/children/*"
|
|
: "children/line/children/*",
|
|
a,
|
|
).every(sre.ClearspeakUtil.simpleCell_)
|
|
? [a]
|
|
: [];
|
|
};
|
|
sre.ClearspeakUtil.isSmallVulgarFraction = function (a) {
|
|
return sre.NumbersUtil.vulgarFractionSmall(a, 20, 11) ? [a] : [];
|
|
};
|
|
sre.ClearspeakUtil.isUnitExpression = function (a) {
|
|
return (
|
|
a.type === sre.SemanticAttr.Type.TEXT ||
|
|
(a.type === sre.SemanticAttr.Type.PUNCTUATED &&
|
|
a.role === sre.SemanticAttr.Role.TEXT &&
|
|
sre.ClearspeakUtil.isNumber_(a.childNodes[0]) &&
|
|
sre.ClearspeakUtil.allTextLastContent_(a.childNodes.slice(1))) ||
|
|
(a.type === sre.SemanticAttr.Type.IDENTIFIER &&
|
|
a.role === sre.SemanticAttr.Role.UNIT) ||
|
|
(a.type === sre.SemanticAttr.Type.INFIXOP &&
|
|
(a.role === sre.SemanticAttr.Role.IMPLICIT ||
|
|
a.role === sre.SemanticAttr.Role.UNIT))
|
|
);
|
|
};
|
|
sre.ClearspeakUtil.allTextLastContent_ = function (a) {
|
|
for (var b = 0; b < a.length - 1; b++)
|
|
if (a[b].type !== sre.SemanticAttr.Type.TEXT || "" !== a[b].textContent)
|
|
return !1;
|
|
return a[a.length - 1].type === sre.SemanticAttr.Type.TEXT;
|
|
};
|
|
sre.ClearspeakUtil.unitExpression = function () {
|
|
return new sre.SemanticAnnotator("clearspeak", function (a) {
|
|
return sre.ClearspeakUtil.isUnitExpression(a) ? "unit" : "";
|
|
});
|
|
};
|
|
sre.ClearspeakUtil.ordinalExponent = function (a) {
|
|
var b = parseInt(a.textContent, 10);
|
|
return isNaN(b)
|
|
? a.textContent
|
|
: 10 < b
|
|
? sre.Messages.NUMBERS.simpleOrdinal(b)
|
|
: sre.Messages.NUMBERS.wordOrdinal(b);
|
|
};
|
|
sre.ClearspeakUtil.isCapitalLetter = function (a) {
|
|
return "Lu" ===
|
|
sre.MathCompoundStore.getInstance().lookupCategory(a.textContent)
|
|
? [a]
|
|
: [];
|
|
};
|
|
sre.ClearspeakUtil.NESTING_DEPTH = null;
|
|
sre.ClearspeakUtil.nestingDepth = function (a) {
|
|
var b = 0,
|
|
c = a.textContent,
|
|
d = "open" === a.getAttribute("role") ? 0 : 1;
|
|
for (a = a.parentNode; a; )
|
|
a.tagName === sre.SemanticAttr.Type.FENCED &&
|
|
a.childNodes[0].childNodes[d].textContent === c &&
|
|
b++,
|
|
(a = a.parentNode);
|
|
sre.ClearspeakUtil.NESTING_DEPTH =
|
|
1 < b ? sre.Messages.NUMBERS.wordOrdinal(b) : "";
|
|
return sre.ClearspeakUtil.NESTING_DEPTH;
|
|
};
|
|
sre.ClearspeakUtil.matchingFences = function (a) {
|
|
var b = a.previousSibling;
|
|
if (b) var c = a;
|
|
else (b = a), (c = a.nextSibling);
|
|
return c
|
|
? sre.SemanticAttr.isMatchingFence(b.textContent, c.textContent)
|
|
? [a]
|
|
: []
|
|
: [];
|
|
};
|
|
sre.ClearspeakUtil.insertNesting = function (a, b) {
|
|
if (!b || !a) return a;
|
|
var c = a.match(/^(open|close) /);
|
|
return c ? c[0] + b + " " + a.substring(c[0].length) : b + " " + a;
|
|
};
|
|
sre.Grammar.getInstance().setCorrection(
|
|
"insertNesting",
|
|
sre.ClearspeakUtil.insertNesting,
|
|
);
|
|
sre.ClearspeakUtil.fencedArguments = function (a) {
|
|
var b = sre.DomUtil.toArray(a.parentNode.childNodes),
|
|
c = sre.XpathUtil.evalXPath("../../children/*", a);
|
|
b = b.indexOf(a);
|
|
return sre.ClearspeakUtil.fencedFactor_(c[b]) ||
|
|
sre.ClearspeakUtil.fencedFactor_(c[b + 1])
|
|
? [a]
|
|
: [];
|
|
};
|
|
sre.ClearspeakUtil.simpleArguments = function (a) {
|
|
var b = sre.DomUtil.toArray(a.parentNode.childNodes),
|
|
c = sre.XpathUtil.evalXPath("../../children/*", a);
|
|
b = b.indexOf(a);
|
|
return sre.ClearspeakUtil.simpleFactor_(c[b]) &&
|
|
c[b + 1] &&
|
|
(sre.ClearspeakUtil.simpleFactor_(c[b + 1]) ||
|
|
c[b + 1].tagName === sre.SemanticAttr.Type.ROOT ||
|
|
c[b + 1].tagName === sre.SemanticAttr.Type.SQRT ||
|
|
(c[b + 1].tagName === sre.SemanticAttr.Type.SUPERSCRIPT &&
|
|
c[b + 1].childNodes[0].childNodes[0] &&
|
|
(c[b + 1].childNodes[0].childNodes[0].tagName ===
|
|
sre.SemanticAttr.Type.NUMBER ||
|
|
c[b + 1].childNodes[0].childNodes[0].tagName ===
|
|
sre.SemanticAttr.Type.IDENTIFIER) &&
|
|
("2" === c[b + 1].childNodes[0].childNodes[1].textContent ||
|
|
"3" === c[b + 1].childNodes[0].childNodes[1].textContent)))
|
|
? [a]
|
|
: [];
|
|
};
|
|
sre.ClearspeakUtil.simpleFactor_ = function (a) {
|
|
return (
|
|
!!a &&
|
|
(a.tagName === sre.SemanticAttr.Type.NUMBER ||
|
|
a.tagName === sre.SemanticAttr.Type.IDENTIFIER ||
|
|
a.tagName === sre.SemanticAttr.Type.FUNCTION ||
|
|
a.tagName === sre.SemanticAttr.Type.APPL ||
|
|
a.tagName === sre.SemanticAttr.Type.FRACTION)
|
|
);
|
|
};
|
|
sre.ClearspeakUtil.fencedFactor_ = function (a) {
|
|
return (
|
|
a &&
|
|
(a.tagName === sre.SemanticAttr.Type.FENCED ||
|
|
(a.hasAttribute("role") &&
|
|
a.getAttribute("role") === sre.SemanticAttr.Role.LEFTRIGHT) ||
|
|
sre.ClearspeakUtil.layoutFactor_(a))
|
|
);
|
|
};
|
|
sre.ClearspeakUtil.layoutFactor_ = function (a) {
|
|
return (
|
|
!!a &&
|
|
(a.tagName === sre.SemanticAttr.Type.MATRIX ||
|
|
a.tagName === sre.SemanticAttr.Type.VECTOR)
|
|
);
|
|
};
|
|
sre.ClearspeakUtil.isHyperbolic = function (a) {
|
|
if (a.tagName === sre.SemanticAttr.Type.APPL) {
|
|
var b = sre.XpathUtil.evalXPath("children/*[1]", a)[0];
|
|
if (
|
|
b &&
|
|
b.tagName === sre.SemanticAttr.Type.FUNCTION &&
|
|
"Hyperbolic" ===
|
|
sre.MathCompoundStore.getInstance().lookupCategory(b.textContent)
|
|
)
|
|
return [a];
|
|
}
|
|
return [];
|
|
};
|
|
sre.ClearspeakUtil.isLogarithmWithBase = function (a) {
|
|
if (a.tagName === sre.SemanticAttr.Type.SUBSCRIPT) {
|
|
var b = sre.XpathUtil.evalXPath("children/*[1]", a)[0];
|
|
if (
|
|
b &&
|
|
b.tagName === sre.SemanticAttr.Type.FUNCTION &&
|
|
"Logarithm" ===
|
|
sre.MathCompoundStore.getInstance().lookupCategory(b.textContent)
|
|
)
|
|
return [a];
|
|
}
|
|
return [];
|
|
};
|
|
sre.ClearspeakUtil.wordOrdinal = function (a) {
|
|
return sre.Messages.NUMBERS.wordOrdinal(parseInt(a.textContent, 10));
|
|
};
|
|
sre.ClearspeakUtil.firstCurrency = function (a) {
|
|
var b = sre.XpathUtil.evalXPath("children/*[1]", a)[0];
|
|
return b &&
|
|
"currency" ===
|
|
sre.MathCompoundStore.getInstance().lookupCategory(
|
|
b.textContent + ":unit",
|
|
)
|
|
? [a]
|
|
: [];
|
|
};
|
|
sre.ClearspeakUtil.lastCurrency = function (a) {
|
|
var b = sre.XpathUtil.evalXPath("children/*[last()]", a)[0];
|
|
return b &&
|
|
"currency" ===
|
|
sre.MathCompoundStore.getInstance().lookupCategory(
|
|
b.textContent + ":unit",
|
|
)
|
|
? [a]
|
|
: [];
|
|
};
|
|
sre.ClearspeakUtil.addAnnotators = function () {
|
|
sre.SemanticAnnotations.getInstance().register(
|
|
sre.ClearspeakUtil.simpleExpression(),
|
|
);
|
|
sre.SemanticAnnotations.getInstance().register(
|
|
sre.ClearspeakUtil.unitExpression(),
|
|
);
|
|
};
|
|
sre.ClearspeakFrench = {
|
|
locale: "fr",
|
|
domain: "clearspeak",
|
|
functions: [
|
|
["CTXF", "CTXFpauseSeparator", sre.StoreUtil.pauseSeparator],
|
|
["CTXF", "CTXFnodeCounter", sre.ClearspeakUtil.nodeCounter],
|
|
["CTXF", "CTXFcontentIterator", sre.StoreUtil.contentIterator],
|
|
["CSF", "CSFvulgarFraction", sre.NumbersUtil.vulgarFraction],
|
|
["CQF", "CQFvulgarFractionSmall", sre.ClearspeakUtil.isSmallVulgarFraction],
|
|
["CQF", "CQFcellsSimple", sre.ClearspeakUtil.allCellsSimple],
|
|
["CSF", "CSFordinalExponent", sre.ClearspeakUtil.ordinalExponent],
|
|
["CSF", "CSFwordOrdinal", sre.Messages.NUMBERS.wordOrdinal],
|
|
["CQF", "CQFisCapital", sre.ClearspeakUtil.isCapitalLetter],
|
|
["CQF", "CQFmatchingFences", sre.ClearspeakUtil.matchingFences],
|
|
["CSF", "CSFnestingDepth", sre.ClearspeakUtil.nestingDepth],
|
|
["CQF", "CQFfencedArguments", sre.ClearspeakUtil.fencedArguments],
|
|
["CQF", "CQFsimpleArguments", sre.ClearspeakUtil.simpleArguments],
|
|
["CQF", "CQFisHyperbolic", sre.ClearspeakUtil.isHyperbolic],
|
|
["CQF", "CQFisLogarithm", sre.ClearspeakUtil.isLogarithmWithBase],
|
|
["CQF", "CQFspaceoutNumber", sre.MathspeakUtil.spaceoutNumber],
|
|
],
|
|
rules: [
|
|
'Rule{collapsed{default{[t] "compress\u00e9e"; [n] . (engine:modality=summary,grammar:collapsed){self::*{@alternative{not(contains(@grammar, "collapsed")){self::*{self::*{self::*{self::*{self::*'.split(
|
|
"{",
|
|
),
|
|
["Rule", "stree", "default", "[n] ./*[1]", "self::stree"],
|
|
["Rule", "unknown", "default", "[n] text()", "self::unknown"],
|
|
'Rule;protected;default;[t] text();self::number;contains(@grammar, "protected")'.split(
|
|
";",
|
|
),
|
|
["Rule", "omit-empty", "default", '[p] (pause:"short")', "self::empty"],
|
|
'Rule{font{default{[n] . (grammar:ignoreFont=@font); [t] @font (grammar:localFont,pause:"short"){self::*{@font{not(contains(@grammar, "ignoreFont")){@font!="normal"'.split(
|
|
"{",
|
|
),
|
|
'Rule{font-identifier{default{[n] . (grammar:ignoreFont=@font); [t] @font (grammar:localFont,pause:"short"){self::identifier{string-length(text())=1{@font{@font="normal"{not(contains(@grammar, "ignoreFont")){@role!="unit"'.split(
|
|
"{",
|
|
),
|
|
'Rule;omit-font;default;[n] self::* (grammar:ignoreFont=@font);self::identifier;string-length(text())=1;@font;not(contains(@grammar, "ignoreFont"));@font="italic"'.split(
|
|
";",
|
|
),
|
|
["Rule", "text", "default", "[n] text()", "self::text"],
|
|
'Rule;capital;default;[n] text() (pitch:0.6,grammar:ignoreCaps="majuscule");self::identifier;@role="latinletter" or @role="greekletter" or @role="simple function";CQFisCapital'.split(
|
|
";",
|
|
),
|
|
'Rule;capital;Caps_SayCaps;[n] text();self::identifier;@role="latinletter" or @role="greekletter";CQFisCapital'.split(
|
|
";",
|
|
),
|
|
'Rule{capital{Caps_SayCaps{[p] (pause:"short"); [n] text(){self::identifier{@role="latinletter" or @role="greekletter"{CQFisCapital{preceding-sibling::*[1]{not(name(preceding-sibling::*[1])="function"){not(contains(@grammar, "angle"))'.split(
|
|
"{",
|
|
),
|
|
'Rule;capital;Caps_SayCaps;[n] text() (pause:"short");self::identifier;@role="latinletter" or @role="greekletter";CQFisCapital;following-sibling::*[1]'.split(
|
|
";",
|
|
),
|
|
'Rule{capital{Caps_SayCaps{[p] (pause:"short"); [n] text() (pause:"short"){self::identifier{@role="latinletter" or @role="greekletter"{CQFisCapital{preceding-sibling::*[1]{following-sibling::*[1]{not(name(preceding-sibling::*[1])="function"){not(contains(@grammar, "angle"))'.split(
|
|
"{",
|
|
),
|
|
'Rule,punctuation-lr,default,[p] (pause:"short"); [n] text() (pause:"short"),self::punctuation,@role="comma"'.split(
|
|
",",
|
|
),
|
|
'Rule;punctuation;default;[n] text();self::punctuation;@role="comma";not(preceding-sibling::*[1]/children);not(following-sibling::*[1]/children)'.split(
|
|
";",
|
|
),
|
|
'Rule,punctuation-l,default,[p] (pause:"short"); [n] text(),self::punctuation,@role="comma",not(following-sibling::*[1]/children)'.split(
|
|
",",
|
|
),
|
|
'Rule;punctuation-r;default;[n] text() (pause:"short");self::punctuation;@role="comma";not(preceding-sibling::*[1]/children)'.split(
|
|
";",
|
|
),
|
|
'Rule;ellipsis;Ellipses_AndSoOn;[t] "et ainsi de suite";self::punctuation;@role="ellipsis";not(following-sibling::*[1]);not(preceding-sibling::*[last()][@role="ellipsis"])'.split(
|
|
";",
|
|
),
|
|
'Rule;ellipsis;Ellipses_AndSoOn;[t] "et ainsi de suite jusqu\'\u00e0";self::punctuation;@role="ellipsis";preceding-sibling::*[1];following-sibling::*[1]'.split(
|
|
";",
|
|
),
|
|
'Rule,vbar-evaluated,default,[n] children/*[1]; [p] (pause:"short"); [t] "\u00e9valu\u00e9 \u00e0"; [n] content/*[1]/children/*[2]; [p] (pause:"short"),self::punctuated,@role="endpunct",content/*[1][@role="vbar"],content/*[1][@embellished],name(content/*[1])="subscript"'.split(
|
|
",",
|
|
),
|
|
'Rule,vbar-evaluated,default,[n] children/*[1]; [p] (pause:"short"); [t] "\u00e9valu\u00e9 \u00e0"; [n] content/*[1]/children/*[2]; [p] (pause:"short"); [t] "moins la m\u00eame expression \u00e9valu\u00e9e \u00e0"; [n] content/*[1]/children/*[1]/children/*[2]; [p] (pause:"short"),self::punctuated,@role="endpunct",content/*[1][@role="vbar"],content/*[1][@embellished],name(content/*[1])="superscript",name(content/*[1]/children/*[1])="subscript"'.split(
|
|
",",
|
|
),
|
|
'Rule;vbar-such-that;VerticalLine_SuchThat;[t] "tel que";self::punctuation;@role="vbar";not(parent::*/parent::*[@embellished="punctuation"])'.split(
|
|
";",
|
|
),
|
|
'Rule;vbar-such-that;VerticalLine_Divides;[t] "diviseur de";self::punctuation;@role="vbar";not(parent::*/parent::*[@embellished="punctuation"])'.split(
|
|
";",
|
|
),
|
|
'Rule;vbar-such-that;VerticalLine_Given;[t] "sachant";self::punctuation;@role="vbar";not(parent::*/parent::*[@embellished="punctuation"])'.split(
|
|
";",
|
|
),
|
|
'Rule;set-member;default;[t] "est un";self::operator;@role="set extended";text()="\u2208" or text()="\u220a"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"set-member",
|
|
"default",
|
|
"SetMemberSymbol_Member",
|
|
'[t] "appartient \u00e0"',
|
|
],
|
|
[
|
|
"SpecializedRule",
|
|
"set-member",
|
|
"default",
|
|
"SetMemberSymbol_Element",
|
|
'[t] "est un \u00e9l\u00e9ment de"',
|
|
],
|
|
[
|
|
"SpecializedRule",
|
|
"set-member",
|
|
"default",
|
|
"SetMemberSymbol_Belongs",
|
|
'[t] "est dans"',
|
|
],
|
|
'Rule;set-not-member;default;[t] "n\'est pas un";self::operator;@role="set extended";text()="\u2209"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"set-not-member",
|
|
"default",
|
|
"SetMemberSymbol_Member",
|
|
'[t] "n\'appartient pas \u00e0"',
|
|
],
|
|
[
|
|
"SpecializedRule",
|
|
"set-not-member",
|
|
"default",
|
|
"SetMemberSymbol_Element",
|
|
'[t] "n\'est pas un \u00e9l\u00e9ment de"',
|
|
],
|
|
[
|
|
"SpecializedRule",
|
|
"set-not-member",
|
|
"default",
|
|
"SetMemberSymbol_Belongs",
|
|
'[t] "n\'est pas dans"',
|
|
],
|
|
'Rule,prime,default,[n] children/*[1]; [n] children/*[2],self::superscript,children/*[2],children/*[2][@role="prime"],self::*'.split(
|
|
",",
|
|
),
|
|
'Rule,feet,default,[n] children/*[1]; [t] "feet",self::superscript,children/*[2][@role="prime"],name(children/*[1])="number",children/*[2][text()="\u2032"],not(preceding-sibling::*[@role="degree"])'.split(
|
|
",",
|
|
),
|
|
'Rule,foot,default,[n] children/*[1]; [t] "foot",self::superscript,children/*[2][@role="prime"],name(children/*[1])="number",children/*[2][text()="\u2032"],children/*[1][text()="1"],not(preceding-sibling::*[@role="degree"])'.split(
|
|
",",
|
|
),
|
|
'Rule,inches,default,[n] children/*[1]; [t] "inches",self::superscript,children/*[2][@role="prime"],name(children/*[1])="number",children/*[2][text()="\u2033"],not(preceding-sibling::*[@role="degree"])'.split(
|
|
",",
|
|
),
|
|
'Rule,inch,default,[n] children/*[1]; [t] "inch",self::superscript,children/*[2][@role="prime"],name(children/*[1])="number",children/*[2][text()="\u2033"],children/*[1][text()="1"],not(preceding-sibling::*[@role="degree"])'.split(
|
|
",",
|
|
),
|
|
'Rule,minutes,default,[p] (pause:short); [n] children/*[1]; [t] "minutes",self::superscript,children/*[2][@role="prime"],preceding-sibling::*[@role="degree"],children/*[2][text()="\u2032"]'.split(
|
|
",",
|
|
),
|
|
'Rule,minute,default,[p] (pause:short); [n] children/*[1]; [t] "minute",self::superscript,children/*[2][@role="prime"],preceding-sibling::*[@role="degree"],children/*[2][text()="\u2032"],children/*[1][text()="1"]'.split(
|
|
",",
|
|
),
|
|
'Rule,seconds,default,[p] (pause:short); [n] children/*[1]; [t] "seconds",self::superscript,children/*[2][@role="prime"],preceding-sibling::*[@role="degree"],children/*[2][text()="\u2033"]'.split(
|
|
",",
|
|
),
|
|
'Rule,second,default,[p] (pause:short); [n] children/*[1]; [t] "second",self::superscript,children/*[2][@role="prime"],preceding-sibling::*[@role="degree"],children/*[2][text()="\u2033"],children/*[1][text()="1"]'.split(
|
|
",",
|
|
),
|
|
'Rule,degrees-angle,Prime_Angle,[n] children/*[1]; [t] "degrees"; [p] (pause:short),self::punctuation,@role="degree"'.split(
|
|
",",
|
|
),
|
|
'Rule,degree-angle,Prime_Angle,[n] children/*[1]; [t] "degree"; [p] (pause:short),self::punctuation,@role="degree",children/*[1][text()="1"]'.split(
|
|
",",
|
|
),
|
|
'Rule{minutes-angle{Prime_Angle{[n] children/*[1]; [t] "minutes"; [p] (pause:short){self::superscript{children/*[2][@role="prime"]{name(children/*[1])="number" or (children/*[1][@role="latinletter"] and ""=translate(children/*[1]/text(),"abcdefghijklmnopqrstuvwxyz", "")){children/*[2][text()="\u2032"]'.split(
|
|
"{",
|
|
),
|
|
'Rule,minute-angle,Prime_Angle,[n] children/*[1]; [t] "minute"; [p] (pause:short),self::superscript,children/*[2][@role="prime"],children/*[2][text()="\u2032"],children/*[1][text()="1"]'.split(
|
|
",",
|
|
),
|
|
'Rule{seconds-angle{Prime_Angle{[n] children/*[1]; [t] "seconds"; [p] (pause:short){self::superscript{children/*[2][@role="prime"]{name(children/*[1])="number" or (children/*[1][@role="latinletter"] and ""=translate(children/*[1]/text(),"abcdefghijklmnopqrstuvwxyz", "")){children/*[2][text()="\u2033"]'.split(
|
|
"{",
|
|
),
|
|
'Rule,second-angle,Prime_Angle,[n] children/*[1]; [t] "second"; [p] (pause:short),self::superscript,children/*[2][@role="prime"],children/*[2][text()="\u2033"],children/*[1][text()="1"]'.split(
|
|
",",
|
|
),
|
|
'Rule{feet-length{Prime_Length{[n] children/*[1]; [t] "feet"; [p] (pause:short){self::superscript{children/*[2][@role="prime"]{name(children/*[1])="number" or (children/*[1][@role="latinletter"] and ""=translate(children/*[1]/text(),"abcdefghijklmnopqrstuvwxyz", "")){children/*[2][text()="\u2032"]'.split(
|
|
"{",
|
|
),
|
|
'Rule,foot-length,Prime_Length,[n] children/*[1]; [t] "foot"; [p] (pause:short),self::superscript,children/*[2][@role="prime"],children/*[2][text()="\u2032"],children/*[1][text()="1"]'.split(
|
|
",",
|
|
),
|
|
'Rule{inches-length{Prime_Length{[n] children/*[1]; [t] "inches"; [p] (pause:short){self::superscript{children/*[2][@role="prime"]{name(children/*[1])="number" or (children/*[1][@role="latinletter"] and ""=translate(children/*[1]/text(),"abcdefghijklmnopqrstuvwxyz", "")){children/*[2][text()="\u2033"]'.split(
|
|
"{",
|
|
),
|
|
'Rule,inch-length,Prime_Length,[n] children/*[1]; [t] "inch"; [p] (pause:short),self::superscript,children/*[2][@role="prime"],children/*[2][text()="\u2033"],children/*[1][text()="1"]'.split(
|
|
",",
|
|
),
|
|
["Rule", "punctuated", "default", "[m] children/*", "self::punctuated"],
|
|
["Rule", "function", "default", "[n] text()", "self::function"],
|
|
[
|
|
"Rule",
|
|
"appl",
|
|
"default",
|
|
'[n] children/*[1]; [t] "de"; [n] children/*[2]; [p] (pause:"short")',
|
|
"self::appl",
|
|
],
|
|
'Rule,appl-simple,default,[n] children/*[1]; [t] "de"; [p] (pause:"short"); [n] children/*[2]; [p] (pause:"short"),self::appl,@role="simple function",name(children/*[2])="appl"'.split(
|
|
",",
|
|
),
|
|
'Rule,appl-simple,default,[n] children/*[1]; [t] "de"; [p] (pause:"short"); [n] children/*[2]; [p] (pause:"short"),self::appl,@role="simple function",name(children/*[2])="fenced",name(children/*[2]/children/*[1])="appl"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"appl",
|
|
"Functions_None",
|
|
'[p] (pause:"short"); [n] children/*[1]; [t] "fois"; [n] children/*[2]; [p] (pause:"short")',
|
|
"self::appl",
|
|
],
|
|
'Rule,function-prefix,default,[n] children/*[1]; [n] children/*[2],self::appl,@role="prefix function"'.split(
|
|
",",
|
|
),
|
|
'Rule{binary-operation{ImpliedTimes_MoreImpliedTimes{[n] . (grammar:impliedTimes); [p] (pause:"short"){self::appl{@role="prefix function"{parent::*/parent::infixop[@role="implicit"]{following-sibling::*{not(contains(@grammar, "impliedTimes"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{function-prefix-simple-arg{default{[n] children/*[1]; [n] children/*[2]{self::appl{@role="prefix function"{name(children/*[2])="fenced"{contains(children/*[2]/children/*[1]/@annotation, "clearspeak:simple"){name(children/*[2]/children/*[1])!="number"{name(children/*[2]/children/*[1])!="identifier"{name(children/*[2]/children/*[1])!="appl"'.split(
|
|
"{",
|
|
),
|
|
'Rule,function-prefix-embell,default,[p] (pause:"short"); [n] children/*[1]; [n] children/*[2]; [p] (pause:"short"); ,self::appl,@role="prefix function",name(children/*[1])!="function"'.split(
|
|
",",
|
|
),
|
|
'Rule{function-prefix-fenced-or-frac-arg{default{[p] (pause:"short"); [n] children/*[1]; [t] "de"; [n] children/*[2]; [p] (pause:"short"){self::appl{@role="prefix function"{(name(children/*[2])="fenced" and not(contains(children/*[2]/children/*[1]/@annotation, "clearspeak:simple"))) or name(children/*[2])="fraction" or (name(children/*[2])!="fenced" and not(contains(children/*[2]/@annotation, "clearspeak:simple"))){self::*'.split(
|
|
"{",
|
|
),
|
|
'Rule,function-prefix-subscript,default,[p] (pause:"short"); [n] children/*[1]; [t] "de"; [p] (pause:"short"); [n] children/*[2]; [p] (pause:"short"),self::appl,@role="prefix function",name(children/*[1])="subscript",self::*'.split(
|
|
",",
|
|
),
|
|
'Rule{function-ln{default{[n] children/*[1]; [n] children/*[2]{self::appl{@role="prefix function"{content/*[2][text()="ln"]{not(following-sibling::*){not(contains(@grammar, "NatLog"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{function-ln{default{[n] children/*[1]; [n] children/*[2]; [p] (pause:"short"){self::appl{@role="prefix function"{content/*[2][text()="ln"]{not(contains(@grammar, "NatLog"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{function-ln{default{[n] children/*[1]; [t] "de"; [n] children/*[2]; [p] (pause:"short"){self::appl{@role="prefix function"{content/*[2][text()="ln"]{name(children/*[2])="fenced"{not(contains(@grammar, "NatLog"))'.split(
|
|
"{",
|
|
),
|
|
'Rule;function-ln;Log_LnAsNaturalLog;[n] . (grammar:NatLog);self::appl;@role="prefix function";content/*[2][text()="ln"];not(following-sibling::*);not(contains(@grammar, "NatLog"))'.split(
|
|
";",
|
|
),
|
|
'Rule{function-ln{Log_LnAsNaturalLog{[n] . (grammar:NatLog); [p] (pause:"short"){self::appl{@role="prefix function"{content/*[2][text()="ln"]{not(contains(@grammar, "NatLog"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{function-prefix-as-exp{default{[n] children/*[1]; [t] "de"; [p] (pause:"short"); [n] children/*[2]; [p] (pause:"short"){self::appl{@role="prefix function"{name(parent::*/parent::*)="superscript"{not(following-sibling::*){(name(children/*[2])="fenced" and not(contains(children/*[2]/children/*[1]/@annotation, "clearspeak:simple"))) or name(children/*[2])="fraction" or (name(children/*[2])!="fenced" and not(contains(children/*[2]/@annotation, "clearspeak:simple")))'.split(
|
|
"{",
|
|
),
|
|
'Rule,function-prefix-subscript-as-exp,default,[n] children/*[1]; [t] "de"; [p] (pause:"short"); [n] children/*[2]; [p] (pause:"short"),self::appl,@role="prefix function",name(parent::*/parent::*)="superscript",not(following-sibling::*),name(children/*[1])="subscript"'.split(
|
|
",",
|
|
),
|
|
'Rule,function-prefix-hyper,default,[p] (pause:"short"); [n] children/*[1]; [t] "de"; [n] children/*[2]; [p] (pause:"short"),self::appl,@role="prefix function",CQFisHyperbolic'.split(
|
|
",",
|
|
),
|
|
'Rule{function-prefix-inverse{default{[p] (pause:"short"); [n] children/*[1]/children/*[1]; [t] "inverse de"; [n] children/*[2]; [p] (pause:"short"){self::appl{@role="prefix function"{name(children/*[1])="superscript"{name(children/*[1]/children/*[2])="prefixop"{children/*[1]/children/*[2][@role="negative"]{children/*[1]/children/*[2]/children/*[1][text()="1"]{not(contains(@grammar, "functions_none"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{function-prefix-inverse{Trig_Reciprocal{[p] (pause:"short"); [t] "la reciproque de"; [n] children/*[1]/children/*[1]; [p] (pause:"short"); [n] children/*[2]; [p] (pause:"short"){self::appl{@role="prefix function"{name(children/*[1])="superscript"{name(children/*[1]/children/*[2])="prefixop"{children/*[1]/children/*[2][@role="negative"]{children/*[1]/children/*[2]/children/*[1][text()="1"]{not(contains(@grammar, "functions_none"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{function-prefix-inverse{Trig_Reciprocal{[p] (pause:"short"); [t] "la reciproque de"; [n] children/*[1]/children/*[1];[n] children/*[2]; [p] (pause:"short"){self::appl{@role="prefix function"{name(children/*[1])="superscript"{name(children/*[1]/children/*[2])="prefixop"{contains(children/*[2]/@annotation, "clearspeak:simple"){children/*[1]/children/*[2][@role="negative"]{children/*[1]/children/*[2]/children/*[1][text()="1"]{not(contains(@grammar, "functions_none"))'.split(
|
|
"{",
|
|
),
|
|
'Rule,appl-triginverse,Trig_TrigInverse,[p] (pause:"short"); [n] children/*[1]; [t] "de"; [n] children/*[2]; [p] (pause:"short"),self::appl,@role="prefix function",name(children/*[1])="superscript",name(children/*[1]/children/*[2])="prefixop",children/*[1]/children/*[2][@role="negative"],children/*[1]/children/*[2]/children/*[1][text()="1"]'.split(
|
|
",",
|
|
),
|
|
'Rule{function-prefix-arc-simple{Trig_ArcTrig{[p] (pause:"short"); [t] "arc"; [n] children/*[1]/children/*[1]; [n] children/*[2]; [p] (pause:"short"){self::appl{@role="prefix function"{name(children/*[1])="superscript"{name(children/*[1]/children/*[2])="prefixop"{children/*[1]/children/*[2][@role="negative"]{children/*[1]/children/*[2]/children/*[1][text()="1"]{not(contains(@grammar, "functions_none"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{function-prefix-arc-simple{Trig_ArcTrig{[p] (pause:"short"); [t] "arc"; [n] children/*[1]/children/*[1]; [p] (pause:"short"); [n] children/*[2]; [p] (pause:"short"){self::appl{@role="prefix function"{name(children/*[1])="superscript"{name(children/*[1]/children/*[2])="prefixop"{children/*[1]/children/*[2][@role="negative"]{children/*[1]/children/*[2]/children/*[1][text()="1"]{name(children/*[2])="fenced"{children/*[2]/children/*[1][@role="prefix function"]{contains(children/*[2]/children/*[1]/@annotation, "clearspeak:simple"){not(contains(@grammar, "functions_none"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{function-prefix-arc{Trig_ArcTrig{[p] (pause:"short"); [t] "arc"; [n] children/*[1]/children/*[1]; [t] "de"; [n] children/*[2]; [p] (pause:"short"){self::appl{@role="prefix function"{name(children/*[1])="superscript"{name(children/*[1]/children/*[2])="prefixop"{children/*[1]/children/*[2][@role="negative"]{children/*[1]/children/*[2]/children/*[1][text()="1"]{not(contains(@grammar, "functions_none")){(name(children/*[2])="fenced" and not(contains(children/*[2]/children/*[1]/@annotation, "clearspeak:simple"))) or (name(children/*[2])="fraction" and children/*[2][@role!="vulgar"])'.split(
|
|
"{",
|
|
),
|
|
'Rule{function-inverse{default{[n] children/*[1]; [t] "inverse"{self::superscript{@role="prefix function" or @role="simple function"{name(children/*[2])="prefixop"{children/*[2][@role="negative"]{children/*[2]/children/*[1][text()="1"]{not(contains(@grammar, "functions_none"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{function-inverse{Functions_Reciprocal{[t] "la reciproque de"; [n] children/*[1]{self::superscript{@role="prefix function" or @role="simple function"{name(children/*[2])="prefixop"{children/*[2][@role="negative"]{children/*[2]/children/*[1][text()="1"]{not(contains(@grammar, "functions_none"))'.split(
|
|
"{",
|
|
),
|
|
'Rule;function-inverse;Functions_None;[n] . (grammar:functions_none);self::superscript;@role="prefix function" or @role="simple function";name(children/*[2])="prefixop";children/*[2][@role="negative"];children/*[2]/children/*[1][text()="1"];not(contains(@grammar, "functions_none"))'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"superscript",
|
|
"default",
|
|
'[n] children/*[1]; [t] "\u00e0 l\'exposant" (pause:"short"); [n] children/*[2]; [p] (pause:"short"); [t] "fin exposant" (pause:"short")',
|
|
"self::superscript",
|
|
],
|
|
'Rule,superscript-simple-exponent,default,[n] children/*[1]; [t] "\u00e0 la puissance"; [n] children/*[2]; [p] (pause:"medium"),self::superscript,not(descendant::superscript)'.split(
|
|
",",
|
|
),
|
|
'Rule,superscript-simple-exponent,default,[n] children/*[1]; [t] "\u00e0 la puissance"; [n] children/*[2]; [p] (pause:"medium") ,self::superscript,not(descendant::superscript),not(following-sibling::*)'.split(
|
|
",",
|
|
),
|
|
'Aliases;superscript-simple-exponent;self::superscript;children/superscript/children/*[2][text()="2"] or children/superscript/children/*[2][text()="3"];name(children/superscript/children/*[1])="number";contains(children/superscript/children/*[1]/@annotation, "clearspeak:simple")'.split(
|
|
";",
|
|
),
|
|
'Aliases;superscript-simple-exponent;self::superscript;children/superscript/children/*[2][text()="2"] or children/superscript/children/*[2][text()="3"];name(children/superscript/children/*[1])="fraction";contains(children/superscript/children/*[1]/@annotation, "clearspeak:simple")'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"superscript-simple-exponent",
|
|
"self::superscript",
|
|
'children/superscript/children/*[2][text()="2"] or children/superscript/children/*[2][text()="3"]',
|
|
'name(children/superscript/children/*[1])="identifier"',
|
|
],
|
|
'Aliases;superscript-simple-exponent;self::superscript;children/*[2][@role="implicit"];count(children/*[2]/children/*)=2;contains(children/*[2]/children/*[1]/@annotation, "simple");name(children/*[2]/children/*[2])="superscript";(name(children/*[2]/children/*[2]/children/*[1])="number" and contains(children/*[2]/children/*[2]/children/*[1]/@annotation, "clearspeak:simple")) or name(children/*[2]/children/*[2]/children/*[1])="identifier";children/*[2]/children/*[2]/children/*[2][text()="2"] or children/*[2]/children/*[2]/children/*[2][text()="3"]'.split(
|
|
";",
|
|
),
|
|
'Rule;superscript-simple-function;Functions_None;[n] . (grammar:functions_none);self::superscript;name(children/*[1])="identifier";children/*[1][@role="simple function"];not(contains(@grammar, "functions_none"))'.split(
|
|
";",
|
|
),
|
|
'Rule,superscript-ordinal,Exponent_Ordinal,[n] children/*[1]; [t] "\u00e0 la"; [n] children/*[2] (grammar:ordinal); [t] "puissance" (pause:"medium"),self::superscript,name(children/*[2])="identifier",children/*[2][@role="latinletter"]'.split(
|
|
",",
|
|
),
|
|
'Rule,superscript-ordinal,Exponent_Ordinal,[n] children/*[1]; [t] "\u00e0 la puissance"; [n] children/*[2]; [p] (pause:"medium"),self::superscript,name(children/*[2])="identifier",children/*[2][@role="latinletter"],CQFisCaptial'.split(
|
|
",",
|
|
),
|
|
'Rule{exponent{default{[n] text() (join:"-"); [t] "i\u00e8me"{self::identifier{contains(@grammar, "ordinal")'.split(
|
|
"{",
|
|
),
|
|
'Rule;exponent;default;[t] CSFordinalExponent;self::number;@role="integer";contains(@grammar, "ordinal");text()!="0"'.split(
|
|
";",
|
|
),
|
|
'Rule;exponent;Exponent_Ordinal;[t] CSFwordOrdinal;self::number;@role="integer";contains(@grammar, "ordinal");text()!="0"'.split(
|
|
";",
|
|
),
|
|
'Rule;exponent;Exponent_Ordinal;[t] "zero";self::number;@role="integer";contains(@grammar, "ordinal");text()="0"'.split(
|
|
";",
|
|
),
|
|
'Rule;exponent;Exponent_OrdinalPower;[t] CSFwordOrdinal;self::number;@role="integer";contains(@grammar, "ordinal");text()!="0"'.split(
|
|
";",
|
|
),
|
|
'Rule;exponent;Exponent_OrdinalPower;[t] "zero";self::number;@role="integer";contains(@grammar, "ordinal");text()="0"'.split(
|
|
";",
|
|
),
|
|
'Rule,square,default,[n] children/*[1]; [t] "au carr\u00e9",self::superscript,children/*[2][text()="2"],name(children/*[1])!="text" or not(name(children/*[1])="text" and (name(../../../punctuated[@role="text"]/..)="stree" or name(..)="stree")),self::*,self::*'.split(
|
|
",",
|
|
),
|
|
'Rule,cube,default,[n] children/*[1]; [t] "au cube",self::superscript,children/*[2][text()="3"],name(children/*[1])!="text" or not(name(children/*[1])="text" and (name(../../../punctuated[@role="text"]/..)="stree" or name(..)="stree")),self::*,self::*'.split(
|
|
",",
|
|
),
|
|
'Rule;paren-simple;default;[n] children/*[1];self::fenced;@role="leftright";contains(children/*[1]/@annotation, "clearspeak:simple");name(../..)!="superscript" and name(../..)!="subscript"'.split(
|
|
";",
|
|
),
|
|
'Rule;paren-simple-exp;default;[n] children/*[1];self::fenced;@role="leftright";name(../..)="superscript";children/*[1][@role="integer"] or children/*[1][@role="float"] or (children/*[1][@role="vulgar"] and contains(children/*[1]/@annotation, "clearspeak:simple")) or children/*[1][@role="latinletter"] or children/*[1][@role="greekletter"] or children/*[1][@role="otherletter"]'.split(
|
|
";",
|
|
),
|
|
'Rule;paren-simple-nested-func;default;[n] children/*[1];self::fenced;@role="leftright";name(../*[1])="identifier" or name(../*[1])="function";parent::*/parent::*[@role="simple function" or @role="prefix function"];children/*[1][@role="simple function" or @role="prefix function"];contains(children/*[1]/children/*[2]/children/*[1]/@annotation, "clearspeak:simple") or name(children/*[1]/children/*[2]/children/*[1])="subscript" or name(children/*[1]/children/*[2]/children/*[1])="superscript" or children/*[1]/children/*[2]/children/*[1][@role="vulgar"] '.split(
|
|
";",
|
|
),
|
|
'Rule{paren-simple-nested-func-no-bracket{Functions_None{[n] children/*[1];{self::fenced{@role="leftright"{name(../*[1])="identifier" or name(../*[1])="function"{parent::*/parent::*[@role="simple function" or @role="prefix function"]{children/*[1][@role="simple function" or @role="prefix function"]{name(children/*[1]/children/*[1])="identifier" or name(children/*[1]/children/*[1])="function"{contains(children/*[1]/children/*[2]/children/*[1]/@annotation, "clearspeak:simple"){name(children/*[1]/children/*[2]/children/*[1])="identifier" or name(children/*[1]/children/*[2]/children/*[1])="number"'.split(
|
|
"{",
|
|
),
|
|
'Rule,fences-open-close,default,[p] (pause:"short"); [n] content/*[1] (grammar:spokenFence); [p] (pause:"short"); [n] children/*[1]; [p] (pause:"short"); [n] content/*[2] (grammar:spokenFence); [p] (pause:"short"),self::fenced,@role="leftright"'.split(
|
|
",",
|
|
),
|
|
'Rule{paren-simple-nested-func{default{[p] (pause:"short"); [n] content/*[1]; [p] (pause:"short"); [n] children/*[1]; [p] (pause:"short"); [n] content/*[2]; [p] (pause:"short"){self::fenced{@role="leftright"{name(../*[1])="identifier" or name(../*[1])="function"{parent::*/parent::*[@role="simple function" or @role="prefix function"]{not(contains(children/*[1]/@annotation, "clearspeak:simple"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{paren-simple-nested-func{Functions_None{[p] (pause:"short"); [n] content/*[1] (grammar:spokenFence); [p] (pause:"short"); [n] children/*[1]; [p] (pause:"short"); [n] content/*[2] (grammar:spokenFence); [p] (pause:"short"){self::fenced{@role="leftright"{name(../*[1])="identifier" or name(../*[1])="function"{parent::*/parent::*[@role="simple function" or @role="prefix function"]{children/*[1][@role="simple function" or @role="prefix function"]{contains(children/*[1]/children/*[2]/children/*[1]/@annotation, "clearspeak:simple") or name(children/*[1]/children/*[2]/children/*[1])="subscript" or name(children/*[1]/children/*[2]/children/*[1])="superscript" or children/*[1]/children/*[2]/children/*[1][@role="vulgar"] '.split(
|
|
"{",
|
|
),
|
|
["SpecializedRule", "fences-open-close", "default", "Paren_Speak"],
|
|
[
|
|
"Aliases",
|
|
"fences-open-close",
|
|
"self::fenced",
|
|
'@role="composed function"',
|
|
],
|
|
[
|
|
"Rule",
|
|
"fence-silent",
|
|
"Paren_Silent",
|
|
'[p] (pause:"short"); [n] children/*[1]; [p] (pause:"short")',
|
|
"self::fenced",
|
|
],
|
|
'Rule,fences-open-close,ImpliedTimes_None,[p] (pause:"short"); [n] content/*[1] (grammar:spokenFence); [p] (pause:"short"); [n] children/*[1]; [p] (pause:"short"); [n] content/*[2] (grammar:spokenFence); [p] (pause:"short"),self::fenced,@role="leftright",parent::*/parent::*[@role!="simple function"],parent::*/parent::*[@role!="prefix function"]'.split(
|
|
",",
|
|
),
|
|
'Rule;fence-nesting;Paren_SpeakNestingLevel;[n] text() (grammar:insertNesting=CSFnestingDepth);self::fence;contains(@grammar, "spokenFence");CQFmatchingFences'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"fence-no-nesting",
|
|
"Paren_SpeakNestingLevel",
|
|
"[n] text()",
|
|
"self::fence",
|
|
],
|
|
'Rule,fences-points,Paren_CoordPoint,[t] "le point avec coordon\u00e9es"; [n] children/*[1],self::fenced,name(children/*[1])="punctuated",children/*[1][@role="sequence"]'.split(
|
|
",",
|
|
),
|
|
'Rule{fences-interval{Paren_Interval{[t] "un intervalle de"; [n] children/*[1]/children/*[1]; [t] "\u00e0"; [n] children/*[1]/children/*[3]; [p] (pause:"short"); [n] . (grammar:interval){self::fenced{not(contains(@grammar, "interval")){name(children/*[1])="punctuated"{children/*[1][@role="sequence"]{count(./children/*[1]/content/*)=1{children/*[1]/content/*[1][@role="comma"]'.split(
|
|
"{",
|
|
),
|
|
'Rule{interval-open{Paren_Interval{[t] "sans inclure"; [n] children/*[1]/children/*[1]; [t] "ni"; [n] children/*[1]/children/*[3]{self::fenced{contains(@grammar, "interval"){content/*[1]/text()="("{content/*[2]/text()=")"'.split(
|
|
"{",
|
|
),
|
|
'Rule{interval-closed-open{Paren_Interval{[t] "avec"; [n] children/*[1]/children/*[1]; [t] "inclus"; [p] (pause:"short"); [t] "mais sans inclure"; [n] children/*[1]/children/*[3]{self::fenced{contains(@grammar, "interval"){content/*[1]/text()="["{content/*[2]/text()=")"'.split(
|
|
"{",
|
|
),
|
|
'Rule{interval-open-closed{Paren_Interval{[t] "sans inclure"; [n] children/*[1]/children/*[1]; [p] (pause:"short"); [t] "mais avec"; [n] children/*[1]/children/*[3]; [t] "inclus"{self::fenced{contains(@grammar, "interval"){content/*[1]/text()="("{content/*[2]/text()="]"'.split(
|
|
"{",
|
|
),
|
|
'Rule{interval-closed{Paren_Interval{[t] "avec"; [n] children/*[1]/children/*[1]; [t] "et"; [n] children/*[1]/children/*[3]; [t] "inclus"{self::fenced{contains(@grammar, "interval"){content/*[1]/text()="["{content/*[2]/text()="]"'.split(
|
|
"{",
|
|
),
|
|
'Rule{interval-open-inf-r{Paren_Interval{[t] "sans inclure"; [n] children/*[1]/children/*[1]{self::fenced{contains(@grammar, "interval"){content/*[1]/text()="("{content/*[2]/text()=")"{children/*[1]/children/*[3]/text()="\u221e" or (name(children/*[1]/children/*[3])="prefixop" and children/*[1]/children/*[3]/children/*[1]/text()="\u221e")'.split(
|
|
"{",
|
|
),
|
|
'Rule{interval-open-inf-l{Paren_Interval{[t] "sans inclure"; [n] children/*[1]/children/*[3]{self::fenced{contains(@grammar, "interval"){content/*[1]/text()="("{content/*[2]/text()=")"{children/*[1]/children/*[1]/text()="\u221e" or (name(children/*[1]/children/*[1])="prefixop" and children/*[1]/children/*[1]/children/*[1]/text()="\u221e")'.split(
|
|
"{",
|
|
),
|
|
'Rule;interval-open-inf-lr;Paren_Interval;;self::fenced;contains(@grammar, "interval");content/*[1]/text()="(";content/*[2]/text()=")";children/*[1]/children/*[3]/text()="\u221e" or (name(children/*[1]/children/*[3])="prefixop" and children/*[1]/children/*[3]/children/*[1]/text()="\u221e");children/*[1]/children/*[1]/text()="\u221e" or (name(children/*[1]/children/*[1])="prefixop" and children/*[1]/children/*[1]/children/*[1]/text()="\u221e")'.split(
|
|
";",
|
|
),
|
|
'Rule{interval-closed-open-inf{Paren_Interval{[t] "avec"; [n] children/*[1]/children/*[1]; [t] "inclus"{self::fenced{contains(@grammar, "interval"){content/*[1]/text()="["{content/*[2]/text()=")"{children/*[1]/children/*[3]/text()="\u221e" or (name(children/*[1]/children/*[3])="prefixop" and children/*[1]/children/*[3]/children/*[1]/text()="\u221e")'.split(
|
|
"{",
|
|
),
|
|
'Rule{interval-open-closed-inf{Paren_Interval{[t] "avec"; [n] children/*[1]/children/*[3]; [t] "inclus"{self::fenced{contains(@grammar, "interval"){content/*[1]/text()="("{content/*[2]/text()="]"{children/*[1]/children/*[1]/text()="\u221e" or (name(children/*[1]/children/*[1])="prefixop" and children/*[1]/children/*[1]/children/*[1]/text()="\u221e")'.split(
|
|
"{",
|
|
),
|
|
'Rule,paren-nested-embellished-funcs,Functions_None,[p] (pause:"short"); [n] content/*[1]; [p] (pause:"short"); [n] children/*[1]; [p] (pause:"short"); [n] content/*[2]; [p] (pause:"short"),self::fenced,@role="leftright",name(../..)="appl",name(children/*[1]) = "appl",preceding-sibling::*/descendant-or-self::*[@role="subsup"] or children/*[1]/descendant-or-self::*[@role="subsup"]'.split(
|
|
",",
|
|
),
|
|
'Rule;set-empty;default;[t] "ensemble vide";self::fenced;@role="set empty"'.split(
|
|
";",
|
|
),
|
|
'Rule,set-extended,default,[t] "ensemble des"; [n] children/*[1]/children/*[1]; [t] "tel que"; [n] children/*[1]/children/*[3],self::fenced,@role="set extended"'.split(
|
|
",",
|
|
),
|
|
'Rule,set-collection,default,[t] "ensemble"; [n] children/*[1],self::fenced,@role="set collection"'.split(
|
|
",",
|
|
),
|
|
["Aliases", "set-collection", "self::fenced", '@role="set singleton"'],
|
|
'Rule,set-extended,Sets_woAll,[t] "ensemble de"; [n] children/*[1]/children/*[1]; [t] "tel que"; [n] children/*[1]/children/*[3],self::fenced,@role="set extended"'.split(
|
|
",",
|
|
),
|
|
'Rule;set-collection;Sets_SilentBracket;[n] children/*[1];self::fenced;@role="set collection"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"subscript",
|
|
"default",
|
|
'[p] (pause:short); [n] children/*[1]; [t] "sub"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::subscript",
|
|
],
|
|
'Rule,subscript-base,default,[n] children/*[1]; [t] "base"; [n] children/*[2],self::subscript,CQFisLogarithm'.split(
|
|
",",
|
|
),
|
|
'Rule{subscript-index{default{[n] children/*[1]; [t] "sub"; [n] children/*[2]{self::subscript{contains(@grammar, "simpleDet")'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"default",
|
|
'[p] (pause:short); [t] "fraction avec num\u00e9rateur"; [n] children/*[1]; [p] (pause:short); [t] "et d\u00e9nominateur"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::fraction",
|
|
],
|
|
'Rule,fraction,Functions_None,[p] (pause:short); [t] "fraction avec num\u00e9rateur"; [n] children/*[1]; [p] (pause:short); [t] "et d\u00e9nominateur"; [n] children/*[2]; [p] (pause:short),self::fraction,name(children/*[1])="appl" or name(children/*[2])="appl"'.split(
|
|
",",
|
|
),
|
|
'Rule{simple-fraction{default{[p] (pause:short); [n] children/*[1]; [t] "sur"; [n] children/*[2]; [p] (pause:short){self::fraction{contains(children/*[1]/@annotation, "clearspeak:simple") or contains(children/*[1]/@annotation, "clearspeak:unit"){contains(children/*[2]/@annotation, "clearspeak:simple") or contains(children/*[2]/@annotation, "clearspeak:unit")'.split(
|
|
"{",
|
|
),
|
|
'Rule,simple-vulgar-fraction,default,[p] (pause:short); [n] children/*[1]; [t] "sur"; [n] children/*[2]; [p] (pause:short),self::fraction,@role="vulgar"'.split(
|
|
",",
|
|
),
|
|
'Rule,simple-text-fraction,default,[p] (pause:short); [n] children/*[1]; [t] "sur"; [n] children/*[2]; [p] (pause:short),self::fraction,name(children/*[1])="text",name(children/*[2])="text"'.split(
|
|
",",
|
|
),
|
|
'Rule,simple-text-fraction,default,[p] (pause:short); [n] children/*[1]; [t] "sur"; [n] children/*[2]; [p] (pause:short),self::fraction,name(children/*[1])="infixop",children/*[1][@role="unit"],name(children/*[2])="text"'.split(
|
|
",",
|
|
),
|
|
'Rule;vulgar-fraction;default;[t] CSFvulgarFraction;self::fraction;@role="vulgar";CQFvulgarFractionSmall'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"Fraction_Over",
|
|
'[p] (pause:short); [n] children/*[1]; [t] "sur"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::fraction",
|
|
],
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"Fraction_OverEndFrac",
|
|
'[p] (pause:short); [n] children/*[1]; [t] "sur"; [n] children/*[2]; [p] (pause:short); [t] "fin fraction"; [p] (pause:short)',
|
|
"self::fraction",
|
|
],
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"Fraction_FracOver",
|
|
'[p] (pause:short); [t] "fraction"; [n] children/*[1]; [t] "sur"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::fraction",
|
|
],
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"Fraction_Per",
|
|
'[p] (pause:short); [n] children/*[1]; [t] "par"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::fraction",
|
|
],
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"Fraction_GeneralEndFrac",
|
|
'[p] (pause:short); [t] "fraction avec num\u00e9rateur"; [n] children/*[1]; [p] (pause:short); [t] "et d\u00e9nominateur"; [n] children/*[2]; [p] (pause:short); [t] "fin fraction"; [p] (pause:short)',
|
|
"self::fraction",
|
|
],
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"Fraction_General",
|
|
'[p] (pause:short); [t] "fraction avec num\u00e9rateur"; [n] children/*[1]; [p] (pause:short); [t] "et d\u00e9nominateur"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::fraction",
|
|
],
|
|
'Rule;simple-vulgar-fraction;Fraction_Ordinal;[t] CSFvulgarFraction;self::fraction;@role="vulgar"'.split(
|
|
";",
|
|
),
|
|
'Rule{fraction{Fraction_EndFrac{[p] (pause:short); [n] . (grammar:endfrac); [t] "fin fraction"; [p] (pause:short){self::fraction{not(contains(@grammar, "endfrac")){not(contains(children/*[1]/@annotation, "clearspeak:unit")){not(contains(children/*[2]/@annotation, "clearspeak:unit"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{vulgar-fraction{Fraction_EndFrac{[p] (pause:short); [n] children/*[1]; [t] "sur"; [n] children/*[2]; [p] (pause:short){self::fraction{name(children/*[1])="fraction"{name(children/*[2])="fraction"{contains(children/*[1]/@annotation, "clearspeak:simple"){contains(children/*[2]/@annotation, "clearspeak:simple")'.split(
|
|
"{",
|
|
),
|
|
'Rule;simple-vulgar-fraction;Fraction_EndFrac;[t] CSFvulgarFraction;self::fraction;@role="vulgar";contains(@annotation, "clearspeak:simple");self::*'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"sqrt",
|
|
"default",
|
|
'[t] "la racine carr\u00e9e de"; [n] children/*[1] (grammar:EndRoot=false); [p] (pause:short)',
|
|
"self::sqrt",
|
|
],
|
|
'Rule,sqrt-nested,default,[p] (pause: "short"); [t] "la racine carr\u00e9e de"; [n] children/*[1] (grammar:EndRoot=false); [p] (pause:short),self::sqrt,not(preceding-sibling::*),ancestor::sqrt|ancestor::root'.split(
|
|
",",
|
|
),
|
|
'Rule,negative-sqrt,default,[t] "la racine carr\u00e9e n\u00e9gative de"; [n] children/*[1]/children/*[1] (grammar:EndRoot=false); [p] (pause:short),self::prefixop,@role="negative",name(children/*[1])="sqrt"'.split(
|
|
",",
|
|
),
|
|
'Rule,negative-sqrt,default,[p] (pause: "short"); [t] "la racine carr\u00e9e n\u00e9gative de"; [n] children/*[1]/children/*[1] (grammar:EndRoot=false); [p] (pause:short),self::prefixop,@role="negative",name(children/*[1])="sqrt",not(preceding-sibling::*),ancestor::sqrt|ancestor::root'.split(
|
|
",",
|
|
),
|
|
'Rule,sqrt-plus-minus,Roots_PosNegSqRoot,[t] "la racine carr\u00e9e positive de"; [n] children/*[1] (grammar:EndRoot=false); [p] (pause:short),self::sqrt,parent::stree or not(parent::*/parent::infixop[@role="addition"]) or (parent::*/parent::*[1]/text()!="\u00b1" and parent::*/parent::*/text()!="\u2213")'.split(
|
|
",",
|
|
),
|
|
'Rule,sqrt-nested-plus-minus,Roots_PosNegSqRoot,[p] (pause: "short"); [t] "la racine carr\u00e9e positive de"; [n] children/*[1] (grammar:EndRoot=false); [p] (pause:short),self::sqrt,not(preceding-sibling::*),ancestor::sqrt|ancestor::root,parent::stree or not(parent::*/parent::infixop[@role="addition"]) or (parent::*/parent::*[1]/text()!="\u00b1" and parent::*/parent::*/text()!="\u2213")'.split(
|
|
",",
|
|
),
|
|
'Rule,sqrt-plus-minus,Roots_PosNegSqRootEnd,[t] "la racine carr\u00e9e positive de"; [n] children/*[1] (grammar:EndRoot=false); [p] (pause:short),self::sqrt,parent::stree or not(parent::*/parent::infixop[@role="addition"]) or (parent::*/parent::*[1]/text()!="\u00b1" and parent::*/parent::*/text()!="\u2213")'.split(
|
|
",",
|
|
),
|
|
'Rule,sqrt-nested-plus-minus,Roots_PosNegSqRootEnd,[p] (pause: "short"); [t] "la racine carr\u00e9e positive de"; [n] children/*[1] (grammar:EndRoot=false); [p] (pause:short),self::sqrt,not(preceding-sibling::*),ancestor::sqrt|ancestor::root,parent::stree or not(parent::*/parent::infixop[@role="addition"]) or (parent::*/parent::*[1]/text()!="\u00b1" and parent::*/parent::*/text()!="\u2213")'.split(
|
|
",",
|
|
),
|
|
'Rule{sqrt-endroot{Roots_RootEnd{[n] . (grammar:EndRoot); [t] "fin racine"; [p] (pause:short){self::sqrt{not(contains(@grammar, "EndRoot"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{negative-sqrt-endroot{Roots_RootEnd{[n] . (grammar:EndRoot); [t] "fin racine"; [p] (pause:short){self::prefixop{@role="negative"{name(children/*[1])="sqrt"{not(contains(@grammar, "EndRoot"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{sqrt-endroot{Roots_PosNegSqRootEnd{[n] . (grammar:EndRoot); [t] "fin racine"; [p] (pause:short){self::sqrt{not(contains(@grammar, "EndRoot"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{negative-sqrt-endroot{Roots_PosNegSqRootEnd{[n] . (grammar:EndRoot); [t] "fin racine"; [p] (pause:short){self::prefixop{@role="negative"{name(children/*[1])="sqrt"{not(contains(@grammar, "EndRoot"))'.split(
|
|
"{",
|
|
),
|
|
'Rule,cube,default,[t] "la racine cubique de"; [n] children/*[2] (grammar:EndRoot=false); [p] (pause:short),self::root,children/*[1][text()="3"]'.split(
|
|
",",
|
|
),
|
|
'Rule,cube-nested,default,[p] (pause:short); [t] "la racine cubique de"; [n] children/*[2] (grammar:EndRoot=false); [p] (pause:short),self::root,children/*[1][text()="3"],not(preceding-sibling::*),ancestor::sqrt|ancestor::root'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"root",
|
|
"default",
|
|
'[t] "la"; [n] children/*[1] (grammar:ordinal); [t] "racine de"; [n] children/*[2] (grammar:EndRoot=false); [p] (pause:short)',
|
|
"self::root",
|
|
],
|
|
'Rule,root-nested,default,[p] (pause:short); [t] "la"; [n] children/*[1] (grammar:ordinal); [t] "racine de"; [n] children/*[2] (grammar:EndRoot=false); [p] (pause:short),self::root,not(preceding-sibling::*),ancestor::sqrt|ancestor::root'.split(
|
|
",",
|
|
),
|
|
'Rule{root-endroot{Roots_RootEnd{[n] . (grammar:EndRoot); [t] "fin racine"; [p] (pause:short){self::root{not(contains(@grammar, "EndRoot"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{root-endroot{Roots_PosNegSqRootEnd{[n] . (grammar:EndRoot); [t] "fin racine"; [p] (pause:short){self::root{not(contains(@grammar, "EndRoot"))'.split(
|
|
"{",
|
|
),
|
|
'Rule,negative,default,[t] "n\u00e9gatif"; [n] children/*[1],self::prefixop,@role="negative"'.split(
|
|
",",
|
|
),
|
|
'Rule,positive,default,[t] "positif"; [n] children/*[1],self::prefixop,@role="positive"'.split(
|
|
",",
|
|
),
|
|
'Rule,angle-measure,default,[t] "la mesure de l\'" (join:""); [n] content/*[1]; [n] children/*[2] (grammar:angle),self::infixop,content/*[1]/text()="\u2220",children/*[1][text()="m"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"prefix",
|
|
"default",
|
|
"[m] content/* (grammar:prefix); [n] children/*[1]",
|
|
"self::prefixop",
|
|
],
|
|
[
|
|
"Rule",
|
|
"postfix",
|
|
"default",
|
|
"[n] children/*[1]; [m] content/* (grammar:postfix)",
|
|
"self::postfixop",
|
|
],
|
|
'Rule{set-prefix-operators{default{[t] "le"; [n] self::* (grammar:!prefix); [t] "de"{self::*{contains(@grammar,"prefix"){descendant-or-self::*/text()="\u2229" or descendant-or-self::*/text()="\u222a"{self::*{self::*{self::*'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"binary-operation",
|
|
"default",
|
|
"[m] children/* (sepFunc:CTXFcontentIterator);",
|
|
"self::infixop",
|
|
],
|
|
'Rule,binary-operation,ImpliedTimes_MoreImpliedTimes,[m] children/* (sepFunc:CTXFcontentIterator);,self::infixop,@role="implicit"'.split(
|
|
",",
|
|
),
|
|
'Rule,binary-operation-pause,default,[p] (pause:short); [m] children/* (sepFunc:CTXFcontentIterator);,self::infixop,@role="implicit",name(children/*[1])="appl"'.split(
|
|
",",
|
|
),
|
|
'Rule,binary-operation-pause,default,[m] children/* (sepFunc:CTXFcontentIterator); [p] (pause:short),self::infixop,@role="implicit",name(children/*[last()])="appl"'.split(
|
|
",",
|
|
),
|
|
'Rule,binary-operation-pause,default,[p] (pause:short); [m] children/* (sepFunc:CTXFcontentIterator); [p] (pause:short),self::infixop,@role="implicit",name(children/*[1])="appl",name(children/*[last()])="appl"'.split(
|
|
",",
|
|
),
|
|
'Rule;implicit-times;default;[p] (pause:short);self::operator;@role="multiplication";text()="\u2062"'.split(
|
|
";",
|
|
),
|
|
'Rule implicit-times default self::operator @role="multiplication" text()="\u2062" CQFsimpleArguments'.split(
|
|
" ",
|
|
),
|
|
'Rule;implicit-times;default;[n] text();self::operator;@role="multiplication";text()="\u2062";CQFfencedArguments'.split(
|
|
";",
|
|
),
|
|
'Rule;implicit-times;ImpliedTimes_MoreImpliedTimes;[n] text();self::operator;@role="multiplication";text()="\u2062"'.split(
|
|
";",
|
|
),
|
|
'Rule implicit-times ImpliedTimes_None self::operator @role="multiplication" text()="\u2062"'.split(
|
|
" ",
|
|
),
|
|
'Rule{binary-operation-simple{default{[m] children/* (rate:"0.5"); [p] (pause:short){self::infixop{@role="implicit"{contains(@annotation, "clearspeak:simple"){not(contains(@grammar, "inFrac"))'.split(
|
|
"{",
|
|
),
|
|
'Rule;simple-in-fraction;default;[n] . (rate:"0.5",grammar:inFrac);self::*;contains(@annotation, "clearspeak:simple");not(contains(@grammar, "inFrac"));name(.)!="identifier";name(.)!="function";name(.)!="number";name(parent::*/parent::*)="fraction";not(preceding-sibling::*)'.split(
|
|
";",
|
|
),
|
|
'Rule;operators-after-power;Exponent_AfterPower;[m] children/* (rate:"0.5");self::infixop;@role="implicit";contains(@grammar, "afterPower")'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"relseq",
|
|
"default",
|
|
"[m] children/* (sepFunc:CTXFcontentIterator)",
|
|
"self::relseq",
|
|
],
|
|
[
|
|
"Rule",
|
|
"multrel",
|
|
"default",
|
|
"[m] children/* (sepFunc:CTXFcontentIterator)",
|
|
"self::multirel",
|
|
],
|
|
'Rule;natural-numbers;default;[t] "les nombres entier naturel";self::identifier;text()="\u2115" or (text()="N" and @font="double-struck");self::*;self::*;self::*'.split(
|
|
";",
|
|
),
|
|
'Rule;integers;default;[t] "les nombres entiers";self::identifier;text()="\u2124" or (text()="Z" and @font="double-struck");self::*;self::*;self::*'.split(
|
|
";",
|
|
),
|
|
'Rule;rational-numbers;default;[t] "les Nombres rationnels";self::identifier;text()="\u211a" or (text()="Q" and @font="double-struck");self::*;self::*;self::*'.split(
|
|
";",
|
|
),
|
|
'Rule;real-numbers;default;[t] "les nombres r\u00e9els";self::identifier;text()="\u211d" or (text()="R" and @font="double-struck");self::*;self::*;self::*'.split(
|
|
";",
|
|
),
|
|
'Rule;complex-numbers;default;[t] "les nombres complexes";self::identifier;text()="\u2102" or (text()="C" and @font="double-struck");self::*;self::*;self::*'.split(
|
|
";",
|
|
),
|
|
'Rule,natural-numbers-super,default,[t] "n" (join: "-"); [n] children/*[2] (grammar:numbers2alpha),self::superscript,children/*[1]/text()="\u2115" or (children/*[1]/text()="N" and children/*[1]/@font="double-struck"),self::*,self::*,self::*'.split(
|
|
",",
|
|
),
|
|
'Rule,integers-super,default,[t] "z" (join: "-"); [n] children/*[2] (grammar:numbers2alpha),self::superscript,children/*[1]/text()="\u2124" or (children/*[1]/text()="Z" and children/*[1]/@font="double-struck"),self::*,self::*,self::*'.split(
|
|
",",
|
|
),
|
|
'Rule,rational-numbers-super,default,[t] "q" (join: "-"); [n] children/*[2] (grammar:numbers2alpha),self::superscript,children/*[1]/text()="\u211a" or (children/*[1]/text()="Q" and children/*[1]/@font="double-struck"),self::*,self::*,self::*'.split(
|
|
",",
|
|
),
|
|
'Rule,real-numbers-super,default,[t] "r" (join:"-"); [n] children/*[2] (grammar:numbers2alpha),self::superscript,children/*[1]/text()="\u211d" or (children/*[1]/text()="R" and children/*[1]/@font="double-struck"),self::*,self::*,self::*'.split(
|
|
",",
|
|
),
|
|
'Rule,complex-numbers-super,default,[t] "c" (join:"-"); [n] children/*[2] (grammar:numbers2alpha),self::superscript,children/*[1]/text()="\u2102" or (children/*[1]/text()="C" and children/*[1]/@font="double-struck"),self::*,self::*,self::*'.split(
|
|
",",
|
|
),
|
|
'Rule;natural-numbers-with-zero;default;[t] "les nombres entiers naturel avec zero";self::subscript;children/*[1]/text()="\u2115" or (children/*[1]/text()="N" and children/*[1]/@font="double-struck");children/*[2]/text()="0"'.split(
|
|
";",
|
|
),
|
|
'Rule;positive-integers;default;[t] "les nombres entiers positif";self::superscript;children/*[1]/text()="\u2124" or (children/*[1]/text()="Z" and children/*[1]/@font="double-struck");children/*[2]/text()="+";self::*;self::*;self::*'.split(
|
|
";",
|
|
),
|
|
'Rule;positive-integers;default;[t] "les nombres entiers n\u00e9gatif";self::superscript;children/*[1]/text()="\u2124" or (children/*[1]/text()="Z" and children/*[1]/@font="double-struck");children/*[2]/text()="-";self::*;self::*;self::*'.split(
|
|
";",
|
|
),
|
|
'Rule;positive-rational-numbers;default;[t] "les nombres rationnels positif";self::superscript;children/*[1]/text()="\u211a" or (children/*[1]/text()="Q" and children/*[1]/@font="double-struck");children/*[2]/text()="+";self::*;self::*;self::*'.split(
|
|
";",
|
|
),
|
|
'Rule;negative-rational-numbers;default;[t] "les nombres rationnels n\u00e9gatif";self::superscript;children/*[1]/text()="\u211a" or (children/*[1]/text()="Q" and children/*[1]/@font="double-struck");children/*[2]/text()="-";self::*;self::*;self::*'.split(
|
|
";",
|
|
),
|
|
'Rule,fences-neutral,default,[p] (pause:short); [t] "la valeur absolue de"; [n] children/*[1]; [p] (pause: short),self::fenced,@role="neutral",content/*[1][text()]="|" or content/*[1][text()]="\u2758" or content/*[1][text()]="\uff5c"'.split(
|
|
",",
|
|
),
|
|
'Rule,fences-neutral,AbsoluteValue_AbsEnd,[p] (pause:short); [t] "la valeur absolue de"; [n] children/*[1]; [p] (pause: short); [t] "fin de valeur absolue"; [p] (pause: short),self::fenced,@role="neutral",content/*[1][text()]="|" or content/*[1][text()]="\u2758" or content/*[1][text()]="\uff5c"'.split(
|
|
",",
|
|
),
|
|
'Rule,fences-neutral,AbsoluteValue_Cardinality,[p] (pause:short); [t] "la cardinalit\u00e9 de"; [n] children/*[1]; [p] (pause: short),self::fenced,@role="neutral",content/*[1][text()]="|" or content/*[1][text()]="\u2758" or content/*[1][text()]="\uff5c"'.split(
|
|
",",
|
|
),
|
|
'Rule,fences-neutral,AbsoluteValue_Determinant,[p] (pause:short); [t] "le d\u00e9terminant de"; [n] children/*[1]; [p] (pause: short),self::fenced,@role="neutral",content/*[1][text()]="|" or content/*[1][text()]="\u2758" or content/*[1][text()]="\uff5c"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"matrix",
|
|
"default",
|
|
'[t] "la matrice de dimension"; [t] count(children/*); [t] "par";[t] count(children/*[1]/children/*); [p] (pause:long); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"rang\u00e9e-:"); [p] (pause:long)',
|
|
"self::matrix",
|
|
],
|
|
'Rule{matrix-simple{default{[t] "la matrice de dimension"; [t] count(children/*); [t] "par";[t] count(children/*[1]/children/*); [p] (pause:long); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"rang\u00e9e-:",grammar:simpleDet); [p] (pause:long){self::matrix{count(children/*)<4{count(children/*[1]/children/*)<4{CQFcellsSimple'.split(
|
|
"{",
|
|
),
|
|
'Rule,matrix-trivial,default,[t] "la matrice de dimension 1 par 1 avec \u00e9l\u00e9ment"; [n] children/*[1]; [p] (pause:long),self::vector,@role="squarematrix"'.split(
|
|
",",
|
|
),
|
|
'Rule{determinant{default{[t] "le d\u00e9terminant de la matrice de dimension"; [t] count(children/*); [t] "par"; [t] count(children/*[1]/children/*); [p] (pause:long); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"rang\u00e9e-:",grammar:simpleDet); [p] (pause:long){self::matrix{@role="determinant"{count(children/*)<4{CQFcellsSimple'.split(
|
|
"{",
|
|
),
|
|
'Rule{determinant-simple{default{[t] "le d\u00e9terminant de la matrice de dimension"; [t] count(children/*); [t] "par"; [t] count(children/*[1]/children/*); [p] (pause:long); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"rang\u00e9e-:"); [p] (pause:long){self::matrix{@role="determinant"'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"matrix-vector",
|
|
"default",
|
|
'[t] "la matrice colonne de dimension"; [t] count(children/*); [t] "par"; [t] count(children/*[1]/children/*); [p] (pause:long); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"rang\u00e9e-:",grammar:simpleDet); [p] (pause:long)',
|
|
"self::vector",
|
|
],
|
|
["SpecializedRule", "matrix-vector", "default", "Matrix_SpeakColNum"],
|
|
'Rule{matrix-vector-simple{default{[t] "la matrice colonne de dimension"; [t] count(children/*); [t] "par"; [t] count(children/*[1]/children/*); [p] (pause:long); [m] children/* (sepFunc:CTXFpauseSeparator,separator:"short",grammar:simpleDet); [p] (pause:long){self::vector{count(children/*)<4{CQFcellsSimple{@role!="squarematrix"'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"matrix-vector-simple",
|
|
"Matrix_SilentColNum",
|
|
'[t] "la matrice colonne de dimension"; [t] count(children/*); [t] "par"; [t] count(children/*[1]/children/*); [p] (pause:long); [m] children/* (sepFunc:CTXFpauseSeparator,separator:"short",grammar:simpleDet); [p] (pause:long)',
|
|
"self::vector",
|
|
],
|
|
'Rule{matrix-row-vector{default{[t] "la matrice ligne de dimension"; [t] count(children/*); [t] "par"; [t] count(children/*[1]/children/*); [p] (pause:long); [m] children/*[1]/children/* (ctxtFunc:CTXFnodeCounter,context:"colonne-:",grammar:simpleDet); [p] (pause:long){self::matrix{@role="rowvector"'.split(
|
|
"{",
|
|
),
|
|
["SpecializedRule", "matrix-row-vector", "default", "Matrix_SpeakColNum"],
|
|
'Rule{matrix-row-vector-simple{default{[t] "la matrice ligne de dimension"; [t] count(children/*); [t] "par"; [t] count(children/*[1]/children/*); [p] (pause:long); [m] children/*[1]/children/* (sepFunc:CTXFpauseSeparator,separator:"short",grammar:simpleDet); [p] (pause:long){self::matrix{@role="rowvector"{count(children/*[1]/children/*)<4{CQFcellsSimple'.split(
|
|
"{",
|
|
),
|
|
'Rule{matrix-row-vector-simple{Matrix_SilentColNum{[t] "la matrice ligne de dimension"; [t] count(children/*); [t] "par"; [t] count(children/*[1]/children/*); [p] (pause:long); [m] children/*[1]/children/* (sepFunc:CTXFpauseSeparator,separator:"short",grammar:simpleDet); [p] (pause:long){self::matrix{@role="rowvector"'.split(
|
|
"{",
|
|
),
|
|
'Rule;matrix-row-simple;default;[m] children/* (sepFunc:CTXFpauseSeparator,separator:"short");self::row;contains(@grammar, "simpleDet")'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"matrix-row-simple",
|
|
"Matrix_SilentColNum",
|
|
'[m] children/* (sepFunc:CTXFpauseSeparator,separator:"short")',
|
|
"self::row",
|
|
],
|
|
'Rule;line-simple;default;[n] children/*[1];self::line;contains(@grammar, "simpleDet")'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"matrix-row",
|
|
"default",
|
|
'[m] children/* (ctxtFunc:CTXFnodeCounter,context:"colonne-,- ",sepFunc:CTXFpauseSeparator,separator:"medium"); [p] (pause:long)',
|
|
"self::row",
|
|
],
|
|
["SpecializedRule", "matrix-row", "default", "Matrix_SpeakColNum"],
|
|
["Rule", "matrix-cell", "default", "[n] children/*[1]", "self::cell"],
|
|
'Rule{matrix-end-matrix{Matrix_EndMatrix{[n] . (grammar:EndMatrix); [t] "fin matrice"{self::matrix{not(contains(@grammar, "EndMatrix"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{matrix-end-vector{Matrix_EndMatrix{[n] . (grammar:EndMatrix); [t] "fin matrice"{self::vector{not(contains(@grammar, "EndMatrix"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{matrix-end-determinant{Matrix_EndMatrix{[n] . (grammar:EndMatrix); [t] "fin d\u00e9terminant"{self::matrix{@role="determinant"{not(contains(@grammar, "EndMatrix"))'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"vector",
|
|
"Matrix_Vector",
|
|
'[t] "le vecteur colonne de dimension"; [t] count(children/*); [t] "par"; [t] count(children/*[1]/children/*); [p] (pause:long); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"rang\u00e9e-:",grammar:simpleDet); [p] (pause:long)',
|
|
"self::vector",
|
|
],
|
|
["SpecializedRule", "vector", "Matrix_Vector", "Matrix_EndVector"],
|
|
'Rule{vector-simple{Matrix_Vector{[t] "le vecteur colonne de dimension"; [t] count(children/*); [t] "par"; [t] count(children/*[1]/children/*); [p] (pause:long); [m] children/* (sepFunc:CTXFpauseSeparator,separator:"short",grammar:simpleDet); [p] (pause:long){self::vector{count(children/*)<4{CQFcellsSimple'.split(
|
|
"{",
|
|
),
|
|
["SpecializedRule", "vector-simple", "Matrix_Vector", "Matrix_EndVector"],
|
|
'Rule{row-vector{Matrix_Vector{[t] "le vecteur ligne de dimension"; [t] count(children/*); [t] "par"; [t] count(children/*[1]/children/*); [p] (pause:long); [m] children/*[1]/children/* (ctxtFunc:CTXFnodeCounter,context:"colonne-:",grammar:simpleDet); [p] (pause:long){self::matrix{@role="rowvector"'.split(
|
|
"{",
|
|
),
|
|
["SpecializedRule", "row-vector", "Matrix_Vector", "Matrix_EndVector"],
|
|
'Rule{row-vector-simple{Matrix_Vector{[t] "le vecteur ligne de dimension"; [t] count(children/*); [t] "par"; [t] count(children/*[1]/children/*); [p] (pause:long); [m] children/*[1]/children/* (sepFunc:CTXFpauseSeparator,separator:"short",grammar:simpleDet); [p] (pause:long){self::matrix{@role="rowvector"{count(children/*[1]/children/*)<4{CQFcellsSimple'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"row-vector-simple",
|
|
"Matrix_Vector",
|
|
"Matrix_EndVector",
|
|
],
|
|
'Rule{vector-end-matrix{Matrix_EndVector{[n] . (grammar:EndMatrix); [t] "fin matrice"{self::matrix{not(contains(@grammar, "EndMatrix")){self::*'.split(
|
|
"{",
|
|
),
|
|
'Rule{vector-end-vector{Matrix_EndVector{[n] . (grammar:EndMatrix); [t] "fin vecteur"{self::vector{not(contains(@grammar, "EndMatrix")){self::*'.split(
|
|
"{",
|
|
),
|
|
'Rule{vector-end-vector{Matrix_EndVector{[n] . (grammar:EndMatrix); [t] "fin vecteur"{self::matrix{@role="rowvector"{not(contains(@grammar, "EndMatrix")){self::*'.split(
|
|
"{",
|
|
),
|
|
'Rule{vector-end-determinant{Matrix_EndVector{[n] . (grammar:EndMatrix); [t] "fin d\u00e9terminant"{self::matrix{@role="determinant"{not(contains(@grammar, "EndMatrix")){self::*'.split(
|
|
"{",
|
|
),
|
|
'Rule,binomial,Matrix_Combinatoric,[n] children/*[2]/children/*[1]; [t] "parmi"; [n] children/*[1]/children/*[1]; ,self::vector,@role="binomial"'.split(
|
|
",",
|
|
),
|
|
'Rule{lines-summary{default{[p] (pause:short); [t] count(children/*); [t] "lignes"; [n] . (grammar:layoutSummary){self::multiline{not(contains(@grammar, "layoutSummary")){self::*'.split(
|
|
"{",
|
|
),
|
|
'Rule;lines-summary;MultiLineOverview_None;[n] . (grammar:layoutSummary);self::multiline;not(contains(@grammar, "layoutSummary"));self::*'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"lines-summary",
|
|
"self::table",
|
|
'not(contains(@grammar, "layoutSummary"))',
|
|
],
|
|
'Rule{cases-summary{default{[p] (pause:short); [t] count(children/*); [t] "cas"; [n] . (grammar:layoutSummary){self::cases{not(contains(@grammar, "layoutSummary"))'.split(
|
|
"{",
|
|
),
|
|
'Rule;cases-summary;MultiLineOverview_None;[n] . (grammar:layoutSummary);self::cases;not(contains(@grammar, "layoutSummary"));self::*'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"lines",
|
|
"default",
|
|
'[p] (pause:short); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"Ligne-:",sepFunc:CTXFpauseSeparator,separator:"long"); [p] (pause:long)',
|
|
"self::table",
|
|
],
|
|
["Aliases", "lines", "self::multiline"],
|
|
["Rule", "line", "default", "[n] children/*[1]", "self::line"],
|
|
'Rule;row-medium;default;[m] children/* (sepFunc:CTXFpauseSeparator,separator:"medium");self::row;@role="table"'.split(
|
|
";",
|
|
),
|
|
["Aliases", "row-medium", "self::row", '@role="cases"'],
|
|
'Rule;row-long;MultiLinePausesBetweenColumns_Long;[m] children/* (sepFunc:CTXFpauseSeparator,separator:"long");self::row;@role="table"'.split(
|
|
";",
|
|
),
|
|
["Aliases", "row-long", "self::row", '@role="cases"'],
|
|
'Rule;row-short;MultiLinePausesBetweenColumns_Short;[m] children/* (sepFunc:CTXFpauseSeparator,separator:"short");self::row;@role="table"'.split(
|
|
";",
|
|
),
|
|
["Aliases", "row-short", "self::row", '@role="cases"'],
|
|
'Rule;blank-cell;default;[t] "vide";self::cell;count(children/*)=0'.split(
|
|
";",
|
|
),
|
|
'Rule;blank-empty;default;[t] "vide";self::empty;count(../*)=1;name(../..)="cell" or name(../..)="line"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"cases",
|
|
"default",
|
|
'[p] (pause:short); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"Cas-:",sepFunc:CTXFpauseSeparator,separator:"long"); [p] (pause:long)',
|
|
"self::cases",
|
|
],
|
|
'Rule{lines-cases-summary{MultiLineLabel_Case{[p] (pause:short); [t] count(children/*); [t] "cas"; [n] . (grammar:layoutSummary){self::multiline{not(contains(@grammar, "layoutSummary"))'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"lines-cases-summary",
|
|
"self::table",
|
|
'not(contains(@grammar, "layoutSummary"))',
|
|
],
|
|
[
|
|
"Rule",
|
|
"lines-cases",
|
|
"MultiLineLabel_Case",
|
|
'[p] (pause:short); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"Cas-:",sepFunc:CTXFpauseSeparator,separator:"long"); [p] (pause:long)',
|
|
"self::table",
|
|
],
|
|
["Aliases", "lines-cases", "self::multiline"],
|
|
'Rule{lines-equations-summary{MultiLineLabel_Equation{[p] (pause:short); [t] count(children/*); [t] "\u00e9quations"; [n] . (grammar:layoutSummary){self::multiline{not(contains(@grammar, "layoutSummary"))'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"lines-equations-summary",
|
|
"self::table",
|
|
'not(contains(@grammar, "layoutSummary"))',
|
|
],
|
|
[
|
|
"Rule",
|
|
"lines-equations",
|
|
"MultiLineLabel_Equation",
|
|
'[p] (pause:short); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"\u00c9quation-:",sepFunc:CTXFpauseSeparator,separator:"long"); [p] (pause:long)',
|
|
"self::table",
|
|
],
|
|
["Aliases", "lines-equations", "self::multiline"],
|
|
'Rule{lines-steps-summary{MultiLineLabel_Step{[p] (pause:short); [t] count(children/*); [t] " \u00e9tapes"; [n] . (grammar:layoutSummary){self::multiline{not(contains(@grammar, "layoutSummary"))'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"lines-steps-summary",
|
|
"self::table",
|
|
'not(contains(@grammar, "layoutSummary"))',
|
|
],
|
|
[
|
|
"Rule",
|
|
"lines-steps",
|
|
"MultiLineLabel_Step",
|
|
'[p] (pause:short); [m] children/* (ctxtFunc:CTXFnodeCounter,context:" \u00c9tape-:",sepFunc:CTXFpauseSeparator,separator:"long"); [p] (pause:long)',
|
|
"self::table",
|
|
],
|
|
["Aliases", "lines-steps", "self::multiline"],
|
|
'Rule{lines-rows-summary{MultiLineLabel_Row{[p] (pause:short); [t] count(children/*); [t] "colonnes"; [n] . (grammar:layoutSummary){self::multiline{not(contains(@grammar, "layoutSummary"))'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"lines-rows-summary",
|
|
"self::table",
|
|
'not(contains(@grammar, "layoutSummary"))',
|
|
],
|
|
[
|
|
"Rule",
|
|
"lines-rows",
|
|
"MultiLineLabel_Row",
|
|
'[p] (pause:short); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"rang\u00e9e-:",sepFunc:CTXFpauseSeparator,separator:"long"); [p] (pause:long)',
|
|
"self::table",
|
|
],
|
|
["Aliases", "lines-rows", "self::multiline"],
|
|
'Rule{lines-constraints-summary{MultiLineLabel_Constraint{[p] (pause:short); [t] count(children/*); [t] "contraintes"; [n] . (grammar:layoutSummary){self::multiline{not(contains(@grammar, "layoutSummary"))'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"lines-constraints-summary",
|
|
"self::table",
|
|
'not(contains(@grammar, "layoutSummary"))',
|
|
],
|
|
[
|
|
"Rule",
|
|
"lines-constraints",
|
|
"MultiLineLabel_Constraint",
|
|
'[p] (pause:short); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"Contrainte-:",sepFunc:CTXFpauseSeparator,separator:"long"); [p] (pause:long)',
|
|
"self::table",
|
|
],
|
|
["Aliases", "lines-constraints", "self::multiline"],
|
|
'Rule{lines-none{MultiLineLabel_None{[p] (pause:short); [m] children/* (sepFunc:CTXFpauseSeparator,separator:"long"); [p] (pause:long){self::table{contains(@grammar, "layoutSummary")'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"lines-none",
|
|
"self::multiline",
|
|
'contains(@grammar, "layoutSummary")',
|
|
],
|
|
[
|
|
"Aliases",
|
|
"lines-none",
|
|
"self::cases",
|
|
'contains(@grammar, "layoutSummary")',
|
|
],
|
|
[
|
|
"Rule",
|
|
"bigop",
|
|
"default",
|
|
'[t] "le"; [n] children/*[1]; [t] "de"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::bigop",
|
|
],
|
|
[
|
|
"Rule",
|
|
"limboth",
|
|
"default",
|
|
'[n] children/*[1]; [t] "de"; [n] children/*[2];[t] "\u00e0"; [n] children/*[3];',
|
|
"self::limboth",
|
|
],
|
|
[
|
|
"Rule",
|
|
"limlower",
|
|
"default",
|
|
'[n] children/*[1]; [t] "sur"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::limlower",
|
|
],
|
|
[
|
|
"Rule",
|
|
"limupper",
|
|
"default",
|
|
'[n] children/*[1]; [t] "sous"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::limupper",
|
|
],
|
|
[
|
|
"Rule",
|
|
"integral",
|
|
"default",
|
|
'[t] "le"; [n] children/*[1]; [t] "de"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::integral",
|
|
],
|
|
[
|
|
"Rule",
|
|
"overscript",
|
|
"default",
|
|
'[n] children/*[1]; [t] "sous"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::overscore",
|
|
],
|
|
'Rule,overscript,default,[n] children/*[1]; [n] children/*[2];,self::overscore,children/*[2][@role="overaccent"]'.split(
|
|
",",
|
|
),
|
|
'Rule,overscript-limits,default,[n] children/*[1]; [t] "\u00e0"; [n] children/*[2],self::overscore,children/*[2][@role!="overaccent"],name(children/*[1])="underscore",children/*[1]/children/*[2][@role!="underaccent"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"underscript",
|
|
"default",
|
|
'[n] children/*[1]; [t] "sur"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::underscore",
|
|
],
|
|
'Rule,underscript-limits,default,[n] children/*[1]; [t] "de"; [n] children/*[2],self::underscore,@role="underover",children/*[2][@role!="underaccent"]'.split(
|
|
",",
|
|
),
|
|
["Rule", "number", "default", "[n] text()", "self::number"],
|
|
'Rule,mixed-number,default,[n] children/*[1]; [t] "et"; [n] children/*[2]; ,self::number,@role="mixed"'.split(
|
|
",",
|
|
),
|
|
'Rule{number-with-chars{default{[t] "nombre"; [m] CQFspaceoutNumber (grammar:protected){self::number{@role="othernumber"{"" != translate(text(), "0123456789.,", ""){not(contains(@grammar, "protected"))'.split(
|
|
"{",
|
|
),
|
|
'Rule,decimal-period,default,[t] "la d\u00e9cimale"; [n] children/*[1] (grammar:spaceout); [t] "virgule suivi par les chiffres r\u00e9p\u00e9t\u00e9s"; [n] children/*[3]/children/*[1] (grammar:spaceout),self::punctuated,@role="sequence",count(./content/*)=1,./content/*[1][@role="fullstop"],name(children/*[1])="number",children/*[1][@role="integer"],name(children/*[3])="overscore",children/*[3][@role="integer"],children/*[3]/children/*[2][@role="overaccent"],children/*[3]/children/*[2][text()="\u00af" or text()="\uffe3" or text()="\uff3f" or text()="_" or text()="\u203e"]'.split(
|
|
",",
|
|
),
|
|
'Rule,decimal-period,default,[t] "la d\u00e9cimale"; [n] children/*[1] (grammar:spaceout); [t] "suivi par les chiffres r\u00e9p\u00e9t\u00e9s"; [n] children/*[2]/children/*[1] (grammar:spaceout);,self::infixop,@role="implicit",count(./children/*)=2,name(children/*[1])="number",children/*[1][@role="float"],name(children/*[2])="overscore",children/*[2][@role="integer"],children/*[2]/children/*[2][@role="overaccent"],children/*[2]/children/*[2][text()="\u00af" or text()="\uffe3" or text()="\uff3f" or text()="_" or text()="\u203e"]'.split(
|
|
",",
|
|
),
|
|
'Rule,decimal-period-singular,default,[t] "la d\u00e9cimale"; [n] children/*[1] (grammar:spaceout); [t] "virgule suivi par le chiffre r\u00e9p\u00e9t\u00e9"; [n] children/*[3]/children/*[1] (grammar:spaceout),self::punctuated,@role="sequence",count(./content/*)=1,./content/*[1][@role="fullstop"],name(children/*[1])="number",children/*[1][@role="integer"],name(children/*[3])="overscore",children/*[3][@role="integer"],children/*[3]/children/*[2][@role="overaccent"],children/*[3]/children/*[2][text()="\u00af" or text()="\uffe3" or text()="\uff3f" or text()="_" or text()="\u203e"],string-length(./children/*[3]/children/*[1]/text())=1'.split(
|
|
",",
|
|
),
|
|
'Rule,decimal-period-singular,default,[t] "la d\u00e9cimale"; [n] children/*[1] (grammar:spaceout); [t] "suivi par le chiffre r\u00e9p\u00e9t\u00e9"; [n] children/*[2]/children/*[1] (grammar:spaceout);,self::infixop,@role="implicit",count(./children/*)=2,name(children/*[1])="number",children/*[1][@role="float"],name(children/*[2])="overscore",children/*[2][@role="integer"],children/*[2]/children/*[2][@role="overaccent"],children/*[2]/children/*[2][text()="\u00af" or text()="\uffe3" or text()="\uff3f" or text()="_" or text()="\u203e"],string-length(./children/*[2]/children/*[1]/text())=1'.split(
|
|
",",
|
|
),
|
|
'Rule;number-with-spaces;default;[m] CQFspaceoutNumber (grammar:!spaceout:number);self::number;contains(@grammar, "spaceout")'.split(
|
|
";",
|
|
),
|
|
'Rule;decimal-point;default;[t] "point";self::punctuation;@role="fullstop";contains(@grammar,"number")'.split(
|
|
";",
|
|
),
|
|
'Rule,line-segment,default,[t] "le segment"; [n] children/*[1]/children/*[1]; [n] children/*[1]/children/*[2]; [p] (pause:short),self::overscore,@role="implicit",children/*[2][@role="overaccent"],children/*[2][text()="\u00af" or text()="\uffe3" or text()="\uff3f" or text()="_" or text()="\u203e"],name(children/*[1])="infixop",count(./children/*[1]/children/*)=2'.split(
|
|
",",
|
|
),
|
|
'Rule,conjugate,Bar_Conjugate,[t] "le complexe conjugu\u00e9 de"; [n] children/*[1],self::overscore,children/*[2][@role="overaccent"],children/*[2][text()="\u00af" or text()="\uffe3" or text()="\uff3f" or text()="_" or text()="\u203e"]'.split(
|
|
",",
|
|
),
|
|
'Rule;defined-by;default;[t] "est d\u00e9fini par" (pause:short);self::overscore;@role="equality";@embellished="relation";name(children/*[2])="text";children/*[2][text()]="def"'.split(
|
|
";",
|
|
),
|
|
'Rule,adorned-sign,default,[t] "signe"; [n] children/*[1] ; [t] "avec"; [n] children/*[2]; [t] "dessus",self::overscore,@embellished,name(children/*[1])="operator" or name(children/*[1])="relation"'.split(
|
|
",",
|
|
),
|
|
'Rule;factorial;default;[t] "factorielle";self::punctuation;text()="!";name(preceding-sibling::*[1])!="text"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"tensor-base",
|
|
"default",
|
|
"[n] children/*[2]; [n] children/*[3]; [n] children/*[1]; [n] children/*[4]; [n] children/*[5]",
|
|
"self::tensor",
|
|
],
|
|
'Rule{left-super{default{[t] "exposant gauche"; [n] text(){self::*[@role="leftsuper"]{not(contains(@grammar,"combinatorics"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{left-super{default{[t] "exposant gauche"; [m] children/*{self::punctuated{@role="leftsuper"{not(contains(@grammar,"combinatorics"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{left-sub{default{[t] "indice gauche"; [n] text(){self::*[@role="leftsub"]{not(contains(@grammar,"combinatorics"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{left-sub{default{[t] "indice gauche"; [m] children/*{self::punctuated{@role="leftsub"{not(contains(@grammar,"combinatorics"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{right-super{default{[t] "exposant droite"; [n] text(){self::*[@role="rightsuper"]{not(contains(@grammar,"combinatorics"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{right-super{default{[t] "exposant droite"; [m] children/*{self::punctuated{@role="rightsuper"{not(contains(@grammar,"combinatorics"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{right-sub{default{[t] "indice droite"; [n] text(){self::*[@role="rightsub"]{not(contains(@grammar,"combinatorics"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{right-sub{default{[t] "indice droite"; [m] children/*{self::punctuated{@role="rightsub"{not(contains(@grammar,"combinatorics"))'.split(
|
|
"{",
|
|
),
|
|
'Rule;empty-index;default;[p] (pause:medium);self::empty;@role="rightsub" or @role="rightsuper" or @role="leftsub" or @role="leftsuper"'.split(
|
|
";",
|
|
),
|
|
'Rule,combinatorics,default,[n] children/*[2] (grammar:combinatorics); [n] children/*[1]; [n] children/*[4] (grammar:combinatorics),self::tensor,name(children/*[3])="empty",name(children/*[5])="empty",children/*[1][text()="P" or text()="C"]'.split(
|
|
",",
|
|
),
|
|
'Rule,choose,CombinationPermutation_ChoosePermute,[t] "combinaison de"; [n] children/*[3] (grammar:combinatorics); [t] "parmi"; [n] children/*[4] (grammar:combinatorics),self::tensor,name(children/*[3])="empty",name(children/*[5])="empty",children/*[1][text()="C"]'.split(
|
|
",",
|
|
),
|
|
'Rule,permute,CombinationPermutation_ChoosePermute,[t] "permutation de"; [n] children/*[2] (grammar:combinatorics); [t] "parmi"; [n] children/*[4] (grammar:combinatorics),self::tensor,name(children/*[3])="empty",name(children/*[5])="empty",children/*[1][text()="P"]'.split(
|
|
",",
|
|
),
|
|
],
|
|
};
|
|
sre.Grammar.getInstance().setPreprocessor(
|
|
"numbers2alpha",
|
|
sre.ClearspeakUtil.numbersToAlpha,
|
|
);
|
|
sre.ClearspeakGerman = {
|
|
locale: "de",
|
|
domain: "clearspeak",
|
|
functions: [
|
|
["CTXF", "CTXFpauseSeparator", sre.StoreUtil.pauseSeparator],
|
|
["CTXF", "CTXFnodeCounter", sre.ClearspeakUtil.nodeCounter],
|
|
["CTXF", "CTXFcontentIterator", sre.StoreUtil.contentIterator],
|
|
["CSF", "CSFvulgarFraction", sre.NumbersUtil.vulgarFraction],
|
|
["CQF", "CQFvulgarFractionSmall", sre.ClearspeakUtil.isSmallVulgarFraction],
|
|
["CQF", "CQFcellsSimple", sre.ClearspeakUtil.allCellsSimple],
|
|
["CSF", "CSFwordOrdinal", sre.ClearspeakUtil.wordOrdinal],
|
|
["CQF", "CQFisCapital", sre.ClearspeakUtil.isCapitalLetter],
|
|
["CQF", "CQFmatchingFences", sre.ClearspeakUtil.matchingFences],
|
|
["CSF", "CSFnestingDepth", sre.ClearspeakUtil.nestingDepth],
|
|
["CQF", "CQFfencedArguments", sre.ClearspeakUtil.fencedArguments],
|
|
["CQF", "CQFsimpleArguments", sre.ClearspeakUtil.simpleArguments],
|
|
["CQF", "CQFisHyperbolic", sre.ClearspeakUtil.isHyperbolic],
|
|
["CQF", "CQFisLogarithm", sre.ClearspeakUtil.isLogarithmWithBase],
|
|
["CQF", "CQFspaceoutNumber", sre.MathspeakUtil.spaceoutNumber],
|
|
],
|
|
rules: [
|
|
'Rule{collapsed{default{[t] "kollapiert"; [n] . (engine:modality=summary,grammar:collapsed){self::*{@alternative{not(contains(@grammar, "collapsed")){self::*{self::*{self::*{self::*{self::*'.split(
|
|
"{",
|
|
),
|
|
["Rule", "stree", "default", "[n] ./*[1]", "self::stree"],
|
|
["Rule", "unknown", "default", "[n] text()", "self::unknown"],
|
|
'Rule;protected;default;[t] text();self::number;contains(@grammar, "protected")'.split(
|
|
";",
|
|
),
|
|
["Rule", "omit-empty", "default", '[p] (pause:"short")', "self::empty"],
|
|
'Rule{font{default{[t] @font (grammar:localFont); [n] self::* (grammar:ignoreFont=@font,pause:"short"){self::*{name(self::*)!="number"{@font{not(contains(@grammar, "ignoreFont")){@font!="normal"'.split(
|
|
"{",
|
|
),
|
|
["SpecializedRule", "font", "default", "Caps_SayCaps"],
|
|
'Rule{font-number{default{[t] @font (grammar:localFontNumber); [n] . (grammar:ignoreFont=@font){self::number{@font{not(contains(@grammar, "ignoreFont")){@font!="normal"'.split(
|
|
"{",
|
|
),
|
|
'Rule{font-identifier{default{[t] @font (grammar:localFont); [n] self::* (grammar:ignoreFont=@font,pause:"short"){self::identifier{string-length(text())=1 or string-length(text())=2{@font{@font="normal"{not(contains(@grammar, "ignoreFont")){@role!="unit"'.split(
|
|
"{",
|
|
),
|
|
["SpecializedRule", "font-identifier", "default", "Caps_SayCaps"],
|
|
'Rule;omit-font;default;[n] self::* (grammar:ignoreFont=@font);self::identifier;string-length(text())=1 or string-length(text())=2;@font;not(contains(@grammar, "ignoreFont"));@font="italic";self::*'.split(
|
|
";",
|
|
),
|
|
["SpecializedRule", "omit-font", "default", "Caps_SayCaps"],
|
|
'Rule{font-double-struck{default{[n] . (grammar:ignoreFont=@font); [t] @font (grammar:localFont){self::*{name(self::*)!="number"{string-length(text())=1 or string-length(text())=2{@font{not(contains(@grammar, "ignoreFont")){@font="double-struck"'.split(
|
|
"{",
|
|
),
|
|
["SpecializedRule", "font-double-struck", "default", "Caps_SayCaps"],
|
|
'Rule{font-number-double-struck{default{[n] . (grammar:ignoreFont=@font); [t] @font (grammar:localFontNumber){self::number{string-length(text())=1 or string-length(text())=2{@font{not(contains(@grammar, "ignoreFont")){@font="double-struck"'.split(
|
|
"{",
|
|
),
|
|
["Rule", "text", "default", "[n] text()", "self::text"],
|
|
'Rule;capital;default;[n] text() (pitch:0.6,grammar:ignoreCaps="gro\u00dfes");self::identifier;@role="latinletter" or @role="greekletter" or @role="simple function";CQFisCapital'.split(
|
|
";",
|
|
),
|
|
'Rule;capital;Caps_SayCaps;[n] text();self::identifier;@role="latinletter" or @role="greekletter";CQFisCapital'.split(
|
|
";",
|
|
),
|
|
'Rule{capital{Caps_SayCaps{[p] (pause:"short"); [n] text(){self::identifier{@role="latinletter" or @role="greekletter"{CQFisCapital{preceding-sibling::*[1]{not(name(preceding-sibling::*[1])="function"){not(contains(@grammar, "angle"))'.split(
|
|
"{",
|
|
),
|
|
'Rule;capital;Caps_SayCaps;[n] text() (pause:"short");self::identifier;@role="latinletter" or @role="greekletter";CQFisCapital;following-sibling::*[1]'.split(
|
|
";",
|
|
),
|
|
'Rule{capital{Caps_SayCaps{[p] (pause:"short"); [n] text() (pause:"short"){self::identifier{@role="latinletter" or @role="greekletter"{CQFisCapital{preceding-sibling::*[1]{following-sibling::*[1]{not(name(preceding-sibling::*[1])="function"){not(contains(@grammar, "angle"))'.split(
|
|
"{",
|
|
),
|
|
'Rule,punctuation-lr,default,[p] (pause:"short"); [n] text() (pause:"short"),self::punctuation,@role="comma"'.split(
|
|
",",
|
|
),
|
|
'Rule;punctuation;default;[n] text();self::punctuation;@role="comma";not(preceding-sibling::*[1]/children);not(following-sibling::*[1]/children)'.split(
|
|
";",
|
|
),
|
|
'Rule,punctuation-l,default,[p] (pause:"short"); [n] text(),self::punctuation,@role="comma",not(following-sibling::*[1]/children)'.split(
|
|
",",
|
|
),
|
|
'Rule;punctuation-r;default;[n] text() (pause:"short");self::punctuation;@role="comma";not(preceding-sibling::*[1]/children)'.split(
|
|
";",
|
|
),
|
|
'Rule;ellipsis;Ellipses_AndSoOn;[t] "und so weiter";self::punctuation;@role="ellipsis";not(following-sibling::*[1]);not(preceding-sibling::*[last()][@role="ellipsis"])'.split(
|
|
";",
|
|
),
|
|
'Rule;ellipsis;Ellipses_AndSoOn;[t] "und so weiter bis";self::punctuation;@role="ellipsis";preceding-sibling::*[1];following-sibling::*[1]'.split(
|
|
";",
|
|
),
|
|
'Rule,vbar-evaluated,default,[n] children/*[1]; [p] (pause:"short"); [t] "ausgewertet f\u00fcr"; [n] content/*[1]/children/*[2]; [p] (pause:"short"),self::punctuated,@role="endpunct",content/*[1][@role="vbar"],content/*[1][@embellished],name(content/*[1])="subscript"'.split(
|
|
",",
|
|
),
|
|
'Rule,vbar-evaluated,default,[n] children/*[1]; [p] (pause:"short"); [t] "ausgewertet f\u00fcr"; [n] content/*[1]/children/*[2]; [p] (pause:"short"); [t] "minus des gleichen Ausdrucks ausgewertet f\u00fcr"; [n] content/*[1]/children/*[1]/children/*[2]; [p] (pause:"short"),self::punctuated,@role="endpunct",content/*[1][@role="vbar"],content/*[1][@embellished],name(content/*[1])="superscript",name(content/*[1]/children/*[1])="subscript"'.split(
|
|
",",
|
|
),
|
|
'Rule;vbar-such-that;VerticalLine_SuchThat;[t] "so dass";self::punctuation;@role="vbar";not(parent::*/parent::*[@embellished="punctuation"])'.split(
|
|
";",
|
|
),
|
|
'Rule;vbar-such-that;VerticalLine_Divides;[t] "teilt";self::punctuation;@role="vbar";not(parent::*/parent::*[@embellished="punctuation"])'.split(
|
|
";",
|
|
),
|
|
'Rule;vbar-such-that;VerticalLine_Given;[t] "f\u00fcr die gilt";self::punctuation;@role="vbar";not(parent::*/parent::*[@embellished="punctuation"])'.split(
|
|
";",
|
|
),
|
|
'Rule;set-member;default;[t] "in";self::operator;@role="set extended";text()="\u2208" or text()="\u220a"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"set-member",
|
|
"default",
|
|
"SetMemberSymbol_Element",
|
|
'[t] "Element von"',
|
|
],
|
|
[
|
|
"SpecializedRule",
|
|
"set-member",
|
|
"default",
|
|
"SetMemberSymbol_Belongs",
|
|
'[t] "geh\u00f6rt zu"',
|
|
],
|
|
'Rule;set-not-member;default;[t] "nicht in";self::operator;@role="set extended";text()="\u2209"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"set-not-member",
|
|
"default",
|
|
"SetMemberSymbol_Element",
|
|
'[t] "kein Element von"',
|
|
],
|
|
[
|
|
"SpecializedRule",
|
|
"set-not-member",
|
|
"default",
|
|
"SetMemberSymbol_Belongs",
|
|
'[t] "geh\u00f6rt nicht zu"',
|
|
],
|
|
'Rule,prime,default,[n] children/*[1]; [n] children/*[2],self::superscript,children/*[2],children/*[2][@role="prime"],self::*'.split(
|
|
",",
|
|
),
|
|
'Rule,feet,default,[n] children/*[1]; [t] "Fu\u00df",self::superscript,children/*[2][@role="prime"],name(children/*[1])="number",children/*[2][text()="\u2032"],not(preceding-sibling::*[@role="degree"])'.split(
|
|
",",
|
|
),
|
|
'Rule,inches,default,[n] children/*[1]; [t] "Zoll",self::superscript,children/*[2][@role="prime"],name(children/*[1])="number",children/*[2][text()="\u2033"],not(preceding-sibling::*[@role="degree"])'.split(
|
|
",",
|
|
),
|
|
'Rule,minutes,default,[p] (pause:short); [n] children/*[1]; [t] "Minuten",self::superscript,children/*[2][@role="prime"],preceding-sibling::*[@role="degree"],children/*[2][text()="\u2032"]'.split(
|
|
",",
|
|
),
|
|
'Rule,minute,default,[p] (pause:short); [n] children/*[1]; [t] "Minute",self::superscript,children/*[2][@role="prime"],preceding-sibling::*[@role="degree"],children/*[2][text()="\u2032"],children/*[1][text()="1"]'.split(
|
|
",",
|
|
),
|
|
'Rule,seconds,default,[p] (pause:short); [n] children/*[1]; [t] "Sekunden",self::superscript,children/*[2][@role="prime"],preceding-sibling::*[@role="degree"],children/*[2][text()="\u2033"]'.split(
|
|
",",
|
|
),
|
|
'Rule,second,default,[p] (pause:short); [n] children/*[1]; [t] "Sekunde",self::superscript,children/*[2][@role="prime"],preceding-sibling::*[@role="degree"],children/*[2][text()="\u2033"],children/*[1][text()="1"]'.split(
|
|
",",
|
|
),
|
|
'Rule,degrees-angle,Prime_Angle,[n] children/*[1]; [t] "Grad"; [p] (pause:short),self::punctuation,@role="degree"'.split(
|
|
",",
|
|
),
|
|
'Rule{minutes-angle{Prime_Angle{[n] children/*[1]; [t] "Minuten"; [p] (pause:short){self::superscript{children/*[2][@role="prime"]{name(children/*[1])="number" or (children/*[1][@role="latinletter"] and ""=translate(children/*[1]/text(),"abcdefghijklmnopqrstuvwxyz", "")){children/*[2][text()="\u2032"]'.split(
|
|
"{",
|
|
),
|
|
'Rule,minute-angle,Prime_Angle,[n] children/*[1]; [t] "Minute"; [p] (pause:short),self::superscript,children/*[2][@role="prime"],children/*[2][text()="\u2032"],children/*[1][text()="1"]'.split(
|
|
",",
|
|
),
|
|
'Rule{seconds-angle{Prime_Angle{[n] children/*[1]; [t] "Sekunden"; [p] (pause:short){self::superscript{children/*[2][@role="prime"]{name(children/*[1])="number" or (children/*[1][@role="latinletter"] and ""=translate(children/*[1]/text(),"abcdefghijklmnopqrstuvwxyz", "")){children/*[2][text()="\u2033"]'.split(
|
|
"{",
|
|
),
|
|
'Rule,second-angle,Prime_Angle,[n] children/*[1]; [t] "Sekunde"; [p] (pause:short),self::superscript,children/*[2][@role="prime"],children/*[2][text()="\u2033"],children/*[1][text()="1"]'.split(
|
|
",",
|
|
),
|
|
'Rule{feet-length{Prime_Length{[n] children/*[1]; [t] "Fu\u00df"; [p] (pause:short){self::superscript{children/*[2][@role="prime"]{name(children/*[1])="number" or (children/*[1][@role="latinletter"] and ""=translate(children/*[1]/text(),"abcdefghijklmnopqrstuvwxyz", "")){children/*[2][text()="\u2032"]'.split(
|
|
"{",
|
|
),
|
|
'Rule{inches-length{Prime_Length{[n] children/*[1]; [t] "Zoll"; [p] (pause:short){self::superscript{children/*[2][@role="prime"]{name(children/*[1])="number" or (children/*[1][@role="latinletter"] and ""=translate(children/*[1]/text(),"abcdefghijklmnopqrstuvwxyz", "")){children/*[2][text()="\u2033"]'.split(
|
|
"{",
|
|
),
|
|
["Rule", "punctuated", "default", "[m] children/*", "self::punctuated"],
|
|
["Rule", "function", "default", "[n] text()", "self::function"],
|
|
'Rule{function-article{default{[t] "der" (grammar:article); [n] text(){self::function{@role="prefix function"{contains(@grammar, "addArticle")'.split(
|
|
"{",
|
|
),
|
|
'Rule{function-article-fem{default{[t] "die" (grammar:article); [n] text(){self::function{@role="prefix function"{contains(@grammar, "addArticle"){text()="det" or text()="dim" or text()="tr"'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"appl",
|
|
"default",
|
|
'[n] children/*[1]; [t] "von"; [n] children/*[2] (grammar:case="dative"); [p] (pause:"short")',
|
|
"self::appl",
|
|
],
|
|
'Rule,appl-simple,default,[n] children/*[1]; [t] "von"; [p] (pause:"short"); [n] children/*[2] (grammar:case="dative"); [p] (pause:"short"),self::appl,@role="simple function",name(children/*[2])="appl"'.split(
|
|
",",
|
|
),
|
|
'Rule,appl-simple,default,[n] children/*[1]; [t] "von"; [p] (pause:"short"); [n] children/*[2] (grammar:case="dative"); [p] (pause:"short"),self::appl,@role="simple function",name(children/*[2])="fenced",name(children/*[2]/children/*[1])="appl"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"appl",
|
|
"Functions_None",
|
|
'[p] (pause:"short"); [n] children/*[1]; [t] "mal"; [n] children/*[2]; [p] (pause:"short")',
|
|
"self::appl",
|
|
],
|
|
'Rule,function-prefix,default,[n] children/*[1]; [n] children/*[2],self::appl,@role="prefix function"'.split(
|
|
",",
|
|
),
|
|
'Rule{binary-operation{ImpliedTimes_MoreImpliedTimes{[n] . (grammar:impliedTimes); [p] (pause:"short"){self::appl{@role="prefix function"{parent::*/parent::infixop[@role="implicit"]{following-sibling::*{not(contains(@grammar, "impliedTimes"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{function-prefix-simple-arg{default{[n] children/*[1]; [n] children/*[2]{self::appl{@role="prefix function"{name(children/*[2])="fenced"{contains(children/*[2]/children/*[1]/@annotation, "clearspeak:simple"){name(children/*[2]/children/*[1])!="number"{name(children/*[2]/children/*[1])!="identifier"{name(children/*[2]/children/*[1])!="appl"'.split(
|
|
"{",
|
|
),
|
|
'Rule,function-prefix-embell,default,[p] (pause:"short"); [n] children/*[1]; [n] children/*[2]; [p] (pause:"short"); ,self::appl,@role="prefix function",name(children/*[1])!="function"'.split(
|
|
",",
|
|
),
|
|
'Rule{function-prefix-fenced-or-frac-arg{default{[p] (pause:"short"); [n] children/*[1] (grammar:addArticle); [t] "von"; [n] children/*[2] (grammar:case="dative"); [p] (pause:"short"){self::appl{@role="prefix function"{(name(children/*[2])="fenced" and not(contains(children/*[2]/children/*[1]/@annotation, "clearspeak:simple"))) or name(children/*[2])="fraction" or (name(children/*[2])!="fenced" and not(contains(children/*[2]/@annotation, "clearspeak:simple"))){self::*'.split(
|
|
"{",
|
|
),
|
|
'Rule,function-prefix-subscript,default,[p] (pause:"short"); [n] children/*[1] (grammar:addArticle); [t] "von"; [p] (pause:"short"); [n] children/*[2] (grammar:case="dative"); [p] (pause:"short"),self::appl,@role="prefix function",name(children/*[1])="subscript",self::*'.split(
|
|
",",
|
|
),
|
|
'Rule{function-ln{default{[n] children/*[1]; [n] children/*[2]{self::appl{@role="prefix function"{content/*[2][text()="ln"]{not(following-sibling::*){not(contains(@grammar, "NatLog"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{function-ln{default{[n] children/*[1]; [n] children/*[2]; [p] (pause:"short"){self::appl{@role="prefix function"{content/*[2][text()="ln"]{not(contains(@grammar, "NatLog"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{function-ln{default{[n] children/*[1]; [t] "von"; [n] children/*[2] (grammar:case="dative"); [p] (pause:"short"){self::appl{@role="prefix function"{content/*[2][text()="ln"]{name(children/*[2])="fenced"{not(contains(@grammar, "NatLog"))'.split(
|
|
"{",
|
|
),
|
|
'Rule;function-ln;Log_LnAsNaturalLog;[n] . (grammar:NatLog);self::appl;@role="prefix function";content/*[2][text()="ln"];not(following-sibling::*);not(contains(@grammar, "NatLog"))'.split(
|
|
";",
|
|
),
|
|
'Rule{function-ln{Log_LnAsNaturalLog{[n] . (grammar:NatLog); [p] (pause:"short"){self::appl{@role="prefix function"{content/*[2][text()="ln"]{not(contains(@grammar, "NatLog"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{function-prefix-as-exp{default{[n] children/*[1]; [t] "von"; [p] (pause:"short"); [n] children/*[2] (grammar:case="dative"); [p] (pause:"short"){self::appl{@role="prefix function"{name(parent::*/parent::*)="superscript"{not(following-sibling::*){(name(children/*[2])="fenced" and not(contains(children/*[2]/children/*[1]/@annotation, "clearspeak:simple"))) or name(children/*[2])="fraction" or (name(children/*[2])!="fenced" and not(contains(children/*[2]/@annotation, "clearspeak:simple")))'.split(
|
|
"{",
|
|
),
|
|
'Rule,function-prefix-subscript-as-exp,default,[n] children/*[1]; [t] "von"; [p] (pause:"short"); [n] children/*[2] (grammar:case="dative"); [p] (pause:"short"),self::appl,@role="prefix function",name(parent::*/parent::*)="superscript",not(following-sibling::*),name(children/*[1])="subscript"'.split(
|
|
",",
|
|
),
|
|
'Rule,function-prefix-hyper,default,[p] (pause:"short"); [n] children/*[1]; [t] "von"; [n] children/*[2] (grammar:case="dative"); [p] (pause:"short"),self::appl,@role="prefix function",CQFisHyperbolic'.split(
|
|
",",
|
|
),
|
|
'Rule{function-prefix-inverse{default{[p] (pause:"short"); [t] "der" (grammar:article); [t] "inverse" (grammar:masculine); [n] children/*[1]/children/*[1]; [t] "von"; [n] children/*[2] (grammar:case="dative"); [p] (pause:"short"){self::appl{@role="prefix function"{name(children/*[1])="superscript"{name(children/*[1]/children/*[2])="prefixop"{children/*[1]/children/*[2][@role="negative"]{children/*[1]/children/*[2]/children/*[1][text()="1"]{not(contains(@grammar, "functions_none"))'.split(
|
|
"{",
|
|
),
|
|
'Rule,appl-triginverse,Trig_TrigInverse,[p] (pause:"short"); [n] children/*[1]; [t] "von"; [n] children/*[2] (grammar:case="dative"); [p] (pause:"short"),self::appl,@role="prefix function",name(children/*[1])="superscript",name(children/*[1]/children/*[2])="prefixop",children/*[1]/children/*[2][@role="negative"],children/*[1]/children/*[2]/children/*[1][text()="1"]'.split(
|
|
",",
|
|
),
|
|
'Rule{function-prefix-arc-simple{Trig_ArcTrig{[p] (pause:"short"); [t] "Arkus" (join:""); [n] children/*[1]/children/*[1] (grammar:lowercase); [n] children/*[2]; [p] (pause:"short"){self::appl{@role="prefix function"{name(children/*[1])="superscript"{name(children/*[1]/children/*[2])="prefixop"{children/*[1]/children/*[2][@role="negative"]{children/*[1]/children/*[2]/children/*[1][text()="1"]{not(contains(@grammar, "functions_none"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{function-prefix-arc-simple{Trig_ArcTrig{[p] (pause:"short"); [t] "Arkus" (join:""); [n] children/*[1]/children/*[1] (grammar:lowercase); [p] (pause:"short"); [n] children/*[2]; [p] (pause:"short"){self::appl{@role="prefix function"{name(children/*[1])="superscript"{name(children/*[1]/children/*[2])="prefixop"{children/*[1]/children/*[2][@role="negative"]{children/*[1]/children/*[2]/children/*[1][text()="1"]{name(children/*[2])="fenced"{children/*[2]/children/*[1][@role="prefix function"]{contains(children/*[2]/children/*[1]/@annotation, "clearspeak:simple"){not(contains(@grammar, "functions_none"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{function-prefix-arc{Trig_ArcTrig{[p] (pause:"short"); [t] "Arkus" (join:""); [n] children/*[1]/children/*[1] (grammar:lowercase); [t] "von"; [n] children/*[2] (grammar:case="dative"); [p] (pause:"short"){self::appl{@role="prefix function"{name(children/*[1])="superscript"{name(children/*[1]/children/*[2])="prefixop"{children/*[1]/children/*[2][@role="negative"]{children/*[1]/children/*[2]/children/*[1][text()="1"]{not(contains(@grammar, "functions_none")){(name(children/*[2])="fenced" and not(contains(children/*[2]/children/*[1]/@annotation, "clearspeak:simple"))) or (name(children/*[2])="fraction" and children/*[2][@role!="vulgar"])'.split(
|
|
"{",
|
|
),
|
|
'Rule{function-inverse{default{[n] children/*[1]; [t] "invers"{self::superscript{@role="prefix function" or @role="simple function"{name(children/*[2])="prefixop"{children/*[2][@role="negative"]{children/*[2]/children/*[1][text()="1"]{not(contains(@grammar, "functions_none"))'.split(
|
|
"{",
|
|
),
|
|
'Rule,superscript-prefix-function,default,[t] "die" (grammar:article); [n] children/*[2] (grammar:ordinal); [t] "Potenz von"; [n] children/*[1],self::superscript,@role="prefix function",name(children/*[2])="number",children/*[2][@role="integer"]'.split(
|
|
",",
|
|
),
|
|
'Rule,superscript-prefix-function,default,[t] "die" (grammar:article); [n] children/*[2] (grammar:ordinal); [t] "Potenz von"; [n] children/*[1],self::superscript,@role="prefix function",name(children/*[2])="identifier"'.split(
|
|
",",
|
|
),
|
|
'Rule;function-inverse;Functions_None;[n] . (grammar:functions_none);self::superscript;@role="prefix function" or @role="simple function";name(children/*[2])="prefixop";children/*[2][@role="negative"];children/*[2]/children/*[1][text()="1"];not(contains(@grammar, "functions_none"))'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"superscript",
|
|
"default",
|
|
'[n] children/*[1]; [t] "mit Exponent" (pause:"short"); [n] children/*[2]; [p] (pause:"short"); [t] "Ende Exponent" (pause:"short")',
|
|
"self::superscript",
|
|
],
|
|
'Rule,superscript-ordinal,default,[n] children/*[1]; [t] "hoch"; [n] children/*[2]; [p] (pause:"short"),self::superscript,name(children/*[2])="number",children/*[2][@role="integer"]'.split(
|
|
",",
|
|
),
|
|
'Rule,superscript-ordinal,default,[n] children/*[1]; [t] "hoch"; [n] children/*[2]; [p] (pause:"short"),self::superscript,name(children/*[2])="prefixop",children/*[2][@role="negative"],name(children/*[2]/children/*[1])="number",children/*[2]/children/*[1][@role="integer"]'.split(
|
|
",",
|
|
),
|
|
'Rule,superscript-ordinal,default,[n] children/*[1]; [t] "hoch"; [n] children/*[2]; [p] (pause:"short"),self::superscript,name(children/*[2])="identifier",children/*[2][@role="latinletter" or @role="greekletter" or @role="otherletter"]'.split(
|
|
",",
|
|
),
|
|
'Rule,superscript-ordinal-default,default,[n] children/*[1]; [t] "mit Exponent" (pause:"short"); [n] children/*[2]; [p] (pause:"short"); [t] "Ende Exponent" (pause:"short"),self::superscript,children//superscript'.split(
|
|
",",
|
|
),
|
|
'Rule,superscript-simple-exponent,default,[n] children/*[1]; [t] "hoch"; [n] children/*[2]; [p] (pause:"short"),self::superscript,not(descendant::superscript)'.split(
|
|
",",
|
|
),
|
|
'Rule,superscript-simple-exponent-end,default,[n] children/*[1]; [t] "hoch"; [n] children/*[2]; ,self::superscript,not(descendant::superscript),not(following-sibling::*)'.split(
|
|
",",
|
|
),
|
|
'Aliases;superscript-simple-exponent;self::superscript;children/superscript/children/*[2][text()="2"] or children/superscript/children/*[2][text()="3"];name(children/superscript/children/*[1])="number";contains(children/superscript/children/*[1]/@annotation, "clearspeak:simple")'.split(
|
|
";",
|
|
),
|
|
'Aliases;superscript-simple-exponent;self::superscript;children/superscript/children/*[2][text()="2"] or children/superscript/children/*[2][text()="3"];name(children/superscript/children/*[1])="fraction";contains(children/superscript/children/*[1]/@annotation, "clearspeak:simple")'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"superscript-simple-exponent",
|
|
"self::superscript",
|
|
'children/superscript/children/*[2][text()="2"] or children/superscript/children/*[2][text()="3"]',
|
|
'name(children/superscript/children/*[1])="identifier"',
|
|
],
|
|
'Aliases;superscript-simple-exponent;self::superscript;children/*[2][@role="implicit"];count(children/*[2]/children/*)=2;contains(children/*[2]/children/*[1]/@annotation, "simple");name(children/*[2]/children/*[2])="superscript";(name(children/*[2]/children/*[2]/children/*[1])="number" and contains(children/*[2]/children/*[2]/children/*[1]/@annotation, "clearspeak:simple")) or name(children/*[2]/children/*[2]/children/*[1])="identifier";children/*[2]/children/*[2]/children/*[2][text()="2"] or children/*[2]/children/*[2]/children/*[2][text()="3"]'.split(
|
|
";",
|
|
),
|
|
'Rule,superscript-simple-power,Exponent_OrdinalPower,[n] children/*[1]; [t] "potenziert mit"; [n] children/*[2]; [p] (pause:"short"),self::superscript,not(descendant::superscript)'.split(
|
|
",",
|
|
),
|
|
'Rule,superscript-simple-power-end,Exponent_OrdinalPower,[n] children/*[1]; [t] "potenziert mit"; [n] children/*[2]; ,self::superscript,not(descendant::superscript),not(following-sibling::*)'.split(
|
|
",",
|
|
),
|
|
'Aliases;superscript-simple-power;self::superscript;children/superscript/children/*[2][text()="2"] or children/superscript/children/*[2][text()="3"];name(children/superscript/children/*[1])="number";contains(children/superscript/children/*[1]/@annotation, "clearspeak:simple")'.split(
|
|
";",
|
|
),
|
|
'Aliases;superscript-simple-power;self::superscript;children/superscript/children/*[2][text()="2"] or children/superscript/children/*[2][text()="3"];name(children/superscript/children/*[1])="fraction";contains(children/superscript/children/*[1]/@annotation, "clearspeak:simple")'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"superscript-simple-power",
|
|
"self::superscript",
|
|
'children/superscript/children/*[2][text()="2"] or children/superscript/children/*[2][text()="3"]',
|
|
'name(children/superscript/children/*[1])="identifier"',
|
|
],
|
|
'Aliases;superscript-simple-power;self::superscript;children/*[2][@role="implicit"];count(children/*[2]/children/*)=2;contains(children/*[2]/children/*[1]/@annotation, "simple");name(children/*[2]/children/*[2])="superscript";(name(children/*[2]/children/*[2]/children/*[1])="number" and contains(children/*[2]/children/*[2]/children/*[1]/@annotation, "clearspeak:simple")) or name(children/*[2]/children/*[2]/children/*[1])="identifier";children/*[2]/children/*[2]/children/*[2][text()="2"] or children/*[2]/children/*[2]/children/*[2][text()="3"]'.split(
|
|
";",
|
|
),
|
|
'Rule{superscript-ordinal-power{Exponent_OrdinalPower{[n] children/*[1]; [t] "zur"; [n] children/*[2] (grammar:ordinal,join:""); [t] "n Potenz" (pause:"short"){self::superscript{name(children/*[2])="number"{children/*[2][@role="integer"]'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"superscript-ordinal-power",
|
|
"self::superscript",
|
|
'name(children/*[2])="identifier"',
|
|
'children/*[2][@role="latinletter" or @role="greekletter" or @role="otherletter"]',
|
|
],
|
|
'Rule{superscript-non-ordinal{Exponent_OrdinalPower{[n] children/*[1]; [t] "zur negativ"; [n] children/*[2]/children/*[1] (grammar:ordinal, join:""); [t] "n Potenz" (pause:"short"){self::superscript{children/*[2][@role="negative"]{name(children/*[2]/children/*[1])="number"{children/*[2]/children/*[1][@role="integer"]'.split(
|
|
"{",
|
|
),
|
|
'Rule{superscript-simple-function{Exponent_OrdinalPower{[t] "die" (grammar:article); [n] children/*[2] (grammar:ordinal); [t] "Potenz von" (pause:"short"); [n] children/*[1]{self::superscript{name(children/*[1])="identifier"{children/*[1][@role="simple function"]{children/*[2][@role!="prime"]{not(contains(@grammar, "functions_none"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{exponent{default{[n] text() (join:""); [t] "te"{self::identifier{contains(@grammar, "ordinal")'.split(
|
|
"{",
|
|
),
|
|
'Rule;exponent;default;[t] CSFwordOrdinal;self::number;@role="integer";contains(@grammar, "ordinal");text()!="0"'.split(
|
|
";",
|
|
),
|
|
'Rule;exponent;default;[t] "nullte";self::number;@role="integer";contains(@grammar, "ordinal");text()="0"'.split(
|
|
";",
|
|
),
|
|
'Rule,superscript-simple-exp,Exponent_Exponent,[n] children/*[1]; [t] "mit Exponent"; [n] children/*[2]; [p] (pause:"short"),self::superscript,not(descendant::superscript)'.split(
|
|
",",
|
|
),
|
|
'Rule,superscript-simple-exp-end,Exponent_Exponent,[n] children/*[1]; [t] "mit Exponent"; [n] children/*[2]; ,self::superscript,not(descendant::superscript),not(following-sibling::*)'.split(
|
|
",",
|
|
),
|
|
'Aliases;superscript-simple-exp;self::superscript;children/superscript/children/*[2][text()="2"] or children/superscript/children/*[2][text()="3"];name(children/superscript/children/*[1])="number";contains(children/superscript/children/*[1]/@annotation, "clearspeak:simple")'.split(
|
|
";",
|
|
),
|
|
'Aliases;superscript-simple-exp;self::superscript;children/superscript/children/*[2][text()="2"] or children/superscript/children/*[2][text()="3"];name(children/superscript/children/*[1])="fraction";contains(children/superscript/children/*[1]/@annotation, "clearspeak:simple")'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"superscript-simple-exp",
|
|
"self::superscript",
|
|
'children/superscript/children/*[2][text()="2"] or children/superscript/children/*[2][text()="3"]',
|
|
'name(children/superscript/children/*[1])="identifier"',
|
|
],
|
|
'Aliases;superscript-simple-exp;self::superscript;children/*[2][@role="implicit"];count(children/*[2]/children/*)=2;contains(children/*[2]/children/*[1]/@annotation, "simple");name(children/*[2]/children/*[2])="superscript";(name(children/*[2]/children/*[2]/children/*[1])="number" and contains(children/*[2]/children/*[2]/children/*[1]/@annotation, "clearspeak:simple")) or name(children/*[2]/children/*[2]/children/*[1])="identifier";children/*[2]/children/*[2]/children/*[2][text()="2"] or children/*[2]/children/*[2]/children/*[2][text()="3"]'.split(
|
|
";",
|
|
),
|
|
'Rule;superscript-simple-function;Functions_None;[n] . (grammar:functions_none);self::superscript;name(children/*[1])="identifier";children/*[1][@role="simple function"];not(contains(@grammar, "functions_none"))'.split(
|
|
";",
|
|
),
|
|
'Rule,square,default,[n] children/*[1]; [t] "Quadrat",self::superscript,children/*[2][text()="2"],name(children/*[1])!="text" or not(name(children/*[1])="text" and (name(../../../punctuated[@role="text"]/..)="stree" or name(..)="stree")),self::*,self::*'.split(
|
|
",",
|
|
),
|
|
'Rule,cube,default,[n] children/*[1]; [t] "Kubik",self::superscript,children/*[2][text()="3"],name(children/*[1])!="text" or not(name(children/*[1])="text" and (name(../../../punctuated[@role="text"]/..)="stree" or name(..)="stree")),self::*,self::*'.split(
|
|
",",
|
|
),
|
|
'Rule;paren-simple;default;[n] children/*[1];self::fenced;@role="leftright";contains(children/*[1]/@annotation, "clearspeak:simple");name(../..)!="superscript" and name(../..)!="subscript"'.split(
|
|
";",
|
|
),
|
|
'Rule;paren-simple-exp;default;[n] children/*[1];self::fenced;@role="leftright";name(../..)="superscript";children/*[1][@role="integer"] or children/*[1][@role="float"] or (children/*[1][@role="vulgar"] and contains(children/*[1]/@annotation, "clearspeak:simple")) or children/*[1][@role="latinletter"] or children/*[1][@role="greekletter"] or children/*[1][@role="otherletter"]'.split(
|
|
";",
|
|
),
|
|
'Rule;paren-simple-nested-func;default;[n] children/*[1];self::fenced;@role="leftright";name(../*[1])="identifier" or name(../*[1])="function";parent::*/parent::*[@role="simple function" or @role="prefix function"];children/*[1][@role="simple function" or @role="prefix function"];contains(children/*[1]/children/*[2]/children/*[1]/@annotation, "clearspeak:simple") or name(children/*[1]/children/*[2]/children/*[1])="subscript" or name(children/*[1]/children/*[2]/children/*[1])="superscript" or children/*[1]/children/*[2]/children/*[1][@role="vulgar"] '.split(
|
|
";",
|
|
),
|
|
'Rule{paren-simple-nested-func-no-bracket{Functions_None{[n] children/*[1];{self::fenced{@role="leftright"{name(../*[1])="identifier" or name(../*[1])="function"{parent::*/parent::*[@role="simple function" or @role="prefix function"]{children/*[1][@role="simple function" or @role="prefix function"]{name(children/*[1]/children/*[1])="identifier" or name(children/*[1]/children/*[1])="function"{contains(children/*[1]/children/*[2]/children/*[1]/@annotation, "clearspeak:simple"){name(children/*[1]/children/*[2]/children/*[1])="identifier" or name(children/*[1]/children/*[2]/children/*[1])="number"'.split(
|
|
"{",
|
|
),
|
|
'Rule,fences-open-close,default,[p] (pause:"short"); [n] content/*[1] (grammar:spokenFence); [p] (pause:"short"); [n] children/*[1]; [p] (pause:"short"); [n] content/*[2] (grammar:spokenFence); [p] (pause:"short"),self::fenced,@role="leftright"'.split(
|
|
",",
|
|
),
|
|
'Rule{paren-simple-nested-func{default{[p] (pause:"short"); [n] content/*[1]; [p] (pause:"short"); [n] children/*[1]; [p] (pause:"short"); [n] content/*[2]; [p] (pause:"short"){self::fenced{@role="leftright"{name(../*[1])="identifier" or name(../*[1])="function"{parent::*/parent::*[@role="simple function" or @role="prefix function"]{not(contains(children/*[1]/@annotation, "clearspeak:simple"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{paren-simple-nested-func{Functions_None{[p] (pause:"short"); [n] content/*[1] (grammar:spokenFence); [p] (pause:"short"); [n] children/*[1]; [p] (pause:"short"); [n] content/*[2] (grammar:spokenFence); [p] (pause:"short"){self::fenced{@role="leftright"{name(../*[1])="identifier" or name(../*[1])="function"{parent::*/parent::*[@role="simple function" or @role="prefix function"]{children/*[1][@role="simple function" or @role="prefix function"]{contains(children/*[1]/children/*[2]/children/*[1]/@annotation, "clearspeak:simple") or name(children/*[1]/children/*[2]/children/*[1])="subscript" or name(children/*[1]/children/*[2]/children/*[1])="superscript" or children/*[1]/children/*[2]/children/*[1][@role="vulgar"] '.split(
|
|
"{",
|
|
),
|
|
["SpecializedRule", "fences-open-close", "default", "Paren_Speak"],
|
|
[
|
|
"Aliases",
|
|
"fences-open-close",
|
|
"self::fenced",
|
|
'@role="composed function"',
|
|
],
|
|
[
|
|
"Rule",
|
|
"fence-silent",
|
|
"Paren_Silent",
|
|
'[p] (pause:"short"); [n] children/*[1]; [p] (pause:"short")',
|
|
"self::fenced",
|
|
],
|
|
'Rule,fences-open-close,ImpliedTimes_None,[p] (pause:"short"); [n] content/*[1] (grammar:spokenFence); [p] (pause:"short"); [n] children/*[1]; [p] (pause:"short"); [n] content/*[2] (grammar:spokenFence); [p] (pause:"short"),self::fenced,@role="leftright",parent::*/parent::*[@role!="simple function"],parent::*/parent::*[@role!="prefix function"]'.split(
|
|
",",
|
|
),
|
|
'Rule;fence-nesting;Paren_SpeakNestingLevel;[n] text() (grammar:insertNesting=CSFnestingDepth);self::fence;contains(@grammar, "spokenFence");CQFmatchingFences'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"fence-no-nesting",
|
|
"Paren_SpeakNestingLevel",
|
|
"[n] text()",
|
|
"self::fence",
|
|
],
|
|
'Rule,fences-points,Paren_CoordPoint,[t] "der Punkt mit Koordinaten"; [n] children/*[1],self::fenced,name(children/*[1])="punctuated",children/*[1][@role="sequence"]'.split(
|
|
",",
|
|
),
|
|
'Rule{fences-interval{Paren_Interval{[t] "das Interval von"; [n] children/*[1]/children/*[1]; [t] "bis"; [n] children/*[1]/children/*[3]; [p] (pause:"short"); [n] . (grammar:interval){self::fenced{not(contains(@grammar, "interval")){name(children/*[1])="punctuated"{children/*[1][@role="sequence"]{count(./children/*[1]/content/*)=1{children/*[1]/content/*[1][@role="comma"]'.split(
|
|
"{",
|
|
),
|
|
'Rule{interval-open{Paren_Interval{[t] "ohne"; [n] children/*[1]/children/*[1]; [t] "und"; [n] children/*[1]/children/*[3]{self::fenced{contains(@grammar, "interval"){content/*[1]/text()="("{content/*[2]/text()=")"'.split(
|
|
"{",
|
|
),
|
|
'Rule{interval-closed-open{Paren_Interval{[t] "einschlie\u00dflich"; [n] children/*[1]/children/*[1]; [p] (pause:"short"); [t] "aber ohne"; [n] children/*[1]/children/*[3]{self::fenced{contains(@grammar, "interval"){content/*[1]/text()="["{content/*[2]/text()=")"'.split(
|
|
"{",
|
|
),
|
|
'Rule{interval-open-closed{Paren_Interval{[t] "ohne"; [n] children/*[1]/children/*[1]; [p] (pause:"short"); [t] "aber einschlie\u00dflich"; [n] children/*[1]/children/*[3]{self::fenced{contains(@grammar, "interval"){content/*[1]/text()="("{content/*[2]/text()="]"'.split(
|
|
"{",
|
|
),
|
|
'Rule{interval-closed{Paren_Interval{[t] "einschlie\u00dflich"; [n] children/*[1]/children/*[1]; [t] "und"; [n] children/*[1]/children/*[3]{self::fenced{contains(@grammar, "interval"){content/*[1]/text()="["{content/*[2]/text()="]"'.split(
|
|
"{",
|
|
),
|
|
'Rule{interval-open-inf-r{Paren_Interval{[t] "ohne"; [n] children/*[1]/children/*[1]{self::fenced{contains(@grammar, "interval"){content/*[1]/text()="("{content/*[2]/text()=")"{children/*[1]/children/*[3]/text()="\u221e" or (name(children/*[1]/children/*[3])="prefixop" and children/*[1]/children/*[3]/children/*[1]/text()="\u221e")'.split(
|
|
"{",
|
|
),
|
|
'Rule{interval-open-inf-l{Paren_Interval{[t] "ohne"; [n] children/*[1]/children/*[3]{self::fenced{contains(@grammar, "interval"){content/*[1]/text()="("{content/*[2]/text()=")"{children/*[1]/children/*[1]/text()="\u221e" or (name(children/*[1]/children/*[1])="prefixop" and children/*[1]/children/*[1]/children/*[1]/text()="\u221e")'.split(
|
|
"{",
|
|
),
|
|
'Rule;interval-open-inf-lr;Paren_Interval;;self::fenced;contains(@grammar, "interval");content/*[1]/text()="(";content/*[2]/text()=")";children/*[1]/children/*[3]/text()="\u221e" or (name(children/*[1]/children/*[3])="prefixop" and children/*[1]/children/*[3]/children/*[1]/text()="\u221e");children/*[1]/children/*[1]/text()="\u221e" or (name(children/*[1]/children/*[1])="prefixop" and children/*[1]/children/*[1]/children/*[1]/text()="\u221e")'.split(
|
|
";",
|
|
),
|
|
'Rule{interval-closed-open-inf{Paren_Interval{[t] "einschlie\u00dflich"; [n] children/*[1]/children/*[1]{self::fenced{contains(@grammar, "interval"){content/*[1]/text()="["{content/*[2]/text()=")"{children/*[1]/children/*[3]/text()="\u221e" or (name(children/*[1]/children/*[3])="prefixop" and children/*[1]/children/*[3]/children/*[1]/text()="\u221e")'.split(
|
|
"{",
|
|
),
|
|
'Rule{interval-open-closed-inf{Paren_Interval{[t] "einschlie\u00dflich"; [n] children/*[1]/children/*[3]{self::fenced{contains(@grammar, "interval"){content/*[1]/text()="("{content/*[2]/text()="]"{children/*[1]/children/*[1]/text()="\u221e" or (name(children/*[1]/children/*[1])="prefixop" and children/*[1]/children/*[1]/children/*[1]/text()="\u221e")'.split(
|
|
"{",
|
|
),
|
|
'Rule,paren-nested-embellished-funcs,Functions_None,[p] (pause:"short"); [n] content/*[1]; [p] (pause:"short"); [n] children/*[1]; [p] (pause:"short"); [n] content/*[2]; [p] (pause:"short"),self::fenced,@role="leftright",name(../..)="appl",name(children/*[1]) = "appl",preceding-sibling::*/descendant-or-self::*[@role="subsup"] or children/*[1]/descendant-or-self::*[@role="subsup"]'.split(
|
|
",",
|
|
),
|
|
'Rule;set-empty;default;[t] "die leere Menge";self::fenced;@role="set empty"'.split(
|
|
";",
|
|
),
|
|
'Rule,set-extended,default,[t] "die Menge aller"; [n] children/*[1]/children/*[1]; [t] "mit"; [n] children/*[1]/children/*[3],self::fenced,@role="set extended"'.split(
|
|
",",
|
|
),
|
|
'Rule,set-collection,default,[t] "die Menge"; [n] children/*[1],self::fenced,@role="set collection"'.split(
|
|
",",
|
|
),
|
|
["Aliases", "set-collection", "self::fenced", '@role="set singleton"'],
|
|
'Rule,set-extended,Sets_woAll,[t] "die Menge von"; [n] children/*[1]/children/*[1]; [t] "mit"; [n] children/*[1]/children/*[3],self::fenced,@role="set extended"'.split(
|
|
",",
|
|
),
|
|
'Rule;set-collection;Sets_SilentBracket;[n] children/*[1];self::fenced;@role="set collection"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"subscript",
|
|
"default",
|
|
'[p] (pause:short); [n] children/*[1]; [t] "Index"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::subscript",
|
|
],
|
|
'Rule,subscript-base,default,[n] children/*[1]; [t] "Basis"; [n] children/*[2],self::subscript,CQFisLogarithm'.split(
|
|
",",
|
|
),
|
|
'Rule{subscript-index{default{[n] children/*[1]; [t] "Index"; [n] children/*[2]{self::subscript{contains(@grammar, "simpleDet")'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"default",
|
|
'[p] (pause:short); [t] "Bruch mit Z\u00e4hler"; [n] children/*[1]; [p] (pause:short); [t] "und Nenner"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::fraction",
|
|
],
|
|
'Rule,fraction,Functions_None,[p] (pause:short); [t] "Bruch mit Z\u00e4hler"; [n] children/*[1]; [p] (pause:short); [t] "und Nenner"; [n] children/*[2]; [p] (pause:short),self::fraction,name(children/*[1])="appl" or name(children/*[2])="appl"'.split(
|
|
",",
|
|
),
|
|
'Rule{simple-fraction{default{[p] (pause:short); [n] children/*[1]; [t] "geteilt durch"; [n] children/*[2]; [p] (pause:short){self::fraction{contains(children/*[1]/@annotation, "clearspeak:simple") or contains(children/*[1]/@annotation, "clearspeak:unit"){contains(children/*[2]/@annotation, "clearspeak:simple") or contains(children/*[2]/@annotation, "clearspeak:unit")'.split(
|
|
"{",
|
|
),
|
|
'Rule,simple-vulgar-fraction,default,[p] (pause:short); [n] children/*[1]; [t] "geteilt durch"; [n] children/*[2]; [p] (pause:short),self::fraction,@role="vulgar"'.split(
|
|
",",
|
|
),
|
|
'Rule,simple-text-fraction,default,[p] (pause:short); [n] children/*[1]; [t] "geteilt durch"; [n] children/*[2]; [p] (pause:short),self::fraction,name(children/*[1])="text",name(children/*[2])="text"'.split(
|
|
",",
|
|
),
|
|
'Rule,simple-text-fraction,default,[p] (pause:short); [n] children/*[1]; [t] "geteilt durch"; [n] children/*[2]; [p] (pause:short),self::fraction,name(children/*[1])="infixop",children/*[1][@role="unit"],name(children/*[2])="text"'.split(
|
|
",",
|
|
),
|
|
'Rule;vulgar-fraction;default;[t] CSFvulgarFraction (grammar:correctOne);self::fraction;@role="vulgar";CQFvulgarFractionSmall'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"Fraction_Over",
|
|
'[p] (pause:short); [n] children/*[1]; [t] "geteilt durch"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::fraction",
|
|
],
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"Fraction_OverEndFrac",
|
|
'[p] (pause:short); [n] children/*[1]; [t] "geteilt durch"; [n] children/*[2]; [p] (pause:short); [t] "Ende Bruch"; [p] (pause:short)',
|
|
"self::fraction",
|
|
],
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"Fraction_FracOver",
|
|
'[p] (pause:short); [t] "Bruch"; [n] children/*[1]; [t] "geteilt durch"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::fraction",
|
|
],
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"Fraction_Per",
|
|
'[p] (pause:short); [n] children/*[1]; [t] "per"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::fraction",
|
|
],
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"Fraction_GeneralEndFrac",
|
|
'[p] (pause:short); [t] "Bruch mit Z\u00e4hler"; [n] children/*[1]; [p] (pause:short); [t] "und Nenner"; [n] children/*[2]; [p] (pause:short); [t] "Ende Bruch"; [p] (pause:short)',
|
|
"self::fraction",
|
|
],
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"Fraction_General",
|
|
'[p] (pause:short); [t] "Bruch mit Z\u00e4hler"; [n] children/*[1]; [p] (pause:short); [t] "und Nenner"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::fraction",
|
|
],
|
|
'Rule;simple-vulgar-fraction;Fraction_Ordinal;[t] CSFvulgarFraction (grammar:correctOne);self::fraction;@role="vulgar"'.split(
|
|
";",
|
|
),
|
|
'Rule{fraction{Fraction_EndFrac{[p] (pause:short); [n] . (grammar:endfrac); [t] "Ende Bruch"; [p] (pause:short){self::fraction{not(contains(@grammar, "endfrac")){not(contains(children/*[1]/@annotation, "clearspeak:unit")){not(contains(children/*[2]/@annotation, "clearspeak:unit"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{vulgar-fraction{Fraction_EndFrac{[p] (pause:short); [n] children/*[1]; [t] "geteilt durch"; [n] children/*[2]; [p] (pause:short){self::fraction{name(children/*[1])="fraction"{name(children/*[2])="fraction"{contains(children/*[1]/@annotation, "clearspeak:simple"){contains(children/*[2]/@annotation, "clearspeak:simple")'.split(
|
|
"{",
|
|
),
|
|
'Rule;simple-vulgar-fraction;Fraction_EndFrac;[t] CSFvulgarFraction (grammar:correctOne);self::fraction;@role="vulgar";contains(@annotation, "clearspeak:simple");self::*'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"sqrt",
|
|
"default",
|
|
'[t] "Quadratwurzel aus"; [n] children/*[1] (grammar:EndRoot=false); [p] (pause:short)',
|
|
"self::sqrt",
|
|
],
|
|
'Rule,sqrt-nested,default,[p] (pause: "short"); [t] "Quadratwurzel aus"; [n] children/*[1] (grammar:EndRoot=false); [p] (pause:short),self::sqrt,not(preceding-sibling::*),ancestor::sqrt|ancestor::root'.split(
|
|
",",
|
|
),
|
|
'Rule,negative-sqrt,default,[t] "negative Quadratwurzel aus"; [n] children/*[1]/children/*[1] (grammar:EndRoot=false); [p] (pause:short),self::prefixop,@role="negative",name(children/*[1])="sqrt"'.split(
|
|
",",
|
|
),
|
|
'Rule,negative-sqrt,default,[p] (pause: "short"); [t] "negative Quadratwurzel aus"; [n] children/*[1]/children/*[1] (grammar:EndRoot=false); [p] (pause:short),self::prefixop,@role="negative",name(children/*[1])="sqrt",not(preceding-sibling::*),ancestor::sqrt|ancestor::root'.split(
|
|
",",
|
|
),
|
|
'Rule,sqrt-plus-minus,Roots_PosNegSqRoot,[t] "positive Quadratwurzel aus"; [n] children/*[1] (grammar:EndRoot=false); [p] (pause:short),self::sqrt,parent::stree or not(parent::*/parent::infixop[@role="addition"]) or (parent::*/parent::*[1]/text()!="\u00b1" and parent::*/parent::*/text()!="\u2213")'.split(
|
|
",",
|
|
),
|
|
'Rule,sqrt-nested-plus-minus,Roots_PosNegSqRoot,[p] (pause: "short"); [t] "positive Quadratwurzel aus"; [n] children/*[1] (grammar:EndRoot=false); [p] (pause:short),self::sqrt,not(preceding-sibling::*),ancestor::sqrt|ancestor::root,parent::stree or not(parent::*/parent::infixop[@role="addition"]) or (parent::*/parent::*[1]/text()!="\u00b1" and parent::*/parent::*/text()!="\u2213")'.split(
|
|
",",
|
|
),
|
|
'Rule,sqrt-plus-minus,Roots_PosNegSqRootEnd,[t] "positive Quadratwurzel aus"; [n] children/*[1] (grammar:EndRoot=false); [p] (pause:short),self::sqrt,parent::stree or not(parent::*/parent::infixop[@role="addition"]) or (parent::*/parent::*[1]/text()!="\u00b1" and parent::*/parent::*/text()!="\u2213")'.split(
|
|
",",
|
|
),
|
|
'Rule,sqrt-nested-plus-minus,Roots_PosNegSqRootEnd,[p] (pause: "short"); [t] "positive Quadratwurzel aus"; [n] children/*[1] (grammar:EndRoot=false); [p] (pause:short),self::sqrt,not(preceding-sibling::*),ancestor::sqrt|ancestor::root,parent::stree or not(parent::*/parent::infixop[@role="addition"]) or (parent::*/parent::*[1]/text()!="\u00b1" and parent::*/parent::*/text()!="\u2213")'.split(
|
|
",",
|
|
),
|
|
'Rule{sqrt-endroot{Roots_RootEnd{[n] . (grammar:EndRoot); [t] "Wurzel Ende"; [p] (pause:short){self::sqrt{not(contains(@grammar, "EndRoot"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{negative-sqrt-endroot{Roots_RootEnd{[n] . (grammar:EndRoot); [t] "Wurzel Ende"; [p] (pause:short){self::prefixop{@role="negative"{name(children/*[1])="sqrt"{not(contains(@grammar, "EndRoot"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{sqrt-endroot{Roots_PosNegSqRootEnd{[n] . (grammar:EndRoot); [t] "Wurzel Ende"; [p] (pause:short){self::sqrt{not(contains(@grammar, "EndRoot"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{negative-sqrt-endroot{Roots_PosNegSqRootEnd{[n] . (grammar:EndRoot); [t] "Wurzel Ende"; [p] (pause:short){self::prefixop{@role="negative"{name(children/*[1])="sqrt"{not(contains(@grammar, "EndRoot"))'.split(
|
|
"{",
|
|
),
|
|
'Rule,cube,default,[t] "Kubikwurzel aus"; [n] children/*[2] (grammar:EndRoot=false); [p] (pause:short),self::root,children/*[1][text()="3"]'.split(
|
|
",",
|
|
),
|
|
'Rule,cube-nested,default,[p] (pause:short); [t] "Kubikwurzel aus"; [n] children/*[2] (grammar:EndRoot=false); [p] (pause:short),self::root,children/*[1][text()="3"],not(preceding-sibling::*),ancestor::sqrt|ancestor::root'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"root",
|
|
"default",
|
|
'[t] "die" (grammar:article); [n] children/*[1] (grammar:ordinal); [t] "Wurzel aus"; [n] children/*[2] (grammar:EndRoot=false); [p] (pause:short)',
|
|
"self::root",
|
|
],
|
|
'Rule,root-nested,default,[p] (pause:short); [t] "die" (grammar:article); [n] children/*[1] (grammar:ordinal); [t] "Wurzel aus"; [n] children/*[2] (grammar:EndRoot=false); [p] (pause:short),self::root,not(preceding-sibling::*),ancestor::sqrt|ancestor::root'.split(
|
|
",",
|
|
),
|
|
'Rule{root-endroot{Roots_RootEnd{[n] . (grammar:EndRoot); [t] "Wurzel Ende"; [p] (pause:short){self::root{not(contains(@grammar, "EndRoot"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{root-endroot{Roots_PosNegSqRootEnd{[n] . (grammar:EndRoot); [t] "Wurzel Ende"; [p] (pause:short){self::root{not(contains(@grammar, "EndRoot"))'.split(
|
|
"{",
|
|
),
|
|
'Rule,negative,default,[t] "minus"; [n] children/*[1],self::prefixop,@role="negative"'.split(
|
|
",",
|
|
),
|
|
'Rule,positive,default,[t] "plus"; [n] children/*[1],self::prefixop,@role="positive"'.split(
|
|
",",
|
|
),
|
|
'Rule,angle-measure,default,[t] "das Ma\u00df des Winkels"; [n] children/*[2] (grammar:angle),self::infixop,content/*[1]/text()="\u2220",children/*[1][text()="m"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"prefix",
|
|
"default",
|
|
"[m] content/* (grammar:prefix); [n] children/*[1]",
|
|
"self::prefixop",
|
|
],
|
|
[
|
|
"Rule",
|
|
"postfix",
|
|
"default",
|
|
"[n] children/*[1]; [m] content/* (grammar:postfix)",
|
|
"self::postfixop",
|
|
],
|
|
'Rule{set-prefix-operators{default{[t] "der" (grammar:article); [n] self::* (grammar:!prefix); [t] "von"{self::*{contains(@grammar,"prefix"){descendant-or-self::*/text()="\u2229"{self::*{self::*{self::*'.split(
|
|
"{",
|
|
),
|
|
'Rule{set-prefix-operators{default{[t] "die" (grammar:article); [n] self::* (grammar:!prefix); [t] "von"{self::*{contains(@grammar,"prefix"){descendant-or-self::*/text()="\u222a"{self::*{self::*{self::*'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"binary-operation",
|
|
"default",
|
|
"[m] children/* (sepFunc:CTXFcontentIterator);",
|
|
"self::infixop",
|
|
],
|
|
'Rule,binary-operation,ImpliedTimes_MoreImpliedTimes,[m] children/* (sepFunc:CTXFcontentIterator);,self::infixop,@role="implicit"'.split(
|
|
",",
|
|
),
|
|
'Rule,binary-operation-pause,default,[p] (pause:short); [m] children/* (sepFunc:CTXFcontentIterator);,self::infixop,@role="implicit",name(children/*[1])="appl"'.split(
|
|
",",
|
|
),
|
|
'Rule,binary-operation-pause,default,[m] children/* (sepFunc:CTXFcontentIterator); [p] (pause:short),self::infixop,@role="implicit",name(children/*[last()])="appl"'.split(
|
|
",",
|
|
),
|
|
'Rule,binary-operation-pause,default,[p] (pause:short); [m] children/* (sepFunc:CTXFcontentIterator); [p] (pause:short),self::infixop,@role="implicit",name(children/*[1])="appl",name(children/*[last()])="appl"'.split(
|
|
",",
|
|
),
|
|
'Rule;implicit-times;default;[p] (pause:short);self::operator;@role="multiplication";text()="\u2062"'.split(
|
|
";",
|
|
),
|
|
'Rule implicit-times default self::operator @role="multiplication" text()="\u2062" CQFsimpleArguments'.split(
|
|
" ",
|
|
),
|
|
'Rule;implicit-times;default;[n] text();self::operator;@role="multiplication";text()="\u2062";CQFfencedArguments'.split(
|
|
";",
|
|
),
|
|
'Rule;implicit-times;ImpliedTimes_MoreImpliedTimes;[n] text();self::operator;@role="multiplication";text()="\u2062"'.split(
|
|
";",
|
|
),
|
|
'Rule implicit-times ImpliedTimes_None self::operator @role="multiplication" text()="\u2062"'.split(
|
|
" ",
|
|
),
|
|
'Rule{binary-operation-simple{default{[m] children/* (rate:"0.5"); [p] (pause:short){self::infixop{@role="implicit"{contains(@annotation, "clearspeak:simple"){not(contains(@grammar, "inFrac"))'.split(
|
|
"{",
|
|
),
|
|
'Rule;simple-in-fraction;default;[n] . (rate:"0.5",grammar:inFrac);self::*;contains(@annotation, "clearspeak:simple");not(contains(@grammar, "inFrac"));name(.)!="identifier";name(.)!="function";name(.)!="number";name(parent::*/parent::*)="fraction";not(preceding-sibling::*)'.split(
|
|
";",
|
|
),
|
|
'Rule;operators-after-power;Exponent_AfterPower;[m] children/* (rate:"0.5");self::infixop;@role="implicit";contains(@grammar, "afterPower")'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"relseq",
|
|
"default",
|
|
"[m] children/* (sepFunc:CTXFcontentIterator)",
|
|
"self::relseq",
|
|
],
|
|
[
|
|
"Rule",
|
|
"multrel",
|
|
"default",
|
|
"[m] children/* (sepFunc:CTXFcontentIterator)",
|
|
"self::multirel",
|
|
],
|
|
'Rule;natural-numbers;default;[t] "die nat\u00fcrlichen Zahlen";self::identifier;text()="\u2115" or (text()="N" and @font="double-struck");self::*;self::*;self::*;self::*;self::*'.split(
|
|
";",
|
|
),
|
|
'Rule;integers;default;[t] "die ganzen Zahlen";self::identifier;text()="\u2124" or (text()="Z" and @font="double-struck");self::*;self::*;self::*;self::*;self::*'.split(
|
|
";",
|
|
),
|
|
'Rule;rational-numbers;default;[t] "die rationalen Zahlen";self::identifier;text()="\u211a" or (text()="Q" and @font="double-struck");self::*;self::*;self::*;self::*;self::*'.split(
|
|
";",
|
|
),
|
|
'Rule;real-numbers;default;[t] "die reellen Zahlen";self::identifier;text()="\u211d" or (text()="R" and @font="double-struck");self::*;self::*;self::*;self::*;self::*'.split(
|
|
";",
|
|
),
|
|
'Rule;complex-numbers;default;[t] "die komplexen Zahlen";self::identifier;text()="\u2102" or (text()="C" and @font="double-struck");self::*;self::*;self::*;self::*;self::*'.split(
|
|
";",
|
|
),
|
|
'Rule,natural-numbers-super,default,[t] "n" (join: "-"); [n] children/*[2] (grammar:numbers2alpha),self::superscript,children/*[1]/text()="\u2115" or (children/*[1]/text()="N" and children/*[1]/@font="double-struck"),self::*,self::*,self::*,self::*,self::*'.split(
|
|
",",
|
|
),
|
|
'Rule,integers-super,default,[t] "z" (join: "-"); [n] children/*[2] (grammar:numbers2alpha),self::superscript,children/*[1]/text()="\u2124" or (children/*[1]/text()="Z" and children/*[1]/@font="double-struck"),self::*,self::*,self::*,self::*,self::*'.split(
|
|
",",
|
|
),
|
|
'Rule,rational-numbers-super,default,[t] "q" (join: "-"); [n] children/*[2] (grammar:numbers2alpha),self::superscript,children/*[1]/text()="\u211a" or (children/*[1]/text()="Q" and children/*[1]/@font="double-struck"),self::*,self::*,self::*,self::*,self::*'.split(
|
|
",",
|
|
),
|
|
'Rule,real-numbers-super,default,[t] "r" (join:"-"); [n] children/*[2] (grammar:numbers2alpha),self::superscript,children/*[1]/text()="\u211d" or (children/*[1]/text()="R" and children/*[1]/@font="double-struck"),self::*,self::*,self::*,self::*,self::*'.split(
|
|
",",
|
|
),
|
|
'Rule,complex-numbers-super,default,[t] "c" (join:"-"); [n] children/*[2] (grammar:numbers2alpha),self::superscript,children/*[1]/text()="\u2102" or (children/*[1]/text()="C" and children/*[1]/@font="double-struck"),self::*,self::*,self::*,self::*,self::*'.split(
|
|
",",
|
|
),
|
|
'Rule;natural-numbers-with-zero;default;[t] "die nat\u00fcrlichen Zahlen mit Null";self::subscript;children/*[1]/text()="\u2115" or (children/*[1]/text()="N" and children/*[1]/@font="double-struck");children/*[2]/text()="0";self::*;self::*;self::*;self::*;self::*'.split(
|
|
";",
|
|
),
|
|
'Rule;positive-integers;default;[t] "die positiven ganzen Zahlen";self::superscript;children/*[1]/text()="\u2124" or (children/*[1]/text()="Z" and children/*[1]/@font="double-struck");children/*[2]/text()="+";self::*;self::*;self::*;self::*;self::*'.split(
|
|
";",
|
|
),
|
|
'Rule;positive-integers;default;[t] "die negativen ganzen Zahlen";self::superscript;children/*[1]/text()="\u2124" or (children/*[1]/text()="Z" and children/*[1]/@font="double-struck");children/*[2]/text()="-";self::*;self::*;self::*;self::*;self::*'.split(
|
|
";",
|
|
),
|
|
'Rule;positive-rational-numbers;default;[t] "die positiven rationalen Zahlen";self::superscript;children/*[1]/text()="\u211a" or (children/*[1]/text()="Q" and children/*[1]/@font="double-struck");children/*[2]/text()="+";self::*;self::*;self::*;self::*;self::*'.split(
|
|
";",
|
|
),
|
|
'Rule;negative-rational-numbers;default;[t] "die negativen rationalen Zahlen";self::superscript;children/*[1]/text()="\u211a" or (children/*[1]/text()="Q" and children/*[1]/@font="double-struck");children/*[2]/text()="-";self::*;self::*;self::*;self::*;self::*'.split(
|
|
";",
|
|
),
|
|
'Rule,fences-neutral,default,[p] (pause:short); [t] "der Betrag von"; [n] children/*[1]; [p] (pause: short),self::fenced,@role="neutral",content/*[1][text()]="|" or content/*[1][text()]="\u2758" or content/*[1][text()]="\uff5c"'.split(
|
|
",",
|
|
),
|
|
'Rule,fences-neutral,AbsoluteValue_AbsEnd,[p] (pause:short); [t] "der Betrag von"; [n] children/*[1]; [p] (pause: short); [t] "Ende Betrag"; [p] (pause: short),self::fenced,@role="neutral",content/*[1][text()]="|" or content/*[1][text()]="\u2758" or content/*[1][text()]="\uff5c"'.split(
|
|
",",
|
|
),
|
|
'Rule,fences-neutral,AbsoluteValue_Cardinality,[p] (pause:short); [t] "die M\u00e4chtigkeit der Menge"; [n] children/*[1]; [p] (pause: short),self::fenced,@role="neutral",content/*[1][text()]="|" or content/*[1][text()]="\u2758" or content/*[1][text()]="\uff5c"'.split(
|
|
",",
|
|
),
|
|
'Rule,fences-neutral,AbsoluteValue_Determinant,[p] (pause:short); [t] "die Determinante von"; [n] children/*[1]; [p] (pause: short),self::fenced,@role="neutral",content/*[1][text()]="|" or content/*[1][text()]="\u2758" or content/*[1][text()]="\uff5c"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"matrix",
|
|
"default",
|
|
'[t] "die" (grammar:article); [t] count(children/*); [t] "mal";[t] count(children/*[1]/children/*); [t] "Matrize"; [p] (pause:long); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"Zeile-:"); [p] (pause:long)',
|
|
"self::matrix",
|
|
],
|
|
'Rule{matrix-simple{default{[t] "die" (grammar:article); [t] count(children/*); [t] "mal";[t] count(children/*[1]/children/*); [t] "Matrize"; [p] (pause:long); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"Zeile-:",grammar:simpleDet); [p] (pause:long){self::matrix{count(children/*)<4{count(children/*[1]/children/*)<4{CQFcellsSimple'.split(
|
|
"{",
|
|
),
|
|
'Rule,matrix-trivial,default,[t] "die 1 mal 1 Matrize mit Element"; [n] children/*[1]; [p] (pause:long),self::vector,@role="squarematrix"'.split(
|
|
",",
|
|
),
|
|
'Rule{determinant{default{[t] "die" (grammar:article); [t] "Determinante der"; [t] count(children/*); [t] "mal"; [t] count(children/*[1]/children/*); [t] "Matrize"; [p] (pause:long); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"Zeile-:",grammar:simpleDet); [p] (pause:long){self::matrix{@role="determinant"{count(children/*)<4{CQFcellsSimple'.split(
|
|
"{",
|
|
),
|
|
'Rule{determinant-simple{default{[t] "die" (grammar:article); [t] "Determinante der"; [t] count(children/*); [t] "mal"; [t] count(children/*[1]/children/*); [t] "Matrize"; [p] (pause:long); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"Zeile-:"); [p] (pause:long){self::matrix{@role="determinant"'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"matrix-vector",
|
|
"default",
|
|
'[t] "die" (grammar:article); [t] count(children/*); [t] "mal";[t] count(children/*[1]/children/*); [t] "Spaltenmatrize"; [p] (pause:long); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"Zeile-:",grammar:simpleDet); [p] (pause:long)',
|
|
"self::vector",
|
|
],
|
|
["SpecializedRule", "matrix-vector", "default", "Matrix_SpeakColNum"],
|
|
'Rule{matrix-vector-simple{default{[t] "die" (grammar:article); [t] count(children/*); [t] "mal";[t] count(children/*[1]/children/*); [t] "Spaltenmatrize"; [p] (pause:long); [m] children/* (sepFunc:CTXFpauseSeparator,separator:"short",grammar:simpleDet); [p] (pause:long){self::vector{count(children/*)<4{CQFcellsSimple{@role!="squarematrix"'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"matrix-vector-simple",
|
|
"Matrix_SilentColNum",
|
|
'[t] "die" (grammar:article); [t] count(children/*); [t] "mal";[t] count(children/*[1]/children/*); [t] "Spaltenmatrize"; [p] (pause:long); [m] children/* (sepFunc:CTXFpauseSeparator,separator:"short",grammar:simpleDet); [p] (pause:long)',
|
|
"self::vector",
|
|
],
|
|
'Rule{matrix-row-vector{default{[t] "die" (grammar:article); [t] count(children/*); [t] "mal";[t] count(children/*[1]/children/*); [t] "Zeilenmatrize"; [p] (pause:long); [m] children/*[1]/children/* (ctxtFunc:CTXFnodeCounter,context:"Spalte-:",grammar:simpleDet); [p] (pause:long){self::matrix{@role="rowvector"'.split(
|
|
"{",
|
|
),
|
|
["SpecializedRule", "matrix-row-vector", "default", "Matrix_SpeakColNum"],
|
|
'Rule{matrix-row-vector-simple{default{[t] "die" (grammar:article); [t] count(children/*); [t] "mal";[t] count(children/*[1]/children/*); [t] "Zeilenmatrize"; [p] (pause:long); [m] children/*[1]/children/* (sepFunc:CTXFpauseSeparator,separator:"short",grammar:simpleDet); [p] (pause:long){self::matrix{@role="rowvector"{count(children/*[1]/children/*)<4{CQFcellsSimple'.split(
|
|
"{",
|
|
),
|
|
'Rule{matrix-row-vector-simple{Matrix_SilentColNum{[t] "die" (grammar:article); [t] count(children/*); [t] "mal";[t] count(children/*[1]/children/*); [t] "Zeilenmatrize"; [p] (pause:long); [m] children/*[1]/children/* (sepFunc:CTXFpauseSeparator,separator:"short",grammar:simpleDet); [p] (pause:long){self::matrix{@role="rowvector"'.split(
|
|
"{",
|
|
),
|
|
'Rule;matrix-row-simple;default;[m] children/* (sepFunc:CTXFpauseSeparator,separator:"short");self::row;contains(@grammar, "simpleDet")'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"matrix-row-simple",
|
|
"Matrix_SilentColNum",
|
|
'[m] children/* (sepFunc:CTXFpauseSeparator,separator:"short")',
|
|
"self::row",
|
|
],
|
|
'Rule;line-simple;default;[n] children/*[1];self::line;contains(@grammar, "simpleDet")'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"matrix-row",
|
|
"default",
|
|
'[m] children/* (ctxtFunc:CTXFnodeCounter,context:"Spalte-,- ",sepFunc:CTXFpauseSeparator,separator:"medium"); [p] (pause:long)',
|
|
"self::row",
|
|
],
|
|
["SpecializedRule", "matrix-row", "default", "Matrix_SpeakColNum"],
|
|
["Rule", "matrix-cell", "default", "[n] children/*[1]", "self::cell"],
|
|
'Rule{matrix-end-matrix{Matrix_EndMatrix{[n] . (grammar:EndMatrix); [t] "Ende Matrize"{self::matrix{not(contains(@grammar, "EndMatrix"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{matrix-end-vector{Matrix_EndMatrix{[n] . (grammar:EndMatrix); [t] "Ende Matrize"{self::vector{not(contains(@grammar, "EndMatrix"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{matrix-end-determinant{Matrix_EndMatrix{[n] . (grammar:EndMatrix); [t] "Ende Determinante"{self::matrix{@role="determinant"{not(contains(@grammar, "EndMatrix"))'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"vector",
|
|
"Matrix_Vector",
|
|
'[t] "der" (grammar:article); [t] count(children/*); [t] "mal";[t] count(children/*[1]/children/*); [t] "Spaltenvektor"; [p] (pause:long); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"Zeile-:",grammar:simpleDet); [p] (pause:long)',
|
|
"self::vector",
|
|
],
|
|
["SpecializedRule", "vector", "Matrix_Vector", "Matrix_EndVector"],
|
|
'Rule{vector-simple{Matrix_Vector{[t] "der" (grammar:article); [t] count(children/*); [t] "mal"; [t] count(children/*[1]/children/*); [t] "Spaltenvektor"; [p] (pause:long); [m] children/* (sepFunc:CTXFpauseSeparator,separator:"short",grammar:simpleDet); [p] (pause:long){self::vector{count(children/*)<4{CQFcellsSimple'.split(
|
|
"{",
|
|
),
|
|
["SpecializedRule", "vector-simple", "Matrix_Vector", "Matrix_EndVector"],
|
|
'Rule{row-vector{Matrix_Vector{[t] "der" (grammar:article); [t] count(children/*); [t] "mal";[t] count(children/*[1]/children/*); [t] "Zeilenvektor"; [p] (pause:long); [m] children/*[1]/children/* (ctxtFunc:CTXFnodeCounter,context:"Spalte-:",grammar:simpleDet); [p] (pause:long){self::matrix{@role="rowvector"'.split(
|
|
"{",
|
|
),
|
|
["SpecializedRule", "row-vector", "Matrix_Vector", "Matrix_EndVector"],
|
|
'Rule{row-vector-simple{Matrix_Vector{[t] "der" (grammar:article); [t] count(children/*); [t] "mal";[t] count(children/*[1]/children/*); [t] "Zeilenvektor"; [p] (pause:long); [m] children/*[1]/children/* (sepFunc:CTXFpauseSeparator,separator:"short",grammar:simpleDet); [p] (pause:long){self::matrix{@role="rowvector"{count(children/*[1]/children/*)<4{CQFcellsSimple'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"row-vector-simple",
|
|
"Matrix_Vector",
|
|
"Matrix_EndVector",
|
|
],
|
|
'Rule{vector-end-matrix{Matrix_EndVector{[n] . (grammar:EndMatrix); [t] "Ende Matrize"{self::matrix{not(contains(@grammar, "EndMatrix")){self::*'.split(
|
|
"{",
|
|
),
|
|
'Rule{vector-end-vector{Matrix_EndVector{[n] . (grammar:EndMatrix); [t] "Ende Vektor"{self::vector{not(contains(@grammar, "EndMatrix")){self::*'.split(
|
|
"{",
|
|
),
|
|
'Rule{vector-end-vector{Matrix_EndVector{[n] . (grammar:EndMatrix); [t] "Ende Vektor"{self::matrix{@role="rowvector"{not(contains(@grammar, "EndMatrix")){self::*'.split(
|
|
"{",
|
|
),
|
|
'Rule{vector-end-determinant{Matrix_EndVector{[n] . (grammar:EndMatrix); [t] "Ende Determinante"{self::matrix{@role="determinant"{not(contains(@grammar, "EndMatrix")){self::*'.split(
|
|
"{",
|
|
),
|
|
'Rule,binomial,Matrix_Combinatoric,[n] children/*[1]/children/*[1]; [t] "\u00fcber"; [n] children/*[2]/children/*[1]; ,self::vector,@role="binomial"'.split(
|
|
",",
|
|
),
|
|
'Rule{lines-summary{default{[p] (pause:short); [t] count(children/*); [t] "Zeilen"; [n] . (grammar:layoutSummary){self::multiline{not(contains(@grammar, "layoutSummary")){self::*'.split(
|
|
"{",
|
|
),
|
|
'Rule;lines-summary;MultiLineOverview_None;[n] . (grammar:layoutSummary);self::multiline;not(contains(@grammar, "layoutSummary"));self::*'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"lines-summary",
|
|
"self::table",
|
|
'not(contains(@grammar, "layoutSummary"))',
|
|
],
|
|
'Rule{cases-summary{default{[p] (pause:short); [t] count(children/*); [t] "F\u00e4lle"; [n] . (grammar:layoutSummary){self::cases{not(contains(@grammar, "layoutSummary"))'.split(
|
|
"{",
|
|
),
|
|
'Rule;cases-summary;MultiLineOverview_None;[n] . (grammar:layoutSummary);self::cases;not(contains(@grammar, "layoutSummary"));self::*'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"lines",
|
|
"default",
|
|
'[p] (pause:short); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"Zeile-:",sepFunc:CTXFpauseSeparator,separator:"long"); [p] (pause:long)',
|
|
"self::table",
|
|
],
|
|
["Aliases", "lines", "self::multiline"],
|
|
["Rule", "line", "default", "[n] children/*[1]", "self::line"],
|
|
'Rule;row-medium;default;[m] children/* (sepFunc:CTXFpauseSeparator,separator:"medium");self::row;@role="table"'.split(
|
|
";",
|
|
),
|
|
["Aliases", "row-medium", "self::row", '@role="cases"'],
|
|
'Rule;row-long;MultiLinePausesBetweenColumns_Long;[m] children/* (sepFunc:CTXFpauseSeparator,separator:"long");self::row;@role="table"'.split(
|
|
";",
|
|
),
|
|
["Aliases", "row-long", "self::row", '@role="cases"'],
|
|
'Rule;row-short;MultiLinePausesBetweenColumns_Short;[m] children/* (sepFunc:CTXFpauseSeparator,separator:"short");self::row;@role="table"'.split(
|
|
";",
|
|
),
|
|
["Aliases", "row-short", "self::row", '@role="cases"'],
|
|
'Rule;blank-cell;default;[t] "leer";self::cell;count(children/*)=0'.split(
|
|
";",
|
|
),
|
|
'Rule;blank-empty;default;[t] "leer";self::empty;count(../*)=1;name(../..)="cell" or name(../..)="line"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"cases",
|
|
"default",
|
|
'[p] (pause:short); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"Fall-:",sepFunc:CTXFpauseSeparator,separator:"long"); [p] (pause:long)',
|
|
"self::cases",
|
|
],
|
|
'Rule{lines-cases-summary{MultiLineLabel_Case{[p] (pause:short); [t] count(children/*); [t] "F\u00e4lle"; [n] . (grammar:layoutSummary){self::multiline{not(contains(@grammar, "layoutSummary"))'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"lines-cases-summary",
|
|
"self::table",
|
|
'not(contains(@grammar, "layoutSummary"))',
|
|
],
|
|
[
|
|
"Rule",
|
|
"lines-cases",
|
|
"MultiLineLabel_Case",
|
|
'[p] (pause:short); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"Fall-:",sepFunc:CTXFpauseSeparator,separator:"long"); [p] (pause:long)',
|
|
"self::table",
|
|
],
|
|
["Aliases", "lines-cases", "self::multiline"],
|
|
'Rule{lines-equations-summary{MultiLineLabel_Equation{[p] (pause:short); [t] count(children/*); [t] "Gleichungen"; [n] . (grammar:layoutSummary){self::multiline{not(contains(@grammar, "layoutSummary"))'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"lines-equations-summary",
|
|
"self::table",
|
|
'not(contains(@grammar, "layoutSummary"))',
|
|
],
|
|
[
|
|
"Rule",
|
|
"lines-equations",
|
|
"MultiLineLabel_Equation",
|
|
'[p] (pause:short); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"Gleichung-:",sepFunc:CTXFpauseSeparator,separator:"long"); [p] (pause:long)',
|
|
"self::table",
|
|
],
|
|
["Aliases", "lines-equations", "self::multiline"],
|
|
'Rule{lines-steps-summary{MultiLineLabel_Step{[p] (pause:short); [t] count(children/*); [t] "Rechenschritte"; [n] . (grammar:layoutSummary){self::multiline{not(contains(@grammar, "layoutSummary"))'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"lines-steps-summary",
|
|
"self::table",
|
|
'not(contains(@grammar, "layoutSummary"))',
|
|
],
|
|
[
|
|
"Rule",
|
|
"lines-steps",
|
|
"MultiLineLabel_Step",
|
|
'[p] (pause:short); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"Schritt-:",sepFunc:CTXFpauseSeparator,separator:"long"); [p] (pause:long)',
|
|
"self::table",
|
|
],
|
|
["Aliases", "lines-steps", "self::multiline"],
|
|
'Rule{lines-rows-summary{MultiLineLabel_Row{[p] (pause:short); [t] count(children/*); [t] "Zeilen"; [n] . (grammar:layoutSummary){self::multiline{not(contains(@grammar, "layoutSummary"))'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"lines-rows-summary",
|
|
"self::table",
|
|
'not(contains(@grammar, "layoutSummary"))',
|
|
],
|
|
[
|
|
"Rule",
|
|
"lines-rows",
|
|
"MultiLineLabel_Row",
|
|
'[p] (pause:short); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"Zeile-:",sepFunc:CTXFpauseSeparator,separator:"long"); [p] (pause:long)',
|
|
"self::table",
|
|
],
|
|
["Aliases", "lines-rows", "self::multiline"],
|
|
'Rule{lines-constraints-summary{MultiLineLabel_Constraint{[p] (pause:short); [t] count(children/*); [t] "Bedingungen"; [n] . (grammar:layoutSummary){self::multiline{not(contains(@grammar, "layoutSummary"))'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"lines-constraints-summary",
|
|
"self::table",
|
|
'not(contains(@grammar, "layoutSummary"))',
|
|
],
|
|
[
|
|
"Rule",
|
|
"lines-constraints",
|
|
"MultiLineLabel_Constraint",
|
|
'[p] (pause:short); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"Bedingung-:",sepFunc:CTXFpauseSeparator,separator:"long"); [p] (pause:long)',
|
|
"self::table",
|
|
],
|
|
["Aliases", "lines-constraints", "self::multiline"],
|
|
'Rule{lines-none{MultiLineLabel_None{[p] (pause:short); [m] children/* (sepFunc:CTXFpauseSeparator,separator:"long"); [p] (pause:long){self::table{contains(@grammar, "layoutSummary")'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"lines-none",
|
|
"self::multiline",
|
|
'contains(@grammar, "layoutSummary")',
|
|
],
|
|
[
|
|
"Aliases",
|
|
"lines-none",
|
|
"self::cases",
|
|
'contains(@grammar, "layoutSummary")',
|
|
],
|
|
[
|
|
"Rule",
|
|
"bigop",
|
|
"default",
|
|
'[n] children/*[1]; [t] "\u00fcber"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::bigop",
|
|
],
|
|
[
|
|
"Rule",
|
|
"limboth",
|
|
"default",
|
|
'[n] children/*[1]; [t] "von"; [n] children/*[2];[t] "bis"; [n] children/*[3];',
|
|
"self::limboth",
|
|
],
|
|
[
|
|
"Rule",
|
|
"limlower",
|
|
"default",
|
|
'[n] children/*[1]; [t] "\u00fcber"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::limlower",
|
|
],
|
|
[
|
|
"Rule",
|
|
"limupper",
|
|
"default",
|
|
'[n] children/*[1]; [t] "unter"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::limupper",
|
|
],
|
|
[
|
|
"Rule",
|
|
"integral",
|
|
"default",
|
|
'[t] "das"; [n] children/*[1]; [t] "\u00fcber"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::integral",
|
|
],
|
|
[
|
|
"Rule",
|
|
"overscript",
|
|
"default",
|
|
'[n] children/*[1]; [t] "unter"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::overscore",
|
|
],
|
|
'Rule,overscript,default,[n] children/*[1]; [n] children/*[2];,self::overscore,children/*[2][@role="overaccent"]'.split(
|
|
",",
|
|
),
|
|
'Rule,overscript-limits,default,[n] children/*[1]; [t] "bis"; [n] children/*[2],self::overscore,children/*[2][@role!="overaccent"],name(children/*[1])="underscore",children/*[1]/children/*[2][@role!="underaccent"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"underscript",
|
|
"default",
|
|
'[n] children/*[1]; [t] "\u00fcber"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::underscore",
|
|
],
|
|
'Rule,underscript-limits,default,[n] children/*[1]; [t] "von"; [n] children/*[2],self::underscore,@role="underover",children/*[2][@role!="underaccent"]'.split(
|
|
",",
|
|
),
|
|
["Rule", "number", "default", "[n] text()", "self::number"],
|
|
'Rule,mixed-number,default,[n] children/*[1]; [n] children/*[2]; ,self::number,@role="mixed"'.split(
|
|
",",
|
|
),
|
|
'Rule{number-with-chars{default{[t] "Zahl"; [m] CQFspaceoutNumber (grammar:protected){self::number{@role="othernumber"{"" != translate(text(), "0123456789.,", ""){not(contains(@grammar, "protected"))'.split(
|
|
"{",
|
|
),
|
|
'Rule,decimal-period,default,[t] "Dezimalbruch"; [n] children/*[1] (grammar:spaceout); [t] "Komma mit Periode"; [n] children/*[3]/children/*[1] (grammar:spaceout),self::punctuated,@role="sequence",count(./content/*)=1,./content/*[1][@role="fullstop"],name(children/*[1])="number",children/*[1][@role="integer"],name(children/*[3])="overscore",children/*[3][@role="integer"],children/*[3]/children/*[2][@role="overaccent"],children/*[3]/children/*[2][text()="\u00af" or text()="\uffe3" or text()="\uff3f" or text()="_" or text()="\u203e"]'.split(
|
|
",",
|
|
),
|
|
'Rule,decimal-period,default,[t] "Dezimalbruch"; [n] children/*[1] (grammar:spaceout); [t] "mit Periode"; [n] children/*[2]/children/*[1] (grammar:spaceout);,self::infixop,@role="implicit",count(./children/*)=2,name(children/*[1])="number",children/*[1][@role="float"],name(children/*[2])="overscore",children/*[2][@role="integer"],children/*[2]/children/*[2][@role="overaccent"],children/*[2]/children/*[2][text()="\u00af" or text()="\uffe3" or text()="\uff3f" or text()="_" or text()="\u203e"]'.split(
|
|
",",
|
|
),
|
|
'Rule,decimal-period-singular,default,[t] "Dezimalbruch"; [n] children/*[1] (grammar:spaceout); [t] "Komma mit Periode"; [n] children/*[3]/children/*[1] (grammar:spaceout),self::punctuated,@role="sequence",count(./content/*)=1,./content/*[1][@role="fullstop"],name(children/*[1])="number",children/*[1][@role="integer"],name(children/*[3])="overscore",children/*[3][@role="integer"],children/*[3]/children/*[2][@role="overaccent"],children/*[3]/children/*[2][text()="\u00af" or text()="\uffe3" or text()="\uff3f" or text()="_" or text()="\u203e"],string-length(./children/*[3]/children/*[1]/text())=1'.split(
|
|
",",
|
|
),
|
|
'Rule,decimal-period-singular,default,[t] "Dezimalbruch"; [n] children/*[1] (grammar:spaceout); [t] "mit Periode"; [n] children/*[2]/children/*[1] (grammar:spaceout);,self::infixop,@role="implicit",count(./children/*)=2,name(children/*[1])="number",children/*[1][@role="float"],name(children/*[2])="overscore",children/*[2][@role="integer"],children/*[2]/children/*[2][@role="overaccent"],children/*[2]/children/*[2][text()="\u00af" or text()="\uffe3" or text()="\uff3f" or text()="_" or text()="\u203e"],string-length(./children/*[2]/children/*[1]/text())=1'.split(
|
|
",",
|
|
),
|
|
'Rule;number-with-spaces;default;[m] CQFspaceoutNumber (grammar:!spaceout:number);self::number;contains(@grammar, "spaceout")'.split(
|
|
";",
|
|
),
|
|
'Rule;decimal-point;default;[t] "Komma";self::punctuation;@role="fullstop";contains(@grammar,"number")'.split(
|
|
";",
|
|
),
|
|
'Rule,line-segment,default,[t] "die Strecke"; [n] children/*[1]/children/*[1]; [n] children/*[1]/children/*[2]; [p] (pause:short),self::overscore,@role="implicit",children/*[2][@role="overaccent"],children/*[2][text()="\u00af" or text()="\uffe3" or text()="\uff3f" or text()="_" or text()="\u203e"],name(children/*[1])="infixop",count(./children/*[1]/children/*)=2'.split(
|
|
",",
|
|
),
|
|
'Rule,conjugate,Bar_Conjugate,[t] "die komplexe Konjugation von"; [n] children/*[1],self::overscore,children/*[2][@role="overaccent"],children/*[2][text()="\u00af" or text()="\uffe3" or text()="\uff3f" or text()="_" or text()="\u203e"]'.split(
|
|
",",
|
|
),
|
|
'Rule;defined-by;default;[t] "ist definiert als" (pause:short);self::overscore;@role="equality";@embellished="relation";name(children/*[2])="text";children/*[2][text()]="def"'.split(
|
|
";",
|
|
),
|
|
'Rule,adorned-sign,default,[n] children/*[1] ; [t] "Zeichen mit dar\u00fcberstehendem"; [n] children/*[2],self::overscore,@embellished,name(children/*[1])="operator" or name(children/*[1])="relation"'.split(
|
|
",",
|
|
),
|
|
'Rule;factorial;default;[t] "Fakult\u00e4t";self::punctuation;text()="!";name(preceding-sibling::*[1])!="text"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"tensor-base",
|
|
"default",
|
|
"[n] children/*[2]; [n] children/*[3]; [n] children/*[1]; [n] children/*[4]; [n] children/*[5]",
|
|
"self::tensor",
|
|
],
|
|
'Rule{left-super{default{[t] "linker oberer Index"; [n] text(){self::*[@role="leftsuper"]{not(contains(@grammar,"combinatorics"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{left-super{default{[t] "linker oberer Index"; [m] children/*{self::punctuated{@role="leftsuper"{not(contains(@grammar,"combinatorics"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{left-sub{default{[t] "linker unterer Index"; [n] text(){self::*[@role="leftsub"]{not(contains(@grammar,"combinatorics"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{left-sub{default{[t] "linker unterer Index"; [m] children/*{self::punctuated{@role="leftsub"{not(contains(@grammar,"combinatorics"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{right-super{default{[t] "rechter oberer Index"; [n] text(){self::*[@role="rightsuper"]{not(contains(@grammar,"combinatorics"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{right-super{default{[t] "rechter oberer Index"; [m] children/*{self::punctuated{@role="rightsuper"{not(contains(@grammar,"combinatorics"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{right-sub{default{[t] "rechter unterer Index"; [n] text(){self::*[@role="rightsub"]{not(contains(@grammar,"combinatorics"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{right-sub{default{[t] "rechter unterer Index"; [m] children/*{self::punctuated{@role="rightsub"{not(contains(@grammar,"combinatorics"))'.split(
|
|
"{",
|
|
),
|
|
'Rule;empty-index;default;[p] (pause:medium);self::empty;@role="rightsub" or @role="rightsuper" or @role="leftsub" or @role="leftsuper"'.split(
|
|
";",
|
|
),
|
|
'Rule,combinatorics,default,[n] children/*[2] (grammar:combinatorics); [n] children/*[1]; [n] children/*[4] (grammar:combinatorics),self::tensor,name(children/*[3])="empty",name(children/*[5])="empty",children/*[1][text()="P" or text()="C"]'.split(
|
|
",",
|
|
),
|
|
'Rule,choose,CombinationPermutation_ChoosePermute,[n] children/*[4] (grammar:combinatorics); [t] "aus"; [n] children/*[2] (grammar:combinatorics),self::tensor,name(children/*[3])="empty",name(children/*[5])="empty",children/*[1][text()="C"]'.split(
|
|
",",
|
|
),
|
|
'Rule,permute,CombinationPermutation_ChoosePermute,[n] children/*[4] (grammar:combinatorics); [t] "Permutionen von"; [n] children/*[2] (grammar:combinatorics),self::tensor,name(children/*[3])="empty",name(children/*[5])="empty",children/*[1][text()="P"]'.split(
|
|
",",
|
|
),
|
|
],
|
|
};
|
|
sre.Grammar.getInstance().setPreprocessor(
|
|
"numbers2alpha",
|
|
sre.ClearspeakUtil.numbersToAlpha,
|
|
);
|
|
sre.ClearspeakRules = {
|
|
domain: "clearspeak",
|
|
functions: [
|
|
["CTXF", "CTXFpauseSeparator", sre.StoreUtil.pauseSeparator],
|
|
["CTXF", "CTXFnodeCounter", sre.ClearspeakUtil.nodeCounter],
|
|
["CTXF", "CTXFcontentIterator", sre.StoreUtil.contentIterator],
|
|
["CSF", "CSFvulgarFraction", sre.NumbersUtil.vulgarFraction],
|
|
["CQF", "CQFvulgarFractionSmall", sre.ClearspeakUtil.isSmallVulgarFraction],
|
|
["CQF", "CQFcellsSimple", sre.ClearspeakUtil.allCellsSimple],
|
|
["CSF", "CSFordinalExponent", sre.ClearspeakUtil.ordinalExponent],
|
|
["CSF", "CSFwordOrdinal", sre.ClearspeakUtil.wordOrdinal],
|
|
["CQF", "CQFisCapital", sre.ClearspeakUtil.isCapitalLetter],
|
|
["CQF", "CQFmatchingFences", sre.ClearspeakUtil.matchingFences],
|
|
["CSF", "CSFnestingDepth", sre.ClearspeakUtil.nestingDepth],
|
|
["CQF", "CQFfencedArguments", sre.ClearspeakUtil.fencedArguments],
|
|
["CQF", "CQFsimpleArguments", sre.ClearspeakUtil.simpleArguments],
|
|
["CQF", "CQFisHyperbolic", sre.ClearspeakUtil.isHyperbolic],
|
|
["CQF", "CQFisLogarithm", sre.ClearspeakUtil.isLogarithmWithBase],
|
|
["CQF", "CQFspaceoutNumber", sre.MathspeakUtil.spaceoutNumber],
|
|
["CQF", "CQFfirstCurrency", sre.ClearspeakUtil.firstCurrency],
|
|
["CQF", "CQFlastCurrency", sre.ClearspeakUtil.lastCurrency],
|
|
],
|
|
rules: [
|
|
'Rule{collapsed{default{[t] "collapsed"; [n] . (engine:modality=summary,grammar:collapsed){self::*[@alternative]{not(contains(@grammar, "collapsed"))'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"direct-speech",
|
|
"default",
|
|
"[t] @ext-speech",
|
|
"self::*[@ext-speech]",
|
|
],
|
|
["Rule", "stree", "default", "[n] ./*[1]", "self::stree"],
|
|
["Rule", "unknown", "default", "[n] text()", "self::unknown"],
|
|
'Rule;protected;default;[t] text();self::number;contains(@grammar, "protected")'.split(
|
|
";",
|
|
),
|
|
["Rule", "omit-empty", "default", '[p] (pause:"short")', "self::empty"],
|
|
'Rule{font{default{[t] @font (grammar:localFont); [n] self::* (grammar:ignoreFont=@font,pause:"short"){self::*{@font{not(contains(@grammar, "ignoreFont")){@font!="normal"'.split(
|
|
"{",
|
|
),
|
|
'Rule{font-identifier{default{[t] @font (grammar:localFont); [n] self::* (grammar:ignoreFont=@font,pause:"short"){self::identifier{string-length(text())=1{@font{@font="normal"{not(contains(@grammar, "ignoreFont")){@role!="unit"'.split(
|
|
"{",
|
|
),
|
|
'Rule;omit-font;default;[n] self::* (grammar:ignoreFont=@font);self::identifier;string-length(text())=1;@font;not(contains(@grammar, "ignoreFont"));@font="italic"'.split(
|
|
";",
|
|
),
|
|
'Rule{german-font{default{[t] "German"; [n] self::* (grammar:ignoreFont=@font){self::*{@font{not(contains(@grammar, "ignoreFont")){@font="fraktur"'.split(
|
|
"{",
|
|
),
|
|
'Rule{german-font{default{[t] "bold German"; [n] self::* (grammar:ignoreFont=@font){self::*{@font{not(contains(@grammar, "ignoreFont")){@font="bold-fraktur"'.split(
|
|
"{",
|
|
),
|
|
["Rule", "text", "default", "[n] text()", "self::text"],
|
|
'Rule;capital;default;[n] text() (pitch:0.6,grammar:ignoreCaps="cap");self::identifier;@role="latinletter" or @role="greekletter" or @role="simple function";CQFisCapital'.split(
|
|
";",
|
|
),
|
|
'Rule;capital;Caps_SayCaps;[n] text();self::identifier;@role="latinletter" or @role="greekletter";CQFisCapital'.split(
|
|
";",
|
|
),
|
|
'Rule{capital{Caps_SayCaps{[p] (pause:"short"); [n] text(){self::identifier{@role="latinletter" or @role="greekletter"{CQFisCapital{preceding-sibling::*[1]{not(name(preceding-sibling::*[1])="function"){not(contains(@grammar, "angle"))'.split(
|
|
"{",
|
|
),
|
|
'Rule;capital;Caps_SayCaps;[n] text() (pause:"short");self::identifier;@role="latinletter" or @role="greekletter";CQFisCapital;following-sibling::*[1]'.split(
|
|
";",
|
|
),
|
|
'Rule{capital{Caps_SayCaps{[p] (pause:"short"); [n] text() (pause:"short"){self::identifier{@role="latinletter" or @role="greekletter"{CQFisCapital{preceding-sibling::*[1]{following-sibling::*[1]{not(name(preceding-sibling::*[1])="function"){not(contains(@grammar, "angle"))'.split(
|
|
"{",
|
|
),
|
|
'Rule,punctuation-lr,default,[p] (pause:"short"); [n] text() (pause:"short"),self::punctuation,@role="comma"'.split(
|
|
",",
|
|
),
|
|
'Rule;punctuation;default;[n] text();self::punctuation;@role="comma";not(preceding-sibling::*[1]/children);not(following-sibling::*[1]/children)'.split(
|
|
";",
|
|
),
|
|
'Rule,punctuation-l,default,[p] (pause:"short"); [n] text(),self::punctuation,@role="comma",not(following-sibling::*[1]/children)'.split(
|
|
",",
|
|
),
|
|
'Rule;punctuation-r;default;[n] text() (pause:"short");self::punctuation;@role="comma";not(preceding-sibling::*[1]/children)'.split(
|
|
";",
|
|
),
|
|
'Rule;ellipsis;Ellipses_AndSoOn;[t] "and so on";self::punctuation;@role="ellipsis";not(following-sibling::*[1]);not(preceding-sibling::*[last()][@role="ellipsis"])'.split(
|
|
";",
|
|
),
|
|
'Rule;ellipsis;Ellipses_AndSoOn;[t] "and so on up to";self::punctuation;@role="ellipsis";preceding-sibling::*[1];following-sibling::*[1]'.split(
|
|
";",
|
|
),
|
|
'Rule,vbar-evaluated,default,[n] children/*[1]; [p] (pause:"short"); [t] "evaluated at"; [n] content/*[1]/children/*[2]; [p] (pause:"short"),self::punctuated,@role="endpunct",content/*[1][@role="vbar"],content/*[1][@embellished],name(content/*[1])="subscript"'.split(
|
|
",",
|
|
),
|
|
'Rule,vbar-evaluated,default,[n] children/*[1]; [p] (pause:"short"); [t] "evaluated at"; [n] content/*[1]/children/*[2]; [p] (pause:"short"); [t] "minus the same expression evaluated at"; [n] content/*[1]/children/*[1]/children/*[2]; [p] (pause:"short"),self::punctuated,@role="endpunct",content/*[1][@role="vbar"],content/*[1][@embellished],name(content/*[1])="superscript",name(content/*[1]/children/*[1])="subscript"'.split(
|
|
",",
|
|
),
|
|
'Rule;vbar-such-that;VerticalLine_SuchThat;[t] "such that";self::punctuation;@role="vbar";not(parent::*/parent::*[@embellished="punctuation"])'.split(
|
|
";",
|
|
),
|
|
'Rule;vbar-divides;default;[t] "divides";self::punctuation;@role="vbar";not(parent::*/parent::*[@embellished="punctuation"]);parent::*/parent::*[@role="sequence"]'.split(
|
|
";",
|
|
),
|
|
'Rule;vbar-divides;VerticalLine_Divides;[t] "divides";self::punctuation;@role="vbar";not(parent::*/parent::*[@embellished="punctuation"])'.split(
|
|
";",
|
|
),
|
|
'Rule;vbar-given;VerticalLine_Given;[t] "given";self::punctuation;@role="vbar";not(parent::*/parent::*[@embellished="punctuation"])'.split(
|
|
";",
|
|
),
|
|
'Rule;set-member;default;[t] "in";self::operator;@role="set extended";text()="\u2208" or text()="\u220a"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"set-member",
|
|
"default",
|
|
"SetMemberSymbol_Member",
|
|
'[t] "member of"',
|
|
],
|
|
[
|
|
"SpecializedRule",
|
|
"set-member",
|
|
"default",
|
|
"SetMemberSymbol_Element",
|
|
'[t] "element of"',
|
|
],
|
|
[
|
|
"SpecializedRule",
|
|
"set-member",
|
|
"default",
|
|
"SetMemberSymbol_Belongs",
|
|
'[t] "belonging to"',
|
|
],
|
|
'Rule;set-not-member;default;[t] "not in";self::operator;@role="set extended";text()="\u2209"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"set-not-member",
|
|
"default",
|
|
"SetMemberSymbol_Member",
|
|
'[t] "not member of"',
|
|
],
|
|
[
|
|
"SpecializedRule",
|
|
"set-not-member",
|
|
"default",
|
|
"SetMemberSymbol_Element",
|
|
'[t] "not element of"',
|
|
],
|
|
[
|
|
"SpecializedRule",
|
|
"set-not-member",
|
|
"default",
|
|
"SetMemberSymbol_Belongs",
|
|
'[t] "not belonging to"',
|
|
],
|
|
'Rule,prime,default,[n] children/*[1]; [n] children/*[2],self::superscript,children/*[2],children/*[2][@role="prime"],self::*'.split(
|
|
",",
|
|
),
|
|
'Rule,feet,default,[n] children/*[1]; [t] "feet",self::superscript,children/*[2][@role="prime"],name(children/*[1])="number",children/*[2][text()="\u2032"],not(preceding-sibling::*[@role="degree"])'.split(
|
|
",",
|
|
),
|
|
'Rule,foot,default,[n] children/*[1]; [t] "foot",self::superscript,children/*[2][@role="prime"],name(children/*[1])="number",children/*[2][text()="\u2032"],children/*[1][text()="1"],not(preceding-sibling::*[@role="degree"])'.split(
|
|
",",
|
|
),
|
|
'Rule,inches,default,[n] children/*[1]; [t] "inches",self::superscript,children/*[2][@role="prime"],name(children/*[1])="number",children/*[2][text()="\u2033"],not(preceding-sibling::*[@role="degree"])'.split(
|
|
",",
|
|
),
|
|
'Rule,inch,default,[n] children/*[1]; [t] "inch",self::superscript,children/*[2][@role="prime"],name(children/*[1])="number",children/*[2][text()="\u2033"],children/*[1][text()="1"],not(preceding-sibling::*[@role="degree"])'.split(
|
|
",",
|
|
),
|
|
'Rule,minutes,default,[p] (pause:short); [n] children/*[1]; [t] "minutes",self::superscript,children/*[2][@role="prime"],preceding-sibling::*[@role="degree"],children/*[2][text()="\u2032"]'.split(
|
|
",",
|
|
),
|
|
'Rule,minute,default,[p] (pause:short); [n] children/*[1]; [t] "minute",self::superscript,children/*[2][@role="prime"],preceding-sibling::*[@role="degree"],children/*[2][text()="\u2032"],children/*[1][text()="1"]'.split(
|
|
",",
|
|
),
|
|
'Rule,seconds,default,[p] (pause:short); [n] children/*[1]; [t] "seconds",self::superscript,children/*[2][@role="prime"],preceding-sibling::*[@role="degree"],children/*[2][text()="\u2033"]'.split(
|
|
",",
|
|
),
|
|
'Rule,second,default,[p] (pause:short); [n] children/*[1]; [t] "second",self::superscript,children/*[2][@role="prime"],preceding-sibling::*[@role="degree"],children/*[2][text()="\u2033"],children/*[1][text()="1"]'.split(
|
|
",",
|
|
),
|
|
'Rule,degrees-angle,Prime_Angle,[n] children/*[1]; [t] "degrees"; [p] (pause:short),self::punctuation,@role="degree"'.split(
|
|
",",
|
|
),
|
|
'Rule,degree-angle,Prime_Angle,[n] children/*[1]; [t] "degree"; [p] (pause:short),self::punctuation,@role="degree",children/*[1][text()="1"]'.split(
|
|
",",
|
|
),
|
|
'Rule{minutes-angle{Prime_Angle{[n] children/*[1]; [t] "minutes"; [p] (pause:short){self::superscript{children/*[2][@role="prime"]{name(children/*[1])="number" or (children/*[1][@role="latinletter"] and ""=translate(children/*[1]/text(),"abcdefghijklmnopqrstuvwxyz", "")){children/*[2][text()="\u2032"]'.split(
|
|
"{",
|
|
),
|
|
'Rule,minute-angle,Prime_Angle,[n] children/*[1]; [t] "minute"; [p] (pause:short),self::superscript,children/*[2][@role="prime"],children/*[2][text()="\u2032"],children/*[1][text()="1"]'.split(
|
|
",",
|
|
),
|
|
'Rule{seconds-angle{Prime_Angle{[n] children/*[1]; [t] "seconds"; [p] (pause:short){self::superscript{children/*[2][@role="prime"]{name(children/*[1])="number" or (children/*[1][@role="latinletter"] and ""=translate(children/*[1]/text(),"abcdefghijklmnopqrstuvwxyz", "")){children/*[2][text()="\u2033"]'.split(
|
|
"{",
|
|
),
|
|
'Rule,second-angle,Prime_Angle,[n] children/*[1]; [t] "second"; [p] (pause:short),self::superscript,children/*[2][@role="prime"],children/*[2][text()="\u2033"],children/*[1][text()="1"]'.split(
|
|
",",
|
|
),
|
|
'Rule{feet-length{Prime_Length{[n] children/*[1]; [t] "feet"; [p] (pause:short){self::superscript{children/*[2][@role="prime"]{name(children/*[1])="number" or (children/*[1][@role="latinletter"] and ""=translate(children/*[1]/text(),"abcdefghijklmnopqrstuvwxyz", "")){children/*[2][text()="\u2032"]'.split(
|
|
"{",
|
|
),
|
|
'Rule,foot-length,Prime_Length,[n] children/*[1]; [t] "foot"; [p] (pause:short),self::superscript,children/*[2][@role="prime"],children/*[2][text()="\u2032"],children/*[1][text()="1"]'.split(
|
|
",",
|
|
),
|
|
'Rule{inches-length{Prime_Length{[n] children/*[1]; [t] "inches"; [p] (pause:short){self::superscript{children/*[2][@role="prime"]{name(children/*[1])="number" or (children/*[1][@role="latinletter"] and ""=translate(children/*[1]/text(),"abcdefghijklmnopqrstuvwxyz", "")){children/*[2][text()="\u2033"]'.split(
|
|
"{",
|
|
),
|
|
'Rule,inch-length,Prime_Length,[n] children/*[1]; [t] "inch"; [p] (pause:short),self::superscript,children/*[2][@role="prime"],children/*[2][text()="\u2033"],children/*[1][text()="1"]'.split(
|
|
",",
|
|
),
|
|
["Rule", "punctuated", "default", "[m] children/*", "self::punctuated"],
|
|
["Rule", "function", "default", "[n] text()", "self::function"],
|
|
'Rule{function-article{default{[t] "the"; [n] text(){self::function{@role="prefix function"{contains(@grammar, "addArticle")'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"appl",
|
|
"default",
|
|
'[n] children/*[1]; [t] "of"; [n] children/*[2]; [p] (pause:"short")',
|
|
"self::appl",
|
|
],
|
|
'Rule,appl-simple,default,[n] children/*[1]; [t] "of"; [p] (pause:"short"); [n] children/*[2]; [p] (pause:"short"),self::appl,@role="simple function",name(children/*[2])="appl"'.split(
|
|
",",
|
|
),
|
|
'Rule,appl-simple,default,[n] children/*[1]; [t] "of"; [p] (pause:"short"); [n] children/*[2]; [p] (pause:"short"),self::appl,@role="simple function",name(children/*[2])="fenced",name(children/*[2]/children/*[1])="appl"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"appl",
|
|
"Functions_None",
|
|
'[p] (pause:"short"); [n] children/*[1]; [t] "times"; [n] children/*[2]; [p] (pause:"short")',
|
|
"self::appl",
|
|
],
|
|
'Rule,function-prefix,default,[n] children/*[1]; [n] children/*[2],self::appl,@role="prefix function"'.split(
|
|
",",
|
|
),
|
|
'Rule{binary-operation{ImpliedTimes_MoreImpliedTimes{[n] . (grammar:impliedTimes); [p] (pause:"short"){self::appl{@role="prefix function"{parent::*/parent::infixop[@role="implicit"]{following-sibling::*{not(contains(@grammar, "impliedTimes"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{function-prefix-simple-arg{default{[n] children/*[1]; [n] children/*[2]{self::appl{@role="prefix function"{name(children/*[2])="fenced"{contains(children/*[2]/children/*[1]/@annotation, "clearspeak:simple"){name(children/*[2]/children/*[1])!="number"{name(children/*[2]/children/*[1])!="identifier"{name(children/*[2]/children/*[1])!="appl"'.split(
|
|
"{",
|
|
),
|
|
'Rule,function-prefix-embell,default,[p] (pause:"short"); [n] children/*[1]; [n] children/*[2]; [p] (pause:"short"); ,self::appl,@role="prefix function",name(children/*[1])!="function"'.split(
|
|
",",
|
|
),
|
|
'Rule{function-prefix-fenced-or-frac-arg{default{[p] (pause:"short"); [n] children/*[1] (grammar:addArticle); [t] "of"; [n] children/*[2]; [p] (pause:"short"){self::appl{@role="prefix function"{(name(children/*[2])="fenced" and not(contains(children/*[2]/children/*[1]/@annotation, "clearspeak:simple"))) or name(children/*[2])="fraction" or (name(children/*[2])!="fenced" and not(contains(children/*[2]/@annotation, "clearspeak:simple"))){self::*'.split(
|
|
"{",
|
|
),
|
|
'Rule,function-prefix-subscript,default,[p] (pause:"short"); [n] children/*[1] (grammar:addArticle); [t] "of"; [p] (pause:"short"); [n] children/*[2]; [p] (pause:"short"),self::appl,@role="prefix function",name(children/*[1])="subscript",self::*'.split(
|
|
",",
|
|
),
|
|
'Rule{function-ln{default{[n] children/*[1]; [n] children/*[2]{self::appl{@role="prefix function"{content/*[2][text()="ln"]{not(following-sibling::*){not(contains(@grammar, "NatLog"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{function-ln{default{[n] children/*[1]; [n] children/*[2]; [p] (pause:"short"){self::appl{@role="prefix function"{content/*[2][text()="ln"]{not(contains(@grammar, "NatLog"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{function-ln{default{[n] children/*[1]; [t] "of"; [n] children/*[2]; [p] (pause:"short"){self::appl{@role="prefix function"{content/*[2][text()="ln"]{name(children/*[2])="fenced"{not(contains(@grammar, "NatLog"))'.split(
|
|
"{",
|
|
),
|
|
'Rule;function-ln;Log_LnAsNaturalLog;[n] . (grammar:NatLog);self::appl;@role="prefix function";content/*[2][text()="ln"];not(following-sibling::*);not(contains(@grammar, "NatLog"))'.split(
|
|
";",
|
|
),
|
|
'Rule{function-ln{Log_LnAsNaturalLog{[n] . (grammar:NatLog); [p] (pause:"short"){self::appl{@role="prefix function"{content/*[2][text()="ln"]{not(contains(@grammar, "NatLog"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{function-prefix-as-exp{default{[n] children/*[1]; [t] "of"; [p] (pause:"short"); [n] children/*[2]; [p] (pause:"short"){self::appl{@role="prefix function"{name(parent::*/parent::*)="superscript"{not(following-sibling::*){(name(children/*[2])="fenced" and not(contains(children/*[2]/children/*[1]/@annotation, "clearspeak:simple"))) or name(children/*[2])="fraction" or (name(children/*[2])!="fenced" and not(contains(children/*[2]/@annotation, "clearspeak:simple")))'.split(
|
|
"{",
|
|
),
|
|
'Rule,function-prefix-subscript-as-exp,default,[n] children/*[1]; [t] "of"; [p] (pause:"short"); [n] children/*[2]; [p] (pause:"short"),self::appl,@role="prefix function",name(parent::*/parent::*)="superscript",not(following-sibling::*),name(children/*[1])="subscript"'.split(
|
|
",",
|
|
),
|
|
'Rule,function-prefix-hyper,default,[p] (pause:"short"); [n] children/*[1]; [t] "of"; [n] children/*[2]; [p] (pause:"short"),self::appl,@role="prefix function",CQFisHyperbolic'.split(
|
|
",",
|
|
),
|
|
'Rule{function-prefix-inverse{default{[p] (pause:"short"); [t] "the inverse"; [n] children/*[1]/children/*[1]; [t] "of"; [n] children/*[2]; [p] (pause:"short"){self::appl{@role="prefix function"{name(children/*[1])="superscript"{name(children/*[1]/children/*[2])="prefixop"{children/*[1]/children/*[2][@role="negative"]{children/*[1]/children/*[2]/children/*[1][text()="1"]{not(contains(@grammar, "functions_none"))'.split(
|
|
"{",
|
|
),
|
|
'Rule,appl-triginverse,Trig_TrigInverse,[p] (pause:"short"); [n] children/*[1]; [t] "of"; [n] children/*[2]; [p] (pause:"short"),self::appl,@role="prefix function",name(children/*[1])="superscript",name(children/*[1]/children/*[2])="prefixop",children/*[1]/children/*[2][@role="negative"],children/*[1]/children/*[2]/children/*[1][text()="1"]'.split(
|
|
",",
|
|
),
|
|
'Rule{function-prefix-arc-simple{Trig_ArcTrig{[p] (pause:"short"); [t] "arc"; [n] children/*[1]/children/*[1]; [n] children/*[2]; [p] (pause:"short"){self::appl{@role="prefix function"{name(children/*[1])="superscript"{name(children/*[1]/children/*[2])="prefixop"{children/*[1]/children/*[2][@role="negative"]{children/*[1]/children/*[2]/children/*[1][text()="1"]{not(contains(@grammar, "functions_none"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{function-prefix-arc-simple{Trig_ArcTrig{[p] (pause:"short"); [t] "arc"; [n] children/*[1]/children/*[1]; [p] (pause:"short"); [n] children/*[2]; [p] (pause:"short"){self::appl{@role="prefix function"{name(children/*[1])="superscript"{name(children/*[1]/children/*[2])="prefixop"{children/*[1]/children/*[2][@role="negative"]{children/*[1]/children/*[2]/children/*[1][text()="1"]{name(children/*[2])="fenced"{children/*[2]/children/*[1][@role="prefix function"]{contains(children/*[2]/children/*[1]/@annotation, "clearspeak:simple"){not(contains(@grammar, "functions_none"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{function-prefix-arc{Trig_ArcTrig{[p] (pause:"short"); [t] "arc"; [n] children/*[1]/children/*[1]; [t] "of"; [n] children/*[2]; [p] (pause:"short"){self::appl{@role="prefix function"{name(children/*[1])="superscript"{name(children/*[1]/children/*[2])="prefixop"{children/*[1]/children/*[2][@role="negative"]{children/*[1]/children/*[2]/children/*[1][text()="1"]{not(contains(@grammar, "functions_none")){(name(children/*[2])="fenced" and not(contains(children/*[2]/children/*[1]/@annotation, "clearspeak:simple"))) or (name(children/*[2])="fraction" and children/*[2][@role!="vulgar"])'.split(
|
|
"{",
|
|
),
|
|
'Rule{function-inverse{default{[n] children/*[1]; [t] "inverse"{self::superscript{@role="prefix function" or @role="simple function"{name(children/*[2])="prefixop"{children/*[2][@role="negative"]{children/*[2]/children/*[1][text()="1"]{not(contains(@grammar, "functions_none"))'.split(
|
|
"{",
|
|
),
|
|
'Rule,superscript-prefix-function,default,[t] "the"; [n] children/*[2] (grammar:ordinal); [t] "power of"; [n] children/*[1],self::superscript,@role="prefix function",name(children/*[2])="number",children/*[2][@role="integer"]'.split(
|
|
",",
|
|
),
|
|
'Rule,superscript-prefix-function,default,[t] "the"; [n] children/*[2] (grammar:ordinal); [t] "power of"; [n] children/*[1],self::superscript,@role="prefix function",name(children/*[2])="identifier"'.split(
|
|
",",
|
|
),
|
|
'Rule;function-inverse;Functions_None;[n] . (grammar:functions_none);self::superscript;@role="prefix function" or @role="simple function";name(children/*[2])="prefixop";children/*[2][@role="negative"];children/*[2]/children/*[1][text()="1"];not(contains(@grammar, "functions_none"))'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"superscript",
|
|
"default",
|
|
'[n] children/*[1]; [t] "raised to the exponent" (pause:"short"); [n] children/*[2]; [p] (pause:"short"); [t] "end exponent" (pause:"short")',
|
|
"self::superscript",
|
|
],
|
|
'Rule,superscript-simple-exponent,default,[n] children/*[1]; [t] "raised to the"; [n] children/*[2]; [t] "power" (pause:"short"),self::superscript,not(descendant::superscript)'.split(
|
|
",",
|
|
),
|
|
'Rule,superscript-simple-exponent-end,default,[n] children/*[1]; [t] "raised to the"; [n] children/*[2]; [t] "power",self::superscript,not(descendant::superscript),not(following-sibling::*)'.split(
|
|
",",
|
|
),
|
|
'Aliases;superscript-simple-exponent;self::superscript;children/superscript/children/*[2][text()="2"] or children/superscript/children/*[2][text()="3"];name(children/superscript/children/*[1])="number";contains(children/superscript/children/*[1]/@annotation, "clearspeak:simple")'.split(
|
|
";",
|
|
),
|
|
'Aliases;superscript-simple-exponent;self::superscript;children/superscript/children/*[2][text()="2"] or children/superscript/children/*[2][text()="3"];name(children/superscript/children/*[1])="fraction";contains(children/superscript/children/*[1]/@annotation, "clearspeak:simple")'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"superscript-simple-exponent",
|
|
"self::superscript",
|
|
'children/superscript/children/*[2][text()="2"] or children/superscript/children/*[2][text()="3"]',
|
|
'name(children/superscript/children/*[1])="identifier"',
|
|
],
|
|
'Aliases;superscript-simple-exponent;self::superscript;children/*[2][@role="implicit"];count(children/*[2]/children/*)=2;contains(children/*[2]/children/*[1]/@annotation, "simple");name(children/*[2]/children/*[2])="superscript";(name(children/*[2]/children/*[2]/children/*[1])="number" and contains(children/*[2]/children/*[2]/children/*[1]/@annotation, "clearspeak:simple")) or name(children/*[2]/children/*[2]/children/*[1])="identifier";children/*[2]/children/*[2]/children/*[2][text()="2"] or children/*[2]/children/*[2]/children/*[2][text()="3"]'.split(
|
|
";",
|
|
),
|
|
'Rule,superscript-ordinal,default,[n] children/*[1]; [t] "to the"; [n] children/*[2] (grammar:ordinal); [t] "power" (pause:"short"),self::superscript,name(children/*[2])="number",children/*[2][@role="integer"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"superscript-ordinal",
|
|
"self::superscript",
|
|
'name(children/*[2])="identifier"',
|
|
'children/*[2][@role="latinletter" or @role="greekletter" or @role="otherletter"]',
|
|
],
|
|
'Rule,superscript-non-ordinal,default,[n] children/*[1]; [t] "to the"; [n] children/*[2]; [t] "power" (pause:"short"),self::superscript,children/*[2][@role="negative"],name(children/*[2]/children/*[1])="number",children/*[2]/children/*[1][@role="integer"]'.split(
|
|
",",
|
|
),
|
|
'Rule{superscript-simple-function{default{[t] "the"; [n] children/*[2] (grammar:ordinal); [t] "power of" (pause:"short"); [n] children/*[1]{self::superscript{name(children/*[1])="identifier"{children/*[1][@role="simple function"]{children/*[2][@role!="prime"]{not(contains(@grammar, "functions_none"))'.split(
|
|
"{",
|
|
),
|
|
'Rule;superscript-simple-function;Functions_None;[n] . (grammar:functions_none);self::superscript;name(children/*[1])="identifier";children/*[1][@role="simple function"];not(contains(@grammar, "functions_none"))'.split(
|
|
";",
|
|
),
|
|
'Rule,superscript-ordinal,Exponent_Ordinal,[n] children/*[1]; [t] "to the"; [n] children/*[2] (grammar:ordinal); [p] (pause:"short"),self::superscript,name(children/*[2])="number",children/*[2][@role="integer"]'.split(
|
|
",",
|
|
),
|
|
'Rule,superscript-ordinal,Exponent_Ordinal,[n] children/*[1]; [t] "to the"; [n] children/*[2]; [p] (pause:"short"),self::superscript,name(children/*[2])="prefixop",children/*[2][@role="negative"],name(children/*[2]/children/*[1])="number",children/*[2]/children/*[1][@role="integer"]'.split(
|
|
",",
|
|
),
|
|
'Rule,superscript-ordinal,Exponent_Ordinal,[n] children/*[1]; [t] "to the"; [n] children/*[2] (grammar:ordinal); [p] (pause:"short"),self::superscript,name(children/*[2])="identifier",children/*[2][@role="latinletter" or @role="greekletter" or @role="otherletter"]'.split(
|
|
",",
|
|
),
|
|
'Rule,superscript-ordinal-default,Exponent_Ordinal,[n] children/*[1]; [t] "raised to the exponent" (pause:"short"); [n] children/*[2]; [p] (pause:"short"); [t] "end exponent" (pause:"short"),self::superscript,children//superscript'.split(
|
|
",",
|
|
),
|
|
'Rule,superscript-ordinal,Exponent_OrdinalPower,[n] children/*[1]; [t] "to the"; [n] children/*[2] (grammar:ordinal); [t] "power"; [p] (pause:"short"),self::superscript,name(children/*[2])="number",children/*[2][@role="integer"]'.split(
|
|
",",
|
|
),
|
|
'Rule,superscript-ordinal,Exponent_OrdinalPower,[n] children/*[1]; [t] "to the"; [n] children/*[2]; [t] "power"; [p] (pause:"short"),self::superscript,name(children/*[2])="prefixop",children/*[2][@role="negative"],name(children/*[2]/children/*[1])="number",children/*[2]/children/*[1][@role="integer"]'.split(
|
|
",",
|
|
),
|
|
'Rule,superscript-ordinal,Exponent_OrdinalPower,[n] children/*[1]; [t] "to the"; [n] children/*[2] (grammar:ordinal); [t] "power"; [p] (pause:"short"),self::superscript,name(children/*[2])="identifier",children/*[2][@role="latinletter" or @role="greekletter" or @role="otherletter"]'.split(
|
|
",",
|
|
),
|
|
'Rule,superscript-ordinal-default,Exponent_OrdinalPower,[n] children/*[1]; [t] "raised to the exponent" (pause:"short"); [n] children/*[2]; [p] (pause:"short"); [t] "end exponent" (pause:"short"),self::superscript,children//superscript'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"superscript-power",
|
|
"Exponent_AfterPower",
|
|
'[n] children/*[1]; [t] "raised to the power"; [n] children/*[2] (grammar:afterPower); [p] (pause:"short")',
|
|
"self::superscript",
|
|
],
|
|
'Rule,superscript-power-default,Exponent_AfterPower,[n] children/*[1]; [t] "raised to the exponent" (pause:"short"); [n] children/*[2]; [p] (pause:"short"); [t] "end exponent" (pause:"short"),self::superscript,children//superscript'.split(
|
|
",",
|
|
),
|
|
'Rule{exponent{default{[n] text() (join:"-"); [t] "th"{self::identifier{contains(@grammar, "ordinal")'.split(
|
|
"{",
|
|
),
|
|
'Rule;exponent;default;[t] CSFordinalExponent;self::number;@role="integer";contains(@grammar, "ordinal");text()!="0"'.split(
|
|
";",
|
|
),
|
|
'Rule;exponent;Exponent_Ordinal;[t] CSFwordOrdinal;self::number;@role="integer";contains(@grammar, "ordinal");text()!="0"'.split(
|
|
";",
|
|
),
|
|
'Rule;exponent;Exponent_Ordinal;[t] "zero";self::number;@role="integer";contains(@grammar, "ordinal");text()="0"'.split(
|
|
";",
|
|
),
|
|
'Rule;exponent;Exponent_OrdinalPower;[t] CSFwordOrdinal;self::number;@role="integer";contains(@grammar, "ordinal");text()!="0"'.split(
|
|
";",
|
|
),
|
|
'Rule;exponent;Exponent_OrdinalPower;[t] "zero";self::number;@role="integer";contains(@grammar, "ordinal");text()="0"'.split(
|
|
";",
|
|
),
|
|
'Rule,square,default,[n] children/*[1]; [t] "squared",self::superscript,@role!="unit",children/*[2][text()="2"],name(children/*[1])!="text" or not(name(children/*[1])="text" and (name(../../../punctuated[@role="text"]/..)="stree" or name(..)="stree")),self::*'.split(
|
|
",",
|
|
),
|
|
'Rule,cube,default,[n] children/*[1]; [t] "cubed",self::superscript,@role!="unit",children/*[2][text()="3"],name(children/*[1])!="text" or not(name(children/*[1])="text" and (name(../../../punctuated[@role="text"]/..)="stree" or name(..)="stree")),self::*'.split(
|
|
",",
|
|
),
|
|
'Rule;paren-simple;default;[n] children/*[1];self::fenced;@role="leftright";contains(children/*[1]/@annotation, "clearspeak:simple");name(../..)!="superscript" and name(../..)!="subscript"'.split(
|
|
";",
|
|
),
|
|
'Rule;paren-simple-exp;default;[n] children/*[1];self::fenced;@role="leftright";name(../..)="superscript";children/*[1][@role="integer"] or children/*[1][@role="float"] or (children/*[1][@role="vulgar"] and contains(children/*[1]/@annotation, "clearspeak:simple")) or children/*[1][@role="latinletter"] or children/*[1][@role="greekletter"] or children/*[1][@role="otherletter"]'.split(
|
|
";",
|
|
),
|
|
'Rule;paren-simple-nested-func;default;[n] children/*[1];self::fenced;@role="leftright";name(../*[1])="identifier" or name(../*[1])="function";parent::*/parent::*[@role="simple function" or @role="prefix function"];children/*[1][@role="simple function" or @role="prefix function"];contains(children/*[1]/children/*[2]/children/*[1]/@annotation, "clearspeak:simple") or name(children/*[1]/children/*[2]/children/*[1])="subscript" or name(children/*[1]/children/*[2]/children/*[1])="superscript" or children/*[1]/children/*[2]/children/*[1][@role="vulgar"] '.split(
|
|
";",
|
|
),
|
|
'Rule{paren-simple-nested-func-no-bracket{Functions_None{[n] children/*[1];{self::fenced{@role="leftright"{name(../*[1])="identifier" or name(../*[1])="function"{parent::*/parent::*[@role="simple function" or @role="prefix function"]{children/*[1][@role="simple function" or @role="prefix function"]{name(children/*[1]/children/*[1])="identifier" or name(children/*[1]/children/*[1])="function"{contains(children/*[1]/children/*[2]/children/*[1]/@annotation, "clearspeak:simple"){name(children/*[1]/children/*[2]/children/*[1])="identifier" or name(children/*[1]/children/*[2]/children/*[1])="number"'.split(
|
|
"{",
|
|
),
|
|
'Rule,fences-open-close,default,[p] (pause:"short"); [n] content/*[1] (grammar:spokenFence); [p] (pause:"short"); [n] children/*[1]; [p] (pause:"short"); [n] content/*[2] (grammar:spokenFence); [p] (pause:"short"),self::fenced,@role="leftright"'.split(
|
|
",",
|
|
),
|
|
'Rule{paren-simple-nested-func{default{[p] (pause:"short"); [n] content/*[1]; [p] (pause:"short"); [n] children/*[1]; [p] (pause:"short"); [n] content/*[2]; [p] (pause:"short"){self::fenced{@role="leftright"{name(../*[1])="identifier" or name(../*[1])="function"{parent::*/parent::*[@role="simple function" or @role="prefix function"]{not(contains(children/*[1]/@annotation, "clearspeak:simple"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{paren-simple-nested-func{Functions_None{[p] (pause:"short"); [n] content/*[1] (grammar:spokenFence); [p] (pause:"short"); [n] children/*[1]; [p] (pause:"short"); [n] content/*[2] (grammar:spokenFence); [p] (pause:"short"){self::fenced{@role="leftright"{name(../*[1])="identifier" or name(../*[1])="function"{parent::*/parent::*[@role="simple function" or @role="prefix function"]{children/*[1][@role="simple function" or @role="prefix function"]{contains(children/*[1]/children/*[2]/children/*[1]/@annotation, "clearspeak:simple") or name(children/*[1]/children/*[2]/children/*[1])="subscript" or name(children/*[1]/children/*[2]/children/*[1])="superscript" or children/*[1]/children/*[2]/children/*[1][@role="vulgar"] '.split(
|
|
"{",
|
|
),
|
|
["SpecializedRule", "fences-open-close", "default", "Paren_Speak"],
|
|
[
|
|
"Aliases",
|
|
"fences-open-close",
|
|
"self::fenced",
|
|
'@role="composed function"',
|
|
],
|
|
[
|
|
"Rule",
|
|
"fence-silent",
|
|
"Paren_Silent",
|
|
'[p] (pause:"short"); [n] children/*[1]; [p] (pause:"short")',
|
|
"self::fenced",
|
|
],
|
|
'Rule,fences-open-close,ImpliedTimes_None,[p] (pause:"short"); [n] content/*[1] (grammar:spokenFence); [p] (pause:"short"); [n] children/*[1]; [p] (pause:"short"); [n] content/*[2] (grammar:spokenFence); [p] (pause:"short"),self::fenced,@role="leftright",parent::*/parent::*[@role!="simple function"],parent::*/parent::*[@role!="prefix function"]'.split(
|
|
",",
|
|
),
|
|
'Rule;fence-nesting;Paren_SpeakNestingLevel;[n] text() (grammar:insertNesting=CSFnestingDepth);self::fence;contains(@grammar, "spokenFence");CQFmatchingFences'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"fence-no-nesting",
|
|
"Paren_SpeakNestingLevel",
|
|
"[n] text()",
|
|
"self::fence",
|
|
],
|
|
'Rule,fences-points,Paren_CoordPoint,[t] "the point with coordinates"; [n] children/*[1],self::fenced,name(children/*[1])="punctuated",children/*[1][@role="sequence"]'.split(
|
|
",",
|
|
),
|
|
'Rule{fences-interval{Paren_Interval{[t] "the interval from"; [n] children/*[1]/children/*[1]; [t] "to"; [n] children/*[1]/children/*[3]; [p] (pause:"short"); [n] . (grammar:interval){self::fenced{not(contains(@grammar, "interval")){name(children/*[1])="punctuated"{children/*[1][@role="sequence"]{count(./children/*[1]/content/*)=1{children/*[1]/content/*[1][@role="comma"]'.split(
|
|
"{",
|
|
),
|
|
'Rule{interval-open{Paren_Interval{[t] "not including"; [n] children/*[1]/children/*[1]; [t] "or"; [n] children/*[1]/children/*[3]{self::fenced{contains(@grammar, "interval"){content/*[1]/text()="("{content/*[2]/text()=")"'.split(
|
|
"{",
|
|
),
|
|
'Rule{interval-closed-open{Paren_Interval{[t] "including"; [n] children/*[1]/children/*[1]; [p] (pause:"short"); [t] "but not including"; [n] children/*[1]/children/*[3]{self::fenced{contains(@grammar, "interval"){content/*[1]/text()="["{content/*[2]/text()=")"'.split(
|
|
"{",
|
|
),
|
|
'Rule{interval-open-closed{Paren_Interval{[t] "not including"; [n] children/*[1]/children/*[1]; [p] (pause:"short"); [t] "but including"; [n] children/*[1]/children/*[3]{self::fenced{contains(@grammar, "interval"){content/*[1]/text()="("{content/*[2]/text()="]"'.split(
|
|
"{",
|
|
),
|
|
'Rule{interval-closed{Paren_Interval{[t] "including"; [n] children/*[1]/children/*[1]; [t] "and"; [n] children/*[1]/children/*[3]{self::fenced{contains(@grammar, "interval"){content/*[1]/text()="["{content/*[2]/text()="]"'.split(
|
|
"{",
|
|
),
|
|
'Rule{interval-open-inf-r{Paren_Interval{[t] "not including"; [n] children/*[1]/children/*[1]{self::fenced{contains(@grammar, "interval"){content/*[1]/text()="("{content/*[2]/text()=")"{children/*[1]/children/*[3]/text()="\u221e" or (name(children/*[1]/children/*[3])="prefixop" and children/*[1]/children/*[3]/children/*[1]/text()="\u221e")'.split(
|
|
"{",
|
|
),
|
|
'Rule{interval-open-inf-l{Paren_Interval{[t] "not including"; [n] children/*[1]/children/*[3]{self::fenced{contains(@grammar, "interval"){content/*[1]/text()="("{content/*[2]/text()=")"{children/*[1]/children/*[1]/text()="\u221e" or (name(children/*[1]/children/*[1])="prefixop" and children/*[1]/children/*[1]/children/*[1]/text()="\u221e")'.split(
|
|
"{",
|
|
),
|
|
'Rule;interval-open-inf-lr;Paren_Interval;;self::fenced;contains(@grammar, "interval");content/*[1]/text()="(";content/*[2]/text()=")";children/*[1]/children/*[3]/text()="\u221e" or (name(children/*[1]/children/*[3])="prefixop" and children/*[1]/children/*[3]/children/*[1]/text()="\u221e");children/*[1]/children/*[1]/text()="\u221e" or (name(children/*[1]/children/*[1])="prefixop" and children/*[1]/children/*[1]/children/*[1]/text()="\u221e")'.split(
|
|
";",
|
|
),
|
|
'Rule{interval-closed-open-inf{Paren_Interval{[t] "including"; [n] children/*[1]/children/*[1]{self::fenced{contains(@grammar, "interval"){content/*[1]/text()="["{content/*[2]/text()=")"{children/*[1]/children/*[3]/text()="\u221e" or (name(children/*[1]/children/*[3])="prefixop" and children/*[1]/children/*[3]/children/*[1]/text()="\u221e")'.split(
|
|
"{",
|
|
),
|
|
'Rule{interval-open-closed-inf{Paren_Interval{[t] "including"; [n] children/*[1]/children/*[3]{self::fenced{contains(@grammar, "interval"){content/*[1]/text()="("{content/*[2]/text()="]"{children/*[1]/children/*[1]/text()="\u221e" or (name(children/*[1]/children/*[1])="prefixop" and children/*[1]/children/*[1]/children/*[1]/text()="\u221e")'.split(
|
|
"{",
|
|
),
|
|
'Rule,paren-nested-embellished-funcs,Functions_None,[p] (pause:"short"); [n] content/*[1]; [p] (pause:"short"); [n] children/*[1]; [p] (pause:"short"); [n] content/*[2]; [p] (pause:"short"),self::fenced,@role="leftright",name(../..)="appl",name(children/*[1]) = "appl",preceding-sibling::*/descendant-or-self::*[@role="subsup"] or children/*[1]/descendant-or-self::*[@role="subsup"]'.split(
|
|
",",
|
|
),
|
|
'Rule;set-empty;default;[t] "the empty set";self::fenced;@role="set empty"'.split(
|
|
";",
|
|
),
|
|
'Rule,set-extended,default,[t] "the set of all"; [n] children/*[1]/children/*[1]; [t] "such that"; [n] children/*[1]/children/*[3],self::fenced,@role="set extended"'.split(
|
|
",",
|
|
),
|
|
'Rule,set-collection,default,[t] "the set"; [n] children/*[1],self::fenced,@role="set collection"'.split(
|
|
",",
|
|
),
|
|
["Aliases", "set-collection", "self::fenced", '@role="set singleton"'],
|
|
'Rule,set-extended,Sets_woAll,[t] "the set of"; [n] children/*[1]/children/*[1]; [t] "such that"; [n] children/*[1]/children/*[3],self::fenced,@role="set extended"'.split(
|
|
",",
|
|
),
|
|
'Rule;set-collection;Sets_SilentBracket;[n] children/*[1];self::fenced;@role="set collection"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"subscript",
|
|
"default",
|
|
'[p] (pause:short); [n] children/*[1]; [t] "sub"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::subscript",
|
|
],
|
|
'Rule,subscript-base,default,[n] children/*[1]; [t] "base"; [n] children/*[2],self::subscript,CQFisLogarithm'.split(
|
|
",",
|
|
),
|
|
'Rule{subscript-index{default{[n] children/*[1]; [t] "sub"; [n] children/*[2]{self::subscript{contains(@grammar, "simpleDet")'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"default",
|
|
'[p] (pause:short); [t] "the fraction with numerator"; [n] children/*[1]; [p] (pause:short); [t] "and denominator"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::fraction",
|
|
],
|
|
'Rule,fraction,Functions_None,[p] (pause:short); [t] "the fraction with numerator"; [n] children/*[1]; [p] (pause:short); [t] "and denominator"; [n] children/*[2]; [p] (pause:short),self::fraction,name(children/*[1])="appl" or name(children/*[2])="appl"'.split(
|
|
",",
|
|
),
|
|
'Rule{simple-fraction{default{[p] (pause:short); [n] children/*[1]; [t] "over"; [n] children/*[2]; [p] (pause:short){self::fraction{contains(children/*[1]/@annotation, "clearspeak:simple") or contains(children/*[1]/@annotation, "clearspeak:unit"){contains(children/*[2]/@annotation, "clearspeak:simple") or contains(children/*[2]/@annotation, "clearspeak:unit")'.split(
|
|
"{",
|
|
),
|
|
'Rule,simple-vulgar-fraction,default,[p] (pause:short); [n] children/*[1]; [t] "over"; [n] children/*[2]; [p] (pause:short),self::fraction,@role="vulgar"'.split(
|
|
",",
|
|
),
|
|
'Rule,simple-text-fraction,default,[p] (pause:short); [n] children/*[1]; [t] "over"; [n] children/*[2]; [p] (pause:short),self::fraction,name(children/*[1])="text",name(children/*[2])="text"'.split(
|
|
",",
|
|
),
|
|
'Rule,simple-text-fraction,default,[p] (pause:short); [n] children/*[1]; [t] "over"; [n] children/*[2]; [p] (pause:short),self::fraction,name(children/*[1])="infixop",children/*[1][@role="unit"],name(children/*[2])="text"'.split(
|
|
",",
|
|
),
|
|
'Rule;vulgar-fraction;default;[t] CSFvulgarFraction;self::fraction;@role="vulgar";CQFvulgarFractionSmall'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"Fraction_Over",
|
|
'[p] (pause:short); [n] children/*[1]; [t] "over"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::fraction",
|
|
],
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"Fraction_OverEndFrac",
|
|
'[p] (pause:short); [n] children/*[1]; [t] "over"; [n] children/*[2]; [p] (pause:short); [t] "end fraction"; [p] (pause:short)',
|
|
"self::fraction",
|
|
],
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"Fraction_FracOver",
|
|
'[p] (pause:short); [t] "the fraction"; [n] children/*[1]; [t] "over"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::fraction",
|
|
],
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"Fraction_Per",
|
|
'[p] (pause:short); [n] children/*[1]; [t] "per"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::fraction",
|
|
],
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"Fraction_GeneralEndFrac",
|
|
'[p] (pause:short); [t] "the fraction with numerator"; [n] children/*[1]; [p] (pause:short); [t] "and denominator"; [n] children/*[2]; [p] (pause:short); [t] "end fraction"; [p] (pause:short)',
|
|
"self::fraction",
|
|
],
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"Fraction_General",
|
|
'[p] (pause:short); [t] "the fraction with numerator"; [n] children/*[1]; [p] (pause:short); [t] "and denominator"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::fraction",
|
|
],
|
|
'Rule;simple-vulgar-fraction;Fraction_Ordinal;[t] CSFvulgarFraction;self::fraction;@role="vulgar"'.split(
|
|
";",
|
|
),
|
|
'Rule{fraction{Fraction_EndFrac{[p] (pause:short); [n] . (grammar:endfrac); [t] "end fraction"; [p] (pause:short){self::fraction{not(contains(@grammar, "endfrac")){not(contains(children/*[1]/@annotation, "clearspeak:unit")){not(contains(children/*[2]/@annotation, "clearspeak:unit"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{vulgar-fraction{Fraction_EndFrac{[p] (pause:short); [n] children/*[1]; [t] "over"; [n] children/*[2]; [p] (pause:short){self::fraction{name(children/*[1])="fraction"{name(children/*[2])="fraction"{contains(children/*[1]/@annotation, "clearspeak:simple"){contains(children/*[2]/@annotation, "clearspeak:simple")'.split(
|
|
"{",
|
|
),
|
|
'Rule;simple-vulgar-fraction;Fraction_EndFrac;[t] CSFvulgarFraction;self::fraction;@role="vulgar";contains(@annotation, "clearspeak:simple");self::*'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"sqrt",
|
|
"default",
|
|
'[t] "the square root of"; [n] children/*[1] (grammar:EndRoot=false); [p] (pause:short)',
|
|
"self::sqrt",
|
|
],
|
|
'Rule,sqrt-nested,default,[p] (pause: "short"); [t] "the square root of"; [n] children/*[1] (grammar:EndRoot=false); [p] (pause:short),self::sqrt,not(preceding-sibling::*),ancestor::sqrt|ancestor::root'.split(
|
|
",",
|
|
),
|
|
'Rule,negative-sqrt,default,[t] "the negative square root of"; [n] children/*[1]/children/*[1] (grammar:EndRoot=false); [p] (pause:short),self::prefixop,@role="negative",name(children/*[1])="sqrt"'.split(
|
|
",",
|
|
),
|
|
'Rule,negative-sqrt,default,[p] (pause: "short"); [t] "the negative square root of"; [n] children/*[1]/children/*[1] (grammar:EndRoot=false); [p] (pause:short),self::prefixop,@role="negative",name(children/*[1])="sqrt",not(preceding-sibling::*),ancestor::sqrt|ancestor::root'.split(
|
|
",",
|
|
),
|
|
'Rule,sqrt-plus-minus,Roots_PosNegSqRoot,[t] "the positive square root of"; [n] children/*[1] (grammar:EndRoot=false); [p] (pause:short),self::sqrt,parent::stree or not(parent::*/parent::infixop[@role="addition"]) or (parent::*/parent::*[1]/text()!="\u00b1" and parent::*/parent::*/text()!="\u2213")'.split(
|
|
",",
|
|
),
|
|
'Rule,sqrt-nested-plus-minus,Roots_PosNegSqRoot,[p] (pause: "short"); [t] "the positive square root of"; [n] children/*[1] (grammar:EndRoot=false); [p] (pause:short),self::sqrt,not(preceding-sibling::*),ancestor::sqrt|ancestor::root,parent::stree or not(parent::*/parent::infixop[@role="addition"]) or (parent::*/parent::*[1]/text()!="\u00b1" and parent::*/parent::*/text()!="\u2213")'.split(
|
|
",",
|
|
),
|
|
'Rule,sqrt-plus-minus,Roots_PosNegSqRootEnd,[t] "the positive square root of"; [n] children/*[1] (grammar:EndRoot=false); [p] (pause:short),self::sqrt,parent::stree or not(parent::*/parent::infixop[@role="addition"]) or (parent::*/parent::*[1]/text()!="\u00b1" and parent::*/parent::*/text()!="\u2213")'.split(
|
|
",",
|
|
),
|
|
'Rule,sqrt-nested-plus-minus,Roots_PosNegSqRootEnd,[p] (pause: "short"); [t] "the positive square root of"; [n] children/*[1] (grammar:EndRoot=false); [p] (pause:short),self::sqrt,not(preceding-sibling::*),ancestor::sqrt|ancestor::root,parent::stree or not(parent::*/parent::infixop[@role="addition"]) or (parent::*/parent::*[1]/text()!="\u00b1" and parent::*/parent::*/text()!="\u2213")'.split(
|
|
",",
|
|
),
|
|
'Rule{sqrt-endroot{Roots_RootEnd{[n] . (grammar:EndRoot); [t] "end root"; [p] (pause:short){self::sqrt{not(contains(@grammar, "EndRoot"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{negative-sqrt-endroot{Roots_RootEnd{[n] . (grammar:EndRoot); [t] "end root"; [p] (pause:short){self::prefixop{@role="negative"{name(children/*[1])="sqrt"{not(contains(@grammar, "EndRoot"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{sqrt-endroot{Roots_PosNegSqRootEnd{[n] . (grammar:EndRoot); [t] "end root"; [p] (pause:short){self::sqrt{not(contains(@grammar, "EndRoot"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{negative-sqrt-endroot{Roots_PosNegSqRootEnd{[n] . (grammar:EndRoot); [t] "end root"; [p] (pause:short){self::prefixop{@role="negative"{name(children/*[1])="sqrt"{not(contains(@grammar, "EndRoot"))'.split(
|
|
"{",
|
|
),
|
|
'Rule,cube,default,[t] "the cube root of"; [n] children/*[2] (grammar:EndRoot=false); [p] (pause:short),self::root,children/*[1][text()="3"]'.split(
|
|
",",
|
|
),
|
|
'Rule,cube-nested,default,[p] (pause:short); [t] "the cube root of"; [n] children/*[2] (grammar:EndRoot=false); [p] (pause:short),self::root,children/*[1][text()="3"],not(preceding-sibling::*),ancestor::sqrt|ancestor::root'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"root",
|
|
"default",
|
|
'[t] "the"; [n] children/*[1] (grammar:ordinal); [t] "root of"; [n] children/*[2] (grammar:EndRoot=false); [p] (pause:short)',
|
|
"self::root",
|
|
],
|
|
'Rule,root-nested,default,[p] (pause:short); [t] "the"; [n] children/*[1] (grammar:ordinal); [t] "root of"; [n] children/*[2] (grammar:EndRoot=false); [p] (pause:short),self::root,not(preceding-sibling::*),ancestor::sqrt|ancestor::root'.split(
|
|
",",
|
|
),
|
|
'Rule{root-endroot{Roots_RootEnd{[n] . (grammar:EndRoot); [t] "end root"; [p] (pause:short){self::root{not(contains(@grammar, "EndRoot"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{root-endroot{Roots_PosNegSqRootEnd{[n] . (grammar:EndRoot); [t] "end root"; [p] (pause:short){self::root{not(contains(@grammar, "EndRoot"))'.split(
|
|
"{",
|
|
),
|
|
'Rule,negative,default,[t] "negative"; [n] children/*[1],self::prefixop,@role="negative"'.split(
|
|
",",
|
|
),
|
|
'Rule,positive,default,[t] "positive"; [n] children/*[1],self::prefixop,@role="positive"'.split(
|
|
",",
|
|
),
|
|
'Rule,angle-measure,default,[t] "the measure of"; [n] content/*[1]; [n] children/*[2] (grammar:angle),self::infixop,content/*[1]/text()="\u2220",children/*[1][text()="m"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"prefix",
|
|
"default",
|
|
"[m] content/* (grammar:prefix); [n] children/*[1]",
|
|
"self::prefixop",
|
|
],
|
|
[
|
|
"Rule",
|
|
"postfix",
|
|
"default",
|
|
"[n] children/*[1]; [m] content/* (grammar:postfix)",
|
|
"self::postfixop",
|
|
],
|
|
'Rule{set-prefix-operators{default{[t] "the"; [n] self::* (grammar:!prefix); [t] "of"{self::*{contains(@grammar,"prefix"){descendant-or-self::*/text()="\u2229" or descendant-or-self::*/text()="\u222a"{self::*{self::*{self::*'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"binary-operation",
|
|
"default",
|
|
"[m] children/* (sepFunc:CTXFcontentIterator);",
|
|
"self::infixop",
|
|
],
|
|
'Rule,binary-operation,ImpliedTimes_MoreImpliedTimes,[m] children/* (sepFunc:CTXFcontentIterator);,self::infixop,@role="implicit"'.split(
|
|
",",
|
|
),
|
|
'Rule,binary-operation-pause,default,[p] (pause:short); [m] children/* (sepFunc:CTXFcontentIterator);,self::infixop,@role="implicit",name(children/*[1])="appl"'.split(
|
|
",",
|
|
),
|
|
'Rule,binary-operation-pause,default,[m] children/* (sepFunc:CTXFcontentIterator); [p] (pause:short),self::infixop,@role="implicit",name(children/*[last()])="appl"'.split(
|
|
",",
|
|
),
|
|
'Rule,binary-operation-pause,default,[p] (pause:short); [m] children/* (sepFunc:CTXFcontentIterator); [p] (pause:short),self::infixop,@role="implicit",name(children/*[1])="appl",name(children/*[last()])="appl"'.split(
|
|
",",
|
|
),
|
|
'Rule;implicit-times;default;[p] (pause:short);self::operator;@role="multiplication";text()="\u2062"'.split(
|
|
";",
|
|
),
|
|
'Rule implicit-times default self::operator @role="multiplication" text()="\u2062" CQFsimpleArguments'.split(
|
|
" ",
|
|
),
|
|
'Rule;implicit-times;default;[n] text();self::operator;@role="multiplication";text()="\u2062";CQFfencedArguments'.split(
|
|
";",
|
|
),
|
|
'Rule;implicit-times;ImpliedTimes_MoreImpliedTimes;[n] text();self::operator;@role="multiplication";text()="\u2062"'.split(
|
|
";",
|
|
),
|
|
'Rule implicit-times ImpliedTimes_None self::operator @role="multiplication" text()="\u2062"'.split(
|
|
" ",
|
|
),
|
|
'Rule{binary-operation-simple{default{[m] children/* (rate:"0.5"); [p] (pause:short){self::infixop{@role="implicit"{contains(@annotation, "clearspeak:simple"){not(contains(@grammar, "inFrac"))'.split(
|
|
"{",
|
|
),
|
|
'Rule;simple-in-fraction;default;[n] . (rate:"0.5",grammar:inFrac);self::*;contains(@annotation, "clearspeak:simple");not(contains(@grammar, "inFrac"));name(.)!="identifier";name(.)!="function";name(.)!="number";name(parent::*/parent::*)="fraction";not(preceding-sibling::*)'.split(
|
|
";",
|
|
),
|
|
'Rule;operators-after-power;Exponent_AfterPower;[m] children/* (rate:"0.5");self::infixop;@role="implicit";contains(@grammar, "afterPower")'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"relseq",
|
|
"default",
|
|
"[m] children/* (sepFunc:CTXFcontentIterator)",
|
|
"self::relseq",
|
|
],
|
|
[
|
|
"Rule",
|
|
"multrel",
|
|
"default",
|
|
"[m] children/* (sepFunc:CTXFcontentIterator)",
|
|
"self::multirel",
|
|
],
|
|
'Rule;natural-numbers;default;[t] "the natural numbers";self::identifier;text()="\u2115" or (text()="N" and @font="double-struck");self::*;self::*;self::*'.split(
|
|
";",
|
|
),
|
|
'Rule;integers;default;[t] "the integers";self::identifier;text()="\u2124" or (text()="Z" and @font="double-struck");self::*;self::*;self::*'.split(
|
|
";",
|
|
),
|
|
'Rule;rational-numbers;default;[t] "the rational numbers";self::identifier;text()="\u211a" or (text()="Q" and @font="double-struck");self::*;self::*;self::*'.split(
|
|
";",
|
|
),
|
|
'Rule;real-numbers;default;[t] "the real numbers";self::identifier;text()="\u211d" or (text()="R" and @font="double-struck");self::*;self::*;self::*'.split(
|
|
";",
|
|
),
|
|
'Rule;complex-numbers;default;[t] "the complex numbers";self::identifier;text()="\u2102" or (text()="C" and @font="double-struck");self::*;self::*;self::*'.split(
|
|
";",
|
|
),
|
|
'Rule,natural-numbers-super,default,[t] "n" (join: "-"); [n] children/*[2] (grammar:numbers2alpha),self::superscript,children/*[1]/text()="\u2115" or (children/*[1]/text()="N" and children/*[1]/@font="double-struck"),self::*,self::*,self::*'.split(
|
|
",",
|
|
),
|
|
'Rule,integers-super,default,[t] "z" (join: "-"); [n] children/*[2] (grammar:numbers2alpha),self::superscript,children/*[1]/text()="\u2124" or (children/*[1]/text()="Z" and children/*[1]/@font="double-struck"),self::*,self::*,self::*'.split(
|
|
",",
|
|
),
|
|
'Rule,rational-numbers-super,default,[t] "q" (join: "-"); [n] children/*[2] (grammar:numbers2alpha),self::superscript,children/*[1]/text()="\u211a" or (children/*[1]/text()="Q" and children/*[1]/@font="double-struck"),self::*,self::*,self::*'.split(
|
|
",",
|
|
),
|
|
'Rule,real-numbers-super,default,[t] "r" (join:"-"); [n] children/*[2] (grammar:numbers2alpha),self::superscript,children/*[1]/text()="\u211d" or (children/*[1]/text()="R" and children/*[1]/@font="double-struck"),self::*,self::*,self::*'.split(
|
|
",",
|
|
),
|
|
'Rule,complex-numbers-super,default,[t] "c" (join:"-"); [n] children/*[2] (grammar:numbers2alpha),self::superscript,children/*[1]/text()="\u2102" or (children/*[1]/text()="C" and children/*[1]/@font="double-struck"),self::*,self::*,self::*'.split(
|
|
",",
|
|
),
|
|
'Rule;natural-numbers-with-zero;default;[t] "the natural numbers with zero";self::subscript;children/*[1]/text()="\u2115" or (children/*[1]/text()="N" and children/*[1]/@font="double-struck");children/*[2]/text()="0"'.split(
|
|
";",
|
|
),
|
|
'Rule;positive-integers;default;[t] "the positive integers";self::superscript;children/*[1]/text()="\u2124" or (children/*[1]/text()="Z" and children/*[1]/@font="double-struck");children/*[2]/text()="+";self::*;self::*;self::*'.split(
|
|
";",
|
|
),
|
|
'Rule;positive-integers;default;[t] "the negative integers";self::superscript;children/*[1]/text()="\u2124" or (children/*[1]/text()="Z" and children/*[1]/@font="double-struck");children/*[2]/text()="-";self::*;self::*;self::*'.split(
|
|
";",
|
|
),
|
|
'Rule;positive-rational-numbers;default;[t] "the positive rational numbers";self::superscript;children/*[1]/text()="\u211a" or (children/*[1]/text()="Q" and children/*[1]/@font="double-struck");children/*[2]/text()="+";self::*;self::*;self::*'.split(
|
|
";",
|
|
),
|
|
'Rule;negative-rational-numbers;default;[t] "the negative rational numbers";self::superscript;children/*[1]/text()="\u211a" or (children/*[1]/text()="Q" and children/*[1]/@font="double-struck");children/*[2]/text()="-";self::*;self::*;self::*'.split(
|
|
";",
|
|
),
|
|
'Rule,fences-neutral,default,[p] (pause:short); [t] "the absolute value of"; [n] children/*[1]; [p] (pause: short),self::fenced,@role="neutral",content/*[1][text()]="|" or content/*[1][text()]="\u2758" or content/*[1][text()]="\uff5c"'.split(
|
|
",",
|
|
),
|
|
'Rule,fences-neutral,AbsoluteValue_AbsEnd,[p] (pause:short); [t] "the absolute value of"; [n] children/*[1]; [p] (pause: short); [t] "end absolute value"; [p] (pause: short),self::fenced,@role="neutral",content/*[1][text()]="|" or content/*[1][text()]="\u2758" or content/*[1][text()]="\uff5c"'.split(
|
|
",",
|
|
),
|
|
'Rule,fences-neutral,AbsoluteValue_Cardinality,[p] (pause:short); [t] "the cardinality of"; [n] children/*[1]; [p] (pause: short),self::fenced,@role="neutral",content/*[1][text()]="|" or content/*[1][text()]="\u2758" or content/*[1][text()]="\uff5c"'.split(
|
|
",",
|
|
),
|
|
'Rule,fences-neutral,AbsoluteValue_Determinant,[p] (pause:short); [t] "the determinant of"; [n] children/*[1]; [p] (pause: short),self::fenced,@role="neutral",content/*[1][text()]="|" or content/*[1][text()]="\u2758" or content/*[1][text()]="\uff5c"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"matrix",
|
|
"default",
|
|
'[t] "the"; [t] count(children/*); [t] "by";[t] count(children/*[1]/children/*); [t] "matrix"; [p] (pause:long); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"Row-:"); [p] (pause:long)',
|
|
"self::matrix",
|
|
],
|
|
'Rule{matrix-simple{default{[t] "the"; [t] count(children/*); [t] "by";[t] count(children/*[1]/children/*); [t] "matrix"; [p] (pause:long); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"Row-:",grammar:simpleDet); [p] (pause:long){self::matrix{count(children/*)<4{count(children/*[1]/children/*)<4{CQFcellsSimple'.split(
|
|
"{",
|
|
),
|
|
'Rule,matrix-trivial,default,[t] "the 1 by 1 matrix with entry"; [n] children/*[1]; [p] (pause:long),self::vector,@role="squarematrix"'.split(
|
|
",",
|
|
),
|
|
'Rule{determinant{default{[t] "the determinant of the"; [t] count(children/*); [t] "by";[t] count(children/*[1]/children/*); [t] "matrix"; [p] (pause:long); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"Row-:",grammar:simpleDet); [p] (pause:long){self::matrix{@role="determinant"{count(children/*)<4{CQFcellsSimple'.split(
|
|
"{",
|
|
),
|
|
'Rule{determinant-simple{default{[t] "the determinant of the"; [t] count(children/*); [t] "by";[t] count(children/*[1]/children/*); [t] "matrix"; [p] (pause:long); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"Row-:"); [p] (pause:long){self::matrix{@role="determinant"'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"matrix-vector",
|
|
"default",
|
|
'[t] "the"; [t] count(children/*); [t] "by";[t] count(children/*[1]/children/*); [t] "column matrix"; [p] (pause:long); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"Row-:",grammar:simpleDet); [p] (pause:long)',
|
|
"self::vector",
|
|
],
|
|
["SpecializedRule", "matrix-vector", "default", "Matrix_SpeakColNum"],
|
|
'Rule{matrix-vector-simple{default{[t] "the"; [t] count(children/*); [t] "by";[t] count(children/*[1]/children/*); [t] "column matrix"; [p] (pause:long); [m] children/* (sepFunc:CTXFpauseSeparator,separator:"short",grammar:simpleDet); [p] (pause:long){self::vector{count(children/*)<4{CQFcellsSimple{@role!="squarematrix"'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"matrix-vector-simple",
|
|
"Matrix_SilentColNum",
|
|
'[t] "the"; [t] count(children/*); [t] "by";[t] count(children/*[1]/children/*); [t] "column matrix"; [p] (pause:long); [m] children/* (sepFunc:CTXFpauseSeparator,separator:"short",grammar:simpleDet); [p] (pause:long)',
|
|
"self::vector",
|
|
],
|
|
'Rule{matrix-row-vector{default{[t] "the"; [t] count(children/*); [t] "by";[t] count(children/*[1]/children/*); [t] "row matrix"; [p] (pause:long); [m] children/*[1]/children/* (ctxtFunc:CTXFnodeCounter,context:"Column-:",grammar:simpleDet); [p] (pause:long){self::matrix{@role="rowvector"'.split(
|
|
"{",
|
|
),
|
|
["SpecializedRule", "matrix-row-vector", "default", "Matrix_SpeakColNum"],
|
|
'Rule{matrix-row-vector-simple{default{[t] "the"; [t] count(children/*); [t] "by";[t] count(children/*[1]/children/*); [t] "row matrix"; [p] (pause:long); [m] children/*[1]/children/* (sepFunc:CTXFpauseSeparator,separator:"short",grammar:simpleDet); [p] (pause:long){self::matrix{@role="rowvector"{count(children/*[1]/children/*)<4{CQFcellsSimple'.split(
|
|
"{",
|
|
),
|
|
'Rule{matrix-row-vector-simple{Matrix_SilentColNum{[t] "the"; [t] count(children/*); [t] "by";[t] count(children/*[1]/children/*); [t] "row matrix"; [p] (pause:long); [m] children/*[1]/children/* (sepFunc:CTXFpauseSeparator,separator:"short",grammar:simpleDet); [p] (pause:long){self::matrix{@role="rowvector"'.split(
|
|
"{",
|
|
),
|
|
'Rule;matrix-row-simple;default;[m] children/* (sepFunc:CTXFpauseSeparator,separator:"short");self::row;contains(@grammar, "simpleDet")'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"matrix-row-simple",
|
|
"Matrix_SilentColNum",
|
|
'[m] children/* (sepFunc:CTXFpauseSeparator,separator:"short")',
|
|
"self::row",
|
|
],
|
|
'Rule;line-simple;default;[n] children/*[1];self::line;contains(@grammar, "simpleDet")'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"matrix-row",
|
|
"default",
|
|
'[m] children/* (ctxtFunc:CTXFnodeCounter,context:"Column-,- ",sepFunc:CTXFpauseSeparator,separator:"medium"); [p] (pause:long)',
|
|
"self::row",
|
|
],
|
|
["SpecializedRule", "matrix-row", "default", "Matrix_SpeakColNum"],
|
|
["Rule", "matrix-cell", "default", "[n] children/*[1]", "self::cell"],
|
|
'Rule{matrix-end-matrix{Matrix_EndMatrix{[n] . (grammar:EndMatrix); [t] "end matrix"{self::matrix{not(contains(@grammar, "EndMatrix"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{matrix-end-vector{Matrix_EndMatrix{[n] . (grammar:EndMatrix); [t] "end matrix"{self::vector{not(contains(@grammar, "EndMatrix"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{matrix-end-determinant{Matrix_EndMatrix{[n] . (grammar:EndMatrix); [t] "end determinant"{self::matrix{@role="determinant"{not(contains(@grammar, "EndMatrix"))'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"vector",
|
|
"Matrix_Vector",
|
|
'[t] "the"; [t] count(children/*); [t] "by";[t] count(children/*[1]/children/*); [t] "column vector"; [p] (pause:long); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"Row-:",grammar:simpleDet); [p] (pause:long)',
|
|
"self::vector",
|
|
],
|
|
["SpecializedRule", "vector", "Matrix_Vector", "Matrix_EndVector"],
|
|
'Rule{vector-simple{Matrix_Vector{[t] "the"; [t] count(children/*); [t] "by"; [t] count(children/*[1]/children/*); [t] "column vector"; [p] (pause:long); [m] children/* (sepFunc:CTXFpauseSeparator,separator:"short",grammar:simpleDet); [p] (pause:long){self::vector{count(children/*)<4{CQFcellsSimple'.split(
|
|
"{",
|
|
),
|
|
["SpecializedRule", "vector-simple", "Matrix_Vector", "Matrix_EndVector"],
|
|
'Rule{row-vector{Matrix_Vector{[t] "the"; [t] count(children/*); [t] "by";[t] count(children/*[1]/children/*); [t] "row vector"; [p] (pause:long); [m] children/*[1]/children/* (ctxtFunc:CTXFnodeCounter,context:"Column-:",grammar:simpleDet); [p] (pause:long){self::matrix{@role="rowvector"'.split(
|
|
"{",
|
|
),
|
|
["SpecializedRule", "row-vector", "Matrix_Vector", "Matrix_EndVector"],
|
|
'Rule{row-vector-simple{Matrix_Vector{[t] "the"; [t] count(children/*); [t] "by";[t] count(children/*[1]/children/*); [t] "row vector"; [p] (pause:long); [m] children/*[1]/children/* (sepFunc:CTXFpauseSeparator,separator:"short",grammar:simpleDet); [p] (pause:long){self::matrix{@role="rowvector"{count(children/*[1]/children/*)<4{CQFcellsSimple'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"row-vector-simple",
|
|
"Matrix_Vector",
|
|
"Matrix_EndVector",
|
|
],
|
|
'Rule{vector-end-matrix{Matrix_EndVector{[n] . (grammar:EndMatrix); [t] "end matrix"{self::matrix{not(contains(@grammar, "EndMatrix")){self::*'.split(
|
|
"{",
|
|
),
|
|
'Rule{vector-end-vector{Matrix_EndVector{[n] . (grammar:EndMatrix); [t] "end vector"{self::vector{not(contains(@grammar, "EndMatrix")){self::*'.split(
|
|
"{",
|
|
),
|
|
'Rule{vector-end-vector{Matrix_EndVector{[n] . (grammar:EndMatrix); [t] "end vector"{self::matrix{@role="rowvector"{not(contains(@grammar, "EndMatrix")){self::*'.split(
|
|
"{",
|
|
),
|
|
'Rule{vector-end-determinant{Matrix_EndVector{[n] . (grammar:EndMatrix); [t] "end determinant"{self::matrix{@role="determinant"{not(contains(@grammar, "EndMatrix")){self::*'.split(
|
|
"{",
|
|
),
|
|
'Rule,binomial,Matrix_Combinatoric,[n] children/*[1]/children/*[1]; [t] "choose"; [n] children/*[2]/children/*[1]; ,self::vector,@role="binomial"'.split(
|
|
",",
|
|
),
|
|
'Rule{lines-summary{default{[p] (pause:short); [t] count(children/*); [t] "lines"; [n] . (grammar:layoutSummary){self::multiline{not(contains(@grammar, "layoutSummary")){self::*'.split(
|
|
"{",
|
|
),
|
|
'Rule;lines-summary;MultiLineOverview_None;[n] . (grammar:layoutSummary);self::multiline;not(contains(@grammar, "layoutSummary"));self::*'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"lines-summary",
|
|
"self::table",
|
|
'not(contains(@grammar, "layoutSummary"))',
|
|
],
|
|
'Rule{cases-summary{default{[p] (pause:short); [t] count(children/*); [t] "cases"; [n] . (grammar:layoutSummary){self::cases{not(contains(@grammar, "layoutSummary"))'.split(
|
|
"{",
|
|
),
|
|
'Rule;cases-summary;MultiLineOverview_None;[n] . (grammar:layoutSummary);self::cases;not(contains(@grammar, "layoutSummary"));self::*'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"lines",
|
|
"default",
|
|
'[p] (pause:short); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"Line-:",sepFunc:CTXFpauseSeparator,separator:"long"); [p] (pause:long)',
|
|
"self::table",
|
|
],
|
|
["Aliases", "lines", "self::multiline"],
|
|
["Rule", "line", "default", "[n] children/*[1]", "self::line"],
|
|
'Rule;row-medium;default;[m] children/* (sepFunc:CTXFpauseSeparator,separator:"medium");self::row;@role="table"'.split(
|
|
";",
|
|
),
|
|
["Aliases", "row-medium", "self::row", '@role="cases"'],
|
|
'Rule;row-long;MultiLinePausesBetweenColumns_Long;[m] children/* (sepFunc:CTXFpauseSeparator,separator:"long");self::row;@role="table"'.split(
|
|
";",
|
|
),
|
|
["Aliases", "row-long", "self::row", '@role="cases"'],
|
|
'Rule;row-short;MultiLinePausesBetweenColumns_Short;[m] children/* (sepFunc:CTXFpauseSeparator,separator:"short");self::row;@role="table"'.split(
|
|
";",
|
|
),
|
|
["Aliases", "row-short", "self::row", '@role="cases"'],
|
|
'Rule;blank-cell;default;[t] "blank";self::cell;count(children/*)=0'.split(
|
|
";",
|
|
),
|
|
'Rule;blank-empty;default;[t] "blank";self::empty;count(../*)=1;name(../..)="cell" or name(../..)="line"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"cases",
|
|
"default",
|
|
'[p] (pause:short); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"Case-:",sepFunc:CTXFpauseSeparator,separator:"long"); [p] (pause:long)',
|
|
"self::cases",
|
|
],
|
|
'Rule{lines-cases-summary{MultiLineLabel_Case{[p] (pause:short); [t] count(children/*); [t] "cases"; [n] . (grammar:layoutSummary){self::multiline{not(contains(@grammar, "layoutSummary"))'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"lines-cases-summary",
|
|
"self::table",
|
|
'not(contains(@grammar, "layoutSummary"))',
|
|
],
|
|
[
|
|
"Rule",
|
|
"lines-cases",
|
|
"MultiLineLabel_Case",
|
|
'[p] (pause:short); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"Case-:",sepFunc:CTXFpauseSeparator,separator:"long"); [p] (pause:long)',
|
|
"self::table",
|
|
],
|
|
["Aliases", "lines-cases", "self::multiline"],
|
|
'Rule{lines-equations-summary{MultiLineLabel_Equation{[p] (pause:short); [t] count(children/*); [t] "equations"; [n] . (grammar:layoutSummary){self::multiline{not(contains(@grammar, "layoutSummary"))'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"lines-equations-summary",
|
|
"self::table",
|
|
'not(contains(@grammar, "layoutSummary"))',
|
|
],
|
|
[
|
|
"Rule",
|
|
"lines-equations",
|
|
"MultiLineLabel_Equation",
|
|
'[p] (pause:short); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"Equation-:",sepFunc:CTXFpauseSeparator,separator:"long"); [p] (pause:long)',
|
|
"self::table",
|
|
],
|
|
["Aliases", "lines-equations", "self::multiline"],
|
|
'Rule{lines-steps-summary{MultiLineLabel_Step{[p] (pause:short); [t] count(children/*); [t] "steps"; [n] . (grammar:layoutSummary){self::multiline{not(contains(@grammar, "layoutSummary"))'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"lines-steps-summary",
|
|
"self::table",
|
|
'not(contains(@grammar, "layoutSummary"))',
|
|
],
|
|
[
|
|
"Rule",
|
|
"lines-steps",
|
|
"MultiLineLabel_Step",
|
|
'[p] (pause:short); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"Step-:",sepFunc:CTXFpauseSeparator,separator:"long"); [p] (pause:long)',
|
|
"self::table",
|
|
],
|
|
["Aliases", "lines-steps", "self::multiline"],
|
|
'Rule{lines-rows-summary{MultiLineLabel_Row{[p] (pause:short); [t] count(children/*); [t] "rows"; [n] . (grammar:layoutSummary){self::multiline{not(contains(@grammar, "layoutSummary"))'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"lines-rows-summary",
|
|
"self::table",
|
|
'not(contains(@grammar, "layoutSummary"))',
|
|
],
|
|
[
|
|
"Rule",
|
|
"lines-rows",
|
|
"MultiLineLabel_Row",
|
|
'[p] (pause:short); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"Row-:",sepFunc:CTXFpauseSeparator,separator:"long"); [p] (pause:long)',
|
|
"self::table",
|
|
],
|
|
["Aliases", "lines-rows", "self::multiline"],
|
|
'Rule{lines-constraints-summary{MultiLineLabel_Constraint{[p] (pause:short); [t] count(children/*); [t] "constraints"; [n] . (grammar:layoutSummary){self::multiline{not(contains(@grammar, "layoutSummary"))'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"lines-constraints-summary",
|
|
"self::table",
|
|
'not(contains(@grammar, "layoutSummary"))',
|
|
],
|
|
[
|
|
"Rule",
|
|
"lines-constraints",
|
|
"MultiLineLabel_Constraint",
|
|
'[p] (pause:short); [m] children/* (ctxtFunc:CTXFnodeCounter,context:"Constraint-:",sepFunc:CTXFpauseSeparator,separator:"long"); [p] (pause:long)',
|
|
"self::table",
|
|
],
|
|
["Aliases", "lines-constraints", "self::multiline"],
|
|
'Rule{lines-none{MultiLineLabel_None{[p] (pause:short); [m] children/* (sepFunc:CTXFpauseSeparator,separator:"long"); [p] (pause:long){self::table{contains(@grammar, "layoutSummary")'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"lines-none",
|
|
"self::multiline",
|
|
'contains(@grammar, "layoutSummary")',
|
|
],
|
|
[
|
|
"Aliases",
|
|
"lines-none",
|
|
"self::cases",
|
|
'contains(@grammar, "layoutSummary")',
|
|
],
|
|
[
|
|
"Rule",
|
|
"bigop",
|
|
"default",
|
|
'[t] "the"; [n] children/*[1]; [t] "of"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::bigop",
|
|
],
|
|
[
|
|
"Rule",
|
|
"limboth",
|
|
"default",
|
|
'[n] children/*[1]; [t] "from"; [n] children/*[2];[t] "to"; [n] children/*[3];',
|
|
"self::limboth",
|
|
],
|
|
[
|
|
"Rule",
|
|
"limlower",
|
|
"default",
|
|
'[n] children/*[1]; [t] "over"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::limlower",
|
|
],
|
|
[
|
|
"Rule",
|
|
"limupper",
|
|
"default",
|
|
'[n] children/*[1]; [t] "under"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::limupper",
|
|
],
|
|
[
|
|
"Rule",
|
|
"integral",
|
|
"default",
|
|
'[t] "the"; [n] children/*[1]; [t] "of"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::integral",
|
|
],
|
|
[
|
|
"Rule",
|
|
"overscript",
|
|
"default",
|
|
'[n] children/*[1]; [t] "under"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::overscore",
|
|
],
|
|
'Rule,overscript,default,[n] children/*[1]; [n] children/*[2];,self::overscore,children/*[2][@role="overaccent"]'.split(
|
|
",",
|
|
),
|
|
'Rule,overscript-limits,default,[n] children/*[1]; [t] "to"; [n] children/*[2],self::overscore,children/*[2][@role!="overaccent"],name(children/*[1])="underscore",children/*[1]/children/*[2][@role!="underaccent"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"underscript",
|
|
"default",
|
|
'[n] children/*[1]; [t] "over"; [n] children/*[2]; [p] (pause:short)',
|
|
"self::underscore",
|
|
],
|
|
'Rule,underscript-limits,default,[n] children/*[1]; [t] "from"; [n] children/*[2],self::underscore,@role="underover",children/*[2][@role!="underaccent"]'.split(
|
|
",",
|
|
),
|
|
["Rule", "number", "default", "[n] text()", "self::number"],
|
|
'Rule,mixed-number,default,[n] children/*[1]; [t] "and"; [n] children/*[2]; ,self::number,@role="mixed"'.split(
|
|
",",
|
|
),
|
|
'Rule{number-with-chars{default{[t] "number"; [m] CQFspaceoutNumber (grammar:protected){self::number{@role="othernumber"{"" != translate(text(), "0123456789.,", ""){not(contains(@grammar, "protected"))'.split(
|
|
"{",
|
|
),
|
|
'Rule,decimal-period,default,[t] "the repeating decimal"; [n] children/*[1] (grammar:spaceout); [t] "point followed by repeating digits"; [n] children/*[3]/children/*[1] (grammar:spaceout),self::punctuated,@role="sequence",count(./content/*)=1,./content/*[1][@role="fullstop"],name(children/*[1])="number",children/*[1][@role="integer"],name(children/*[3])="overscore",children/*[3][@role="integer"],children/*[3]/children/*[2][@role="overaccent"],children/*[3]/children/*[2][text()="\u00af" or text()="\uffe3" or text()="\uff3f" or text()="_" or text()="\u203e"]'.split(
|
|
",",
|
|
),
|
|
'Rule,decimal-period,default,[t] "the repeating decimal"; [n] children/*[1] (grammar:spaceout); [t] "followed by repeating digits"; [n] children/*[2]/children/*[1] (grammar:spaceout);,self::infixop,@role="implicit",count(./children/*)=2,name(children/*[1])="number",children/*[1][@role="float"],name(children/*[2])="overscore",children/*[2][@role="integer"],children/*[2]/children/*[2][@role="overaccent"],children/*[2]/children/*[2][text()="\u00af" or text()="\uffe3" or text()="\uff3f" or text()="_" or text()="\u203e"]'.split(
|
|
",",
|
|
),
|
|
'Rule,decimal-period-singular,default,[t] "the repeating decimal"; [n] children/*[1] (grammar:spaceout); [t] "point followed by repeating digit"; [n] children/*[3]/children/*[1] (grammar:spaceout),self::punctuated,@role="sequence",count(./content/*)=1,./content/*[1][@role="fullstop"],name(children/*[1])="number",children/*[1][@role="integer"],name(children/*[3])="overscore",children/*[3][@role="integer"],children/*[3]/children/*[2][@role="overaccent"],children/*[3]/children/*[2][text()="\u00af" or text()="\uffe3" or text()="\uff3f" or text()="_" or text()="\u203e"],string-length(./children/*[3]/children/*[1]/text())=1'.split(
|
|
",",
|
|
),
|
|
'Rule,decimal-period-singular,default,[t] "the repeating decimal"; [n] children/*[1] (grammar:spaceout); [t] "followed by repeating digit"; [n] children/*[2]/children/*[1] (grammar:spaceout);,self::infixop,@role="implicit",count(./children/*)=2,name(children/*[1])="number",children/*[1][@role="float"],name(children/*[2])="overscore",children/*[2][@role="integer"],children/*[2]/children/*[2][@role="overaccent"],children/*[2]/children/*[2][text()="\u00af" or text()="\uffe3" or text()="\uff3f" or text()="_" or text()="\u203e"],string-length(./children/*[2]/children/*[1]/text())=1'.split(
|
|
",",
|
|
),
|
|
'Rule;number-with-spaces;default;[m] CQFspaceoutNumber (grammar:!spaceout:number);self::number;contains(@grammar, "spaceout")'.split(
|
|
";",
|
|
),
|
|
'Rule;decimal-point;default;[t] "point";self::punctuation;@role="fullstop";contains(@grammar,"number")'.split(
|
|
";",
|
|
),
|
|
'Rule,line-segment,default,[t] "the line segment"; [n] children/*[1]/children/*[1]; [n] children/*[1]/children/*[2]; [p] (pause:short),self::overscore,@role="implicit",children/*[2][@role="overaccent"],children/*[2][text()="\u00af" or text()="\uffe3" or text()="\uff3f" or text()="_" or text()="\u203e"],name(children/*[1])="infixop",count(./children/*[1]/children/*)=2'.split(
|
|
",",
|
|
),
|
|
'Rule,conjugate,Bar_Conjugate,[t] "the complex conjugate of"; [n] children/*[1],self::overscore,children/*[2][@role="overaccent"],children/*[2][text()="\u00af" or text()="\uffe3" or text()="\uff3f" or text()="_" or text()="\u203e"]'.split(
|
|
",",
|
|
),
|
|
'Rule;defined-by;default;[t] "is defined to be" (pause:short);self::overscore;@role="equality";@embellished="relation";name(children/*[2])="text";children/*[2][text()]="def"'.split(
|
|
";",
|
|
),
|
|
'Rule,adorned-sign,default,[n] children/*[1] ; [t] "sign with"; [n] children/*[2]; [t] "over it",self::overscore,@embellished,name(children/*[1])="operator" or name(children/*[1])="relation"'.split(
|
|
",",
|
|
),
|
|
'Rule;factorial;default;[t] "factorial";self::punctuation;text()="!";name(preceding-sibling::*[1])!="text"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"tensor-base",
|
|
"default",
|
|
"[n] children/*[2]; [n] children/*[3]; [n] children/*[1]; [n] children/*[4]; [n] children/*[5]",
|
|
"self::tensor",
|
|
],
|
|
'Rule{left-super{default{[t] "left super"; [n] text(){self::*[@role="leftsuper"]{not(contains(@grammar,"combinatorics"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{left-super{default{[t] "left super"; [m] children/*{self::punctuated{@role="leftsuper"{not(contains(@grammar,"combinatorics"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{left-sub{default{[t] "left sub"; [n] text(){self::*[@role="leftsub"]{not(contains(@grammar,"combinatorics"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{left-sub{default{[t] "left sub"; [m] children/*{self::punctuated{@role="leftsub"{not(contains(@grammar,"combinatorics"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{right-super{default{[t] "right super"; [n] text(){self::*[@role="rightsuper"]{not(contains(@grammar,"combinatorics"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{right-super{default{[t] "right super"; [m] children/*{self::punctuated{@role="rightsuper"{not(contains(@grammar,"combinatorics"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{right-sub{default{[t] "right sub"; [n] text(){self::*[@role="rightsub"]{not(contains(@grammar,"combinatorics"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{right-sub{default{[t] "right sub"; [m] children/*{self::punctuated{@role="rightsub"{not(contains(@grammar,"combinatorics"))'.split(
|
|
"{",
|
|
),
|
|
'Rule;empty-index;default;[p] (pause:medium);self::empty;@role="rightsub" or @role="rightsuper" or @role="leftsub" or @role="leftsuper"'.split(
|
|
";",
|
|
),
|
|
'Rule,combinatorics,default,[n] children/*[2] (grammar:combinatorics); [n] children/*[1]; [n] children/*[4] (grammar:combinatorics),self::tensor,name(children/*[3])="empty",name(children/*[5])="empty",children/*[1][text()="P" or text()="C"]'.split(
|
|
",",
|
|
),
|
|
'Rule,choose,CombinationPermutation_ChoosePermute,[n] children/*[2] (grammar:combinatorics); [t] "choose"; [n] children/*[4] (grammar:combinatorics),self::tensor,name(children/*[3])="empty",name(children/*[5])="empty",children/*[1][text()="C"]'.split(
|
|
",",
|
|
),
|
|
'Rule,permute,CombinationPermutation_ChoosePermute,[n] children/*[2] (grammar:combinatorics); [t] "permute"; [n] children/*[4] (grammar:combinatorics),self::tensor,name(children/*[3])="empty",name(children/*[5])="empty",children/*[1][text()="P"]'.split(
|
|
",",
|
|
),
|
|
'Rule;unit-singular;default;[t] text() (grammar:annotation="unit":translate);self::identifier;@role="unit"'.split(
|
|
";",
|
|
),
|
|
'Rule;unit-plural;default;[t] text() (grammar:annotation="unit":translate:plural);self::identifier;@role="unit";not(contains(@grammar, "singularUnit"))'.split(
|
|
";",
|
|
),
|
|
'Rule,unit-square,default,[t] "square"; [n] children/*[1],self::superscript,@role="unit",children/*[2][text()=2],name(children/*[1])="identifier"'.split(
|
|
",",
|
|
),
|
|
'Rule,unit-cubic,default,[t] "cubic"; [n] children/*[1],self::superscript,@role="unit",children/*[2][text()=3],name(children/*[1])="identifier"'.split(
|
|
",",
|
|
),
|
|
'Rule,unit-reciprocal,default,[t] "reciprocal"; [n] children/*[1],self::superscript,@role="unit",name(children/*[1])="identifier",name(children/*[2])="prefixop",children/*[2][@role="negative"],children/*[2]/children/*[1][text()=1],count(preceding-sibling::*)=0 or preceding-sibling::*[@role!="unit"]'.split(
|
|
",",
|
|
),
|
|
'Rule,unit-reciprocal,default,[t] "per"; [n] children/*[1] (grammar:singularUnit),self::superscript,@role="unit",name(children/*[1])="identifier",name(children/*[2])="prefixop",children/*[2][@role="negative"],children/*[2]/children/*[1][text()=1],preceding-sibling::*[@role="unit"]'.split(
|
|
",",
|
|
),
|
|
'Rule;unit-combine;default;[m] children/*;self::infixop;@role="unit"'.split(
|
|
";",
|
|
),
|
|
'Rule,unit-combine-singular,default,[n] children/*[1]; [n] children/*[2] (grammar:singularUnit); [m] children/*[position()>2],self::infixop,@role="unit",name(children/*[1])="number",children/*[1][text()=1]'.split(
|
|
",",
|
|
),
|
|
'Rule,unit-divide,default,[n] children/*[1]; [t] "per"; [n] children/*[2] (grammar:singularUnit),self::fraction,@role="unit"'.split(
|
|
",",
|
|
),
|
|
'Rule{currency{default{[m] children/*[position()>1]; [n] children/*[1];{self::infixop{contains(@annotation, "clearspeak:unit"){children/*[1][@role="unit"]{CQFfirstCurrency'.split(
|
|
"{",
|
|
),
|
|
'Rule;currency;Currency_Position;[m] children/*;self::infixop;contains(@annotation, "clearspeak:unit")'.split(
|
|
";",
|
|
),
|
|
["SpecializedRule", "currency", "Currency_Position", "Currency_Prefix"],
|
|
'Rule{currency{Currency_Prefix{[n] children/*[last()]; [m] children/*[position()<last()]; {self::infixop{contains(@annotation, "clearspeak:unit"){children/*[last()][@role="unit"]{CQFlastCurrency'.split(
|
|
"{",
|
|
),
|
|
],
|
|
initialize: [sre.ClearspeakUtil.addAnnotators],
|
|
};
|
|
sre.Grammar.getInstance().setPreprocessor(
|
|
"numbers2alpha",
|
|
sre.ClearspeakUtil.numbersToAlpha,
|
|
);
|
|
sre.EmacspeakRules = {
|
|
domain: "emacspeak",
|
|
functions: [
|
|
["CTXF", "CTXFnodeCounter", sre.StoreUtil.nodeCounter],
|
|
["CTXF", "CTXFcontentIterator", sre.StoreUtil.contentIterator],
|
|
["CQF", "CQFvulgarFractionSmall", sre.MathspeakUtil.isSmallVulgarFraction],
|
|
["CSF", "CSFvulgarFraction", sre.NumbersUtil.vulgarFraction],
|
|
],
|
|
rules: [
|
|
["Rule", "stree", "default", "[n] ./*[1]", "self::stree"],
|
|
[
|
|
"Rule",
|
|
"multrel",
|
|
"default",
|
|
'[t] "multirelation"; [m] children/* (sepFunc:CTXFcontentIterator)',
|
|
"self::multirel",
|
|
],
|
|
'Rule{variable-equality{default{[t] "equation sequence"; [m] children/* (context:"part",ctxtFunc:CTXFnodeCounter,sepFunc:CTXFcontentIterator){self::relseq[@role="equality"]{count(./children/*)>2{./children/punctuation[@role="ellipsis"]'.split(
|
|
"{",
|
|
),
|
|
'Rule{multi-equality{default{[t] "equation sequence"; [m] children/* (context:"part",ctxtFunc:CTXFnodeCounter,sepFunc:CTXFcontentIterator){self::relseq[@role="equality"]{count(./children/*)>2'.split(
|
|
"{",
|
|
),
|
|
'Rule,equality,default,[t] "equation"; [t] "left hand side"; [n] children/*[1];[p] (pause:200); [n] content/*[1] (pause:200);[t] "right hand side"; [n] children/*[2],self::relseq[@role="equality"],count(./children/*)=2'.split(
|
|
",",
|
|
),
|
|
'Rule,simple-equality,default,[n] children/*[1]; [p] (pause:200); [n] content/*[1] (pause:200);[n] children/*[2],self::relseq[@role="equality"],count(./children/*)=2,./children/identifier or ./children/number'.split(
|
|
",",
|
|
),
|
|
'Rule,simple-equality2,default,[n] children/*[1]; [p] (pause:200); [n] content/*[1] (pause:200);[n] children/*[2],self::relseq[@role="equality"],count(./children/*)=2,./children/function or ./children/appl'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"relseq",
|
|
"default",
|
|
"[m] children/* (sepFunc:CTXFcontentIterator)",
|
|
"self::relseq",
|
|
],
|
|
'Rule;implicit;default;[m] children/*;self::infixop;@role="implicit";children/*[1][@role="latinletter"] or children/*[1][@role="greekletter"] or children/*[1][@role="otherletter"] or name(children/*[1])="number";children/*[2][@role="latinletter"] or children/*[2][@role="greekletter"] or children/*[2][@role="otherletter"] or name(children/*[2])="number"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"binary-operation",
|
|
"default",
|
|
"[p] (pause:100); [m] children/* (sepFunc:CTXFcontentIterator); [p] (pause:100);",
|
|
"self::infixop",
|
|
],
|
|
'Rule,variable-addition,default,[t] "sum with variable number of summands";[p] (pause:400); [m] children/* (sepFunc:CTXFcontentIterator),self::infixop[@role="addition"],count(children/*)>2,children/punctuation[@role="ellipsis"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"prefix",
|
|
"default",
|
|
'[t] "prefix"; [n] text(); [t] "of" (pause 150);[n] children/*[1]',
|
|
"self::prefixop",
|
|
],
|
|
'Rule,negative,default,[t] "negative"; [n] children/*[1],self::prefixop,self::prefixop[@role="negative"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"postfix",
|
|
"default",
|
|
'[n] children/*[1]; [t] "postfix"; [n] text() (pause 300)',
|
|
"self::postfixop",
|
|
],
|
|
["Rule", "identifier", "default", "[n] text()", "self::identifier"],
|
|
["Rule", "number", "default", "[n] text()", "self::number"],
|
|
'Rule{font{default{[t] @font; [n] . (grammar:ignoreFont=@font){self::*{@font{not(contains(@grammar, "ignoreFont")){@font!="normal"'.split(
|
|
"{",
|
|
),
|
|
'Rule{font-identifier-short{default{[t] @font; [n] CQFhideFont; [t] CSFshowFont{self::identifier{string-length(text())=1{@font{@font="normal"{""=translate(text(), "abcdefghijklmnopqrstuvwxyz\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9", ""){@role!="unit"'.split(
|
|
"{",
|
|
),
|
|
'Rule{font-identifier{default{[t] @font; [n] . (grammar:ignoreFont=@font){self::identifier{string-length(text())=1{@font{@font="normal"{not(contains(@grammar, "ignoreFont")){@role!="unit"'.split(
|
|
"{",
|
|
),
|
|
'Rule;omit-font;default;[n] . (grammar:ignoreFont=@font);self::identifier;string-length(text())=1;@font;not(contains(@grammar, "ignoreFont"));@font="italic"'.split(
|
|
";",
|
|
),
|
|
'Rule,simple-fraction,default,[p] (pause:100); [n] children/*[1] (rate:0.35); [t] "over"; [n] children/*[2] (rate:0.35); [p] (pause:100),self::fraction,name(children/*[1])="number" or name(children/*[1])="identifier",name(children/*[2])="number" or name(children/*[2])="identifier"'.split(
|
|
",",
|
|
),
|
|
'Rule;vulgar-fraction;default;[t] CSFvulgarFraction;self::fraction;@role="vulgar";CQFvulgarFractionSmall'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"default",
|
|
'[p] (pause:250); [n] children/*[1] (rate:0.35); [p] (pause:250); [t] "divided by"; [p] (pause:250); [n] children/*[2] (rate:0.35); [p] (pause:250)',
|
|
"self::fraction",
|
|
],
|
|
[
|
|
"Rule",
|
|
"superscript",
|
|
"default",
|
|
'[n] children/*[1]; [t] "super"; [n] children/*[2] (pitch:0.35);[p] (pause:300)',
|
|
"self::superscript",
|
|
],
|
|
[
|
|
"Rule",
|
|
"subscript",
|
|
"default",
|
|
'[n] children/*[1]; [t] "sub"; [n] children/*[2] (pitch:-0.35);[p] (pause:300)',
|
|
"self::subscript",
|
|
],
|
|
'Rule,ellipsis,default,[p] (pause:200); [t] "ellipsis"; [p] (pause:300),self::punctuation,self::punctuation[@role="ellipsis"]'.split(
|
|
",",
|
|
),
|
|
'Rule;fence-single;default;[n] text();self::punctuation;self::punctuation[@role="openfence"]'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Alias",
|
|
"fence-single",
|
|
"self::punctuation",
|
|
'self::punctuation[@role="closefence"]',
|
|
],
|
|
[
|
|
"Alias",
|
|
"fence-single",
|
|
"self::punctuation",
|
|
'self::punctuation[@role="vbar"]',
|
|
],
|
|
[
|
|
"Alias",
|
|
"fence-single",
|
|
"self::punctuation",
|
|
'self::punctuation[@role="application"]',
|
|
],
|
|
["Rule", "omit-empty", "default", "[p] (pause:100)", "self::empty"],
|
|
'Rule,fences-open-close,default,[p] (pause:200); [n] children/*[1] (rate:0.35); [p] (pause:200),self::fenced,@role="leftright"'.split(
|
|
",",
|
|
),
|
|
'Rule,fences-open-close-in-appl,default,[p] (pause:200); [n] children/*[1]; [p] (pause:200);,self::fenced[@role="leftright"],./parent::children/parent::appl'.split(
|
|
",",
|
|
),
|
|
'Rule,fences-neutral,default,[p] (pause:100); [t] "absolute value of"; [n] children/*[1];[p] (pause:350);,self::fenced,self::fenced[@role="neutral"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"omit-fences",
|
|
"default",
|
|
"[p] (pause:500); [n] children/*[1]; [p] (pause:200);",
|
|
"self::fenced",
|
|
],
|
|
[
|
|
"Rule",
|
|
"matrix",
|
|
"default",
|
|
'[t] "matrix"; [m] children/* (ctxtFunc:CTXFnodeCounter,context:"row",pause:100)',
|
|
"self::matrix",
|
|
],
|
|
[
|
|
"Rule",
|
|
"matrix-row",
|
|
"default",
|
|
'[m] children/* (ctxtFunc:CTXFnodeCounter,context:"column",pause:100)',
|
|
'self::row[@role="matrix"]',
|
|
],
|
|
[
|
|
"Rule",
|
|
"matrix-cell",
|
|
"default",
|
|
"[n] children/*[1]",
|
|
'self::cell[@role="matrix"]',
|
|
],
|
|
[
|
|
"Rule",
|
|
"vector",
|
|
"default",
|
|
'[t] "vector"; [m] children/* (ctxtFunc:CTXFnodeCounter,context:"element",pause:100)',
|
|
"self::vector",
|
|
],
|
|
[
|
|
"Rule",
|
|
"cases",
|
|
"default",
|
|
'[t] "case statement"; [m] children/* (ctxtFunc:CTXFnodeCounter,context:"case",pause:100)',
|
|
"self::cases",
|
|
],
|
|
[
|
|
"Rule",
|
|
"cases-row",
|
|
"default",
|
|
"[m] children/*",
|
|
'self::row[@role="cases"]',
|
|
],
|
|
[
|
|
"Rule",
|
|
"cases-cell",
|
|
"default",
|
|
"[n] children/*[1]",
|
|
'self::cell[@role="cases"]',
|
|
],
|
|
[
|
|
"Rule",
|
|
"row",
|
|
"default",
|
|
'[m] ./* (ctxtFunc:CTXFnodeCounter,context:"column",pause:100)',
|
|
"self::row",
|
|
],
|
|
'Rule{cases-end{default{[t] "case statement"; [m] children/* (ctxtFunc:CTXFnodeCounter,context:"case",pause:100);[t] "end cases"{self::cases{following-sibling::*'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"multiline",
|
|
"default",
|
|
'[t] "multiline equation";[m] children/* (ctxtFunc:CTXFnodeCounter,context:"line",pause:100)',
|
|
"self::multiline",
|
|
],
|
|
["Rule", "line", "default", "[m] children/*", "self::line"],
|
|
[
|
|
"Rule",
|
|
"table",
|
|
"default",
|
|
'[t] "multiline equation";[m] children/* (ctxtFunc:CTXFnodeCounter,context:"row",pause:200)',
|
|
"self::table",
|
|
],
|
|
[
|
|
"Rule",
|
|
"table-row",
|
|
"default",
|
|
"[m] children/* (pause:100)",
|
|
'self::row[@role="table"]',
|
|
],
|
|
["Alias", "cases-cell", 'self::cell[@role="table"]'],
|
|
'Rule,end-punct,default,[m] children/*; [p] (pause:300),self::punctuated,@role="endpunct"'.split(
|
|
",",
|
|
),
|
|
'Rule,start-punct,default,[n] content/*[1]; [p] (pause:200); [m] children/*[position()>1],self::punctuated,@role="startpunct"'.split(
|
|
",",
|
|
),
|
|
'Rule,integral-punct,default,[n] children/*[1] (rate:0.2); [n] children/*[3] (rate:0.2),self::punctuated,@role="integral"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"punctuated",
|
|
"default",
|
|
"[m] children/* (pause:100)",
|
|
"self::punctuated",
|
|
],
|
|
["Rule", "function", "default", "[n] text()", "self::function"],
|
|
[
|
|
"Rule",
|
|
"appl",
|
|
"default",
|
|
"[n] children/*[1]; [n] content/*[1]; [n] children/*[2]",
|
|
"self::appl",
|
|
],
|
|
'Rule,sum-only,default,[n] children/*[1]; [t] "from"; [n] children/*[2]; [t] "to";[n] children/*[3],self::limboth,@role="sum" or @role="integral"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"limboth",
|
|
"default",
|
|
'[n] children/*[1]; [p] (pause 100); [t] "over"; [n] children/*[2];[t] "under"; [n] children/*[3]; [p] (pause 250);',
|
|
"self::limboth",
|
|
],
|
|
[
|
|
"Rule",
|
|
"limlower",
|
|
"default",
|
|
'[n] children/*[1]; [t] "over"; [n] children/*[2];',
|
|
"self::limlower",
|
|
],
|
|
[
|
|
"Rule",
|
|
"limupper",
|
|
"default",
|
|
'[n] children/*[1]; [t] "under"; [n] children/*[2];',
|
|
"self::limupper",
|
|
],
|
|
["Rule", "largeop", "default", "[n] text()", "self::largeop"],
|
|
[
|
|
"Rule",
|
|
"bigop",
|
|
"default",
|
|
'[n] children/*[1]; [p] (pause 100); [t] "over"; [n] children/*[2];[p] (pause 250);',
|
|
"self::bigop",
|
|
],
|
|
[
|
|
"Rule",
|
|
"integral",
|
|
"default",
|
|
"[n] children/*[1]; [p] (pause 100); [n] children/*[2];[p] (pause 200); [n] children/*[3] (rate:0.35);",
|
|
"self::integral",
|
|
],
|
|
[
|
|
"Rule",
|
|
"sqrt",
|
|
"default",
|
|
'[t] "Square root of"; [n] children/*[1] (rate:0.35); [p] (pause:400)',
|
|
"self::sqrt",
|
|
],
|
|
'Rule,square,default,[n] children/*[1]; [t] "squared" (pitch:0.35); [p] (pause:200),self::superscript,children/*[2][text()=2],name(./children/*[1])!="text"'.split(
|
|
",",
|
|
),
|
|
'Rule,cube,default,[n] children/*[1]; [t] "cubed" (pitch:0.35); [p] (pause:200),self::superscript,children/*[2][text()=3],name(./children/*[1])!="text"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"root",
|
|
"default",
|
|
'[t] "root of order"; [n] children/*[1];[t] "over"; [n] children/*[1] (rate:0.35); [p] (pause:400)',
|
|
"self::root",
|
|
],
|
|
"Rule,text-no-mult,default,[n] children/*[1]; [p] (pause:200); [n] children/*[2],self::infixop,children/text".split(
|
|
",",
|
|
),
|
|
["Rule", "text", "default", "[n] text(); [p] (pause:200)", "self::text"],
|
|
'Rule;unit;default;[t] text() (annotation:unit, preprocess);self::identifier;@role="unit"'.split(
|
|
";",
|
|
),
|
|
'Rule,unit-square,default,[t] "square"; [n] children/*[1],self::superscript,@role="unit",children/*[2][text()=2],name(children/*[1])="identifier"'.split(
|
|
",",
|
|
),
|
|
'Rule,unit-cubic,default,[t] "cubic"; [n] children/*[1],self::superscript,@role="unit",children/*[2][text()=3],name(children/*[1])="identifier"'.split(
|
|
",",
|
|
),
|
|
'Rule,reciprocal,default,[t] "reciprocal"; [n] children/*[1],self::superscript,@role="unit",name(children/*[1])="identifier",name(children/*[2])="prefixop",children/*[2][@role="negative"],children/*[2]/children/*[1][text()=1],count(preceding-sibling::*)=0 or preceding-sibling::*[@role!="unit"]'.split(
|
|
",",
|
|
),
|
|
'Rule,reciprocal,default,[t] "per"; [n] children/*[1],self::superscript,@role="unit",name(children/*[1])="identifier",name(children/*[2])="prefixop",children/*[2][@role="negative"],children/*[2]/children/*[1][text()=1],preceding-sibling::*[@role="unit"]'.split(
|
|
",",
|
|
),
|
|
'Rule;unit-combine;default;[m] children/*;self::infixop;@role="unit"'.split(
|
|
";",
|
|
),
|
|
'Rule,unit-divide,default,[n] children/*[1] (pitch:0.3); [t] "per"; [n] children/*[2] (pitch:-0.3),self::fraction,@role="unit"'.split(
|
|
",",
|
|
),
|
|
],
|
|
};
|
|
sre.MathspeakFrenchUtil = {};
|
|
sre.MathspeakFrenchUtil.smallRoot = function (a) {
|
|
if (!a.childNodes || 0 === a.childNodes.length || !a.childNodes[0].childNodes)
|
|
return [];
|
|
var b = a.childNodes[0].childNodes[0].textContent;
|
|
if (!/^\d+$/.test(b)) return [];
|
|
b = parseInt(b, 10);
|
|
return 1 < b && 3 >= b ? [a] : [];
|
|
};
|
|
sre.MathspeakFrenchUtil.baselineVerbose = function (a) {
|
|
return sre.MathspeakUtil.baselineVerbose(a).replace(/\-$/, "");
|
|
};
|
|
sre.MathspeakFrenchUtil.baselineBrief = function (a) {
|
|
return sre.MathspeakUtil.baselineBrief(a).replace(/\-$/, "");
|
|
};
|
|
sre.MathspeakFrenchUtil.leftSuperscriptVerbose = function (a) {
|
|
return sre.MathspeakUtil.superscriptVerbose(a).replace(
|
|
/^exposant/,
|
|
"exposant gauche",
|
|
);
|
|
};
|
|
sre.MathspeakFrenchUtil.leftSubscriptVerbose = function (a) {
|
|
return sre.MathspeakUtil.subscriptVerbose(a).replace(
|
|
/^indice/,
|
|
"indice gauche",
|
|
);
|
|
};
|
|
sre.MathspeakFrenchUtil.leftSuperscriptBrief = function (a) {
|
|
return sre.MathspeakUtil.superscriptBrief(a).replace(/^sup/, "sup gauche");
|
|
};
|
|
sre.MathspeakFrenchUtil.leftSubscriptBrief = function (a) {
|
|
return sre.MathspeakUtil.subscriptBrief(a).replace(/^sub/, "sub gauche");
|
|
};
|
|
sre.MathspeakFrench = {
|
|
locale: "fr",
|
|
domain: "mathspeak",
|
|
functions: [
|
|
["CQF", "CQFspaceoutNumber", sre.MathspeakUtil.spaceoutNumber],
|
|
["CQF", "CQFspaceoutIdentifier", sre.MathspeakUtil.spaceoutIdentifier],
|
|
["CSF", "CSFspaceoutText", sre.MathspeakUtil.spaceoutText],
|
|
["CSF", "CSFopenFracVerbose", sre.MathspeakUtil.openingFractionVerbose],
|
|
["CSF", "CSFcloseFracVerbose", sre.MathspeakUtil.closingFractionVerbose],
|
|
["CSF", "CSFoverFracVerbose", sre.MathspeakUtil.overFractionVerbose],
|
|
["CSF", "CSFopenFracBrief", sre.MathspeakUtil.openingFractionBrief],
|
|
["CSF", "CSFcloseFracBrief", sre.MathspeakUtil.closingFractionBrief],
|
|
["CSF", "CSFopenFracSbrief", sre.MathspeakUtil.openingFractionSbrief],
|
|
["CSF", "CSFcloseFracSbrief", sre.MathspeakUtil.closingFractionSbrief],
|
|
["CSF", "CSFoverFracSbrief", sre.MathspeakUtil.overFractionSbrief],
|
|
["CSF", "CSFvulgarFrFraction", sre.NumbersUtil.vulgarFraction],
|
|
["CQF", "CQFvulgarFractionSmall", sre.MathspeakUtil.isSmallVulgarFraction],
|
|
["CSF", "CSFopenRadicalVerbose", sre.MathspeakUtil.openingRadicalVerbose],
|
|
["CSF", "CSFcloseRadicalVerbose", sre.MathspeakUtil.closingRadicalVerbose],
|
|
["CSF", "CSFindexRadicalVerbose", sre.MathspeakUtil.indexRadicalVerbose],
|
|
["CSF", "CSFopenRadicalBrief", sre.MathspeakUtil.openingRadicalBrief],
|
|
["CSF", "CSFcloseRadicalBrief", sre.MathspeakUtil.closingRadicalBrief],
|
|
["CSF", "CSFindexRadicalBrief", sre.MathspeakUtil.indexRadicalBrief],
|
|
["CSF", "CSFopenRadicalSbrief", sre.MathspeakUtil.openingRadicalSbrief],
|
|
["CSF", "CSFindexRadicalSbrief", sre.MathspeakUtil.indexRadicalSbrief],
|
|
["CQF", "CQFisSmallRoot", sre.MathspeakFrenchUtil.smallRoot],
|
|
["CSF", "CSFsuperscriptVerbose", sre.MathspeakUtil.superscriptVerbose],
|
|
["CSF", "CSFsuperscriptBrief", sre.MathspeakUtil.superscriptBrief],
|
|
["CSF", "CSFsubscriptVerbose", sre.MathspeakUtil.subscriptVerbose],
|
|
["CSF", "CSFsubscriptBrief", sre.MathspeakUtil.subscriptBrief],
|
|
["CSF", "CSFbaselineVerbose", sre.MathspeakFrenchUtil.baselineVerbose],
|
|
["CSF", "CSFbaselineBrief", sre.MathspeakFrenchUtil.baselineBrief],
|
|
[
|
|
"CSF",
|
|
"CSFleftsuperscriptVerbose",
|
|
sre.MathspeakFrenchUtil.leftSuperscriptVerbose,
|
|
],
|
|
[
|
|
"CSF",
|
|
"CSFleftsubscriptVerbose",
|
|
sre.MathspeakFrenchUtil.leftSubscriptVerbose,
|
|
],
|
|
["CSF", "CSFrightsuperscriptVerbose", sre.MathspeakUtil.superscriptVerbose],
|
|
["CSF", "CSFrightsubscriptVerbose", sre.MathspeakUtil.subscriptVerbose],
|
|
[
|
|
"CSF",
|
|
"CSFleftsuperscriptBrief",
|
|
sre.MathspeakFrenchUtil.leftSuperscriptBrief,
|
|
],
|
|
[
|
|
"CSF",
|
|
"CSFleftsubscriptBrief",
|
|
sre.MathspeakFrenchUtil.leftSubscriptBrief,
|
|
],
|
|
["CSF", "CSFrightsuperscriptBrief", sre.MathspeakUtil.superscriptBrief],
|
|
["CSF", "CSFrightsubscriptBrief", sre.MathspeakUtil.subscriptBrief],
|
|
["CSF", "CSFunderscript", sre.MathspeakUtil.nestedUnderscore],
|
|
["CSF", "CSFoverscript", sre.MathspeakUtil.nestedOverscore],
|
|
["CTXF", "CTXFordinalCounter", sre.NumbersUtil.ordinalCounter],
|
|
["CTXF", "CTXFcontentIterator", sre.StoreUtil.contentIterator],
|
|
["CQF", "CQFdetIsSimple", sre.MathspeakUtil.determinantIsSimple],
|
|
["CSF", "CSFRemoveParens", sre.MathspeakUtil.removeParens],
|
|
["CQF", "CQFresetNesting", sre.MathspeakUtil.resetNestingDepth],
|
|
["CQF", "CQFisLogarithm", sre.ClearspeakUtil.isLogarithmWithBase],
|
|
],
|
|
rules: [
|
|
'Rule;collapsed;default;[n] . (engine:modality=summary,grammar:collapsed);self::*;@alternative;not(contains(@grammar, "collapsed"));self::*;self::*;self::*;self::*;self::*'.split(
|
|
";",
|
|
),
|
|
["SpecializedRule", "collapsed", "default", "brief"],
|
|
["SpecializedRule", "collapsed", "brief", "sbrief"],
|
|
"Rule;stree;default;[n] ./*[1];self::stree;CQFresetNesting".split(";"),
|
|
["Rule", "unknown", "default", "[n] text()", "self::unknown"],
|
|
'Rule;protected;default;[t] text();self::*;@role="protected"'.split(";"),
|
|
["Rule", "omit-empty", "default", "[p] (pause:100)", "self::empty"],
|
|
'Rule;blank-empty;default;[t] "vide";self::empty;count(../*)=1;name(../..)="cell" or name(../..)="line"'.split(
|
|
";",
|
|
),
|
|
'Rule{font{default{[n] . (grammar:ignoreFont=@font); [t] @font (grammar:localFont){self::*{@font{not(contains(@grammar, "ignoreFont")){@font!="normal"'.split(
|
|
"{",
|
|
),
|
|
'Rule{font-identifier-short{default{[n] . (grammar:ignoreFont=@font); [t] @font (grammar:localFont);{self::identifier{string-length(text())=1{@font{not(contains(@grammar, "ignoreFont")){@font="normal"{""=translate(text(), "abcdefghijklmnopqrstuvwxyz\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9", ""){@role!="unit"'.split(
|
|
"{",
|
|
),
|
|
'Rule{font-identifier{default{[n] . (grammar:ignoreFont=@font); [t] @font (grammar:localFont){self::identifier{string-length(text())=1{@font{@font="normal"{not(contains(@grammar, "ignoreFont")){@role!="unit"'.split(
|
|
"{",
|
|
),
|
|
'Rule;omit-font;default;[n] . (grammar:ignoreFont=@font);self::identifier;string-length(text())=1;@font;not(contains(@grammar, "ignoreFont"));@font="italic"'.split(
|
|
";",
|
|
),
|
|
["Rule", "number", "default", "[n] text()", "self::number"],
|
|
'Rule,mixed-number,default,[n] children/*[1]; [t] "et"; [n] children/*[2]; ,self::number,@role="mixed"'.split(
|
|
",",
|
|
),
|
|
'Rule{number-with-chars{default{[t] "nombre"; [m] CQFspaceoutNumber{self::number{"" != translate(text(), "0123456789.,", ""){text() != translate(text(), "0123456789.,", "")'.split(
|
|
"{",
|
|
),
|
|
'Rule{number-as-upper-word{default{[t] "MotMajuscule"; [t] CSFspaceoutText{self::number{string-length(text())>1{text()=translate(text(), "abcdefghijklmnopqrstuvwxyz\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9", "ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9"){""=translate(text(), "ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9","")'.split(
|
|
"{",
|
|
),
|
|
'Rule{number-baseline{default{[t] "position de base"; [n] . (grammar:baseline){self::number{not(contains(@grammar, "ignoreFont")){preceding-sibling::identifier{not(contains(@grammar, "baseline")){preceding-sibling::*[1][@role="latinletter" or @role="greekletter" or @role="otherletter"]{parent::*/parent::infixop[@role="implicit"]'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"number-baseline",
|
|
"default",
|
|
"brief",
|
|
'[t] "base"; [n] . (grammar:baseline)',
|
|
],
|
|
["SpecializedRule", "number-baseline", "brief", "sbrief"],
|
|
'Rule{number-baseline-font{default{[t] "position de base"; [n] . (grammar:ignoreFont=@font); [t] @font (grammar:localFont){self::number{@font{not(contains(@grammar, "ignoreFont")){@font!="normal"{preceding-sibling::identifier{preceding-sibling::*[@role="latinletter" or @role="greekletter" or @role="otherletter"]{parent::*/parent::infixop[@role="implicit"]'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"number-baseline-font",
|
|
"default",
|
|
"brief",
|
|
'[t] "base"; [n] . (grammar:ignoreFont=@font); [t] @font (grammar:localFont)',
|
|
],
|
|
["SpecializedRule", "number-baseline-font", "brief", "sbrief"],
|
|
'Rule;identifier;default;[m] CQFspaceoutIdentifier;self::identifier;string-length(text())>1;@role!="unit";@role!="protected";not(@font) or @font="normal" or contains(@grammar, "ignoreFont");text()!=translate(text(), "abcdefghijklmnopqrstuvwxyz\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9", "")'.split(
|
|
";",
|
|
),
|
|
["Rule", "identifier", "default", "[n] text()", "self::identifier"],
|
|
'Rule,negative,default,[t] "n\u00e9gatif"; [n] children/*[1],self::prefixop,@role="negative",children/identifier'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"negative",
|
|
"self::prefixop",
|
|
'@role="negative"',
|
|
"children/number",
|
|
],
|
|
[
|
|
"Aliases",
|
|
"negative",
|
|
"self::prefixop",
|
|
'@role="negative"',
|
|
'children/fraction[@role="vulgar"]',
|
|
],
|
|
'Rule,negative,default,[t] "n\u00e9gatif"; [n] children/*[1],self::prefixop,@role="negative"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"prefix",
|
|
"default",
|
|
"[m] content/*; [n] children/*[1]",
|
|
"self::prefixop",
|
|
],
|
|
[
|
|
"Rule",
|
|
"postfix",
|
|
"default",
|
|
"[n] children/*[1]; [m] content/*",
|
|
"self::postfixop",
|
|
],
|
|
[
|
|
"Rule",
|
|
"binary-operation",
|
|
"default",
|
|
"[m] children/* (sepFunc:CTXFcontentIterator);",
|
|
"self::infixop",
|
|
],
|
|
'Rule;implicit;default;[m] children/*;self::infixop;@role="implicit"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"implicit",
|
|
"self::infixop",
|
|
'@role="leftsuper" or @role="leftsub" or @role="rightsuper" or @role="rightsub"',
|
|
],
|
|
'Rule,subtraction,default,[m] children/* (separator:"moins");,self::infixop,@role="subtraction"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"function-unknown",
|
|
"default",
|
|
"[n] children/*[1]; [n] children/*[2]",
|
|
"self::appl",
|
|
],
|
|
'Rule,function-prefix,default,[n] children/*[1]; [n] children/*[2],self::appl,children/*[1][@role="prefix function"]'.split(
|
|
",",
|
|
),
|
|
'Rule,fences-open-close,default,[n] content/*[1]; [n] children/*[1]; [n] content/*[2],self::fenced,@role="leftright"'.split(
|
|
",",
|
|
),
|
|
'Rule,fences-neutral,default,[t] "d\u00e9but valeur absolue"; [n] children/*[1]; [t] "fin valeur absolue",self::fenced,@role="neutral",content/*[1][text()]="|" or content/*[1][text()]="\u2758" or content/*[1][text()]="\uff5c"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"fences-neutral",
|
|
"default",
|
|
"sbrief",
|
|
'[t] "valeur absolue"; [n] children/*[1]; [t] "fin valeur absolue"',
|
|
],
|
|
'Rule,fences-neutral,default,[n] content/*[1]; [n] children/*[1]; [n] content/*[2],self::fenced,@role="neutral"'.split(
|
|
",",
|
|
),
|
|
'Rule,fences-set,default,[t] "d\u00e9but ensemble"; [n] children/*[1]; [t] "fin ensemble",self::fenced,@role="set empty" or @role="set extended" or @role="set singleton" or @role="set collection",not(name(../..)="appl")'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"fences-set",
|
|
"default",
|
|
"sbrief",
|
|
'[t] "ensemble"; [n] children/*[1]; [t] "fin ensemble"',
|
|
],
|
|
["Rule", "text", "default", "[n] text()", "self::text"],
|
|
'Rule;factorial;default;[t] "factorielle";self::punctuation;text()="!";name(preceding-sibling::*[1])!="text"'.split(
|
|
";",
|
|
),
|
|
'Rule;minus;default;[t] "moins";self::operator;text()="-"'.split(";"),
|
|
'Rule;single-prime;default;[t] "prime";self::punctuated;@role="prime";count(children/*)=1'.split(
|
|
";",
|
|
),
|
|
'Rule;double-prime;default;[t] "double prime";self::punctuated;@role="prime";count(children/*)=2'.split(
|
|
";",
|
|
),
|
|
'Rule;triple-prime;default;[t] "triple prime";self::punctuated;@role="prime";count(children/*)=3'.split(
|
|
";",
|
|
),
|
|
'Rule;quadruple-prime;default;[t] "quadruple prime";self::punctuated;@role="prime";count(children/*)=4'.split(
|
|
";",
|
|
),
|
|
'Rule,counted-prime,default,[t] count(children/*); [t] "prime",self::punctuated,@role="prime"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"default",
|
|
"[t] CSFopenFracVerbose; [n] children/*[1]; [t] CSFoverFracVerbose; [n] children/*[2]; [t] CSFcloseFracVerbose",
|
|
"self::fraction",
|
|
],
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"brief",
|
|
"[t] CSFopenFracBrief; [n] children/*[1]; [t] CSFoverFracVerbose; [n] children/*[2]; [t] CSFcloseFracBrief",
|
|
"self::fraction",
|
|
],
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"sbrief",
|
|
"[t] CSFopenFracSbrief; [n] children/*[1]; [t] CSFoverFracSbrief; [n] children/*[2]; [t] CSFcloseFracSbrief",
|
|
"self::fraction",
|
|
],
|
|
'Rule;vulgar-fraction;default;[t] CSFvulgarFrFraction;self::fraction;@role="vulgar";CQFvulgarFractionSmall'.split(
|
|
";",
|
|
),
|
|
["SpecializedRule", "vulgar-fraction", "default", "brief"],
|
|
["SpecializedRule", "vulgar-fraction", "default", "sbrief"],
|
|
'Rule,continued-fraction-outer,default,[t] "fraction continue"; [n] children/*[1];[t] "sur"; [n] children/*[2],self::fraction,not(ancestor::fraction),children/*[2]/descendant-or-self::*[@role="ellipsis" and not(following-sibling::*)]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"continued-fraction-outer",
|
|
"default",
|
|
"brief",
|
|
'[t] "frac continue"; [n] children/*[1];[t] "sur"; [n] children/*[2]',
|
|
],
|
|
["SpecializedRule", "continued-fraction-outer", "brief", "sbrief"],
|
|
'Rule,continued-fraction-inner,default,[t] "d\u00e9but fraction"; [n] children/*[1];[t] "sur"; [n] children/*[2],self::fraction,ancestor::fraction,children/*[2]/descendant-or-self::*[@role="ellipsis" and not(following-sibling::*)]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"continued-fraction-inner",
|
|
"default",
|
|
"brief",
|
|
'[t] "d\u00e9but frac"; [n] children/*[1];[t] "sur"; [n] children/*[2]',
|
|
],
|
|
[
|
|
"SpecializedRule",
|
|
"continued-fraction-inner",
|
|
"brief",
|
|
"sbrief",
|
|
'[t] "frac"; [n] children/*[1];[t] "sur"; [n] children/*[2]',
|
|
],
|
|
[
|
|
"Rule",
|
|
"sqrt",
|
|
"default",
|
|
"[t] CSFopenRadicalVerbose; [n] children/*[1]; [t] CSFcloseRadicalVerbose",
|
|
"self::sqrt",
|
|
],
|
|
[
|
|
"Rule",
|
|
"sqrt",
|
|
"brief",
|
|
"[t] CSFopenRadicalBrief; [n] children/*[1]; [t] CSFcloseRadicalBrief",
|
|
"self::sqrt",
|
|
],
|
|
[
|
|
"Rule",
|
|
"sqrt",
|
|
"sbrief",
|
|
"[t] CSFopenRadicalSbrief; [n] children/*[1]; [t] CSFcloseRadicalBrief",
|
|
"self::sqrt",
|
|
],
|
|
"Rule,root-small,default,[t] CSFopenRadicalVerbose; [n] children/*[2]; [t] CSFcloseRadicalVerbose,self::root,CQFisSmallRoot".split(
|
|
",",
|
|
),
|
|
"Rule,root-small,brief,[t] CSFopenRadicalBrief; [n] children/*[2]; [t] CSFcloseRadicalBrief,self::root,CQFisSmallRoot".split(
|
|
",",
|
|
),
|
|
"Rule,root-small,sbrief,[t] CSFopenRadicalSbrief; [n] children/*[2]; [t] CSFcloseRadicalBrief,self::root,CQFisSmallRoot".split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"root",
|
|
"default",
|
|
"[t] CSFindexRadicalVerbose; [n] children/*[1];[t] CSFopenRadicalVerbose; [n] children/*[2]; [t] CSFcloseRadicalVerbose",
|
|
"self::root",
|
|
],
|
|
[
|
|
"Rule",
|
|
"root",
|
|
"brief",
|
|
"[t] CSFindexRadicalBrief; [n] children/*[1];[t] CSFopenRadicalBrief; [n] children/*[2]; [t] CSFcloseRadicalBrief",
|
|
"self::root",
|
|
],
|
|
[
|
|
"Rule",
|
|
"root",
|
|
"sbrief",
|
|
"[t] CSFindexRadicalSbrief; [n] children/*[1];[t] CSFopenRadicalSbrief; [n] children/*[2]; [t] CSFcloseRadicalBrief",
|
|
"self::root",
|
|
],
|
|
'Rule,limboth,default,[n] children/*[1]; [t] "d\u00e9but"; [t] CSFunderscript; [n] children/*[2];[t] "d\u00e9but"; [t] CSFoverscript; [n] children/*[3],self::limboth,name(../..)="underscore" or name(../..)="overscore",following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(
|
|
",",
|
|
),
|
|
'Rule,limlower,default,[n] children/*[1]; [t] "d\u00e9but"; [t] CSFunderscript; [n] children/*[2];,self::limlower,name(../..)="underscore" or name(../..)="overscore",following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(
|
|
",",
|
|
),
|
|
'Rule,limupper,default,[n] children/*[1]; [t] "d\u00e9but"; [t] CSFoverscript; [n] children/*[2];,self::limupper,name(../..)="underscore" or name(../..)="overscore",following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(
|
|
",",
|
|
),
|
|
'Aliases;limlower;self::underscore;@role="limit function";name(../..)="underscore" or name(../..)="overscore";following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(
|
|
";",
|
|
),
|
|
'Aliases;limlower;self::underscore;children/*[2][@role!="underaccent"];name(../..)="underscore" or name(../..)="overscore";following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(
|
|
";",
|
|
),
|
|
'Aliases;limupper;self::overscore;children/*[2][@role!="overaccent"];name(../..)="underscore" or name(../..)="overscore";following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"limboth-end",
|
|
"default",
|
|
'[n] children/*[1]; [t] "d\u00e9but"; [t] CSFunderscript; [n] children/*[2];[t] "d\u00e9but"; [t] CSFoverscript; [n] children/*[3]; [t] "fin scripts"',
|
|
"self::limboth",
|
|
],
|
|
[
|
|
"Rule",
|
|
"limlower-end",
|
|
"default",
|
|
'[n] children/*[1]; [t] "d\u00e9but"; [t] CSFunderscript; [n] children/*[2]; [t] "fin scripts"',
|
|
"self::limlower",
|
|
],
|
|
[
|
|
"Rule",
|
|
"limupper-end",
|
|
"default",
|
|
'[n] children/*[1]; [t] "d\u00e9but"; [t] CSFoverscript; [n] children/*[2]; [t] "fin scripts"',
|
|
"self::limupper",
|
|
],
|
|
["Aliases", "limlower-end", "self::underscore", '@role="limit function"'],
|
|
["Aliases", "limlower-end", "self::underscore"],
|
|
["Aliases", "limupper-end", "self::overscore"],
|
|
[
|
|
"Rule",
|
|
"integral",
|
|
"default",
|
|
"[n] children/*[1]; [n] children/*[2]; [n] children/*[3];",
|
|
"self::integral",
|
|
],
|
|
'Rule,integral,default,[n] children/*[1]; [t] "indice inf\u00e9rieur"; [n] children/*[2];[t] "indice sup\u00e9rieur"; [n] children/*[3]; [t] "position de base";,self::limboth,@role="integral"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"integral",
|
|
"default",
|
|
"brief",
|
|
'[n] children/*[1]; [t] "inf"; [n] children/*[2];[t] "sup"; [n] children/*[3]; [t] "position de base";',
|
|
],
|
|
["SpecializedRule", "integral", "brief", "sbrief"],
|
|
[
|
|
"Rule",
|
|
"bigop",
|
|
"default",
|
|
"[n] children/*[1]; [n] children/*[2];",
|
|
"self::bigop",
|
|
],
|
|
[
|
|
"Rule",
|
|
"relseq",
|
|
"default",
|
|
"[m] children/* (sepFunc:CTXFcontentIterator)",
|
|
"self::relseq",
|
|
],
|
|
'Rule,equality,default,[n] children/*[1]; [n] content/*[1]; [n] children/*[2],self::relseq,@role="equality",count(./children/*)=2'.split(
|
|
",",
|
|
),
|
|
'Rule;multi-equality;default;[m] children/* (sepFunc:CTXFcontentIterator);self::relseq;@role="equality";count(./children/*)>2'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"multrel",
|
|
"default",
|
|
"[m] children/* (sepFunc:CTXFcontentIterator)",
|
|
"self::multirel",
|
|
],
|
|
[
|
|
"Rule",
|
|
"subscript",
|
|
"default",
|
|
"[n] children/*[1]; [t] CSFsubscriptVerbose; [n] children/*[2]",
|
|
"self::subscript",
|
|
],
|
|
[
|
|
"Rule",
|
|
"subscript",
|
|
"brief",
|
|
"[n] children/*[1]; [t] CSFsubscriptBrief; [n] children/*[2]",
|
|
"self::subscript",
|
|
],
|
|
["SpecializedRule", "subscript", "brief", "sbrief"],
|
|
'Rule,subscript-base,default,[n] children/*[1]; [t] "base"; [n] children/*[2],self::subscript,CQFisLogarithm,self::*,self::*,self::*'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "subscript-base", "default", "brief"],
|
|
["SpecializedRule", "subscript-base", "default", "sbrief"],
|
|
'Rule,subscript-simple,brief,[n] children/*[1]; [n] children/*[2],self::subscript,name(./children/*[1])="identifier",name(./children/*[2])="number",./children/*[2][@role!="mixed"],./children/*[2][@role!="othernumber"]'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "subscript-simple", "brief", "sbrief"],
|
|
'Rule,subscript-baseline,default,[n] children/*[1]; [t] CSFsubscriptVerbose; [n] children/*[2]; [t] CSFbaselineVerbose,self::subscript,following-sibling::*,not(name(following-sibling::subscript/children/*[1])="empty" or (name(following-sibling::infixop[@role="implicit"]/children/*[1])="subscript" and name(following-sibling::*/children/*[1]/children/*[1])="empty")) and @role!="subsup",not(following-sibling::*[@role="rightsuper" or @role="rightsub" or @role="leftsub" or @role="leftsub"])'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"subscript-baseline",
|
|
"default",
|
|
"brief",
|
|
"[n] children/*[1]; [t] CSFsubscriptBrief; [n] children/*[2]; [t] CSFbaselineBrief",
|
|
],
|
|
["SpecializedRule", "subscript-baseline", "brief", "sbrief"],
|
|
'Aliases;subscript-baseline;self::subscript;not(following-sibling::*);ancestor::fenced|ancestor::root|ancestor::sqrt|ancestor::punctuated|ancestor::fraction;not(ancestor::punctuated[@role="leftsuper" or @role="rightsub" or @role="rightsuper" or @role="rightsub"])'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"subscript-baseline",
|
|
"self::subscript",
|
|
"not(following-sibling::*)",
|
|
"ancestor::relseq|ancestor::multirel",
|
|
sre.MathspeakUtil.generateBaselineConstraint(),
|
|
],
|
|
[
|
|
"Aliases",
|
|
"subscript-baseline",
|
|
"self::subscript",
|
|
"not(following-sibling::*)",
|
|
"@embellished",
|
|
],
|
|
'Rule,subscript-empty-sup,default,[n] children/*[1]; [n] children/*[2],self::subscript,name(children/*[2])="infixop",name(children/*[2][@role="implicit"]/children/*[1])="superscript",name(children/*[2]/children/*[1]/children/*[1])="empty"'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "subscript-empty-sup", "default", "brief"],
|
|
["SpecializedRule", "subscript-empty-sup", "brief", "sbrief"],
|
|
[
|
|
"Aliases",
|
|
"subscript-empty-sup",
|
|
"self::subscript",
|
|
'name(children/*[2])="superscript"',
|
|
'name(children/*[2]/children/*[1])="empty"',
|
|
],
|
|
[
|
|
"Rule",
|
|
"superscript",
|
|
"default",
|
|
"[n] children/*[1]; [t] CSFsuperscriptVerbose; [n] children/*[2]",
|
|
"self::superscript",
|
|
],
|
|
[
|
|
"SpecializedRule",
|
|
"superscript",
|
|
"default",
|
|
"brief",
|
|
"[n] children/*[1]; [t] CSFsuperscriptBrief; [n] children/*[2]",
|
|
],
|
|
["SpecializedRule", "superscript", "brief", "sbrief"],
|
|
'Rule,superscript-baseline,default,[n] children/*[1]; [t] CSFsuperscriptVerbose; [n] children/*[2];[t] CSFbaselineVerbose,self::superscript,following-sibling::*,not(name(following-sibling::superscript/children/*[1])="empty" or (name(following-sibling::infixop[@role="implicit"]/children/*[1])="superscript" and name(following-sibling::*/children/*[1]/children/*[1])="empty")) and not(following-sibling::*[@role="rightsuper" or @role="rightsub" or @role="leftsub" or @role="leftsub"])'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"superscript-baseline",
|
|
"default",
|
|
"brief",
|
|
"[n] children/*[1]; [t] CSFsuperscriptBrief; [n] children/*[2];[t] CSFbaselineBrief",
|
|
],
|
|
["SpecializedRule", "superscript-baseline", "brief", "sbrief"],
|
|
'Aliases;superscript-baseline;self::superscript;not(following-sibling::*);ancestor::punctuated;ancestor::*/following-sibling::* and not(ancestor::punctuated[@role="leftsuper" or @role="rightsub" or @role="rightsuper" or @role="rightsub"])'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"superscript-baseline",
|
|
"self::superscript",
|
|
"not(following-sibling::*)",
|
|
"ancestor::fraction|ancestor::fenced|ancestor::root|ancestor::sqrt",
|
|
],
|
|
[
|
|
"Aliases",
|
|
"superscript-baseline",
|
|
"self::superscript",
|
|
"not(following-sibling::*)",
|
|
"ancestor::relseq|ancestor::multirel",
|
|
"not(@embellished)",
|
|
sre.MathspeakUtil.generateBaselineConstraint(),
|
|
],
|
|
'Aliases superscript-baseline self::superscript not(following-sibling::*) @embellished not(children/*[2][@role="prime"])'.split(
|
|
" ",
|
|
),
|
|
'Rule,superscript-empty-sub,default,[n] children/*[1]; [n] children/*[2],self::superscript,name(children/*[2])="infixop",name(children/*[2][@role="implicit"]/children/*[1])="subscript",name(children/*[2]/children/*[1]/children/*[1])="empty"'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "superscript-empty-sub", "default", "brief"],
|
|
["SpecializedRule", "superscript-empty-sub", "brief", "sbrief"],
|
|
[
|
|
"Aliases",
|
|
"superscript-empty-sub",
|
|
"self::superscript",
|
|
'name(children/*[2])="subscript"',
|
|
'name(children/*[2]/children/*[1])="empty"',
|
|
],
|
|
'Rule,square,default,[n] children/*[1]; [t] "au carr\u00e9",self::superscript,children/*[2],children/*[2][text()=2],name(children/*[1])!="text" or not(name(children/*[1])="text" and (name(../../../punctuated[@role="text"]/..)="stree" or name(..)="stree")),name(children/*[1])!="subscript" or (name(children/*[1])="subscript" and name(children/*[1]/children/*[1])="identifier" and name(children/*[1]/children/*[2])="number" and children/*[1]/children/*[2][@role!="mixed"] and children/*[1]/children/*[2][@role!="othernumber"]),not(@embellished)'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "square", "default", "brief"],
|
|
["SpecializedRule", "square", "default", "sbrief"],
|
|
'Aliases;square;self::superscript;children/*[2];children/*[2][text()=2];@embellished;children/*[1][@role="prefix operator"]'.split(
|
|
";",
|
|
),
|
|
'Rule,cube,default,[n] children/*[1]; [t] "cubique",self::superscript,children/*[2],children/*[2][text()=3],name(children/*[1])!="text" or not(name(children/*[1])="text" and (name(../../../punctuated[@role="text"]/..)="stree" or name(..)="stree")),name(children/*[1])!="subscript" or (name(children/*[1])="subscript" and name(children/*[1]/children/*[1])="identifier" and name(children/*[1]/children/*[2])="number" and children/*[1]/children/*[2][@role!="mixed"] and children/*[1]/children/*[2][@role!="othernumber"]),not(@embellished)'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "cube", "default", "brief"],
|
|
["SpecializedRule", "cube", "default", "sbrief"],
|
|
'Aliases;cube;self::superscript;children/*[2];children/*[2][text()=3];@embellished;children/*[1][@role="prefix operator"]'.split(
|
|
";",
|
|
),
|
|
'Rule,prime,default,[n] children/*[1]; [n] children/*[2],self::superscript,children/*[2],children/*[2][@role="prime"]'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "prime", "default", "brief"],
|
|
["SpecializedRule", "prime", "default", "sbrief"],
|
|
'Rule,prime-subscript,default,[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptVerbose; [n] children/*[1]/children/*[2],self::superscript,children/*[2][@role="prime"],name(children/*[1])="subscript",not(following-sibling::*)'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"prime-subscript",
|
|
"default",
|
|
"brief",
|
|
"[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptBrief; [n] children/*[1]/children/*[2]",
|
|
],
|
|
["SpecializedRule", "prime-subscript", "brief", "sbrief"],
|
|
'Rule,prime-subscript-baseline,default,[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptVerbose; [n] children/*[1]/children/*[2]; [t] CSFbaselineVerbose,self::superscript,children/*[2][@role="prime"],name(children/*[1])="subscript",following-sibling::*'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"prime-subscript-baseline",
|
|
"default",
|
|
"brief",
|
|
"[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptBrief; [n] children/*[1]/children/*[2]; [t] CSFbaselineBrief",
|
|
],
|
|
["SpecializedRule", "prime-subscript-baseline", "brief", "sbrief"],
|
|
'Aliases prime-subscript-baseline self::superscript children/*[2][@role="prime"] name(children/*[1])="subscript" not(following-sibling::*) @embellished'.split(
|
|
" ",
|
|
),
|
|
'Rule,prime-subscript-simple,brief,[n] children/*[1]/children/*[1]; [n] children/*[2];[n] children/*[1]/children/*[2],self::superscript,children/*[2][@role="prime"],name(children/*[1])="subscript",name(children/*[1]/children/*[1])="identifier",name(children/*[1]/children/*[2])="number",children/*[1]/children/*[2][@role!="mixed"],children/*[1]/children/*[2][@role!="othernumber"]'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "prime-subscript-simple", "brief", "sbrief"],
|
|
'Rule,overscore,default,[t] "suscrire"; [n] children/*[1]; [t] "avec"; [n] children/*[2],self::overscore,children/*[2][@role="overaccent"]'.split(
|
|
",",
|
|
),
|
|
'Rule,double-overscore,default,[t] "sus-suscrire"; [n] children/*[1]; [t] "avec"; [n] children/*[2],self::overscore,children/*[2][@role="overaccent"],name(children/*[1])="overscore",children/*[1]/children/*[2][@role="overaccent"]'.split(
|
|
",",
|
|
),
|
|
'Rule,underscore,default,[t] "souscrire"; [n] children/*[1]; [t] "avec"; [n] children/*[2],self::underscore,children/*[2][@role="underaccent"]'.split(
|
|
",",
|
|
),
|
|
'Rule,double-underscore,default,[t] "sous-souscrire"; [n] children/*[1]; [t] "avec"; [n] children/*[2],self::underscore,children/*[2][@role="underaccent"],name(children/*[1])="underscore",children/*[1]/children/*[2][@role="underaccent"]'.split(
|
|
",",
|
|
),
|
|
'Rule,matrix-fence,default,[n] children/*[1];,self::fenced,count(children/*)=1,name(children/*[1])="matrix"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"matrix",
|
|
"default",
|
|
'[t] "d\u00e9but matrice"; [t] count(children/*); [t] "par";[t] count(children/*[1]/children/*); [m] children/* (ctxtFunc:CTXFordinalCounter,context:"rang\u00e9e "); [t] "fin matrice"',
|
|
"self::matrix",
|
|
],
|
|
[
|
|
"Rule",
|
|
"matrix",
|
|
"sbrief",
|
|
'[t] "matrice"; [t] count(children/*); [t] "par";[t] count(children/*[1]/children/*); [m] children/* (ctxtFunc:CTXFordinalCounter,context:"rang\u00e9e "); [t] "fin matrice"',
|
|
"self::matrix",
|
|
],
|
|
["Aliases", "matrix", "self::vector"],
|
|
[
|
|
"Rule",
|
|
"matrix-row",
|
|
"default",
|
|
'[m] children/* (ctxtFunc:CTXFordinalCounter,context:"colonne");[p] (pause: 200)',
|
|
"self::row",
|
|
],
|
|
'Rule{row-with-label{default{[t] "avec \u00e9tiquette"; [n] content/*[1]; [t] "fin \u00e9tiquette"(pause: 200); [m] children/* (ctxtFunc:CTXFordinalCounter,context:"colonne"){self::row{content'.split(
|
|
"{",
|
|
),
|
|
'Rule{row-with-label{brief{[t] "\u00e9tiquette"; [n] content/*[1]; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"colonne"){self::row{content'.split(
|
|
"{",
|
|
),
|
|
["SpecializedRule", "row-with-label", "brief", "sbrief"],
|
|
'Rule{row-with-text-label{sbrief{[t] "\u00e9tiquette"; [t] CSFRemoveParens;[m] children/* (ctxtFunc:CTXFordinalCounter,context:"colonne"){self::row{content{name(content/cell/children/*[1])="text"'.split(
|
|
"{",
|
|
),
|
|
'Rule;empty-row;default;[t] "vide";self::row;count(children/*)=0'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"matrix-cell",
|
|
"default",
|
|
"[n] children/*[1]; [p] (pause: 300)",
|
|
"self::cell",
|
|
],
|
|
'Rule,empty-cell,default,[t] "vide"; [p] (pause: 300),self::cell,count(children/*)=0'.split(
|
|
",",
|
|
),
|
|
'Rule{determinant{default{[t] "d\u00e9but d\u00e9terminant"; [t] count(children/*); [t] "par";[t] count(children/*[1]/children/*); [t] ""; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"rang\u00e9e "); [t] "fin d\u00e9terminant"{self::matrix{@role="determinant"'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"determinant",
|
|
"default",
|
|
"sbrief",
|
|
'[t] "d\u00e9terminant"; [t] count(children/*); [t] "par";[t] count(children/*[1]/children/*); [m] children/* (ctxtFunc:CTXFordinalCounter,context:"rang\u00e9e "); [t] "fin d\u00e9terminant"',
|
|
],
|
|
'Rule{determinant-simple{default{[t] "d\u00e9but d\u00e9terminant"; [t] count(children/*); [t] "par";[t] count(children/*[1]/children/*); [m] children/* (ctxtFunc:CTXFordinalCounter,context:"rang\u00e9e",grammar:simpleDet); [t] "fin d\u00e9terminant"{self::matrix{@role="determinant"{CQFdetIsSimple'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"determinant-simple",
|
|
"default",
|
|
"sbrief",
|
|
'[t] "d\u00e9terminant"; [t] count(children/*); [t] "par";[t] count(children/*[1]/children/*); [m] children/* (ctxtFunc:CTXFordinalCounter,context:"rang\u00e9e",grammar:simpleDet); [t] "fin d\u00e9terminant"',
|
|
],
|
|
'Rule{row-simple{default{[m] children/*;{self::row{@role="determinant"{contains(@grammar, "simpleDet")'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"layout",
|
|
"default",
|
|
'[t] "d\u00e9but tableau"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"rang\u00e9e "); [t] "fin tableau"',
|
|
"self::table",
|
|
],
|
|
[
|
|
"Rule",
|
|
"layout",
|
|
"sbrief",
|
|
'[t] "tableau"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"rang\u00e9e "); [t] "fin tableau"',
|
|
"self::table",
|
|
],
|
|
'Rule,binomial,default,[t] "d\u00e9but binomiale"; [n] children/*[2]/children/*[1]; [t] "parmi"; [n] children/*[1]/children/*[1]; [t] "fin binomiale",self::vector,@role="binomial"'.split(
|
|
",",
|
|
),
|
|
'Rule,binomial,sbrief,[t] "binomiale"; [n] children/*[1]/children/*[1]; [t] "parmi"; [n] children/*[2]/children/*[1]; [t] "fin binomiale",self::vector,@role="binomial"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"cases",
|
|
"default",
|
|
'[t] "d\u00e9but tableau"; [n] content/*[1]; [t] "\u00e9largie";[m] children/* (ctxtFunc:CTXFordinalCounter,context:"rang\u00e9e "); [t] "fin tableau"',
|
|
"self::cases",
|
|
],
|
|
[
|
|
"Rule",
|
|
"cases",
|
|
"sbrief",
|
|
'[t] "tableau"; [n] content/*[1]; [t] "\u00e9largie"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"rang\u00e9e "); [t] "fin tableau"',
|
|
"self::cases",
|
|
],
|
|
["Aliases", "layout", "self::multiline"],
|
|
["Rule", "line", "default", "[m] children/*", "self::line"],
|
|
'Rule,line-with-label,default,[t] "avec etiquette"; [n] content/*[1]; [t] "fin etiquette" (pause: 200); [m] children/*,self::line,content'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"line-with-label",
|
|
"default",
|
|
"brief",
|
|
'[t] "etiquette"; [n] content/*[1] (pause: 200); [m] children/*',
|
|
],
|
|
["SpecializedRule", "line-with-label", "brief", "sbrief"],
|
|
'Rule,line-with-text-label,sbrief,[t] "etiquette"; [t] CSFRemoveParens; [m] children/*,self::line,content,name(content/cell/children/*[1])="text"'.split(
|
|
",",
|
|
),
|
|
'Rule;empty-line;default;[t] "vide";self::line;count(children/*)=0;not(content)'.split(
|
|
";",
|
|
),
|
|
["SpecializedRule", "empty-line", "default", "brief"],
|
|
["SpecializedRule", "empty-line", "brief", "sbrief"],
|
|
'Rule,empty-line-with-label,default,[t] "avec etiquette"; [n] content/*[1]; [t] "fin etiquette" (pause: 200); [t] "vide",self::line,count(children/*)=0,content'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"empty-line-with-label",
|
|
"default",
|
|
"brief",
|
|
'[t] "etiquette"; [n] content/*[1] (pause: 200); [t] "vide"',
|
|
],
|
|
["SpecializedRule", "empty-line-with-label", "brief", "sbrief"],
|
|
[
|
|
"Rule",
|
|
"enclose",
|
|
"default",
|
|
'[t] "d\u00e9but enfermer en"; [t] @role (grammar:localEnclose); [n] children/*[1]; [t] "fin enfermer"',
|
|
"self::enclose",
|
|
],
|
|
'Rule,overbar,default,[t] "d\u00e9but trait suscrit"; [n] children/*[1]; [t] "fin trait suscrit",self::enclose,@role="top"'.split(
|
|
",",
|
|
),
|
|
'Rule,underbar,default,[t] "d\u00e9but trait souscrit"; [n] children/*[1]; [t] "fin trait souscrit",self::enclose,@role="bottom"'.split(
|
|
",",
|
|
),
|
|
'Rule,leftbar,default,[t] "barre verticale"; [n] children/*[1],self::enclose,@role="left"'.split(
|
|
",",
|
|
),
|
|
'Rule,rightbar,default,[n] children/*[1]; [t] "barre verticale",self::enclose,@role="right"'.split(
|
|
",",
|
|
),
|
|
'Rule,crossout,default,[t] "d\u00e9but biff\u00e9"; [n] children/*[1]; [t] "fin biff\u00e9",self::enclose,@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"'.split(
|
|
",",
|
|
),
|
|
'Rule,cancel,default,[t] "d\u00e9but biff\u00e9"; [n] children/*[1]/children/*[1]; [t] "avec"; [n] children/*[2]; [t] "fin biff\u00e9",self::overscore,@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "cancel", "default", "brief"],
|
|
["SpecializedRule", "cancel", "default", "sbrief"],
|
|
[
|
|
"Aliases",
|
|
"cancel",
|
|
"self::underscore",
|
|
'@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"',
|
|
],
|
|
'Rule,cancel-reverse,default,[t] "d\u00e9but biff\u00e9"; [n] children/*[2]/children/*[1]; [t] "avec"; [n] children/*[1]; [t] "fin biff\u00e9",self::overscore,name(children/*[2])="enclose",children/*[2][@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"]'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "cancel-reverse", "default", "brief"],
|
|
["SpecializedRule", "cancel-reverse", "default", "sbrief"],
|
|
[
|
|
"Aliases",
|
|
"cancel-reverse",
|
|
"self::underscore",
|
|
'name(children/*[2])="enclose"',
|
|
'children/*[2][@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"]',
|
|
],
|
|
'Rule;end-punct;default;[m] children/*;self::punctuated;@role="endpunct"'.split(
|
|
";",
|
|
),
|
|
'Rule,start-punct,default,[n] content/*[1]; [m] children/*[position()>1],self::punctuated,@role="startpunct"'.split(
|
|
",",
|
|
),
|
|
'Rule,integral-punct,default,[n] children/*[1]; [n] children/*[3],self::punctuated,@role="integral"'.split(
|
|
",",
|
|
),
|
|
["Rule", "punctuated", "default", "[m] children/*", "self::punctuated"],
|
|
'Rule;unit;default;[t] text() (grammar:annotation="unit":translate);self::identifier;@role="unit"'.split(
|
|
";",
|
|
),
|
|
'Rule,unit-square,default,[n] children/*[1]; [t] "carr\u00e9",self::superscript,@role="unit",children/*[2][text()=2],name(children/*[1])="identifier"'.split(
|
|
",",
|
|
),
|
|
'Rule,unit-cubic,default,[n] children/*[1]; [t] "cubique",self::superscript,@role="unit",children/*[2][text()=3],name(children/*[1])="identifier"'.split(
|
|
",",
|
|
),
|
|
'Rule,reciprocal,default,[t] "r\u00e9ciproque"; [n] children/*[1],self::superscript,@role="unit",name(children/*[1])="identifier",name(children/*[2])="prefixop",children/*[2][@role="negative"],children/*[2]/children/*[1][text()=1],count(preceding-sibling::*)=0 or preceding-sibling::*[@role!="unit"]'.split(
|
|
",",
|
|
),
|
|
'Rule,reciprocal,default,[t] "par"; [n] children/*[1],self::superscript,@role="unit",name(children/*[1])="identifier",name(children/*[2])="prefixop",children/*[2][@role="negative"],children/*[2]/children/*[1][text()=1],preceding-sibling::*[@role="unit"]'.split(
|
|
",",
|
|
),
|
|
'Rule;unit-combine;default;[m] children/*;self::infixop;@role="unit"'.split(
|
|
";",
|
|
),
|
|
'Rule,unit-divide,default,[n] children/*[1]; [t] "par"; [n] children/*[2],self::fraction,@role="unit"'.split(
|
|
",",
|
|
),
|
|
],
|
|
initialize: [sre.MathspeakUtil.generateTensorRules],
|
|
};
|
|
sre.MathspeakGerman = {
|
|
locale: "de",
|
|
domain: "mathspeak",
|
|
functions: [
|
|
["CQF", "CQFspaceoutNumber", sre.MathspeakUtil.spaceoutNumber],
|
|
["CQF", "CQFspaceoutIdentifier", sre.MathspeakUtil.spaceoutIdentifier],
|
|
["CSF", "CSFspaceoutText", sre.MathspeakUtil.spaceoutText],
|
|
["CSF", "CSFopenFracVerbose", sre.MathspeakUtil.openingFractionVerbose],
|
|
["CSF", "CSFcloseFracVerbose", sre.MathspeakUtil.closingFractionVerbose],
|
|
["CSF", "CSFoverFracVerbose", sre.MathspeakUtil.overFractionVerbose],
|
|
["CSF", "CSFopenFracBrief", sre.MathspeakUtil.openingFractionBrief],
|
|
["CSF", "CSFcloseFracBrief", sre.MathspeakUtil.closingFractionBrief],
|
|
["CSF", "CSFopenFracSbrief", sre.MathspeakUtil.openingFractionSbrief],
|
|
["CSF", "CSFcloseFracSbrief", sre.MathspeakUtil.closingFractionSbrief],
|
|
["CSF", "CSFoverFracSbrief", sre.MathspeakUtil.overFractionSbrief],
|
|
["CSF", "CSFvulgarFraction", sre.NumbersUtil.vulgarFraction],
|
|
["CQF", "CQFvulgarFractionSmall", sre.MathspeakUtil.isSmallVulgarFraction],
|
|
["CSF", "CSFopenRadicalVerbose", sre.MathspeakUtil.openingRadicalVerbose],
|
|
["CSF", "CSFcloseRadicalVerbose", sre.MathspeakUtil.closingRadicalVerbose],
|
|
["CSF", "CSFindexRadicalVerbose", sre.MathspeakUtil.indexRadicalVerbose],
|
|
["CSF", "CSFopenRadicalBrief", sre.MathspeakUtil.openingRadicalBrief],
|
|
["CSF", "CSFcloseRadicalBrief", sre.MathspeakUtil.closingRadicalBrief],
|
|
["CSF", "CSFindexRadicalBrief", sre.MathspeakUtil.indexRadicalBrief],
|
|
["CSF", "CSFopenRadicalSbrief", sre.MathspeakUtil.openingRadicalSbrief],
|
|
["CSF", "CSFindexRadicalSbrief", sre.MathspeakUtil.indexRadicalSbrief],
|
|
["CSF", "CSFsuperscriptVerbose", sre.MathspeakUtil.superscriptVerbose],
|
|
["CSF", "CSFsuperscriptBrief", sre.MathspeakUtil.superscriptBrief],
|
|
["CSF", "CSFsubscriptVerbose", sre.MathspeakUtil.subscriptVerbose],
|
|
["CSF", "CSFsubscriptBrief", sre.MathspeakUtil.subscriptBrief],
|
|
["CSF", "CSFbaselineVerbose", sre.MathspeakUtil.baselineVerbose],
|
|
["CSF", "CSFbaselineBrief", sre.MathspeakUtil.baselineBrief],
|
|
["CSF", "CSFleftsuperscriptVerbose", sre.MathspeakUtil.superscriptVerbose],
|
|
["CSF", "CSFleftsubscriptVerbose", sre.MathspeakUtil.subscriptVerbose],
|
|
["CSF", "CSFrightsuperscriptVerbose", sre.MathspeakUtil.superscriptVerbose],
|
|
["CSF", "CSFrightsubscriptVerbose", sre.MathspeakUtil.subscriptVerbose],
|
|
["CSF", "CSFleftsuperscriptBrief", sre.MathspeakUtil.superscriptBrief],
|
|
["CSF", "CSFleftsubscriptBrief", sre.MathspeakUtil.subscriptBrief],
|
|
["CSF", "CSFrightsuperscriptBrief", sre.MathspeakUtil.superscriptBrief],
|
|
["CSF", "CSFrightsubscriptBrief", sre.MathspeakUtil.subscriptBrief],
|
|
["CSF", "CSFunderscript", sre.MathspeakUtil.nestedUnderscore],
|
|
["CSF", "CSFoverscript", sre.MathspeakUtil.nestedOverscore],
|
|
["CTXF", "CTXFordinalCounter", sre.NumbersUtil.ordinalCounter],
|
|
["CTXF", "CTXFcontentIterator", sre.StoreUtil.contentIterator],
|
|
["CQF", "CQFdetIsSimple", sre.MathspeakUtil.determinantIsSimple],
|
|
["CSF", "CSFRemoveParens", sre.MathspeakUtil.removeParens],
|
|
["CQF", "CQFresetNesting", sre.MathspeakUtil.resetNestingDepth],
|
|
],
|
|
rules: [
|
|
'Rule{collapsed{default{[n] . (engine:modality=summary,grammar:collapsed); [t] "kollabiert"{self::*{@alternative{not(contains(@grammar, "collapsed")){self::*{self::*{self::*{self::*{self::*'.split(
|
|
"{",
|
|
),
|
|
["SpecializedRule", "collapsed", "default", "brief"],
|
|
["SpecializedRule", "collapsed", "brief", "sbrief"],
|
|
"Rule;stree;default;[n] ./*[1];self::stree;CQFresetNesting".split(";"),
|
|
["Rule", "unknown", "default", "[n] text()", "self::unknown"],
|
|
'Rule;protected;default;[t] text();self::number;contains(@grammar, "protected")'.split(
|
|
";",
|
|
),
|
|
["Rule", "omit-empty", "default", "[p] (pause:100)", "self::empty"],
|
|
'Rule;blank-empty;default;[t] "leer";self::empty;count(../*)=1;name(../..)="cell" or name(../..)="line"'.split(
|
|
";",
|
|
),
|
|
'Rule{font{default{[t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font){self::*{name(self::*)!="number"{@font{not(contains(@grammar, "ignoreFont")){@font!="normal"'.split(
|
|
"{",
|
|
),
|
|
'Rule{font-number{default{[t] @font (grammar:localFontNumber); [n] . (grammar:ignoreFont=@font){self::number{@font{not(contains(@grammar, "ignoreFont")){@font!="normal"'.split(
|
|
"{",
|
|
),
|
|
'Rule{font-identifier-short{default{[t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font){self::identifier{string-length(text())=1{@font{not(contains(@grammar, "ignoreFont")){@font="normal"{""=translate(text(), "abcdefghijklmnopqrstuvwxyz\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9", ""){@role!="unit"'.split(
|
|
"{",
|
|
),
|
|
'Rule{font-identifier{default{[t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font){self::identifier{string-length(text())=1 or string-length(text())=2{@font{@font="normal"{not(contains(@grammar, "ignoreFont")){@role!="unit"'.split(
|
|
"{",
|
|
),
|
|
'Rule;omit-font;default;[n] . (grammar:ignoreFont=@font);self::identifier;string-length(text())=1 or string-length(text())=2;@font;not(contains(@grammar, "ignoreFont"));@font="italic";self::*'.split(
|
|
";",
|
|
),
|
|
'Rule{font-double-struck{default{[n] . (grammar:ignoreFont=@font); [t] @font (grammar:localFont){self::*{name(self::*)!="number"{string-length(text())=1 or string-length(text())=2{@font{not(contains(@grammar, "ignoreFont")){@font="double-struck"'.split(
|
|
"{",
|
|
),
|
|
'Rule{font-number-double-struck{default{[n] . (grammar:ignoreFont=@font); [t] @font (grammar:localFontNumber){self::number{string-length(text())=1 or string-length(text())=2{@font{not(contains(@grammar, "ignoreFont")){@font="double-struck"'.split(
|
|
"{",
|
|
),
|
|
["Rule", "number", "default", "[n] text()", "self::number"],
|
|
'Rule,mixed-number,default,[n] children/*[1]; [n] children/*[2]; ,self::number,@role="mixed"'.split(
|
|
",",
|
|
),
|
|
'Rule{number-with-chars{default{[t] "Zahl"; [m] CQFspaceoutNumber (grammar:protected){self::number{@role="othernumber"{"" != translate(text(), "0123456789.,", ""){not(contains(@grammar, "protected"))'.split(
|
|
"{",
|
|
),
|
|
'Rule{number-as-upper-word{default{[t] "Wort gro\u00df"; [t] CSFspaceoutText{self::number{string-length(text())>1{text()=translate(text(), "abcdefghijklmnopqrstuvwxyz\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9", "ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9"){""=translate(text(), "ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9","")'.split(
|
|
"{",
|
|
),
|
|
["SpecializedRule", "number-as-upper-word", "default", "brief"],
|
|
["SpecializedRule", "number-as-upper-word", "default", "sbrief"],
|
|
'Rule{number-baseline{default{[t] "Grundlinie"; [n] . (grammar:baseline){self::number{not(contains(@grammar, "ignoreFont")){preceding-sibling::identifier{not(contains(@grammar, "baseline")){preceding-sibling::*[1][@role="latinletter" or @role="greekletter" or @role="otherletter"]{parent::*/parent::infixop[@role="implicit"]'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"number-baseline",
|
|
"default",
|
|
"brief",
|
|
'[t] "Grund"; [n] . (grammar:baseline)',
|
|
],
|
|
["SpecializedRule", "number-baseline", "brief", "sbrief"],
|
|
'Rule{number-baseline-font{default{[t] "Grundlinie"; [t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font){self::number{@font{not(contains(@grammar, "ignoreFont")){@font!="normal"{preceding-sibling::identifier{preceding-sibling::*[@role="latinletter" or @role="greekletter" or @role="otherletter"]{parent::*/parent::infixop[@role="implicit"]'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"number-baseline-font",
|
|
"default",
|
|
"brief",
|
|
'[t] "Grund"; [t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font)',
|
|
],
|
|
["SpecializedRule", "number-baseline-font", "brief", "sbrief"],
|
|
'Rule;identifier;default;[m] CQFspaceoutIdentifier;self::identifier;string-length(text())>1;@role!="unit";not(@font) or @font="normal" or contains(@grammar, "ignoreFont");text()!=translate(text(), "abcdefghijklmnopqrstuvwxyz\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9", "")'.split(
|
|
";",
|
|
),
|
|
["Rule", "identifier", "default", "[n] text()", "self::identifier"],
|
|
'Rule,negative,default,[t] "minus"; [n] children/*[1],self::prefixop,@role="negative",children/identifier'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"negative",
|
|
"self::prefixop",
|
|
'@role="negative"',
|
|
"children/number",
|
|
],
|
|
[
|
|
"Aliases",
|
|
"negative",
|
|
"self::prefixop",
|
|
'@role="negative"',
|
|
'children/fraction[@role="vulgar"]',
|
|
],
|
|
'Rule,negative,default,[t] "minus"; [n] children/*[1],self::prefixop,@role="negative"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"prefix",
|
|
"default",
|
|
"[m] content/*; [n] children/*[1]",
|
|
"self::prefixop",
|
|
],
|
|
[
|
|
"Rule",
|
|
"postfix",
|
|
"default",
|
|
"[n] children/*[1]; [m] content/*",
|
|
"self::postfixop",
|
|
],
|
|
[
|
|
"Rule",
|
|
"binary-operation",
|
|
"default",
|
|
"[m] children/* (sepFunc:CTXFcontentIterator);",
|
|
"self::infixop",
|
|
],
|
|
'Rule;implicit;default;[m] children/*;self::infixop;@role="implicit"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"implicit",
|
|
"self::infixop",
|
|
'@role="leftsuper" or @role="leftsub" or @role="rightsuper" or @role="rightsub"',
|
|
],
|
|
'Rule,subtraction,default,[m] children/* (separator:"minus");,self::infixop,@role="subtraction"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"function-unknown",
|
|
"default",
|
|
"[n] children/*[1]; [n] children/*[2]",
|
|
"self::appl",
|
|
],
|
|
'Rule,function-prefix,default,[n] children/*[1]; [n] children/*[2],self::appl,children/*[1][@role="prefix function"]'.split(
|
|
",",
|
|
),
|
|
'Rule,fences-open-close,default,[n] content/*[1]; [n] children/*[1]; [n] content/*[2],self::fenced,@role="leftright"'.split(
|
|
",",
|
|
),
|
|
'Rule,fences-neutral,default,[t] "Anfang Betrag"; [n] children/*[1]; [t] "Ende Betrag",self::fenced,@role="neutral",content/*[1][text()]="|" or content/*[1][text()]="\u2758" or content/*[1][text()]="\uff5c"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"fences-neutral",
|
|
"default",
|
|
"sbrief",
|
|
'[t] "Betrag"; [n] children/*[1]; [t] "Ende Betrag"',
|
|
],
|
|
'Rule,fences-neutral,default,[n] content/*[1]; [n] children/*[1]; [n] content/*[2],self::fenced,@role="neutral"'.split(
|
|
",",
|
|
),
|
|
'Rule,fences-set,default,[t] "Anfang Menge"; [n] children/*[1]; [t] "Ende Menge",self::fenced,@role="set empty" or @role="set extended" or @role="set singleton" or @role="set collection",not(name(../..)="appl")'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"fences-set",
|
|
"default",
|
|
"sbrief",
|
|
'[t] "Menge"; [n] children/*[1]; [t] "Ende Menge"',
|
|
],
|
|
["Rule", "text", "default", "[n] text()", "self::text"],
|
|
'Rule;factorial;default;[t] "Fakult\u00e4t";self::punctuation;text()="!";name(preceding-sibling::*[1])!="text"'.split(
|
|
";",
|
|
),
|
|
'Rule;minus;default;[t] "minus";self::operator;text()="-"'.split(";"),
|
|
'Rule;single-prime;default;[t] "Strich";self::punctuated;@role="prime";count(children/*)=1'.split(
|
|
";",
|
|
),
|
|
'Rule;double-prime;default;[t] "zwei Strich";self::punctuated;@role="prime";count(children/*)=2'.split(
|
|
";",
|
|
),
|
|
'Rule;triple-prime;default;[t] "drei Strich";self::punctuated;@role="prime";count(children/*)=3'.split(
|
|
";",
|
|
),
|
|
'Rule;quadruple-prime;default;[t] "vier Strich";self::punctuated;@role="prime";count(children/*)=4'.split(
|
|
";",
|
|
),
|
|
'Rule,counted-prime,default,[t] count(children/*); [t] "Strich",self::punctuated,@role="prime"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"default",
|
|
"[t] CSFopenFracVerbose; [n] children/*[1]; [t] CSFoverFracVerbose; [n] children/*[2]; [t] CSFcloseFracVerbose",
|
|
"self::fraction",
|
|
],
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"brief",
|
|
"[t] CSFopenFracBrief; [n] children/*[1]; [t] CSFoverFracVerbose; [n] children/*[2]; [t] CSFcloseFracBrief",
|
|
"self::fraction",
|
|
],
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"sbrief",
|
|
"[t] CSFopenFracSbrief; [n] children/*[1]; [t] CSFoverFracSbrief; [n] children/*[2]; [t] CSFcloseFracSbrief",
|
|
"self::fraction",
|
|
],
|
|
'Rule;vulgar-fraction;default;[t] CSFvulgarFraction (grammar:correctOne);self::fraction;@role="vulgar";CQFvulgarFractionSmall'.split(
|
|
";",
|
|
),
|
|
["SpecializedRule", "vulgar-fraction", "default", "brief"],
|
|
["SpecializedRule", "vulgar-fraction", "default", "sbrief"],
|
|
'Rule,continued-fraction-outer,default,[t] "Kettenbruch"; [n] children/*[1];[t] "durch"; [n] children/*[2],self::fraction,not(ancestor::fraction),children/*[2]/descendant-or-self::*[@role="ellipsis" and not(following-sibling::*)]'.split(
|
|
",",
|
|
),
|
|
'Rule,continued-fraction-inner,default,[t] "Anfang Bruch"; [n] children/*[1];[t] "durch"; [n] children/*[2],self::fraction,ancestor::fraction,children/*[2]/descendant-or-self::*[@role="ellipsis" and not(following-sibling::*)]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"continued-fraction-inner",
|
|
"default",
|
|
"sbrief",
|
|
'[t] "Bruch"; [n] children/*[1];[t] "durch"; [n] children/*[2]',
|
|
],
|
|
[
|
|
"Rule",
|
|
"sqrt",
|
|
"default",
|
|
"[t] CSFopenRadicalVerbose; [n] children/*[1]; [t] CSFcloseRadicalVerbose",
|
|
"self::sqrt",
|
|
],
|
|
[
|
|
"Rule",
|
|
"sqrt",
|
|
"brief",
|
|
"[t] CSFopenRadicalBrief; [n] children/*[1]; [t] CSFcloseRadicalBrief",
|
|
"self::sqrt",
|
|
],
|
|
[
|
|
"Rule",
|
|
"sqrt",
|
|
"sbrief",
|
|
"[t] CSFopenRadicalSbrief; [n] children/*[1]; [t] CSFcloseRadicalBrief",
|
|
"self::sqrt",
|
|
],
|
|
"Rule,root-small,default,[t] CSFopenRadicalVerbose; [n] children/*[2]; [t] CSFcloseRadicalVerbose,self::root,children/*[1][text()=3 or text()=2]".split(
|
|
",",
|
|
),
|
|
"Rule,root-small,brief,[t] CSFopenRadicalBrief; [n] children/*[2]; [t] CSFcloseRadicalBrief,self::root,children/*[1][text()=3 or text()=2]".split(
|
|
",",
|
|
),
|
|
"Rule,root-small,sbrief,[t] CSFopenRadicalSbrief; [n] children/*[2]; [t] CSFcloseRadicalBrief,self::root,children/*[1][text()=3 or text()=2]".split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"root",
|
|
"default",
|
|
"[t] CSFindexRadicalVerbose; [n] children/*[1];[t] CSFopenRadicalVerbose; [n] children/*[2]; [t] CSFcloseRadicalVerbose",
|
|
"self::root",
|
|
],
|
|
[
|
|
"Rule",
|
|
"root",
|
|
"brief",
|
|
"[t] CSFindexRadicalBrief; [n] children/*[1];[t] CSFopenRadicalBrief; [n] children/*[2]; [t] CSFcloseRadicalBrief",
|
|
"self::root",
|
|
],
|
|
[
|
|
"Rule",
|
|
"root",
|
|
"sbrief",
|
|
"[t] CSFindexRadicalSbrief; [n] children/*[1];[t] CSFopenRadicalSbrief; [n] children/*[2]; [t] CSFcloseRadicalBrief",
|
|
"self::root",
|
|
],
|
|
'Rule,limboth,default,[n] children/*[1]; [t] CSFunderscript; [n] children/*[2];[t] CSFoverscript; [n] children/*[3],self::limboth,name(../..)="underscore" or name(../..)="overscore",following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(
|
|
",",
|
|
),
|
|
'Rule,limlower,default,[n] children/*[1]; [t] CSFunderscript; [n] children/*[2];,self::limlower,name(../..)="underscore" or name(../..)="overscore",following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(
|
|
",",
|
|
),
|
|
'Rule,limupper,default,[n] children/*[1]; [t] CSFoverscript; [n] children/*[2];,self::limupper,name(../..)="underscore" or name(../..)="overscore",following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(
|
|
",",
|
|
),
|
|
'Aliases;limlower;self::underscore;@role="limit function";name(../..)="underscore" or name(../..)="overscore";following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(
|
|
";",
|
|
),
|
|
'Aliases;limlower;self::underscore;children/*[2][@role!="underaccent"];name(../..)="underscore" or name(../..)="overscore";following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(
|
|
";",
|
|
),
|
|
'Aliases;limupper;self::overscore;children/*[2][@role!="overaccent"];name(../..)="underscore" or name(../..)="overscore";following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"limboth-end",
|
|
"default",
|
|
'[n] children/*[1]; [t] CSFunderscript; [n] children/*[2];[t] CSFoverscript; [n] children/*[3]; [t] "Ende \u00dcberschrift"',
|
|
"self::limboth",
|
|
],
|
|
[
|
|
"Rule",
|
|
"limlower-end",
|
|
"default",
|
|
'[n] children/*[1]; [t] CSFunderscript; [n] children/*[2]; [t] "Ende Unterschrift"',
|
|
"self::limlower",
|
|
],
|
|
[
|
|
"Rule",
|
|
"limupper-end",
|
|
"default",
|
|
'[n] children/*[1]; [t] CSFoverscript; [n] children/*[2]; [t] "Ende \u00dcberschrift"',
|
|
"self::limupper",
|
|
],
|
|
["Aliases", "limlower-end", "self::underscore", '@role="limit function"'],
|
|
["Aliases", "limlower-end", "self::underscore"],
|
|
["Aliases", "limupper-end", "self::overscore"],
|
|
[
|
|
"Rule",
|
|
"integral",
|
|
"default",
|
|
"[n] children/*[1]; [n] children/*[2]; [n] children/*[3];",
|
|
"self::integral",
|
|
],
|
|
'Rule,integral,default,[n] children/*[1]; [t] "Index"; [n] children/*[2];[t] "Hoch"; [n] children/*[3]; [t] "Grundlinie";,self::limboth,@role="integral"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"integral",
|
|
"default",
|
|
"brief",
|
|
'[n] children/*[1]; [t] "Index"; [n] children/*[2];[t] "Hoch"; [n] children/*[3]; [t] "Base";',
|
|
],
|
|
["SpecializedRule", "integral", "brief", "sbrief"],
|
|
[
|
|
"Rule",
|
|
"bigop",
|
|
"default",
|
|
"[n] children/*[1]; [n] children/*[2];",
|
|
"self::bigop",
|
|
],
|
|
[
|
|
"Rule",
|
|
"relseq",
|
|
"default",
|
|
"[m] children/* (sepFunc:CTXFcontentIterator)",
|
|
"self::relseq",
|
|
],
|
|
'Rule,equality,default,[n] children/*[1]; [n] content/*[1]; [n] children/*[2],self::relseq,@role="equality",count(./children/*)=2'.split(
|
|
",",
|
|
),
|
|
'Rule;multi-equality;default;[m] children/* (sepFunc:CTXFcontentIterator);self::relseq;@role="equality";count(./children/*)>2'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"multrel",
|
|
"default",
|
|
"[m] children/* (sepFunc:CTXFcontentIterator)",
|
|
"self::multirel",
|
|
],
|
|
[
|
|
"Rule",
|
|
"subscript",
|
|
"default",
|
|
"[n] children/*[1]; [t] CSFsubscriptVerbose; [n] children/*[2]",
|
|
"self::subscript",
|
|
],
|
|
[
|
|
"Rule",
|
|
"subscript",
|
|
"brief",
|
|
"[n] children/*[1]; [t] CSFsubscriptBrief; [n] children/*[2]",
|
|
"self::subscript",
|
|
],
|
|
["SpecializedRule", "subscript", "brief", "sbrief"],
|
|
'Rule,subscript-simple,default,[n] children/*[1]; [n] children/*[2],self::subscript,name(./children/*[1])="identifier",name(./children/*[2])="number",./children/*[2][@role!="mixed"],./children/*[2][@role!="othernumber"]'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "subscript-simple", "default", "brief"],
|
|
["SpecializedRule", "subscript-simple", "default", "sbrief"],
|
|
'Rule,subscript-baseline,default,[n] children/*[1]; [t] CSFsubscriptVerbose; [n] children/*[2]; [t] CSFbaselineVerbose,self::subscript,following-sibling::*,not(name(following-sibling::subscript/children/*[1])="empty" or (name(following-sibling::infixop[@role="implicit"]/children/*[1])="subscript" and name(following-sibling::*/children/*[1]/children/*[1])="empty")) and @role!="subsup",not(following-sibling::*[@role="rightsuper" or @role="rightsub" or @role="leftsub" or @role="leftsub"])'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"subscript-baseline",
|
|
"default",
|
|
"brief",
|
|
"[n] children/*[1]; [t] CSFsubscriptBrief; [n] children/*[2]; [t] CSFbaselineBrief",
|
|
],
|
|
["SpecializedRule", "subscript-baseline", "brief", "sbrief"],
|
|
'Aliases;subscript-baseline;self::subscript;not(following-sibling::*);ancestor::fenced|ancestor::root|ancestor::sqrt|ancestor::punctuated|ancestor::fraction;not(ancestor::punctuated[@role="leftsuper" or @role="rightsub" or @role="rightsuper" or @role="rightsub"])'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"subscript-baseline",
|
|
"self::subscript",
|
|
"not(following-sibling::*)",
|
|
"ancestor::relseq|ancestor::multirel",
|
|
sre.MathspeakUtil.generateBaselineConstraint(),
|
|
],
|
|
[
|
|
"Aliases",
|
|
"subscript-baseline",
|
|
"self::subscript",
|
|
"not(following-sibling::*)",
|
|
"@embellished",
|
|
],
|
|
'Rule,subscript-empty-sup,default,[n] children/*[1]; [n] children/*[2],self::subscript,name(children/*[2])="infixop",name(children/*[2][@role="implicit"]/children/*[1])="superscript",name(children/*[2]/children/*[1]/children/*[1])="empty"'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "subscript-empty-sup", "default", "brief"],
|
|
["SpecializedRule", "subscript-empty-sup", "brief", "sbrief"],
|
|
[
|
|
"Aliases",
|
|
"subscript-empty-sup",
|
|
"self::subscript",
|
|
'name(children/*[2])="superscript"',
|
|
'name(children/*[2]/children/*[1])="empty"',
|
|
],
|
|
[
|
|
"Rule",
|
|
"superscript",
|
|
"default",
|
|
"[n] children/*[1]; [t] CSFsuperscriptVerbose; [n] children/*[2]",
|
|
"self::superscript",
|
|
],
|
|
[
|
|
"SpecializedRule",
|
|
"superscript",
|
|
"default",
|
|
"brief",
|
|
"[n] children/*[1]; [t] CSFsuperscriptBrief; [n] children/*[2]",
|
|
],
|
|
["SpecializedRule", "superscript", "brief", "sbrief"],
|
|
'Rule,superscript-baseline,default,[n] children/*[1]; [t] CSFsuperscriptVerbose; [n] children/*[2];[t] CSFbaselineVerbose,self::superscript,following-sibling::*,not(name(following-sibling::superscript/children/*[1])="empty" or (name(following-sibling::infixop[@role="implicit"]/children/*[1])="superscript" and name(following-sibling::*/children/*[1]/children/*[1])="empty")) and not(following-sibling::*[@role="rightsuper" or @role="rightsub" or @role="leftsub" or @role="leftsub"])'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"superscript-baseline",
|
|
"default",
|
|
"brief",
|
|
"[n] children/*[1]; [t] CSFsuperscriptBrief; [n] children/*[2];[t] CSFbaselineBrief",
|
|
],
|
|
["SpecializedRule", "superscript-baseline", "brief", "sbrief"],
|
|
'Aliases;superscript-baseline;self::superscript;not(following-sibling::*);ancestor::punctuated;ancestor::*/following-sibling::* and not(ancestor::punctuated[@role="leftsuper" or @role="rightsub" or @role="rightsuper" or @role="rightsub"])'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"superscript-baseline",
|
|
"self::superscript",
|
|
"not(following-sibling::*)",
|
|
"ancestor::fraction|ancestor::fenced|ancestor::root|ancestor::sqrt",
|
|
],
|
|
[
|
|
"Aliases",
|
|
"superscript-baseline",
|
|
"self::superscript",
|
|
"not(following-sibling::*)",
|
|
"ancestor::relseq|ancestor::multirel",
|
|
"not(@embellished)",
|
|
sre.MathspeakUtil.generateBaselineConstraint(),
|
|
],
|
|
'Aliases superscript-baseline self::superscript not(following-sibling::*) @embellished not(children/*[2][@role="prime"])'.split(
|
|
" ",
|
|
),
|
|
'Rule,superscript-empty-sub,default,[n] children/*[1]; [n] children/*[2],self::superscript,name(children/*[2])="infixop",name(children/*[2][@role="implicit"]/children/*[1])="subscript",name(children/*[2]/children/*[1]/children/*[1])="empty"'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "superscript-empty-sub", "default", "brief"],
|
|
["SpecializedRule", "superscript-empty-sub", "brief", "sbrief"],
|
|
[
|
|
"Aliases",
|
|
"superscript-empty-sub",
|
|
"self::superscript",
|
|
'name(children/*[2])="subscript"',
|
|
'name(children/*[2]/children/*[1])="empty"',
|
|
],
|
|
'Rule,square,default,[n] children/*[1]; [t] "Quadrat",self::superscript,children/*[2],children/*[2][text()=2],name(children/*[1])!="text" or not(name(children/*[1])="text" and (name(../../../punctuated[@role="text"]/..)="stree" or name(..)="stree")),name(children/*[1])!="subscript" or (name(children/*[1])="subscript" and name(children/*[1]/children/*[1])="identifier" and name(children/*[1]/children/*[2])="number" and children/*[1]/children/*[2][@role!="mixed"] and children/*[1]/children/*[2][@role!="othernumber"]),not(@embellished)'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "square", "default", "brief"],
|
|
["SpecializedRule", "square", "default", "sbrief"],
|
|
'Aliases;square;self::superscript;children/*[2];children/*[2][text()=2];@embellished;children/*[1][@role="prefix operator"]'.split(
|
|
";",
|
|
),
|
|
'Rule,cube,default,[n] children/*[1]; [t] "Kubik",self::superscript,children/*[2],children/*[2][text()=3],name(children/*[1])!="text" or not(name(children/*[1])="text" and (name(../../../punctuated[@role="text"]/..)="stree" or name(..)="stree")),name(children/*[1])!="subscript" or (name(children/*[1])="subscript" and name(children/*[1]/children/*[1])="identifier" and name(children/*[1]/children/*[2])="number" and children/*[1]/children/*[2][@role!="mixed"] and children/*[1]/children/*[2][@role!="othernumber"]),not(@embellished)'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "cube", "default", "brief"],
|
|
["SpecializedRule", "cube", "default", "sbrief"],
|
|
'Aliases;cube;self::superscript;children/*[2];children/*[2][text()=3];@embellished;children/*[1][@role="prefix operator"]'.split(
|
|
";",
|
|
),
|
|
'Rule,prime,default,[n] children/*[1]; [n] children/*[2],self::superscript,children/*[2],children/*[2][@role="prime"]'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "prime", "default", "brief"],
|
|
["SpecializedRule", "prime", "default", "sbrief"],
|
|
'Rule,prime-subscript,default,[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptVerbose; [n] children/*[1]/children/*[2],self::superscript,children/*[2][@role="prime"],name(children/*[1])="subscript",not(following-sibling::*)'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"prime-subscript",
|
|
"default",
|
|
"brief",
|
|
"[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptBrief; [n] children/*[1]/children/*[2]",
|
|
],
|
|
["SpecializedRule", "prime-subscript", "brief", "sbrief"],
|
|
'Rule,prime-subscript-baseline,default,[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptVerbose; [n] children/*[1]/children/*[2]; [t] CSFbaselineVerbose,self::superscript,children/*[2][@role="prime"],name(children/*[1])="subscript",following-sibling::*'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"prime-subscript-baseline",
|
|
"default",
|
|
"brief",
|
|
"[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptBrief; [n] children/*[1]/children/*[2]; [t] CSFbaselineBrief",
|
|
],
|
|
["SpecializedRule", "prime-subscript-baseline", "brief", "sbrief"],
|
|
'Aliases prime-subscript-baseline self::superscript children/*[2][@role="prime"] name(children/*[1])="subscript" not(following-sibling::*) @embellished'.split(
|
|
" ",
|
|
),
|
|
'Rule,prime-subscript-simple,default,[n] children/*[1]/children/*[1]; [n] children/*[2];[n] children/*[1]/children/*[2],self::superscript,children/*[2][@role="prime"],name(children/*[1])="subscript",name(children/*[1]/children/*[1])="identifier",name(children/*[1]/children/*[2])="number",children/*[1]/children/*[2][@role!="mixed"],children/*[1]/children/*[2][@role!="othernumber"]'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "prime-subscript-simple", "default", "brief"],
|
|
["SpecializedRule", "prime-subscript-simple", "default", "sbrief"],
|
|
'Rule,overscore,default,[t] "modifiziert oben"; [n] children/*[1]; [t] "mit"; [n] children/*[2],self::overscore,children/*[2][@role="overaccent"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"overscore",
|
|
"default",
|
|
"brief",
|
|
'[t] "mod oben"; [n] children/*[1]; [t] "mit"; [n] children/*[2]',
|
|
],
|
|
["SpecializedRule", "overscore", "brief", "sbrief"],
|
|
'Rule,double-overscore,default,[t] "modifiziert oben oben"; [n] children/*[1]; [t] "mit"; [n] children/*[2],self::overscore,children/*[2][@role="overaccent"],name(children/*[1])="overscore",children/*[1]/children/*[2][@role="overaccent"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"double-overscore",
|
|
"default",
|
|
"brief",
|
|
'[t] "mod oben oben"; [n] children/*[1]; [t] "mit"; [n] children/*[2]',
|
|
],
|
|
["SpecializedRule", "double-overscore", "brief", "sbrief"],
|
|
'Rule,underscore,default,[t] "modifiziert unten"; [n] children/*[1]; [t] "mit"; [n] children/*[2],self::underscore,children/*[2][@role="underaccent"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"underscore",
|
|
"default",
|
|
"brief",
|
|
'[t] "mod unten"; [n] children/*[1]; [t] "mit"; [n] children/*[2]',
|
|
],
|
|
["SpecializedRule", "underscore", "brief", "sbrief"],
|
|
'Rule,double-underscore,default,[t] "modifiziert unten unten"; [n] children/*[1]; [t] "mit"; [n] children/*[2],self::underscore,children/*[2][@role="underaccent"],name(children/*[1])="underscore",children/*[1]/children/*[2][@role="underaccent"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"double-underscore",
|
|
"default",
|
|
"brief",
|
|
'[t] "mod unten unten"; [n] children/*[1]; [t] "mit"; [n] children/*[2]',
|
|
],
|
|
["SpecializedRule", "double-underscore", "brief", "sbrief"],
|
|
'Rule,overbar,default,[n] children/*[1]; [t] "\u00dcberstrich",self::overscore,@role="latinletter" or @role="greekletter" or @role="otherletter",children/*[2][@role="overaccent"],children/*[2][text()="\u00af" or text()="\uffe3" or text()="\uff3f" or text()="_" or text()="\u203e"]'.split(
|
|
",",
|
|
),
|
|
'Rule,underbar,default,[n] children/*[1]; [t] "Unterstrich",self::underscore,@role="latinletter" or @role="greekletter" or @role="otherletter",children/*[2][@role="underaccent"],children/*[2][text()="\u00af" or text()="\uffe3" or text()="\uff3f" or text()="_" or text()="\u203e"]'.split(
|
|
",",
|
|
),
|
|
'Rule,overtilde,default,[n] children/*[1]; [t] "Tilde oben",self::overscore,children/*[2][@role="overaccent"],@role="latinletter" or @role="greekletter" or @role="otherletter",children/*[2][text()="~" or text()="\u02dc" or text()="\u223c" or text()="\uff5e"]'.split(
|
|
",",
|
|
),
|
|
'Rule,undertilde,default,[n] children/*[1]; [t] "Tilde unten",self::underscore,@role="latinletter" or @role="greekletter" or @role="otherletter",children/*[2][@role="underaccent"],children/*[2][text()="~" or text()="\u02dc" or text()="\u223c" or text()="\uff5e"]'.split(
|
|
",",
|
|
),
|
|
'Rule,matrix-fence,default,[n] children/*[1];,self::fenced,count(children/*)=1,name(children/*[1])="matrix"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"matrix",
|
|
"default",
|
|
'[t] "Anfang"; [t] count(children/*); [t] "mal";[t] count(children/*[1]/children/*); [t] "Matrize"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Zeile "); [t] "Ende Matrize"',
|
|
"self::matrix",
|
|
],
|
|
[
|
|
"Rule",
|
|
"matrix",
|
|
"sbrief",
|
|
'[t] count(children/*); [t] "mal";[t] count(children/*[1]/children/*); [t] "Matrize"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Zeile "); [t] "Ende Matrize"',
|
|
"self::matrix",
|
|
],
|
|
["Aliases", "matrix", "self::vector"],
|
|
[
|
|
"Rule",
|
|
"matrix-row",
|
|
"default",
|
|
'[m] children/* (ctxtFunc:CTXFordinalCounter,context:"Spalte");[p] (pause: 200)',
|
|
"self::row",
|
|
],
|
|
'Rule{row-with-label{default{[t] "mit Bezeichner"; [n] content/*[1]; [t] "Ende Bezeichner"(pause: 200); [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Spalte"){self::row{content'.split(
|
|
"{",
|
|
),
|
|
'Rule{row-with-label{brief{[t] "Bezeichner"; [n] content/*[1]; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Spalte"){self::row{content'.split(
|
|
"{",
|
|
),
|
|
["SpecializedRule", "row-with-label", "brief", "sbrief"],
|
|
'Rule{row-with-text-label{sbrief{[t] "Bezeichner"; [t] CSFRemoveParens;[m] children/* (ctxtFunc:CTXFordinalCounter,context:"Spalte"){self::row{content{name(content/cell/children/*[1])="text"'.split(
|
|
"{",
|
|
),
|
|
'Rule;empty-row;default;[t] "Blank";self::row;count(children/*)=0'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"matrix-cell",
|
|
"default",
|
|
"[n] children/*[1]; [p] (pause: 300)",
|
|
"self::cell",
|
|
],
|
|
'Rule,empty-cell,default,[t] "leer"; [p] (pause: 300),self::cell,count(children/*)=0'.split(
|
|
",",
|
|
),
|
|
'Rule{determinant{default{[t] "Anfang"; [t] count(children/*); [t] "mal";[t] count(children/*[1]/children/*); [t] "Determinante"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Zeile "); [t] "Ende Determinante"{self::matrix{@role="determinant"'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"determinant",
|
|
"default",
|
|
"sbrief",
|
|
'[t] count(children/*); [t] "mal";[t] count(children/*[1]/children/*); [t] "Determinante"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Zeile "); [t] "Ende Determinante"',
|
|
],
|
|
'Rule{determinant-simple{default{[t] "Anfang"; [t] count(children/*); [t] "mal";[t] count(children/*[1]/children/*); [t] "Determinante"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Zeile",grammar:simpleDet); [t] "Ende Determinante"{self::matrix{@role="determinant"{CQFdetIsSimple'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"determinant-simple",
|
|
"default",
|
|
"sbrief",
|
|
'[t] count(children/*); [t] "mal";[t] count(children/*[1]/children/*); [t] "Determinante"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Zeile",grammar:simpleDet); [t] "Ende Determinante"',
|
|
],
|
|
'Rule{row-simple{default{[m] children/*;{self::row{@role="determinant"{contains(@grammar, "simpleDet")'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"layout",
|
|
"default",
|
|
'[t] "Anfang Anordnung"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Zeile "); [t] "Ende Anordnung"',
|
|
"self::table",
|
|
],
|
|
[
|
|
"Rule",
|
|
"layout",
|
|
"sbrief",
|
|
'[t] "Anordnung"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Zeile "); [t] "Ende Anordnung"',
|
|
"self::table",
|
|
],
|
|
'Rule,binomial,default,[t] "Anfang Binomialkoeffizient"; [n] children/*[2]/children/*[1]; [t] "aus"; [n] children/*[1]/children/*[1]; [t] "Ende Binomialkoeffizient",self::vector,@role="binomial"'.split(
|
|
",",
|
|
),
|
|
'Rule,binomial,brief,[t] "Anfang Binomial"; [n] children/*[2]/children/*[1]; [t] "aus"; [n] children/*[1]/children/*[1]; [t] "Ende Binomial",self::vector,@role="binomial"'.split(
|
|
",",
|
|
),
|
|
'Rule,binomial,sbrief,[t] "Binomial"; [n] children/*[2]/children/*[1]; [t] "aus"; [n] children/*[1]/children/*[1]; [t] "Ende Binomial",self::vector,@role="binomial"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"cases",
|
|
"default",
|
|
'[t] "Anfang Fallunterscheidung"; [t] "gro\u00dfe"; [n] content/*[1];[m] children/* (ctxtFunc:CTXFordinalCounter,context:"Zeile "); [t] "Ende Fallunterscheidung"',
|
|
"self::cases",
|
|
],
|
|
[
|
|
"Rule",
|
|
"cases",
|
|
"brief",
|
|
'[t] "Anfang F\u00e4lle"; [t] "gro\u00dfe"; [n] content/*[1];[m] children/* (ctxtFunc:CTXFordinalCounter,context:"Zeile "); [t] "Ende F\u00e4lle"',
|
|
"self::cases",
|
|
],
|
|
[
|
|
"Rule",
|
|
"cases",
|
|
"sbrief",
|
|
'[t] "F\u00e4lle"; [t] "gro\u00dfe"; [n] content/*[1];[m] children/* (ctxtFunc:CTXFordinalCounter,context:"Zeile "); [t] "Ende F\u00e4lle"',
|
|
"self::cases",
|
|
],
|
|
["Aliases", "layout", "self::multiline"],
|
|
["Rule", "line", "default", "[m] children/*", "self::line"],
|
|
'Rule,line-with-label,default,[t] "mit Bezeichner"; [n] content/*[1]; [t] "Ende Bezeichner" (pause: 200); [m] children/*,self::line,content'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"line-with-label",
|
|
"default",
|
|
"brief",
|
|
'[t] "Bezeichner"; [n] content/*[1] (pause: 200); [m] children/*',
|
|
],
|
|
["SpecializedRule", "line-with-label", "brief", "sbrief"],
|
|
'Rule,line-with-text-label,sbrief,[t] "Bezeichner"; [t] CSFRemoveParens; [m] children/*,self::line,content,name(content/cell/children/*[1])="text"'.split(
|
|
",",
|
|
),
|
|
'Rule;empty-line;default;[t] "leer";self::line;count(children/*)=0;not(content)'.split(
|
|
";",
|
|
),
|
|
["SpecializedRule", "empty-line", "default", "brief"],
|
|
["SpecializedRule", "empty-line", "brief", "sbrief"],
|
|
'Rule,empty-line-with-label,default,[t] "mit Bezeichner"; [n] content/*[1]; [t] "Ende Bezeichner"(pause: 200); [t] "leer",self::line,count(children/*)=0,content'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"empty-line-with-label",
|
|
"default",
|
|
"brief",
|
|
'[t] "Bezeichner"; [n] content/*[1] (pause: 200); [t] "leer"',
|
|
],
|
|
["SpecializedRule", "empty-line-with-label", "brief", "sbrief"],
|
|
[
|
|
"Rule",
|
|
"enclose",
|
|
"default",
|
|
'[t] "Anfang Umschlie\u00dfung"; [t] @role (grammar:localEnclose); [n] children/*[1]; [t] "Ende Umschlie\u00dfung"',
|
|
"self::enclose",
|
|
],
|
|
["Aliases", "overbar", "self::enclose", '@role="top"'],
|
|
["Aliases", "underbar", "self::enclose", '@role="bottom"'],
|
|
'Rule,leftbar,default,[t] "senkrechter Strich"; [n] children/*[1],self::enclose,@role="left"'.split(
|
|
",",
|
|
),
|
|
'Rule,rightbar,default,[n] children/*[1]; [t] "senkrechter Strich",self::enclose,@role="right"'.split(
|
|
",",
|
|
),
|
|
'Rule,crossout,default,[t] "durchgestrichen"; [n] children/*[1]; [t] "Ende duchgestrichen",self::enclose,@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"'.split(
|
|
",",
|
|
),
|
|
'Rule,cancel,default,[t] "durchgestrichen"; [n] children/*[1]/children/*[1]; [t] "mit"; [n] children/*[2]; [t] "Ende duchgestrichen",self::overscore,@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "cancel", "default", "brief"],
|
|
["SpecializedRule", "cancel", "default", "sbrief"],
|
|
[
|
|
"Aliases",
|
|
"cancel",
|
|
"self::underscore",
|
|
'@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"',
|
|
],
|
|
'Rule,cancel-reverse,default,[t] "durchgestrichen"; [n] children/*[2]/children/*[1]; [t] "mit"; [n] children/*[1]; [t] "Ende duchgestrichen",self::overscore,name(children/*[2])="enclose",children/*[2][@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"]'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "cancel-reverse", "default", "brief"],
|
|
["SpecializedRule", "cancel-reverse", "default", "sbrief"],
|
|
[
|
|
"Aliases",
|
|
"cancel-reverse",
|
|
"self::underscore",
|
|
'name(children/*[2])="enclose"',
|
|
'children/*[2][@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"]',
|
|
],
|
|
'Rule;end-punct;default;[m] children/*;self::punctuated;@role="endpunct"'.split(
|
|
";",
|
|
),
|
|
'Rule,start-punct,default,[n] content/*[1]; [m] children/*[position()>1],self::punctuated,@role="startpunct"'.split(
|
|
",",
|
|
),
|
|
'Rule,integral-punct,default,[n] children/*[1]; [n] children/*[3],self::punctuated,@role="integral"'.split(
|
|
",",
|
|
),
|
|
["Rule", "punctuated", "default", "[m] children/*", "self::punctuated"],
|
|
'Rule;unit;default;[t] text() (grammar:annotation="unit":translate:plural);self::identifier;@role="unit"'.split(
|
|
";",
|
|
),
|
|
'Rule,unit-square,default,[t] "Quadrat"; [n] children/*[1],self::superscript,@role="unit",children/*[2][text()=2],name(children/*[1])="identifier"'.split(
|
|
",",
|
|
),
|
|
'Rule,unit-cubic,default,[t] "Kubik"; [n] children/*[1],self::superscript,@role="unit",children/*[2][text()=3],name(children/*[1])="identifier"'.split(
|
|
",",
|
|
),
|
|
'Rule,reciprocal,default,[n] children/*[1]; [t] "invers",self::superscript,@role="unit",name(children/*[1])="identifier",name(children/*[2])="prefixop",children/*[2][@role="negative"],children/*[2]/children/*[1][text()=1],count(preceding-sibling::*)=0 or preceding-sibling::*[@role!="unit"]'.split(
|
|
",",
|
|
),
|
|
'Rule,reciprocal,default,[t] "pro"; [n] children/*[1],self::superscript,@role="unit",name(children/*[1])="identifier",name(children/*[2])="prefixop",children/*[2][@role="negative"],children/*[2]/children/*[1][text()=1],preceding-sibling::*[@role="unit"]'.split(
|
|
",",
|
|
),
|
|
'Rule;unit-combine;default;[m] children/*;self::infixop;@role="unit"'.split(
|
|
";",
|
|
),
|
|
'Rule,unit-divide,default,[n] children/*[1]; [t] "pro"; [n] children/*[2],self::fraction,@role="unit"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"inference",
|
|
"default",
|
|
'[t] "Schlussregel"; [m] content/*; [t] "mit Folgerung"; [n] children/*[1]; [t] "aus"; [t] count(children/*[2]/children/*); [t] "Pr\u00e4missen"',
|
|
"self::inference",
|
|
],
|
|
'Rule,inference,default,[t] "Schlussregel"; ; [m] content/*; [t] "mit Folgerung"; [n] children/*[1]; [t] "aus"; [t] count(children/*[2]/children/*); [t] "Pr\u00e4misse",self::inference,count(children/*[2]/children/*)<2'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"premise",
|
|
"default",
|
|
'[m] children/* (ctxtFunc:CTXFordinalCounter,context:"Pr\u00e4misse ");',
|
|
"self::premises",
|
|
],
|
|
["Rule", "conclusion", "default", "[n] children/*[1]", "self::conclusion"],
|
|
[
|
|
"Rule",
|
|
"label",
|
|
"default",
|
|
'[t] "Regel"; [n] children/*[1]',
|
|
"self::rulelabel",
|
|
],
|
|
'Rule,axiom,default,[t] "Axiom"; [m] children/*[1];,self::inference,@role="axiom"'.split(
|
|
",",
|
|
),
|
|
'Rule,axiom,default,[t] "leeres Axiom";,self::empty,@role="axiom"'.split(
|
|
",",
|
|
),
|
|
],
|
|
initialize: [sre.MathspeakUtil.generateTensorRules],
|
|
};
|
|
sre.MathspeakRules = {
|
|
domain: "mathspeak",
|
|
functions: [
|
|
["CQF", "CQFspaceoutNumber", sre.MathspeakUtil.spaceoutNumber],
|
|
["CQF", "CQFspaceoutIdentifier", sre.MathspeakUtil.spaceoutIdentifier],
|
|
["CSF", "CSFspaceoutText", sre.MathspeakUtil.spaceoutText],
|
|
["CSF", "CSFopenFracVerbose", sre.MathspeakUtil.openingFractionVerbose],
|
|
["CSF", "CSFcloseFracVerbose", sre.MathspeakUtil.closingFractionVerbose],
|
|
["CSF", "CSFoverFracVerbose", sre.MathspeakUtil.overFractionVerbose],
|
|
["CSF", "CSFopenFracBrief", sre.MathspeakUtil.openingFractionBrief],
|
|
["CSF", "CSFcloseFracBrief", sre.MathspeakUtil.closingFractionBrief],
|
|
["CSF", "CSFopenFracSbrief", sre.MathspeakUtil.openingFractionSbrief],
|
|
["CSF", "CSFcloseFracSbrief", sre.MathspeakUtil.closingFractionSbrief],
|
|
["CSF", "CSFoverFracSbrief", sre.MathspeakUtil.overFractionSbrief],
|
|
["CSF", "CSFvulgarFraction", sre.NumbersUtil.vulgarFraction],
|
|
["CQF", "CQFvulgarFractionSmall", sre.MathspeakUtil.isSmallVulgarFraction],
|
|
["CSF", "CSFopenRadicalVerbose", sre.MathspeakUtil.openingRadicalVerbose],
|
|
["CSF", "CSFcloseRadicalVerbose", sre.MathspeakUtil.closingRadicalVerbose],
|
|
["CSF", "CSFindexRadicalVerbose", sre.MathspeakUtil.indexRadicalVerbose],
|
|
["CSF", "CSFopenRadicalBrief", sre.MathspeakUtil.openingRadicalBrief],
|
|
["CSF", "CSFcloseRadicalBrief", sre.MathspeakUtil.closingRadicalBrief],
|
|
["CSF", "CSFindexRadicalBrief", sre.MathspeakUtil.indexRadicalBrief],
|
|
["CSF", "CSFopenRadicalSbrief", sre.MathspeakUtil.openingRadicalSbrief],
|
|
["CSF", "CSFindexRadicalSbrief", sre.MathspeakUtil.indexRadicalSbrief],
|
|
["CSF", "CSFsuperscriptVerbose", sre.MathspeakUtil.superscriptVerbose],
|
|
["CSF", "CSFsuperscriptBrief", sre.MathspeakUtil.superscriptBrief],
|
|
["CSF", "CSFsubscriptVerbose", sre.MathspeakUtil.subscriptVerbose],
|
|
["CSF", "CSFsubscriptBrief", sre.MathspeakUtil.subscriptBrief],
|
|
["CSF", "CSFbaselineVerbose", sre.MathspeakUtil.baselineVerbose],
|
|
["CSF", "CSFbaselineBrief", sre.MathspeakUtil.baselineBrief],
|
|
["CSF", "CSFleftsuperscriptVerbose", sre.MathspeakUtil.superscriptVerbose],
|
|
["CSF", "CSFleftsubscriptVerbose", sre.MathspeakUtil.subscriptVerbose],
|
|
["CSF", "CSFrightsuperscriptVerbose", sre.MathspeakUtil.superscriptVerbose],
|
|
["CSF", "CSFrightsubscriptVerbose", sre.MathspeakUtil.subscriptVerbose],
|
|
["CSF", "CSFleftsuperscriptBrief", sre.MathspeakUtil.superscriptBrief],
|
|
["CSF", "CSFleftsubscriptBrief", sre.MathspeakUtil.subscriptBrief],
|
|
["CSF", "CSFrightsuperscriptBrief", sre.MathspeakUtil.superscriptBrief],
|
|
["CSF", "CSFrightsubscriptBrief", sre.MathspeakUtil.subscriptBrief],
|
|
["CSF", "CSFunderscript", sre.MathspeakUtil.nestedUnderscore],
|
|
["CSF", "CSFoverscript", sre.MathspeakUtil.nestedOverscore],
|
|
["CTXF", "CTXFordinalCounter", sre.NumbersUtil.ordinalCounter],
|
|
["CTXF", "CTXFcontentIterator", sre.StoreUtil.contentIterator],
|
|
["CQF", "CQFdetIsSimple", sre.MathspeakUtil.determinantIsSimple],
|
|
["CSF", "CSFRemoveParens", sre.MathspeakUtil.removeParens],
|
|
["CQF", "CQFresetNesting", sre.MathspeakUtil.resetNestingDepth],
|
|
],
|
|
rules: [
|
|
'Rule{collapsed{default{[t] "collapsed"; [n] . (engine:modality=summary,grammar:collapsed){self::*[@alternative]{not(contains(@grammar, "collapsed"))'.split(
|
|
"{",
|
|
),
|
|
["SpecializedRule", "collapsed", "default", "brief"],
|
|
["SpecializedRule", "collapsed", "brief", "sbrief"],
|
|
[
|
|
"Rule",
|
|
"direct-speech",
|
|
"default",
|
|
"[t] @ext-speech",
|
|
"self::*[@ext-speech]",
|
|
],
|
|
"Rule;stree;default;[n] ./*[1];self::stree;CQFresetNesting".split(";"),
|
|
["Rule", "unknown", "default", "[n] text()", "self::unknown"],
|
|
'Rule;protected;default;[t] text();self::number;contains(@grammar, "protected")'.split(
|
|
";",
|
|
),
|
|
["Rule", "omit-empty", "default", "[p] (pause:100)", "self::empty"],
|
|
'Rule;blank-empty;default;[t] "Blank";self::empty;count(../*)=1;name(../..)="cell" or name(../..)="line"'.split(
|
|
";",
|
|
),
|
|
'Rule{font{default{[t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font){self::*{@font{not(contains(@grammar, "ignoreFont")){@font!="normal"'.split(
|
|
"{",
|
|
),
|
|
'Rule{font-identifier-short{default{[t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font){self::identifier{string-length(text())=1{@font{not(contains(@grammar, "ignoreFont")){@font="normal"{""=translate(text(), "abcdefghijklmnopqrstuvwxyz\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9", ""){@role!="unit"'.split(
|
|
"{",
|
|
),
|
|
'Rule{font-identifier{default{[t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font){self::identifier{string-length(text())=1{@font{@font="normal"{not(contains(@grammar, "ignoreFont")){@role!="unit"'.split(
|
|
"{",
|
|
),
|
|
'Rule;omit-font;default;[n] . (grammar:ignoreFont=@font);self::identifier;string-length(text())=1;@font;not(contains(@grammar, "ignoreFont"));@font="italic"'.split(
|
|
";",
|
|
),
|
|
'Rule{german-font{default{[t] "German"; [n] . (grammar:ignoreFont=@font){self::*{@font{not(contains(@grammar, "ignoreFont")){@font="fraktur"'.split(
|
|
"{",
|
|
),
|
|
'Rule{german-font{default{[t] "bold German"; [n] . (grammar:ignoreFont=@font){self::*{@font{not(contains(@grammar, "ignoreFont")){@font="bold-fraktur"'.split(
|
|
"{",
|
|
),
|
|
["Rule", "number", "default", "[n] text()", "self::number"],
|
|
'Rule,mixed-number,default,[n] children/*[1]; [t] "and"; [n] children/*[2]; ,self::number,@role="mixed"'.split(
|
|
",",
|
|
),
|
|
'Rule{number-with-chars{default{[t] "Number"; [m] CQFspaceoutNumber (grammar:protected){self::number{@role="othernumber"{"" != translate(text(), "0123456789.,", ""){not(contains(@grammar, "protected"))'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"number-with-chars",
|
|
"default",
|
|
"brief",
|
|
'[t] "Num"; [m] CQFspaceoutNumber (grammar:protected)',
|
|
],
|
|
["SpecializedRule", "number-with-chars", "brief", "sbrief"],
|
|
'Rule{number-as-upper-word{default{[t] "UpperWord"; [t] CSFspaceoutText{self::number{string-length(text())>1{text()=translate(text(), "abcdefghijklmnopqrstuvwxyz\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9", "ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9"){""=translate(text(), "ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9","")'.split(
|
|
"{",
|
|
),
|
|
["SpecializedRule", "number-as-upper-word", "default", "brief"],
|
|
["SpecializedRule", "number-as-upper-word", "default", "sbrief"],
|
|
'Rule{number-baseline{default{[t] "Baseline"; [n] . (grammar:baseline){self::number{not(contains(@grammar, "ignoreFont")){preceding-sibling::identifier{not(contains(@grammar, "baseline")){preceding-sibling::*[1][@role="latinletter" or @role="greekletter" or @role="otherletter"]{parent::*/parent::infixop[@role="implicit"]'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"number-baseline",
|
|
"default",
|
|
"brief",
|
|
'[t] "Base"; [n] . (grammar:baseline)',
|
|
],
|
|
["SpecializedRule", "number-baseline", "brief", "sbrief"],
|
|
'Rule{number-baseline-font{default{[t] "Baseline"; [t] @font; [n] . (grammar:ignoreFont=@font){self::number{@font{not(contains(@grammar, "ignoreFont")){@font!="normal"{preceding-sibling::identifier{preceding-sibling::*[@role="latinletter" or @role="greekletter" or @role="otherletter"]{parent::*/parent::infixop[@role="implicit"]'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"number-baseline-font",
|
|
"default",
|
|
"brief",
|
|
'[t] "Base"; [t] @font; [n] . (grammar:ignoreFont=@font)',
|
|
],
|
|
["SpecializedRule", "number-baseline-font", "brief", "sbrief"],
|
|
'Rule;identifier;default;[m] CQFspaceoutIdentifier;self::identifier;string-length(text())>1;@role!="unit";not(@font) or @font="normal" or contains(@grammar, "ignoreFont");text()!=translate(text(), "abcdefghijklmnopqrstuvwxyz\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9", "")'.split(
|
|
";",
|
|
),
|
|
["Rule", "identifier", "default", "[n] text()", "self::identifier"],
|
|
'Rule,negative,default,[t] "negative"; [n] children/*[1],self::prefixop,@role="negative",children/identifier'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"negative",
|
|
"self::prefixop",
|
|
'@role="negative"',
|
|
"children/number",
|
|
],
|
|
[
|
|
"Aliases",
|
|
"negative",
|
|
"self::prefixop",
|
|
'@role="negative"',
|
|
'children/fraction[@role="vulgar"]',
|
|
],
|
|
'Rule,negative,default,[t] "minus"; [n] children/*[1],self::prefixop,@role="negative"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"prefix",
|
|
"default",
|
|
"[m] content/*; [n] children/*[1]",
|
|
"self::prefixop",
|
|
],
|
|
[
|
|
"Rule",
|
|
"postfix",
|
|
"default",
|
|
"[n] children/*[1]; [m] content/*",
|
|
"self::postfixop",
|
|
],
|
|
[
|
|
"Rule",
|
|
"binary-operation",
|
|
"default",
|
|
"[m] children/* (sepFunc:CTXFcontentIterator);",
|
|
"self::infixop",
|
|
],
|
|
'Rule;implicit;default;[m] children/*;self::infixop;@role="implicit"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"implicit",
|
|
"self::infixop",
|
|
'@role="leftsuper" or @role="leftsub" or @role="rightsuper" or @role="rightsub"',
|
|
],
|
|
'Rule,subtraction,default,[m] children/* (separator:"minus");,self::infixop,@role="subtraction"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"function-unknown",
|
|
"default",
|
|
"[n] children/*[1]; [n] children/*[2]",
|
|
"self::appl",
|
|
],
|
|
'Rule,function-prefix,default,[n] children/*[1]; [n] children/*[2],self::appl,children/*[1][@role="prefix function"]'.split(
|
|
",",
|
|
),
|
|
'Rule,fences-open-close,default,[n] content/*[1]; [n] children/*[1]; [n] content/*[2],self::fenced,@role="leftright"'.split(
|
|
",",
|
|
),
|
|
'Rule,fences-neutral,default,[t] "StartAbsoluteValue"; [n] children/*[1]; [t] "EndAbsoluteValue",self::fenced,@role="neutral",content/*[1][text()]="|" or content/*[1][text()]="\u2758" or content/*[1][text()]="\uff5c"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"fences-neutral",
|
|
"default",
|
|
"sbrief",
|
|
'[t] "AbsoluteValue"; [n] children/*[1]; [t] "EndAbsoluteValue"',
|
|
],
|
|
'Rule,fences-neutral,default,[n] content/*[1]; [n] children/*[1]; [n] content/*[2],self::fenced,@role="neutral"'.split(
|
|
",",
|
|
),
|
|
'Rule,fences-set,default,[t] "StartSet"; [n] children/*[1]; [t] "EndSet",self::fenced,@role="set empty" or @role="set extended" or @role="set singleton" or @role="set collection",not(name(../..)="appl")'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"fences-set",
|
|
"default",
|
|
"sbrief",
|
|
'[t] "Set"; [n] children/*[1]; [t] "EndSet"',
|
|
],
|
|
["Rule", "text", "default", "[n] text()", "self::text"],
|
|
'Rule;factorial;default;[t] "factorial";self::punctuation;text()="!";name(preceding-sibling::*[1])!="text"'.split(
|
|
";",
|
|
),
|
|
'Rule;minus;default;[t] "minus";self::operator;text()="-"'.split(";"),
|
|
'Rule;single-prime;default;[t] "prime";self::punctuated;@role="prime";count(children/*)=1'.split(
|
|
";",
|
|
),
|
|
'Rule;double-prime;default;[t] "double prime";self::punctuated;@role="prime";count(children/*)=2'.split(
|
|
";",
|
|
),
|
|
'Rule;triple-prime;default;[t] "triple prime";self::punctuated;@role="prime";count(children/*)=3'.split(
|
|
";",
|
|
),
|
|
'Rule;quadruple-prime;default;[t] "quadruple prime";self::punctuated;@role="prime";count(children/*)=4'.split(
|
|
";",
|
|
),
|
|
'Rule,counted-prime,default,[t] count(children/*); [t] "prime",self::punctuated,@role="prime"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"default",
|
|
"[t] CSFopenFracVerbose; [n] children/*[1]; [t] CSFoverFracVerbose; [n] children/*[2]; [t] CSFcloseFracVerbose",
|
|
"self::fraction",
|
|
],
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"brief",
|
|
"[t] CSFopenFracBrief; [n] children/*[1]; [t] CSFoverFracVerbose; [n] children/*[2]; [t] CSFcloseFracBrief",
|
|
"self::fraction",
|
|
],
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"sbrief",
|
|
"[t] CSFopenFracSbrief; [n] children/*[1]; [t] CSFoverFracSbrief; [n] children/*[2]; [t] CSFcloseFracSbrief",
|
|
"self::fraction",
|
|
],
|
|
'Rule;vulgar-fraction;default;[t] CSFvulgarFraction;self::fraction;@role="vulgar";CQFvulgarFractionSmall'.split(
|
|
";",
|
|
),
|
|
["SpecializedRule", "vulgar-fraction", "default", "brief"],
|
|
["SpecializedRule", "vulgar-fraction", "default", "sbrief"],
|
|
'Rule,continued-fraction-outer,default,[t] "ContinuedFraction"; [n] children/*[1];[t] "Over"; [n] children/*[2],self::fraction,not(ancestor::fraction),children/*[2]/descendant-or-self::*[@role="ellipsis" and not(following-sibling::*)]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"continued-fraction-outer",
|
|
"default",
|
|
"brief",
|
|
'[t] "ContinuedFrac"; [n] children/*[1];[t] "Over"; [n] children/*[2]',
|
|
],
|
|
["SpecializedRule", "continued-fraction-outer", "brief", "sbrief"],
|
|
'Rule,continued-fraction-inner,default,[t] "StartFraction"; [n] children/*[1];[t] "Over"; [n] children/*[2],self::fraction,ancestor::fraction,children/*[2]/descendant-or-self::*[@role="ellipsis" and not(following-sibling::*)]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"continued-fraction-inner",
|
|
"default",
|
|
"brief",
|
|
'[t] "StartFrac"; [n] children/*[1];[t] "Over"; [n] children/*[2]',
|
|
],
|
|
[
|
|
"SpecializedRule",
|
|
"continued-fraction-inner",
|
|
"brief",
|
|
"sbrief",
|
|
'[t] "Frac"; [n] children/*[1];[t] "Over"; [n] children/*[2]',
|
|
],
|
|
[
|
|
"Rule",
|
|
"sqrt",
|
|
"default",
|
|
"[t] CSFopenRadicalVerbose; [n] children/*[1]; [t] CSFcloseRadicalVerbose",
|
|
"self::sqrt",
|
|
],
|
|
[
|
|
"Rule",
|
|
"sqrt",
|
|
"brief",
|
|
"[t] CSFopenRadicalBrief; [n] children/*[1]; [t] CSFcloseRadicalBrief",
|
|
"self::sqrt",
|
|
],
|
|
[
|
|
"Rule",
|
|
"sqrt",
|
|
"sbrief",
|
|
"[t] CSFopenRadicalSbrief; [n] children/*[1]; [t] CSFcloseRadicalBrief",
|
|
"self::sqrt",
|
|
],
|
|
[
|
|
"Rule",
|
|
"root",
|
|
"default",
|
|
"[t] CSFindexRadicalVerbose; [n] children/*[1];[t] CSFopenRadicalVerbose; [n] children/*[2]; [t] CSFcloseRadicalVerbose",
|
|
"self::root",
|
|
],
|
|
[
|
|
"Rule",
|
|
"root",
|
|
"brief",
|
|
"[t] CSFindexRadicalBrief; [n] children/*[1];[t] CSFopenRadicalBrief; [n] children/*[2]; [t] CSFcloseRadicalBrief",
|
|
"self::root",
|
|
],
|
|
[
|
|
"Rule",
|
|
"root",
|
|
"sbrief",
|
|
"[t] CSFindexRadicalSbrief; [n] children/*[1];[t] CSFopenRadicalSbrief; [n] children/*[2]; [t] CSFcloseRadicalBrief",
|
|
"self::root",
|
|
],
|
|
'Rule,limboth,default,[n] children/*[1]; [t] CSFunderscript; [n] children/*[2];[t] CSFoverscript; [n] children/*[3],self::limboth,name(../..)="underscore" or name(../..)="overscore",following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(
|
|
",",
|
|
),
|
|
'Rule,limlower,default,[n] children/*[1]; [t] CSFunderscript; [n] children/*[2];,self::limlower,name(../..)="underscore" or name(../..)="overscore",following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(
|
|
",",
|
|
),
|
|
'Rule,limupper,default,[n] children/*[1]; [t] CSFoverscript; [n] children/*[2];,self::limupper,name(../..)="underscore" or name(../..)="overscore",following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(
|
|
",",
|
|
),
|
|
'Aliases;limlower;self::underscore;@role="limit function";name(../..)="underscore" or name(../..)="overscore";following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(
|
|
";",
|
|
),
|
|
'Aliases;limlower;self::underscore;children/*[2][@role!="underaccent"];name(../..)="underscore" or name(../..)="overscore";following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(
|
|
";",
|
|
),
|
|
'Aliases;limupper;self::overscore;children/*[2][@role!="overaccent"];name(../..)="underscore" or name(../..)="overscore";following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"limboth-end",
|
|
"default",
|
|
'[n] children/*[1]; [t] CSFunderscript; [n] children/*[2];[t] CSFoverscript; [n] children/*[3]; [t] "Endscripts"',
|
|
"self::limboth",
|
|
],
|
|
[
|
|
"Rule",
|
|
"limlower-end",
|
|
"default",
|
|
'[n] children/*[1]; [t] CSFunderscript; [n] children/*[2]; [t] "Endscripts"',
|
|
"self::limlower",
|
|
],
|
|
[
|
|
"Rule",
|
|
"limupper-end",
|
|
"default",
|
|
'[n] children/*[1]; [t] CSFoverscript; [n] children/*[2]; [t] "Endscripts"',
|
|
"self::limupper",
|
|
],
|
|
["Aliases", "limlower-end", "self::underscore", '@role="limit function"'],
|
|
["Aliases", "limlower-end", "self::underscore"],
|
|
["Aliases", "limupper-end", "self::overscore"],
|
|
[
|
|
"Rule",
|
|
"integral",
|
|
"default",
|
|
"[n] children/*[1]; [n] children/*[2]; [n] children/*[3];",
|
|
"self::integral",
|
|
],
|
|
'Rule,integral,default,[n] children/*[1]; [t] "Subscript"; [n] children/*[2];[t] "Superscript"; [n] children/*[3]; [t] "Baseline";,self::limboth,@role="integral"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"integral",
|
|
"default",
|
|
"brief",
|
|
'[n] children/*[1]; [t] "Sub"; [n] children/*[2];[t] "Sup"; [n] children/*[3]; [t] "Base";',
|
|
],
|
|
["SpecializedRule", "integral", "brief", "sbrief"],
|
|
[
|
|
"Rule",
|
|
"bigop",
|
|
"default",
|
|
"[n] children/*[1]; [n] children/*[2];",
|
|
"self::bigop",
|
|
],
|
|
[
|
|
"Rule",
|
|
"relseq",
|
|
"default",
|
|
"[m] children/* (sepFunc:CTXFcontentIterator)",
|
|
"self::relseq",
|
|
],
|
|
'Rule,equality,default,[n] children/*[1]; [n] content/*[1]; [n] children/*[2],self::relseq,@role="equality",count(./children/*)=2'.split(
|
|
",",
|
|
),
|
|
'Rule;multi-equality;default;[m] children/* (sepFunc:CTXFcontentIterator);self::relseq;@role="equality";count(./children/*)>2'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"multrel",
|
|
"default",
|
|
"[m] children/* (sepFunc:CTXFcontentIterator)",
|
|
"self::multirel",
|
|
],
|
|
[
|
|
"Rule",
|
|
"subscript",
|
|
"default",
|
|
"[n] children/*[1]; [t] CSFsubscriptVerbose; [n] children/*[2]",
|
|
"self::subscript",
|
|
],
|
|
[
|
|
"Rule",
|
|
"subscript",
|
|
"brief",
|
|
"[n] children/*[1]; [t] CSFsubscriptBrief; [n] children/*[2]",
|
|
"self::subscript",
|
|
],
|
|
["SpecializedRule", "subscript", "brief", "sbrief"],
|
|
'Rule,subscript-simple,default,[n] children/*[1]; [n] children/*[2],self::subscript,name(./children/*[1])="identifier",name(./children/*[2])="number",./children/*[2][@role!="mixed"],./children/*[2][@role!="othernumber"]'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "subscript-simple", "default", "brief"],
|
|
["SpecializedRule", "subscript-simple", "default", "sbrief"],
|
|
'Rule,subscript-baseline,default,[n] children/*[1]; [t] CSFsubscriptVerbose; [n] children/*[2]; [t] CSFbaselineVerbose,self::subscript,following-sibling::*,not(name(following-sibling::subscript/children/*[1])="empty" or (name(following-sibling::infixop[@role="implicit"]/children/*[1])="subscript" and name(following-sibling::*/children/*[1]/children/*[1])="empty")) and @role!="subsup",not(following-sibling::*[@role="rightsuper" or @role="rightsub" or @role="leftsub" or @role="leftsub"])'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"subscript-baseline",
|
|
"default",
|
|
"brief",
|
|
"[n] children/*[1]; [t] CSFsubscriptBrief; [n] children/*[2]; [t] CSFbaselineBrief",
|
|
],
|
|
["SpecializedRule", "subscript-baseline", "brief", "sbrief"],
|
|
'Aliases;subscript-baseline;self::subscript;not(following-sibling::*);ancestor::fenced|ancestor::root|ancestor::sqrt|ancestor::punctuated|ancestor::fraction;not(ancestor::punctuated[@role="leftsuper" or @role="rightsub" or @role="rightsuper" or @role="rightsub"])'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"subscript-baseline",
|
|
"self::subscript",
|
|
"not(following-sibling::*)",
|
|
"ancestor::relseq|ancestor::multirel",
|
|
sre.MathspeakUtil.generateBaselineConstraint(),
|
|
],
|
|
[
|
|
"Aliases",
|
|
"subscript-baseline",
|
|
"self::subscript",
|
|
"not(following-sibling::*)",
|
|
"@embellished",
|
|
],
|
|
'Rule,subscript-empty-sup,default,[n] children/*[1]; [n] children/*[2],self::subscript,name(children/*[2])="infixop",name(children/*[2][@role="implicit"]/children/*[1])="superscript",name(children/*[2]/children/*[1]/children/*[1])="empty"'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "subscript-empty-sup", "default", "brief"],
|
|
["SpecializedRule", "subscript-empty-sup", "brief", "sbrief"],
|
|
[
|
|
"Aliases",
|
|
"subscript-empty-sup",
|
|
"self::subscript",
|
|
'name(children/*[2])="superscript"',
|
|
'name(children/*[2]/children/*[1])="empty"',
|
|
],
|
|
[
|
|
"Rule",
|
|
"superscript",
|
|
"default",
|
|
"[n] children/*[1]; [t] CSFsuperscriptVerbose; [n] children/*[2]",
|
|
"self::superscript",
|
|
],
|
|
[
|
|
"SpecializedRule",
|
|
"superscript",
|
|
"default",
|
|
"brief",
|
|
"[n] children/*[1]; [t] CSFsuperscriptBrief; [n] children/*[2]",
|
|
],
|
|
["SpecializedRule", "superscript", "brief", "sbrief"],
|
|
'Rule,superscript-baseline,default,[n] children/*[1]; [t] CSFsuperscriptVerbose; [n] children/*[2];[t] CSFbaselineVerbose,self::superscript,following-sibling::*,not(name(following-sibling::superscript/children/*[1])="empty" or (name(following-sibling::infixop[@role="implicit"]/children/*[1])="superscript" and name(following-sibling::*/children/*[1]/children/*[1])="empty")) and not(following-sibling::*[@role="rightsuper" or @role="rightsub" or @role="leftsub" or @role="leftsub"])'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"superscript-baseline",
|
|
"default",
|
|
"brief",
|
|
"[n] children/*[1]; [t] CSFsuperscriptBrief; [n] children/*[2];[t] CSFbaselineBrief",
|
|
],
|
|
["SpecializedRule", "superscript-baseline", "brief", "sbrief"],
|
|
'Aliases;superscript-baseline;self::superscript;not(following-sibling::*);ancestor::punctuated;ancestor::*/following-sibling::* and not(ancestor::punctuated[@role="leftsuper" or @role="rightsub" or @role="rightsuper" or @role="rightsub"])'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"superscript-baseline",
|
|
"self::superscript",
|
|
"not(following-sibling::*)",
|
|
"ancestor::fraction|ancestor::fenced|ancestor::root|ancestor::sqrt",
|
|
],
|
|
[
|
|
"Aliases",
|
|
"superscript-baseline",
|
|
"self::superscript",
|
|
"not(following-sibling::*)",
|
|
"ancestor::relseq|ancestor::multirel",
|
|
"not(@embellished)",
|
|
sre.MathspeakUtil.generateBaselineConstraint(),
|
|
],
|
|
'Aliases superscript-baseline self::superscript not(following-sibling::*) @embellished not(children/*[2][@role="prime"])'.split(
|
|
" ",
|
|
),
|
|
'Rule,superscript-empty-sub,default,[n] children/*[1]; [n] children/*[2],self::superscript,name(children/*[2])="infixop",name(children/*[2][@role="implicit"]/children/*[1])="subscript",name(children/*[2]/children/*[1]/children/*[1])="empty"'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "superscript-empty-sub", "default", "brief"],
|
|
["SpecializedRule", "superscript-empty-sub", "brief", "sbrief"],
|
|
[
|
|
"Aliases",
|
|
"superscript-empty-sub",
|
|
"self::superscript",
|
|
'name(children/*[2])="subscript"',
|
|
'name(children/*[2]/children/*[1])="empty"',
|
|
],
|
|
'Rule,square,default,[n] children/*[1]; [t] "squared",self::superscript,children/*[2],children/*[2][text()=2],name(children/*[1])!="text" or not(name(children/*[1])="text" and (name(../../../punctuated[@role="text"]/..)="stree" or name(..)="stree")),name(children/*[1])!="subscript" or (name(children/*[1])="subscript" and name(children/*[1]/children/*[1])="identifier" and name(children/*[1]/children/*[2])="number" and children/*[1]/children/*[2][@role!="mixed"] and children/*[1]/children/*[2][@role!="othernumber"]),not(@embellished)'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "square", "default", "brief"],
|
|
["SpecializedRule", "square", "default", "sbrief"],
|
|
'Aliases;square;self::superscript;children/*[2];children/*[2][text()=2];@embellished;children/*[1][@role="prefix operator"]'.split(
|
|
";",
|
|
),
|
|
'Rule,cube,default,[n] children/*[1]; [t] "cubed",self::superscript,children/*[2],children/*[2][text()=3],name(children/*[1])!="text" or not(name(children/*[1])="text" and (name(../../../punctuated[@role="text"]/..)="stree" or name(..)="stree")),name(children/*[1])!="subscript" or (name(children/*[1])="subscript" and name(children/*[1]/children/*[1])="identifier" and name(children/*[1]/children/*[2])="number" and children/*[1]/children/*[2][@role!="mixed"] and children/*[1]/children/*[2][@role!="othernumber"]),not(@embellished)'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "cube", "default", "brief"],
|
|
["SpecializedRule", "cube", "default", "sbrief"],
|
|
'Aliases;cube;self::superscript;children/*[2];children/*[2][text()=3];@embellished;children/*[1][@role="prefix operator"]'.split(
|
|
";",
|
|
),
|
|
'Rule,prime,default,[n] children/*[1]; [n] children/*[2],self::superscript,children/*[2],children/*[2][@role="prime"]'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "prime", "default", "brief"],
|
|
["SpecializedRule", "prime", "default", "sbrief"],
|
|
'Rule,prime-subscript,default,[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptVerbose; [n] children/*[1]/children/*[2],self::superscript,children/*[2][@role="prime"],name(children/*[1])="subscript",not(following-sibling::*)'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"prime-subscript",
|
|
"default",
|
|
"brief",
|
|
"[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptBrief; [n] children/*[1]/children/*[2]",
|
|
],
|
|
["SpecializedRule", "prime-subscript", "brief", "sbrief"],
|
|
'Rule,prime-subscript-baseline,default,[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptVerbose; [n] children/*[1]/children/*[2]; [t] CSFbaselineVerbose,self::superscript,children/*[2][@role="prime"],name(children/*[1])="subscript",following-sibling::*'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"prime-subscript-baseline",
|
|
"default",
|
|
"brief",
|
|
"[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptBrief; [n] children/*[1]/children/*[2]; [t] CSFbaselineBrief",
|
|
],
|
|
["SpecializedRule", "prime-subscript-baseline", "brief", "sbrief"],
|
|
'Aliases prime-subscript-baseline self::superscript children/*[2][@role="prime"] name(children/*[1])="subscript" not(following-sibling::*) @embellished'.split(
|
|
" ",
|
|
),
|
|
'Rule,prime-subscript-simple,default,[n] children/*[1]/children/*[1]; [n] children/*[2];[n] children/*[1]/children/*[2],self::superscript,children/*[2][@role="prime"],name(children/*[1])="subscript",name(children/*[1]/children/*[1])="identifier",name(children/*[1]/children/*[2])="number",children/*[1]/children/*[2][@role!="mixed"],children/*[1]/children/*[2][@role!="othernumber"]'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "prime-subscript-simple", "default", "brief"],
|
|
["SpecializedRule", "prime-subscript-simple", "default", "sbrief"],
|
|
'Rule,overscore,default,[t] "ModifyingAbove"; [n] children/*[1]; [t] "With"; [n] children/*[2],self::overscore,children/*[2][@role="overaccent"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"overscore",
|
|
"default",
|
|
"brief",
|
|
'[t] "ModAbove"; [n] children/*[1]; [t] "With"; [n] children/*[2]',
|
|
],
|
|
["SpecializedRule", "overscore", "brief", "sbrief"],
|
|
'Rule,double-overscore,default,[t] "ModifyingAbove Above"; [n] children/*[1]; [t] "With"; [n] children/*[2],self::overscore,children/*[2][@role="overaccent"],name(children/*[1])="overscore",children/*[1]/children/*[2][@role="overaccent"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"double-overscore",
|
|
"default",
|
|
"brief",
|
|
'[t] "ModAbove Above"; [n] children/*[1]; [t] "With"; [n] children/*[2]',
|
|
],
|
|
["SpecializedRule", "double-overscore", "brief", "sbrief"],
|
|
'Rule,underscore,default,[t] "ModifyingBelow"; [n] children/*[1]; [t] "With"; [n] children/*[2],self::underscore,children/*[2][@role="underaccent"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"underscore",
|
|
"default",
|
|
"brief",
|
|
'[t] "ModBelow"; [n] children/*[1]; [t] "With"; [n] children/*[2]',
|
|
],
|
|
["SpecializedRule", "underscore", "brief", "sbrief"],
|
|
'Rule,double-underscore,default,[t] "ModifyingBelow Below"; [n] children/*[1]; [t] "With"; [n] children/*[2],self::underscore,children/*[2][@role="underaccent"],name(children/*[1])="underscore",children/*[1]/children/*[2][@role="underaccent"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"double-underscore",
|
|
"default",
|
|
"brief",
|
|
'[t] "ModBelow Below"; [n] children/*[1]; [t] "With"; [n] children/*[2]',
|
|
],
|
|
["SpecializedRule", "double-underscore", "brief", "sbrief"],
|
|
'Rule,overbar,default,[n] children/*[1]; [t] "overbar",self::overscore,@role="latinletter" or @role="greekletter" or @role="otherletter",children/*[2][@role="overaccent"],children/*[2][text()="\u00af" or text()="\uffe3" or text()="\uff3f" or text()="_" or text()="\u203e"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"overbar",
|
|
"default",
|
|
"brief",
|
|
'[n] children/*[1]; [t] "overBar"',
|
|
],
|
|
["SpecializedRule", "overbar", "brief", "sbrief"],
|
|
'Rule,underbar,default,[n] children/*[1]; [t] "underbar",self::underscore,@role="latinletter" or @role="greekletter" or @role="otherletter",children/*[2][@role="underaccent"],children/*[2][text()="\u00af" or text()="\uffe3" or text()="\uff3f" or text()="_" or text()="\u203e"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"underbar",
|
|
"default",
|
|
"brief",
|
|
'[n] children/*[1]; [t] "underBar"',
|
|
],
|
|
["SpecializedRule", "underbar", "brief", "sbrief"],
|
|
'Rule,overtilde,default,[n] children/*[1]; [t] "overTilde",self::overscore,children/*[2][@role="overaccent"],@role="latinletter" or @role="greekletter" or @role="otherletter",children/*[2][text()="~" or text()="\u02dc" or text()="\u223c" or text()="\uff5e"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"overtilde",
|
|
"default",
|
|
"brief",
|
|
'[n] children/*[1]; [t] "overtilde"',
|
|
],
|
|
["SpecializedRule", "overtilde", "brief", "sbrief"],
|
|
'Rule,undertilde,default,[n] children/*[1]; [t] "underTilde",self::underscore,@role="latinletter" or @role="greekletter" or @role="otherletter",children/*[2][@role="underaccent"],children/*[2][text()="~" or text()="\u02dc" or text()="\u223c" or text()="\uff5e"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"undertilde",
|
|
"default",
|
|
"brief",
|
|
'[n] children/*[1]; [t] "undertilde"',
|
|
],
|
|
["SpecializedRule", "undertilde", "brief", "sbrief"],
|
|
'Rule,matrix-fence,default,[n] children/*[1];,self::fenced,count(children/*)=1,name(children/*[1])="matrix"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"matrix",
|
|
"default",
|
|
'[t] "Start"; [t] count(children/*); [t] "By";[t] count(children/*[1]/children/*); [t] "Matrix"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Row "); [t] "EndMatrix"',
|
|
"self::matrix",
|
|
],
|
|
[
|
|
"Rule",
|
|
"matrix",
|
|
"sbrief",
|
|
'[t] count(children/*); [t] "By";[t] count(children/*[1]/children/*); [t] "Matrix"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Row "); [t] "EndMatrix"',
|
|
"self::matrix",
|
|
],
|
|
["Aliases", "matrix", "self::vector"],
|
|
[
|
|
"Rule",
|
|
"matrix-row",
|
|
"default",
|
|
'[m] children/* (ctxtFunc:CTXFordinalCounter,context:"Column");[p] (pause: 200)',
|
|
"self::row",
|
|
],
|
|
'Rule{row-with-label{default{[t] "with Label"; [n] content/*[1]; [t] "EndLabel"(pause: 200); [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Column"){self::row{content'.split(
|
|
"{",
|
|
),
|
|
'Rule{row-with-label{brief{[t] "Label"; [n] content/*[1]; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Column"){self::row{content'.split(
|
|
"{",
|
|
),
|
|
["SpecializedRule", "row-with-label", "brief", "sbrief"],
|
|
'Rule{row-with-text-label{sbrief{[t] "Label"; [t] CSFRemoveParens;[m] children/* (ctxtFunc:CTXFordinalCounter,context:"Column"){self::row{content{name(content/cell/children/*[1])="text"'.split(
|
|
"{",
|
|
),
|
|
'Rule;empty-row;default;[t] "Blank";self::row;count(children/*)=0'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"matrix-cell",
|
|
"default",
|
|
"[n] children/*[1]; [p] (pause: 300)",
|
|
"self::cell",
|
|
],
|
|
'Rule,empty-cell,default,[t] "Blank"; [p] (pause: 300),self::cell,count(children/*)=0'.split(
|
|
",",
|
|
),
|
|
'Rule{determinant{default{[t] "Start"; [t] count(children/*); [t] "By";[t] count(children/*[1]/children/*); [t] "Determinant"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Row "); [t] "EndDeterminant"{self::matrix{@role="determinant"'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"determinant",
|
|
"default",
|
|
"sbrief",
|
|
'[t] count(children/*); [t] "By";[t] count(children/*[1]/children/*); [t] "Determinant"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Row "); [t] "EndDeterminant"',
|
|
],
|
|
'Rule{determinant-simple{default{[t] "Start"; [t] count(children/*); [t] "By";[t] count(children/*[1]/children/*); [t] "Determinant"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Row",grammar:simpleDet); [t] "EndDeterminant"{self::matrix{@role="determinant"{CQFdetIsSimple'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"determinant-simple",
|
|
"default",
|
|
"sbrief",
|
|
'[t] count(children/*); [t] "By";[t] count(children/*[1]/children/*); [t] "Determinant"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Row",grammar:simpleDet); [t] "EndDeterminant"',
|
|
],
|
|
'Rule{row-simple{default{[m] children/*;{self::row{@role="determinant"{contains(@grammar, "simpleDet")'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"layout",
|
|
"default",
|
|
'[t] "StartLayout"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Row "); [t] "EndLayout"',
|
|
"self::table",
|
|
],
|
|
[
|
|
"Rule",
|
|
"layout",
|
|
"sbrief",
|
|
'[t] "Layout"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Row "); [t] "EndLayout"',
|
|
"self::table",
|
|
],
|
|
'Rule,binomial,default,[t] "StartBinomialOrMatrix"; [n] children/*[1]/children/*[1]; [t] "Choose"; [n] children/*[2]/children/*[1]; [t] "EndBinomialOrMatrix",self::vector,@role="binomial"'.split(
|
|
",",
|
|
),
|
|
'Rule,binomial,sbrief,[t] "BinomialOrMatrix"; [n] children/*[1]/children/*[1]; [t] "Choose"; [n] children/*[2]/children/*[1]; [t] "EndBinomialOrMatrix",self::vector,@role="binomial"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"cases",
|
|
"default",
|
|
'[t] "StartLayout"; [t] "Enlarged"; [n] content/*[1];[m] children/* (ctxtFunc:CTXFordinalCounter,context:"Row "); [t] "EndLayout"',
|
|
"self::cases",
|
|
],
|
|
[
|
|
"Rule",
|
|
"cases",
|
|
"sbrief",
|
|
'[t] "Layout"; [t] "Enlarged"; [n] content/*[1];[m] children/* (ctxtFunc:CTXFordinalCounter,context:"Row "); [t] "EndLayout"',
|
|
"self::cases",
|
|
],
|
|
["Aliases", "layout", "self::multiline"],
|
|
["Rule", "line", "default", "[m] children/*", "self::line"],
|
|
'Rule,line-with-label,default,[t] "with Label"; [n] content/*[1]; [t] "EndLabel" (pause: 200); [m] children/*,self::line,content'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"line-with-label",
|
|
"default",
|
|
"brief",
|
|
'[t] "Label"; [n] content/*[1] (pause: 200); [m] children/*',
|
|
],
|
|
["SpecializedRule", "line-with-label", "brief", "sbrief"],
|
|
'Rule,line-with-text-label,sbrief,[t] "Label"; [t] CSFRemoveParens; [m] children/*,self::line,content,name(content/cell/children/*[1])="text"'.split(
|
|
",",
|
|
),
|
|
'Rule;empty-line;default;[t] "Blank";self::line;count(children/*)=0;not(content)'.split(
|
|
";",
|
|
),
|
|
["SpecializedRule", "empty-line", "default", "brief"],
|
|
["SpecializedRule", "empty-line", "brief", "sbrief"],
|
|
'Rule,empty-line-with-label,default,[t] "with Label"; [n] content/*[1]; [t] "EndLabel"(pause: 200); [t] "Blank",self::line,count(children/*)=0,content'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"empty-line-with-label",
|
|
"default",
|
|
"brief",
|
|
'[t] "Label"; [n] content/*[1] (pause: 200); [t] "Blank"',
|
|
],
|
|
["SpecializedRule", "empty-line-with-label", "brief", "sbrief"],
|
|
[
|
|
"Rule",
|
|
"enclose",
|
|
"default",
|
|
'[t] "StartEnclose"; [t] @role (grammar:localEnclose); [n] children/*[1]; [t] "EndEnclose"',
|
|
"self::enclose",
|
|
],
|
|
["Aliases", "overbar", "self::enclose", '@role="top"'],
|
|
["Aliases", "underbar", "self::enclose", '@role="bottom"'],
|
|
'Rule,leftbar,default,[t] "vertical bar"; [n] children/*[1],self::enclose,@role="left"'.split(
|
|
",",
|
|
),
|
|
'Rule,rightbar,default,[n] children/*[1]; [t] "vertical bar",self::enclose,@role="right"'.split(
|
|
",",
|
|
),
|
|
'Rule,crossout,default,[t] "CrossOut"; [n] children/*[1]; [t] "EndCrossOut",self::enclose,@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"'.split(
|
|
",",
|
|
),
|
|
'Rule,cancel,default,[t] "CrossOut"; [n] children/*[1]/children/*[1]; [t] "With"; [n] children/*[2]; [t] "EndCrossOut",self::overscore,@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "cancel", "default", "brief"],
|
|
["SpecializedRule", "cancel", "default", "sbrief"],
|
|
[
|
|
"Aliases",
|
|
"cancel",
|
|
"self::underscore",
|
|
'@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"',
|
|
],
|
|
'Rule,cancel-reverse,default,[t] "CrossOut"; [n] children/*[2]/children/*[1]; [t] "With"; [n] children/*[1]; [t] "EndCrossOut",self::overscore,name(children/*[2])="enclose",children/*[2][@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"]'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "cancel-reverse", "default", "brief"],
|
|
["SpecializedRule", "cancel-reverse", "default", "sbrief"],
|
|
[
|
|
"Aliases",
|
|
"cancel-reverse",
|
|
"self::underscore",
|
|
'name(children/*[2])="enclose"',
|
|
'children/*[2][@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"]',
|
|
],
|
|
'Rule;end-punct;default;[m] children/*;self::punctuated;@role="endpunct"'.split(
|
|
";",
|
|
),
|
|
'Rule,start-punct,default,[n] content/*[1]; [m] children/*[position()>1],self::punctuated,@role="startpunct"'.split(
|
|
",",
|
|
),
|
|
'Rule,integral-punct,default,[n] children/*[1]; [n] children/*[3],self::punctuated,@role="integral"'.split(
|
|
",",
|
|
),
|
|
["Rule", "punctuated", "default", "[m] children/*", "self::punctuated"],
|
|
'Rule;unit;default;[t] text() (grammar:annotation="unit":translate:plural);self::identifier;@role="unit"'.split(
|
|
";",
|
|
),
|
|
'Rule;unit-combine;default;[m] children/*;self::infixop;@role="unit"'.split(
|
|
";",
|
|
),
|
|
'Rule,unit-divide,default,[n] children/*[1]; [t] "per"; [n] children/*[2],self::fraction,@role="unit"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"inference",
|
|
"default",
|
|
'[t] "inference rule"; [m] content/*; [t] "with conclusion"; [n] children/*[1]; [t] "and"; [t] count(children/*[2]/children/*); [t] "premises"',
|
|
"self::inference",
|
|
],
|
|
'Rule,inference,default,[t] "inference rule"; ; [m] content/*; [t] "with conclusion"; [n] children/*[1]; [t] "and"; [t] count(children/*[2]/children/*); [t] "premise",self::inference,count(children/*[2]/children/*)<2'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"premise",
|
|
"default",
|
|
'[m] children/* (ctxtFunc:CTXFordinalCounter,context:"premise ");',
|
|
"self::premises",
|
|
],
|
|
["Rule", "conclusion", "default", "[n] children/*[1]", "self::conclusion"],
|
|
[
|
|
"Rule",
|
|
"label",
|
|
"default",
|
|
'[t] "label"; [n] children/*[1]',
|
|
"self::rulelabel",
|
|
],
|
|
'Rule,axiom,default,[t] "axiom"; [m] children/*[1];,self::inference,@role="axiom"'.split(
|
|
",",
|
|
),
|
|
'Rule,axiom,default,[t] "empty axiom";,self::empty,@role="axiom"'.split(
|
|
",",
|
|
),
|
|
],
|
|
initialize: [sre.MathspeakUtil.generateTensorRules],
|
|
};
|
|
sre.MathspeakSpanishUtil = {};
|
|
sre.MathspeakSpanishUtil.ordinalCounter = function (a, b) {
|
|
var c = 0;
|
|
return function () {
|
|
return sre.Messages.NUMBERS.numberToOrdinal(++c, !1) + " " + b;
|
|
};
|
|
};
|
|
sre.MathspeakSpanishUtil.smallRoot = function (a) {
|
|
if (!a.childNodes || 0 === a.childNodes.length || !a.childNodes[0].childNodes)
|
|
return [];
|
|
var b = a.childNodes[0].childNodes[0].textContent;
|
|
if (!/^\d+$/.test(b)) return [];
|
|
b = parseInt(b, 10);
|
|
return 1 < b && 10 >= b ? [a] : [];
|
|
};
|
|
sre.UnitUtil = {};
|
|
sre.UnitUtil.unitMultipliers = function (a, b) {
|
|
var c = 0;
|
|
return function () {
|
|
var d = sre.AuditoryDescription.create(
|
|
{
|
|
text:
|
|
sre.UnitUtil.rightMostUnit(a[c]) &&
|
|
sre.UnitUtil.leftMostUnit(a[c + 1])
|
|
? sre.Messages.UNIT_TIMES
|
|
: "",
|
|
},
|
|
{},
|
|
);
|
|
c++;
|
|
return [d];
|
|
};
|
|
};
|
|
sre.UnitUtil.SCRIPT_ELEMENTS = [
|
|
sre.SemanticAttr.Type.SUPERSCRIPT,
|
|
sre.SemanticAttr.Type.SUBSCRIPT,
|
|
sre.SemanticAttr.Type.OVERSCORE,
|
|
sre.SemanticAttr.Type.UNDERSCORE,
|
|
];
|
|
sre.UnitUtil.rightMostUnit = function (a) {
|
|
for (; a; ) {
|
|
if ("unit" === a.getAttribute("role")) return !0;
|
|
var b = a.tagName;
|
|
a = sre.XpathUtil.evalXPath("children/*", a);
|
|
a = -1 !== sre.UnitUtil.SCRIPT_ELEMENTS.indexOf(b) ? a[0] : a[a.length - 1];
|
|
}
|
|
return !1;
|
|
};
|
|
sre.UnitUtil.leftMostUnit = function (a) {
|
|
for (; a; ) {
|
|
if ("unit" === a.getAttribute("role")) return !0;
|
|
a = sre.XpathUtil.evalXPath("children/*", a)[0];
|
|
}
|
|
return !1;
|
|
};
|
|
sre.UnitUtil.oneLeft = function (a) {
|
|
for (; a; ) {
|
|
if ("number" === a.tagName && "1" === a.textContent) return [a];
|
|
if (
|
|
"infixop" !== a.tagName ||
|
|
("multiplication" !== a.getAttribute("role") &&
|
|
"implicit" !== a.getAttribute("role"))
|
|
)
|
|
break;
|
|
a = sre.XpathUtil.evalXPath("children/*", a)[0];
|
|
}
|
|
return [];
|
|
};
|
|
sre.MathspeakSpanish = {
|
|
locale: "es",
|
|
domain: "mathspeak",
|
|
functions: [
|
|
["CQF", "CQFspaceoutNumber", sre.MathspeakUtil.spaceoutNumber],
|
|
["CQF", "CQFspaceoutIdentifier", sre.MathspeakUtil.spaceoutIdentifier],
|
|
["CSF", "CSFspaceoutText", sre.MathspeakUtil.spaceoutText],
|
|
["CSF", "CSFopenFracVerbose", sre.MathspeakUtil.openingFractionVerbose],
|
|
["CSF", "CSFcloseFracVerbose", sre.MathspeakUtil.closingFractionVerbose],
|
|
["CSF", "CSFoverFracVerbose", sre.MathspeakUtil.overFractionVerbose],
|
|
["CSF", "CSFopenFracBrief", sre.MathspeakUtil.openingFractionBrief],
|
|
["CSF", "CSFcloseFracBrief", sre.MathspeakUtil.closingFractionBrief],
|
|
["CSF", "CSFopenFracSbrief", sre.MathspeakUtil.openingFractionSbrief],
|
|
["CSF", "CSFcloseFracSbrief", sre.MathspeakUtil.closingFractionSbrief],
|
|
["CSF", "CSFoverFracSbrief", sre.MathspeakUtil.overFractionSbrief],
|
|
["CSF", "CSFopenRadicalVerbose", sre.MathspeakUtil.openingRadicalVerbose],
|
|
["CSF", "CSFcloseRadicalVerbose", sre.MathspeakUtil.closingRadicalVerbose],
|
|
["CSF", "CSFindexRadicalVerbose", sre.MathspeakUtil.indexRadicalVerbose],
|
|
["CSF", "CSFopenRadicalBrief", sre.MathspeakUtil.openingRadicalBrief],
|
|
["CSF", "CSFcloseRadicalBrief", sre.MathspeakUtil.closingRadicalBrief],
|
|
["CSF", "CSFindexRadicalBrief", sre.MathspeakUtil.indexRadicalBrief],
|
|
["CSF", "CSFopenRadicalSbrief", sre.MathspeakUtil.openingRadicalSbrief],
|
|
["CSF", "CSFindexRadicalSbrief", sre.MathspeakUtil.indexRadicalSbrief],
|
|
["CQF", "CQFisSmallRoot", sre.MathspeakSpanishUtil.smallRoot],
|
|
["CSF", "CSFsuperscriptVerbose", sre.MathspeakUtil.superscriptVerbose],
|
|
["CSF", "CSFsuperscriptBrief", sre.MathspeakUtil.superscriptBrief],
|
|
["CSF", "CSFsubscriptVerbose", sre.MathspeakUtil.subscriptVerbose],
|
|
["CSF", "CSFsubscriptBrief", sre.MathspeakUtil.subscriptBrief],
|
|
["CSF", "CSFbaselineVerbose", sre.MathspeakUtil.baselineVerbose],
|
|
["CSF", "CSFbaselineBrief", sre.MathspeakUtil.baselineBrief],
|
|
["CSF", "CSFleftsuperscriptVerbose", sre.MathspeakUtil.superscriptVerbose],
|
|
["CSF", "CSFleftsubscriptVerbose", sre.MathspeakUtil.subscriptVerbose],
|
|
["CSF", "CSFrightsuperscriptVerbose", sre.MathspeakUtil.superscriptVerbose],
|
|
["CSF", "CSFrightsubscriptVerbose", sre.MathspeakUtil.subscriptVerbose],
|
|
["CSF", "CSFleftsuperscriptBrief", sre.MathspeakUtil.superscriptBrief],
|
|
["CSF", "CSFleftsubscriptBrief", sre.MathspeakUtil.subscriptBrief],
|
|
["CSF", "CSFrightsuperscriptBrief", sre.MathspeakUtil.superscriptBrief],
|
|
["CSF", "CSFrightsubscriptBrief", sre.MathspeakUtil.subscriptBrief],
|
|
["CSF", "CSFunderscript", sre.MathspeakUtil.nestedUnderscore],
|
|
["CSF", "CSFoverscript", sre.MathspeakUtil.nestedOverscore],
|
|
["CTXF", "CTXFordinalCounter", sre.MathspeakSpanishUtil.ordinalCounter],
|
|
["CTXF", "CTXFcontentIterator", sre.StoreUtil.contentIterator],
|
|
["CTXF", "CTXFunitMultipliers", sre.UnitUtil.unitMultipliers],
|
|
["CQF", "CQFdetIsSimple", sre.MathspeakUtil.determinantIsSimple],
|
|
["CSF", "CSFRemoveParens", sre.MathspeakUtil.removeParens],
|
|
["CQF", "CQFoneLeft", sre.UnitUtil.oneLeft],
|
|
["CQF", "CQFresetNesting", sre.MathspeakUtil.resetNestingDepth],
|
|
],
|
|
rules: [
|
|
'Rule{collapsed{default{[n] . (engine:modality=summary,grammar:collapsed); [t] "plegado";{self::*{@alternative{not(contains(@grammar, "collapsed")){self::*{self::*{self::*{self::*{self::*'.split(
|
|
"{",
|
|
),
|
|
["SpecializedRule", "collapsed", "default", "brief"],
|
|
["SpecializedRule", "collapsed", "brief", "sbrief"],
|
|
"Rule;stree;default;[n] ./*[1];self::stree;CQFresetNesting".split(";"),
|
|
["Rule", "unknown", "default", "[n] text()", "self::unknown"],
|
|
'Rule;protected;default;[t] text();self::number;contains(@grammar, "protected")'.split(
|
|
";",
|
|
),
|
|
["Rule", "omit-empty", "default", "[p] (pause:100)", "self::empty"],
|
|
'Rule;blank-empty;default;[t] "espacio";self::empty;count(../*)=1;name(../..)="cell" or name(../..)="line"'.split(
|
|
";",
|
|
),
|
|
'Rule{font{default{[t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font){self::*{@font{not(contains(@grammar, "ignoreFont")){@font!="normal"'.split(
|
|
"{",
|
|
),
|
|
'Rule{font-identifier-short{default{[t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font){self::identifier{string-length(text())=1{@font{not(contains(@grammar, "ignoreFont")){@font="normal"{""=translate(text(), "abcdefghijklmnopqrstuvwxyz\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9", ""){@role!="unit"'.split(
|
|
"{",
|
|
),
|
|
'Rule{font-identifier{default{[t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font){self::identifier{string-length(text())=1{@font{@font="normal"{not(contains(@grammar, "ignoreFont")){@role!="unit"'.split(
|
|
"{",
|
|
),
|
|
'Rule;omit-font;default;[n] . (grammar:ignoreFont=@font);self::identifier;string-length(text())=1;@font;not(contains(@grammar, "ignoreFont"));@font="italic"'.split(
|
|
";",
|
|
),
|
|
["Rule", "number", "default", "[n] text()", "self::number"],
|
|
'Rule,mixed-number,default,[n] children/*[1]; [t] "m\u00e1s"; [n] children/*[2]; ,self::number,@role="mixed"'.split(
|
|
",",
|
|
),
|
|
'Rule{number-with-chars{default{[t] "n\u00famero"; [m] CQFspaceoutNumber (grammar:protected){self::number{@role="othernumber"{"" != translate(text(), "0123456789.,", ""){not(contains(@grammar, "protected"))'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"number-with-chars",
|
|
"default",
|
|
"brief",
|
|
'[t] "n\u00fam"; [m] CQFspaceoutNumber (grammar:protected)',
|
|
],
|
|
["SpecializedRule", "number-with-chars", "brief", "sbrief"],
|
|
'Rule{number-as-upper-word{default{[t] "may\u00fascula"; [t] CSFspaceoutText{self::number{string-length(text())>1{text()=translate(text(), "abcdefghijklmnopqrstuvwxyz\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9", "ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9"){""=translate(text(), "ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9","")'.split(
|
|
"{",
|
|
),
|
|
["SpecializedRule", "number-as-upper-word", "default", "brief"],
|
|
["SpecializedRule", "number-as-upper-word", "default", "sbrief"],
|
|
'Rule{number-baseline{default{[t] "l\u00ednea base"; [n] . (grammar:baseline){self::number{not(contains(@grammar, "ignoreFont")){preceding-sibling::identifier{not(contains(@grammar, "baseline")){preceding-sibling::*[1][@role="latinletter" or @role="greekletter" or @role="otherletter"]{parent::*/parent::infixop[@role="implicit"]'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"number-baseline",
|
|
"default",
|
|
"brief",
|
|
'[t] "base"; [n] text()',
|
|
],
|
|
["SpecializedRule", "number-baseline", "brief", "sbrief"],
|
|
'Rule{number-baseline-font{default{[t] "l\u00ednea base"; [t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font){self::number{@font{not(contains(@grammar, "ignoreFont")){@font!="normal"{preceding-sibling::identifier{preceding-sibling::*[@role="latinletter" or @role="greekletter" or @role="otherletter"]{parent::*/parent::infixop[@role="implicit"]'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"number-baseline-font",
|
|
"default",
|
|
"brief",
|
|
'[t] "base"; [t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font)',
|
|
],
|
|
["SpecializedRule", "number-baseline-font", "brief", "sbrief"],
|
|
'Rule;identifier;default;[m] CQFspaceoutIdentifier;self::identifier;string-length(text())>1;@role!="unit";not(@font) or @font="normal" or contains(@grammar, "ignoreFont");text()!=translate(text(), "abcdefghijklmnopqrstuvwxyz\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9", "")'.split(
|
|
";",
|
|
),
|
|
["Rule", "identifier", "default", "[n] text()", "self::identifier"],
|
|
'Rule,negative,default,[t] "menos"; [n] children/*[1],self::prefixop,@role="negative",children/identifier'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"negative",
|
|
"self::prefixop",
|
|
'@role="negative"',
|
|
"children/number",
|
|
],
|
|
[
|
|
"Aliases",
|
|
"negative",
|
|
"self::prefixop",
|
|
'@role="negative"',
|
|
'children/fraction[@role="vulgar"]',
|
|
],
|
|
'Rule,negative,default,[t] "menos"; [n] children/*[1],self::prefixop,@role="negative"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"prefix",
|
|
"default",
|
|
"[m] content/*; [n] children/*[1]",
|
|
"self::prefixop",
|
|
],
|
|
[
|
|
"Rule",
|
|
"postfix",
|
|
"default",
|
|
"[n] children/*[1]; [m] content/*",
|
|
"self::postfixop",
|
|
],
|
|
[
|
|
"Rule",
|
|
"binary-operation",
|
|
"default",
|
|
"[m] children/* (sepFunc:CTXFcontentIterator);",
|
|
"self::infixop",
|
|
],
|
|
'Rule;implicit;default;[m] children/*;self::infixop;@role="implicit"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"implicit",
|
|
"self::infixop",
|
|
'@role="leftsuper" or @role="leftsub" or @role="rightsuper" or @role="rightsub"',
|
|
],
|
|
'Rule,subtraction,default,[m] children/* (separator:"menos");,self::infixop,@role="subtraction"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"function-unknown",
|
|
"default",
|
|
"[n] children/*[1]; [n] children/*[2]",
|
|
"self::appl",
|
|
],
|
|
'Rule,function-prefix,default,[n] children/*[1]; [n] children/*[2],self::appl,children/*[1][@role="prefix function"]'.split(
|
|
",",
|
|
),
|
|
'Rule,fences-open-close,default,[n] content/*[1]; [n] children/*[1]; [n] content/*[2],self::fenced,@role="leftright"'.split(
|
|
",",
|
|
),
|
|
'Rule,fences-neutral,default,[t] "empezar valor absoluto"; [n] children/*[1]; [t] "finalizar valor absoluto",self::fenced,@role="neutral",content/*[1][text()]="|" or content/*[1][text()]="\u2758" or content/*[1][text()]="\uff5c"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"fences-neutral",
|
|
"default",
|
|
"sbrief",
|
|
'[t] "valor absoluto"; [n] children/*[1]; [t] "finalizar valor absoluto"',
|
|
],
|
|
'Rule,fences-neutral,default,[n] content/*[1]; [n] children/*[1]; [n] content/*[2],self::fenced,@role="neutral"'.split(
|
|
",",
|
|
),
|
|
'Rule,fences-set,default,[t] "empezar llave"; [n] children/*[1]; [t] "finalizar llave",self::fenced,@role="set empty" or @role="set extended" or @role="set singleton" or @role="set collection",not(name(../..)="appl")'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"fences-set",
|
|
"default",
|
|
"sbrief",
|
|
'[t] "llave"; [n] children/*[1]; [t] "finalizar llave"',
|
|
],
|
|
[
|
|
"Rule",
|
|
"text",
|
|
"default",
|
|
"[n] text() (grammar:noTranslateText)",
|
|
"self::text",
|
|
],
|
|
'Rule;factorial;default;[t] "factorial";self::punctuation;text()="!";name(preceding-sibling::*[1])!="text"'.split(
|
|
";",
|
|
),
|
|
'Rule;minus;default;[t] "menos";self::operator;text()="-"'.split(";"),
|
|
'Rule;single-prime;default;[t] "prima";self::punctuated;@role="prime";count(children/*)=1'.split(
|
|
";",
|
|
),
|
|
'Rule;double-prime;default;[t] "doble prima";self::punctuated;@role="prime";count(children/*)=2'.split(
|
|
";",
|
|
),
|
|
'Rule;triple-prime;default;[t] "triple prima";self::punctuated;@role="prime";count(children/*)=3'.split(
|
|
";",
|
|
),
|
|
'Rule;quadruple-prime;default;[t] "cuadruplicar prima";self::punctuated;@role="prime";count(children/*)=4'.split(
|
|
";",
|
|
),
|
|
'Rule,counted-prime,default,[t] count(children/*); [t] "prime",self::punctuated,@role="prime"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"default",
|
|
"[t] CSFopenFracVerbose; [n] children/*[1]; [t] CSFoverFracVerbose; [n] children/*[2]; [t] CSFcloseFracVerbose",
|
|
"self::fraction",
|
|
],
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"brief",
|
|
"[t] CSFopenFracBrief; [n] children/*[1]; [t] CSFoverFracVerbose; [n] children/*[2]; [t] CSFcloseFracBrief",
|
|
"self::fraction",
|
|
],
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"sbrief",
|
|
"[t] CSFopenFracSbrief; [n] children/*[1]; [t] CSFoverFracSbrief; [n] children/*[2]; [t] CSFcloseFracSbrief",
|
|
"self::fraction",
|
|
],
|
|
'Rule,continued-fraction-outer,default,[t] "fracci\u00f3n continua"; [n] children/*[1];[t] "entre"; [n] children/*[2],self::fraction,not(ancestor::fraction),children/*[2]/descendant-or-self::*[@role="ellipsis" and not(following-sibling::*)]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"continued-fraction-outer",
|
|
"default",
|
|
"brief",
|
|
'[t] "frac continua"; [n] children/*[1];[t] "entre"; [n] children/*[2]',
|
|
],
|
|
["SpecializedRule", "continued-fraction-outer", "brief", "sbrief"],
|
|
'Rule,continued-fraction-inner,default,[t] "empezar fracci\u00f3n"; [n] children/*[1];[t] "entre"; [n] children/*[2],self::fraction,ancestor::fraction,children/*[2]/descendant-or-self::*[@role="ellipsis" and not(following-sibling::*)]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"continued-fraction-inner",
|
|
"default",
|
|
"brief",
|
|
'[t] "empezar frac"; [n] children/*[1];[t] "entre"; [n] children/*[2]',
|
|
],
|
|
[
|
|
"SpecializedRule",
|
|
"continued-fraction-inner",
|
|
"brief",
|
|
"sbrief",
|
|
'[t] "frac"; [n] children/*[1];[t] "entre"; [n] children/*[2]',
|
|
],
|
|
[
|
|
"Rule",
|
|
"sqrt",
|
|
"default",
|
|
"[t] CSFopenRadicalVerbose; [n] children/*[1]; [t] CSFcloseRadicalVerbose",
|
|
"self::sqrt",
|
|
],
|
|
[
|
|
"Rule",
|
|
"sqrt",
|
|
"brief",
|
|
"[t] CSFopenRadicalBrief; [n] children/*[1]; [t] CSFcloseRadicalBrief",
|
|
"self::sqrt",
|
|
],
|
|
[
|
|
"Rule",
|
|
"sqrt",
|
|
"sbrief",
|
|
"[t] CSFopenRadicalSbrief; [n] children/*[1]; [t] CSFcloseRadicalBrief",
|
|
"self::sqrt",
|
|
],
|
|
"Rule,root-small,default,[t] CSFopenRadicalVerbose; [n] children/*[2]; [t] CSFcloseRadicalVerbose,self::root,CQFisSmallRoot".split(
|
|
",",
|
|
),
|
|
"Rule,root-small,brief,[t] CSFopenRadicalBrief; [n] children/*[2]; [t] CSFcloseRadicalBrief,self::root,CQFisSmallRoot".split(
|
|
",",
|
|
),
|
|
"Rule,root-small,sbrief,[t] CSFopenRadicalSbrief; [n] children/*[2]; [t] CSFcloseRadicalBrief,self::root,CQFisSmallRoot".split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"root",
|
|
"default",
|
|
"[t] CSFindexRadicalVerbose; [n] children/*[1];[t] CSFopenRadicalVerbose; [n] children/*[2]; [t] CSFcloseRadicalVerbose",
|
|
"self::root",
|
|
],
|
|
[
|
|
"Rule",
|
|
"root",
|
|
"brief",
|
|
"[t] CSFindexRadicalBrief; [n] children/*[1];[t] CSFopenRadicalBrief; [n] children/*[2]; [t] CSFcloseRadicalBrief",
|
|
"self::root",
|
|
],
|
|
[
|
|
"Rule",
|
|
"root",
|
|
"sbrief",
|
|
"[t] CSFindexRadicalSbrief; [n] children/*[1];[t] CSFopenRadicalSbrief; [n] children/*[2]; [t] CSFcloseRadicalBrief",
|
|
"self::root",
|
|
],
|
|
'Rule,limboth,default,[n] children/*[1]; [t] CSFunderscript; [n] children/*[2];[t] CSFoverscript; [n] children/*[3],self::limboth,name(../..)="underscore" or name(../..)="overscore",following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(
|
|
",",
|
|
),
|
|
'Rule,limlower,default,[n] children/*[1]; [t] CSFunderscript; [n] children/*[2];,self::limlower,name(../..)="underscore" or name(../..)="overscore",following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(
|
|
",",
|
|
),
|
|
'Rule,limupper,default,[n] children/*[1]; [t] CSFoverscript; [n] children/*[2];,self::limupper,name(../..)="underscore" or name(../..)="overscore",following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(
|
|
",",
|
|
),
|
|
'Aliases;limlower;self::underscore;@role="limit function";name(../..)="underscore" or name(../..)="overscore";following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(
|
|
";",
|
|
),
|
|
'Aliases;limlower;self::underscore;children/*[2][@role!="underaccent"];name(../..)="underscore" or name(../..)="overscore";following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(
|
|
";",
|
|
),
|
|
'Aliases;limupper;self::overscore;children/*[2][@role!="overaccent"];name(../..)="underscore" or name(../..)="overscore";following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"limboth-end",
|
|
"default",
|
|
'[n] children/*[1]; [t] CSFunderscript; [n] children/*[2];[t] CSFoverscript; [n] children/*[3]; [t] "finalizar \u00edndices"',
|
|
"self::limboth",
|
|
],
|
|
[
|
|
"Rule",
|
|
"limlower-end",
|
|
"default",
|
|
'[n] children/*[1]; [t] CSFunderscript; [n] children/*[2]; [t] "finalizar \u00edndices"',
|
|
"self::limlower",
|
|
],
|
|
[
|
|
"Rule",
|
|
"limupper-end",
|
|
"default",
|
|
'[n] children/*[1]; [t] CSFoverscript; [n] children/*[2]; [t] "finalizar \u00edndices"',
|
|
"self::limupper",
|
|
],
|
|
["Aliases", "limlower-end", "self::underscore", '@role="limit function"'],
|
|
["Aliases", "limlower-end", "self::underscore"],
|
|
["Aliases", "limupper-end", "self::overscore"],
|
|
[
|
|
"Rule",
|
|
"integral",
|
|
"default",
|
|
"[n] children/*[1]; [n] children/*[2]; [n] children/*[3];",
|
|
"self::integral",
|
|
],
|
|
'Rule,integral,default,[n] children/*[1]; [t] "definida"; [t] "sub\u00edndice"; [n] children/*[2];[t] "super\u00edndice"; [n] children/*[3]; [t] "l\u00ednea base";,self::limboth,@role="integral"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"integral",
|
|
"default",
|
|
"brief",
|
|
'[n] children/*[1]; [t] "Sub"; [n] children/*[2];[t] "Sup"; [n] children/*[3]; [t] "Base";',
|
|
],
|
|
["SpecializedRule", "integral", "brief", "sbrief"],
|
|
[
|
|
"Rule",
|
|
"bigop",
|
|
"default",
|
|
"[n] children/*[1]; [n] children/*[2];",
|
|
"self::bigop",
|
|
],
|
|
[
|
|
"Rule",
|
|
"relseq",
|
|
"default",
|
|
"[m] children/* (sepFunc:CTXFcontentIterator)",
|
|
"self::relseq",
|
|
],
|
|
'Rule,equality,default,[n] children/*[1]; [n] content/*[1]; [n] children/*[2],self::relseq,@role="equality",count(./children/*)=2'.split(
|
|
",",
|
|
),
|
|
'Rule;multi-equality;default;[m] children/* (sepFunc:CTXFcontentIterator);self::relseq;@role="equality";count(./children/*)>2'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"multrel",
|
|
"default",
|
|
"[m] children/* (sepFunc:CTXFcontentIterator)",
|
|
"self::multirel",
|
|
],
|
|
[
|
|
"Rule",
|
|
"subscript",
|
|
"default",
|
|
"[n] children/*[1]; [t] CSFsubscriptVerbose; [n] children/*[2]",
|
|
"self::subscript",
|
|
],
|
|
[
|
|
"Rule",
|
|
"subscript",
|
|
"brief",
|
|
"[n] children/*[1]; [t] CSFsubscriptBrief; [n] children/*[2]",
|
|
"self::subscript",
|
|
],
|
|
["SpecializedRule", "subscript", "brief", "sbrief"],
|
|
'Rule,subscript-baseline,default,[n] children/*[1]; [t] CSFsubscriptVerbose; [n] children/*[2]; [t] CSFbaselineVerbose,self::subscript,following-sibling::*,not(name(following-sibling::subscript/children/*[1])="empty" or (name(following-sibling::infixop[@role="implicit"]/children/*[1])="subscript" and name(following-sibling::*/children/*[1]/children/*[1])="empty")) and @role!="subsup",not(following-sibling::*[@role="rightsuper" or @role="rightsub" or @role="leftsub" or @role="leftsub"])'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"subscript-baseline",
|
|
"default",
|
|
"brief",
|
|
"[n] children/*[1]; [t] CSFsubscriptBrief; [n] children/*[2]; [t] CSFbaselineBriefS",
|
|
],
|
|
["SpecializedRule", "subscript-baseline", "brief", "sbrief"],
|
|
'Aliases;subscript-baseline;self::subscript;not(following-sibling::*);ancestor::fenced|ancestor::root|ancestor::sqrt|ancestor::punctuated|ancestor::fraction;not(ancestor::punctuated[@role="leftsuper" or @role="rightsub" or @role="rightsuper" or @role="rightsub"])'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"subscript-baseline",
|
|
"self::subscript",
|
|
"not(following-sibling::*)",
|
|
"ancestor::relseq|ancestor::multirel",
|
|
sre.MathspeakUtil.generateBaselineConstraint(),
|
|
],
|
|
[
|
|
"Aliases",
|
|
"subscript-baseline",
|
|
"self::subscript",
|
|
"not(following-sibling::*)",
|
|
"@embellished",
|
|
],
|
|
'Rule,subscript-empty-sup,default,[n] children/*[1]; [n] children/*[2],self::subscript,name(children/*[2])="infixop",name(children/*[2][@role="implicit"]/children/*[1])="superscript",name(children/*[2]/children/*[1]/children/*[1])="empty"'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "subscript-empty-sup", "default", "brief"],
|
|
["SpecializedRule", "subscript-empty-sup", "brief", "sbrief"],
|
|
[
|
|
"Aliases",
|
|
"subscript-empty-sup",
|
|
"self::subscript",
|
|
'name(children/*[2])="superscript"',
|
|
'name(children/*[2]/children/*[1])="empty"',
|
|
],
|
|
[
|
|
"Rule",
|
|
"superscript",
|
|
"default",
|
|
"[n] children/*[1]; [t] CSFsuperscriptVerbose; [n] children/*[2]",
|
|
"self::superscript",
|
|
],
|
|
[
|
|
"SpecializedRule",
|
|
"superscript",
|
|
"default",
|
|
"brief",
|
|
"[n] children/*[1]; [t] CSFsuperscriptBrief; [n] children/*[2]",
|
|
],
|
|
["SpecializedRule", "superscript", "brief", "sbrief"],
|
|
'Rule,superscript-baseline,default,[n] children/*[1]; [t] CSFsuperscriptVerbose; [n] children/*[2];[t] CSFbaselineVerbose,self::superscript,following-sibling::*,not(name(following-sibling::superscript/children/*[1])="empty" or (name(following-sibling::infixop[@role="implicit"]/children/*[1])="superscript" and name(following-sibling::*/children/*[1]/children/*[1])="empty")) and not(following-sibling::*[@role="rightsuper" or @role="rightsub" or @role="leftsub" or @role="leftsub"])'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"superscript-baseline",
|
|
"default",
|
|
"brief",
|
|
"[n] children/*[1]; [t] CSFsuperscriptBrief; [n] children/*[2];[t] CSFbaselineBriefS",
|
|
],
|
|
["SpecializedRule", "superscript-baseline", "brief", "sbrief"],
|
|
'Aliases;superscript-baseline;self::superscript;not(following-sibling::*);ancestor::punctuated;ancestor::*/following-sibling::* and not(ancestor::punctuated[@role="leftsuper" or @role="rightsub" or @role="rightsuper" or @role="rightsub"])'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"superscript-baseline",
|
|
"self::superscript",
|
|
"not(following-sibling::*)",
|
|
"ancestor::fraction|ancestor::fenced|ancestor::root|ancestor::sqrt",
|
|
],
|
|
[
|
|
"Aliases",
|
|
"superscript-baseline",
|
|
"self::superscript",
|
|
"not(following-sibling::*)",
|
|
"ancestor::relseq|ancestor::multirel",
|
|
"not(@embellished)",
|
|
sre.MathspeakUtil.generateBaselineConstraint(),
|
|
],
|
|
'Aliases superscript-baseline self::superscript not(following-sibling::*) @embellished not(children/*[2][@role="prime"])'.split(
|
|
" ",
|
|
),
|
|
'Rule,superscript-empty-sub,default,[n] children/*[1]; [n] children/*[2],self::superscript,name(children/*[2])="infixop",name(children/*[2][@role="implicit"]/children/*[1])="subscript",name(children/*[2]/children/*[1]/children/*[1])="empty"'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "superscript-empty-sub", "default", "brief"],
|
|
["SpecializedRule", "superscript-empty-sub", "brief", "sbrief"],
|
|
[
|
|
"Aliases",
|
|
"superscript-empty-sub",
|
|
"self::superscript",
|
|
'name(children/*[2])="subscript"',
|
|
'name(children/*[2]/children/*[1])="empty"',
|
|
],
|
|
'Rule,square,default,[n] children/*[1]; [t] "al cuadrado",self::superscript,children/*[2],children/*[2][text()=2],name(children/*[1])!="text" or not(name(children/*[1])="text" and (name(../../../punctuated[@role="text"]/..)="stree" or name(..)="stree")),name(children/*[1])!="subscript" or (name(children/*[1])="subscript" and name(children/*[1]/children/*[1])="identifier" and name(children/*[1]/children/*[2])="number" and children/*[1]/children/*[2][@role!="mixed"] and children/*[1]/children/*[2][@role!="othernumber"]),not(@embellished)'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "square", "default", "brief"],
|
|
["SpecializedRule", "square", "default", "sbrief"],
|
|
'Aliases;square;self::superscript;children/*[2];children/*[2][text()=2];@embellished;children/*[1][@role="prefix operator"]'.split(
|
|
";",
|
|
),
|
|
'Rule,cube,default,[n] children/*[1]; [t] "al cubo",self::superscript,children/*[2],children/*[2][text()=3],name(children/*[1])!="text" or not(name(children/*[1])="text" and (name(../../../punctuated[@role="text"]/..)="stree" or name(..)="stree")),name(children/*[1])!="subscript" or (name(children/*[1])="subscript" and name(children/*[1]/children/*[1])="identifier" and name(children/*[1]/children/*[2])="number" and children/*[1]/children/*[2][@role!="mixed"] and children/*[1]/children/*[2][@role!="othernumber"]),not(@embellished)'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "cube", "default", "brief"],
|
|
["SpecializedRule", "cube", "default", "sbrief"],
|
|
'Aliases;cube;self::superscript;children/*[2];children/*[2][text()=3];@embellished;children/*[1][@role="prefix operator"]'.split(
|
|
";",
|
|
),
|
|
'Rule,prime,default,[n] children/*[1]; [n] children/*[2],self::superscript,children/*[2],children/*[2][@role="prime"]'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "prime", "default", "brief"],
|
|
["SpecializedRule", "prime", "default", "sbrief"],
|
|
'Rule,prime-subscript,default,[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptVerbose; [n] children/*[1]/children/*[2],self::superscript,children/*[2][@role="prime"],name(children/*[1])="subscript",not(following-sibling::*)'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"prime-subscript",
|
|
"default",
|
|
"brief",
|
|
"[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptBrief; [n] children/*[1]/children/*[2]",
|
|
],
|
|
["SpecializedRule", "prime-subscript", "brief", "sbrief"],
|
|
'Rule,prime-subscript-baseline,default,[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptVerbose; [n] children/*[1]/children/*[2]; [t] CSFbaselineVerbose,self::superscript,children/*[2][@role="prime"],name(children/*[1])="subscript",following-sibling::*'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"prime-subscript-baseline",
|
|
"default",
|
|
"brief",
|
|
"[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptBrief; [n] children/*[1]/children/*[2]; [t] CSFbaselineBriefS",
|
|
],
|
|
["SpecializedRule", "prime-subscript-baseline", "brief", "sbrief"],
|
|
'Aliases prime-subscript-baseline self::superscript children/*[2][@role="prime"] name(children/*[1])="subscript" not(following-sibling::*) @embellished'.split(
|
|
" ",
|
|
),
|
|
'Rule,overscore,default,[t] "modificando superior"; [n] children/*[1]; [t] "con"; [n] children/*[2],self::overscore,children/*[2][@role="overaccent"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"overscore",
|
|
"default",
|
|
"brief",
|
|
'[t] "mod superior"; [n] children/*[1]; [t] "con"; [n] children/*[2]',
|
|
],
|
|
["SpecializedRule", "overscore", "brief", "sbrief"],
|
|
'Rule,double-overscore,default,[t] "modificando superior superior"; [n] children/*[1]; [t] "con"; [n] children/*[2],self::overscore,children/*[2][@role="overaccent"],name(children/*[1])="overscore",children/*[1]/children/*[2][@role="overaccent"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"double-overscore",
|
|
"default",
|
|
"brief",
|
|
'[t] "mod superior superior"; [n] children/*[1]; [t] "con"; [n] children/*[2]',
|
|
],
|
|
["SpecializedRule", "double-overscore", "brief", "sbrief"],
|
|
'Rule,underscore,default,[t] "modificando inferior"; [n] children/*[1]; [t] "con"; [n] children/*[2],self::underscore,children/*[2][@role="underaccent"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"underscore",
|
|
"default",
|
|
"brief",
|
|
'[t] "mod inferior"; [n] children/*[1]; [t] "con"; [n] children/*[2]',
|
|
],
|
|
["SpecializedRule", "underscore", "brief", "sbrief"],
|
|
'Rule,double-underscore,default,[t] "modificando inferior inferior"; [n] children/*[1]; [t] "con"; [n] children/*[2],self::underscore,children/*[2][@role="underaccent"],name(children/*[1])="underscore",children/*[1]/children/*[2][@role="underaccent"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"double-underscore",
|
|
"default",
|
|
"brief",
|
|
'[t] "mod inferior inferior"; [n] children/*[1]; [t] "con"; [n] children/*[2]',
|
|
],
|
|
["SpecializedRule", "double-underscore", "brief", "sbrief"],
|
|
'Rule,overbar,default,[n] children/*[1]; [t] "barra",self::overscore,@role="latinletter" or @role="greekletter" or @role="otherletter",children/*[2][@role="overaccent"],children/*[2][text()="\u00af" or text()="\uffe3" or text()="\uff3f" or text()="_" or text()="\u203e"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"overbar",
|
|
"default",
|
|
"brief",
|
|
'[n] children/*[1]; [t] "barra"',
|
|
],
|
|
["SpecializedRule", "overbar", "brief", "sbrief"],
|
|
'Rule,underbar,default,[n] children/*[1]; [t] "subbarra",self::underscore,@role="latinletter" or @role="greekletter" or @role="otherletter",children/*[2][@role="underaccent"],children/*[2][text()="\u00af" or text()="\uffe3" or text()="\uff3f" or text()="_" or text()="\u203e"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"underbar",
|
|
"default",
|
|
"brief",
|
|
'[n] children/*[1]; [t] "subbarra"',
|
|
],
|
|
["SpecializedRule", "underbar", "brief", "sbrief"],
|
|
'Rule,overtilde,default,[n] children/*[1]; [t] "tilde",self::overscore,children/*[2][@role="overaccent"],@role="latinletter" or @role="greekletter" or @role="otherletter",children/*[2][text()="~" or text()="\u02dc" or text()="\u223c" or text()="\uff5e"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"overtilde",
|
|
"default",
|
|
"brief",
|
|
'[n] children/*[1]; [t] "tilde"',
|
|
],
|
|
["SpecializedRule", "overtilde", "brief", "sbrief"],
|
|
'Rule,undertilde,default,[n] children/*[1]; [t] "subtilde",self::underscore,@role="latinletter" or @role="greekletter" or @role="otherletter",children/*[2][@role="underaccent"],children/*[2][text()="~" or text()="\u02dc" or text()="\u223c" or text()="\uff5e"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"undertilde",
|
|
"default",
|
|
"brief",
|
|
'[n] children/*[1]; [t] "subtilde"',
|
|
],
|
|
["SpecializedRule", "undertilde", "brief", "sbrief"],
|
|
'Rule,matrix-fence,default,[n] children/*[1];,self::fenced,count(children/*)=1,name(children/*[1])="matrix"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"matrix",
|
|
"default",
|
|
'[t] "empezar matriz"; [t] count(children/*); [t] "por";[t] count(children/*[1]/children/*); [m] children/* (ctxtFunc:CTXFordinalCounter,context:"fila "); [t] "finalizar matriz"',
|
|
"self::matrix",
|
|
],
|
|
[
|
|
"Rule",
|
|
"matrix",
|
|
"sbrief",
|
|
'[t] "matriz"; [t] count(children/*); [t] "por";[t] count(children/*[1]/children/*); [m] children/* (ctxtFunc:CTXFordinalCounter,context:" "); [t] "finalizar matriz"',
|
|
"self::matrix",
|
|
],
|
|
["Aliases", "matrix", "self::vector"],
|
|
[
|
|
"Rule",
|
|
"matrix-row",
|
|
"default",
|
|
'[m] children/* (ctxtFunc:CTXFordinalCounter,context:"columna");[p] (pause: 200)',
|
|
"self::row",
|
|
],
|
|
'Rule{row-with-label{default{[t] "con etiqueta"; [n] content/*[1]; [t] "finalizar etiqueta" (pause: 200); [m] children/* (ctxtFunc:CTXFordinalCounter,context:"columna"){self::row{content'.split(
|
|
"{",
|
|
),
|
|
'Rule{row-with-label{brief{[t] "etiqueta"; [n] content/*[1]; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"columna"){self::row{content'.split(
|
|
"{",
|
|
),
|
|
["SpecializedRule", "row-with-label", "brief", "sbrief"],
|
|
'Rule{row-with-text-label{sbrief{[t] "etiqueta"; [t] CSFRemoveParens;[m] children/* (ctxtFunc:CTXFordinalCounter,context:"columna"){self::row{content{name(content/cell/children/*[1])="text"'.split(
|
|
"{",
|
|
),
|
|
'Rule;empty-row;default;[t] "espacio";self::row;count(children/*)=0'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"matrix-cell",
|
|
"default",
|
|
"[n] children/*[1]; [p] (pause: 300)",
|
|
"self::cell",
|
|
],
|
|
'Rule,empty-cell,default,[t] "espacio"; [p] (pause: 300),self::cell,count(children/*)=0'.split(
|
|
",",
|
|
),
|
|
'Rule{determinant{default{[t] "empezar determinante"; [t] count(children/*); [t] "por";[t] count(children/*[1]/children/*); [m] children/* (ctxtFunc:CTXFordinalCounter,context:"fila "); [t] "finalizar determinante"{self::matrix{@role="determinant"'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"determinant",
|
|
"default",
|
|
"sbrief",
|
|
'[t] "determinante"; [t] count(children/*); [t] "por";[t] count(children/*[1]/children/*); [m] children/* (ctxtFunc:CTXFordinalCounter,context:"fila "); [t] "finalizar determinante"',
|
|
],
|
|
'Rule{determinant-simple{default{[t] "empezar determinante"; [t] count(children/*); [t] "por";[t] count(children/*[1]/children/*); [m] children/* (ctxtFunc:CTXFordinalCounter,context:"fila",grammar:simpleDet); [t] "finalizar determinante"{self::matrix{@role="determinant"{CQFdetIsSimple'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"determinant-simple",
|
|
"default",
|
|
"sbrief",
|
|
'[t] "determinante"; [t] count(children/*); [t] "por";[t] count(children/*[1]/children/*); [m] children/* (ctxtFunc:CTXFordinalCounter,context:"fila",grammar:simpleDet); [t] "finalizar determinante"',
|
|
],
|
|
'Rule{row-simple{default{[m] children/*;{self::row{@role="determinant"{contains(@grammar, "simpleDet")'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"layout",
|
|
"default",
|
|
'[t] "empezar esquema"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"fila "); [t] "finalizar esquema"',
|
|
"self::table",
|
|
],
|
|
[
|
|
"Rule",
|
|
"layout",
|
|
"sbrief",
|
|
'[t] "esquema"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"fila "); [t] "finalizar esquema"',
|
|
"self::table",
|
|
],
|
|
'Rule,binomial,default,[t] "empezar binomial"; [n] children/*[1]/children/*[1]; [t] "en"; [n] children/*[2]/children/*[1]; [t] "finalizar binomial",self::vector,@role="binomial"'.split(
|
|
",",
|
|
),
|
|
'Rule,binomial,sbrief,[t] "binomial"; [n] children/*[1]/children/*[1]; [t] "en"; [n] children/*[2]/children/*[1]; [t] "finalizar binomial",self::vector,@role="binomial"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"cases",
|
|
"default",
|
|
'[t] "empezar esquema"; [n] content/*[1]; [t] "alargada"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"fila "); [t] "finalizar esquema"',
|
|
"self::cases",
|
|
],
|
|
[
|
|
"Rule",
|
|
"cases",
|
|
"sbrief",
|
|
'[t] "esquema"; [n] content/*[1]; [t] "alargada"; [m] children/* (ctxtFunc:CTXFordinalCounter,context:"fila "); [t] "finalizar esquema"',
|
|
"self::cases",
|
|
],
|
|
["Aliases", "layout", "self::multiline"],
|
|
["Rule", "line", "default", "[m] children/*", "self::line"],
|
|
'Rule,line-with-label,default,[t] "con etiqueta"; [n] content/*[1]; [t] "finalizar etiqueta" (pause: 200); [m] children/*,self::line,content'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"line-with-label",
|
|
"default",
|
|
"brief",
|
|
'[t] "etiqueta"; [n] content/*[1] (pause: 200); [m] children/*',
|
|
],
|
|
["SpecializedRule", "line-with-label", "brief", "sbrief"],
|
|
'Rule,line-with-text-label,sbrief,[t] "etiqueta"; [t] CSFRemoveParens; [m] children/*,self::line,content,name(content/cell/children/*[1])="text"'.split(
|
|
",",
|
|
),
|
|
'Rule;empty-line;default;[t] "espacio";self::line;count(children/*)=0;not(content)'.split(
|
|
";",
|
|
),
|
|
["SpecializedRule", "empty-line", "default", "brief"],
|
|
["SpecializedRule", "empty-line", "brief", "sbrief"],
|
|
'Rule,empty-line-with-label,default,[t] "con etiqueta"; [n] content/*[1]; [t] "finalizar etiqueta" (pause: 200); [t] "espacio",self::line,count(children/*)=0,content'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"empty-line-with-label",
|
|
"default",
|
|
"brief",
|
|
'[t] "etiqueta"; [n] content/*[1] (pause: 200); [t] "espacio"',
|
|
],
|
|
["SpecializedRule", "empty-line-with-label", "brief", "sbrief"],
|
|
[
|
|
"Rule",
|
|
"enclose",
|
|
"default",
|
|
'[t] "empezar rodear"; [t] @role (grammar:localEnclose); [n] children/*[1]; [t] "finalizar rodear"',
|
|
"self::enclose",
|
|
],
|
|
["Aliases", "overbar", "self::enclose", '@role="top"'],
|
|
["Aliases", "underbar", "self::enclose", '@role="bottom"'],
|
|
'Rule,leftbar,default,[t] "barra vertical"; [n] children/*[1],self::enclose,@role="left"'.split(
|
|
",",
|
|
),
|
|
'Rule,rightbar,default,[n] children/*[1]; [t] "barra vertical",self::enclose,@role="right"'.split(
|
|
",",
|
|
),
|
|
'Rule,crossout,default,[t] "tachado"; [n] children/*[1]; [t] "finalizar tachado",self::enclose,@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"'.split(
|
|
",",
|
|
),
|
|
'Rule,cancel,default,[t] "tachado"; [n] children/*[1]/children/*[1]; [t] "con"; [n] children/*[2]; [t] "finalizar tachado",self::overscore,@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "cancel", "default", "brief"],
|
|
["SpecializedRule", "cancel", "default", "sbrief"],
|
|
[
|
|
"Aliases",
|
|
"cancel",
|
|
"self::underscore",
|
|
'@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"',
|
|
],
|
|
'Rule,cancel-reverse,default,[t] "tachado"; [n] children/*[2]/children/*[1]; [t] "con"; [n] children/*[1]; [t] "finalizar tachado",self::overscore,name(children/*[2])="enclose",children/*[2][@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"]'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "cancel-reverse", "default", "brief"],
|
|
["SpecializedRule", "cancel-reverse", "default", "sbrief"],
|
|
[
|
|
"Aliases",
|
|
"cancel-reverse",
|
|
"self::underscore",
|
|
'name(children/*[2])="enclose"',
|
|
'children/*[2][@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"]',
|
|
],
|
|
'Rule;end-punct;default;[m] children/*;self::punctuated;@role="endpunct"'.split(
|
|
";",
|
|
),
|
|
'Rule,start-punct,default,[n] content/*[1]; [m] children/*[position()>1],self::punctuated,@role="startpunct"'.split(
|
|
",",
|
|
),
|
|
'Rule,integral-punct,default,[n] children/*[1]; [n] children/*[3],self::punctuated,@role="integral"'.split(
|
|
",",
|
|
),
|
|
["Rule", "punctuated", "default", "[m] children/*", "self::punctuated"],
|
|
'Rule;unit-singular;default;[t] text() (grammar:annotation="unit":translate);self::identifier;@role="unit"'.split(
|
|
";",
|
|
),
|
|
'Rule;unit-plural;default;[t] text() (grammar:annotation="unit":translate:plural);self::identifier;@role="unit";not(contains(@grammar, "singularUnit"))'.split(
|
|
";",
|
|
),
|
|
'Rule,unit-square,default,[n] children/*[1]; [t] "cuadrado",self::superscript,@role="unit",children/*[2][text()=2],name(children/*[1])="identifier"'.split(
|
|
",",
|
|
),
|
|
'Rule,unit-cubic,default,[n] children/*[1]; [t] "c\u00fabico",self::superscript,@role="unit",children/*[2][text()=3],name(children/*[1])="identifier"'.split(
|
|
",",
|
|
),
|
|
'Rule,reciprocal,default,[t] "rec\u00edproco"; [n] children/*[1],self::superscript,@role="unit",name(children/*[1])="identifier",name(children/*[2])="prefixop",children/*[2][@role="negative"],children/*[2]/children/*[1][text()=1],count(preceding-sibling::*)=0 or preceding-sibling::*[@role!="unit"]'.split(
|
|
",",
|
|
),
|
|
'Rule,reciprocal,default,[t] "por"; [n] children/*[1],self::superscript,@role="unit",name(children/*[1])="identifier",name(children/*[2])="prefixop",children/*[2][@role="negative"],children/*[2]/children/*[1][text()=1],preceding-sibling::*[@role="unit"]'.split(
|
|
",",
|
|
),
|
|
'Rule;unit-combine;default;[m] children/* (sepFunc:CTXFunitMultipliers);self::infixop;@role="unit"'.split(
|
|
";",
|
|
),
|
|
'Rule,unit-combine-mult,default,[m] children/* (sepFunc:CTXFunitMultipliers);,self::infixop,@role="multiplication" or @role="implicit",children/*[@role="unit"]'.split(
|
|
",",
|
|
),
|
|
'Rule{unit-combiner-singular{default{[n] children/*[1]; [t] "por"; [m] children/*[position()>1] (grammar:!singularUnit, sepFunc:CTXFunitMultipliers){self::infixop{@role="unit"{name(children/*[1])!="number"{contains(@grammar, "singularUnit"){count(children/*)>1'.split(
|
|
"{",
|
|
),
|
|
'Rule,unit-combine-singular-first,default,[n] children/*[1]; [n] children/*[2] (grammar:singularUnit); [t] "por"; [m] children/*[position()>2] (sepFunc:CTXFunitMultipliers),self::infixop,@role="unit",name(children/*[1])="number",children/*[1][text()=1]'.split(
|
|
",",
|
|
),
|
|
'Rule,unit-combine-singular-first,default,[n] children/*[1]; [n] children/*[2] (grammar:singularUnit); ,self::infixop,@role="unit",name(children/*[1])="number",children/*[1][text()=1],count(children/*)=2'.split(
|
|
",",
|
|
),
|
|
'Rule,unit-divide,default,[n] children/*[1]; [t] "por"; [n] children/*[2] (grammar:singularUnit),self::fraction,@role="unit"'.split(
|
|
",",
|
|
),
|
|
],
|
|
initialize: [sre.MathspeakUtil.generateTensorRules],
|
|
};
|
|
sre.NemethUtil = {};
|
|
sre.NemethUtil.openingFraction = function (a) {
|
|
a = sre.MathspeakUtil.fractionNestingDepth(a);
|
|
return (
|
|
Array(a).join(sre.Messages.MS.FRACTION_REPEAT) +
|
|
sre.Messages.MS.FRACTION_START
|
|
);
|
|
};
|
|
sre.NemethUtil.closingFraction = function (a) {
|
|
a = sre.MathspeakUtil.fractionNestingDepth(a);
|
|
return (
|
|
Array(a).join(sre.Messages.MS.FRACTION_REPEAT) +
|
|
sre.Messages.MS.FRACTION_END
|
|
);
|
|
};
|
|
sre.NemethUtil.overFraction = function (a) {
|
|
a = sre.MathspeakUtil.fractionNestingDepth(a);
|
|
return (
|
|
Array(a).join(sre.Messages.MS.FRACTION_REPEAT) +
|
|
sre.Messages.MS.FRACTION_OVER
|
|
);
|
|
};
|
|
sre.NemethUtil.overBevelledFraction = function (a) {
|
|
a = sre.MathspeakUtil.fractionNestingDepth(a);
|
|
return (
|
|
Array(a).join(sre.Messages.MS.FRACTION_REPEAT) +
|
|
"\u2838" +
|
|
sre.Messages.MS.FRACTION_OVER
|
|
);
|
|
};
|
|
sre.NemethUtil.nestedRadical = function (a, b) {
|
|
a = sre.NemethUtil.radicalNestingDepth(a);
|
|
return 1 === a ? b : Array(a).join(sre.Messages.MS.NESTED) + b;
|
|
};
|
|
sre.NemethUtil.radicalNestingDepth = function (a, b) {
|
|
b = b || 0;
|
|
return a.parentNode
|
|
? sre.NemethUtil.radicalNestingDepth(
|
|
a.parentNode,
|
|
"root" === a.tagName || "sqrt" === a.tagName ? b + 1 : b,
|
|
)
|
|
: b;
|
|
};
|
|
sre.NemethUtil.openingRadical = function (a) {
|
|
return sre.NemethUtil.nestedRadical(a, sre.Messages.MS.STARTROOT);
|
|
};
|
|
sre.NemethUtil.closingRadical = function (a) {
|
|
return sre.NemethUtil.nestedRadical(a, sre.Messages.MS.ENDROOT);
|
|
};
|
|
sre.NemethUtil.indexRadical = function (a) {
|
|
return sre.NemethUtil.nestedRadical(a, sre.Messages.MS.ROOTINDEX);
|
|
};
|
|
sre.NemethUtil.enlargeFence = function (a) {
|
|
if (1 === a.length) return "\u2820" + a;
|
|
var b = a.split("");
|
|
return b.every(function (c) {
|
|
return "\u2833" === c;
|
|
})
|
|
? "\u2820" + b.join("\u2820")
|
|
: a.slice(0, 1) + "\u2820" + a.slice(1);
|
|
};
|
|
sre.Grammar.getInstance().setCorrection(
|
|
"enlargeFence",
|
|
sre.NemethUtil.enlargeFence,
|
|
);
|
|
sre.NemethUtil.NUMBER_PROPAGATORS_ = [
|
|
sre.SemanticAttr.Type.MULTIREL,
|
|
sre.SemanticAttr.Type.RELSEQ,
|
|
sre.SemanticAttr.Type.PUNCTUATED,
|
|
sre.SemanticAttr.Type.APPL,
|
|
];
|
|
sre.NemethUtil.checkParent_ = function (a) {
|
|
a = a.parent;
|
|
if (!a) return !1;
|
|
var b = a.type;
|
|
return -1 !== sre.NemethUtil.NUMBER_PROPAGATORS_.indexOf(b) ||
|
|
(b === sre.SemanticAttr.Type.PREFIXOP &&
|
|
a.role === sre.SemanticAttr.Role.NEGATIVE)
|
|
? !0
|
|
: !1;
|
|
};
|
|
sre.NemethUtil.propagateNumber = function (a, b) {
|
|
if (!a.childNodes.length)
|
|
return (
|
|
sre.NemethUtil.checkParent_(a) && (b.number = !0),
|
|
[b.number ? "number" : "", { number: !1 }]
|
|
);
|
|
sre.NemethUtil.checkParent_(a) && (b.number = !0);
|
|
return ["", b];
|
|
};
|
|
sre.NemethUtil.numberIndicator = function () {
|
|
return new sre.SemanticVisitor("nemeth", sre.NemethUtil.propagateNumber, {
|
|
number: !0,
|
|
});
|
|
};
|
|
sre.NemethUtil.addAnnotators = function () {
|
|
sre.SemanticAnnotations.getInstance().register(
|
|
sre.NemethUtil.numberIndicator(),
|
|
);
|
|
};
|
|
sre.NemethUtil.componentString_ = {
|
|
2: "CSFbaseline",
|
|
1: "CSFsubscript",
|
|
0: "CSFsuperscript",
|
|
};
|
|
sre.NemethUtil.childNumber_ = { 4: 2, 3: 3, 2: 1, 1: 4, 0: 5 };
|
|
sre.NemethUtil.generateTensorRuleStrings_ = function (a) {
|
|
var b = [],
|
|
c = "";
|
|
a = parseInt(a, 2);
|
|
for (var d = 0; 5 > d; d++) {
|
|
var e = "children/*[" + sre.NemethUtil.childNumber_[d] + "]";
|
|
a & 1
|
|
? (c =
|
|
"[t] " +
|
|
sre.NemethUtil.componentString_[d % 3] +
|
|
"Verbose; [n] " +
|
|
e +
|
|
";" +
|
|
c)
|
|
: b.unshift("name(" + e + ')="empty"');
|
|
a >>= 1;
|
|
}
|
|
b.push(c);
|
|
return b;
|
|
};
|
|
sre.NemethUtil.generateTensorRules = function (a) {
|
|
var b = goog.bind(a.defineRule, a);
|
|
a = goog.bind(a.defineRulesAlias, a);
|
|
for (
|
|
var c =
|
|
"11111 11110 11101 11100 10111 10110 10101 10100 01111 01110 01101 01100".split(
|
|
" ",
|
|
),
|
|
d = 0,
|
|
e;
|
|
(e = c[d]);
|
|
d++
|
|
) {
|
|
var f = "tensor" + e;
|
|
e = sre.NemethUtil.generateTensorRuleStrings_(e);
|
|
var g = e.pop(),
|
|
h = [f, "default", g, "self::tensor"].concat(e);
|
|
b.apply(null, h);
|
|
g += "; [t]" + sre.NemethUtil.componentString_[2] + "Verbose";
|
|
f += "-baseline";
|
|
h = [f, "default", g, "self::tensor", "following-sibling::*"].concat(e);
|
|
b.apply(null, h);
|
|
f = [
|
|
f,
|
|
"self::tensor",
|
|
"not(following-sibling::*)",
|
|
"ancestor::fraction|ancestor::punctuated|ancestor::fenced|ancestor::root|ancestor::sqrt|ancestor::relseq|ancestor::multirel|@embellished",
|
|
].concat(e);
|
|
a.apply(null, f);
|
|
}
|
|
};
|
|
sre.NemethRules = {
|
|
locale: "nemeth",
|
|
modality: "braille",
|
|
domain: "default",
|
|
functions: [
|
|
["CQF", "CQFspaceoutNumber", sre.MathspeakUtil.spaceoutNumber],
|
|
["CQF", "CQFspaceoutIdentifier", sre.MathspeakUtil.spaceoutIdentifier],
|
|
["CSF", "CSFspaceoutText", sre.MathspeakUtil.spaceoutText],
|
|
["CSF", "CSFopenFraction", sre.NemethUtil.openingFraction],
|
|
["CSF", "CSFcloseFraction", sre.NemethUtil.closingFraction],
|
|
["CSF", "CSFoverFraction", sre.NemethUtil.overFraction],
|
|
["CSF", "CSFoverBevFraction", sre.NemethUtil.overBevelledFraction],
|
|
["CSF", "CSFopenRadicalVerbose", sre.NemethUtil.openingRadical],
|
|
["CSF", "CSFcloseRadicalVerbose", sre.NemethUtil.closingRadical],
|
|
["CSF", "CSFindexRadicalVerbose", sre.NemethUtil.indexRadical],
|
|
["CSF", "CSFsuperscriptVerbose", sre.MathspeakUtil.superscriptVerbose],
|
|
["CSF", "CSFsubscriptVerbose", sre.MathspeakUtil.subscriptVerbose],
|
|
["CSF", "CSFbaselineVerbose", sre.MathspeakUtil.baselineVerbose],
|
|
["CSF", "CSFunderscript", sre.MathspeakUtil.nestedUnderscore],
|
|
["CSF", "CSFoverscript", sre.MathspeakUtil.nestedOverscore],
|
|
["CTXF", "CTXFordinalCounter", sre.NumbersUtil.ordinalCounter],
|
|
["CTXF", "CTXFcontentIterator", sre.StoreUtil.contentIterator],
|
|
["CQF", "CQFdetIsSimple", sre.MathspeakUtil.determinantIsSimple],
|
|
["CSF", "CSFRemoveParens", sre.MathspeakUtil.removeParens],
|
|
["CQF", "CQFresetNesting", sre.MathspeakUtil.resetNestingDepth],
|
|
],
|
|
rules: [
|
|
"Rule;stree;default;[n] ./*[1];self::stree;CQFresetNesting".split(";"),
|
|
["Rule", "unknown", "default", "[n] text()", "self::unknown"],
|
|
'Rule;protected;default;[t] text();self::*;@role="protected"'.split(";"),
|
|
["Rule", "omit-empty", "default", "[p] (pause:100)", "self::empty"],
|
|
'Rule;blank-empty;default;[t] "\u2800";self::empty;count(../*)=1;name(../..)="cell" or name(../..)="line"'.split(
|
|
";",
|
|
),
|
|
'Rule{font{default{[t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font){self::*{@font{not(contains(@grammar, "ignoreFont")){@font!="normal"'.split(
|
|
"{",
|
|
),
|
|
'Rule{font-identifier-short{default{[t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font){self::identifier{string-length(text())=1{@font{not(contains(@grammar, "ignoreFont")){@font="normal"{""=translate(text(), "abcdefghijklmnopqrstuvwxyz\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9", ""){@role!="unit"'.split(
|
|
"{",
|
|
),
|
|
'Rule{font-identifier{default{[t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font){self::identifier{string-length(text())=1{@font{@font="normal"{not(contains(@grammar, "ignoreFont")){@role!="unit"'.split(
|
|
"{",
|
|
),
|
|
'Rule;omit-font;default;[n] . (grammar:ignoreFont=@font);self::identifier;string-length(text())=1;@font;@role!="greekletter";not(contains(@grammar, "ignoreFont"));@font="italic"'.split(
|
|
";",
|
|
),
|
|
'Rule{number-indicator{default{[t] "\u283c"; [n] text() (pause:10){self::number{contains(@annotation, "nemeth:number"){not(ancestor::sqrt){not(ancestor::root){not(ancestor::fraction)'.split(
|
|
"{",
|
|
),
|
|
["Rule", "number", "default", "[n] text()", "self::number"],
|
|
'Rule,mixed-number,default,[n] children/*[1]; [t] "\u2838\u2839"; [n] children/*[2]/children/*[1]; [t] "\u280c"; [n] children/*[2]/children/*[2]; [t] "\u2838\u283c",self::number,@role="mixed"'.split(
|
|
",",
|
|
),
|
|
'Rule{number-with-chars{default{[t] "\u283c"; [m] CQFspaceoutNumber{self::number{"" != translate(text(), "0123456789.,", ""){text() != translate(text(), "0123456789.,", "")'.split(
|
|
"{",
|
|
),
|
|
'Rule{number-as-upper-word{default{[t] "UpperWord"; [t] CSFspaceoutText{self::number{string-length(text())>1{text()=translate(text(), "abcdefghijklmnopqrstuvwxyz\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9", "ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9"){""=translate(text(), "ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9","")'.split(
|
|
"{",
|
|
),
|
|
'Rule{number-baseline{default{[t] "\u2810"; [n] text(){self::number{not(contains(@grammar, "ignoreFont")){preceding-sibling::identifier{preceding-sibling::*[1][@role="latinletter" or @role="greekletter" or @role="otherletter"]{parent::*/parent::infixop[@role="implicit"]'.split(
|
|
"{",
|
|
),
|
|
'Rule{number-baseline-font{default{[t] "\u2810"; [t] @font; [n] . (grammar:ignoreFont=@font){self::number{@font{not(contains(@grammar, "ignoreFont")){@font!="normal"{preceding-sibling::identifier{preceding-sibling::*[@role="latinletter" or @role="greekletter" or @role="otherletter"]{parent::*/parent::infixop[@role="implicit"]'.split(
|
|
"{",
|
|
),
|
|
'Rule;identifier;default;[n] text();self::identifier;@role="protected"'.split(
|
|
";",
|
|
),
|
|
'Rule,negative,default,[t] "\u2824"; [n] children/*[1],self::prefixop,@role="negative"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"prefix",
|
|
"default",
|
|
"[n] text(); [n] children/*[1]",
|
|
"self::prefixop",
|
|
],
|
|
[
|
|
"Rule",
|
|
"postfix",
|
|
"default",
|
|
"[n] children/*[1]; [n] text()",
|
|
"self::postfixop",
|
|
],
|
|
[
|
|
"Rule",
|
|
"binary-operation",
|
|
"default",
|
|
"[m] children/* (sepFunc:CTXFcontentIterator);",
|
|
"self::infixop",
|
|
],
|
|
'Rule;implicit;default;[m] children/*;self::infixop;@role="implicit"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"implicit",
|
|
"self::infixop",
|
|
'@role="leftsuper" or @role="leftsub" or @role="rightsuper" or @role="rightsub"',
|
|
],
|
|
[
|
|
"Rule",
|
|
"function-named",
|
|
"default",
|
|
'[n] children/*[1]; [t] "\u2800"; [n] children/*[2]',
|
|
"self::appl",
|
|
],
|
|
'Rule,function-prefix,default,[n] content/*[1]; [t] "\u2800"; [n] children/*[1],self::prefixop,content/*[1][@role="infix function"]'.split(
|
|
",",
|
|
),
|
|
'Rule,function-infix,default,[n] children/*[1]; [n] content/*[1]; [t] "\u2800"; [n] children/*[2],self::infixop,@role="infix function"'.split(
|
|
",",
|
|
),
|
|
'Rule,function-simple,default,[n] children/*[1]; [n] children/*[2],self::appl,children/*[1][@role="simple function"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"fences-open-close",
|
|
"default",
|
|
"[n] content/*[1]; [n] children/*[1]; [n] content/*[2]",
|
|
"self::fenced",
|
|
],
|
|
'Rule,fences-neutral,default,[n] content/*[1]; [n] children/*[1]; [n] content/*[2],self::fenced,@role="neutral"'.split(
|
|
",",
|
|
),
|
|
["Rule", "text", "default", "[n] text()", "self::text"],
|
|
'Rule;factorial;default;[t] "\u282f";self::punctuation;text()="!";name(preceding-sibling::*[1])!="text"'.split(
|
|
";",
|
|
),
|
|
'Rule;single-prime;default;[t] "\u2804";self::punctuated;@role="prime";count(children/*)=1'.split(
|
|
";",
|
|
),
|
|
'Rule;double-prime;default;[t] "\u2804\u2804";self::punctuated;@role="prime";count(children/*)=2'.split(
|
|
";",
|
|
),
|
|
'Rule;triple-prime;default;[t] "\u2804\u2804\u2804";self::punctuated;@role="prime";count(children/*)=3'.split(
|
|
";",
|
|
),
|
|
'Rule;quadruple-prime;default;[t] "\u2804\u2804\u2804\u2804";self::punctuated;@role="prime";count(children/*)=4'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"default",
|
|
"[t] CSFopenFraction; [n] children/*[1]; [t] CSFoverFraction; [n] children/*[2]; [t] CSFcloseFraction",
|
|
"self::fraction",
|
|
],
|
|
'Rule{bevelled-fraction{default{[t] CSFopenFraction; [n] children/*[1]; [t] CSFoverBevFraction; [n] children/*[2]; [t] CSFcloseFraction{self::fraction{contains(@annotation, "general:bevelled")'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"sqrt",
|
|
"default",
|
|
"[t] CSFopenRadicalVerbose; [n] children/*[1]; [t] CSFcloseRadicalVerbose",
|
|
"self::sqrt",
|
|
],
|
|
[
|
|
"Rule",
|
|
"root",
|
|
"default",
|
|
'[t] CSFindexRadicalVerbose; [n] children/*[1];[t] "\u281c"; [n] children/*[2]; [t] CSFcloseRadicalVerbose',
|
|
"self::root",
|
|
],
|
|
'Rule,limboth,default,[t] "\u2810"; [n] children/*[1]; [t] CSFunderscript; [n] children/*[2];[t] CSFoverscript; [n] children/*[3],self::limboth,name(../..)="underscore" or name(../..)="overscore",following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(
|
|
",",
|
|
),
|
|
'Rule,limlower,default,[t] "\u2810"; [n] children/*[1]; [t] CSFunderscript; [n] children/*[2];,self::limlower,name(../..)="underscore" or name(../..)="overscore",following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(
|
|
",",
|
|
),
|
|
'Rule,limupper,default,[t] "\u2810"; [n] children/*[1]; [t] CSFoverscript; [n] children/*[2];,self::limupper,name(../..)="underscore" or name(../..)="overscore",following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(
|
|
",",
|
|
),
|
|
'Aliases;limlower;self::underscore;@role="limit function";name(../..)="underscore" or name(../..)="overscore";following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(
|
|
";",
|
|
),
|
|
'Aliases;limlower;self::underscore;children/*[2][@role!="underaccent"];name(../..)="underscore" or name(../..)="overscore";following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(
|
|
";",
|
|
),
|
|
'Aliases;limupper;self::overscore;children/*[2][@role!="overaccent"];name(../..)="underscore" or name(../..)="overscore";following-sibling::*[@role!="underaccent" and @role!="overaccent"]'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"limboth-end",
|
|
"default",
|
|
'[t] "\u2810"; [n] children/*[1]; [t] CSFunderscript; [n] children/*[2];[t] CSFoverscript; [n] children/*[3]; [t] "\u283b"',
|
|
"self::limboth",
|
|
],
|
|
[
|
|
"Rule",
|
|
"limlower-end",
|
|
"default",
|
|
'[t] "\u2810"; [n] children/*[1]; [t] CSFunderscript; [n] children/*[2]; [t] "\u283b"',
|
|
"self::limlower",
|
|
],
|
|
[
|
|
"Rule",
|
|
"limupper-end",
|
|
"default",
|
|
'[t] "\u2810"; [n] children/*[1]; [t] CSFoverscript; [n] children/*[2]; [t] "\u283b"',
|
|
"self::limupper",
|
|
],
|
|
["Aliases", "limlower-end", "self::underscore", '@role="limit function"'],
|
|
["Aliases", "limlower-end", "self::underscore"],
|
|
["Aliases", "limupper-end", "self::overscore"],
|
|
[
|
|
"Rule",
|
|
"integral",
|
|
"default",
|
|
"[n] children/*[1]; [n] children/*[2]; [n] children/*[3];",
|
|
"self::integral",
|
|
],
|
|
'Rule,integral,default,[n] children/*[1]; [t] "\u2830"; [n] children/*[2];[t] "\u2818"; [n] children/*[3]; [t] "\u2810",self::limboth,@role="integral"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"bigop",
|
|
"default",
|
|
"[n] children/*[1]; [n] children/*[2];",
|
|
"self::bigop",
|
|
],
|
|
[
|
|
"Rule",
|
|
"relseq",
|
|
"default",
|
|
"[m] children/* (sepFunc:CTXFcontentIterator)",
|
|
"self::relseq",
|
|
],
|
|
'Rule,equality,default,[n] children/*[1]; [n] content/*[1]; [n] children/*[2],self::relseq,@role="equality",count(./children/*)=2'.split(
|
|
",",
|
|
),
|
|
'Rule;multi-equality;default;[m] children/* (sepFunc:CTXFcontentIterator);self::relseq;@role="equality";count(./children/*)>2'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"multrel",
|
|
"default",
|
|
"[m] children/* (sepFunc:CTXFcontentIterator)",
|
|
"self::multirel",
|
|
],
|
|
[
|
|
"Rule",
|
|
"subscript",
|
|
"default",
|
|
"[n] children/*[1]; [t] CSFsubscriptVerbose; [n] children/*[2]",
|
|
"self::subscript",
|
|
],
|
|
'Rule,subscript-simple,default,[n] children/*[1]; [n] children/*[2],self::subscript,name(./children/*[1])="identifier",name(./children/*[2])="number",./children/*[2][@role!="mixed"],./children/*[2][@role!="othernumber"],self::*'.split(
|
|
",",
|
|
),
|
|
'Rule,subscript-baseline,default,[n] children/*[1]; [t] CSFsubscriptVerbose; [n] children/*[2]; [t] CSFbaselineVerbose,self::subscript,following-sibling::*,@role!="prefix function",not(name(following-sibling::subscript/children/*[1])="empty" or (name(following-sibling::infixop[@role="implicit"]/children/*[1])="subscript" and name(following-sibling::*/children/*[1]/children/*[1])="empty")) and @role!="subsup",not(following-sibling::*[@role="rightsuper" or @role="rightsub" or @role="leftsub" or @role="leftsub"])'.split(
|
|
",",
|
|
),
|
|
'Aliases;subscript-baseline;self::subscript;not(following-sibling::*);ancestor::fenced|ancestor::root|ancestor::sqrt|ancestor::punctuated|ancestor::fraction;not(ancestor::punctuated[@role="leftsuper" or @role="rightsub" or @role="rightsuper" or @role="rightsub"])'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"subscript-baseline",
|
|
"self::subscript",
|
|
"not(following-sibling::*)",
|
|
"ancestor::relseq|ancestor::multirel",
|
|
sre.MathspeakUtil.generateBaselineConstraint(),
|
|
],
|
|
[
|
|
"Aliases",
|
|
"subscript-baseline",
|
|
"self::subscript",
|
|
"not(following-sibling::*)",
|
|
"@embellished",
|
|
],
|
|
'Rule,subscript-empty-sup,default,[n] children/*[1]; [n] children/*[2],self::subscript,name(children/*[2])="infixop",name(children/*[2][@role="implicit"]/children/*[1])="superscript",name(children/*[2]/children/*[1]/children/*[1])="empty"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"subscript-empty-sup",
|
|
"self::subscript",
|
|
'name(children/*[2])="superscript"',
|
|
'name(children/*[2]/children/*[1])="empty"',
|
|
],
|
|
[
|
|
"Rule",
|
|
"superscript",
|
|
"default",
|
|
"[n] children/*[1]; [t] CSFsuperscriptVerbose; [n] children/*[2]",
|
|
"self::superscript",
|
|
],
|
|
'Rule,superscript-baseline,default,[n] children/*[1]; [t] CSFsuperscriptVerbose; [n] children/*[2];[t] CSFbaselineVerbose,self::superscript,following-sibling::*,@role!="prefix function",not(name(following-sibling::superscript/children/*[1])="empty" or (name(following-sibling::infixop[@role="implicit"]/children/*[1])="superscript" and name(following-sibling::*/children/*[1]/children/*[1])="empty")) and not(following-sibling::*[@role="rightsuper" or @role="rightsub" or @role="leftsub" or @role="leftsub"])'.split(
|
|
",",
|
|
),
|
|
'Aliases;superscript-baseline;self::superscript;not(following-sibling::*);ancestor::punctuated;ancestor::*/following-sibling::* and not(ancestor::punctuated[@role="leftsuper" or @role="rightsub" or @role="rightsuper" or @role="rightsub"])'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"superscript-baseline",
|
|
"self::superscript",
|
|
"not(following-sibling::*)",
|
|
"ancestor::fraction|ancestor::fenced|ancestor::root|ancestor::sqrt",
|
|
],
|
|
[
|
|
"Aliases",
|
|
"superscript-baseline",
|
|
"self::superscript",
|
|
"not(following-sibling::*)",
|
|
"ancestor::relseq|ancestor::multirel",
|
|
"not(@embellished)",
|
|
sre.MathspeakUtil.generateBaselineConstraint(),
|
|
],
|
|
'Aliases superscript-baseline self::superscript not(following-sibling::*) @embellished not(children/*[2][@role="prime"])'.split(
|
|
" ",
|
|
),
|
|
'Rule,superscript-empty-sub,default,[n] children/*[1]; [n] children/*[2],self::superscript,name(children/*[2])="infixop",name(children/*[2][@role="implicit"]/children/*[1])="subscript",name(children/*[2]/children/*[1]/children/*[1])="empty"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"superscript-empty-sub",
|
|
"self::superscript",
|
|
'name(children/*[2])="subscript"',
|
|
'name(children/*[2]/children/*[1])="empty"',
|
|
],
|
|
'Rule,prime,default,[n] children/*[1]; [n] children/*[2],self::superscript,children/*[2],children/*[2][@role="prime"]'.split(
|
|
",",
|
|
),
|
|
'Rule,prime-subscript,default,[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptVerbose; [n] children/*[1]/children/*[2],self::superscript,children/*[2][@role="prime"],name(children/*[1])="subscript",not(following-sibling::*)'.split(
|
|
",",
|
|
),
|
|
'Rule,prime-subscript-baseline,default,[n] children/*[1]/children/*[1]; [n] children/*[2]; [t] CSFsubscriptVerbose; [n] children/*[1]/children/*[2]; [t] CSFbaselineVerbose,self::superscript,children/*[2][@role="prime"],name(children/*[1])="subscript",following-sibling::*'.split(
|
|
",",
|
|
),
|
|
'Aliases prime-subscript-baseline self::superscript children/*[2][@role="prime"] name(children/*[1])="subscript" not(following-sibling::*) @embellished'.split(
|
|
" ",
|
|
),
|
|
'Rule,prime-subscript-simple,default,[n] children/*[1]/children/*[1]; [n] children/*[2];[n] children/*[1]/children/*[2],self::superscript,children/*[2][@role="prime"],name(children/*[1])="subscript",name(children/*[1]/children/*[1])="identifier",name(children/*[1]/children/*[2])="number",children/*[1]/children/*[2][@role!="mixed"],children/*[1]/children/*[2][@role!="othernumber"]'.split(
|
|
",",
|
|
),
|
|
'Rule,overscore,default,[t] "\u2810"; [n] children/*[1]; [t] "\u2823"; [n] children/*[2]; [t] "\u283b",self::overscore,children/*[2][@role="overaccent"]'.split(
|
|
",",
|
|
),
|
|
'Rule{overscore{default{[n] children/*[1]; [t] "\u2823"; [n] children/*[2]{self::overscore{children/*[2][@role="overaccent"]{contains(@grammar, "modified")'.split(
|
|
"{",
|
|
),
|
|
'Rule,double-overscore,default,[t] "\u2810"; [n] children/*[1] (grammar:"modified"); [t] "\u2823"; [n] children/*[2]; [t] "\u283b",self::overscore,children/*[2][@role="overaccent"],name(children/*[1])="overscore",children/*[1]/children/*[2][@role="overaccent"]'.split(
|
|
",",
|
|
),
|
|
'Rule,underscore,default,[t] "\u2810"; [n] children/*[1]; [t] "\u2829"; [n] children/*[2]; [t] "\u283b",self::underscore,children/*[2][@role="underaccent"]'.split(
|
|
",",
|
|
),
|
|
'Rule{underscore{default{[n] children/*[1]; [t] "\u2829"; [n] children/*[2]{self::underscore{children/*[2][@role="underaccent"]{contains(@grammar, "modified")'.split(
|
|
"{",
|
|
),
|
|
'Rule,double-underscore,default,[t] "\u2810"; [n] children/*[1] (grammar:"modified"); [t] "\u2829"; [n] children/*[2]; [t] "\u283b",self::underscore,children/*[2][@role="underaccent"],name(children/*[1])="underscore",children/*[1]/children/*[2][@role="underaccent"]'.split(
|
|
",",
|
|
),
|
|
'Rule,matrix-fence,default,[n] children/*[1];,self::fenced,count(children/*)=1,name(children/*[1])="matrix"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"matrix",
|
|
"default",
|
|
'[m] children/* (separator:"\u2800", join:"");',
|
|
"self::matrix",
|
|
],
|
|
["Aliases", "matrix", "self::vector"],
|
|
[
|
|
"Rule",
|
|
"matrix-row",
|
|
"default",
|
|
'[n] ../../content/*[1] (grammar:enlargeFence); [m] children/* (separator:"\u2800"); [n] ../../content/*[2] (grammar:enlargeFence); ',
|
|
"self::row",
|
|
],
|
|
["Aliases", "matrix-row", "self::line", '@role="vector"'],
|
|
["Aliases", "matrix-row", "self::line", '@role="binomial"'],
|
|
'Rule{row-with-label{default{[t] "with Label"; [n] content/*[1]; [t] "EndLabel"(pause: 200); [m] children/* (ctxtFunc:CTXFordinalCounter,context:"Column"){self::row{content'.split(
|
|
"{",
|
|
),
|
|
'Rule;empty-row;default;[t] "\u2800" (pause:300);self::row;count(children/*)=0'.split(
|
|
";",
|
|
),
|
|
["Rule", "matrix-cell", "default", "[n] children/*[1]", "self::cell"],
|
|
'Rule;empty-cell;default;[t] "\u2800" (pause: 300);self::cell;count(children/*)=0'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"layout",
|
|
"default",
|
|
'[m] children/* (separator:"\u2800", join:"");',
|
|
"self::table",
|
|
],
|
|
[
|
|
"Rule",
|
|
"cases",
|
|
"default",
|
|
'[n] ../../content/*[1] (grammar:enlargeFence); [m] children/* (separator:"\u2800"); [t] "\u2810"',
|
|
"self::cases",
|
|
],
|
|
["Aliases", "layout", "self::multiline"],
|
|
["Rule", "line", "default", "[m] children/*", "self::line"],
|
|
'Rule,line-with-label,default,[t] "with Label"; [n] content/*[1]; [t] "EndLabel" (pause: 200); [m] children/*,self::line,content'.split(
|
|
",",
|
|
),
|
|
'Rule;empty-line;default;[t] "\u2800";self::line;count(children/*)=0;not(content)'.split(
|
|
";",
|
|
),
|
|
'Rule,empty-line-with-label,default,[t] "with Label"; [n] content/*[1]; [t] "EndLabel"(pause: 200); [t] "Blank",self::line,count(children/*)=0,content'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"enclose",
|
|
"default",
|
|
'[t] "StartEnclose"; [t] @role (grammar:localEnclose); [n] children/*[1]; [t] "EndEnclose"',
|
|
"self::enclose",
|
|
],
|
|
'Rule,overbar,default,[t] "\u2810"; [n] children/*[1]; [t] "\u2823\u2831\u283b",self::enclose,@role="top"'.split(
|
|
",",
|
|
),
|
|
'Rule,underbar,default,[t] "\u2810"; [n] children/*[1]; [t] "\u2829\u2831\u283b",self::enclose,@role="bottom"'.split(
|
|
",",
|
|
),
|
|
'Rule,leftbar,default,[t] "\u2833"; [n] children/*[1],self::enclose,@role="left"'.split(
|
|
",",
|
|
),
|
|
'Rule,rightbar,default,[n] children/*[1]; [t] "\u2833",self::enclose,@role="right"'.split(
|
|
",",
|
|
),
|
|
'Rule,crossout,default,[t] "\u282a"; [n] children/*[1]; [t] "\u283b",self::enclose,@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"'.split(
|
|
",",
|
|
),
|
|
'Rule,cancel,default,[t] "\u282a"; [n] children/*[1]/children/*[1]; [t] "\u282a"; [n] children/*[2]; [t] "\u283b",self::overscore,@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"cancel",
|
|
"self::underscore",
|
|
'@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"',
|
|
],
|
|
'Rule,cancel-reverse,default,[t] "\u282a"; [n] children/*[2]/children/*[1]; [t] "\u282a"; [n] children/*[1]; [t] "\u283b",self::overscore,name(children/*[2])="enclose",children/*[2][@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"cancel-reverse",
|
|
"self::underscore",
|
|
'name(children/*[2])="enclose"',
|
|
'children/*[2][@role="updiagonalstrike" or @role="downdiagonalstrike" or @role="horizontalstrike"]',
|
|
],
|
|
'Rule;end-punct;default;[m] children/*;self::punctuated;@role="endpunct"'.split(
|
|
";",
|
|
),
|
|
'Rule,start-punct,default,[n] content/*[1]; [m] children/*[position()>1],self::punctuated,@role="startpunct"'.split(
|
|
",",
|
|
),
|
|
'Rule{punctuation{default{[n] text(); [t] "\u2810"{self::punctuation{@role="fullstop"{contains(@annotation, "nemeth:number")'.split(
|
|
"{",
|
|
),
|
|
'Rule,integral-punct,default,[n] children/*[1]; [n] children/*[3],self::punctuated,@role="integral"'.split(
|
|
",",
|
|
),
|
|
["Rule", "punctuated", "default", "[m] children/*", "self::punctuated"],
|
|
'Rule,punctuation-comma,default,[n] text(); [t] "\u2800",self::punctuation,parent::*/parent::punctuated,following-sibling::*,@role!="fullstop",@role!="vbar"'.split(
|
|
",",
|
|
),
|
|
'Rule,punctuation-ellipses,default,[t] "\u2800"; [n] text(); [t] "\u2800",self::punctuation,parent::*/parent::punctuated,following-sibling::*,@role="ellipsis",name(preceding-sibling::*[1])!="punctuation"'.split(
|
|
",",
|
|
),
|
|
'Rule,punctuation-ellipses,default,[t] "\u2800"; [n] text();,self::punctuation,parent::*/parent::punctuated,@role="ellipsis",name(preceding-sibling::*[1])!="punctuation"'.split(
|
|
",",
|
|
),
|
|
'Rule,reference-sign,default,[n] children/*[1]; [n] children/*[2],self::superscript,name(children/*[1])="text" or (name(children/*[1])="punctuated" and children/*[1][@role="text"]),name(children/*[2])="operator" or name(children/*[2])="punctuation"'.split(
|
|
",",
|
|
),
|
|
'Rule,reference-number,default,[n] children/*[1]; [t] "\u2808\u283b"; [n] children/*[2]; [t] "\u2810",self::superscript,name(children/*[1])="text" or (name(children/*[1])="punctuated" and children/*[1][@role="text"]),name(children/*[2])="number",children/*[2][@role="integer"]'.split(
|
|
",",
|
|
),
|
|
],
|
|
initialize: [
|
|
sre.NemethUtil.generateTensorRules,
|
|
sre.NemethUtil.addAnnotators,
|
|
],
|
|
};
|
|
sre.PrefixFrench = {
|
|
locale: "fr",
|
|
modality: "prefix",
|
|
domain: "default",
|
|
functions: [["CSF", "CSFordinalPosition", sre.NumbersUtil.ordinalPosition]],
|
|
rules: [
|
|
'Rule,numerator,default,[t] "num\u00e9rateur"; [p] (pause:200),self::*,name(../..)="fraction",count(preceding-sibling::*)=0'.split(
|
|
",",
|
|
),
|
|
'Rule,denominator,default,[t] "d\u00e9nominateur"; [p] (pause:200),self::*,name(../..)="fraction",count(preceding-sibling::*)=1'.split(
|
|
",",
|
|
),
|
|
'Rule,base,default,[t] "base"; [p] (pause:200),self::*,name(../..)="superscript" or name(../..)="subscript" or name(../..)="overscore" or name(../..)="underscore" or name(../..)="tensor" or name(../..)="limlower" or name(../..)="limupper",count(preceding-sibling::*)=0'.split(
|
|
",",
|
|
),
|
|
'Rule,base-limit,default,[t] "base"; [p] (pause:200),self::*,name(../..)="limboth"'.split(
|
|
",",
|
|
),
|
|
'Rule,exponent,default,[t] "exposant"; [p] (pause:200),self::*,name(../..)="superscript",count(preceding-sibling::*)=1'.split(
|
|
",",
|
|
),
|
|
'Rule,subscript,default,[t] "indice"; [p] (pause:200),self::*,name(../..)="subscript",count(preceding-sibling::*)=1'.split(
|
|
",",
|
|
),
|
|
'Rule,overscript,default,[t] "indice suscrit"; [p] (pause:200),self::*,name(../..)="overscore" or name(../..)="limupper" or name(../..)="limboth",count(preceding-sibling::*)=1 or count(preceding-sibling::*)=2'.split(
|
|
",",
|
|
),
|
|
'Rule,underscript,default,[t] "indice souscrit"; [p] (pause:200),self::*,name(../..)="underscore" or name(../..)="limlower" or name(../..)="limboth",count(preceding-sibling::*)=1'.split(
|
|
",",
|
|
),
|
|
'Rule,radicand,default,[t] "radicande"; [p] (pause:200),self::*,name(../..)="sqrt"'.split(
|
|
",",
|
|
),
|
|
'Rule,radicand,default,[t] "radicande"; [p] (pause:200),self::*,name(../..)="root",count(preceding-sibling::*)=1'.split(
|
|
",",
|
|
),
|
|
'Rule,index,default,[t] "indice"; [p] (pause:200),self::*,name(../..)="root",count(preceding-sibling::*)=0'.split(
|
|
",",
|
|
),
|
|
'Rule,leftsub,default,[t] "indice inf\u00e9rieur gauche"; [p] (pause:200),self::*,name(../..)="tensor",@role="leftsub"'.split(
|
|
",",
|
|
),
|
|
'Rule,leftsub,default,[t] CSFordinalPosition (grammar:gender="male"); [t] "indice inf\u00e9rieur gauche"; [p] (pause:200),self::*,name(../..)="punctuated",name(../../../..)="tensor",../../@role="leftsub"'.split(
|
|
",",
|
|
),
|
|
'Rule,leftsuper,default,[t] "indice sup\u00e9rieur gauche"; [p] (pause:200),self::*,name(../..)="tensor",@role="leftsuper"'.split(
|
|
",",
|
|
),
|
|
'Rule,leftsuper,default,[t] CSFordinalPosition (grammar:gender="male"); [t] "indice sup\u00e9rieur gauche"; [p] (pause:200),self::*,name(../..)="punctuated",name(../../../..)="tensor",../../@role="leftsuper"'.split(
|
|
",",
|
|
),
|
|
'Rule,rightsub,default,[t] "indice inf\u00e9rieur droite"; [p] (pause:200),self::*,name(../..)="tensor",@role="rightsub"'.split(
|
|
",",
|
|
),
|
|
'Rule,rightsub,default,[t] CSFordinalPosition (grammar:gender="male"); [t] "indice inf\u00e9rieur droite"; [p] (pause:200),self::*,name(../..)="punctuated",name(../../../..)="tensor",../../@role="rightsub"'.split(
|
|
",",
|
|
),
|
|
'Rule,rightsuper,default,[t] "indice sup\u00e9rieur droite"; [p] (pause:200),self::*,name(../..)="tensor",@role="rightsuper"'.split(
|
|
",",
|
|
),
|
|
'Rule,rightsuper,default,[t] CSFordinalPosition (grammar:gender="male"); [t] "indice sup\u00e9rieur droite"; [p] (pause:200),self::*,name(../..)="punctuated",name(../../../..)="tensor",../../@role="rightsuper"'.split(
|
|
",",
|
|
),
|
|
'Rule,choice,default,[t] "nombre d\'\u00e9l\u00e9ments choisis"; [p] (pause:200),self::line,@role="binomial",parent::*/parent::vector,count(preceding-sibling::*)=1'.split(
|
|
",",
|
|
),
|
|
'Rule,select,default,[t] "nombre d\'\u00e9l\u00e9ments disponibles"; [p] (pause:200),self::line,@role="binomial",parent::*/parent::vector,count(preceding-sibling::*)=0'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"row",
|
|
"default",
|
|
'[t] CSFordinalPosition (grammar:gender="female"); [t] "rang\u00e9e"; [p] (pause:200)',
|
|
"self::row",
|
|
],
|
|
["Aliases", "row", "self::line"],
|
|
'Rule{cell{default{[n] ../..; [t] CSFordinalPosition (grammar:gender="female"); [t] "colonne"; [p] (pause:200){self::cell{contains(@grammar,"depth")'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"cell",
|
|
"default",
|
|
'[t] CSFordinalPosition (grammar:gender="female"); [t] "colonne"; [p] (pause:200)',
|
|
"self::cell",
|
|
],
|
|
],
|
|
};
|
|
sre.PrefixGerman = {
|
|
modality: "prefix",
|
|
locale: "de",
|
|
domain: "default",
|
|
functions: [["CSF", "CSFordinalPosition", sre.NumbersUtil.ordinalPosition]],
|
|
rules: [
|
|
'Rule,numerator,default,[t] "Z\u00e4hler"; [p] (pause:200),self::*,name(../..)="fraction",count(preceding-sibling::*)=0'.split(
|
|
",",
|
|
),
|
|
'Rule,denominator,default,[t] "Nenner"; [p] (pause:200),self::*,name(../..)="fraction",count(preceding-sibling::*)=1'.split(
|
|
",",
|
|
),
|
|
'Rule,base,default,[t] "Basis"; [p] (pause:200),self::*,name(../..)="superscript" or name(../..)="subscript" or name(../..)="overscore" or name(../..)="underscore" or name(../..)="tensor",count(preceding-sibling::*)=0'.split(
|
|
",",
|
|
),
|
|
'Rule,exponent,default,[t] "Exponent"; [p] (pause:200),self::*,name(../..)="superscript",count(preceding-sibling::*)=1'.split(
|
|
",",
|
|
),
|
|
'Rule,subscript,default,[t] "Index"; [p] (pause:200),self::*,name(../..)="subscript",count(preceding-sibling::*)=1'.split(
|
|
",",
|
|
),
|
|
'Rule,overscript,default,[t] "Oberer Grenzwert"; [p] (pause:200),self::*,name(../..)="overscore",count(preceding-sibling::*)=1'.split(
|
|
",",
|
|
),
|
|
'Rule,underscript,default,[t] "Unterer Grenzwert"; [p] (pause:200),self::*,name(../..)="underscore",count(preceding-sibling::*)=1'.split(
|
|
",",
|
|
),
|
|
'Rule,radicand,default,[t] "Radikand"; [p] (pause:200),self::*,name(../..)="sqrt"'.split(
|
|
",",
|
|
),
|
|
'Rule,radicand,default,[t] "Radikand"; [p] (pause:200),self::*,name(../..)="root",count(preceding-sibling::*)=1'.split(
|
|
",",
|
|
),
|
|
'Rule,index,default,[t] "Wurzelexponent"; [p] (pause:200),self::*,name(../..)="root",count(preceding-sibling::*)=0'.split(
|
|
",",
|
|
),
|
|
'Rule,leftsub,default,[t] "linker unterer Index"; [p] (pause:200),self::*,name(../..)="tensor",@role="leftsub"'.split(
|
|
",",
|
|
),
|
|
'Rule,leftsub,default,[t] CSFordinalPosition; [t] "linker unterer Index"; [p] (pause:200),self::*,name(../..)="punctuated",name(../../../..)="tensor",../../@role="leftsub"'.split(
|
|
",",
|
|
),
|
|
'Rule,leftsuper,default,[t] "linker oberer Index"; [p] (pause:200),self::*,name(../..)="tensor",@role="leftsuper"'.split(
|
|
",",
|
|
),
|
|
'Rule,leftsuper,default,[t] CSFordinalPosition; [t] "linker oberer Index"; [p] (pause:200),self::*,name(../..)="punctuated",name(../../../..)="tensor",../../@role="leftsuper"'.split(
|
|
",",
|
|
),
|
|
'Rule,rightsub,default,[t] "rechter unterer Index"; [p] (pause:200),self::*,name(../..)="tensor",@role="rightsub"'.split(
|
|
",",
|
|
),
|
|
'Rule,rightsub,default,[t] CSFordinalPosition; [t] "rechter unterer Index"; [p] (pause:200),self::*,name(../..)="punctuated",name(../../../..)="tensor",../../@role="rightsub"'.split(
|
|
",",
|
|
),
|
|
'Rule,rightsuper,default,[t] "rechter oberer Index"; [p] (pause:200),self::*,name(../..)="tensor",@role="rightsuper"'.split(
|
|
",",
|
|
),
|
|
'Rule,rightsuper,default,[t] CSFordinalPosition; [t] "rechter oberer Index"; [p] (pause:200),self::*,name(../..)="punctuated",name(../../../..)="tensor",../../@role="rightsuper"'.split(
|
|
",",
|
|
),
|
|
'Rule,choice,default,[t] "Grundgesamtheit"; [p] (pause:200),self::line,@role="binomial",parent::*/parent::vector,count(preceding-sibling::*)=0'.split(
|
|
",",
|
|
),
|
|
'Rule,select,default,[t] "Stichprobengr\u00f6\u00dfe"; [p] (pause:200),self::line,@role="binomial",parent::*/parent::vector,count(preceding-sibling::*)=1'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"row",
|
|
"default",
|
|
'[t] CSFordinalPosition; [t] "Zeile"; [p] (pause:200)',
|
|
"self::row",
|
|
],
|
|
["Aliases", "row", "self::line"],
|
|
'Rule{cell{default{[n] ../..; [t] CSFordinalPosition; [t] "Spalte"; [p] (pause:200){self::cell{contains(@grammar,"depth")'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"cell",
|
|
"default",
|
|
'[t] CSFordinalPosition; [t] "Spalte"; [p] (pause:200)',
|
|
"self::cell",
|
|
],
|
|
],
|
|
};
|
|
sre.PrefixRules = {
|
|
modality: "prefix",
|
|
domain: "default",
|
|
functions: [["CSF", "CSFordinalPosition", sre.NumbersUtil.ordinalPosition]],
|
|
rules: [
|
|
'Rule,numerator,default,[t] "Numerator"; [p] (pause:200),self::*,name(../..)="fraction",count(preceding-sibling::*)=0'.split(
|
|
",",
|
|
),
|
|
'Rule,denominator,default,[t] "Denominator"; [p] (pause:200),self::*,name(../..)="fraction",count(preceding-sibling::*)=1'.split(
|
|
",",
|
|
),
|
|
'Rule,base,default,[t] "Base"; [p] (pause:200),self::*,name(../..)="superscript" or name(../..)="subscript" or name(../..)="overscore" or name(../..)="underscore" or name(../..)="tensor",count(preceding-sibling::*)=0'.split(
|
|
",",
|
|
),
|
|
'Rule,exponent,default,[t] "Exponent"; [p] (pause:200),self::*,name(../..)="superscript",count(preceding-sibling::*)=1'.split(
|
|
",",
|
|
),
|
|
'Rule,subscript,default,[t] "Subscript"; [p] (pause:200),self::*,name(../..)="subscript",count(preceding-sibling::*)=1'.split(
|
|
",",
|
|
),
|
|
'Rule,overscript,default,[t] "Overscript"; [p] (pause:200),self::*,name(../..)="overscore",count(preceding-sibling::*)=1'.split(
|
|
",",
|
|
),
|
|
'Rule,underscript,default,[t] "Underscript"; [p] (pause:200),self::*,name(../..)="underscore",count(preceding-sibling::*)=1'.split(
|
|
",",
|
|
),
|
|
'Rule,radicand,default,[t] "Radicand"; [p] (pause:200),self::*,name(../..)="sqrt"'.split(
|
|
",",
|
|
),
|
|
'Rule,radicand,default,[t] "Radicand"; [p] (pause:200),self::*,name(../..)="root",count(preceding-sibling::*)=1'.split(
|
|
",",
|
|
),
|
|
'Rule,index,default,[t] "Index"; [p] (pause:200),self::*,name(../..)="root",count(preceding-sibling::*)=0'.split(
|
|
",",
|
|
),
|
|
'Rule,leftsub,default,[t] "Left Subscript"; [p] (pause:200),self::*,name(../..)="tensor",@role="leftsub"'.split(
|
|
",",
|
|
),
|
|
'Rule,leftsub,default,[t] CSFordinalPosition; [t] "Left Subscript"; [p] (pause:200),self::*,name(../..)="punctuated",name(../../../..)="tensor",../../@role="leftsub"'.split(
|
|
",",
|
|
),
|
|
'Rule,leftsuper,default,[t] "Left Superscript"; [p] (pause:200),self::*,name(../..)="tensor",@role="leftsuper"'.split(
|
|
",",
|
|
),
|
|
'Rule,leftsuper,default,[t] CSFordinalPosition; [t] "Left Superscript"; [p] (pause:200),self::*,name(../..)="punctuated",name(../../../..)="tensor",../../@role="leftsuper"'.split(
|
|
",",
|
|
),
|
|
'Rule,rightsub,default,[t] "Right Subscript"; [p] (pause:200),self::*,name(../..)="tensor",@role="rightsub"'.split(
|
|
",",
|
|
),
|
|
'Rule,rightsub,default,[t] CSFordinalPosition; [t] "Right Subscript"; [p] (pause:200),self::*,name(../..)="punctuated",name(../../../..)="tensor",../../@role="rightsub"'.split(
|
|
",",
|
|
),
|
|
'Rule,rightsuper,default,[t] "Right Superscript"; [p] (pause:200),self::*,name(../..)="tensor",@role="rightsuper"'.split(
|
|
",",
|
|
),
|
|
'Rule,rightsuper,default,[t] CSFordinalPosition; [t] "Right Superscript"; [p] (pause:200),self::*,name(../..)="punctuated",name(../../../..)="tensor",../../@role="rightsuper"'.split(
|
|
",",
|
|
),
|
|
'Rule,choice,default,[t] "Choice Quantity"; [p] (pause:200),self::line,@role="binomial",parent::*/parent::vector,count(preceding-sibling::*)=0'.split(
|
|
",",
|
|
),
|
|
'Rule,select,default,[t] "Selection Quantity"; [p] (pause:200),self::line,@role="binomial",parent::*/parent::vector,count(preceding-sibling::*)=1'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"row",
|
|
"default",
|
|
'[t] CSFordinalPosition; [t] "Row"; [p] (pause:200)',
|
|
"self::row",
|
|
],
|
|
["Aliases", "row", "self::line"],
|
|
'Rule{cell{default{[n] ../..; [t] CSFordinalPosition; [t] "Column"; [p] (pause:200){self::cell{contains(@grammar,"depth")'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"cell",
|
|
"default",
|
|
'[t] CSFordinalPosition; [t] "Column"; [p] (pause:200)',
|
|
"self::cell",
|
|
],
|
|
],
|
|
};
|
|
sre.PrefixSpanish = {
|
|
locale: "es",
|
|
modality: "prefix",
|
|
domain: "default",
|
|
functions: [["CSF", "CSFordinalPosition", sre.NumbersUtil.ordinalPosition]],
|
|
rules: [
|
|
'Rule,numerator,default,[t] "numerador"; [p] (pause:200),self::*,name(../..)="fraction",count(preceding-sibling::*)=0'.split(
|
|
",",
|
|
),
|
|
'Rule,denominator,default,[t] "denominador"; [p] (pause:200),self::*,name(../..)="fraction",count(preceding-sibling::*)=1'.split(
|
|
",",
|
|
),
|
|
'Rule,base,default,[t] "base"; [p] (pause:200),self::*,name(../..)="superscript" or name(../..)="subscript" or name(../..)="overscore" or name(../..)="underscore" or name(../..)="tensor",count(preceding-sibling::*)=0'.split(
|
|
",",
|
|
),
|
|
'Rule,exponent,default,[t] "exponente"; [p] (pause:200),self::*,name(../..)="superscript",count(preceding-sibling::*)=1'.split(
|
|
",",
|
|
),
|
|
'Rule,subscript,default,[t] "sub\u00edndice"; [p] (pause:200),self::*,name(../..)="subscript",count(preceding-sibling::*)=1'.split(
|
|
",",
|
|
),
|
|
'Rule,overscript,default,[t] "sobre\u00edndice"; [p] (pause:200),self::*,name(../..)="overscore",count(preceding-sibling::*)=1'.split(
|
|
",",
|
|
),
|
|
'Rule,underscript,default,[t] "bajo\u00edndice"; [p] (pause:200),self::*,name(../..)="underscore",count(preceding-sibling::*)=1'.split(
|
|
",",
|
|
),
|
|
'Rule,radicand,default,[t] "radicand"; [p] (pause:200),self::*,name(../..)="sqrt"'.split(
|
|
",",
|
|
),
|
|
'Rule,radicand,default,[t] "radicand"; [p] (pause:200),self::*,name(../..)="root",count(preceding-sibling::*)=1'.split(
|
|
",",
|
|
),
|
|
'Rule,index,default,[t] "\u00edndice"; [p] (pause:200),self::*,name(../..)="root",count(preceding-sibling::*)=0'.split(
|
|
",",
|
|
),
|
|
'Rule,leftsub,default,[t] "sub\u00edndice izquierdo"; [p] (pause:200),self::*,name(../..)="tensor",@role="leftsub"'.split(
|
|
",",
|
|
),
|
|
'Rule,leftsub,default,[t] CSFordinalPosition (grammar:gender="male"); [t] "sub\u00edndice izquierdo"; [p] (pause:200),self::*,name(../..)="punctuated",name(../../../..)="tensor",../../@role="leftsub"'.split(
|
|
",",
|
|
),
|
|
'Rule,leftsuper,default,[t] "super\u00edndice izquierdo"; [p] (pause:200),self::*,name(../..)="tensor",@role="leftsuper"'.split(
|
|
",",
|
|
),
|
|
'Rule,leftsuper,default,[t] CSFordinalPosition (grammar:gender="male"); [t] "super\u00edndice izquierdo"; [p] (pause:200),self::*,name(../..)="punctuated",name(../../../..)="tensor",../../@role="leftsuper"'.split(
|
|
",",
|
|
),
|
|
'Rule,rightsub,default,[t] "sub\u00edndice derecho"; [p] (pause:200),self::*,name(../..)="tensor",@role="rightsub"'.split(
|
|
",",
|
|
),
|
|
'Rule,rightsub,default,[t] CSFordinalPosition (grammar:gender="male"); [t] "sub\u00edndice derecho"; [p] (pause:200),self::*,name(../..)="punctuated",name(../../../..)="tensor",../../@role="rightsub"'.split(
|
|
",",
|
|
),
|
|
'Rule,rightsuper,default,[t] "super\u00edndice derecho"; [p] (pause:200),self::*,name(../..)="tensor",@role="rightsuper"'.split(
|
|
",",
|
|
),
|
|
'Rule,rightsuper,default,[t] CSFordinalPosition (grammar:gender="male"); [t] "super\u00edndice derecho"; [p] (pause:200),self::*,name(../..)="punctuated",name(../../../..)="tensor",../../@role="rightsuper"'.split(
|
|
",",
|
|
),
|
|
'Rule,choice,default,[t] "cantidad de elecci\u00f3n"; [p] (pause:200),self::line,@role="binomial",parent::*/parent::vector,count(preceding-sibling::*)=0'.split(
|
|
",",
|
|
),
|
|
'Rule,select,default,[t] "cantidad de selecci\u00f3n"; [p] (pause:200),self::line,@role="binomial",parent::*/parent::vector,count(preceding-sibling::*)=1'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"row",
|
|
"default",
|
|
'[t] CSFordinalPosition (grammar:gender="female"); [t] "fila"; [p] (pause:200)',
|
|
"self::row",
|
|
],
|
|
["Aliases", "row", "self::line"],
|
|
'Rule{cell{default{[n] ../..; [t] CSFordinalPosition (grammar:gender="female"); [t] "columna"; [p] (pause:200){self::cell{contains(@grammar,"depth")'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"cell",
|
|
"default",
|
|
'[t] CSFordinalPosition (grammar:gender="female"); [t] "columna"; [p] (pause:200)',
|
|
"self::cell",
|
|
],
|
|
],
|
|
};
|
|
sre.SemanticTreeRules = {
|
|
domain: "default",
|
|
functions: [
|
|
["CTXF", "CTXFnodeCounter", sre.StoreUtil.nodeCounter],
|
|
["CTXF", "CTXFcontentIterator", sre.StoreUtil.contentIterator],
|
|
],
|
|
rules: [
|
|
'Rule{collapsed{default{[t] "collapsed"; [n] . (engine:modality=summary,grammar:collapsed){self::*{@alternative{not(contains(@grammar, "collapsed")){self::*{self::*{self::*{self::*{self::*'.split(
|
|
"{",
|
|
),
|
|
["Rule", "stree", "default", "[n] ./*[1]", "self::stree"],
|
|
'Rule;factorial;default;[t] "factorial";self::punctuation;text()="!";name(preceding-sibling::*[1])!="text"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"multrel",
|
|
"default",
|
|
'[t] "multirelation"; [m] children/* (sepFunc:CTXFcontentIterator)',
|
|
"self::multirel",
|
|
],
|
|
'Rule{variable-equality{default{[t] "equation sequence"; [m] children/* (context:"part",ctxtFunc:CTXFnodeCounter,sepFunc:CTXFcontentIterator){self::relseq[@role="equality"]{count(./children/*)>2{./children/punctuation[@role="ellipsis"]'.split(
|
|
"{",
|
|
),
|
|
'Rule{multi-equality{default{[t] "equation sequence"; [m] children/* (context:"part",ctxtFunc:CTXFnodeCounter,sepFunc:CTXFcontentIterator){self::relseq[@role="equality"]{count(./children/*)>2'.split(
|
|
"{",
|
|
),
|
|
'Rule,equality,default,[n] children/*[1]; [p] (pause:200); [n] content/*[1] (pause:200);[n] children/*[2],self::relseq[@role="equality"],count(./children/*)=2'.split(
|
|
",",
|
|
),
|
|
'Rule,simple-equality,default,[n] children/*[1]; [p] (pause:200); [n] content/*[1] (pause:200);[n] children/*[2],self::relseq[@role="equality"],count(./children/*)=2,./children/identifier or ./children/number'.split(
|
|
",",
|
|
),
|
|
'Rule,simple-equality2,default,[n] children/*[1]; [p] (pause:200); [n] content/*[1] (pause:200);[n] children/*[2],self::relseq[@role="equality"],count(./children/*)=2,./children/function or ./children/appl'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"relseq",
|
|
"default",
|
|
"[m] children/* (sepFunc:CTXFcontentIterator)",
|
|
"self::relseq",
|
|
],
|
|
[
|
|
"Rule",
|
|
"binary-operation",
|
|
"default",
|
|
"[m] children/* (sepFunc:CTXFcontentIterator);",
|
|
"self::infixop",
|
|
],
|
|
'Rule,variable-addition,default,[t] "sum with variable number of summands";[p] (pause:400); [m] children/* (sepFunc:CTXFcontentIterator),self::infixop[@role="addition"],count(children/*)>2,children/punctuation[@role="ellipsis"]'.split(
|
|
",",
|
|
),
|
|
'Rule,multi-addition,default,[t] "sum with"; [t] count(./children/*); [t] "summands";[p] (pause:400); [m] children/* (sepFunc:CTXFcontentIterator),self::infixop[@role="addition"],count(./children/*)>2'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"prefix",
|
|
"default",
|
|
'[t] "prefix"; [m] content/* (pause 150);[n] children/*[1]',
|
|
"self::prefixop",
|
|
],
|
|
'Rule,negative,default,[t] "negative"; [n] children/*[1],self::prefixop,self::prefixop[@role="negative"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"postfix",
|
|
"default",
|
|
'[n] children/*[1]; [t] "postfix"; [m] content/* (pause 300)',
|
|
"self::postfixop",
|
|
],
|
|
["Rule", "identifier", "default", "[n] text()", "self::identifier"],
|
|
["Rule", "number", "default", "[n] text()", "self::number"],
|
|
'Rule,mixed-number,default,[n] children/*[1]; [t] "and"; [n] children/*[2]; ,self::number,@role="mixed"'.split(
|
|
",",
|
|
),
|
|
'Rule{font{default{[t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font){self::*{@font{not(contains(@grammar, "ignoreFont")){@font!="normal"'.split(
|
|
"{",
|
|
),
|
|
'Rule{font-identifier-short{default{[t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font){self::identifier{string-length(text())=1{@font{not(contains(@grammar, "ignoreFont")){@font="normal"{""=translate(text(), "abcdefghijklmnopqrstuvwxyz\u03b1\u03b2\u03b3\u03b4\u03b5\u03b6\u03b7\u03b8\u03b9\u03ba\u03bb\u03bc\u03bd\u03be\u03bf\u03c0\u03c1\u03c2\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03c9ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039a\u039b\u039c\u039d\u039e\u039f\u03a0\u03a1\u03a3\u03a3\u03a4\u03a5\u03a6\u03a7\u03a8\u03a9", ""){@role!="unit"'.split(
|
|
"{",
|
|
),
|
|
'Rule{font-identifier{default{[t] @font (grammar:localFont); [n] . (grammar:ignoreFont=@font){self::identifier{string-length(text())=1{@font{@font="normal"{not(contains(@grammar, "ignoreFont")){@role!="unit"'.split(
|
|
"{",
|
|
),
|
|
'Rule;omit-font;default;[n] . (grammar:ignoreFont=@font);self::identifier;string-length(text())=1;@font;not(contains(@grammar, "ignoreFont"));@font="italic"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"fraction",
|
|
"default",
|
|
'[p] (pause:250); [n] children/*[1] (rate:0.35); [p] (pause:250); [t] "divided by"; [n] children/*[2] (rate:-0.35); [p] (pause:400)',
|
|
"self::fraction",
|
|
],
|
|
[
|
|
"Rule",
|
|
"superscript",
|
|
"default",
|
|
'[n] children/*[1]; [t] "super"; [n] children/*[2] (pitch:0.35);[p] (pause:300)',
|
|
"self::superscript",
|
|
],
|
|
[
|
|
"Rule",
|
|
"subscript",
|
|
"default",
|
|
'[n] children/*[1]; [t] "sub"; [n] children/*[2] (pitch:-0.35);[p] (pause:300)',
|
|
"self::subscript",
|
|
],
|
|
'Rule,ellipsis,default,[p] (pause:200); [t] "ellipsis"; [p] (pause:300),self::punctuation,self::punctuation[@role="ellipsis"]'.split(
|
|
",",
|
|
),
|
|
'Rule;fence-single;default;[n] text();self::punctuation;self::punctuation[@role="openfence"]'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Aliases",
|
|
"fence-single",
|
|
"self::punctuation",
|
|
'self::punctuation[@role="closefence"]',
|
|
],
|
|
[
|
|
"Aliases",
|
|
"fence-single",
|
|
"self::punctuation",
|
|
'self::punctuation[@role="vbar"]',
|
|
],
|
|
[
|
|
"Aliases",
|
|
"fence-single",
|
|
"self::punctuation",
|
|
'self::punctuation[@role="application"]',
|
|
],
|
|
["Rule", "omit-empty", "default", "[p] (pause:100)", "self::empty"],
|
|
'Rule,fences-open-close,default,[p] (pause:100); [n] content/*[1]; [n] children/*[1]; [n] content/*[2]; [p] (pause:100),self::fenced,@role="leftright"'.split(
|
|
",",
|
|
),
|
|
'Rule,fences-open-close-in-appl,default,[p] (pause:200); [n] children/*[1]; [p] (pause:200);,self::fenced[@role="leftright"],./parent::children/parent::appl'.split(
|
|
",",
|
|
),
|
|
'Rule,fences-neutral,default,[p] (pause:100); [t] "absolute value of"; [n] children/*[1];[p] (pause:350);,self::fenced,self::fenced[@role="neutral"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"omit-fences",
|
|
"default",
|
|
"[p] (pause:500); [n] children/*[1]; [p] (pause:200);",
|
|
"self::fenced",
|
|
],
|
|
[
|
|
"Rule",
|
|
"matrix",
|
|
"default",
|
|
'[t] "matrix"; [m] children/* (ctxtFunc:CTXFnodeCounter,context:"row",pause:100)',
|
|
"self::matrix",
|
|
],
|
|
[
|
|
"Rule",
|
|
"matrix-row",
|
|
"default",
|
|
'[m] children/* (ctxtFunc:CTXFnodeCounter,context:"column",pause:100)',
|
|
'self::row[@role="matrix"]',
|
|
],
|
|
[
|
|
"Rule",
|
|
"matrix-cell",
|
|
"default",
|
|
"[n] children/*[1]",
|
|
'self::cell[@role="matrix"]',
|
|
],
|
|
[
|
|
"Rule",
|
|
"vector",
|
|
"default",
|
|
'[t] "vector"; [m] children/* (ctxtFunc:CTXFnodeCounter,context:"element",pause:100)',
|
|
"self::vector",
|
|
],
|
|
[
|
|
"Rule",
|
|
"cases",
|
|
"default",
|
|
'[t] "case statement"; [m] children/* (ctxtFunc:CTXFnodeCounter,context:"case",pause:100)',
|
|
"self::cases",
|
|
],
|
|
[
|
|
"Rule",
|
|
"cases-row",
|
|
"default",
|
|
"[m] children/*",
|
|
'self::row[@role="cases"]',
|
|
],
|
|
[
|
|
"Rule",
|
|
"cases-cell",
|
|
"default",
|
|
"[n] children/*[1]",
|
|
'self::cell[@role="cases"]',
|
|
],
|
|
[
|
|
"Rule",
|
|
"row",
|
|
"default",
|
|
'[m] ./* (ctxtFunc:CTXFnodeCounter,context:"column",pause:100)',
|
|
"self::row",
|
|
],
|
|
'Rule{cases-end{default{[t] "case statement"; [m] children/* (ctxtFunc:CTXFnodeCounter,context:"case",pause:100);[t] "end cases"{self::cases{following-sibling::*'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"multiline",
|
|
"default",
|
|
'[t] "multiline equation";[m] children/* (ctxtFunc:CTXFnodeCounter,context:"line",pause:100)',
|
|
"self::multiline",
|
|
],
|
|
'Rule{multiline-ineq{default{[t] "multiline inequality";[m] children/* (ctxtFunc:CTXFnodeCounter,context:"row",pause:100){self::multiline{@role="inequality"'.split(
|
|
"{",
|
|
),
|
|
["Rule", "line", "default", "[m] children/*", "self::line"],
|
|
[
|
|
"Rule",
|
|
"table",
|
|
"default",
|
|
'[t] "multiline equation";[m] children/* (ctxtFunc:CTXFnodeCounter,context:"row",pause:200)',
|
|
"self::table",
|
|
],
|
|
'Rule{table-ineq{default{[t] "multiline inequality";[m] children/* (ctxtFunc:CTXFnodeCounter,context:"row",pause:200){self::table{@role="inequality"'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"table-row",
|
|
"default",
|
|
"[m] children/* (pause:100)",
|
|
'self::row[@role="table"]',
|
|
],
|
|
["Aliases", "cases-cell", 'self::cell[@role="table"]'],
|
|
'Rule;empty-cell;default;[t] "Blank";self::cell;count(children/*)=0'.split(
|
|
";",
|
|
),
|
|
'Rule,end-punct,default,[m] children/*; [p] (pause:300),self::punctuated,@role="endpunct"'.split(
|
|
",",
|
|
),
|
|
'Rule,start-punct,default,[n] content/*[1]; [p] (pause:200); [m] children/*[position()>1],self::punctuated,@role="startpunct"'.split(
|
|
",",
|
|
),
|
|
'Rule,integral-punct,default,[n] children/*[1] (rate:0.2); [n] children/*[3] (rate:0.2),self::punctuated,@role="integral"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"punctuated",
|
|
"default",
|
|
"[m] children/* (pause:100)",
|
|
"self::punctuated",
|
|
],
|
|
["Rule", "function", "default", "[n] text()", "self::function"],
|
|
[
|
|
"Rule",
|
|
"appl",
|
|
"default",
|
|
"[n] children/*[1]; [n] content/*[1]; [n] children/*[2]",
|
|
"self::appl",
|
|
],
|
|
'Rule,sum-only,default,[n] children/*[1]; [t] "from"; [n] children/*[2]; [t] "to";[n] children/*[3],self::limboth,self::limboth[@role="sum"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"limboth",
|
|
"default",
|
|
'[n] children/*[1]; [p] (pause 100); [t] "over"; [n] children/*[2];[t] "under"; [n] children/*[3]; [p] (pause 250);',
|
|
"self::limboth",
|
|
],
|
|
[
|
|
"Rule",
|
|
"limlower",
|
|
"default",
|
|
'[n] children/*[1]; [t] "over"; [n] children/*[2];',
|
|
"self::limlower",
|
|
],
|
|
[
|
|
"Rule",
|
|
"limupper",
|
|
"default",
|
|
'[n] children/*[1]; [t] "under"; [n] children/*[2];',
|
|
"self::limupper",
|
|
],
|
|
["Rule", "largeop", "default", "[n] text()", "self::largeop"],
|
|
[
|
|
"Rule",
|
|
"bigop",
|
|
"default",
|
|
'[n] children/*[1]; [p] (pause 100); [t] "over"; [n] children/*[2];[p] (pause 250);',
|
|
"self::bigop",
|
|
],
|
|
[
|
|
"Rule",
|
|
"integral",
|
|
"default",
|
|
"[n] children/*[1]; [p] (pause 100); [n] children/*[2];[p] (pause 200); [n] children/*[3] (rate:0.35);",
|
|
"self::integral",
|
|
],
|
|
[
|
|
"Rule",
|
|
"sqrt",
|
|
"default",
|
|
'[t] "Square root of"; [n] children/*[1] (rate:0.35); [p] (pause:400)',
|
|
"self::sqrt",
|
|
],
|
|
'Rule,square,default,[n] children/*[1]; [t] "squared" (pitch:0.35); [p] (pause:300),self::superscript,children/*[2][text()=2],name(./children/*[1])!="text"'.split(
|
|
",",
|
|
),
|
|
'Rule,cube,default,[n] children/*[1]; [t] "cubed" (pitch:0.35); [p] (pause:300),self::superscript,children/*[2][text()=3],name(./children/*[1])!="text"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"root",
|
|
"default",
|
|
'[t] "root of order"; [n] children/*[1];[t] "over"; [n] children/*[2] (rate:0.35); [p] (pause:400)',
|
|
"self::root",
|
|
],
|
|
["Rule", "text", "default", "[n] text(); [p] (pause:200)", "self::text"],
|
|
'Rule;unit;default;[t] text() (grammar:annotation="unit":translate:plural);self::identifier;@role="unit"'.split(
|
|
";",
|
|
),
|
|
'Rule,unit-square,default,[t] "square"; [n] children/*[1],self::superscript,@role="unit",children/*[2][text()=2],name(children/*[1])="identifier"'.split(
|
|
",",
|
|
),
|
|
'Rule,unit-cubic,default,[t] "cubic"; [n] children/*[1],self::superscript,@role="unit",children/*[2][text()=3],name(children/*[1])="identifier"'.split(
|
|
",",
|
|
),
|
|
'Rule,reciprocal,default,[t] "reciprocal"; [n] children/*[1],self::superscript,@role="unit",name(children/*[1])="identifier",name(children/*[2])="prefixop",children/*[2][@role="negative"],children/*[2]/children/*[1][text()=1],count(preceding-sibling::*)=0 or preceding-sibling::*[@role!="unit"]'.split(
|
|
",",
|
|
),
|
|
'Rule,reciprocal,default,[t] "per"; [n] children/*[1],self::superscript,@role="unit",name(children/*[1])="identifier",name(children/*[2])="prefixop",children/*[2][@role="negative"],children/*[2]/children/*[1][text()=1],preceding-sibling::*[@role="unit"]'.split(
|
|
",",
|
|
),
|
|
'Rule;unit-combine;default;[m] children/*;self::infixop;@role="unit"'.split(
|
|
";",
|
|
),
|
|
'Rule,unit-divide,default,[n] children/*[1] (pitch:0.3); [t] "per"; [n] children/*[2] (pitch:-0.3),self::fraction,@role="unit"'.split(
|
|
",",
|
|
),
|
|
],
|
|
};
|
|
sre.SummaryFrench = {
|
|
locale: "fr",
|
|
modality: "summary",
|
|
rules: [
|
|
[
|
|
"Rule",
|
|
"collapsed-masculine",
|
|
"default.masculine",
|
|
'[t] "compress\u00e9"',
|
|
'contains(@grammar, "collapsed")',
|
|
],
|
|
[
|
|
"Rule",
|
|
"collapsed-feminine",
|
|
"default.feminine",
|
|
'[t] "compress\u00e9e"',
|
|
'contains(@grammar, "collapsed")',
|
|
],
|
|
[
|
|
"Rule",
|
|
"no-collapsed",
|
|
"default.masculine",
|
|
'[t] ""',
|
|
'not(contains(@grammar, "collapsed"))',
|
|
],
|
|
[
|
|
"Rule",
|
|
"no-collapsed",
|
|
"default.feminine",
|
|
'[t] ""',
|
|
'not(contains(@grammar, "collapsed"))',
|
|
],
|
|
["Rule", "stree", "default.default", "[n] ./*[1]", "self::stree"],
|
|
'Rule{abstr-identifier{default.default{[t] "identifiant long"; [n] . (engine:style=masculine){self::identifier{contains(@grammar, "collapsed")'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-identifier",
|
|
"default.default",
|
|
'[t] "identifiant"; [n] . (engine:style=masculine)',
|
|
"self::identifier",
|
|
],
|
|
'Rule{abstr-number{default.default{[t] "nombre long"; [n] . (engine:style=masculine){self::number{contains(@grammar, "collapsed")'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-number",
|
|
"default.default",
|
|
'[t] "nombre"; [n] . (engine:style=masculine)',
|
|
"self::number",
|
|
],
|
|
'Rule{abstr-mixed-number{default.default{[t] "nombre fractionnaire long"; [n] . (engine:style=masculine){self::number{@role="mixed"{contains(@grammar, "collapsed")'.split(
|
|
"{",
|
|
),
|
|
'Rule,abstr-mixed-number,default.default,[t] "nombre fractionnaire"; [n] . (engine:style=masculine),self::number,@role="mixed"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-text",
|
|
"default.default",
|
|
'[t] "texte"; [n] . (engine:style=masculine)',
|
|
"self::text",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-function",
|
|
"default.default",
|
|
'[t] "expression fonctionnelle"; [n] . (engine:style=feminine)',
|
|
"self::function",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-function",
|
|
"mathspeak.brief",
|
|
'[t] "fonction"; [n] . (engine:style=feminine)',
|
|
"self::function",
|
|
],
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-function",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule,abstr-lim,default.default,[t] "fonction de limitation"; [n] . (engine:style=feminine),self::function,@role="limit function"'.split(
|
|
",",
|
|
),
|
|
'Rule,abstr-lim,mathspeak.brief,[t] "lim"; [n] . (engine:style=feminine),self::function,@role="limit function"'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "abstr-lim", "mathspeak.brief", "mathspeak.sbrief"],
|
|
[
|
|
"Rule",
|
|
"abstr-fraction",
|
|
"default.default",
|
|
'[t] "fraction"; [n] . (engine:style=feminine)',
|
|
"self::fraction",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-fraction",
|
|
"mathspeak.brief",
|
|
'[t] "frac"; [n] . (engine:style=feminine)',
|
|
"self::fraction",
|
|
],
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-fraction",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule,abstr-continued-fraction,default.default,[t] "fraction continue"; [n] . (engine:style=feminine),self::fraction,children/*[2]/descendant-or-self::*[@role="ellipsis"]'.split(
|
|
",",
|
|
),
|
|
'Rule,abstr-continued-fraction,mathspeak.brief,[t] "frac continue"; [n] . (engine:style=feminine),self::fraction,children/*[2]/descendant-or-self::*[@role="ellipsis"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-continued-fraction",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-sqrt",
|
|
"default.default",
|
|
'[t] "racine carr\u00e9e"; [n] . (engine:style=feminine)',
|
|
"self::sqrt",
|
|
],
|
|
'Rule,abstr-sqrt-nested,default.default,[t] "racine carr\u00e9e imbriqu\u00e9e"; [n] . (engine:style=feminine),self::sqrt,children/*/descendant-or-self::sqrt or children/*/descendant-or-self::root'.split(
|
|
",",
|
|
),
|
|
'Rule{abstr-root{default.default{[t] "racine d\'indice"; [n] children/*[1] (engine:modality="speech"); [t] "fin indice"; [n] . (engine:style=feminine);{self::root{contains(@grammar, "collapsed"){following-sibling::* or ancestor::*/following-sibling::*'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-root",
|
|
"default.default",
|
|
'[t] "racine d\'indice"; [n] children/*[1] (engine:modality=speech); [n] . (engine:style=feminine)',
|
|
"self::root",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-root",
|
|
"mathspeak.brief",
|
|
'[t] "racine"; [n] . (engine:style=feminine)',
|
|
"self::root",
|
|
],
|
|
["SpecializedRule", "abstr-root", "mathspeak.brief", "mathspeak.sbrief"],
|
|
'Rule{abstr-root-nested{default.default{[t] "racine imbriqu\u00e9e d\'indice"; [n] children/*[1] (engine:modality=speech); [t] "fin indice"; [n] . (engine:style=feminine);{self::root{contains(@grammar, "collapsed"){children/*/descendant-or-self::sqrt or children/*/descendant-or-self::root{following-sibling::* or ancestor::*/following-sibling::*'.split(
|
|
"{",
|
|
),
|
|
'Rule,abstr-root-nested,default.default,[t] "racine imbriqu\u00e9e d\'indice"; [n] children/*[1] (engine:modality=speech); [n] . (engine:style=feminine),self::root,children/*/descendant-or-self::sqrt or children/*/descendant-or-self::root'.split(
|
|
",",
|
|
),
|
|
'Rule,abstr-root-nested,mathspeak.brief,[t] "racine imbriqu\u00e9e"; [n] . (engine:style=feminine),self::root,children/*/descendant-or-self::sqrt or children/*/descendant-or-self::root'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-root-nested",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-superscript",
|
|
"default.default",
|
|
'[t] "puissance"; [n] . (engine:style=feminine)',
|
|
"self::superscript",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-subscript",
|
|
"default.default",
|
|
'[t] "indice"; [n] . (engine:style=masculine)',
|
|
"self::subscript",
|
|
],
|
|
'Rule,abstr-subsup,default.default,[t] "puissance avec index"; [n] . (engine:style=feminine),self::superscript,name(children/*[1])="subscript"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-infixop",
|
|
"default.default",
|
|
'[t] @role (grammar:localRole); [t] "avec"; [t] count(./children/*); [t] "\u00e9l\u00e9ments"; [n] . (engine:style=masculine)',
|
|
"self::infixop",
|
|
],
|
|
'Rule,abstr-infixop,default.default,[t] @role (grammar:localRole); [t] "avec un nombre d\'\u00e9l\u00e9ments variable"; [n] . (engine:style=masculine),self::infixop,count(./children/*)>2,./children/punctuation[@role="ellipsis"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-infixop",
|
|
"mathspeak.brief",
|
|
"[t] @role (grammar:localRole); [n] . (engine:style=masculine)",
|
|
"self::infixop",
|
|
],
|
|
["SpecializedRule", "abstr-infixop", "mathspeak.brief", "mathspeak.sbrief"],
|
|
'Rule,abstr-addition,default.default,[t] "somme avec"; [t] count(./children/*); [t] "op\u00e9randes"; [n] . (engine:style=feminine),self::infixop,@role="addition"'.split(
|
|
",",
|
|
),
|
|
'Rule,abstr-addition,mathspeak.brief,[t] "somme"; [n] . (engine:style=feminine),self::infixop,@role="addition"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-addition",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule,abstr-var-addition,default.default,[t] "somme avec un nombre variable d\'op\u00e9randes"; [n] . (engine:style=feminine),self::infixop,@role="addition",count(./children/*)>2,./children/punctuation[@role="ellipsis"]'.split(
|
|
",",
|
|
),
|
|
'Rule,abstr-multiplication,default.default,[t] "produit avec"; [t] count(./children/*); [t] "facteurs"; [n] . (engine:style=masculine);,self::infixop,@role="multiplication"'.split(
|
|
",",
|
|
),
|
|
'Rule,abstr-multiplication,mathspeak.brief,[t] "produit"; [n] . (engine:style=masculine),self::infixop,@role="multiplication"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-multiplication",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
["Aliases", "abstr-multiplication", "self::infixop", '@role="implicit"'],
|
|
'Rule,abstr-var-multiplication,default.default,[t] "produit avec un nombre de facteurs variable"; [n] . (engine:style=masculine),self::infixop,@role="multiplication",count(./children/*)>2,./children/punctuation[@role="ellipsis"]'.split(
|
|
",",
|
|
),
|
|
'Aliases abstr-var-multiplication self::infixop @role="implicit" count(./children/*)>2 ./children/punctuation[@role="ellipsis"]'.split(
|
|
" ",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-vector",
|
|
"default.default",
|
|
'[t] "vecteur de dimension"; [t] count(./children/*); [n] . (engine:style=masculine)',
|
|
"self::vector",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-vector",
|
|
"mathspeak.brief",
|
|
'[t] "vecteur"; [n] . (engine:style=masculine)',
|
|
"self::vector",
|
|
],
|
|
["SpecializedRule", "abstr-vector", "mathspeak.brief", "mathspeak.sbrief"],
|
|
'Rule,abstr-var-vector,default.default,[t] "vecteur colonne de dimension n"; [n] . (engine:style=masculine),self::vector,./children/*/children/punctuation[@role="ellipsis"]'.split(
|
|
",",
|
|
),
|
|
'Rule,abstr-binomial,default.default,[t] "binomial"; [n] . (engine:style=masculine),self::vector,@role="binomial"'.split(
|
|
",",
|
|
),
|
|
["SpecializedRule", "abstr-binomial", "default.default", "mathspeak.brief"],
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-binomial",
|
|
"default.default",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule,abstr-determinant,default.default,[t] "d\u00e9terminant de dimension"; [t] count(./children/*); [n] . (engine:style=masculine),self::matrix,@role="determinant"'.split(
|
|
",",
|
|
),
|
|
'Rule,abstr-determinant,mathspeak.brief,[t] "d\u00e9terminant"; [n] . (engine:style=masculine),self::matrix,@role="determinant"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-determinant",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule,abstr-var-determinant,default.default,[t] "d\u00e9terminant de dimension n"; [n] . (engine:style=masculine),self::matrix,@role="determinant",./children/*/children/*/children/punctuation[@role="ellipsis"]'.split(
|
|
",",
|
|
),
|
|
'Rule,abstr-squarematrix,default.default,[t] "matrice carr\u00e9e de dimension"; [t] count(./children/*); [n] . (engine:style=feminine),self::matrix,@role="squarematrix"'.split(
|
|
",",
|
|
),
|
|
'Rule,abstr-squarematrix,mathspeak.brief,[t] "matrice carr\u00e9e"; [n] . (engine:style=feminine),self::matrix,@role="squarematrix"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-squarematrix",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule,abstr-rowvector,default.default,[t] "vecteur ligne de dimension"; [t] count(./children/row/children/*); [n] . (engine:style=masculine),self::matrix,@role="rowvector"'.split(
|
|
",",
|
|
),
|
|
'Rule,abstr-rowvector,mathspeak.brief,[t] "vecteur ligne"; [n] . (engine:style=masculine),self::matrix,@role="rowvector"'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-rowvector",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule;abstr-var-matrix;default.default;[t] "vecteur ligne de dimension n";self::matrix;@role="rowvector";./children/*/children/*/children/punctuation[@role="ellipsis"]'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-matrix",
|
|
"default.default",
|
|
'[t] "matrice"; [t] count(children/*); [t] "par";[t] count(children/*[1]/children/*); [n] . (engine:style=feminine)',
|
|
"self::matrix",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-matrix",
|
|
"mathspeak.brief",
|
|
'[t] "matrice"; [n] . (engine:style=feminine)',
|
|
"self::matrix",
|
|
],
|
|
["SpecializedRule", "abstr-matrix", "mathspeak.brief", "mathspeak.sbrief"],
|
|
'Rule,abstr-var-matrix,default.default,[t] "matrice de dimension n par m"; [n] . (engine:style=feminine),self::matrix,./children/*/children/*/children/punctuation[@role="ellipsis"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-cases",
|
|
"default.default",
|
|
'[t] "d\u00e9claration de cas";[t] "avec"; [t] count(children/*); [t] "cas"; [n] . (engine:style=feminine)',
|
|
"self::cases",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-cases",
|
|
"mathspeak.brief",
|
|
'[t] "d\u00e9claration de cas"; [n] . (engine:style=feminine)',
|
|
"self::cases",
|
|
],
|
|
["SpecializedRule", "abstr-cases", "mathspeak.brief", "mathspeak.sbrief"],
|
|
'Rule,abstr-var-cases,default.default,[t] "d\u00e9claration de cas variable"; [n] . (engine:style=feminine),self::cases,./children/row/children/cell/children/punctuation[@role="ellipsis"]or ./children/line/children/punctuation[@role="ellipsis"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-punctuated",
|
|
"default.default",
|
|
'[t] "liste de longueur"; [t] count(children/*) - count(content/*); [t] "s\u00e9par\u00e9e par des"; [n] content/*[1] (join:""); [t] "s"; [n] . (engine:style=feminine)',
|
|
"self::punctuated",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-punctuated",
|
|
"mathspeak.brief",
|
|
'[t] "liste s\u00e9par\u00e9e par des"; [n] content/*[1] (join:""); [t] "s"; [n] . (engine:style=feminine)',
|
|
"self::punctuated",
|
|
],
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-punctuated",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule,abstr-var-punctuated,default.default,[t] "liste de longueur variable s\u00e9par\u00e9e par des"; [n] content/*[1] (join:""); [t] "s"; [n] . (engine:style=feminine),self::punctuated,./children/punctuation[@role="ellipsis"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-bigop",
|
|
"default.default",
|
|
"[n] content/*[1]; [n] . (engine:style=masculine)",
|
|
"self::bigop",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-integral",
|
|
"default.default",
|
|
'[t] "int\u00e9grale"; [n] . (engine:style=feminine)',
|
|
'@role="integral"',
|
|
],
|
|
"Rule,abstr-relation,default.default,[t] @role (grammar:localRole); [n] . (engine:style=masculine);,self::relseq,count(./children/*)=2".split(
|
|
",",
|
|
),
|
|
'Rule,abstr-relation-seq,default.default,[t] @role (grammar:localRole); [t] "s\u00e9quence"; [t] "avec"; [t] count(./children/*); [t] "\u00e9l\u00e9ments"; [n] . (engine:style=feminine),self::relseq,count(./children/*)>2'.split(
|
|
",",
|
|
),
|
|
'Rule,abstr-relation-seq,mathspeak.brief,[t] @role (grammar:localRole); [t] "s\u00e9quence"; [n] . (engine:style=feminine),self::relseq,count(./children/*)>2'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-relation-seq",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule,abstr-var-relation,default.default,[t] @role (grammar:localRole); [t] "s\u00e9quence"; [t] "avec un nombre de \u00e9l\u00e9ments variable"; [n] . (engine:style=feminine),self::relseq,count(./children/*)>2,./children/punctuation[@role="ellipsis"]'.split(
|
|
",",
|
|
),
|
|
'UniqueAlias abstr-relation default.default self::multirel @role!="unknown" count(./children/*)>2'.split(
|
|
" ",
|
|
),
|
|
'Aliases abstr-var-relation self::multirel @role!="unknown" count(./children/*)>2 ./children/punctuation[@role="ellipsis"]'.split(
|
|
" ",
|
|
),
|
|
'Rule,abstr-multirel,default.default,[t] "s\u00e9quence de relation"; [t] "avec"; [t] count(./children/*); [t] "\u00e9l\u00e9ments"; [n] . (engine:style=feminine),self::multirel,count(./children/*)>2'.split(
|
|
",",
|
|
),
|
|
'Rule,abstr-multirel,mathspeak.brief,[t] "s\u00e9quence de relation"; [n] . (engine:style=feminine),self::multirel,count(./children/*)>2'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-multirel",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule,abstr-var-multirel,default.default,[t] "s\u00e9quence de relation avec un nombre de \u00e9l\u00e9ments variable"; [n] . (engine:style=feminine),self::multirel,count(./children/*)>2,./children/punctuation[@role="ellipsis"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-table",
|
|
"default.default",
|
|
'[t] "table avec"; [t] count(children/*); [t] "lignes et";[t] count(children/*[1]/children/*); [t] "colonnes"; [n] . (engine:style=feminine);',
|
|
"self::table",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-line",
|
|
"default.default",
|
|
'[t] "dans"; [t] @role (grammar:localRole); [n] . (engine:style=masculine)',
|
|
"self::line",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-row",
|
|
"default.default",
|
|
'[t] "dans"; [t] @role (grammar:localRole);[t] count(preceding-sibling::..); [t] "avec";[t] count(children/*); [t] "colonnes"; [n] . (engine:style=feminine)',
|
|
"self::row",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-cell",
|
|
"default.default",
|
|
'[t] "dans"; [t] @role (grammar:localRole); [n] . (engine:style=feminine);',
|
|
"self::cell",
|
|
],
|
|
],
|
|
};
|
|
sre.SummaryGerman = {
|
|
modality: "summary",
|
|
locale: "de",
|
|
rules: [
|
|
'Rule;abstr-identifier;default.default;[t] "langer Bezeichner";self::identifier;contains(@grammar, "collapsed")'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-identifier",
|
|
"default.default",
|
|
'[t] "Bezeichner"',
|
|
"self::identifier",
|
|
],
|
|
'Rule;abstr-number;default.default;[t] "lange Zahl";self::number;contains(@grammar, "collapsed")'.split(
|
|
";",
|
|
),
|
|
["Rule", "abstr-number", "default.default", '[t] "Zahl"', "self::number"],
|
|
'Rule;abstr-mixed-number;default.default;[t] "langer gemischter Bruch";self::number;@role="mixed";contains(@grammar, "collapsed")'.split(
|
|
";",
|
|
),
|
|
'Rule;abstr-mixed-number;default.default;[t] "gemischter Bruch";self::number;@role="mixed"'.split(
|
|
";",
|
|
),
|
|
["Rule", "abstr-text", "default.default", '[t] "Text"', "self::text"],
|
|
[
|
|
"Rule",
|
|
"abstr-function",
|
|
"default.default",
|
|
'[t] "Funktionsausdruck"',
|
|
"self::function",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-function",
|
|
"mathspeak.brief",
|
|
'[t] "Funktion"',
|
|
"self::function",
|
|
],
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-function",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule;abstr-lim;default.default;[t] "Grenzwertfunktion";self::function;@role="limit function"'.split(
|
|
";",
|
|
),
|
|
'Rule;abstr-lim;mathspeak.brief;[t] "Grenzwert";self::function;@role="limit function"'.split(
|
|
";",
|
|
),
|
|
["SpecializedRule", "abstr-lim", "mathspeak.brief", "mathspeak.sbrief"],
|
|
[
|
|
"Rule",
|
|
"abstr-fraction",
|
|
"default.default",
|
|
'[t] "Bruch"',
|
|
"self::fraction",
|
|
],
|
|
'Rule;abstr-continued-fraction;default.default;[t] "Kettenbruch";self::fraction;children/*[2]/descendant-or-self::*[@role="ellipsis"]'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-sqrt",
|
|
"default.default",
|
|
'[t] "Quadratwurzel"',
|
|
"self::sqrt",
|
|
],
|
|
'Rule;abstr-sqrt-nested;default.default;[t] "verschachtelte Quadratwurzel";self::sqrt;children/*/descendant-or-self::sqrt or children/*/descendant-or-self::root'.split(
|
|
";",
|
|
),
|
|
'Rule{abstr-root{default.default{[t] "Wurzel mit Exponent"; [n] children/*[1] (engine:modality=speech); [t] "Exponentende"{self::root{contains(@grammar, "collapsed"){following-sibling::* or ancestor::*/following-sibling::*'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-root",
|
|
"default.default",
|
|
'[t] "Wurzel mit Exponent"; [n] children/*[1] (engine:modality=speech)',
|
|
"self::root",
|
|
],
|
|
["Rule", "abstr-root", "mathspeak.brief", '[t] "Wurzel"', "self::root"],
|
|
["SpecializedRule", "abstr-root", "mathspeak.brief", "mathspeak.sbrief"],
|
|
'Rule{abstr-root-nested{default.default{[t] "verschachtelte Wurzel mit Wurzelexponent"; [n] children/*[1] (engine:modality="speech"); [t] "Ende Wurzelexponent"{self::root{contains(@grammar, "collapsed"){children/*/descendant-or-self::sqrt or children/*/descendant-or-self::root{following-sibling::* or ancestor::*/following-sibling::*'.split(
|
|
"{",
|
|
),
|
|
'Rule,abstr-root-nested,default.default,[t] "verschachtelte Wurzel mit Exponent"; [n] children/*[1] (engine:modality="speech"),self::root,children/*/descendant-or-self::sqrt or children/*/descendant-or-self::root'.split(
|
|
",",
|
|
),
|
|
'Rule;abstr-root-nested;mathspeak.brief;[t] "verschachtelte Wurzel";self::root;children/*/descendant-or-self::sqrt or children/*/descendant-or-self::root'.split(
|
|
";",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-root-nested",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-superscript",
|
|
"default.default",
|
|
'[t] "Potenz"',
|
|
"self::superscript",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-subscript",
|
|
"default.default",
|
|
'[t] "Index"',
|
|
"self::subscript",
|
|
],
|
|
'Rule;abstr-subsup;default.default;[t] "Potenz mit Index";self::superscript;name(children/*[1])="subscript"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-infixop",
|
|
"default.default",
|
|
'[t] @role (grammar:localRole); [t] "mit"; [t] count(./children/*); [t] "Elementen"',
|
|
"self::infixop",
|
|
],
|
|
'Rule,abstr-infixop,default.default,[t] @role (grammar:localRole); [t] "mit ver\u00e4nderlicher Anzahl an Elementen",self::infixop,count(./children/*)>2,./children/punctuation[@role="ellipsis"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-infixop",
|
|
"mathspeak.brief",
|
|
"[t] @role (grammar:localRole)",
|
|
"self::infixop",
|
|
],
|
|
["SpecializedRule", "abstr-infixop", "mathspeak.brief", "mathspeak.sbrief"],
|
|
'Rule,abstr-addition,default.default,[t] "Summe mit"; [t] count(./children/*); [t] "Summanden",self::infixop,@role="addition"'.split(
|
|
",",
|
|
),
|
|
'Rule;abstr-addition;mathspeak.brief;[t] "Summe";self::infixop;@role="addition"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-addition",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule;abstr-var-addition;default.default;[t] "Summe mit ver\u00e4nderlicher Anzahl an Summanden";self::infixop;@role="addition";count(./children/*)>2;./children/punctuation[@role="ellipsis"]'.split(
|
|
";",
|
|
),
|
|
'Rule,abstr-multiplication,default.default,[t] "Produkt mit"; [t] count(./children/*); [t] "Faktoren",self::infixop,@role="multiplication"'.split(
|
|
",",
|
|
),
|
|
'Rule;abstr-multiplication;mathspeak.brief;[t] "Produkt";self::infixop;@role="multiplication"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-multiplication",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
["Aliases", "abstr-multiplication", "self::infixop", '@role="implicit"'],
|
|
'Rule;abstr-var-multiplication;default.default;[t] "Produkt mit ver\u00e4nderlicher Anzahl an Faktoren";self::infixop;@role="multiplication";count(./children/*)>2;./children/punctuation[@role="ellipsis"]'.split(
|
|
";",
|
|
),
|
|
'Aliases abstr-var-multiplication self::infixop @role="implicit" count(./children/*)>2 ./children/punctuation[@role="ellipsis"]'.split(
|
|
" ",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-vector",
|
|
"default.default",
|
|
'[t] count(./children/*) ; [t] "dimensionaler Vektor"',
|
|
"self::vector",
|
|
],
|
|
["Rule", "abstr-vector", "mathspeak.brief", '[t] "Vektor"', "self::vector"],
|
|
["SpecializedRule", "abstr-vector", "mathspeak.brief", "mathspeak.sbrief"],
|
|
'Rule;abstr-var-vector;default.default;[t] "n dimensionaler Vektor";self::vector;./children/*/children/punctuation[@role="ellipsis"]'.split(
|
|
";",
|
|
),
|
|
'Rule;abstr-binomial;default.default;[t] "Binomialkoeffizient";self::vector;@role="binomial"'.split(
|
|
";",
|
|
),
|
|
["SpecializedRule", "abstr-binomial", "default.default", "mathspeak.brief"],
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-binomial",
|
|
"default.default",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule,abstr-determinant,default.default,[t] count(./children/*); [t] "dimensionale Determinante",self::matrix,@role="determinant"'.split(
|
|
",",
|
|
),
|
|
'Rule;abstr-determinant;mathspeak.brief;[t] "Determinante";self::matrix;@role="determinant"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-determinant",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule;abstr-var-determinant;default.default;[t] "n dimensionale Determinante";self::matrix;@role="determinant";./children/*/children/*/children/punctuation[@role="ellipsis"]'.split(
|
|
";",
|
|
),
|
|
'Rule,abstr-squarematrix,default.default,[t] count(./children/*); [t] "dimensionale quadratische Matrize",self::matrix,@role="squarematrix"'.split(
|
|
",",
|
|
),
|
|
'Rule;abstr-squarematrix;mathspeak.brief;[t] "quadratische Matrize";self::matrix;@role="squarematrix"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-squarematrix",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule,abstr-rowvector,default.default,[t] count(./children/row/children/*); [t] "dimensionaler Zeilenvektor",self::matrix,@role="rowvector"'.split(
|
|
",",
|
|
),
|
|
'Rule;abstr-rowvector;mathspeak.brief;[t] "Zeilenvektor";self::matrix;@role="rowvector"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-rowvector",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule;abstr-var-matrix;default.default;[t] "n dimensionaler Zeilenvektor";self::matrix;@role="rowvector";./children/*/children/*/children/punctuation[@role="ellipsis"]'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-matrix",
|
|
"default.default",
|
|
'[t] count(children/*); [t] "mal";[t] count(children/*[1]/children/*); [t] "Matrize"',
|
|
"self::matrix",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-matrix",
|
|
"mathspeak.brief",
|
|
'[t] "Matrize"',
|
|
"self::matrix",
|
|
],
|
|
["SpecializedRule", "abstr-matrix", "mathspeak.brief", "mathspeak.sbrief"],
|
|
'Rule;abstr-var-matrix;default.default;[t] "n mal m dimensionale Matrize";self::matrix;./children/*/children/*/children/punctuation[@role="ellipsis"]'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-cases",
|
|
"default.default",
|
|
'[t] "Fallunterscheidung";[t] "mit"; [t] count(children/*); [t] "F\u00e4llen"',
|
|
"self::cases",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-cases",
|
|
"mathspeak.brief",
|
|
'[t] "Fallunterscheidung"',
|
|
"self::cases",
|
|
],
|
|
["SpecializedRule", "abstr-cases", "mathspeak.brief", "mathspeak.sbrief"],
|
|
'Rule;abstr-var-cases;default.default;[t] "Fallunterscheidung mit ver\u00e4nderlicher Anzahl an F\u00e4llen";self::cases;./children/row/children/cell/children/punctuation[@role="ellipsis"]or ./children/line/children/punctuation[@role="ellipsis"]'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-punctuated",
|
|
"default.default",
|
|
'[t] "mit"; [n] content/*[1]; [t] "getrennte Liste der L\u00e4nge"; [t] count(children/*) - count(content/*)',
|
|
"self::punctuated",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-punctuated",
|
|
"mathspeak.brief",
|
|
'[t] "mit"; [n] content/*[1]; [t] "getrennte Liste";',
|
|
"self::punctuated",
|
|
],
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-punctuated",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule,abstr-var-punctuated,default.default,[t] "mit"; [n] content/*[1]; [t] "getrennte Liste";[t] "ver\u00e4nderlicher L\u00e4nge",self::punctuated,./children/punctuation[@role="ellipsis"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-bigop",
|
|
"default.default",
|
|
"[n] content/*[1]",
|
|
"self::bigop",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-integral",
|
|
"default.default",
|
|
'[t] "Integral"',
|
|
'@role="integral"',
|
|
],
|
|
"Rule,abstr-relation,default.default,[t] @role (grammar:localRole);,self::relseq,count(./children/*)=2".split(
|
|
",",
|
|
),
|
|
'Rule{abstr-relation-seq{default.default{[t] @role (grammar:localRole, join:""); [t] "ssequenz"; [t] "mit"; [t] count(./children/*); [t] "Elementen"{self::relseq{count(./children/*)>2'.split(
|
|
"{",
|
|
),
|
|
'Rule{abstr-relation-seq{mathspeak.brief{[t] @role (grammar:localRole, join:""); [t] "ssequenz"{self::relseq{count(./children/*)>2'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-relation-seq",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule{abstr-var-relation{default.default{[t] @role (grammar:localRole, join:""); [t] "ssequenz";[t] "mit ver\u00e4nderlicher Anzahl an Elementen"{self::relseq{count(./children/*)>2{./children/punctuation[@role="ellipsis"]'.split(
|
|
"{",
|
|
),
|
|
'UniqueAlias abstr-relation default.default self::multirel @role!="unknown" count(./children/*)>2'.split(
|
|
" ",
|
|
),
|
|
'Aliases abstr-var-relation self::multirel @role!="unknown" count(./children/*)>2 ./children/punctuation[@role="ellipsis"]'.split(
|
|
" ",
|
|
),
|
|
'Rule,abstr-multirel,default.default,[t] "Relationsequenz"; [t] "mit"; [t] count(./children/*); [t] "Elementen",self::multirel,count(./children/*)>2'.split(
|
|
",",
|
|
),
|
|
'Rule;abstr-multirel;mathspeak.brief;[t] "Relationsequenz";self::multirel;count(./children/*)>2'.split(
|
|
";",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-multirel",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule;abstr-var-multirel;default.default;[t] "Relationsequenz mit ver\u00e4nderlicher Anzahl an Elementen";self::multirel;count(./children/*)>2;./children/punctuation[@role="ellipsis"]'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-table",
|
|
"default.default",
|
|
'[t] "Tabelle mit"; [t] count(children/*); [t] "Zeilen und";[t] count(children/*[1]/children/*); [t] "Spalten"',
|
|
"self::table",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-line",
|
|
"default.default",
|
|
'[t] "in"; [t] @role (grammar:localRole);',
|
|
"self::line",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-row",
|
|
"default.default",
|
|
'[t] "in"; [t] @role (grammar:localRole);[t] count(preceding-sibling::..); [t] "mit";[t] count(children/*); [t] "Spalten"',
|
|
"self::row",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-cell",
|
|
"default.default",
|
|
'[t] "in"; [t] @role (grammar:localRole);',
|
|
"self::cell",
|
|
],
|
|
],
|
|
};
|
|
sre.SummaryRules = {
|
|
modality: "summary",
|
|
rules: [
|
|
'Rule;abstr-identifier;default.default;[t] "long identifier";self::identifier;contains(@grammar, "collapsed")'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-identifier",
|
|
"default.default",
|
|
'[t] "identifier"',
|
|
"self::identifier",
|
|
],
|
|
'Rule;abstr-number;default.default;[t] "long number";self::number;contains(@grammar, "collapsed")'.split(
|
|
";",
|
|
),
|
|
["Rule", "abstr-number", "default.default", '[t] "number"', "self::number"],
|
|
'Rule;abstr-mixed-number;default.default;[t] "long mixed number";self::number;@role="mixed";contains(@grammar, "collapsed")'.split(
|
|
";",
|
|
),
|
|
'Rule;abstr-mixed-number;default.default;[t] "mixed number";self::number;@role="mixed"'.split(
|
|
";",
|
|
),
|
|
["Rule", "abstr-text", "default.default", '[t] "text"', "self::text"],
|
|
[
|
|
"Rule",
|
|
"abstr-function",
|
|
"default.default",
|
|
'[t] "functional expression"',
|
|
"self::function",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-function",
|
|
"mathspeak.brief",
|
|
'[t] "function"',
|
|
"self::function",
|
|
],
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-function",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule;abstr-lim;default.default;[t] "limit function";self::function;@role="limit function"'.split(
|
|
";",
|
|
),
|
|
'Rule;abstr-lim;mathspeak.brief;[t] "lim";self::function;@role="limit function"'.split(
|
|
";",
|
|
),
|
|
["SpecializedRule", "abstr-lim", "mathspeak.brief", "mathspeak.sbrief"],
|
|
[
|
|
"Rule",
|
|
"abstr-fraction",
|
|
"default.default",
|
|
'[t] "fraction"',
|
|
"self::fraction",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-fraction",
|
|
"mathspeak.brief",
|
|
'[t] "frac"',
|
|
"self::fraction",
|
|
],
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-fraction",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule;abstr-continued-fraction;default.default;[t] "continued fraction";self::fraction;children/*[2]/descendant-or-self::*[@role="ellipsis"]'.split(
|
|
";",
|
|
),
|
|
'Rule;abstr-continued-fraction;mathspeak.brief;[t] "continued frac";self::fraction;children/*[2]/descendant-or-self::*[@role="ellipsis"]'.split(
|
|
";",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-continued-fraction",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-sqrt",
|
|
"default.default",
|
|
'[t] "square root"',
|
|
"self::sqrt",
|
|
],
|
|
'Rule;abstr-sqrt-nested;default.default;[t] "nested square root";self::sqrt;children/*/descendant-or-self::sqrt or children/*/descendant-or-self::root'.split(
|
|
";",
|
|
),
|
|
'Rule{abstr-root{default.default{[t] "root of index"; [n] children/*[1] (engine:modality="speech"); [t] "endindex"{self::root{contains(@grammar, "collapsed"){following-sibling::* or ancestor::*/following-sibling::*'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-root",
|
|
"default.default",
|
|
'[t] "root of index"; [n] children/*[1] (engine:modality=speech)',
|
|
"self::root",
|
|
],
|
|
["Rule", "abstr-root", "mathspeak.brief", '[t] "root"', "self::root"],
|
|
["SpecializedRule", "abstr-root", "mathspeak.brief", "mathspeak.sbrief"],
|
|
'Rule{abstr-root-nested{default.default{[t] "nested root of index"; [n] children/*[1] (engine:modality="speech"); [t] "endindex"{self::root{contains(@grammar, "collapsed"){children/*/descendant-or-self::sqrt or children/*/descendant-or-self::root{following-sibling::* or ancestor::*/following-sibling::*'.split(
|
|
"{",
|
|
),
|
|
'Rule,abstr-root-nested,default.default,[t] "nested root of index"; [n] children/*[1] (engine:modality="speech"),self::root,children/*/descendant-or-self::sqrt or children/*/descendant-or-self::root'.split(
|
|
",",
|
|
),
|
|
'Rule;abstr-root-nested;mathspeak.brief;[t] "nested root";self::root;children/*/descendant-or-self::sqrt or children/*/descendant-or-self::root'.split(
|
|
";",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-root-nested",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-superscript",
|
|
"default.default",
|
|
'[t] "power"',
|
|
"self::superscript",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-subscript",
|
|
"default.default",
|
|
'[t] "subscript"',
|
|
"self::subscript",
|
|
],
|
|
'Rule;abstr-subsup;default.default;[t] "power with subscript";self::superscript;name(children/*[1])="subscript"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-infixop",
|
|
"default.default",
|
|
'[t] @role (grammar:localRole); [t] "with"; [t] count(./children/*); [t] "elements"',
|
|
"self::infixop",
|
|
],
|
|
'Rule,abstr-infixop,default.default,[t] @role (grammar:localRole); [t] "with variable number of elements",self::infixop,count(./children/*)>2,./children/punctuation[@role="ellipsis"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-infixop",
|
|
"mathspeak.brief",
|
|
"[t] @role (grammar:localRole)",
|
|
"self::infixop",
|
|
],
|
|
["SpecializedRule", "abstr-infixop", "mathspeak.brief", "mathspeak.sbrief"],
|
|
'Rule,abstr-addition,default.default,[t] "sum with"; [t] count(./children/*); [t] "summands",self::infixop,@role="addition"'.split(
|
|
",",
|
|
),
|
|
'Rule;abstr-addition;mathspeak.brief;[t] "sum";self::infixop;@role="addition"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-addition",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule;abstr-var-addition;default.default;[t] "sum with variable number of summands";self::infixop;@role="addition";count(./children/*)>2;./children/punctuation[@role="ellipsis"]'.split(
|
|
";",
|
|
),
|
|
'Rule,abstr-multiplication,default.default,[t] "product with"; [t] count(./children/*); [t] "factors",self::infixop,@role="multiplication"'.split(
|
|
",",
|
|
),
|
|
'Rule;abstr-multiplication;mathspeak.brief;[t] "product";self::infixop;@role="multiplication"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-multiplication",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
["Aliases", "abstr-multiplication", "self::infixop", '@role="implicit"'],
|
|
'Rule;abstr-var-multiplication;default.default;[t] "product with variable number of factors";self::infixop;@role="multiplication";count(./children/*)>2;./children/punctuation[@role="ellipsis"]'.split(
|
|
";",
|
|
),
|
|
'Aliases abstr-var-multiplication self::infixop @role="implicit" count(./children/*)>2 ./children/punctuation[@role="ellipsis"]'.split(
|
|
" ",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-vector",
|
|
"default.default",
|
|
'[t] count(./children/*) ; [t] "dimensional vector"',
|
|
"self::vector",
|
|
],
|
|
["Rule", "abstr-vector", "mathspeak.brief", '[t] "vector"', "self::vector"],
|
|
["SpecializedRule", "abstr-vector", "mathspeak.brief", "mathspeak.sbrief"],
|
|
'Rule;abstr-var-vector;default.default;[t] "n dimensional vector";self::vector;./children/*/children/punctuation[@role="ellipsis"]'.split(
|
|
";",
|
|
),
|
|
'Rule;abstr-binomial;default.default;[t] "binomial";self::vector;@role="binomial"'.split(
|
|
";",
|
|
),
|
|
["SpecializedRule", "abstr-binomial", "default.default", "mathspeak.brief"],
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-binomial",
|
|
"default.default",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule,abstr-determinant,default.default,[t] count(./children/*); [t] "dimensional determinant",self::matrix,@role="determinant"'.split(
|
|
",",
|
|
),
|
|
'Rule;abstr-determinant;mathspeak.brief;[t] "determinant";self::matrix;@role="determinant"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-determinant",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule;abstr-var-determinant;default.default;[t] "n dimensional determinant";self::matrix;@role="determinant";./children/*/children/*/children/punctuation[@role="ellipsis"]'.split(
|
|
";",
|
|
),
|
|
'Rule,abstr-squarematrix,default.default,[t] count(./children/*); [t] "dimensional square matrix",self::matrix,@role="squarematrix"'.split(
|
|
",",
|
|
),
|
|
'Rule;abstr-squarematrix;mathspeak.brief;[t] "square matrix";self::matrix;@role="squarematrix"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-squarematrix",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule,abstr-rowvector,default.default,[t] count(./children/row/children/*); [t] "dimensional row vector",self::matrix,@role="rowvector"'.split(
|
|
",",
|
|
),
|
|
'Rule;abstr-rowvector;mathspeak.brief;[t] "row vector";self::matrix;@role="rowvector"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-rowvector",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule;abstr-var-matrix;default.default;[t] "n dimensional row vector";self::matrix;@role="rowvector";./children/*/children/*/children/punctuation[@role="ellipsis"]'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-matrix",
|
|
"default.default",
|
|
'[t] count(children/*); [t] "by";[t] count(children/*[1]/children/*); [t] "matrix"',
|
|
"self::matrix",
|
|
],
|
|
["Rule", "abstr-matrix", "mathspeak.brief", '[t] "matrix"', "self::matrix"],
|
|
["SpecializedRule", "abstr-matrix", "mathspeak.brief", "mathspeak.sbrief"],
|
|
'Rule;abstr-var-matrix;default.default;[t] "n by m dimensional matrix";self::matrix;./children/*/children/*/children/punctuation[@role="ellipsis"]'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-cases",
|
|
"default.default",
|
|
'[t] "case statement";[t] "with"; [t] count(children/*); [t] "cases"',
|
|
"self::cases",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-cases",
|
|
"mathspeak.brief",
|
|
'[t] "case statement"',
|
|
"self::cases",
|
|
],
|
|
["SpecializedRule", "abstr-cases", "mathspeak.brief", "mathspeak.sbrief"],
|
|
'Rule;abstr-var-cases;default.default;[t] "case statement with variable number of cases";self::cases;./children/row/children/cell/children/punctuation[@role="ellipsis"]or ./children/line/children/punctuation[@role="ellipsis"]'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-punctuated",
|
|
"default.default",
|
|
'[n] content/*[1]; [t] "separated list"; [t] "of length"; [t] count(children/*) - count(content/*)',
|
|
"self::punctuated",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-punctuated",
|
|
"mathspeak.brief",
|
|
'[n] content/*[1]; [t] "separated list"',
|
|
"self::punctuated",
|
|
],
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-punctuated",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule,abstr-var-punctuated,default.default,[n] content/*[1]; [t] "separated list";[t] "of variable length",self::punctuated,./children/punctuation[@role="ellipsis"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-bigop",
|
|
"default.default",
|
|
"[n] content/*[1]",
|
|
"self::bigop",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-integral",
|
|
"default.default",
|
|
'[t] "integral"',
|
|
'@role="integral"',
|
|
],
|
|
"Rule,abstr-relation,default.default,[t] @role (grammar:localRole);,self::relseq,count(./children/*)=2".split(
|
|
",",
|
|
),
|
|
'Rule,abstr-relation-seq,default.default,[t] @role (grammar:localRole); [t] "sequence"; [t] "with"; [t] count(./children/*); [t] "elements",self::relseq,count(./children/*)>2'.split(
|
|
",",
|
|
),
|
|
'Rule,abstr-relation-seq,mathspeak.brief,[t] @role (grammar:localRole); [t] "sequence",self::relseq,count(./children/*)>2'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-relation-seq",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule,abstr-var-relation,default.default,[t] @role (grammar:localRole); [t] "sequence"; [t] "with variable number of elements",self::relseq,count(./children/*)>2,./children/punctuation[@role="ellipsis"]'.split(
|
|
",",
|
|
),
|
|
'UniqueAlias abstr-relation default.default self::multirel @role!="unknown" count(./children/*)>2'.split(
|
|
" ",
|
|
),
|
|
'Aliases abstr-var-relation self::multirel @role!="unknown" count(./children/*)>2 ./children/punctuation[@role="ellipsis"]'.split(
|
|
" ",
|
|
),
|
|
'Rule,abstr-multirel,default.default,[t] "relation sequence"; [t] "with"; [t] count(./children/*); [t] "elements",self::multirel,count(./children/*)>2'.split(
|
|
",",
|
|
),
|
|
'Rule;abstr-multirel;mathspeak.brief;[t] "relation sequence";self::multirel;count(./children/*)>2'.split(
|
|
";",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-multirel",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule;abstr-var-multirel;default.default;[t] "relation sequence with variable number of elements";self::multirel;count(./children/*)>2;./children/punctuation[@role="ellipsis"]'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-table",
|
|
"default.default",
|
|
'[t] "table with"; [t] count(children/*); [t] "rows and";[t] count(children/*[1]/children/*); [t] "columns"',
|
|
"self::table",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-line",
|
|
"default.default",
|
|
'[t] "in"; [t] @role (grammar:localRole);',
|
|
"self::line",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-row",
|
|
"default.default",
|
|
'[t] "in"; [t] @role (grammar:localRole);[t] count(preceding-sibling::..); [t] "with";[t] count(children/*); [t] "columns"',
|
|
"self::row",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-cell",
|
|
"default.default",
|
|
'[t] "in"; [t] @role (grammar:localRole);',
|
|
"self::cell",
|
|
],
|
|
],
|
|
};
|
|
sre.SummarySpanish = {
|
|
locale: "es",
|
|
modality: "summary",
|
|
rules: [
|
|
["Rule", "stree", "default.default", "[n] ./*[1]", "self::stree"],
|
|
'Rule;abstr-identifier;default.default;[t] "identificador largo";self::identifier;contains(@grammar, "collapsed")'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-identifier",
|
|
"default.default",
|
|
'[t] "identificador"',
|
|
"self::identifier",
|
|
],
|
|
'Rule;abstr-number;default.default;[t] "n\u00famero largo";self::number;contains(@grammar, "collapsed")'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-number",
|
|
"default.default",
|
|
'[t] "n\u00famero"',
|
|
"self::number",
|
|
],
|
|
'Rule;abstr-mixed-number;default.default;[t] "n\u00famero largo mixto";self::number;@role="mixed";contains(@grammar, "collapsed")'.split(
|
|
";",
|
|
),
|
|
'Rule;abstr-mixed-number;default.default;[t] "n\u00famero mixto";self::number;@role="mixed"'.split(
|
|
";",
|
|
),
|
|
["Rule", "abstr-text", "default.default", '[t] "texto"', "self::text"],
|
|
[
|
|
"Rule",
|
|
"abstr-function",
|
|
"default.default",
|
|
'[t] "expresi\u00f3n funcional"',
|
|
"self::function",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-function",
|
|
"mathspeak.brief",
|
|
'[t] "funci\u00f3n"',
|
|
"self::function",
|
|
],
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-function",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule;abstr-lim;default.default;[t] "funci\u00f3n de l\u00edmite";self::function;@role="limit function"'.split(
|
|
";",
|
|
),
|
|
'Rule;abstr-lim;mathspeak.brief;[t] "l\u00edmite";self::function;@role="limit function"'.split(
|
|
";",
|
|
),
|
|
["SpecializedRule", "abstr-lim", "mathspeak.brief", "mathspeak.sbrief"],
|
|
[
|
|
"Rule",
|
|
"abstr-fraction",
|
|
"default.default",
|
|
'[t] "fracci\u00f3n"',
|
|
"self::fraction",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-fraction",
|
|
"mathspeak.brief",
|
|
'[t] "frac"',
|
|
"self::fraction",
|
|
],
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-fraction",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule;abstr-continued-fraction;default.default;[t] "fracci\u00f3n continua";self::fraction;children/*[2]/descendant-or-self::*[@role="ellipsis"]'.split(
|
|
";",
|
|
),
|
|
'Rule;abstr-continued-fraction;mathspeak.brief;[t] "frac continua";self::fraction;children/*[2]/descendant-or-self::*[@role="ellipsis"]'.split(
|
|
";",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-continued-fraction",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-sqrt",
|
|
"default.default",
|
|
'[t] "ra\u00edz cuadrada"',
|
|
"self::sqrt",
|
|
],
|
|
'Rule;abstr-sqrt-nested;default.default;[t] "ra\u00edz cuadrada anidada";self::sqrt;children/*/descendant-or-self::sqrt or children/*/descendant-or-self::root'.split(
|
|
";",
|
|
),
|
|
'Rule{abstr-root{default.default{[t] "ra\u00edz del \u00edndice"; [n] children/*[1] (engine:modality="speech"); [t] "finalizar de \u00edndice"{self::root{contains(@grammar, "collapsed"){following-sibling::* or ancestor::*/following-sibling::*'.split(
|
|
"{",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-root",
|
|
"default.default",
|
|
'[t] "ra\u00edz del \u00edndice"; [n] children/*[1] (engine:modality=speech)',
|
|
"self::root",
|
|
],
|
|
["Rule", "abstr-root", "mathspeak.brief", '[t] "ra\u00edz"', "self::root"],
|
|
["SpecializedRule", "abstr-root", "mathspeak.brief", "mathspeak.sbrief"],
|
|
'Rule{abstr-root-nested{default.default{[t] "ra\u00edz anidada del \u00edndice"; [n] children/*[1] (engine:modality="speech"); [t] "finalizar de \u00edndice"{self::root{contains(@grammar, "collapsed"){children/*/descendant-or-self::sqrt or children/*/descendant-or-self::root{following-sibling::* or ancestor::*/following-sibling::*'.split(
|
|
"{",
|
|
),
|
|
'Rule,abstr-root-nested,default.default,[t] "ra\u00edz anidada del \u00edndice"; [n] children/*[1] (engine:modality="speech"),self::root,children/*/descendant-or-self::sqrt or children/*/descendant-or-self::root'.split(
|
|
",",
|
|
),
|
|
'Rule;abstr-root-nested;mathspeak.brief;[t] "ra\u00edz anidada";self::root;children/*/descendant-or-self::sqrt or children/*/descendant-or-self::root'.split(
|
|
";",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-root-nested",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-superscript",
|
|
"default.default",
|
|
'[t] "potencia"',
|
|
"self::superscript",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-subscript",
|
|
"default.default",
|
|
'[t] "sub\u00edndice"',
|
|
"self::subscript",
|
|
],
|
|
'Rule;abstr-subsup;default.default;[t] "potencia con sub\u00edndice";self::superscript;name(children/*[1])="subscript"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-infixop",
|
|
"default.default",
|
|
'[t] @role (grammar:localRole); [t] "con"; [t] count(./children/*); [t] "elementos"',
|
|
"self::infixop",
|
|
],
|
|
'Rule,abstr-infixop,default.default,[t] @role (grammar:localRole); [t] "con una cantidad variable de elementos",self::infixop,count(./children/*)>2,./children/punctuation[@role="ellipsis"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-infixop",
|
|
"mathspeak.brief",
|
|
"[t] @role (grammar:localRole)",
|
|
"self::infixop",
|
|
],
|
|
["SpecializedRule", "abstr-infixop", "mathspeak.brief", "mathspeak.sbrief"],
|
|
'Rule,abstr-addition,default.default,[t] "suma con"; [t] count(./children/*); [t] "sumandos",self::infixop,@role="addition"'.split(
|
|
",",
|
|
),
|
|
'Rule;abstr-addition;mathspeak.brief;[t] "suma";self::infixop;@role="addition"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-addition",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule;abstr-var-addition;default.default;[t] "suma con n\u00famero variable de sumandos";self::infixop;@role="addition";count(./children/*)>2;./children/punctuation[@role="ellipsis"]'.split(
|
|
";",
|
|
),
|
|
'Rule,abstr-multiplication,default.default,[t] "producto con"; [t] count(./children/*); [t] "factores",self::infixop,@role="multiplication"'.split(
|
|
",",
|
|
),
|
|
'Rule;abstr-multiplication;mathspeak.brief;[t] "producto";self::infixop;@role="multiplication"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-multiplication",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
["Aliases", "abstr-multiplication", "self::infixop", '@role="implicit"'],
|
|
'Rule;abstr-var-multiplication;default.default;[t] "producto con una cantidad variable de factores";self::infixop;@role="multiplication";count(./children/*)>2;./children/punctuation[@role="ellipsis"]'.split(
|
|
";",
|
|
),
|
|
'Aliases abstr-var-multiplication self::infixop @role="implicit" count(./children/*)>2 ./children/punctuation[@role="ellipsis"]'.split(
|
|
" ",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-vector",
|
|
"default.default",
|
|
'[t] "vector de dimensi\u00f3n"; [t] count(./children/*)',
|
|
"self::vector",
|
|
],
|
|
["Rule", "abstr-vector", "mathspeak.brief", '[t] "vector"', "self::vector"],
|
|
["SpecializedRule", "abstr-vector", "mathspeak.brief", "mathspeak.sbrief"],
|
|
'Rule;abstr-var-vector;default.default;[t] "vector de dimensi\u00f3n n";self::vector;./children/*/children/punctuation[@role="ellipsis"]'.split(
|
|
";",
|
|
),
|
|
'Rule;abstr-binomial;default.default;[t] "binomio";self::vector;@role="binomial"'.split(
|
|
";",
|
|
),
|
|
["SpecializedRule", "abstr-binomial", "default.default", "mathspeak.brief"],
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-binomial",
|
|
"default.default",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule,abstr-determinant,default.default,[t] "determinante de dimensi\u00f3n"; [t] count(./children/*),self::matrix,@role="determinant"'.split(
|
|
",",
|
|
),
|
|
'Rule;abstr-determinant;mathspeak.brief;[t] "determinante";self::matrix;@role="determinant"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-determinant",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule;abstr-var-determinant;default.default;[t] "determinante de dimensi\u00f3n n";self::matrix;@role="determinant";./children/*/children/*/children/punctuation[@role="ellipsis"]'.split(
|
|
";",
|
|
),
|
|
'Rule,abstr-squarematrix,default.default,[t] "matriz cuadrada de dimensi\u00f3n"; [t] count(./children/*),self::matrix,@role="squarematrix"'.split(
|
|
",",
|
|
),
|
|
'Rule;abstr-squarematrix;mathspeak.brief;[t] "matriz cuadrada";self::matrix;@role="squarematrix"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-squarematrix",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule,abstr-rowvector,default.default,[t] "vector fila de dimensi\u00f3n"; [t] count(./children/row/children/*),self::matrix,@role="rowvector"'.split(
|
|
",",
|
|
),
|
|
'Rule;abstr-rowvector;mathspeak.brief;[t] "vector fila";self::matrix;@role="rowvector"'.split(
|
|
";",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-rowvector",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule;abstr-var-matrix;default.default;[t] "vector fila de dimensi\u00f3n n";self::matrix;@role="rowvector";./children/*/children/*/children/punctuation[@role="ellipsis"]'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-matrix",
|
|
"default.default",
|
|
'[t] count(children/*); [t] "por";[t] count(children/*[1]/children/*); [t] "matriz"',
|
|
"self::matrix",
|
|
],
|
|
["Rule", "abstr-matrix", "mathspeak.brief", '[t] "matriz"', "self::matrix"],
|
|
["SpecializedRule", "abstr-matrix", "mathspeak.brief", "mathspeak.sbrief"],
|
|
'Rule;abstr-var-matrix;default.default;[t] "matriz de dimensi\u00f3n n por m";self::matrix;./children/*/children/*/children/punctuation[@role="ellipsis"]'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-cases",
|
|
"default.default",
|
|
'[t] "declaraci\u00f3n de caso";[t] "con"; [t] count(children/*); [t] "casos"',
|
|
"self::cases",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-cases",
|
|
"mathspeak.brief",
|
|
'[t] "declaraci\u00f3n de caso"',
|
|
"self::cases",
|
|
],
|
|
["SpecializedRule", "abstr-cases", "mathspeak.brief", "mathspeak.sbrief"],
|
|
'Rule;abstr-var-cases;default.default;[t] "declaraci\u00f3n de caso con n\u00famero variable de casos";self::cases;./children/row/children/cell/children/punctuation[@role="ellipsis"]or ./children/line/children/punctuation[@role="ellipsis"]'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-punctuated",
|
|
"default.default",
|
|
'[t] "lista separada por"; [n] content/*[1]; [t] "de longitud"; [t] count(children/*) - count(content/*)',
|
|
"self::punctuated",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-punctuated",
|
|
"mathspeak.brief",
|
|
'[t] "lista separada por"; [n] content/*[1]',
|
|
"self::punctuated",
|
|
],
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-punctuated",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule,abstr-var-punctuated,default.default,[t] "lista separada por"; [n] content/*[1],[t] "de longitud variable",self::punctuated,./children/punctuation[@role="ellipsis"]'.split(
|
|
",",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-bigop",
|
|
"default.default",
|
|
"[n] content/*[1]",
|
|
"self::bigop",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-integral",
|
|
"default.default",
|
|
'[t] "integral"',
|
|
'@role="integral"',
|
|
],
|
|
"Rule,abstr-relation,default.default,[t] @role (grammar:localRole);,self::relseq,count(./children/*)=2".split(
|
|
",",
|
|
),
|
|
'Rule,abstr-relation-seq,default.default,[t] "secuencia de"; [t] @role (grammar:localRole); [t] "con"; [t] count(./children/*); [t] "elementos",self::relseq,count(./children/*)>2'.split(
|
|
",",
|
|
),
|
|
'Rule,abstr-relation-seq,mathspeak.brief,[t] "secuencia de"; [t] @role (grammar:localRole),self::relseq,count(./children/*)>2'.split(
|
|
",",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-relation-seq",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule,abstr-var-relation,default.default,[t] "secuencia de"; [t] @role (grammar:localRole); [t] "con una cantidad variable de elementos",self::relseq,count(./children/*)>2,./children/punctuation[@role="ellipsis"]'.split(
|
|
",",
|
|
),
|
|
'UniqueAlias abstr-relation default.default self::multirel @role!="unknown" count(./children/*)>2'.split(
|
|
" ",
|
|
),
|
|
'Aliases abstr-var-relation self::multirel @role!="unknown" count(./children/*)>2 ./children/punctuation[@role="ellipsis"]'.split(
|
|
" ",
|
|
),
|
|
'Rule,abstr-multirel,default.default,[t] "secuencia de relaci\u00f3n"; [t] "con"; [t] count(./children/*); [t] "elementos",self::multirel,count(./children/*)>2'.split(
|
|
",",
|
|
),
|
|
'Rule;abstr-multirel;mathspeak.brief;[t] "secuencia de relaci\u00f3n";self::multirel;count(./children/*)>2'.split(
|
|
";",
|
|
),
|
|
[
|
|
"SpecializedRule",
|
|
"abstr-multirel",
|
|
"mathspeak.brief",
|
|
"mathspeak.sbrief",
|
|
],
|
|
'Rule;abstr-var-multirel;default.default;[t] "secuencia de relaci\u00f3n con n\u00famero variable de elementos";self::multirel;count(./children/*)>2;./children/punctuation[@role="ellipsis"]'.split(
|
|
";",
|
|
),
|
|
[
|
|
"Rule",
|
|
"abstr-table",
|
|
"default.default",
|
|
'[t] "mesa con"; [t] count(children/*); [t] "filas y";[t] count(children/*[1]/children/*); [t] "columnas"',
|
|
"self::table",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-line",
|
|
"default.default",
|
|
'[t] "en"; [t] @role (grammar:localRole);',
|
|
"self::line",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-row",
|
|
"default.default",
|
|
'[t] "en"; [t] @role (grammar:localRole);[t] count(preceding-sibling::..); [t] "con";[t] count(children/*); [t] "columnas"',
|
|
"self::row",
|
|
],
|
|
[
|
|
"Rule",
|
|
"abstr-cell",
|
|
"default.default",
|
|
'[t] "en"; [t] @role (grammar:localRole);',
|
|
"self::cell",
|
|
],
|
|
],
|
|
};
|
|
sre.SpeechRuleStores = {};
|
|
sre.SpeechRuleStores.RULE_SETS_ = {
|
|
SemanticTreeRules: sre.SemanticTreeRules,
|
|
MathspeakFrench: sre.MathspeakFrench,
|
|
MathspeakGerman: sre.MathspeakGerman,
|
|
MathspeakRules: sre.MathspeakRules,
|
|
MathspeakSpanish: sre.MathspeakSpanish,
|
|
NemethRules: sre.NemethRules,
|
|
ClearspeakFrench: sre.ClearspeakFrench,
|
|
ClearspeakGerman: sre.ClearspeakGerman,
|
|
ClearspeakRules: sre.ClearspeakRules,
|
|
EmacspeakRules: sre.EmacspeakRules,
|
|
SummaryFrench: sre.SummaryFrench,
|
|
SummaryGerman: sre.SummaryGerman,
|
|
SummaryRules: sre.SummaryRules,
|
|
SummarySpanish: sre.SummarySpanish,
|
|
PrefixFrench: sre.PrefixFrench,
|
|
PrefixGerman: sre.PrefixGerman,
|
|
PrefixRules: sre.PrefixRules,
|
|
PrefixSpanish: sre.PrefixSpanish,
|
|
};
|
|
sre.SpeechRuleStores.availableSets = function () {
|
|
return Object.keys(sre.SpeechRuleStores.RULE_SETS_);
|
|
};
|
|
sre.SpeechRuleStores.getConstructor = function (a) {
|
|
return (a = sre.SpeechRuleStores.RULE_SETS_[a]) ? a : null;
|
|
};
|
|
sre.SpeechRuleEngine = function () {
|
|
this.activeStore_ = null;
|
|
this.cache_ = {};
|
|
this.ready_ = !0;
|
|
this.combinedStores_ = {};
|
|
this.evaluators_ = {};
|
|
this.ruleSets_ = {};
|
|
sre.Engine.registerTest(
|
|
goog.bind(function (a) {
|
|
return this.ready_;
|
|
}, this),
|
|
);
|
|
};
|
|
goog.addSingletonGetter(sre.SpeechRuleEngine);
|
|
sre.SpeechRuleEngine.prototype.parameterize = function (a) {
|
|
for (var b = {}, c = 0, d = a.length; c < d; c++) {
|
|
var e = a[c];
|
|
if (this.ruleSets_[e]) b[e] = this.ruleSets_[e];
|
|
else {
|
|
var f = sre.SpeechRuleStores.getConstructor(e);
|
|
if (f && f.getInstance)
|
|
(b[e] = f.getInstance()), (this.ruleSets_[e] = f.getInstance());
|
|
else if (f) {
|
|
var g = this.storeFactory_(f.modality);
|
|
g.parse(f);
|
|
this.ruleSets_[e] = g;
|
|
b[e] = g;
|
|
}
|
|
}
|
|
}
|
|
this.parameterize_(b);
|
|
};
|
|
sre.SpeechRuleEngine.prototype.storeFactory_ = function (a) {
|
|
return new (
|
|
{ braille: sre.BrailleStore, speech: sre.MathStore }[a] || sre.MathStore
|
|
)();
|
|
};
|
|
sre.SpeechRuleEngine.prototype.parameterize_ = function (a) {
|
|
try {
|
|
this.activeStore_ = this.combineStores_(a);
|
|
} catch (b) {
|
|
if ("StoreError" == b.name) console.error("Store Error:", b.message);
|
|
else throw b;
|
|
}
|
|
this.updateEngine();
|
|
};
|
|
sre.SpeechRuleEngine.prototype.clearCache = function () {
|
|
this.cache_ = {};
|
|
};
|
|
sre.SpeechRuleEngine.prototype.forCache = function (a) {
|
|
for (var b in this.cache_) a(b, this.cache_[b]);
|
|
};
|
|
sre.SpeechRuleEngine.prototype.getCacheForNode_ = function (a) {
|
|
if (!a || !a.getAttribute) return null;
|
|
a = a.getAttribute("id");
|
|
return "undefined" === a || "" === a ? null : this.getCache(a);
|
|
};
|
|
sre.SpeechRuleEngine.prototype.getCache = function (a) {
|
|
return (a = this.cache_[a]) ? this.cloneCache(a) : a;
|
|
};
|
|
sre.SpeechRuleEngine.prototype.cloneCache = function (a) {
|
|
return a.map(function (b) {
|
|
return b.clone();
|
|
});
|
|
};
|
|
sre.SpeechRuleEngine.prototype.pushCache_ = function (a, b) {
|
|
sre.Engine.getInstance().cache &&
|
|
a.getAttribute &&
|
|
(a = a.getAttribute("id")) &&
|
|
(this.cache_[a] = this.cloneCache(b));
|
|
};
|
|
sre.SpeechRuleEngine.prototype.evaluateNode = function (a) {
|
|
var b = new Date().getTime();
|
|
a = this.evaluateNode_(a);
|
|
var c = new Date().getTime();
|
|
sre.Debugger.getInstance().output("Time:", c - b);
|
|
return a;
|
|
};
|
|
sre.SpeechRuleEngine.prototype.evaluateNode_ = function (a) {
|
|
if (!a) return [];
|
|
this.updateConstraint_();
|
|
return this.evaluateTree_(a);
|
|
};
|
|
sre.SpeechRuleEngine.prototype.evaluateTree_ = function (a) {
|
|
var b = sre.Engine.getInstance();
|
|
sre.Debugger.getInstance().output(
|
|
b.mode !== sre.Engine.Mode.HTTP ? a.toString() : a,
|
|
);
|
|
if (b.cache) {
|
|
var c = this.getCacheForNode_(a);
|
|
if (c) return a.attributes && this.addPersonality_(c, {}, !1, a), c;
|
|
}
|
|
sre.Grammar.getInstance().setAttribute(a);
|
|
var d = this.activeStore_.lookupRule(a, b.dynamicCstr);
|
|
if (!d) {
|
|
if (b.strict) return [];
|
|
c = this.getEvaluator(b.locale, b.modality)(a);
|
|
a.attributes && this.addPersonality_(c, {}, !1, a);
|
|
this.pushCache_(a, c);
|
|
return c;
|
|
}
|
|
sre.Debugger.getInstance().generateOutput(
|
|
goog.bind(function () {
|
|
return [
|
|
"Apply Rule:",
|
|
d.name,
|
|
d.dynamicCstr.toString(),
|
|
b.mode !== sre.Engine.Mode.HTTP ? a.toString() : a,
|
|
];
|
|
}, this),
|
|
);
|
|
var e = d.context || this.activeStore_.context,
|
|
f = d.action.components;
|
|
c = [];
|
|
for (var g = 0, h; (h = f[g]); g++) {
|
|
var k = [],
|
|
l = h.content || "",
|
|
m = h.attributes || {},
|
|
n = !1;
|
|
h.grammar && this.processGrammar(e, a, h.grammar);
|
|
var p = null,
|
|
q = null;
|
|
if (m.engine) {
|
|
p = sre.Engine.getInstance().dynamicCstr.getComponents();
|
|
var r = sre.Grammar.parseInput(m.engine);
|
|
q = this.cache_;
|
|
this.clearCache();
|
|
sre.Engine.getInstance().setDynamicCstr(r);
|
|
}
|
|
switch (h.type) {
|
|
case sre.SpeechRule.Type.NODE:
|
|
(l = e.applyQuery(a, l)) && (k = this.evaluateTree_(l));
|
|
break;
|
|
case sre.SpeechRule.Type.MULTI:
|
|
n = !0;
|
|
l = e.applySelector(a, l);
|
|
0 < l.length &&
|
|
(k = this.evaluateNodeList_(
|
|
e,
|
|
l,
|
|
m.sepFunc,
|
|
e.constructString(a, m.separator),
|
|
m.ctxtFunc,
|
|
e.constructString(a, m.context),
|
|
));
|
|
break;
|
|
case sre.SpeechRule.Type.TEXT:
|
|
(l = e.constructString(a, l)) &&
|
|
(k = [sre.AuditoryDescription.create({ text: l }, { adjust: !0 })]);
|
|
break;
|
|
default:
|
|
k = [sre.AuditoryDescription.create({ text: l })];
|
|
}
|
|
k[0] &&
|
|
!n &&
|
|
(m.context &&
|
|
(k[0].context = e.constructString(a, m.context) + (k[0].context || "")),
|
|
m.annotation && (k[0].annotation = m.annotation));
|
|
h.grammar && sre.Grammar.getInstance().popState();
|
|
c = c.concat(this.addPersonality_(k, m, n, a));
|
|
p && ((this.cache_ = q), sre.Engine.getInstance().setDynamicCstr(p));
|
|
}
|
|
this.pushCache_(a, c);
|
|
return c;
|
|
};
|
|
sre.SpeechRuleEngine.prototype.evaluateNodeList_ = function (a, b, c, d, e, f) {
|
|
if (b == []) return [];
|
|
var g = d || "",
|
|
h = f || "";
|
|
d = (d = a.contextFunctions.lookup(e))
|
|
? d(b, h)
|
|
: function () {
|
|
return h;
|
|
};
|
|
a = (a = a.contextFunctions.lookup(c))
|
|
? a(b, g)
|
|
: function () {
|
|
return sre.AuditoryDescription.create({ text: g }, { translate: !0 });
|
|
};
|
|
c = [];
|
|
for (e = 0; (f = b[e]); e++)
|
|
(f = this.evaluateTree_(f)),
|
|
0 < f.length &&
|
|
((f[0].context = d() + (f[0].context || "")),
|
|
(c = c.concat(f)),
|
|
e < b.length - 1 && ((f = a()), (c = c.concat(f))));
|
|
return c;
|
|
};
|
|
sre.SpeechRuleEngine.prototype.addPersonality_ = function (a, b, c, d) {
|
|
var e = {},
|
|
f;
|
|
for (f in sre.Engine.personalityProps) {
|
|
var g = b[sre.Engine.personalityProps[f]];
|
|
if ("undefined" !== typeof g) {
|
|
var h = parseFloat(g);
|
|
e[sre.Engine.personalityProps[f]] = isNaN(h)
|
|
? '"' == g.charAt(0)
|
|
? g.slice(1, -1)
|
|
: g
|
|
: h;
|
|
}
|
|
}
|
|
for (b = 0; (f = a[b]); b++)
|
|
this.addRelativePersonality_(f, e), this.addExternalAttributes_(f, d);
|
|
c &&
|
|
a.length &&
|
|
delete a[a.length - 1].personality[sre.Engine.personalityProps.JOIN];
|
|
return a;
|
|
};
|
|
sre.SpeechRuleEngine.prototype.addExternalAttributes_ = function (a, b) {
|
|
if (b.hasAttributes()) {
|
|
b = b.attributes;
|
|
for (var c = b.length - 1; 0 <= c; c--) {
|
|
var d = b[c].name;
|
|
!a.attributes[d] && d.match(/^ext/) && (a.attributes[d] = b[c].value);
|
|
}
|
|
}
|
|
};
|
|
sre.SpeechRuleEngine.prototype.addRelativePersonality_ = function (a, b) {
|
|
if (!a.personality) return (a.personality = b), a;
|
|
var c = a.personality,
|
|
d;
|
|
for (d in b)
|
|
c[d] =
|
|
c[d] && "number" == typeof c[d] && "number" == typeof b[d]
|
|
? c[d] + b[d]
|
|
: b[d];
|
|
return a;
|
|
};
|
|
sre.SpeechRuleEngine.prototype.toString = function () {
|
|
return this.activeStore_
|
|
.findAllRules(function (a) {
|
|
return !0;
|
|
})
|
|
.map(function (a) {
|
|
return a.toString();
|
|
})
|
|
.join("\n");
|
|
};
|
|
sre.SpeechRuleEngine.debugSpeechRule = function (a, b) {
|
|
var c = sre.SpeechRuleEngine.getInstance().activeStore_;
|
|
c && c.debugSpeechRule(a, b);
|
|
};
|
|
sre.SpeechRuleEngine.debugNamedSpeechRule = function (a, b) {
|
|
var c = sre.SpeechRuleEngine.getInstance().activeStore_;
|
|
if (c)
|
|
for (
|
|
var d = c.findAllRules(function (g) {
|
|
return g.name == a;
|
|
}),
|
|
e = 0,
|
|
f;
|
|
(f = d[e]);
|
|
e++
|
|
)
|
|
sre.Debugger.getInstance().output(
|
|
"Rule",
|
|
a,
|
|
"DynamicCstr:",
|
|
f.dynamicCstr.toString(),
|
|
"number",
|
|
e,
|
|
),
|
|
c.debugSpeechRule(f, b);
|
|
};
|
|
sre.SpeechRuleEngine.prototype.runInSetting = function (a, b) {
|
|
var c = sre.Engine.getInstance(),
|
|
d = {},
|
|
e = null,
|
|
f;
|
|
for (f in a)
|
|
"rules" === f
|
|
? ((e = this.activeStore_),
|
|
(c.ruleSets = a[f]),
|
|
this.parameterize(c.ruleSets))
|
|
: ((d[f] = c[f]), (c[f] = a[f]));
|
|
c.setDynamicCstr();
|
|
a = b();
|
|
for (f in d) c[f] = d[f];
|
|
e && (this.activeStore_ = e);
|
|
c.setDynamicCstr();
|
|
return a;
|
|
};
|
|
sre.SpeechRuleEngine.prototype.combineStores_ = function (a) {
|
|
var b = this.cachedStore_(a);
|
|
if (b) return b;
|
|
b = new sre.MathStore();
|
|
for (var c in a) {
|
|
var d = a[c];
|
|
d.initialize();
|
|
d.getSpeechRules().forEach(function (e) {
|
|
b.trie.addRule(e);
|
|
});
|
|
this.addEvaluator(d);
|
|
}
|
|
b.setSpeechRules(b.trie.collectRules());
|
|
return (this.combinedStores_[this.combinedStoreName_(Object.keys(a))] = b);
|
|
};
|
|
sre.SpeechRuleEngine.prototype.combinedStoreName_ = function (a) {
|
|
return a.sort().join("-");
|
|
};
|
|
sre.SpeechRuleEngine.prototype.cachedStore_ = function (a) {
|
|
var b = Object.keys(a);
|
|
return b.some(function (c) {
|
|
return !a[c].initialized;
|
|
})
|
|
? null
|
|
: this.combinedStores_[this.combinedStoreName_(b)];
|
|
};
|
|
sre.SpeechRuleEngine.prototype.updateEngine = function () {
|
|
this.ready_ = !0;
|
|
var a = sre.MathMap.getInstance();
|
|
sre.Engine.isReady()
|
|
? (sre.Engine.getInstance().evaluator = goog.bind(
|
|
a.store.lookupString,
|
|
a.store,
|
|
))
|
|
: ((this.ready_ = !1), setTimeout(goog.bind(this.updateEngine, this), 250));
|
|
};
|
|
sre.SpeechRuleEngine.prototype.processGrammar = function (a, b, c) {
|
|
var d = {},
|
|
e;
|
|
for (e in c) {
|
|
var f = c[e];
|
|
d[e] = "string" === typeof f ? a.constructString(b, f) : f;
|
|
}
|
|
sre.Grammar.getInstance().pushState(d);
|
|
};
|
|
sre.SpeechRuleEngine.prototype.updateConstraint_ = function () {
|
|
var a = sre.Engine.getInstance().dynamicCstr,
|
|
b = sre.Engine.getInstance().strict,
|
|
c = this.activeStore_.trie,
|
|
d = {},
|
|
e = a.getValue(sre.DynamicCstr.Axis.LOCALE),
|
|
f = a.getValue(sre.DynamicCstr.Axis.MODALITY),
|
|
g = a.getValue(sre.DynamicCstr.Axis.DOMAIN);
|
|
c.hasSubtrie([e, f, g]) ||
|
|
((e = sre.DynamicCstr.DEFAULT_VALUES[sre.DynamicCstr.Axis.LOCALE]),
|
|
c.hasSubtrie([e, f, g]) ||
|
|
((f = sre.DynamicCstr.DEFAULT_VALUES[sre.DynamicCstr.Axis.MODALITY]),
|
|
c.hasSubtrie([e, f, g]) ||
|
|
(g = sre.DynamicCstr.DEFAULT_VALUES[sre.DynamicCstr.Axis.DOMAIN])));
|
|
d[sre.DynamicCstr.Axis.LOCALE] = [e];
|
|
d[sre.DynamicCstr.Axis.MODALITY] = [
|
|
"summary" !== f
|
|
? f
|
|
: sre.DynamicCstr.DEFAULT_VALUES[sre.DynamicCstr.Axis.MODALITY],
|
|
];
|
|
d[sre.DynamicCstr.Axis.DOMAIN] = [
|
|
"speech" !== f
|
|
? sre.DynamicCstr.DEFAULT_VALUES[sre.DynamicCstr.Axis.DOMAIN]
|
|
: g,
|
|
];
|
|
c = a.getOrder();
|
|
for (e = 0; (f = c[e]); e++)
|
|
if (!d[f]) {
|
|
g = a.getValue(f);
|
|
var h = this.makeSet_(g, a.preference),
|
|
k = sre.DynamicCstr.DEFAULT_VALUES[f];
|
|
b || g === k || h.push(k);
|
|
d[f] = h;
|
|
}
|
|
a.updateProperties(d);
|
|
};
|
|
sre.SpeechRuleEngine.prototype.makeSet_ = function (a, b) {
|
|
return b && Object.keys(b).length ? a.split(":") : [a];
|
|
};
|
|
sre.SpeechRuleEngine.prototype.addEvaluator = function (a) {
|
|
var b = goog.bind(a.evaluateDefault, a),
|
|
c = this.evaluators_[a.locale];
|
|
c
|
|
? (c[a.modality] = b)
|
|
: ((c = {}), (c[a.modality] = b), (this.evaluators_[a.locale] = c));
|
|
};
|
|
sre.SpeechRuleEngine.prototype.getEvaluator = function (a, b) {
|
|
return (b = (a = this.evaluators_[a]) ? a[b] : null)
|
|
? b
|
|
: goog.bind(this.activeStore_.evaluateDefault, this.activeStore_);
|
|
};
|
|
sre.SpeechRuleEngine.prototype.enumerate = function (a) {
|
|
return this.activeStore_.trie.enumerate(a);
|
|
};
|
|
sre.SpeechGeneratorUtil = {};
|
|
sre.SpeechGeneratorUtil.computeSpeech = function (a) {
|
|
var b = sre.SpeechRuleEngine.getInstance();
|
|
b.clearCache();
|
|
return b.evaluateNode(a);
|
|
};
|
|
sre.SpeechGeneratorUtil.recomputeSpeech = function (a) {
|
|
a = sre.SemanticTree.fromNode(a);
|
|
return sre.SpeechRuleEngine.getInstance().evaluateNode(a.xml());
|
|
};
|
|
sre.SpeechGeneratorUtil.computeSpeechWithoutCache = function (a) {
|
|
var b = sre.Engine.getInstance().cache;
|
|
sre.Engine.getInstance().cache = !1;
|
|
a = sre.SpeechRuleEngine.getInstance().evaluateNode(a);
|
|
sre.Engine.getInstance().cache = b;
|
|
return a;
|
|
};
|
|
sre.SpeechGeneratorUtil.retrieveSpeech = function (a) {
|
|
var b = null;
|
|
sre.Engine.getInstance().cache &&
|
|
(b = sre.SpeechRuleEngine.getInstance().getCache(a.id.toString()));
|
|
b || (b = sre.SpeechGeneratorUtil.recomputeSpeech(a));
|
|
return sre.AuralRendering.getInstance().markup(b);
|
|
};
|
|
sre.SpeechGeneratorUtil.addSpeech = function (a, b, c) {
|
|
b = sre.SpeechGeneratorUtil.retrieveSpeech(b);
|
|
a.setAttribute(c || sre.EnrichMathml.Attribute.SPEECH, b);
|
|
};
|
|
sre.SpeechGeneratorUtil.addPrefix = function (a, b) {
|
|
(b = sre.SpeechGeneratorUtil.retrievePrefix(b)) &&
|
|
a.setAttribute(sre.EnrichMathml.Attribute.PREFIX, b);
|
|
};
|
|
sre.SpeechGeneratorUtil.retrievePrefix = function (a) {
|
|
a = sre.SpeechGeneratorUtil.computePrefix_(a);
|
|
return sre.AuralRendering.getInstance().markup(a);
|
|
};
|
|
sre.SpeechGeneratorUtil.computePrefix_ = function (a) {
|
|
var b = sre.SemanticTree.fromRoot(a),
|
|
c = sre.XpathUtil.evalXPath('.//*[@id="' + a.id + '"]', b.xml())[0];
|
|
return c
|
|
? sre.SpeechRuleEngine.getInstance().runInSetting(
|
|
{
|
|
modality: "prefix",
|
|
domain: "default",
|
|
style: "default",
|
|
strict: !0,
|
|
cache: !1,
|
|
speech: !0,
|
|
},
|
|
function () {
|
|
return sre.SpeechRuleEngine.getInstance().evaluateNode(c);
|
|
},
|
|
)
|
|
: [];
|
|
};
|
|
sre.SpeechGeneratorUtil.connectMactions = function (a, b, c) {
|
|
b = sre.DomUtil.querySelectorAll(b, "maction");
|
|
for (var d = 0, e; (e = b[d]); d++) {
|
|
var f = e.getAttribute("id");
|
|
if ((f = sre.DomUtil.querySelectorAllByAttrValue(a, "id", f)[0])) {
|
|
var g = e.childNodes[1];
|
|
e = g.getAttribute(sre.EnrichMathml.Attribute.ID);
|
|
var h = sre.WalkerUtil.getBySemanticId(a, e);
|
|
(h && "dummy" !== h.getAttribute(sre.EnrichMathml.Attribute.TYPE)) ||
|
|
((h = f.childNodes[0]),
|
|
h.getAttribute("sre-highlighter-added") ||
|
|
((f = g.getAttribute(sre.EnrichMathml.Attribute.PARENT)) &&
|
|
h.setAttribute(sre.EnrichMathml.Attribute.PARENT, f),
|
|
h.setAttribute(sre.EnrichMathml.Attribute.TYPE, "dummy"),
|
|
h.setAttribute(sre.EnrichMathml.Attribute.ID, e),
|
|
sre.DomUtil.querySelectorAllByAttrValue(c, "id", e)[0].setAttribute(
|
|
"alternative",
|
|
e,
|
|
)));
|
|
}
|
|
}
|
|
};
|
|
sre.SpeechGeneratorUtil.connectAllMactions = function (a, b) {
|
|
a = sre.DomUtil.querySelectorAll(a, "maction");
|
|
for (var c = 0, d; (d = a[c]); c++)
|
|
(d = d.childNodes[1].getAttribute(sre.EnrichMathml.Attribute.ID)),
|
|
sre.DomUtil.querySelectorAllByAttrValue(b, "id", d)[0].setAttribute(
|
|
"alternative",
|
|
d,
|
|
);
|
|
};
|
|
sre.SpeechGeneratorUtil.retrieveSummary = function (a) {
|
|
a = sre.SpeechGeneratorUtil.computeSummary_(a);
|
|
return sre.AuralRendering.getInstance().markup(a);
|
|
};
|
|
sre.SpeechGeneratorUtil.computeSummary_ = function (a) {
|
|
return a
|
|
? sre.SpeechRuleEngine.getInstance().runInSetting(
|
|
{ modality: "summary", strict: !1, cache: !1, speech: !0 },
|
|
function () {
|
|
return sre.SpeechRuleEngine.getInstance().evaluateNode(a);
|
|
},
|
|
)
|
|
: [];
|
|
};
|
|
sre.AbstractSpeechGenerator = function () {
|
|
this.rebuilt_ = null;
|
|
this.options_ = {};
|
|
this.modality = sre.EnrichMathml.addPrefix("speech");
|
|
};
|
|
sre.AbstractSpeechGenerator.prototype.getRebuilt = function () {
|
|
return this.rebuilt_;
|
|
};
|
|
sre.AbstractSpeechGenerator.prototype.setRebuilt = function (a) {
|
|
this.rebuilt_ = a;
|
|
};
|
|
sre.AbstractSpeechGenerator.prototype.setOptions = function (a) {
|
|
this.options_ = a || {};
|
|
this.modality = sre.EnrichMathml.addPrefix(
|
|
this.options_.modality || "speech",
|
|
);
|
|
};
|
|
sre.AbstractSpeechGenerator.prototype.getOptions = function () {
|
|
return this.options_;
|
|
};
|
|
sre.AbstractSpeechGenerator.prototype.getSpeech = goog.abstractMethod;
|
|
sre.AbstractSpeechGenerator.prototype.start = function () {};
|
|
sre.AbstractSpeechGenerator.prototype.end = function () {};
|
|
sre.AbstractSpeechGenerator.prototype.generateSpeech = function (a, b) {
|
|
this.rebuilt_ || (this.rebuilt_ = new sre.RebuildStree(b));
|
|
sre.System.getInstance().setupEngine(this.options_);
|
|
a = sre.SpeechGeneratorUtil.computeSpeech(this.getRebuilt().xml);
|
|
return sre.AuralRendering.getInstance().markup(a);
|
|
};
|
|
sre.AdhocSpeechGenerator = function () {
|
|
sre.AbstractSpeechGenerator.call(this);
|
|
};
|
|
goog.inherits(sre.AdhocSpeechGenerator, sre.AbstractSpeechGenerator);
|
|
sre.AdhocSpeechGenerator.prototype.getSpeech = function (a, b) {
|
|
b = this.generateSpeech(a, b);
|
|
a.setAttribute(this.modality, b);
|
|
return b;
|
|
};
|
|
sre.ColorGenerator = function () {
|
|
sre.AbstractSpeechGenerator.call(this);
|
|
this.modality = sre.EnrichMathml.addPrefix("foreground");
|
|
this.contrast = new sre.ContrastPicker();
|
|
};
|
|
goog.inherits(sre.ColorGenerator, sre.AbstractSpeechGenerator);
|
|
sre.ColorGenerator.prototype.getSpeech = function (a, b) {
|
|
return sre.WalkerUtil.getAttribute(a, this.modality);
|
|
};
|
|
sre.ColorGenerator.prototype.generateSpeech = function (a, b) {
|
|
this.getRebuilt() || this.setRebuilt(new sre.RebuildStree(a));
|
|
this.colorLeaves_(a);
|
|
return sre.WalkerUtil.getAttribute(a, this.modality);
|
|
};
|
|
sre.ColorGenerator.prototype.colorLeaves_ = function (a) {
|
|
var b = this,
|
|
c = [];
|
|
sre.ColorGenerator.visitStree_(this.getRebuilt().streeRoot, c, {});
|
|
var d = {};
|
|
c = $jscomp.makeIterator(c);
|
|
for (
|
|
var e = c.next();
|
|
!e.done;
|
|
d = { $jscomp$loop$prop$color$5: d.$jscomp$loop$prop$color$5 }, e = c.next()
|
|
) {
|
|
e = e.value;
|
|
d.$jscomp$loop$prop$color$5 = this.contrast.generate();
|
|
var f = !1;
|
|
(f = Array.isArray(e)
|
|
? e
|
|
.map(
|
|
(function (g) {
|
|
return function (h) {
|
|
return b.colorLeave_(a, h, g.$jscomp$loop$prop$color$5);
|
|
};
|
|
})(d),
|
|
)
|
|
.reduce(function (g, h) {
|
|
return g || h;
|
|
}, !1)
|
|
: this.colorLeave_(a, e, d.$jscomp$loop$prop$color$5)) &&
|
|
this.contrast.increment();
|
|
}
|
|
};
|
|
sre.ColorGenerator.prototype.colorLeave_ = function (a, b, c) {
|
|
return (a = sre.WalkerUtil.getBySemanticId(a, b))
|
|
? (a.setAttribute(this.modality, c), !0)
|
|
: !1;
|
|
};
|
|
sre.ColorGenerator.visitStree_ = function (a, b, c) {
|
|
if (a.childNodes.length) {
|
|
if (
|
|
(a.contentNodes.length &&
|
|
("punctuated" === a.type &&
|
|
a.contentNodes.forEach(function (h) {
|
|
return (c[h.id] = !0);
|
|
}),
|
|
"implicit" !== a.role &&
|
|
b.push(
|
|
a.contentNodes.map(function (h) {
|
|
return h.id;
|
|
}),
|
|
)),
|
|
a.childNodes.length)
|
|
)
|
|
if ("implicit" === a.role) {
|
|
var d = [],
|
|
e = [];
|
|
a = $jscomp.makeIterator(a.childNodes);
|
|
for (var f = a.next(); !f.done; f = a.next()) {
|
|
var g = [];
|
|
sre.ColorGenerator.visitStree_(f.value, g, c);
|
|
2 >= g.length && d.push(g.shift());
|
|
e = e.concat(g);
|
|
}
|
|
b.push(d);
|
|
e.forEach(function (h) {
|
|
return b.push(h);
|
|
});
|
|
} else
|
|
a.childNodes.forEach(function (h) {
|
|
return sre.ColorGenerator.visitStree_(h, b, c);
|
|
});
|
|
} else c[a.id] || b.push(a.id);
|
|
};
|
|
sre.DirectSpeechGenerator = function () {
|
|
sre.AbstractSpeechGenerator.call(this);
|
|
};
|
|
goog.inherits(sre.DirectSpeechGenerator, sre.AbstractSpeechGenerator);
|
|
sre.DirectSpeechGenerator.prototype.getSpeech = function (a, b) {
|
|
return sre.WalkerUtil.getAttribute(a, this.modality);
|
|
};
|
|
sre.DummySpeechGenerator = function () {
|
|
sre.AbstractSpeechGenerator.call(this);
|
|
};
|
|
goog.inherits(sre.DummySpeechGenerator, sre.AbstractSpeechGenerator);
|
|
sre.DummySpeechGenerator.prototype.getSpeech = function (a, b) {
|
|
return "";
|
|
};
|
|
sre.TreeSpeechGenerator = function () {
|
|
sre.AbstractSpeechGenerator.call(this);
|
|
};
|
|
goog.inherits(sre.TreeSpeechGenerator, sre.AbstractSpeechGenerator);
|
|
sre.TreeSpeechGenerator.prototype.getSpeech = function (a, b) {
|
|
var c = this.generateSpeech(a, b);
|
|
a.setAttribute(this.modality, c);
|
|
var d = this.getRebuilt().nodeDict,
|
|
e;
|
|
for (e in d) {
|
|
var f = d[e],
|
|
g = sre.WalkerUtil.getBySemanticId(b, e),
|
|
h = sre.WalkerUtil.getBySemanticId(a, e);
|
|
g &&
|
|
h &&
|
|
(sre.SpeechGeneratorUtil.addSpeech(h, f, this.modality),
|
|
this.modality === sre.EnrichMathml.Attribute.SPEECH &&
|
|
sre.SpeechGeneratorUtil.addPrefix(h, f));
|
|
}
|
|
return c;
|
|
};
|
|
sre.NodeSpeechGenerator = function () {
|
|
sre.TreeSpeechGenerator.call(this);
|
|
};
|
|
goog.inherits(sre.NodeSpeechGenerator, sre.TreeSpeechGenerator);
|
|
sre.NodeSpeechGenerator.prototype.getSpeech = function (a, b) {
|
|
var c = sre.WalkerUtil.getAttribute(a, this.modality);
|
|
return c ? c : sre.NodeSpeechGenerator.superClass_.getSpeech.call(this, a, b);
|
|
};
|
|
sre.SummarySpeechGenerator = function () {
|
|
sre.AbstractSpeechGenerator.call(this);
|
|
};
|
|
goog.inherits(sre.SummarySpeechGenerator, sre.AbstractSpeechGenerator);
|
|
sre.SummarySpeechGenerator.prototype.getSpeech = function (a, b) {
|
|
sre.SpeechGeneratorUtil.connectAllMactions(b, this.getRebuilt().xml);
|
|
return this.generateSpeech(a, b);
|
|
};
|
|
sre.SpeechGeneratorFactory = {};
|
|
sre.SpeechGeneratorFactory.generator = function (a) {
|
|
return new (
|
|
sre.SpeechGeneratorFactory.generatorMapping_[a] ||
|
|
sre.SpeechGeneratorFactory.generatorMapping_.Direct
|
|
)();
|
|
};
|
|
sre.SpeechGeneratorFactory.generatorMapping_ = {
|
|
Adhoc: sre.AdhocSpeechGenerator,
|
|
Color: sre.ColorGenerator,
|
|
Direct: sre.DirectSpeechGenerator,
|
|
Dummy: sre.DummySpeechGenerator,
|
|
Node: sre.NodeSpeechGenerator,
|
|
Summary: sre.SummarySpeechGenerator,
|
|
Tree: sre.TreeSpeechGenerator,
|
|
};
|
|
sre.EventUtil = {};
|
|
sre.EventUtil.KeyCode = {
|
|
ENTER: 13,
|
|
ESC: 27,
|
|
SPACE: 32,
|
|
PAGE_UP: 33,
|
|
PAGE_DOWN: 34,
|
|
END: 35,
|
|
HOME: 36,
|
|
LEFT: 37,
|
|
UP: 38,
|
|
RIGHT: 39,
|
|
DOWN: 40,
|
|
TAB: 9,
|
|
LESS: 188,
|
|
GREATER: 190,
|
|
DASH: 189,
|
|
0: 48,
|
|
1: 49,
|
|
2: 50,
|
|
3: 51,
|
|
4: 52,
|
|
5: 53,
|
|
6: 54,
|
|
7: 55,
|
|
8: 56,
|
|
9: 57,
|
|
A: 65,
|
|
B: 66,
|
|
C: 67,
|
|
D: 68,
|
|
E: 69,
|
|
F: 70,
|
|
G: 71,
|
|
H: 72,
|
|
I: 73,
|
|
J: 74,
|
|
K: 75,
|
|
L: 76,
|
|
M: 77,
|
|
N: 78,
|
|
O: 79,
|
|
P: 80,
|
|
Q: 81,
|
|
R: 82,
|
|
S: 83,
|
|
T: 84,
|
|
U: 85,
|
|
V: 86,
|
|
W: 87,
|
|
X: 88,
|
|
Y: 89,
|
|
Z: 90,
|
|
};
|
|
sre.EventUtil.Move = (function () {
|
|
var a = {},
|
|
b;
|
|
for (b in sre.EventUtil.KeyCode) a[sre.EventUtil.KeyCode[b]] = b;
|
|
return a;
|
|
})();
|
|
sre.EventUtil.EventType = {
|
|
CLICK: "click",
|
|
DBLCLICK: "dblclick",
|
|
MOUSEDOWN: "mousedown",
|
|
MOUSEUP: "mouseup",
|
|
MOUSEOVER: "mouseover",
|
|
MOUSEOUT: "mouseout",
|
|
MOUSEMOVE: "mousemove",
|
|
SELECTSTART: "selectstart",
|
|
KEYPRESS: "keypress",
|
|
KEYDOWN: "keydown",
|
|
KEYUP: "keyup",
|
|
TOUCHSTART: "touchstart",
|
|
TOUCHMOVE: "touchmove",
|
|
TOUCHEND: "touchend",
|
|
TOUCHCANCEL: "touchcancel",
|
|
};
|
|
sre.EventUtil.Event = function (a, b, c) {
|
|
this.src = a;
|
|
this.type = b;
|
|
this.callback = c;
|
|
};
|
|
sre.EventUtil.Event.prototype.add = function () {
|
|
this.src.addEventListener(this.type, this.callback);
|
|
};
|
|
sre.EventUtil.Event.prototype.remove = function () {
|
|
this.src.removeEventListener(this.type, this.callback);
|
|
};
|
|
sre.Focus = function (a, b) {
|
|
this.semanticNodes_ = a;
|
|
this.semanticPrimary_ = b;
|
|
this.domNodes_ = [];
|
|
this.domPrimary_ = null;
|
|
this.allNodes_ = [];
|
|
};
|
|
sre.Focus.prototype.getSemanticPrimary = function () {
|
|
return this.semanticPrimary_;
|
|
};
|
|
sre.Focus.prototype.getSemanticNodes = function () {
|
|
return this.semanticNodes_;
|
|
};
|
|
sre.Focus.prototype.getNodes = function () {
|
|
return this.allNodes_;
|
|
};
|
|
sre.Focus.prototype.getDomNodes = function () {
|
|
return this.domNodes_;
|
|
};
|
|
sre.Focus.prototype.getDomPrimary = function () {
|
|
return this.domPrimary_;
|
|
};
|
|
sre.Focus.prototype.toString = function () {
|
|
return "Primary:" + this.domPrimary_ + " Nodes:" + this.domNodes_;
|
|
};
|
|
sre.Focus.prototype.clone = function () {
|
|
var a = new sre.Focus(this.semanticNodes_, this.semanticPrimary_);
|
|
a.domNodes_ = this.domNodes_;
|
|
a.domPrimary_ = this.domPrimary_;
|
|
a.allNodes_ = this.allNodes_;
|
|
return a;
|
|
};
|
|
sre.Focus.factory = function (a, b, c, d) {
|
|
var e = function (h) {
|
|
return sre.WalkerUtil.getBySemanticId(d, h);
|
|
},
|
|
f = c.nodeDict;
|
|
c = e(a);
|
|
e = b.map(e);
|
|
var g = b.map(function (h) {
|
|
return f[h];
|
|
});
|
|
a = new sre.Focus(g, f[a]);
|
|
a.domNodes_ = e;
|
|
a.domPrimary_ = c;
|
|
a.allNodes_ = sre.Focus.generateAllVisibleNodes_(b, e, f, d);
|
|
return a;
|
|
};
|
|
sre.Focus.generateAllVisibleNodes_ = function (a, b, c, d) {
|
|
for (
|
|
var e = function (m) {
|
|
return sre.WalkerUtil.getBySemanticId(d, m);
|
|
},
|
|
f = [],
|
|
g = 0,
|
|
h = a.length;
|
|
g < h;
|
|
g++
|
|
)
|
|
if (b[g]) f.push(b[g]);
|
|
else {
|
|
var k = c[a[g]];
|
|
if (k) {
|
|
k = k.childNodes.map(function (m) {
|
|
return m.id.toString();
|
|
});
|
|
var l = k.map(e);
|
|
f = f.concat(sre.Focus.generateAllVisibleNodes_(k, l, c, d));
|
|
}
|
|
}
|
|
return f;
|
|
};
|
|
sre.Levels = function () {
|
|
this.level_ = [];
|
|
};
|
|
sre.Levels.prototype.push = function (a) {
|
|
this.level_.push(a);
|
|
};
|
|
sre.Levels.prototype.pop = function () {
|
|
return this.level_.pop();
|
|
};
|
|
sre.Levels.prototype.peek = function () {
|
|
return this.level_[this.level_.length - 1] || null;
|
|
};
|
|
sre.Levels.prototype.indexOf = function (a) {
|
|
var b = this.peek();
|
|
return b ? b.indexOf(a) : null;
|
|
};
|
|
sre.Levels.prototype.find = function (a) {
|
|
var b = this.peek();
|
|
if (!b) return null;
|
|
for (var c = 0, d = b.length; c < d; c++) if (a(b[c])) return b[c];
|
|
return null;
|
|
};
|
|
sre.Levels.prototype.get = function (a) {
|
|
var b = this.peek();
|
|
return !b || 0 > a || a >= b.length ? null : b[a];
|
|
};
|
|
sre.Levels.prototype.depth = function () {
|
|
return this.level_.length;
|
|
};
|
|
sre.Levels.prototype.clone = function () {
|
|
var a = new sre.Levels();
|
|
a.level_ = this.level_.slice(0);
|
|
return a;
|
|
};
|
|
sre.Levels.prototype.toString = function () {
|
|
for (var a = "", b = 0, c; (c = this.level_[b]); b++)
|
|
a +=
|
|
"\n" +
|
|
c.map(function (d) {
|
|
return d.toString();
|
|
});
|
|
return a;
|
|
};
|
|
sre.Walker = function () {};
|
|
sre.Walker.prototype.isActive = function () {};
|
|
sre.Walker.prototype.activate = function () {};
|
|
sre.Walker.prototype.deactivate = function () {};
|
|
sre.Walker.prototype.speech = function () {};
|
|
sre.Walker.prototype.getXml = function () {};
|
|
sre.Walker.prototype.getRebuilt = function () {};
|
|
sre.Walker.prototype.getFocus = function (a) {};
|
|
sre.Walker.prototype.setFocus = function (a) {};
|
|
sre.Walker.prototype.getDepth = function () {};
|
|
sre.Walker.prototype.move = function (a) {};
|
|
sre.Walker.prototype.update = function (a) {};
|
|
sre.Walker.move = {
|
|
UP: "up",
|
|
DOWN: "down",
|
|
LEFT: "left",
|
|
RIGHT: "right",
|
|
REPEAT: "repeat",
|
|
DEPTH: "depth",
|
|
ENTER: "enter",
|
|
EXPAND: "expand",
|
|
HOME: "home",
|
|
SUMMARY: "summary",
|
|
DETAIL: "detail",
|
|
ROW: "row",
|
|
CELL: "cell",
|
|
};
|
|
sre.Walker.STATE_ = {};
|
|
sre.Walker.resetState = function (a) {
|
|
delete sre.Walker.STATE_[a];
|
|
};
|
|
sre.Walker.setState = function (a, b) {
|
|
sre.Walker.STATE_[a] = b;
|
|
};
|
|
sre.Walker.getState = function (a) {
|
|
return sre.Walker.STATE_[a];
|
|
};
|
|
sre.AbstractWalker = function (a, b, c, d) {
|
|
this.node = a;
|
|
this.node.id
|
|
? (this.id = this.node.id)
|
|
: this.node.hasAttribute(sre.AbstractWalker.SRE_ID_ATTR)
|
|
? (this.id = this.node.getAttribute(sre.AbstractWalker.SRE_ID_ATTR))
|
|
: (this.node.setAttribute(
|
|
sre.AbstractWalker.SRE_ID_ATTR,
|
|
sre.AbstractWalker.ID_COUNTER,
|
|
),
|
|
(this.id = sre.AbstractWalker.ID_COUNTER++));
|
|
this.generator = b;
|
|
this.highlighter = c;
|
|
this.rootNode = sre.WalkerUtil.getSemanticRoot(a);
|
|
this.rootId = this.rootNode.getAttribute(sre.EnrichMathml.Attribute.ID);
|
|
this.xmlString_ = d;
|
|
this.focus_ = this.rebuilt_ = this.xml_ = null;
|
|
this.keyMapping = {};
|
|
this.keyMapping[sre.EventUtil.KeyCode.UP] = goog.bind(this.up, this);
|
|
this.keyMapping[sre.EventUtil.KeyCode.DOWN] = goog.bind(this.down, this);
|
|
this.keyMapping[sre.EventUtil.KeyCode.RIGHT] = goog.bind(this.right, this);
|
|
this.keyMapping[sre.EventUtil.KeyCode.LEFT] = goog.bind(this.left, this);
|
|
this.keyMapping[sre.EventUtil.KeyCode.TAB] = goog.bind(this.repeat, this);
|
|
this.keyMapping[sre.EventUtil.KeyCode.DASH] = goog.bind(this.expand, this);
|
|
this.keyMapping[sre.EventUtil.KeyCode.SPACE] = goog.bind(this.depth, this);
|
|
this.keyMapping[sre.EventUtil.KeyCode.HOME] = goog.bind(this.home, this);
|
|
this.keyMapping[sre.EventUtil.KeyCode.X] = goog.bind(this.summary, this);
|
|
this.keyMapping[sre.EventUtil.KeyCode.Z] = goog.bind(this.detail, this);
|
|
this.keyMapping[sre.EventUtil.KeyCode.V] = goog.bind(this.virtualize, this);
|
|
this.keyMapping[sre.EventUtil.KeyCode.P] = goog.bind(this.previous, this);
|
|
this.keyMapping[sre.EventUtil.KeyCode.U] = goog.bind(this.undo, this);
|
|
this.keyMapping[sre.EventUtil.KeyCode.LESS] = goog.bind(
|
|
this.previousRules,
|
|
this,
|
|
);
|
|
this.keyMapping[sre.EventUtil.KeyCode.GREATER] = goog.bind(
|
|
this.nextRules,
|
|
this,
|
|
);
|
|
this.active_ = !1;
|
|
this.moved = sre.Walker.move.ENTER;
|
|
this.cursors = [];
|
|
};
|
|
sre.AbstractWalker.prototype.getXml = function () {
|
|
this.xml_ || (this.xml_ = sre.DomUtil.parseInput(this.xmlString_));
|
|
return this.xml_;
|
|
};
|
|
sre.AbstractWalker.prototype.getRebuilt = function () {
|
|
this.rebuilt_ || (this.rebuilt_ = this.rebuildStree());
|
|
return this.rebuilt_;
|
|
};
|
|
sre.AbstractWalker.ID_COUNTER = 0;
|
|
sre.AbstractWalker.SRE_ID_ATTR = "sre-explorer-id";
|
|
sre.AbstractWalker.prototype.isActive = function () {
|
|
return this.active_;
|
|
};
|
|
sre.AbstractWalker.prototype.toggleActive_ = function () {
|
|
this.active_ = !this.active_;
|
|
};
|
|
sre.AbstractWalker.prototype.activate = function () {
|
|
this.isActive() || (this.generator.start(), this.toggleActive_());
|
|
};
|
|
sre.AbstractWalker.prototype.deactivate = function () {
|
|
this.isActive() &&
|
|
(sre.Walker.setState(this.id, this.primaryId()),
|
|
this.generator.end(),
|
|
this.toggleActive_());
|
|
};
|
|
sre.AbstractWalker.prototype.getFocus = function (a) {
|
|
this.focus_ ||
|
|
(this.focus_ = sre.Focus.factory(
|
|
this.rootId,
|
|
[this.rootId],
|
|
this.getRebuilt(),
|
|
this.node,
|
|
));
|
|
a && this.updateFocus();
|
|
return this.focus_;
|
|
};
|
|
sre.AbstractWalker.prototype.setFocus = function (a) {
|
|
this.focus_ = a;
|
|
};
|
|
sre.AbstractWalker.prototype.getDepth = function () {
|
|
return this.levels.depth() - 1;
|
|
};
|
|
sre.AbstractWalker.prototype.isSpeech = function () {
|
|
return this.generator.modality === sre.EnrichMathml.Attribute.SPEECH;
|
|
};
|
|
sre.AbstractWalker.prototype.speech = function () {
|
|
var a = this.getFocus().getDomNodes();
|
|
if (!a.length) return "";
|
|
var b = this.specialMove();
|
|
if (null !== b) return b;
|
|
switch (this.moved) {
|
|
case sre.Walker.move.DEPTH:
|
|
return this.depth_();
|
|
case sre.Walker.move.SUMMARY:
|
|
return this.summary_();
|
|
case sre.Walker.move.DETAIL:
|
|
return this.detail_();
|
|
default:
|
|
b = [];
|
|
for (
|
|
var c = this.getFocus().getSemanticNodes(), d = 0, e = a.length;
|
|
d < e;
|
|
d++
|
|
) {
|
|
var f = a[d],
|
|
g = c[d];
|
|
b.push(
|
|
f
|
|
? this.generator.getSpeech(f, this.getXml())
|
|
: sre.SpeechGeneratorUtil.retrieveSpeech(g),
|
|
);
|
|
}
|
|
return this.mergePrefix_(b);
|
|
}
|
|
};
|
|
sre.AbstractWalker.prototype.mergePrefix_ = function (a, b) {
|
|
b = b || [];
|
|
var c = this.isSpeech() ? this.prefix_() : "",
|
|
d = sre.AuralRendering.getInstance();
|
|
c && a.unshift(c);
|
|
return d.finalize(d.merge(b.concat(a)));
|
|
};
|
|
sre.AbstractWalker.prototype.prefix_ = function () {
|
|
var a = this.getFocus().getDomNodes(),
|
|
b = this.getFocus().getSemanticNodes();
|
|
return a[0]
|
|
? sre.WalkerUtil.getAttribute(a[0], sre.EnrichMathml.Attribute.PREFIX)
|
|
: sre.SpeechGeneratorUtil.retrievePrefix(b[0]);
|
|
};
|
|
sre.AbstractWalker.prototype.move = function (a) {
|
|
a = this.keyMapping[a];
|
|
if (!a) return null;
|
|
a = a();
|
|
if (!a || a === this.getFocus()) return !1;
|
|
this.setFocus(a);
|
|
this.moved === sre.Walker.move.HOME && (this.levels = this.initLevels());
|
|
return !0;
|
|
};
|
|
sre.AbstractWalker.prototype.up = function () {
|
|
this.moved = sre.Walker.move.UP;
|
|
return this.getFocus();
|
|
};
|
|
sre.AbstractWalker.prototype.down = function () {
|
|
this.moved = sre.Walker.move.DOWN;
|
|
return this.getFocus();
|
|
};
|
|
sre.AbstractWalker.prototype.left = function () {
|
|
this.moved = sre.Walker.move.LEFT;
|
|
return this.getFocus();
|
|
};
|
|
sre.AbstractWalker.prototype.right = function () {
|
|
this.moved = sre.Walker.move.RIGHT;
|
|
return this.getFocus();
|
|
};
|
|
sre.AbstractWalker.prototype.repeat = function () {
|
|
this.moved = sre.Walker.move.REPEAT;
|
|
return this.getFocus().clone();
|
|
};
|
|
sre.AbstractWalker.prototype.depth = function () {
|
|
this.moved = this.isSpeech() ? sre.Walker.move.DEPTH : sre.Walker.move.REPEAT;
|
|
return this.getFocus().clone();
|
|
};
|
|
sre.AbstractWalker.prototype.depth_ = function () {
|
|
var a = sre.Grammar.getInstance().getParameter("depth");
|
|
sre.Grammar.getInstance().setParameter("depth", !0);
|
|
var b = this.getFocus().getDomPrimary();
|
|
b =
|
|
(this.expandable(b) && [sre.Messages.NAVIGATE.EXPANDABLE]) ||
|
|
(this.collapsible(b) && [sre.Messages.NAVIGATE.COLLAPSIBLE]) ||
|
|
[];
|
|
var c = [
|
|
sre.AuralRendering.getInstance().markup([
|
|
new sre.AuditoryDescription({
|
|
text: sre.Messages.NAVIGATE.LEVEL + " " + this.getDepth(),
|
|
personality: {},
|
|
}),
|
|
]),
|
|
],
|
|
d = this.getFocus().getSemanticNodes();
|
|
d = sre.SpeechGeneratorUtil.retrievePrefix(d[0]);
|
|
var e = sre.AuralRendering.getInstance();
|
|
d && c.push(d);
|
|
sre.Grammar.getInstance().setParameter("depth", a);
|
|
return e.finalize(e.merge(c.concat(b)));
|
|
};
|
|
sre.AbstractWalker.prototype.home = function () {
|
|
this.moved = sre.Walker.move.HOME;
|
|
return sre.Focus.factory(
|
|
this.rootId,
|
|
[this.rootId],
|
|
this.getRebuilt(),
|
|
this.node,
|
|
);
|
|
};
|
|
sre.AbstractWalker.prototype.getBySemanticId = function (a) {
|
|
return sre.WalkerUtil.getBySemanticId(this.node, a);
|
|
};
|
|
sre.AbstractWalker.prototype.primaryId = function () {
|
|
return this.getFocus().getSemanticPrimary().id.toString();
|
|
};
|
|
sre.AbstractWalker.prototype.expand = function () {
|
|
var a = this.getFocus().getDomPrimary();
|
|
a = this.actionable_(a);
|
|
if (!a) return this.getFocus();
|
|
this.moved = sre.Walker.move.EXPAND;
|
|
a.dispatchEvent(new Event("click"));
|
|
return this.getFocus().clone();
|
|
};
|
|
sre.AbstractWalker.prototype.actionable_ = function (a) {
|
|
return a && a.parentNode && this.highlighter.isMactionNode(a.parentNode)
|
|
? a.parentNode
|
|
: null;
|
|
};
|
|
sre.AbstractWalker.prototype.expandable = function (a) {
|
|
return !!this.actionable_(a) && 0 === a.childNodes.length;
|
|
};
|
|
sre.AbstractWalker.prototype.collapsible = function (a) {
|
|
return !!this.actionable_(a) && 0 < a.childNodes.length;
|
|
};
|
|
sre.AbstractWalker.prototype.restoreState = function () {
|
|
if (this.highlighter) {
|
|
var a = sre.Walker.getState(this.id);
|
|
if (a) {
|
|
var b = this.getRebuilt().nodeDict[a];
|
|
for (a = []; b; ) a.push(b.id), (b = b.parent);
|
|
for (a.pop(); 0 < a.length; ) {
|
|
this.down();
|
|
b = a.pop();
|
|
b = this.findFocusOnLevel(b);
|
|
if (!b) break;
|
|
this.setFocus(b);
|
|
}
|
|
this.moved = sre.Walker.move.ENTER;
|
|
}
|
|
}
|
|
};
|
|
sre.AbstractWalker.prototype.updateFocus = function () {
|
|
this.setFocus(
|
|
sre.Focus.factory(
|
|
this.getFocus().getSemanticPrimary().id.toString(),
|
|
this.getFocus()
|
|
.getSemanticNodes()
|
|
.map(function (a) {
|
|
return a.id;
|
|
}),
|
|
this.getRebuilt(),
|
|
this.node,
|
|
),
|
|
);
|
|
};
|
|
sre.AbstractWalker.prototype.findFocusOnLevel = goog.abstractMethod;
|
|
sre.AbstractWalker.prototype.initLevels = goog.abstractMethod;
|
|
sre.AbstractWalker.prototype.rebuildStree = function () {
|
|
var a = new sre.RebuildStree(this.getXml());
|
|
this.rootId = a.stree.root.id.toString();
|
|
this.generator.setRebuilt(a);
|
|
this.focus_ = sre.Focus.factory(this.rootId, [this.rootId], a, this.node);
|
|
this.levels = this.initLevels();
|
|
sre.SpeechGeneratorUtil.connectMactions(this.node, this.getXml(), a.xml);
|
|
return a;
|
|
};
|
|
sre.AbstractWalker.prototype.previousLevel = function () {
|
|
var a = this.getFocus().getDomPrimary();
|
|
return a
|
|
? sre.WalkerUtil.getAttribute(a, sre.EnrichMathml.Attribute.PARENT)
|
|
: this.getFocus().getSemanticPrimary().parent.id.toString();
|
|
};
|
|
sre.AbstractWalker.prototype.nextLevel = function () {
|
|
var a = this.getFocus().getDomPrimary();
|
|
if (a) {
|
|
var b = sre.WalkerUtil.splitAttribute(
|
|
sre.WalkerUtil.getAttribute(a, sre.EnrichMathml.Attribute.CHILDREN),
|
|
),
|
|
c = sre.WalkerUtil.splitAttribute(
|
|
sre.WalkerUtil.getAttribute(a, sre.EnrichMathml.Attribute.CONTENT),
|
|
),
|
|
d = sre.WalkerUtil.getAttribute(a, sre.EnrichMathml.Attribute.TYPE);
|
|
a = sre.WalkerUtil.getAttribute(a, sre.EnrichMathml.Attribute.ROLE);
|
|
return this.combineContentChildren(d, a, c, b);
|
|
}
|
|
c = function (e) {
|
|
return e.id.toString();
|
|
};
|
|
d = this.getRebuilt().nodeDict[this.primaryId()];
|
|
b = d.childNodes.map(c);
|
|
c = d.contentNodes.map(c);
|
|
return 0 === b.length
|
|
? []
|
|
: this.combineContentChildren(d.type, d.role, c, b);
|
|
};
|
|
sre.AbstractWalker.prototype.combineContentChildren = goog.abstractMethod;
|
|
sre.AbstractWalker.prototype.singletonFocus = function (a) {
|
|
return this.focusFromId(a, [a]);
|
|
};
|
|
sre.AbstractWalker.prototype.focusFromId = function (a, b) {
|
|
return sre.Focus.factory(a, b, this.getRebuilt(), this.node);
|
|
};
|
|
sre.AbstractWalker.prototype.summary = function () {
|
|
this.moved = this.isSpeech()
|
|
? sre.Walker.move.SUMMARY
|
|
: sre.Walker.move.REPEAT;
|
|
return this.getFocus().clone();
|
|
};
|
|
sre.AbstractWalker.prototype.summary_ = function () {
|
|
var a = this.getFocus().getSemanticPrimary().id.toString();
|
|
a =
|
|
this.getRebuilt().xml.getAttribute("id") === a
|
|
? this.getRebuilt().xml
|
|
: sre.DomUtil.querySelectorAllByAttrValue(
|
|
this.getRebuilt().xml,
|
|
"id",
|
|
a,
|
|
)[0];
|
|
a = sre.SpeechGeneratorUtil.retrieveSummary(a);
|
|
return this.mergePrefix_([a]);
|
|
};
|
|
sre.AbstractWalker.prototype.detail = function () {
|
|
this.moved = this.isSpeech()
|
|
? sre.Walker.move.DETAIL
|
|
: sre.Walker.move.REPEAT;
|
|
return this.getFocus().clone();
|
|
};
|
|
sre.AbstractWalker.prototype.detail_ = function () {
|
|
var a = this.getFocus().getSemanticPrimary().id.toString();
|
|
a =
|
|
this.getRebuilt().xml.getAttribute("id") === a
|
|
? this.getRebuilt().xml
|
|
: sre.DomUtil.querySelectorAllByAttrValue(
|
|
this.getRebuilt().xml,
|
|
"id",
|
|
a,
|
|
)[0];
|
|
var b = a.getAttribute("alternative");
|
|
a.removeAttribute("alternative");
|
|
var c = sre.SpeechGeneratorUtil.computeSpeechWithoutCache(a);
|
|
c = sre.AuralRendering.getInstance().markup(c);
|
|
c = this.mergePrefix_([c]);
|
|
a.setAttribute("alternative", b);
|
|
return c;
|
|
};
|
|
sre.AbstractWalker.prototype.specialMove = function () {
|
|
return null;
|
|
};
|
|
sre.AbstractWalker.prototype.virtualize = function (a) {
|
|
this.cursors.push({
|
|
focus: this.getFocus(),
|
|
levels: this.levels,
|
|
undo: a || !this.cursors.length,
|
|
});
|
|
this.levels = this.levels.clone();
|
|
return this.getFocus().clone();
|
|
};
|
|
sre.AbstractWalker.prototype.previous = function () {
|
|
var a = this.cursors.pop();
|
|
if (!a) return this.getFocus();
|
|
this.levels = a.levels;
|
|
return a.focus;
|
|
};
|
|
sre.AbstractWalker.prototype.undo = function () {
|
|
do var a = this.cursors.pop();
|
|
while (a && !a.undo);
|
|
if (!a) return this.getFocus();
|
|
this.levels = a.levels;
|
|
return a.focus;
|
|
};
|
|
sre.AbstractWalker.prototype.update = function (a) {
|
|
this.generator.setOptions(a);
|
|
sre.System.getInstance().setupEngine(a);
|
|
sre.SpeechGeneratorFactory.generator("Tree").getSpeech(
|
|
this.node,
|
|
this.getXml(),
|
|
);
|
|
};
|
|
sre.AbstractWalker.prototype.nextRules = function () {
|
|
var a = this.generator.getOptions();
|
|
if ("speech" !== a.modality) return this.getFocus();
|
|
sre.Engine.DOMAIN_TO_STYLES[a.domain] = a.style;
|
|
a.domain = "mathspeak" === a.domain ? "clearspeak" : "mathspeak";
|
|
a.style = sre.Engine.DOMAIN_TO_STYLES[a.domain];
|
|
this.update(a);
|
|
this.moved = sre.Walker.move.REPEAT;
|
|
return this.getFocus().clone();
|
|
};
|
|
sre.AbstractWalker.prototype.nextStyle = function (a, b) {
|
|
if ("mathspeak" === a) {
|
|
a = ["default", "brief", "sbrief"];
|
|
var c = a.indexOf(b);
|
|
return -1 === c ? b : c >= a.length - 1 ? a[0] : a[c + 1];
|
|
}
|
|
if ("clearspeak" === a) {
|
|
var d = sre.ClearspeakPreferences.getLocalePreferences().en;
|
|
if (!d) return "default";
|
|
a = sre.ClearspeakPreferences.relevantPreferences(
|
|
this.getFocus().getSemanticPrimary(),
|
|
);
|
|
c = sre.ClearspeakPreferences.findPreference(b, a);
|
|
d = d[a].map(function (e) {
|
|
return e.split("_")[1];
|
|
});
|
|
c = d.indexOf(c);
|
|
return -1 === c
|
|
? b
|
|
: sre.ClearspeakPreferences.addPreference(
|
|
b,
|
|
a,
|
|
c >= d.length - 1 ? d[0] : d[c + 1],
|
|
);
|
|
}
|
|
return b;
|
|
};
|
|
sre.AbstractWalker.prototype.previousRules = function () {
|
|
var a = this.generator.getOptions();
|
|
if ("speech" !== a.modality) return this.getFocus();
|
|
a.style = this.nextStyle(a.domain, a.style);
|
|
this.update(a);
|
|
this.moved = sre.Walker.move.REPEAT;
|
|
return this.getFocus().clone();
|
|
};
|
|
sre.DummyWalker = function (a, b, c, d) {
|
|
sre.AbstractWalker.call(this, a, b, c, d);
|
|
};
|
|
goog.inherits(sre.DummyWalker, sre.AbstractWalker);
|
|
sre.DummyWalker.prototype.up = function () {};
|
|
sre.DummyWalker.prototype.down = function () {};
|
|
sre.DummyWalker.prototype.left = function () {};
|
|
sre.DummyWalker.prototype.right = function () {};
|
|
sre.DummyWalker.prototype.repeat = function () {};
|
|
sre.DummyWalker.prototype.depth = function () {};
|
|
sre.DummyWalker.prototype.home = function () {};
|
|
sre.DummyWalker.prototype.getDepth = function () {
|
|
return 0;
|
|
};
|
|
sre.DummyWalker.prototype.initLevels = function () {};
|
|
sre.SemanticWalker = function (a, b, c, d) {
|
|
sre.AbstractWalker.call(this, a, b, c, d);
|
|
this.levels = null;
|
|
this.restoreState();
|
|
};
|
|
goog.inherits(sre.SemanticWalker, sre.AbstractWalker);
|
|
sre.SemanticWalker.prototype.initLevels = function () {
|
|
var a = new sre.Levels();
|
|
a.push([this.getFocus()]);
|
|
return a;
|
|
};
|
|
sre.SemanticWalker.prototype.up = function () {
|
|
sre.SemanticWalker.superClass_.up.call(this);
|
|
var a = this.previousLevel();
|
|
if (!a) return null;
|
|
this.levels.pop();
|
|
return this.levels.find(function (b) {
|
|
return b.getSemanticNodes().some(function (c) {
|
|
return c.id.toString() === a;
|
|
});
|
|
});
|
|
};
|
|
sre.SemanticWalker.prototype.down = function () {
|
|
sre.SemanticWalker.superClass_.down.call(this);
|
|
var a = this.nextLevel();
|
|
if (0 === a.length) return null;
|
|
this.levels.push(a);
|
|
return a[0];
|
|
};
|
|
sre.SemanticWalker.prototype.combineContentChildren = function (a, b, c, d) {
|
|
switch (a) {
|
|
case sre.SemanticAttr.Type.RELSEQ:
|
|
case sre.SemanticAttr.Type.INFIXOP:
|
|
case sre.SemanticAttr.Type.MULTIREL:
|
|
return this.makePairList(d, c);
|
|
case sre.SemanticAttr.Type.PREFIXOP:
|
|
return [this.focusFromId(d[0], c.concat(d))];
|
|
case sre.SemanticAttr.Type.POSTFIXOP:
|
|
return [this.focusFromId(d[0], d.concat(c))];
|
|
case sre.SemanticAttr.Type.MATRIX:
|
|
case sre.SemanticAttr.Type.VECTOR:
|
|
case sre.SemanticAttr.Type.FENCED:
|
|
return [this.focusFromId(d[0], [c[0], d[0], c[1]])];
|
|
case sre.SemanticAttr.Type.CASES:
|
|
return [this.focusFromId(d[0], [c[0], d[0]])];
|
|
case sre.SemanticAttr.Type.PUNCTUATED:
|
|
return b === sre.SemanticAttr.Role.TEXT
|
|
? d.map(goog.bind(this.singletonFocus, this))
|
|
: d.length === c.length
|
|
? c.map(goog.bind(this.singletonFocus, this))
|
|
: this.combinePunctuations(d, c, [], []);
|
|
case sre.SemanticAttr.Type.APPL:
|
|
return [this.focusFromId(d[0], [d[0], c[0]]), this.singletonFocus(d[1])];
|
|
case sre.SemanticAttr.Type.ROOT:
|
|
return [this.singletonFocus(d[1]), this.singletonFocus(d[0])];
|
|
default:
|
|
return d.map(goog.bind(this.singletonFocus, this));
|
|
}
|
|
};
|
|
sre.SemanticWalker.prototype.combinePunctuations = function (a, b, c, d) {
|
|
if (0 === a.length) return d;
|
|
var e = a.shift(),
|
|
f = b.shift();
|
|
if (e === f) return c.push(f), this.combinePunctuations(a, b, c, d);
|
|
b.unshift(f);
|
|
c.push(e);
|
|
if (a.length === b.length) return d.push(this.focusFromId(e, c.concat(b))), d;
|
|
d.push(this.focusFromId(e, c));
|
|
return this.combinePunctuations(a, b, [], d);
|
|
};
|
|
sre.SemanticWalker.prototype.makePairList = function (a, b) {
|
|
if (0 === a.length) return [];
|
|
if (1 === a.length) return [this.singletonFocus(a[0])];
|
|
for (
|
|
var c = [this.singletonFocus(a.shift())], d = 0, e = a.length;
|
|
d < e;
|
|
d++
|
|
)
|
|
c.push(this.focusFromId(a[d], [b[d], a[d]]));
|
|
return c;
|
|
};
|
|
sre.SemanticWalker.prototype.left = function () {
|
|
sre.SemanticWalker.superClass_.left.call(this);
|
|
var a = this.levels.indexOf(this.getFocus());
|
|
return null === a ? null : (a = this.levels.get(a - 1)) ? a : null;
|
|
};
|
|
sre.SemanticWalker.prototype.right = function () {
|
|
sre.SemanticWalker.superClass_.right.call(this);
|
|
var a = this.levels.indexOf(this.getFocus());
|
|
return null === a ? null : (a = this.levels.get(a + 1)) ? a : null;
|
|
};
|
|
sre.SemanticWalker.prototype.findFocusOnLevel = function (a) {
|
|
return this.levels.find(function (b) {
|
|
return b.getSemanticPrimary().id === a;
|
|
});
|
|
};
|
|
sre.SyntaxWalker = function (a, b, c, d) {
|
|
sre.AbstractWalker.call(this, a, b, c, d);
|
|
this.levels = null;
|
|
this.restoreState();
|
|
};
|
|
goog.inherits(sre.SyntaxWalker, sre.AbstractWalker);
|
|
sre.SyntaxWalker.prototype.initLevels = function () {
|
|
var a = new sre.Levels();
|
|
a.push([this.primaryId()]);
|
|
return a;
|
|
};
|
|
sre.SyntaxWalker.prototype.up = function () {
|
|
sre.SyntaxWalker.superClass_.up.call(this);
|
|
var a = this.previousLevel();
|
|
if (!a) return null;
|
|
this.levels.pop();
|
|
return this.singletonFocus(a);
|
|
};
|
|
sre.SyntaxWalker.prototype.down = function () {
|
|
sre.SyntaxWalker.superClass_.down.call(this);
|
|
var a = this.nextLevel();
|
|
if (0 === a.length) return null;
|
|
var b = this.singletonFocus(a[0]);
|
|
b && this.levels.push(a);
|
|
return b;
|
|
};
|
|
sre.SyntaxWalker.prototype.combineContentChildren = function (a, b, c, d) {
|
|
switch (a) {
|
|
case sre.SemanticAttr.Type.RELSEQ:
|
|
case sre.SemanticAttr.Type.INFIXOP:
|
|
case sre.SemanticAttr.Type.MULTIREL:
|
|
return sre.BaseUtil.interleaveLists(d, c);
|
|
case sre.SemanticAttr.Type.PREFIXOP:
|
|
return c.concat(d);
|
|
case sre.SemanticAttr.Type.POSTFIXOP:
|
|
return d.concat(c);
|
|
case sre.SemanticAttr.Type.MATRIX:
|
|
case sre.SemanticAttr.Type.VECTOR:
|
|
case sre.SemanticAttr.Type.FENCED:
|
|
return d.unshift(c[0]), d.push(c[1]), d;
|
|
case sre.SemanticAttr.Type.CASES:
|
|
return d.unshift(c[0]), d;
|
|
case sre.SemanticAttr.Type.PUNCTUATED:
|
|
return b === sre.SemanticAttr.Role.TEXT
|
|
? sre.BaseUtil.interleaveLists(d, c)
|
|
: d;
|
|
case sre.SemanticAttr.Type.APPL:
|
|
return [d[0], c[0], d[1]];
|
|
case sre.SemanticAttr.Type.ROOT:
|
|
return [d[1], d[0]];
|
|
default:
|
|
return d;
|
|
}
|
|
};
|
|
sre.SyntaxWalker.prototype.left = function () {
|
|
sre.SyntaxWalker.superClass_.left.call(this);
|
|
var a = this.levels.indexOf(this.primaryId());
|
|
return null === a
|
|
? null
|
|
: (a = this.levels.get(a - 1))
|
|
? this.singletonFocus(a)
|
|
: null;
|
|
};
|
|
sre.SyntaxWalker.prototype.right = function () {
|
|
sre.SyntaxWalker.superClass_.right.call(this);
|
|
var a = this.levels.indexOf(this.primaryId());
|
|
return null === a
|
|
? null
|
|
: (a = this.levels.get(a + 1))
|
|
? this.singletonFocus(a)
|
|
: null;
|
|
};
|
|
sre.SyntaxWalker.prototype.findFocusOnLevel = function (a) {
|
|
return this.singletonFocus(a.toString());
|
|
};
|
|
sre.TableWalker = function (a, b, c, d) {
|
|
sre.SyntaxWalker.call(this, a, b, c, d);
|
|
this.modifier = !1;
|
|
this.keyMapping[sre.EventUtil.KeyCode["0"]] = goog.bind(this.jumpCell, this);
|
|
this.keyMapping[sre.EventUtil.KeyCode["1"]] = goog.bind(this.jumpCell, this);
|
|
this.keyMapping[sre.EventUtil.KeyCode["2"]] = goog.bind(this.jumpCell, this);
|
|
this.keyMapping[sre.EventUtil.KeyCode["3"]] = goog.bind(this.jumpCell, this);
|
|
this.keyMapping[sre.EventUtil.KeyCode["4"]] = goog.bind(this.jumpCell, this);
|
|
this.keyMapping[sre.EventUtil.KeyCode["5"]] = goog.bind(this.jumpCell, this);
|
|
this.keyMapping[sre.EventUtil.KeyCode["6"]] = goog.bind(this.jumpCell, this);
|
|
this.keyMapping[sre.EventUtil.KeyCode["7"]] = goog.bind(this.jumpCell, this);
|
|
this.keyMapping[sre.EventUtil.KeyCode["8"]] = goog.bind(this.jumpCell, this);
|
|
this.keyMapping[sre.EventUtil.KeyCode["9"]] = goog.bind(this.jumpCell, this);
|
|
this.key_ = null;
|
|
this.row_ = 0;
|
|
this.firstJump = this.currentTable_ = null;
|
|
};
|
|
goog.inherits(sre.TableWalker, sre.SyntaxWalker);
|
|
sre.TableWalker.prototype.move = function (a) {
|
|
this.key_ = a;
|
|
a = sre.TableWalker.superClass_.move.call(this, a);
|
|
this.modifier = !1;
|
|
return a;
|
|
};
|
|
sre.TableWalker.prototype.up = function () {
|
|
this.moved = sre.Walker.move.UP;
|
|
return this.eligibleCell_()
|
|
? this.verticalMove_(!1)
|
|
: sre.TableWalker.superClass_.up.call(this);
|
|
};
|
|
sre.TableWalker.prototype.down = function () {
|
|
this.moved = sre.Walker.move.DOWN;
|
|
return this.eligibleCell_()
|
|
? this.verticalMove_(!0)
|
|
: sre.TableWalker.superClass_.down.call(this);
|
|
};
|
|
sre.TableWalker.ELIGIBLE_CELL_ROLES = [
|
|
sre.SemanticAttr.Role.DETERMINANT,
|
|
sre.SemanticAttr.Role.ROWVECTOR,
|
|
sre.SemanticAttr.Role.BINOMIAL,
|
|
sre.SemanticAttr.Role.SQUAREMATRIX,
|
|
sre.SemanticAttr.Role.MULTILINE,
|
|
sre.SemanticAttr.Role.MATRIX,
|
|
sre.SemanticAttr.Role.VECTOR,
|
|
sre.SemanticAttr.Role.CASES,
|
|
sre.SemanticAttr.Role.TABLE,
|
|
];
|
|
sre.TableWalker.ELIGIBLE_TABLE_TYPES = [
|
|
sre.SemanticAttr.Type.MULTILINE,
|
|
sre.SemanticAttr.Type.MATRIX,
|
|
sre.SemanticAttr.Type.VECTOR,
|
|
sre.SemanticAttr.Type.CASES,
|
|
sre.SemanticAttr.Type.TABLE,
|
|
];
|
|
sre.TableWalker.prototype.eligibleCell_ = function () {
|
|
var a = this.getFocus().getSemanticPrimary();
|
|
return (
|
|
this.modifier &&
|
|
a.type === sre.SemanticAttr.Type.CELL &&
|
|
-1 !== sre.TableWalker.ELIGIBLE_CELL_ROLES.indexOf(a.role)
|
|
);
|
|
};
|
|
sre.TableWalker.prototype.verticalMove_ = function (a) {
|
|
var b = this.previousLevel();
|
|
if (!b) return null;
|
|
var c = this.getFocus(),
|
|
d = this.levels.indexOf(this.primaryId()),
|
|
e = this.levels.pop();
|
|
b = this.levels.indexOf(b);
|
|
a = this.levels.get(a ? b + 1 : b - 1);
|
|
if (!a) return this.levels.push(e), null;
|
|
this.setFocus(this.singletonFocus(a));
|
|
a = this.nextLevel();
|
|
if (!a[d]) return this.setFocus(c), this.levels.push(e), null;
|
|
this.levels.push(a);
|
|
return this.singletonFocus(a[d]);
|
|
};
|
|
sre.TableWalker.prototype.jumpCell = function () {
|
|
if (!this.isInTable_() || null === this.key_) return this.getFocus();
|
|
if (this.moved === sre.Walker.move.ROW) {
|
|
this.moved = sre.Walker.move.CELL;
|
|
var a = this.key_ - sre.EventUtil.KeyCode["0"];
|
|
return this.isLegalJump_(this.row_, a)
|
|
? this.jumpCell_(this.row_, a)
|
|
: this.getFocus();
|
|
}
|
|
a = this.key_ - sre.EventUtil.KeyCode["0"];
|
|
if (a > this.currentTable_.childNodes.length) return this.getFocus();
|
|
this.row_ = a;
|
|
this.moved = sre.Walker.move.ROW;
|
|
return this.getFocus().clone();
|
|
};
|
|
sre.TableWalker.prototype.jumpCell_ = function (a, b) {
|
|
this.firstJump
|
|
? this.virtualize(!1)
|
|
: ((this.firstJump = this.getFocus()), this.virtualize(!0));
|
|
var c = this.currentTable_.id.toString();
|
|
do var d = this.levels.pop();
|
|
while (-1 === d.indexOf(c));
|
|
this.levels.push(d);
|
|
this.setFocus(this.singletonFocus(c));
|
|
this.levels.push(this.nextLevel());
|
|
a = this.currentTable_.childNodes[a - 1];
|
|
this.setFocus(this.singletonFocus(a.id.toString()));
|
|
this.levels.push(this.nextLevel());
|
|
return this.singletonFocus(a.childNodes[b - 1].id.toString());
|
|
};
|
|
sre.TableWalker.prototype.isLegalJump_ = function (a, b) {
|
|
var c = sre.DomUtil.querySelectorAllByAttrValue(
|
|
this.getRebuilt().xml,
|
|
"id",
|
|
this.currentTable_.id.toString(),
|
|
)[0];
|
|
if (!c || c.hasAttribute("alternative")) return !1;
|
|
a = this.currentTable_.childNodes[a - 1];
|
|
if (!a) return !1;
|
|
c = sre.DomUtil.querySelectorAllByAttrValue(c, "id", a.id.toString())[0];
|
|
return !c || c.hasAttribute("alternative")
|
|
? !1
|
|
: !(!a || !a.childNodes[b - 1]);
|
|
};
|
|
sre.TableWalker.prototype.isInTable_ = function () {
|
|
for (var a = this.getFocus().getSemanticPrimary(); a; ) {
|
|
if (-1 !== sre.TableWalker.ELIGIBLE_TABLE_TYPES.indexOf(a.type))
|
|
return (this.currentTable_ = a), !0;
|
|
a = a.parent;
|
|
}
|
|
return !1;
|
|
};
|
|
sre.TableWalker.prototype.undo = function () {
|
|
var a = sre.TableWalker.superClass_.undo.call(this);
|
|
a === this.firstJump && (this.firstJump = null);
|
|
return a;
|
|
};
|
|
sre.WalkerFactory = {};
|
|
sre.WalkerFactory.walker = function (a, b, c, d, e) {
|
|
return new (
|
|
sre.WalkerFactory.walkerMapping_[a.toLowerCase()] ||
|
|
sre.WalkerFactory.walkerMapping_.dummy
|
|
)(b, c, d, e);
|
|
};
|
|
sre.WalkerFactory.walkerMapping_ = {
|
|
dummy: sre.DummyWalker,
|
|
semantic: sre.SemanticWalker,
|
|
syntax: sre.SyntaxWalker,
|
|
table: sre.TableWalker,
|
|
};
|
|
sre.ProcessorFactory = {};
|
|
sre.ProcessorFactory.PROCESSORS_ = {};
|
|
sre.ProcessorFactory.get_ = function (a) {
|
|
var b = sre.ProcessorFactory.PROCESSORS_[a.toLowerCase()];
|
|
if (!b) throw new sre.Engine.Error("Unknown processor " + a);
|
|
return b;
|
|
};
|
|
sre.ProcessorFactory.process = function (a, b) {
|
|
return sre.ProcessorFactory.get_(a).processor(b);
|
|
};
|
|
sre.ProcessorFactory.print = function (a, b) {
|
|
a = sre.ProcessorFactory.get_(a);
|
|
return sre.Engine.getInstance().pprint ? a.pprint(b) : a.print(b);
|
|
};
|
|
sre.ProcessorFactory.output = function (a, b) {
|
|
a = sre.ProcessorFactory.get_(a);
|
|
b = a.processor(b);
|
|
return sre.Engine.getInstance().pprint ? a.pprint(b) : a.print(b);
|
|
};
|
|
sre.ProcessorFactory.keypress = function (a, b) {
|
|
a = sre.ProcessorFactory.get_(a);
|
|
b = a.key ? a.key(b) : b;
|
|
b = a.processor(b);
|
|
return sre.Engine.getInstance().pprint ? a.pprint(b) : a.print(b);
|
|
};
|
|
sre.Processor = function (a, b) {
|
|
this.name = a;
|
|
this.processor = b.processor;
|
|
this.print = b.print || sre.Processor.stringify_;
|
|
this.pprint = b.pprint || this.print;
|
|
sre.ProcessorFactory.PROCESSORS_[this.name] = this;
|
|
};
|
|
sre.KeyProcessor = function (a, b) {
|
|
sre.Processor.call(this, a, b);
|
|
this.key = b.key || sre.KeyProcessor.getKey_;
|
|
};
|
|
goog.inherits(sre.KeyProcessor, sre.Processor);
|
|
sre.KeyProcessor.getKey_ = function (a) {
|
|
return "string" === typeof a ? sre.EventUtil.KeyCode[a.toUpperCase()] : a;
|
|
};
|
|
sre.Processor.LocalState_ = {
|
|
walker: null,
|
|
speechGenerator: null,
|
|
highlighter: null,
|
|
};
|
|
sre.Processor.stringify_ = function (a) {
|
|
return a ? a.toString() : a;
|
|
};
|
|
new sre.Processor("semantic", {
|
|
processor: function (a) {
|
|
a = sre.DomUtil.parseInput(a);
|
|
return sre.Semantic.xmlTree(a);
|
|
},
|
|
pprint: function (a) {
|
|
return sre.DomUtil.formatXml(a.toString());
|
|
},
|
|
});
|
|
new sre.Processor("speech", {
|
|
processor: function (a) {
|
|
a = sre.DomUtil.parseInput(a);
|
|
a = sre.Semantic.xmlTree(a);
|
|
a = sre.SpeechGeneratorUtil.computeSpeech(a);
|
|
var b = sre.AuralRendering.getInstance();
|
|
return b.finalize(b.markup(a));
|
|
},
|
|
pprint: function (a) {
|
|
a = a.toString();
|
|
return sre.AuralRendering.ofType(sre.XmlRenderer)
|
|
? sre.DomUtil.formatXml(a)
|
|
: a;
|
|
},
|
|
});
|
|
new sre.Processor("json", {
|
|
processor: function (a) {
|
|
a = sre.DomUtil.parseInput(a, sre.Engine.Error);
|
|
return sre.Semantic.getTree(a).toJson();
|
|
},
|
|
print: function (a) {
|
|
return JSON.stringify(a);
|
|
},
|
|
pprint: function (a) {
|
|
return JSON.stringify(a, null, 2);
|
|
},
|
|
});
|
|
new sre.Processor("description", {
|
|
processor: function (a) {
|
|
a = sre.DomUtil.parseInput(a);
|
|
a = sre.Semantic.xmlTree(a);
|
|
return sre.SpeechGeneratorUtil.computeSpeech(a);
|
|
},
|
|
print: function (a) {
|
|
return JSON.stringify(a);
|
|
},
|
|
pprint: function (a) {
|
|
return JSON.stringify(a, null, 2);
|
|
},
|
|
});
|
|
new sre.Processor("enriched", {
|
|
processor: function (a) {
|
|
a = sre.Enrich.semanticMathmlSync(a);
|
|
var b = sre.WalkerUtil.getSemanticRoot(a);
|
|
switch (sre.Engine.getInstance().speech) {
|
|
case sre.Engine.Speech.SHALLOW:
|
|
var c = sre.SpeechGeneratorFactory.generator("Adhoc");
|
|
c.getSpeech(b, a);
|
|
break;
|
|
case sre.Engine.Speech.DEEP:
|
|
(c = sre.SpeechGeneratorFactory.generator("Tree")), c.getSpeech(b, a);
|
|
}
|
|
return a;
|
|
},
|
|
pprint: function (a) {
|
|
return sre.DomUtil.formatXml(a.toString());
|
|
},
|
|
});
|
|
new sre.Processor("walker", {
|
|
processor: function (a) {
|
|
var b = sre.SpeechGeneratorFactory.generator("Node");
|
|
sre.Processor.LocalState_.speechGenerator = b;
|
|
sre.Processor.LocalState_.highlighter = sre.HighlighterFactory.highlighter(
|
|
{ color: "black" },
|
|
{ color: "white" },
|
|
{ renderer: "NativeMML" },
|
|
);
|
|
a = sre.ProcessorFactory.process("enriched", a);
|
|
var c = sre.ProcessorFactory.print("enriched", a);
|
|
sre.Processor.LocalState_.walker = sre.WalkerFactory.walker(
|
|
sre.Engine.getInstance().walker,
|
|
a,
|
|
b,
|
|
sre.Processor.LocalState_.highlighter,
|
|
c,
|
|
);
|
|
return sre.Processor.LocalState_.walker;
|
|
},
|
|
print: function (a) {
|
|
return sre.Processor.LocalState_.walker.speech();
|
|
},
|
|
});
|
|
new sre.KeyProcessor("move", {
|
|
processor: function (a) {
|
|
return sre.Processor.LocalState_.walker
|
|
? !1 === sre.Processor.LocalState_.walker.move(a)
|
|
? sre.AuralRendering.getInstance().error(a)
|
|
: sre.Processor.LocalState_.walker.speech()
|
|
: null;
|
|
},
|
|
});
|
|
sre.System = function () {
|
|
this.version = sre.Variables.VERSION;
|
|
};
|
|
goog.addSingletonGetter(sre.System);
|
|
sre.System.prototype.setupEngine = function (a) {
|
|
var b = sre.Engine.getInstance(),
|
|
c = function (d) {
|
|
b[d] = a[d] || b[d];
|
|
};
|
|
c("mode");
|
|
sre.System.prototype.configBlocks_(a);
|
|
sre.Engine.BINARY_FEATURES.forEach(function (d) {
|
|
"undefined" !== typeof a[d] && (b[d] = !!a[d]);
|
|
});
|
|
sre.Engine.STRING_FEATURES.forEach(c);
|
|
a.json && (sre.SystemExternal.jsonPath = sre.BaseUtil.makePath(a.json));
|
|
a.xpath && (sre.SystemExternal.WGXpath = a.xpath);
|
|
b.setupBrowsers();
|
|
b.ruleSets = a.rules ? a.rules : sre.SpeechRuleStores.availableSets();
|
|
sre.SpeechRuleEngine.getInstance().parameterize(b.ruleSets);
|
|
b.setDynamicCstr();
|
|
sre.L10n.setLocale();
|
|
};
|
|
sre.System.prototype.configBlocks_ = function (a) {
|
|
if (
|
|
!sre.Engine.getInstance().config &&
|
|
sre.Engine.getInstance().mode === sre.Engine.Mode.HTTP
|
|
) {
|
|
sre.Engine.getInstance().config = !0;
|
|
for (
|
|
var b = document.documentElement.querySelectorAll(
|
|
'script[type="text/x-sre-config"]',
|
|
),
|
|
c = 0,
|
|
d = b.length;
|
|
c < d;
|
|
c++
|
|
)
|
|
try {
|
|
var e = b[c].innerHTML,
|
|
f = JSON.parse(e),
|
|
g;
|
|
for (g in f) a[g] = f[g];
|
|
} catch (h) {
|
|
sre.Debugger.getInstance().output("Illegal configuration ", e);
|
|
}
|
|
}
|
|
};
|
|
sre.System.setAsync = function () {
|
|
sre.Engine.isReady() || setTimeout(sre.System.setAsync, 500);
|
|
sre.System.getInstance().setupEngine({ mode: sre.Engine.Mode.ASYNC });
|
|
};
|
|
sre.System.prototype.engineSetup = function () {
|
|
var a = ["mode"].concat(
|
|
sre.Engine.STRING_FEATURES,
|
|
sre.Engine.BINARY_FEATURES,
|
|
),
|
|
b = sre.Engine.getInstance(),
|
|
c = {};
|
|
a.forEach(function (d) {
|
|
c[d] = b[d];
|
|
});
|
|
c.json = sre.SystemExternal.jsonPath;
|
|
c.xpath = sre.SystemExternal.WGXpath;
|
|
c.rules = b.ruleSets.slice();
|
|
return c;
|
|
};
|
|
sre.System.prototype.engineReady = function () {
|
|
return sre.Engine.isReady();
|
|
};
|
|
sre.System.prototype.toSpeech = function (a) {
|
|
return sre.System.getInstance().processString("speech", a);
|
|
};
|
|
sre.System.prototype.toSemantic = function (a) {
|
|
return sre.System.getInstance().processString("semantic", a);
|
|
};
|
|
sre.System.prototype.toJson = function (a) {
|
|
return sre.System.getInstance().processString("json", a);
|
|
};
|
|
sre.System.prototype.toDescription = function (a) {
|
|
return sre.System.getInstance().processString("description", a);
|
|
};
|
|
sre.System.prototype.toEnriched = function (a) {
|
|
return sre.System.getInstance().processString("enriched", a);
|
|
};
|
|
sre.System.prototype.processString = function (a, b) {
|
|
return sre.ProcessorFactory.process(a, b);
|
|
};
|
|
sre.System.prototype.fileToSpeech = function (a, b) {
|
|
sre.System.getInstance().processFile("speech", a, b);
|
|
};
|
|
sre.System.prototype.fileToSemantic = function (a, b) {
|
|
sre.System.getInstance().processFile("semantic", a, b);
|
|
};
|
|
sre.System.prototype.fileToJson = function (a, b) {
|
|
sre.System.getInstance().processFile("json", a, b);
|
|
};
|
|
sre.System.prototype.fileToDescription = function (a, b) {
|
|
sre.System.getInstance().processFile("description", a, b);
|
|
};
|
|
sre.System.prototype.fileToEnriched = function (a, b) {
|
|
sre.System.getInstance().processFile("enriched", a, b);
|
|
};
|
|
sre.System.prototype.processFile = function (a, b, c) {
|
|
sre.Engine.isReady()
|
|
? sre.Engine.getInstance().mode === sre.Engine.Mode.SYNC
|
|
? this.processFileSync_(a, b, c)
|
|
: this.processFileAsync_(a, b, c)
|
|
: setTimeout(
|
|
goog.bind(function () {
|
|
this.processFile(a, b, c);
|
|
}, this),
|
|
100,
|
|
);
|
|
};
|
|
sre.System.prototype.inputFileSync_ = function (a) {
|
|
try {
|
|
var b = sre.SystemExternal.fs.readFileSync(a, { encoding: "utf8" });
|
|
} catch (c) {
|
|
throw new sre.Engine.Error("Can not open file: " + a);
|
|
}
|
|
return b;
|
|
};
|
|
sre.System.prototype.processFileSync_ = function (a, b, c) {
|
|
b = sre.System.getInstance().inputFileSync_(b);
|
|
a = sre.ProcessorFactory.output(a, b);
|
|
if (c)
|
|
try {
|
|
sre.SystemExternal.fs.writeFileSync(c, a);
|
|
} catch (d) {
|
|
throw new sre.Engine.Error("Can not write to file: " + c);
|
|
}
|
|
else console.info(a);
|
|
};
|
|
sre.System.prototype.inputFileAsync_ = function (a, b) {
|
|
sre.SystemExternal.fs.readFile(
|
|
a,
|
|
{ encoding: "utf8" },
|
|
goog.bind(function (c, d) {
|
|
if (c) throw new sre.Engine.Error("Can not open file: " + a);
|
|
b(d);
|
|
}, this),
|
|
);
|
|
};
|
|
sre.System.prototype.processFileAsync_ = function (a, b, c) {
|
|
sre.System.getInstance().inputFileAsync_(
|
|
b,
|
|
goog.bind(function (d) {
|
|
d = sre.ProcessorFactory.output(a, d);
|
|
c
|
|
? sre.SystemExternal.fs.writeFile(c, d, function (e) {
|
|
if (e) throw new sre.Engine.Error("Can not write to file: " + c);
|
|
})
|
|
: console.info(d);
|
|
}, this),
|
|
);
|
|
};
|
|
sre.System.prototype.walk = function (a) {
|
|
return sre.ProcessorFactory.output("walker", a);
|
|
};
|
|
sre.System.prototype.move = function (a) {
|
|
return sre.ProcessorFactory.keypress("move", a);
|
|
};
|
|
sre.Browser = {};
|
|
sre.System.getInstance().setupEngine({
|
|
mode: sre.Engine.Mode.HTTP,
|
|
domain: "mathspeak",
|
|
style: "default",
|
|
});
|
|
var SRE = sre.System.getInstance();
|