Overview
Comment: | [graphspell] JS sucks: for some strange reason, Thunderbird doesn’t like the using of hasOwnProperty with personal Object -> use Map |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | graphspell | v1.1 |
Files: | files | file ages | folders |
SHA3-256: |
8b6694ecca38fa9e726ae0e5c0911000 |
User & Date: | olr on 2019-05-15 07:55:07 |
Other Links: | manifest | tags |
Context
2019-05-15
| ||
09:15 | pylint: exclusion list check-in: a31e62962a user: olr tags: trunk | |
07:55 | [graphspell] JS sucks: for some strange reason, Thunderbird doesn’t like the using of hasOwnProperty with personal Object -> use Map check-in: 8b6694ecca user: olr tags: trunk, graphspell, v1.1 | |
06:30 | [fr] mise à jour du dictionnaire check-in: 07779d8b19 user: olr tags: trunk, fr | |
Changes
Modified graphspell-js/spellchecker.js from [2c21818f72] to [be57805d79].
︙ | ︙ | |||
43 44 45 46 47 48 49 | 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 | | | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | 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.dDefaultSugg = 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 } |
︙ | ︙ | |||
131 132 133 134 135 136 137 | // Default suggestions loadSuggestions (sLangCode) { // load default suggestion module for <sLangCode> // When “import” works everywhere, do like with Python | > | | > > > > | 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | // Default suggestions loadSuggestions (sLangCode) { // load default suggestion module for <sLangCode> // When “import” works everywhere, do like with Python try { if (typeof(suggest) !== 'undefined') { this.dDefaultSugg = suggest[sLangCode]; } } catch (e) { console.error(e); } } // Storage activateStorage () { |
︙ | ︙ | |||
245 246 247 248 249 250 251 | 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 | | | | | | | 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | 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.dDefaultSugg) { if (this.dDefaultSugg.has(sWord)) { yield this.dDefaultSugg.get(sWord).split("|"); } else if (sWord.gl_isTitle() && this.dDefaultSugg.has(sWord.toLowerCase())) { let lRes = this.dDefaultSugg.get(sWord.toLowerCase()).split("|"); yield lRes.map((sSugg) => { return sSugg.slice(0,1).toUpperCase() + sSugg.slice(1); }); } else { yield this.oMainDic.suggest(sWord, nSuggLimit, true); } } else { yield this.oMainDic.suggest(sWord, nSuggLimit, true); } |
︙ | ︙ |
Modified graphspell-js/suggest.js from [c30d93f1aa] to [c5d6fec71a].
1 2 3 4 5 | // JavaScript "use strict"; var suggest = { | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > | > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | // JavaScript "use strict"; var suggest = { fr: new Map ([ ["bcp", "beaucoup"], ["ca", "ça"], ["cad", "c’est-à-dire"], ["cb", "combien|CB"], ["cdlt", "cordialement"], ["construirent", "construire|construisirent|construisent|construiront"], ["càd", "c’est-à-dire"], ["dc", "de|donc"], ["done", "donc|donne"], ["email", "courriel|e-mail|émail"], ["emails", "courriels|e-mails"], ["Etes-vous", "Êtes-vous"], ["Etiez-vous", "Étiez-vous"], ["Etions-vous", "Étions-nous"], ["parce-que", "parce que"], ["pcq", "parce que"], ["pd", "pendant|pédé"], ["pdq", "pendant que"], ["pdt", "pendant"], ["pdtq", "pendant que"], ["pk", "pourquoi"], ["pq", "pourquoi|PQ"], ["prq", "presque"], ["prsq", "presque"], ["qcq", "quiconque"], ["qq", "quelque"], ["qqch", "quelque chose"], ["qqn", "quelqu’un"], ["qqne", "quelqu’une"], ["qqs", "quelques"], ["qqunes", "quelques-unes"], ["qquns", "quelques-uns"], ["tdq", "tandis que"], ["tj", "toujours"], ["tjs", "toujours"], ["tq", "tant que|tandis que"], ["ts", "tous"], ["tt", "tant|tout"], ["tte", "toute"], ["ttes", "toutes"] ]) }; if (typeof(exports) !== 'undefined') { exports.fr = suggest.fr; } |