Changes In Branch nodejs Through [f16a92cab4] Excluding Merge-Ins
This is equivalent to a diff from 4d2953e2f6 to f16a92cab4
2018-10-12
| ||
14:20 | [core][js] Textformater more usable check-in: c70980cc3c user: IllusionPerdu tags: core, nodejs | |
13:35 | [core][js] Textformater add functions check-in: f16a92cab4 user: IllusionPerdu tags: core, nodejs | |
12:03 | [core][js] Fix textformater check-in: dcba084a8d user: IllusionPerdu tags: core, nodejs | |
2018-10-10
| ||
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 compile_rules.py from [6c0309c95b] to [3c1cc360a0].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | + + | """ Grammalecte: compile rules """ import re import os import traceback import json import colorsys import time import compile_rules_js_convert as jsconv import compile_rules_graph as crg dDEF = {} lFUNCTIONS = [] |
︙ | |||
415 416 417 418 419 420 421 | 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 | - + | dColor = {} dOptLabel = {} dOptPriority = {} for sLine in lOptionLines: sLine = sLine.strip() if sLine.startswith("OPTGROUP/"): m = re.match("OPTGROUP/([a-z0-9]+):(.+)$", sLine) |
︙ | |||
461 462 463 464 465 466 467 | 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 | - + + + + + + + + + + | def printBookmark (nLevel, sComment, nLine): "print bookmark within the rules file" print(" {:>6}: {}".format(nLine, " " * nLevel + sComment)) |
︙ | |||
608 609 610 611 612 613 614 | 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 | + + - - - - - - - - + + + + + + + + + - + + + | sJSCallables += " return " + jsconv.py2js(sReturn) + ";\n" sJSCallables += " },\n" displayStats(lParagraphRules, lSentenceRules) print("Unnamed rules: " + str(nRULEWITHOUTNAME)) dVars = { "fBuildTime": fBuildTime, |
Modified compile_rules_graph.py from [f9b11563d7] to [f9c246b8ef].
︙ | |||
314 315 316 317 318 319 320 | 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | - + | sAction = createFunction("da", sActionId, sAction) return [sOption, sCondition, cAction, sAction] else: print(" # Unknown action.", sActionId) return None |
︙ | |||
450 451 452 453 454 455 456 | 450 451 452 453 454 455 456 457 458 459 460 461 | - + - + | print("\nFunctions:") print(sPyCallables) # Result return { "graph_callables": sPyCallables, "graph_callablesJS": sJSCallables, |
Added gc_core/js/exemple-node.js version [e34f3521aa].
|
Modified gc_core/js/lang_core/gc_engine.js from [e6dde271f2] to [5c503d2a3c].
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 | + + - - + + + + + + + + - + | // 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 | + + + - + | version: "${version}", author: "${author}", //// Initialization load: function (sContext="JavaScript", sColorType="aRGB", sPath="") { try { if(typeof(process) !== 'undefined') { var spellchecker = require("../graphspell/spellchecker.js"); _oSpellChecker = new spellchecker.SpellChecker("${lang}", "", "${dic_main_filename_js}", "${dic_extended_filename_js}", "${dic_community_filename_js}", "${dic_personal_filename_js}"); |
︙ | |||
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 () { |
︙ |
Modified gc_core/js/lang_core/gc_options.js from [aa3f5d62cd] to [ece26d7264].
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 [4a0b977685].
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 [3efb8afd5c].
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 [147f1c4e7b].
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 */ |
︙ |
Modified gc_core/js/text.js from [c9e7670db8] to [1251d5448b].
1 | 1 2 3 4 5 6 7 8 9 10 11 12 | + + - - + + | // JavaScript /* jshint esversion:6, -W097 */ |
︙ |
Modified gc_lang/fr/modules-js/conj.js from [8124143953] to [98b99c75fa].
1 2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | + + - - + + + + - + | // 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 | + + + - + - + - + | } 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 [53af2cbc4f].
| 1 2 3 4 5 6 7 8 9 10 11 | - - + + + + |
|
︙ |
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 [6c462561b6].
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | - - - + + + + + + + + + - + |
|
︙ |
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 [7cfc8c21b3].
1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | + + - - + + + + - + | // 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 | + + + - + | 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 [71750ecf21].
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 | + + + - + | } return aSelect; } }; // Initialization if (!phonet.bInit && typeof(process) !== 'undefined') { //Nodejs phonet.init(helpers.loadFile(__dirname+"/phonet_data.json")); |
︙ |
Modified gc_lang/fr/modules-js/textformatter.js from [a9dd9e148e] to [f30182bb9d].
1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | + + - - + + - + | // 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, "…"] ], |
︙ | |||
259 260 261 262 263 264 265 | 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 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 | - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | ]); const dTFOptions = dTFDefaultOptions.gl_shallowCopy(); class TextFormatter { |
Modified graphspell-js/char_player.js from [626d7d161b] to [98e99c3ff4].
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 | - + | }, // Other functions filterSugg: function (aSugg) { return aSugg.filter((sSugg) => { return !sSugg.endsWith("è") && !sSugg.endsWith("È"); }); } |
︙ |
Modified graphspell-js/dawg.js from [d94e6b7163] to [f36dfe75af].
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 [3e56cf75fd].
| 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 | - + + - - + + + + + + + - - - - - - - + + + + + + + + |
|
︙ |
Modified graphspell-js/ibdawg.js from [26e5034903] to [4598bbd432].
| 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) { |
︙ |
Modified graphspell-js/spellchecker.js from [b26374afa0] to [a3d5cf0515].
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> |
︙ |
Modified graphspell-js/str_transform.js from [63ae767339] to [d8c3ab3e0d].
| 1 2 3 4 5 6 7 8 9 10 11 12 | - - + + + + + |
|
︙ |
Added graphspell-js/test/minimal.js version [9a28cea93b].
|
Modified graphspell-js/tokenizer.js from [88bacac87d] to [1dc7e255ce].
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 | - + | 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; |
︙ |
Modified make.py from [b3fb947153] to [7a5afc5f1b].
︙ | |||
182 183 184 185 186 187 188 | 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | - + - + | if not os.path.isdir("grammalecte/graphspell/_dictionaries/"+sf): hZip.write("grammalecte/graphspell/_dictionaries/"+sf, sAddPath+"grammalecte/graphspell/_dictionaries/"+sf) for sf in os.listdir(spLangPack): if not os.path.isdir(spLangPack+"/"+sf): hZip.write(spLangPack+"/"+sf, sAddPath+spLangPack+"/"+sf) |
︙ | |||
371 372 373 374 375 376 377 378 379 380 381 382 383 384 | 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 | + | def main (): "build Grammalecte with requested options" print("Python: " + sys.version) xParser = argparse.ArgumentParser() xParser.add_argument("lang", type=str, nargs='+', help="lang project to generate (name of folder in /lang)") xParser.add_argument("-uc", "--use_cache", help="use data cache instead of rebuilding rules", action="store_true") xParser.add_argument("-b", "--build_data", help="launch build_data.py (part 1 and 2)", action="store_true") xParser.add_argument("-bb", "--build_data_before", help="launch build_data.py (only part 1: before dictionary building)", action="store_true") xParser.add_argument("-ba", "--build_data_after", help="launch build_data.py (only part 2: before dictionary building)", action="store_true") xParser.add_argument("-d", "--dict", help="generate FSA dictionary", action="store_true") xParser.add_argument("-t", "--tests", help="run unit tests", action="store_true") xParser.add_argument("-p", "--perf", help="run performance tests", action="store_true") xParser.add_argument("-pm", "--perf_memo", help="run performance tests and store results in perf_memo.txt", action="store_true") |
︙ | |||
438 439 440 441 442 443 444 | 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 | - + | if databuild and xArgs.build_data_after: databuild.after('gc_lang/'+sLang, dVars, xArgs.javascript) # copy dictionaries from Graphspell copyGraphspellDictionaries(dVars, xArgs.javascript, xArgs.add_extended_dictionary, xArgs.add_community_dictionary, xArgs.add_personal_dictionary) # make |
︙ |