From a3a81530a0a30ba02b5253b762e2ccd77d3b01fc Mon Sep 17 00:00:00 2001 From: lonkaars Date: Mon, 10 Jul 2023 16:26:13 +0200 Subject: small restructuring + all deinflection tests working --- core/raw/api.ts | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'core/raw') diff --git a/core/raw/api.ts b/core/raw/api.ts index 593b932..6046a26 100644 --- a/core/raw/api.ts +++ b/core/raw/api.ts @@ -1,29 +1,39 @@ -import Core from "../api.ts"; -import Parser from "../../language/parser.ts"; +import Core, { CoreExport, CoreImport, CoreSearch, CoreUser } from "../api.ts"; import YomikunError from "../../util/error.ts"; -import { DeepPartial } from "../../util/types.ts"; -import { InputSentenceProps } from "../../language/types.ts"; +import Search from "../../search/search.ts"; /** @summary internal Core (DO NOT USE DIRECTLY) */ export default class RawCore implements Core { - private parser: Parser; public ready: Promise; + private _search: Search; + constructor() { if (this.constructor === RawCore) { throw new YomikunError("RawCore instantiated! Use DirectCoreClient instead!"); } - this.parser = new Parser(); + this._search = new Search(); this.ready = new Promise(async resolve => { - await this.parser.ready; + await this._search.ready; resolve(); }) } - async parseSentence(input: string, options?: DeepPartial) { - return await this.parser.parse(input, options); - } + public search: CoreSearch = { + terms: async term => { + return await this._search.terms(term); + }, + sentence: async (sentence, optional?) => { + return await this._search.sentence(sentence, optional); + }, + }; + + public user: CoreUser = {}; + + public import: CoreImport = {}; + + public export: CoreExport = {}; }; -- cgit v1.2.3