MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / outcome

Function outcome

docs/mathnet/scripts/check-corpus.ts:22–37  ·  view source on GitHub ↗
(input: string)

Source from the content-addressed store, hash-verified

20 */
21import { ComputeEngine } from '../../../src/compute-engine';
22import * as fs from 'fs';
23import * as path from 'path';
24
25const scriptDir = path.dirname(process.argv[1]);
26const corpusPath = path.join(scriptDir, '..', 'parser-test-cases.json');
27const corpus = JSON.parse(fs.readFileSync(corpusPath, 'utf8'));
28const showFailures = process.argv.includes('--failures');
29const update = process.argv.includes('--update');
30
31/** Current parser outcome: 'clean', 'throw', or the first error code. */
32function outcome(input: string): string {
33 // A fresh engine per input: the engine narrows free-symbol types from
34 // usage persistently, so a shared engine lets one fragment's inference
35 // contaminate another's parse (e.g. an early `A \setminus B` narrows `A`
36 // to a set and breaks a later `\frac{AB^2}{PC}`). Fragments are
37 // independent inputs; measure them independently.
38 const ce = new ComputeEngine();
39 try {
40 const expr = ce.parse(input);

Callers 1

check-corpus.tsFile · 0.85

Calls 1

parseMethod · 0.95

Tested by

no test coverage detected