Overview
Comment: | [tb][js] update gce_worker |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | tb | gcerw |
Files: | files | file ages | folders |
SHA3-256: |
9fd78a9ee541acc671ae8624285be0ff |
User & Date: | olr on 2020-04-06 20:43:04 |
Other Links: | branch diff | manifest | tags |
Context
2020-04-08
| ||
14:07 | merge trunk check-in: 5c14b1c9e0 user: olr tags: gcerw | |
2020-04-06
| ||
20:43 | [tb][js] update gce_worker check-in: 9fd78a9ee5 user: olr tags: tb, gcerw | |
20:01 | [core][js] gc engine: code rewriting check-in: 42fa8f123a user: olr tags: core, gcerw | |
Changes
Modified gc_lang/fr/mailext/worker/gce_worker.js from [abd0c9c4ba] to [420e3521e3].
︙ | ︙ | |||
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | // end of copy/paste // no console here, use “dump” let gce = null; // module: grammar checker engine let text = null; let tkz = null; // module: tokenizer let lxg = null; // module: lexicographer let helpers = null; let oTokenizer = null; let oSpellChecker = null; let oLxg = null; function loadGrammarChecker (sGCOptions="", sContext="JavaScript") { if (gce === null) { try { gce = require("resource://grammalecte/fr/gc_engine.js"); helpers = require("resource://grammalecte/graphspell/helpers.js"); text = require("resource://grammalecte/text.js"); tkz = require("resource://grammalecte/graphspell/tokenizer.js"); //lxg = require("resource://grammalecte/fr/lexicographe.js"); oTokenizer = new tkz.Tokenizer("fr"); gce.load(sContext, "sCSS"); oSpellChecker = gce.getSpellChecker(); if (sGCOptions !== "") { | > > | | | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | // end of copy/paste // no console here, use “dump” let gce = null; // module: grammar checker engine let gco = null; let text = null; let tkz = null; // module: tokenizer let lxg = null; // module: lexicographer let helpers = null; let oTokenizer = null; let oSpellChecker = null; let oLxg = null; function loadGrammarChecker (sGCOptions="", sContext="JavaScript") { if (gce === null) { try { gco = require("resource://grammalecte/fr/gc_options.js"); gce = require("resource://grammalecte/fr/gc_engine.js"); helpers = require("resource://grammalecte/graphspell/helpers.js"); text = require("resource://grammalecte/text.js"); tkz = require("resource://grammalecte/graphspell/tokenizer.js"); //lxg = require("resource://grammalecte/fr/lexicographe.js"); oTokenizer = new tkz.Tokenizer("fr"); gce.load(sContext, "sCSS"); oSpellChecker = gce.getSpellChecker(); if (sGCOptions !== "") { gco.setOptions(helpers.objectToMap(JSON.parse(sGCOptions))); } // we always retrieve options from the gce, for setOptions filters obsolete options return gco.getOptions().gl_toString(); } catch (e) { console.log("# Error: " + e.fileName + "\n" + e.name + "\nline: " + e.lineNumber + "\n" + e.message); } } } |
︙ | ︙ | |||
115 116 117 118 119 120 121 | for (let aSugg of oSpellChecker.suggest(sWord, nSuggLimit)) { lSugg.push(...aSugg); } return lSugg.join("|"); } function getOptions () { | | | | | | | | | | | | | | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | for (let aSugg of oSpellChecker.suggest(sWord, nSuggLimit)) { lSugg.push(...aSugg); } return lSugg.join("|"); } function getOptions () { return gco.getOptions().gl_toString(); } function getDefaultOptions () { return gco.getDefaultOptions().gl_toString(); } function setOptions (sGCOptions) { gco.setOptions(helpers.objectToMap(JSON.parse(sGCOptions))); return gco.getOptions().gl_toString(); } function setOption (sOptName, bValue) { gco.setOptions(new Map([ [sOptName, bValue] ])); return gco.getOptions().gl_toString(); } function resetOptions () { gco.resetOptions(); return gco.getOptions().gl_toString(); } function fullTests (sGCOptions="") { if (!gce || !oSpellChecker || !gco) { return "# Error: grammar checker or dictionary not loaded." } let dMemoOptions = gco.getOptions(); if (sGCOptions) { gco.setOptions(helpers.objectToMap(JSON.parse(sGCOptions))); } let tests = require("resource://grammalecte/tests.js"); let oTest = new tests.TestGrammarChecking(gce); let sAllRes = ""; for (let sRes of oTest.testParse()) { console.log(sRes+"\n"); sAllRes += sRes+"\n"; } gco.setOptions(dMemoOptions); return sAllRes; } |