Grammalecte  Check-in [a227ad5a87]

Overview
Comment:[graphspell][js] dawg: fix bugs in select()
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | graphspell
Files: files | file ages | folders
SHA3-256: a227ad5a87fcaf529a3c396b141cd36a9eccdd3c38c31cc2006e53bb3bc95827
User & Date: olr on 2018-02-07 16:14:07
Other Links: manifest | tags
Context
2018-02-07
16:15
[graphspell][js] dawg: convert Map to Object when exporting to JSON check-in: e1707a65be user: olr tags: trunk, graphspell
16:14
[graphspell][js] dawg: fix bugs in select() check-in: a227ad5a87 user: olr tags: trunk, graphspell
15:19
[graphspell][js] ibdawg: add select() function check-in: fe54076259 user: olr tags: trunk, graphspell
Changes

Modified graphspell-js/ibdawg.js from [6074b8efa8] to [c46a5bd198].

396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
            }
        }
        yield* this._select1(zPattern, 0, "");
    }

    // VERSION 1

    _select1 (zPattern, iAddr, sWord) {
        // recursive generator
        for (let [nVal, jAddr] of self._getArcs1(iAddr)) {
            if (nVal < this.nChar) {
                // simple character
                yield* self._select1(zPattern, jAddr, sWord + self.lArcVal[nVal])
            } else {
                let sEntry = sWord + "\t" + this.funcStemming(sWord, this.lArcVal[nVal]);
                for (let [nMorphVal, _] of this._getArcs1(jAddr)) {
                    if (!zPattern || zPattern.search(this.lArcVal[nMorphVal])) {
                        yield sEntry + "\t" + this.lArcVal[nMorphVal];
                    }
                }
            }
        }
    }            








|

|


|



|







396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
            }
        }
        yield* this._select1(zPattern, 0, "");
    }

    // VERSION 1

    * _select1 (zPattern, iAddr, sWord) {
        // recursive generator
        for (let [nVal, jAddr] of this._getArcs1(iAddr)) {
            if (nVal < this.nChar) {
                // simple character
                yield* this._select1(zPattern, jAddr, sWord + this.lArcVal[nVal]);
            } else {
                let sEntry = sWord + "\t" + this.funcStemming(sWord, this.lArcVal[nVal]);
                for (let [nMorphVal, _] of this._getArcs1(jAddr)) {
                    if (!zPattern || zPattern.test(this.lArcVal[nMorphVal])) {
                        yield sEntry + "\t" + this.lArcVal[nMorphVal];
                    }
                }
            }
        }
    }