blob: 1e90f57a0c61fcd6002b8ca797c6aa3296f32b3a (
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
import { SearchSentenceResult } from "./search/types.ts";
function prettyprintParseResult(input: SearchSentenceResult) {
for (var word of input.words) {
var out = "";
out += word.id;
out += ": ";
out += word.writing;
out += " (";
out += word.reading;
out += ") ";
out += word.tags.map(a => `[${a}]`).join(" ");
console.log(out);
}
console.log(input.words.map(t => t.source).join(" "));
}
import Core from "./core/api.ts";
import DirectCoreClient from "./core/direct/client.ts";
async function coreTest(core: Core) {
prettyprintParseResult(await core.search.sentence("浮上したハイラル城の下にてゼルダ様達の捜索を行うこととなった"));
console.log("-------------");
prettyprintParseResult(await core.search.sentence("浮上した城の様"));
console.log("-------------");
prettyprintParseResult(await core.search.sentence("迷子になってしまった"));
console.log("-------------");
prettyprintParseResult(await core.search.sentence("日本に来て一番驚いたことは自動販売機の多さだ。"));
}
// test 1 (direct core)
await (async () => {
var core = new DirectCoreClient();
await core.ready;
console.log("Prepare direct core done");
await coreTest(core);
})();
console.log("\n".repeat(2));
import RemoteCoreServer from "./core/http/server.ts";
import RemoteCoreClient from "./core/http/client.ts";
// test 2 (remote core)
await (async () => {
// default host = localhost:9400
new RemoteCoreServer().start();
var core = new RemoteCoreClient();
await core.ready;
console.log("Prepare remote core done");
await coreTest(core);
Deno.exit(0);
})();
|