Skip to content

Commit

Permalink
Merge branch 'develop' into dependabot/github_actions/dot-github/work…
Browse files Browse the repository at this point in the history
…flows/actions/download-artifact-4.1.7
  • Loading branch information
zorkow authored Nov 14, 2024
2 parents ecd87d7 + 4248c33 commit d447f89
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 8
Expand All @@ -27,7 +27,7 @@ jobs:
run: pnpm i; pnpm build

- name: Upload build
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: sre-library
path: |
Expand All @@ -47,7 +47,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 8
Expand Down
3 changes: 3 additions & 0 deletions ts/common/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,9 @@ export class Cli {
.option('-m, --mathml', 'Generate enriched MathML.', () =>
processor('enriched')
)
.option('-u, --rebuild', 'Rebuild semantic tree from enriched MathML.', () =>
processor('rebuild')
)
.option(
'-t, --latex',
'Accepts LaTeX input for certain locale/modality combinations.',
Expand Down
14 changes: 14 additions & 0 deletions ts/common/processor_factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import * as SpeechGeneratorFactory from '../speech_generator/speech_generator_fa
import * as SpeechGeneratorUtil from '../speech_generator/speech_generator_util.js';
import * as WalkerFactory from '../walker/walker_factory.js';
import * as WalkerUtil from '../walker/walker_util.js';
import { RebuildStree } from '../walker/rebuild_stree.js';
import * as DomUtil from './dom_util.js';
import { Engine, SREError } from './engine.js';
import * as EngineConst from '../common/engine_const.js';
Expand Down Expand Up @@ -272,6 +273,19 @@ set(
})
);

// rebuild: Rebuild semnatic tree from Enriched MathML node.
set(
new Processor<Element>('rebuild', {
processor: function (expr) {
let rebuilt = new RebuildStree(DomUtil.parseInput(expr));
return rebuilt.stree.xml();
},
pprint: function (tree) {
return DomUtil.formatXml(tree.toString());
}
})
);

set(
new Processor('walker', {
processor: function (expr: string) {
Expand Down
9 changes: 6 additions & 3 deletions ts/semantic_tree/semantic_processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3195,12 +3195,15 @@ export class SemanticProcessor {
newNodes.push(SemanticProcessor.getInstance().row(firstComp));
}
}
return [
SemanticProcessor.getInstance().punctuatedNode_(newNodes, partition.rel)
];
return (newNodes.length === 1 && partition.rel.length === 1) ? newNodes :
[
SemanticProcessor.getInstance().punctuatedNode_(newNodes, partition.rel)
];
}

// TODO: Refine roles to reflect same roles. Find sequences of punctuation
// TODO: Extend punctuated nodes to include elements outside the current scope
// Example: a\mathinner{...\_\_\_}
// elements and separate those out or at least rewrite ellipses.
/**
* Create a punctuated node.
Expand Down

0 comments on commit d447f89

Please sign in to comment.