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); })();