blob: 051cfc66168babd15fa21c7d3da0876aecfe634b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
import * as path from 'https://deno.land/std@0.102.0/path/mod.ts';
import { assertEquals } from "https://deno.land/std@0.192.0/testing/asserts.ts";
import DirectCoreClient from '../../core/direct/client.ts';
var core = new DirectCoreClient();
await core.ready;
interface Test {
test: {
input: string;
reading: string;
};
_original: string;
tags: Array<string>;
};
const here = path.dirname(path.fromFileUrl(import.meta.url));
const tests = JSON.parse(await Deno.readTextFile(path.resolve(here, 'cases.json'))) as Test[];
var timeStart = performance.now();
for (var { test } of tests) {
var result = await core.parseSentence(test.input);
// TODO: add reading back into conjugated verb to complete this test
}
var timeEnd = performance.now();
var duration = timeEnd - timeStart;
var averageLength = tests.map(t => t.test.input.length).reduce((a, b) => a + b) / tests.length;
console.log(` amount of sentences: ${tests.length}`);
console.log(`average sentence length: ${averageLength.toFixed(1)} characters`);
console.log(` test duration: ${duration.toFixed(0)} ms`);
console.log(` average throughput: ${(tests.length / (duration / 1e3)).toFixed(1)} sentence/second`);
|