Index: graphspell-js/spellchecker.js ================================================================== --- graphspell-js/spellchecker.js +++ graphspell-js/spellchecker.js @@ -68,10 +68,17 @@ this.oTokenizer = new tokenizer.Tokenizer(this.sLangCode); } else { this.oTokenizer = new Tokenizer(this.sLangCode); } } + + getTokenizer () { + if (!this.oTokenizer) { + this.loadTokenizer(); + } + return this.oTokenizer; + } setMainDictionary (dictionary) { // returns true if the dictionary is loaded this.oMainDic = this._loadDictionary(dictionary); return Boolean(this.oMainDic); Index: graphspell/spellchecker.py ================================================================== --- graphspell/spellchecker.py +++ graphspell/spellchecker.py @@ -46,10 +46,15 @@ return None def loadTokenizer (self): self.oTokenizer = tokenizer.Tokenizer(self.sLangCode) + def getTokenizer (self): + if not self.oTokenizer: + self.loadTokenizer() + return self.oTokenizer + def setMainDictionary (self, sfDictionary): "returns True if the dictionary is loaded" self.oMainDic = self._loadDictionary(sfDictionary) return bool(self.oMainDic)