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: graphspell, trunk
16:14
[graphspell][js] dawg: fix bugs in select() check-in: a227ad5a87 user: olr tags: graphspell, trunk
15:19
[graphspell][js] ibdawg: add select() function check-in: fe54076259 user: olr tags: graphspell, trunk
Changes

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

   396    396               }
   397    397           }
   398    398           yield* this._select1(zPattern, 0, "");
   399    399       }
   400    400   
   401    401       // VERSION 1
   402    402   
   403         -    _select1 (zPattern, iAddr, sWord) {
          403  +    * _select1 (zPattern, iAddr, sWord) {
   404    404           // recursive generator
   405         -        for (let [nVal, jAddr] of self._getArcs1(iAddr)) {
          405  +        for (let [nVal, jAddr] of this._getArcs1(iAddr)) {
   406    406               if (nVal < this.nChar) {
   407    407                   // simple character
   408         -                yield* self._select1(zPattern, jAddr, sWord + self.lArcVal[nVal])
          408  +                yield* this._select1(zPattern, jAddr, sWord + this.lArcVal[nVal]);
   409    409               } else {
   410    410                   let sEntry = sWord + "\t" + this.funcStemming(sWord, this.lArcVal[nVal]);
   411    411                   for (let [nMorphVal, _] of this._getArcs1(jAddr)) {
   412         -                    if (!zPattern || zPattern.search(this.lArcVal[nMorphVal])) {
          412  +                    if (!zPattern || zPattern.test(this.lArcVal[nMorphVal])) {
   413    413                           yield sEntry + "\t" + this.lArcVal[nMorphVal];
   414    414                       }
   415    415                   }
   416    416               }
   417    417           }
   418    418       }            
   419    419