add initial marp implementation with sample content and build configuration
This commit is contained in:
49
node_modules/speech-rule-engine/mjs/rule_engine/store_util.js
generated
vendored
Normal file
49
node_modules/speech-rule-engine/mjs/rule_engine/store_util.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
import { AuditoryDescription } from '../audio/auditory_description.js';
|
||||
import * as XpathUtil from '../common/xpath_util.js';
|
||||
import { Engine } from '../common/engine.js';
|
||||
export function nodeCounter(nodes, context) {
|
||||
const localLength = nodes.length;
|
||||
let localCounter = 0;
|
||||
let localContext = context;
|
||||
if (!context) {
|
||||
localContext = '';
|
||||
}
|
||||
return function () {
|
||||
if (localCounter < localLength) {
|
||||
localCounter += 1;
|
||||
}
|
||||
return localContext + ' ' + localCounter;
|
||||
};
|
||||
}
|
||||
export function pauseSeparator(_nodes, context) {
|
||||
const numeral = parseFloat(context);
|
||||
const value = isNaN(numeral) ? context : numeral;
|
||||
return function () {
|
||||
return [
|
||||
AuditoryDescription.create({
|
||||
text: '',
|
||||
personality: { pause: value }
|
||||
})
|
||||
];
|
||||
};
|
||||
}
|
||||
export function contentIterator(nodes, context) {
|
||||
let contentNodes;
|
||||
if (nodes.length > 0) {
|
||||
contentNodes = XpathUtil.evalXPath('../../content/*', nodes[0]);
|
||||
}
|
||||
else {
|
||||
contentNodes = [];
|
||||
}
|
||||
return function () {
|
||||
const content = contentNodes.shift();
|
||||
const contextDescr = context
|
||||
? [AuditoryDescription.create({ text: context }, { translate: true })]
|
||||
: [];
|
||||
if (!content) {
|
||||
return contextDescr;
|
||||
}
|
||||
const descrs = Engine.evaluateNode(content);
|
||||
return contextDescr.concat(descrs);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user