Grammalecte  Changes On Branch d8959f76a4322471

Changes In Branch multid Through [d8959f76a4] Excluding Merge-Ins

This is equivalent to a diff from 62c389aedf to d8959f76a4

2018-02-16
15:46
[fx][graphspell] merge multid: multi-dictionaries > editable personal dictionary check-in: 607d532bca user: olr tags: fx, graphspell, new_feature, trunk
2018-02-13
14:23
[graphspell][py] fix variables name check-in: 2bcf7228cc user: olr tags: graphspell, multid
13:39
[core][js] multi-dictionaries check-in: d8959f76a4 user: olr tags: core, multid
13:38
[graphspell][js] rename vars check-in: 62c389aedf user: olr tags: graphspell, trunk
10:47
[graphspell][js] spellchecker wrapper for ibdawg check-in: c989c20101 user: olr tags: graphspell, trunk

Modified gc_core/js/lang_core/gc_engine.js from [2f5e964b5d] to [08b8dd1900].

    35     35   
    36     36   
    37     37   // data
    38     38   let _sAppContext = "";                                  // what software is running
    39     39   let _dOptions = null;
    40     40   let _aIgnoredRules = new Set();
    41     41   let _oDict = null;
           42  +let _oSpellChecker = null;
    42     43   let _dAnalyses = new Map();                             // cache for data from dictionary
    43     44   
    44     45   
    45     46   var gc_engine = {
    46     47   
    47     48       //// Informations
    48     49   
................................................................................
   318    319       },
   319    320   
   320    321       //// Initialization
   321    322   
   322    323       load: function (sContext="JavaScript", sPath="") {
   323    324           try {
   324    325               if (typeof(require) !== 'undefined') {
   325         -                var ibdawg = require("resource://grammalecte/graphspell/ibdawg.js");
   326         -                _oDict = new ibdawg.IBDAWG("${dic_filename}.json");
          326  +                //var ibdawg = require("resource://grammalecte/graphspell/ibdawg.js");
          327  +                //_oDict = new ibdawg.IBDAWG("${dic_filename}.json");
          328  +                console.log("<resource:>");
          329  +                var spellchecker = require("resource://grammalecte/graphspell/spellchecker.js");
          330  +                _oSpellChecker = new spellchecker.Spellchecker("${lang}", "${dic_filename}.json");
   327    331               } else {
   328         -                _oDict = new IBDAWG("${dic_filename}.json", sPath);
          332  +                //_oDict = new IBDAWG("${dic_filename}.json", sPath);
          333  +                console.log("no <resource:>");
          334  +                _oSpellChecker = new Spellchecker("${lang}", "${dic_filename}.json", sPath);
   329    335               }
   330    336               _sAppContext = sContext;
   331    337               _dOptions = gc_options.getOptions(sContext).gl_shallowCopy();     // duplication necessary, to be able to reset to default
   332    338           }
   333    339           catch (e) {
   334    340               helpers.logerror(e);
   335    341           }
   336    342       },
   337    343   
   338    344       getDictionary: function () {
   339         -        return _oDict;
          345  +        return _oSpellChecker;
   340    346       },
   341    347   
   342    348       //// Options
   343    349   
   344    350       setOption: function (sOpt, bVal) {
   345    351           if (_dOptions.has(sOpt)) {
   346    352               _dOptions.set(sOpt, bVal);
................................................................................
   386    392           helpers.echo("DA: " + dDA.get(aWord[0]));
   387    393       }
   388    394       helpers.echo("FSA: " + _dAnalyses.get(aWord[1]));
   389    395       return true;
   390    396   }
   391    397   
   392    398   function _storeMorphFromFSA (sWord) {
   393         -    // retrieves morphologies list from _oDict -> _dAnalyses
   394         -    //helpers.echo("register: "+sWord + " " + _oDict.getMorph(sWord).toString())
   395         -    _dAnalyses.set(sWord, _oDict.getMorph(sWord));
          399  +    // retrieves morphologies list from _oSpellChecker -> _dAnalyses
          400  +    //helpers.echo("register: "+sWord + " " + _oSpellChecker.getMorph(sWord).toString())
          401  +    _dAnalyses.set(sWord, _oSpellChecker.getMorph(sWord));
   396    402       return !!_dAnalyses.get(sWord);
   397    403   }
   398    404   
   399    405   function morph (dDA, aWord, sPattern, bStrict=true, bNoWord=false) {
   400    406       // analyse a tuple (position, word), return true if sPattern in morphologies (disambiguation on)
   401    407       if (!aWord) {
   402    408           //helpers.echo("morph: noword, returns " + bNoWord);

Modified gc_lang/fr/webext/gce_worker.js from [2a64cce6de] to [30916bedcd].

    32     32   //console.log("[Worker] GC Engine Worker [start]");
    33     33   //console.log(self);
    34     34   
    35     35   importScripts("grammalecte/graphspell/helpers.js");
    36     36   importScripts("grammalecte/graphspell/str_transform.js");
    37     37   importScripts("grammalecte/graphspell/char_player.js");
    38     38   importScripts("grammalecte/graphspell/ibdawg.js");
           39  +importScripts("grammalecte/graphspell/spellchecker.js");
    39     40   importScripts("grammalecte/text.js");
    40     41   importScripts("grammalecte/graphspell/tokenizer.js");
    41     42   importScripts("grammalecte/fr/conj.js");
    42     43   importScripts("grammalecte/fr/mfsp.js");
    43     44   importScripts("grammalecte/fr/phonet.js");
    44     45   importScripts("grammalecte/fr/cregex.js");
    45     46   importScripts("grammalecte/fr/gc_options.js");