Skip to content

Commit

Permalink
feat: pass dictPath option down to kuromojin (#6)
Browse files Browse the repository at this point in the history
* feat: pass config down to kuromojin

* fix: useless protected

* fix: make options optional
  • Loading branch information
linonetwo authored and azu committed Jan 25, 2019
1 parent f82425e commit e313046
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/nlcst-parse-japanese/src/nlcst-parse-japanese.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
}
Expand Down

0 comments on commit e313046

Please sign in to comment.