diff options
Diffstat (limited to 'core/raw/api.ts')
| -rw-r--r-- | core/raw/api.ts | 30 | 
1 files changed, 20 insertions, 10 deletions
| 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<void>; +	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<InputSentenceProps>) { -		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 = {};  }; |