diff --git a/packages/nlcst-parse-japanese/src/nlcst-parse-japanese.ts b/packages/nlcst-parse-japanese/src/nlcst-parse-japanese.ts index 6e269f2..3d7da1c 100644 --- a/packages/nlcst-parse-japanese/src/nlcst-parse-japanese.ts +++ b/packages/nlcst-parse-japanese/src/nlcst-parse-japanese.ts @@ -317,9 +317,15 @@ function tokenize( */ export class JapaneseParser { private tokenizer!: { tokenize(text: string): any }; + private dicPath?: string; - ready() { - return getTokenizer().then((tokenizer: any) => { + constructor(options: { dicPath?: string } = {}) { + this.dicPath = options.dicPath; + } + + public ready() { + const options = this.dicPath && { dicPath: this.dicPath }; + return getTokenizer(options).then((tokenizer: any) => { this.tokenizer = tokenizer; }); }