import { ParseResult } from "./language/types.ts"; function prettyprintParseResult(input: ParseResult) { for (var token of input.tokens) { var out = ""; out += token.term_id; out += ": "; out += token.writing; out += " ("; out += token.reading; out += ") "; out += token.tags.map(a => `[${a}]`).join(" "); console.log(out); } console.log(input.tokens.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("浮上したハイラル城の下にてゼルダ様達の捜索を行うこととなった")); console.log("-------------"); prettyprintParseResult(await core.parseSentence("浮上した城の様")); console.log("-------------"); prettyprintParseResult(await core.parseSentence("迷子になってしまった")); console.log("-------------"); prettyprintParseResult(await core.parseSentence("日本に来て一番驚いたことは自動販売機の多さだ。")); } // 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)); // // // 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); // })();