@@ -100,11 +100,11 @@ catch (e) { throw Error("# Error. File not found or not loadable.\n" + e.message + "\n"); } /* Properties: - sName, nVersion, sHeader, lArcVal, nArcVal, byDic, sLang, nChar, nBytesArc, nBytesNodeAddress, + sName, nCompressionMethod, sHeader, lArcVal, nArcVal, byDic, sLang, nChar, nBytesArc, nBytesNodeAddress, nEntries, nNode, nArc, nAff, cStemming, nTag, dChar, nBytesOffset, */ /* Bug workaround. @@ -120,12 +120,12 @@ /* end of bug workaround */ if (!this.sHeader.startsWith("/pyfsa/")) { throw TypeError("# Error. Not a pyfsa binary dictionary. Header: " + this.sHeader); } - if (!(this.nVersion == "1" || this.nVersion == "2" || this.nVersion == "3")) { - throw RangeError("# Error. Unknown dictionary version: " + this.nVersion); + if (!(this.nCompressionMethod == "1" || this.nCompressionMethod == "2" || this.nCompressionMethod == "3")) { + throw RangeError("# Error. Unknown dictionary compression method: " + this.nCompressionMethod); } // to get the value of an arc, to get the char of an arc with its value this.dChar = helpers.objectToMap(this.dChar); this.dCharVal = this.dChar.gl_reverse(); //this.byDic = new Uint8Array(this.byDic); // not quicker, even slower @@ -141,12 +141,12 @@ this._arcMask = (2 ** ((this.nBytesArc * 8) - 3)) - 1; this._finalNodeMask = 1 << ((this.nBytesArc * 8) - 1); this._lastArcMask = 1 << ((this.nBytesArc * 8) - 2); - // Configuring DAWG functions according to nVersion - switch (this.nVersion) { + // Configuring DAWG functions according to nCompressionMethod + switch (this.nCompressionMethod) { case 1: this.morph = this._morph1; this.stem = this._stem1; this._lookupArcNode = this._lookupArcNode1; this._getArcs = this._getArcs1; @@ -165,19 +165,19 @@ this._lookupArcNode = this._lookupArcNode3; this._getArcs = this._getArcs3; this._writeNodes = this._writeNodes3; break; default: - throw ValueError("# Error: unknown code: " + this.nVersion); + throw ValueError("# Error: unknown code: " + this.nCompressionMethod); } //console.log(this.getInfo()); this.bOptNumSigle = true; this.bOptNumAtLast = false; } getInfo () { - return ` Language: ${this.sLang} Version: ${this.nVersion} Date: ${this.sDate} Stemming: ${this.cStemming}FX\n` + + return ` Language: ${this.sLang} Version: ${this.nCompressionMethod} Date: ${this.sDate} Stemming: ${this.cStemming}FX\n` + ` Arcs values: ${this.nArcVal} = ${this.nChar} characters, ${this.nAff} affixes, ${this.nTag} tags\n` + ` Dictionary: ${this.nEntries} entries, ${this.nNode} nodes, ${this.nArc} arcs\n` + ` Address size: ${this.nBytesNodeAddress} bytes, Arc size: ${this.nBytesArc} bytes\n`; }