diff options
| author | lonkaars <loek@pipeframe.xyz> | 2023-07-10 16:26:13 +0200 | 
|---|---|---|
| committer | lonkaars <loek@pipeframe.xyz> | 2023-07-10 16:26:13 +0200 | 
| commit | a3a81530a0a30ba02b5253b762e2ccd77d3b01fc (patch) | |
| tree | afad1bae0c2f7cb9d4a11b6c1c56bc8bae2f14e5 /core/raw | |
| parent | e430d8cb4a30640298b7fae3c93bc6329e2a0382 (diff) | |
small restructuring + all deinflection tests working
Diffstat (limited to 'core/raw')
| -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 = {};  };  |