blob: 593b9326cbcb8a82241698165394d47ccfde869f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
import Core from "../api.ts";
import Parser from "../../language/parser.ts";
import YomikunError from "../../util/error.ts";
import { DeepPartial } from "../../util/types.ts";
import { InputSentenceProps } from "../../language/types.ts";
/** @summary internal Core (DO NOT USE DIRECTLY) */
export default class RawCore implements Core {
private parser: Parser;
public ready: Promise<void>;
constructor() {
if (this.constructor === RawCore) {
throw new YomikunError("RawCore instantiated! Use DirectCoreClient instead!");
}
this.parser = new Parser();
this.ready = new Promise(async resolve => {
await this.parser.ready;
resolve();
})
}
async parseSentence(input: string, options?: DeepPartial<InputSentenceProps>) {
return await this.parser.parse(input, options);
}
};
|