Changes In Branch nodejs Through [2d5c0dce59] Excluding Merge-Ins
This is equivalent to a diff from 4d2953e2f6 to 2d5c0dce59
2018-10-10
| ||
12:23 | [js] Minimal file to use in node check-in: a43e8d10eb user: IllusionPerdu tags: njs, nodejs | |
12:08 | [js] All Grammalecte work in node check-in: 2d5c0dce59 user: IllusionPerdu tags: njs, nodejs | |
09:36 | Minimal file to use in node check-in: b79bb889b9 user: IllusionPerdu tags: graphspell, njs, nodejs | |
09:19 | Some change to javascript to work in node check-in: a3687f4fd3 user: IllusionPerdu tags: graphspell, njs, nodejs | |
09:03 | [fr] test faux positif check-in: bdcc97b45b user: olr tags: trunk, fr | |
2018-10-09
| ||
11:07 | [graphspell][js] useless comments check-in: 4d2953e2f6 user: olr tags: trunk, graphspell | |
08:54 | [graphspell][js] performance tests check-in: 14ed269c7c user: olr tags: trunk, graphspell | |
Modified gc_core/js/lang_core/gc_engine.js from [e6dde271f2] to [47ef94b478].
1 | 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 | + + - - + + - - - + + + - - - - - - + + + + + + + + + + + + | // Grammar checker engine /* jshint esversion:6, -W097 */ |
︙ | |||
49 50 51 52 53 54 55 | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | - - + + + + + | version: "${version}", author: "${author}", //// Initialization load: function (sContext="JavaScript", sColorType="aRGB", sPath="") { try { |
︙ | |||
177 178 179 180 181 182 183 | 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | - + | this.dTokenPos = new Map(); this.dTags = new Map(); this.dError = new Map(); this.dErrorPriority = new Map(); // Key = position; value = priority } asString () { |
︙ | |||
1385 1386 1387 1388 1389 1390 1391 | 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 | - + | ${callablesJS} // callables for graph rules ${graph_callablesJS} } |
︙ |
Modified gc_core/js/lang_core/gc_options.js from [aa3f5d62cd] to [a80ff5a6ee].
1 | 1 2 3 4 5 6 7 8 9 10 11 12 | + + - - + + | // Options for Grammalecte /* jshint esversion:6 */ |
︙ | |||
21 22 23 24 25 26 27 | 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 54 55 56 57 58 | - + - + - + - + - - - + + + | for (let [sOpt, sColor] of Object.entries(dOptColor)) { dColor[sOpt] = dColorType[sColor]; } return dColor; } catch (e) { console.error(e); |
Modified gc_core/js/lang_core/gc_rules.js from [cdb121423e] to [c719e5aff6].
1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | + + - + - + - + | // Grammar checker rules /* jshint esversion:6, -W097 */ |
Modified gc_core/js/lang_core/gc_rules_graph.js from [7405261f29] to [41e4864e6c].
1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | + + - + - + - + - + | // Grammar checker graph rules /* jshint esversion:6, -W097 */ |
Modified gc_core/js/tests.js from [1eda44faf6] to [2455a96fb4].
1 | 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 | + + - - + + - - + + + + + + + + - + + | // JavaScript /* jshint esversion:6, -W097 */ |
︙ | |||
149 150 151 152 153 154 155 | 158 159 160 161 162 163 164 165 166 167 | - + | } return [" ".repeat(sLine.length), ""]; } } |
Modified gc_core/js/text.js from [c9e7670db8] to [2540b2b127].
1 | 1 2 3 4 5 6 7 8 9 10 11 12 | + + - - + + | // JavaScript /* jshint esversion:6, -W097 */ |
︙ | |||
55 56 57 58 59 60 61 | 57 58 59 60 61 62 63 64 65 66 67 68 | - + | console.error(e); return "\n# Error. Data: " + oErr.toString(); } } }; |
Modified gc_lang/fr/modules-js/conj.js from [8124143953] to [9586582de9].
1 2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | + + - - + + - + - - + + + + | // Grammalecte - Conjugueur // License: GPL 3 /* jshint esversion:6, -W097 */ |
︙ | |||
492 493 494 495 496 497 498 | 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 | + + + - + - - + + - - + + - - + + - + - + - + - + | } return (this.dConj.get(":Q").get(":Q4")) ? this.dConj.get(":Q").get(":Q4") : this.dConj.get(":Q").get(":Q1"); } } // Initialization if(!conj.bInit && typeof process !== 'undefined') { // Work with nodejs conj.init(helpers.loadFile(__dirname+'/conj_data.json')); |
︙ |
Modified gc_lang/fr/modules-js/conj_generator.js from [058e3de2f7] to [5e8295b732].
1 2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | - - - - + + + + + + | // JavaScript |
︙ | |||
135 136 137 138 139 140 141 | 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | - + | [2, "isses", ":Sp:Sq:2s/*", false], [2, "isse", ":Sp:3s/*", false], [2, "ît", ":Sq:3s/*", false], [2, "is", ":E:2s/*", false], [2, "issons", ":E:1p/*", false], [2, "issez", ":E:2p/*", false] ], |
︙ |
Modified gc_lang/fr/modules-js/cregex.js from [97d67d03aa] to [9727baa3eb].
| 1 2 3 4 5 6 7 8 9 10 11 | - - + + + + |
|
︙ | |||
263 264 265 266 267 268 269 | 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | - + | return false; } return lMorph.some(s => this._zNPm.test(s)); } }; |
︙ |
Modified gc_lang/fr/modules-js/gce_analyseur.js from [427ee71140] to [09241345b5].
| 1 2 3 4 5 6 7 8 9 10 11 | - - + + + + |
|
︙ | |||
126 127 128 129 130 131 132 | 128 129 130 131 132 133 134 135 136 137 138 139 140 | - + | if (s.length > 1 && s.length < 16 && s.slice(0, 1).gl_isLowerCase() && (!s.slice(1).gl_isLowerCase() || /[0-9]/.test(s))) { return true; } return false; } |
Modified gc_lang/fr/modules-js/gce_date_verif.js from [f30dbe242e] to [8555f52be9].
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | - + - + - + + |
|
︙ |
Modified gc_lang/fr/modules-js/gce_suggestions.js from [ae7eaca80b] to [b2f66a0847].
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | - - - + + + + + - - - - + + + + + + + + |
|
︙ |
Modified gc_lang/fr/modules-js/lexicographe.js from [3f0da2f1ff] to [50f4dc02f6].
1 2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 | + + - - + + | // Grammalecte - Lexicographe // License: MPL 2 /* jshint esversion:6, -W097 */ |
︙ |
Modified gc_lang/fr/modules-js/mfsp.js from [9d6124ec70] to [d93c273b71].
1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | + + - - + + - - + + + + | // Grammalecte /* jshint esversion:6, -W097 */ |
︙ | |||
100 101 102 103 104 105 106 | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | + + + - + - + - + - + - + - + | return "## erreur, code : " + sSfx + " ##"; } } }; // Initialization if(!mfsp.bInit && typeof process !== 'undefined') { //Nodejs mfsp.init(helpers.loadFile(__dirname+'/mfsp_data.json')); |
Modified gc_lang/fr/modules-js/phonet.js from [07bba03053] to [fb94b7fe43].
1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | + + - + + - + + + | // Grammalecte - Suggestion phonétique /* jshint esversion:6 */ |
︙ | |||
80 81 82 83 84 85 86 | 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | - + + + + - - + + - + - + - + - + | } return aSelect; } }; // Initialization |
Modified gc_lang/fr/modules-js/textformatter.js from [a9dd9e148e] to [526f0b2382].
1 | 1 2 3 4 5 6 7 8 9 10 11 12 | + + - - + + | // Grammalecte - text formatter /* jshint esversion:6, -W097 */ |
︙ | |||
81 82 83 84 85 86 87 | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | - + | "erase_non_breaking_hyphens": [ [//g, ""] ], //// typographic signs "ts_apostrophe": [ [/\b([ldnjmtscç])['´‘′`](?=[a-zA-Zà-ö0-9À-Öø-ÿØ-ßĀ-ʯ])/ig, "$1’"], [/\b(qu|jusqu|lorsqu|puisqu|quoiqu|quelqu|presqu|entr|aujourd|prud)['´‘′`]/ig, "$1’"] ], "ts_ellipsis": [ [/\.\.\./g, "…"], [/…\.\./g, "……"], [/…\.(?!\.)/g, "…"] ], |
︙ | |||
283 284 285 286 287 288 289 | 285 286 287 288 289 290 291 292 293 294 295 | - + | getDefaultOptions () { return dTFDefaultOptions; } } |
Modified graphspell-js/char_player.js from [626d7d161b] to [27827e9132].
1 2 3 4 5 6 7 8 9 10 | 1 2 3 4 5 6 7 8 9 10 11 12 13 | + + + | // list of similar chars // useful for suggestion mechanism /* jshint esversion:6 */ /* jslint esversion:6 */ ${map} var char_player = { _xTransCharsForSpelling: new Map([ ['ſ', 's'], ['ffi', 'ffi'], ['ffl', 'ffl'], ['ff', 'ff'], ['ſt', 'ft'], ['fi', 'fi'], ['fl', 'fl'], ['st', 'st'] |
︙ | |||
21 22 23 24 25 26 27 | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | - + | _xTransCharsForSimplification: new Map([ ['à', 'a'], ['é', 'e'], ['î', 'i'], ['ô', 'o'], ['û', 'u'], ['ÿ', 'i'], ['y', 'i'], ['â', 'a'], ['è', 'e'], ['ï', 'i'], ['ö', 'o'], ['ù', 'u'], ['ŷ', 'i'], ['ä', 'a'], ['ê', 'e'], ['í', 'i'], ['ó', 'o'], ['ü', 'u'], ['ý', 'i'], ['á', 'a'], ['ë', 'e'], ['ì', 'i'], ['ò', 'o'], ['ú', 'u'], ['ỳ', 'i'], ['ā', 'a'], ['ē', 'e'], ['ī', 'i'], ['ō', 'o'], ['ū', 'u'], ['ȳ', 'i'], ['ç', 'c'], ['ñ', 'n'], ['k', 'q'], ['w', 'v'], |
︙ | |||
100 101 102 103 104 105 106 | 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | - + | ["Ë", "EeÉéÈèÊêËëĒēŒœ"], ["f", "fF"], ["F", "Ff"], ["g", "gGjJĵĴ"], ["G", "GgJjĴĵ"], |
︙ | |||
378 379 380 381 382 383 384 | 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 | - + - + | }, // Other functions filterSugg: function (aSugg) { return aSugg.filter((sSugg) => { return !sSugg.endsWith("è") && !sSugg.endsWith("È"); }); } |
︙ |
Modified graphspell-js/dawg.js from [d94e6b7163] to [56edbc7aa3].
1 2 3 4 5 6 7 8 9 10 11 12 | 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 | + + + + - - - + + + + - | // JavaScript // FSA DICTIONARY BUILDER // // by Olivier R. // License: MPL 2 // // This tool encodes lexicon into an indexable binary dictionary // Input files MUST be encoded in UTF-8. /* jshint esversion:6, -W097 */ /* jslint esversion:6 */ /* global require, exports, console, helpers */ "use strict"; |
︙ | |||
96 97 98 99 100 101 102 | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | - + | let lWord = []; for (let [sFlex, iAff, iTag] of lEntry) { let lTemp = []; for (let c of sFlex) { lTemp.push(dChar.get(c)); } lTemp.push(iAff+nChar); |
︙ | |||
426 427 428 429 430 431 432 | 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 | - + | this.nNextId += 1; return this.nNextId-1; }, reset: function () { this.nNextId = 0; } |
︙ | |||
540 541 542 543 544 545 546 | 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 | - + | convValueToHexString (nVal, nByte) { // nVal: value to convert, nByte: number of bytes let sHexVal = nVal.toString(16); // conversion to hexadecimal string //console.log(`value: ${nVal} in ${nByte} bytes`); if (sHexVal.length < (nByte*2)) { return "0".repeat((nByte*2) - sHexVal.length) + sHexVal; } else if (sHexVal.length == (nByte*2)) { |
︙ |
Modified graphspell-js/helpers.js from [6ccb02c60d] to [2ed0ee7e88].
| 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 | - + + - - + + + + + + + - - - - - - - + + + + + + + + |
|
︙ | |||
57 58 59 60 61 62 63 | 64 65 66 67 68 69 70 71 72 73 74 75 76 | - + | obj[k] = v; } return obj; } }; |
Modified graphspell-js/ibdawg.js from [26e5034903] to [3da9a9daaf].
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | - - - + + + + + - - - - - + + + + + + + + - |
|
︙ | |||
93 94 95 96 97 98 99 | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | + + + + - + + | // INDEXABLE BINARY DIRECT ACYCLIC WORD GRAPH constructor (param1, sPath="") { // param1 can be a filename or a object with all the necessary data. try { let oData = null; if (typeof(param1) == "string") { let sURL; if(typeof process !== 'undefined') { sURL = (sPath !== "") ? sPath + "/" + param1 : __dirname + "/_dictionaries/"+param1; } else { |
︙ | |||
219 220 221 222 223 224 225 | 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | - + | "l2grams": this.l2grams }; return oJSON; } isValidToken (sToken) { // checks if sToken is valid (if there is hyphens in sToken, sToken is split, each part is checked) |
︙ | |||
296 297 298 299 300 301 302 | 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 | - + - - + + - + - - + | } } return Boolean(this._convBytesToInteger(this.byDic.slice(iAddr, iAddr+this.nBytesArc)) & this._finalNodeMask); } getMorph (sWord) { // retrieves morphologies list, different casing allowed |
︙ | |||
587 588 589 590 591 592 593 | 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 | - + | } iAddr = iEndArcAddr + this.nBytesNodeAddress; } } } * _getArcs1 (iAddr) { |
︙ | |||
628 629 630 631 632 633 634 | 636 637 638 639 640 641 642 643 644 645 | - + | _lookupArcNode3 (nVal, iAddr) { // to do } } |
Modified graphspell-js/spellchecker.js from [b26374afa0] to [6b69161b99].
1 2 3 4 5 6 7 8 9 10 11 12 13 | 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 | + + + - - - - + + + + + + - | // Spellchecker // Wrapper for the IBDAWG class. // Useful to check several dictionaries at once. // To avoid iterating over a pile of dictionaries, it is assumed that 3 are enough: // - the main dictionary, bundled with the package // - the extended dictionary // - the community dictionary, added by an organization // - the personal dictionary, created by the user for its own convenience /* jshint esversion:6, -W097 */ /* jslint esversion:6 */ /* global require, exports, console, IBDAWG, Tokenizer */ "use strict"; |
︙ | |||
62 63 64 65 66 67 68 | 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | - + | } } catch (e) { let sfDictionary = (typeof(dictionary) == "string") ? dictionary : dictionary.sLangName + "/" + dictionary.sFileName; if (bNecessary) { throw "Error: <" + sfDictionary + "> not loaded. " + e.message; } |
︙ | |||
193 194 195 196 197 198 199 | 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | - + - + | // checks if sWord is valid (different casing tested if the first letter is a capital) if (this.oMainDic.isValid(sWord)) { return true; } if (this.bExtendedDic && this.oExtendedDic.isValid(sWord)) { return true; } |
︙ | |||
269 270 271 272 273 274 275 | 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | - + | if (this.bPersonalDic) { yield this.oPersonalDic.suggest(sWord, nSuggLimit); } } * select (sFlexPattern="", sTagsPattern="") { // generator: returns all entries which flexion fits <sFlexPattern> and morphology fits <sTagsPattern> |
︙ | |||
297 298 299 300 301 302 303 | 301 302 303 304 305 306 307 308 309 310 | - + | if (this.bPersonalDic) { lResult.push(...this.oPersonalDic.getSimilarEntries(sWord, nSuggLimit)); } return lResult; } } |
Modified graphspell-js/str_transform.js from [63ae767339] to [2ff1a56a97].
| 1 2 3 4 5 6 7 8 9 10 11 12 | - - + + + + + |
|
︙ | |||
216 217 218 219 220 221 222 | 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | - + | let [sPfxCode, sSfxCode] = sAffCode.split('/'); sWord = sPfxCode.slice(1) + sWord.slice(sPfxCode.charCodeAt(0)-48); return sSfxCode[0] == '0' ? sWord + sSfxCode.slice(1) : sWord.slice(0, -(sSfxCode.charCodeAt(0)-48)) + sSfxCode.slice(1); } }; |
Added graphspell-js/test/minimal.js version [9a28cea93b].
|
Modified graphspell-js/tokenizer.js from [88bacac87d] to [541689c69f].
1 2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 | + + - - + + | // JavaScript // Very simple tokenizer /* jshint esversion:6, -W097 */ |
︙ | |||
68 69 70 71 72 73 74 | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | - + - + | while (sText) { let iCut = 1; for (let [zRegex, sType] of this.aRules) { if (sType !== "SPACE" || bWithSpaces) { try { if ((m = zRegex.exec(sText)) !== null) { iToken += 1; |