diff options
Diffstat (limited to 'main.ts')
-rw-r--r-- | main.ts | 60 |
1 files changed, 30 insertions, 30 deletions
@@ -1,37 +1,34 @@ -import { ParseResult } from "./language/types.ts"; +import { SearchSentenceResult } from "./search/types.ts"; -function prettyprintParseResult(input: ParseResult) { - for (var token of input.tokens) { +function prettyprintParseResult(input: SearchSentenceResult) { + for (var word of input.words) { var out = ""; - out += token.term_id; + out += word.id; out += ": "; - out += token.writing; + out += word.writing; out += " ("; - out += token.reading; + out += word.reading; out += ") "; - out += token.tags.map(a => `[${a}]`).join(" "); + out += word.tags.map(a => `[${a}]`).join(" "); console.log(out); } - console.log(input.tokens.map(t => t.source).join(" ")); + console.log(input.words.map(t => t.source).join(" ")); } import Core from "./core/api.ts"; import DirectCoreClient from "./core/direct/client.ts"; -import RemoteCoreServer from "./core/http/server.ts"; -import RemoteCoreClient from "./core/http/client.ts"; - async function coreTest(core: Core) { - prettyprintParseResult(await core.parseSentence("浮上したハイラル城の下にてゼルダ様達の捜索を行うこととなった")); + prettyprintParseResult(await core.search.sentence("浮上したハイラル城の下にてゼルダ様達の捜索を行うこととなった")); console.log("-------------"); - prettyprintParseResult(await core.parseSentence("浮上した城の様")); + prettyprintParseResult(await core.search.sentence("浮上した城の様")); console.log("-------------"); - prettyprintParseResult(await core.parseSentence("迷子になってしまった")); + prettyprintParseResult(await core.search.sentence("迷子になってしまった")); console.log("-------------"); - prettyprintParseResult(await core.parseSentence("日本に来て一番驚いたことは自動販売機の多さだ。")); + prettyprintParseResult(await core.search.sentence("日本に来て一番驚いたことは自動販売機の多さだ。")); } // test 1 (direct core) @@ -43,18 +40,21 @@ await (async () => { await coreTest(core); })(); -// console.log("\n".repeat(2)); -// -// // 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); -// })(); +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); +})(); |