diff options
author | lonkaars <loek@pipeframe.xyz> | 2023-06-28 23:59:50 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2023-06-28 23:59:50 +0200 |
commit | 67dbb6421976254658c5e38045513129dd18187a (patch) | |
tree | 288b599d1097b26bdbcad3b6749b38e133017cf2 /core/raw/api.ts |
initial public commit
Diffstat (limited to 'core/raw/api.ts')
-rw-r--r-- | core/raw/api.ts | 27 |
1 files changed, 27 insertions, 0 deletions
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); + } +}; + |