Overview
Comment: | [graphspell][fx][js] add default suggestions module |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | fx | graphspell |
Files: | files | file ages | folders |
SHA3-256: |
c3cdee9c769a05f7377df3f82b8d38b3 |
User & Date: | olr on 2019-05-14 12:58:22 |
Other Links: | manifest | tags |
Context
2019-05-14
| ||
13:27 | [core][fr][misc] change immunity tag (% -> !) check-in: d167d2a710 user: olr tags: trunk, fr, core, misc | |
12:58 | [graphspell][fx][js] add default suggestions module check-in: c3cdee9c76 user: olr tags: trunk, fx, graphspell | |
12:23 | [graphspell] suggestions for French language: add words with apostrophes when it seems relevant check-in: a9c5ccc29c user: olr tags: trunk, fr | |
Changes
Modified gc_lang/fr/webext/gce_worker.js from [107e6c6733] to [8b5d51f7e1].
︙ | |||
31 32 33 34 35 36 37 38 39 40 41 42 43 44 | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | + | //console.log("[Worker] GC Engine Worker [start]"); //console.log(self); importScripts("grammalecte/graphspell/helpers.js"); importScripts("grammalecte/graphspell/str_transform.js"); importScripts("grammalecte/graphspell/char_player.js"); importScripts("grammalecte/graphspell/suggest.js"); importScripts("grammalecte/graphspell/ibdawg.js"); importScripts("grammalecte/graphspell/spellchecker.js"); importScripts("grammalecte/text.js"); importScripts("grammalecte/graphspell/tokenizer.js"); importScripts("grammalecte/fr/conj.js"); importScripts("grammalecte/fr/mfsp.js"); importScripts("grammalecte/fr/phonet.js"); |
︙ |
Modified graphspell-js/spellchecker.js from [29bf30d9e3] to [79840617ea].
︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | + + | /* global require, exports, console, IBDAWG, Tokenizer */ "use strict"; if(typeof(process) !== 'undefined') { var ibdawg = require("./ibdawg.js"); var tokenizer = require("./tokenizer.js"); var suggest = require("./suggest.js"); } else if (typeof(require) !== 'undefined') { var ibdawg = require("resource://grammalecte/graphspell/ibdawg.js"); var tokenizer = require("resource://grammalecte/graphspell/tokenizer.js"); var suggest = require("resource://grammalecte/graphspell/suggest.js"); } ${map} const dDefaultDictionaries = new Map([ ["fr", "fr-allvars.json"], |
︙ | |||
40 41 42 43 44 45 46 47 48 49 50 51 52 53 | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | + + + | } this.oMainDic = this._loadDictionary(mainDic, sPath, true); this.oCommunityDic = this._loadDictionary(communityDic, sPath); this.oPersonalDic = this._loadDictionary(personalDic, sPath); this.bCommunityDic = Boolean(this.oCommunityDic); this.bPersonalDic = Boolean(this.oPersonalDic); this.oTokenizer = null; // Default suggestions this.oDefaultSugg = null; this.loadSuggestions(sLangCode) // storage this.bStorage = false; this._dMorphologies = new Map(); // key: flexion, value: list of morphologies this._dLemmas = new Map(); // key: flexion, value: list of lemmas } _loadDictionary (dictionary, sPath="", bNecessary=false) { |
︙ | |||
120 121 122 123 124 125 126 127 128 129 130 131 132 133 | 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 | + + + + + + + + + + + | this.bCommunityDic = false; } deactivatePersonalDictionary () { this.bPersonalDic = false; } // Default suggestions loadSuggestions (sLangCode) { // load default suggestion module for <sLangCode> // When “import” works everywhere, do like with Python if (suggest && suggest.hasOwnProperty(sLangCode)) { this.oDefaultSugg = suggest[sLangCode]; } } // Storage activateStorage () { this.bStorage = true; } |
︙ | |||
229 230 231 232 233 234 235 | 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | + + + + + + + - + + + + + | return this._dLemmas.get(sWord); } return Array.from(new Set(this.getMorph(sWord).map((sMorph) => { return sMorph.slice(1, sMorph.indexOf("/")); }))); } * suggest (sWord, nSuggLimit=10) { // generator: returns 1, 2 or 3 lists of suggestions if (this.oDefaultSugg) { if (this.oDefaultSugg.hasOwnProperty(sWord)) { yield this.oDefaultSugg[sWord].split("|"); } else if (sWord.gl_isTitle() && this.oDefaultSugg.hasOwnProperty(sWord.lower())) { let lRes = this.oDefaultSugg[sWord.toLowerCase()].split("|"); yield lRes.map((sSugg) => { return sSugg.slice(0,1).toUpperCase() + sSugg.slice(1); }); } else { |
︙ |
Added graphspell-js/suggest.js version [c30d93f1aa].
|
Modified graphspell/fr.py from [963bf7ea5b] to [cc9153951f].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | + | """ Default suggestion for French language """ dSugg = { "bcp": "beaucoup", "ca": "ça", "cad": "c’est-à-dire", "cb": "combien|CB", "cdlt": "cordialement", "construirent": "construire|construisirent|construisent|construiront", "càd": "c’est-à-dire", "done": "donc|donne", "dc": "de|donc", "email": "courriel|e-mail|émail", "emails": "courriels|e-mails", "Etes-vous": "Êtes-vous", "Etiez-vous": "Étiez-vous", "Etions-nous": "Étions-nous", "parce-que": "parce que", |
︙ |