From 67dbb6421976254658c5e38045513129dd18187a Mon Sep 17 00:00:00 2001 From: lonkaars Date: Wed, 28 Jun 2023 23:59:50 +0200 Subject: initial public commit --- core/raw/api.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 core/raw/api.ts (limited to 'core/raw') diff --git a/core/raw/api.ts b/core/raw/api.ts new file mode 100644 index 0000000..2d29eed --- /dev/null +++ b/core/raw/api.ts @@ -0,0 +1,27 @@ +import API from "../api.ts"; +import Parser from "../../language/parser.ts"; +import YomikunError from "../../util/error.ts"; + +/** @summary internal Yomikun API client (DO NOT USE DIRECTLY) */ +export default class YomikunRAWAPI implements API { + private _parser: Parser; + + constructor() { + if (this.constructor === YomikunRAWAPI) { + throw new YomikunError("YomikunRAWAPI instantiated! please use YomikunDirectAPIClient instead"); + } + + this._parser = new Parser(); + } + + async prepare() { + await Promise.all([ + this._parser.prepare(), + ]); + } + + async parseSentence(input: string) { + return this._parser.parse(input); + } +}; + -- cgit v1.2.3