stuff
This commit is contained in:
parent
bc92231240
commit
b8225c639e
11904 changed files with 1472749 additions and 133 deletions
33
node_modules/speech-rule-engine/mjs/enrich_mathml/case_proof.js
generated
vendored
Normal file
33
node_modules/speech-rule-engine/mjs/enrich_mathml/case_proof.js
generated
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import { SemanticType } from '../semantic_tree/semantic_meaning.js';
|
||||
import { AbstractEnrichCase } from './abstract_enrich_case.js';
|
||||
import * as EnrichMathml from './enrich_mathml.js';
|
||||
import { setAttributes } from './enrich_attr.js';
|
||||
export class CaseProof extends AbstractEnrichCase {
|
||||
static test(semantic) {
|
||||
return (!!semantic.mathmlTree &&
|
||||
(semantic.type === SemanticType.INFERENCE ||
|
||||
semantic.type === SemanticType.PREMISES));
|
||||
}
|
||||
constructor(semantic) {
|
||||
super(semantic);
|
||||
this.mml = semantic.mathmlTree;
|
||||
}
|
||||
getMathml() {
|
||||
if (!this.semantic.childNodes.length) {
|
||||
return this.mml;
|
||||
}
|
||||
this.semantic.contentNodes.forEach(function (x) {
|
||||
EnrichMathml.walkTree(x);
|
||||
setAttributes(x.mathmlTree, x);
|
||||
});
|
||||
this.semantic.childNodes.forEach(function (x) {
|
||||
EnrichMathml.walkTree(x);
|
||||
});
|
||||
setAttributes(this.mml, this.semantic);
|
||||
if (this.mml.getAttribute('data-semantic-id') ===
|
||||
this.mml.getAttribute('data-semantic-parent')) {
|
||||
this.mml.removeAttribute('data-semantic-parent');
|
||||
}
|
||||
return this.mml;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue