Changes In Branch salxg Through [26f692e745] Excluding Merge-Ins
This is equivalent to a diff from ad847e39e2 to 26f692e745
2020-08-26
| ||
17:02 | [fr] ajustements check-in: fb7fbed379 user: olr tags: trunk, fr | |
08:16 | [graphspell] spellchecker: fix call to setLabelsOnToken check-in: dca1db07b3 user: olr tags: graphspell, salxg | |
08:15 | [graphspell][py] lexicographer: function setLabelsOnToken() check-in: 26f692e745 user: olr tags: graphspell, salxg | |
2020-08-25
| ||
16:03 | [core][graphspell][fx] update lexicographer check-in: 257257469a user: olr tags: core, fx, graphspell, salxg | |
2020-08-23
| ||
06:26 | merge trunk check-in: b4b3569231 user: olr tags: salxg | |
05:44 | [lo] fix lexicon editor check-in: ad847e39e2 user: olr tags: trunk, lo | |
05:38 | [fx] fix lexicon editor check-in: b14f8f2526 user: olr tags: trunk, fx | |
Modified gc_core/js/lang_core/gc_engine.js from [1328582cce] to [c1f3aa973c].
︙ | |||
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | 193 194 195 196 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 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | + + - + - + - + - - - - - - - + + + + + + + + + + + + + + + + | // parse paragraph try { this.parseText(this.sText, this.sText0, true, 0, sCountry, dOpt, bShowRuleId, bDebug, bContext); } catch (e) { console.error(e); } this.lTokens = null; this.lTokens0 = null; let lParagraphErrors = null; if (bFullInfo) { lParagraphErrors = Array.from(this.dError.values()); this.dSentenceError.clear(); } // parse sentence let sText = this._getCleanText(); let lSentences = []; let oSentence = null; for (let [iStart, iEnd] of text.getSentenceBoundaries(sText)) { try { this.sSentence = sText.slice(iStart, iEnd); this.sSentence0 = this.sText0.slice(iStart, iEnd); this.nOffsetWithinParagraph = iStart; |
︙ | |||
370 371 372 373 374 375 376 | 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | - + - + | if (this.dTokenPos.gl_get(oToken["nStart"], {}).hasOwnProperty("lMorph")) { oToken["lMorph"] = this.dTokenPos.get(oToken["nStart"])["lMorph"]; } if (this.dTokenPos.gl_get(oToken["nStart"], {}).hasOwnProperty("aTags")) { oToken["aTags"] = this.dTokenPos.get(oToken["nStart"])["aTags"]; } } |
︙ | |||
612 613 614 615 616 617 618 | 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 | - + | } parseGraph (oGraph, sCountry="${country_default}", dOptions=null, bShowRuleId=false, bDebug=false, bContext=false) { // parse graph with tokens from the text and execute actions encountered let lPointer = []; let bTagAndRewrite = false; try { |
︙ | |||
664 665 666 667 668 669 670 | 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 | - - + + - + - - + + - + - - + + - + - - + + - + - + - - + + - - + + | // Suggestion [ option, condition, "-", replacement/suggestion/action, iTokenStart, iTokenEnd, cStartLimit, cEndLimit, bCaseSvty, nPriority, sMessage, iURL ] // TextProcessor [ option, condition, "~", replacement/suggestion/action, iTokenStart, iTokenEnd, bCaseSvty ] // Disambiguator [ option, condition, "=", replacement/suggestion/action ] // Tag [ option, condition, "/", replacement/suggestion/action, iTokenStart, iTokenEnd ] // Immunity [ option, condition, "!", "", iTokenStart, iTokenEnd ] // Test [ option, condition, ">", "" ] if (!sOption || dOptions.gl_get(sOption, false)) { |
︙ | |||
806 807 808 809 810 811 812 | 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 | - - + + - + - - + + | return this._createError(nStart, nEnd, sLineId, sRuleId, sOption, sMessage, lSugg, sURL, bContext); } _createErrorFromTokens (sSugg, nTokenOffset, nLastToken, iFirstToken, nStart, nEnd, sLineId, sRuleId, bCaseSvty, sMsg, sURL, bShowRuleId, sOption, bContext) { // suggestions let lSugg = []; if (sSugg.startsWith("=")) { |
︙ | |||
851 852 853 854 855 856 857 | 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 | - + - + | return oErr; } _expand (sText, nTokenOffset, nLastToken) { let m; while ((m = /\\(-?[0-9]+)/.exec(sText)) !== null) { if (m[1].slice(0,1) == "-") { |
︙ | |||
892 893 894 895 896 897 898 | 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 | - + - + - + - + - + - - + + - + - + - + - + + - + + + | } _tagAndPrepareTokenForRewriting (sWhat, nTokenRewriteStart, nTokenRewriteEnd, nTokenOffset, nLastToken, bCaseSvty, bDebug) { // text processor: rewrite tokens between <nTokenRewriteStart> and <nTokenRewriteEnd> position if (sWhat === "*") { // purge text if (nTokenRewriteEnd - nTokenRewriteStart == 0) { |
︙ | |||
1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 | 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 | + + + - - + + + + + + | this.dTokenPos.delete(oToken["nStart"]); } catch (e) { console.log(this.asString()); console.log(oToken); } } if (this.lTokens0 !== null && bKeepToken0) { lNewTokens0.push(oToken); } } if (bDebug) { console.log(" TEXT REWRITED: " + this.sSentence); } |
︙ |
Modified gc_core/py/lang_core/gc_engine.py from [472d04d897] to [95514cb21c].
︙ | |||
231 232 233 234 235 236 237 | 231 232 233 234 235 236 237 238 239 240 241 242 243 244 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 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 | - + - + + + - - + + - - - - - + - - + + + + + + + + + + + + + | def __init__ (self, sText): self.sText = sText self.sText0 = sText self.sSentence = "" self.sSentence0 = "" self.nOffsetWithinParagraph = 0 |
︙ | |||
377 378 379 380 381 382 383 | 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 | - - + + - - + + | self.sText = sText else: self.sSentence = sText def update (self, sSentence, bDebug=False): "update <sSentence> and retokenize" self.sSentence = sSentence |
︙ | |||
548 549 550 551 552 553 554 | 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 | - + | dPointer2 = { "iToken1": iToken1, "iNode": dNode["<>"], "bKeep": True } yield from self._getNextPointers(dToken, dGraph, dPointer2, bDebug) def parseGraph (self, dGraph, sCountry="${country_default}", dOptions=None, bShowRuleId=False, bDebug=False, bContext=False): "parse graph with tokens from the text and execute actions encountered" lPointer = [] bTagAndRewrite = False |
︙ | |||
589 590 591 592 593 594 595 | 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 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 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 | - + - + - - + + - + - + - + - - + + - + - + - - + + - - + + | # Suggestion [ option, condition, "-", replacement/suggestion/action, iTokenStart, iTokenEnd, cStartLimit, cEndLimit, bCaseSvty, nPriority, sMessage, iURL ] # TextProcessor [ option, condition, "~", replacement/suggestion/action, iTokenStart, iTokenEnd, bCaseSvty ] # Disambiguator [ option, condition, "=", replacement/suggestion/action ] # Tag [ option, condition, "/", replacement/suggestion/action, iTokenStart, iTokenEnd ] # Immunity [ option, condition, "!", "", iTokenStart, iTokenEnd ] # Test [ option, condition, ">", "" ] if not sOption or dOptions.get(sOption, False): |
︙ | |||
692 693 694 695 696 697 698 | 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 | - + - + - + | if _bWriterError: return self._createErrorForWriter(nStart, nEnd - nStart, sRuleId, sOption, sMessage, lSugg, sURL) return self._createErrorAsDict(nStart, nEnd, sLineId, sRuleId, sOption, sMessage, lSugg, sURL, bContext) def _createErrorFromTokens (self, sSugg, nTokenOffset, nLastToken, iFirstToken, nStart, nEnd, sLineId, sRuleId, bCaseSvty, sMsg, sURL, bShowRuleId, sOption, bContext): # suggestions if sSugg[0:1] == "=": |
︙ | |||
750 751 752 753 754 755 756 | 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 | - + - + | dErr['sBefore'] = self.sText0[max(0,nStart-80):nStart] dErr['sAfter'] = self.sText0[nEnd:nEnd+80] return dErr def _expand (self, sText, nTokenOffset, nLastToken): for m in re.finditer(r"\\(-?[0-9]+)", sText): if m.group(1)[0:1] == "-": |
︙ | |||
779 780 781 782 783 784 785 | 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 | - + - + - + - + - + - + - + - + - + - + + - + - + + + + + - + + - + + + - - + + + + + | return sText[0:m.start(iGroup)] + sNew + sText[m.end(iGroup):] def _tagAndPrepareTokenForRewriting (self, sWhat, nTokenRewriteStart, nTokenRewriteEnd, nTokenOffset, nLastToken, bCaseSvty, bDebug): "text processor: rewrite tokens between <nTokenRewriteStart> and <nTokenRewriteEnd> position" if sWhat == "*": # purge text if nTokenRewriteEnd - nTokenRewriteStart == 0: |
Modified gc_lang/fr/webext/content_scripts/init.js from [d6a977e5a7] to [b54947b0d1].
︙ | |||
340 341 342 343 344 345 346 | 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | - - + + - - + + | this.send("parseAndSpellcheck", { sText: sText, sCountry: "FR", bDebug: false, bContext: false }, { sDestination: sDestination }); }, parseAndSpellcheck1: function (sText, sDestination, sParagraphId) { this.send("parseAndSpellcheck1", { sText: sText, sCountry: "FR", bDebug: false, bContext: false }, { sDestination: sDestination, sParagraphId: sParagraphId }); }, |
︙ | |||
418 419 420 421 422 423 424 | 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 | - + + + + - - - - - + + + + + + | break; case "parseAndSpellcheck1": if (oInfo.sDestination == "__GrammalectePanel__") { oGrammalecte.oGCPanel.refreshParagraph(oInfo.sParagraphId, result); } break; case "parseFull": |
︙ |
Modified gc_lang/fr/webext/content_scripts/panel_gc.css from [9a73dd19f8] to [89a25fc756].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 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 | + + - - - - | /* Grammar checker */ div#grammalecte_gc_panel_content { position: absolute; height: 100%; width: 100%; margin: 0; overflow: auto; } div.grammalecte_paragraph_block { margin: 5px 5px 0 5px; background-color: hsl(0, 0%, 96%); border-radius: 2px; } |
︙ | |||
43 44 45 46 47 48 49 50 51 52 53 54 55 56 | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | + + + + + + + | cursor: pointer; font-family: "Trebuchet MS", "Fira Sans", "Liberation Sans", sans-serif; font-size: 14px; color: hsl(0, 0%, 96%); border-radius: 2px; } div.grammalecte_paragraph_actions .grammalecte_blue { color: hsl(0, 0%, 80%); } div.grammalecte_paragraph_actions .grammalecte_blue:hover { background-color: hsl(210, 50%, 40%); color: hsl(0, 0%, 100%); } div.grammalecte_paragraph_actions .grammalecte_green { color: hsl(0, 0%, 80%); } div.grammalecte_paragraph_actions .grammalecte_green:hover { background-color: hsl(120, 50%, 40%); color: hsl(0, 0%, 100%); } |
︙ |
Modified gc_lang/fr/webext/content_scripts/panel_gc.js from [5158e88aeb] to [c04a1ec88f].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 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 | + + + | // JavaScript /* jshint esversion:6, -W097 */ /* jslint esversion:6 */ /* global GrammalectePanel, oGrammalecte, oGrammalecteBackgroundPort, showError, window, document, console */ "use strict"; function onGrammalecteGCPanelClick (xEvent) { try { let xElem = xEvent.target; if (xElem.id) { if (xElem.id.startsWith("grammalecte_sugg")) { oGrammalecte.oGCPanel.applySuggestion(xElem.id); } else if (xElem.id === "grammalecte_tooltip_ignore") { oGrammalecte.oGCPanel.ignoreError(xElem.id); } else if (xElem.id.startsWith("grammalecte_analysis")) { oGrammalecte.oGCPanel.sendParagraphToGrammaticalAnalysis(parseInt(xElem.dataset.para_num, 10)); } else if (xElem.id.startsWith("grammalecte_check")) { oGrammalecte.oGCPanel.recheckParagraph(parseInt(xElem.dataset.para_num, 10)); } else if (xElem.id.startsWith("grammalecte_hide")) { xElem.parentNode.parentNode.style.display = "none"; } else if (xElem.id.startsWith("grammalecte_err") && xElem.className !== "grammalecte_error_corrected" && xElem.className !== "grammalecte_error_ignored") { |
︙ | |||
62 63 64 65 66 67 68 69 70 71 72 73 74 75 | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | + + + + + + + + + + + + | this.oTextControl = null; this.nLastResult = 0; this.iLastEditedParagraph = -1; this.nParagraph = 0; // Lexicographer this.nLxgCount = 0; this.xLxgPanelContent = oGrammalecte.createNode("div", {id: "grammalecte_lxg_panel_content"}); this.xLxgInputBlock = oGrammalecte.createNode("div", {id: "grammalecte_lxg_input_block"}); this.xLxgInput = oGrammalecte.createNode("div", {id: "grammalecte_lxg_input", lang: "fr", contentEditable: "true"}); this.xLxgInputButton = oGrammalecte.createNode("div", {id: "grammalecte_lxg_input_button", textContent: "Analyse grammaticale"}); this.xLxgInputButton.addEventListener("click", () => { this.grammaticalAnalysis(); }, false); this.xLxgInputButton2 = oGrammalecte.createNode("div", {id: "grammalecte_lxg_input_button", textContent: "Analyse lexicale"}); this.xLxgInputButton2.addEventListener("click", () => { this.getListOfTokens(); }, false); this.xLxgInputBlock.appendChild(this.xLxgInput); this.xLxgInputBlock.appendChild(this.xLxgInputButton); this.xLxgInputBlock.appendChild(this.xLxgInputButton2); this.xLxgPanelContent.appendChild(this.xLxgInputBlock); this.xLxgResultZone = oGrammalecte.createNode("div", {id: "grammalecte_lxg_result_zone"}); this.xLxgPanelContent.appendChild(this.xLxgResultZone); this.xPanelContent.appendChild(this.xLxgPanelContent); // Conjugueur this.xConjPanelContent = oGrammalecte.createNode("div", {id: "grammalecte_conj_panel_content"}); this.xConjPanelContent.innerHTML = sGrammalecteConjugueurHTML; // @Reviewers: sGrammalecteConjugueurHTML is a const value defined in <content_scripts/html_src.js> this.xPanelContent.appendChild(this.xConjPanelContent); this.sVerb = ""; this.bListenConj = false; |
︙ | |||
110 111 112 113 114 115 116 | 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | - - - - | oGrammalecte.bAutoRefresh = this.bAutoRefresh; browser.storage.local.set({"autorefresh_option": this.bAutoRefresh}); this.setAutoRefreshButton(); } this.xLxgButton.onclick = () => { if (!this.bWorking) { this.showLexicographer(); |
︙ | |||
236 237 238 239 240 241 242 | 247 248 249 250 251 252 253 254 255 256 257 258 259 260 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 | - + + - - - + + + | this.oTextControl.clear(); } addParagraphResult (oResult) { try { this.resetTimer(); if (oResult && (oResult.sParagraph.trim() !== "" || oResult.aGrammErr.length > 0 || oResult.aSpellErr.length > 0)) { |
︙ | |||
528 529 530 531 532 533 534 | 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 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 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 | - - - + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - + + + + + - + + | } } // Lexicographer clearLexicographer () { this.nLxgCount = 0; |
︙ | |||
598 599 600 601 602 603 604 | 705 706 707 708 709 710 711 712 713 714 715 716 717 718 | - - - - - - | return xTokenDescr; } catch (e) { showError(e); } } |
︙ |
Modified gc_lang/fr/webext/content_scripts/panel_lxg.css from [ae4f6ddf8d] to [e1c944551d].
1 2 3 4 5 6 7 8 9 10 11 | 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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + - + - + | /* Lexicographer */ div#grammalecte_lxg_panel_content { display: none; position: absolute; height: 100%; width: 100%; font-size: 13px; } div#grammalecte_lxg_input_block { padding: 10px; /*background-color: hsl(210, 50%, 95%);*/ /*border-bottom: solid 1px hsl(210, 0%, 90%);*/ text-align: right; } div#grammalecte_lxg_result_zone { } div#grammalecte_lxg_input { min-height: 100px; padding: 10px; background-color: hsl(210, 0%, 100%); border: solid 1px hsl(210, 20%, 80%); border-radius: 3px; font-family: "Courier New", Courier, "Lucida Sans Typewriter", "Lucida Typewriter", monospace; text-align: left; } div#grammalecte_lxg_input_button { display: inline-block; margin: 0 10px 0 0; padding: 3px 10px; background-color: hsl(210, 50%, 50%); color: hsl(210, 50%, 98%); text-align: center; cursor: pointer; border-radius: 0 0 3px 3px; } |
︙ | |||
83 84 85 86 87 88 89 90 91 92 93 94 95 96 | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | + + + + + + | font-family: "Trebuchet MS", "Fira Sans", "Ubuntu Condensed", "Liberation Sans", sans-serif; color: hsl(0, 0%, 0%); } div.grammalecte_lxg_morph_elem { font-family: "Trebuchet MS", "Fira Sans", "Ubuntu Condensed", "Liberation Sans", sans-serif; color: hsl(0, 0%, 0%); } div.grammalecte_lxg_other_tags { padding-left: 20px; font-family: "Trebuchet MS", "Fira Sans", "Ubuntu Condensed", "Liberation Sans", sans-serif; color: hsl(0, 0%, 50%); } div.grammalecte_lxg_token_LOC { background-color: hsla(150, 50%, 30%, 1); } div.grammalecte_lxg_token_WORD { background-color: hsla(150, 50%, 50%, 1); } div.grammalecte_lxg_token_WORD_ELIDED { |
︙ |
Modified gc_lang/fr/webext/gce_worker.js from [e351d5e6fd] to [e86439bcff].
︙ | |||
227 228 229 230 231 232 233 | 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | - + - - + - - - + + - - - - + - + | function parseAndSpellcheck1 (sParagraph, sCountry, bDebug, bContext, oInfo={}) { sParagraph = sParagraph.replace(//g, "").normalize("NFC"); let aGrammErr = gc_engine.parse(sParagraph, sCountry, bDebug, null, bContext); let aSpellErr = oSpellChecker.parseParagraph(sParagraph); postMessage(createResponse("parseAndSpellcheck1", {sParagraph: sParagraph, aGrammErr: aGrammErr, aSpellErr: aSpellErr}, oInfo, true)); } |
︙ |
Modified grammalecte-cli.py from [0e5de0a660] to [d8f015f794].
︙ | |||
338 339 340 341 342 343 344 | 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | - + | if xArgs.textformatter: sParagraph = oTextFormatter.formatText(sParagraph) lParagraphErrors, lSentences = oGrammarChecker.gce.parse(sParagraph, bDebug=xArgs.debug, bFullInfo=True) echo(txt.getReadableErrors(lParagraphErrors, xArgs.width)) for dSentence in lSentences: echo("{nStart}:{nEnd}".format(**dSentence)) echo(" <" + dSentence["sSentence"]+">") |
︙ |
Modified graphspell-js/lexgraph_fr.js from [9858773647] to [e233698561].
︙ | |||
162 163 164 165 166 167 168 | 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | - - - + + + + + + | [':e', [" épicène", "épicène"]], [':m', [" masculin", "masculin"]], [':f', [" féminin", "féminin"]], [':s', [" singulier", "singulier"]], [':p', [" pluriel", "pluriel"]], [':i', [" invariable", "invariable"]], |
︙ | |||
219 220 221 222 223 224 225 | 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | - - - - - - + + + + + + | [':O3', [" 3ᵉ pers.,", "Pronom : 3ᵉ personne"]], [':C', [" conjonction,", "Conjonction"]], [':Ĉ', [" conjonction (él.),", "Conjonction (élément)"]], [':Cc', [" conjonction de coordination,", "Conjonction de coordination"]], [':Cs', [" conjonction de subordination,", "Conjonction de subordination"]], [':Ĉs', [" conjonction de subordination (él.),", "Conjonction de subordination (élément)"]], |
︙ | |||
275 276 277 278 279 280 281 | 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 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | - - - - - - - - - - + + + + + + + + + + - - - - + + + + - - - - - - - - - - - + + + + + + + + + + + + + + + - - + + - - - + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - - - + + + + - - | ['i', " intransitive"], ['n', " transitive indirecte"], ['t', " transitive directe"], ['p', " pronominale"], ['m', " impersonnelle"], ]), |
︙ | |||
371 372 373 374 375 376 377 | 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 | - - + + | oSpellChecker: null, oTokenizer: null, oLocGraph: null, _zPartDemForm: new RegExp("([a-zA-Zà-ö0-9À-Öø-ÿØ-ßĀ-ʯ]+)-(là|ci)$", "i"), _aPartDemExceptList: new Set(["celui", "celle", "ceux", "celles", "de", "jusque", "par", "marie-couche-toi"]), |
︙ | |||
401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 | 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 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 489 490 491 492 493 494 495 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 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + | if (m) { sWord = m[1]; sSuffix = m[2]; } // split word in 3 parts: prefix, root, suffix return [sPrefix, sWord, sSuffix]; }, analyze: function (sWord) { // return meaning of <sWord> if found else an empty string sWord = sWord.toLowerCase(); if (this.dValues.has(sWord)) { return this.dValues.get(sWord); } return ""; }, readableMorph: function (sMorph) { let sRes = ""; sMorph = sMorph.replace(/:V([0-3][ea_])[itpqnmr_eaxz]+/, ":V$1"); let m; while ((m = this._zTag.exec(sMorph)) !== null) { if (this.dTag.has(m[0])) { sRes += this.dTag.get(m[0])[0]; } else { sRes += " [" + m[0] + "]?"; } } if (sRes.startsWith(" verbe") && !sRes.includes("infinitif")) { sRes += " [" + sMorph.slice(1, sMorph.indexOf("/")) + "]"; } if (!sRes) { return " [" + sMorph + "]: étiquettes inconnues"; } return sRes.gl_trimRight(","); }, setLabelsOnToken (oToken) { // Token: .sType, .sValue, .nStart, .nEnd, .lMorph let m = null; try { switch (oToken.sType) { case 'PUNC': case 'SIGN': oToken["aLabels"] = [this.dValues.gl_get(oToken.sValue, "signe de ponctuation divers")]; break; case 'NUM': oToken["aLabels"] = ["nombre"]; break; case 'LINK': oToken["aLabels"] = ["hyperlien"]; break; case 'TAG': oToken["aLabels"] = ["étiquette (hashtag)"]; break; case 'HTML': oToken["aLabels"] = ["balise HTML"]; break; case 'PSEUDOHTML': oToken["aLabels"] = ["balise pseudo-HTML"]; break; case 'HTMLENTITY': oToken["aLabels"] = ["entité caractère XML/HTML"]; break; case 'HOUR': oToken["aLabels"] = ["heure"]; break; case 'WORD_ELIDED': oToken["aLabels"] = [this.dValues.gl_get(oToken.sValue, "préfixe élidé inconnu")]; break; case 'WORD_ORDINAL': oToken["aLabels"] = ["nombre ordinal"]; break; case 'FOLDERUNIX': oToken["aLabels"] = ["dossier UNIX (et dérivés)"]; break; case 'FOLDERWIN': oToken["aLabels"] = ["dossier Windows"]; break; case 'WORD_ACRONYM': oToken["aLabels"] = ["sigle ou acronyme"]; break; case 'WORD': if (oToken.hasOwnProperty("lMorph") && oToken["lMorph"].length > 0) { // with morphology oToken["aLabels"] = []; for (let sMorph of oToken["lMorph"]) { oToken["aLabels"].push(this.readableMorph(sMorph)); } if (oToken.hasOwnProperty("sTags")) { let aTags = []; for (let sTag of oToken["sTags"]) { if (this.dValues.has(sTag)) { aTags.push(this.dValues.get(sTag)) } } if (aTags.length > 0) { oToken["aOtherLabels"] = aTags; } } } else { // no morphology, guessing if (oToken.sValue.gl_count("-") > 4) { oToken["aLabels"] = ["élément complexe indéterminé"]; } else if (m = this._zPartDemForm.exec(oToken.sValue)) { // mots avec particules démonstratives oToken["aLabels"] = ["mot avec particule démonstrative"]; } else if (m = this._zImperatifVerb.exec(oToken.sValue)) { // formes interrogatives oToken["aLabels"] = ["forme verbale impérative"]; } else if (m = this._zInterroVerb.exec(oToken.sValue)) { // formes interrogatives oToken["aLabels"] = ["forme verbale interrogative"]; } } break; default: oToken["aLabels"] = ["token de nature inconnue"]; } } catch (e) { console.error(e); } return null; }, getInfoForToken: function (oToken) { // Token: .sType, .sValue, .nStart, .nEnd // return a object {sType, sValue, aLabel} let m = null; try { switch (oToken.sType) { case 'PUNC': case 'SIGN': return { sType: oToken.sType, sValue: oToken.sValue, |
︙ | |||
466 467 468 469 470 471 472 | 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 | - - + | return { sType: oToken.sType, sValue: oToken.sValue, aLabel: ["heure"] }; break; case 'WORD_ELIDED': |
︙ | |||
522 523 524 525 526 527 528 | 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 | - - + + - - + + - - + + | }; } return { sType: oToken.sType, sValue: oToken.sValue, aLabel: ["mot avec particule démonstrative"], aSubElem: [ |
︙ | |||
578 579 580 581 582 583 584 | 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 | - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - + + + - - - - - + - - - - - - + - - - + - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | } return null; }, _getMorph (sWord) { let aElem = []; for (let s of this.oSpellChecker.getMorph(sWord)) { |
Modified graphspell-js/spellchecker.js from [be4f6fe289] to [851f1e59f5].
︙ | |||
130 131 132 133 134 135 136 | 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 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | // Lexicographer loadLexicographer (sLangCode) { // load default suggestion module for <sLangCode> if (typeof(process) !== 'undefined') { this.lexicographer = require(`./lexgraph_${sLangCode}.js`); } else if (self && self.hasOwnProperty("lexgraph_"+sLangCode)) { // self is the Worker this.lexicographer = self["lexgraph_"+sLangCode]; } } |
︙ |
Modified graphspell/lexgraph_fr.py from [06640299ad] to [daf02d1e51].
1 2 3 4 5 6 7 8 9 10 11 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | - + | """ Lexicographer for the French language """ # Note: # This mode must contains at least: # <dSugg> : a dictionary for default suggestions. # <bLexicographer> : a boolean False # if the boolean is True, 4 functions are required: # split(sWord) -> returns a list of string (that will be analyzed) # analyze(sWord) -> returns a string with the meaning of word |
︙ | |||
168 169 170 171 172 173 174 | 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | - - - + + + + + + | ':e': (" épicène", "épicène"), ':m': (" masculin", "masculin"), ':f': (" féminin", "féminin"), ':s': (" singulier", "singulier"), ':p': (" pluriel", "pluriel"), ':i': (" invariable", "invariable"), |
︙ | |||
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | 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 | + + + - - + + | 'puisqu’': "(puisque), conjonction de subordination", 'quoiqu’': "(quoique), conjonction de subordination", 'jusqu’': "(jusque), préposition", '-je': " pronom personnel sujet, 1ʳᵉ pers. sing.", '-tu': " pronom personnel sujet, 2ᵉ pers. sing.", '-il': " pronom personnel sujet, 3ᵉ pers. masc. sing.", '-iel': " pronom personnel sujet, 3ᵉ pers. sing.", '-on': " pronom personnel sujet, 3ᵉ pers. sing. ou plur.", '-elle': " pronom personnel sujet, 3ᵉ pers. fém. sing.", '-t-il': " “t” euphonique + pronom personnel sujet, 3ᵉ pers. masc. sing.", '-t-on': " “t” euphonique + pronom personnel sujet, 3ᵉ pers. sing. ou plur.", '-t-elle': " “t” euphonique + pronom personnel sujet, 3ᵉ pers. fém. sing.", '-t-iel': " “t” euphonique + pronom personnel sujet, 3ᵉ pers. sing.", '-nous': " pronom personnel sujet/objet, 1ʳᵉ pers. plur. ou COI (à nous), plur.", '-vous': " pronom personnel sujet/objet, 2ᵉ pers. plur. ou COI (à vous), plur.", '-ils': " pronom personnel sujet, 3ᵉ pers. masc. plur.", '-elles': " pronom personnel sujet, 3ᵉ pers. masc. plur.", '-iels': " pronom personnel sujet, 3ᵉ pers. plur.", |
︙ | |||
322 323 324 325 326 327 328 329 330 331 332 333 334 335 | 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | "-t’y": " (te) pronom personnel objet + (y) pronom adverbial", "-s’y": " (se) pronom personnel objet + (y) pronom adverbial", '-en': " pronom adverbial", "-m’en": " (me) pronom personnel objet + (en) pronom adverbial", "-t’en": " (te) pronom personnel objet + (en) pronom adverbial", "-s’en": " (se) pronom personnel objet + (en) pronom adverbial", '.': "point", '·': "point médian", '…': "points de suspension", ':': "deux-points", ';': "point-virgule", ',': "virgule", '?': "point d’interrogation", '!': "point d’exclamation", '(': "parenthèse ouvrante", ')': "parenthèse fermante", '[': "crochet ouvrant", ']': "crochet fermant", '{': "accolade ouvrante", '}': "accolade fermante", '-': "tiret", '—': "tiret cadratin", '–': "tiret demi-cadratin", '«': "guillemet ouvrant (chevrons)", '»': "guillemet fermant (chevrons)", '“': "guillemet ouvrant double", '”': "guillemet fermant double", '‘': "guillemet ouvrant", '’': "guillemet fermant", '"': "guillemets droits (déconseillé en typographie)", '/': "signe de la division", '+': "signe de l’addition", '*': "signe de la multiplication", '=': "signe de l’égalité", '<': "inférieur à", '>': "supérieur à", '⩽': "inférieur ou égal à", '⩾': "supérieur ou égal à", '%': "signe de pourcentage", '‰': "signe pour mille" } _zElidedPrefix = re.compile("(?i)^([ldmtsnjcç]|lorsqu|presqu|jusqu|puisqu|quoiqu|quelqu|qu)[’'‘`ʼ]([\\w-]+)") _zCompoundWord = re.compile("(?i)(\\w+)(-(?:(?:les?|la)-(?:moi|toi|lui|[nv]ous|leur)|t-(?:il|elle|on)|y|en|[mts]’(?:y|en)|les?|l[aà]|[mt]oi|leur|lui|je|tu|ils?|elles?|on|[nv]ous|ce))$") _zTag = re.compile("[:;/][\\w*][^:;/]*") |
︙ | |||
354 355 356 357 358 359 360 | 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 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 | - + - + - - - + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | "return meaning of <sWord> if found else an empty string" sWord = sWord.lower() if sWord in _dValues: return _dValues[sWord] return "" |
Modified graphspell/spellchecker.py from [b9cca64fbd] to [a1f53ef986].
︙ | |||
96 97 98 99 100 101 102 | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | - + | self.bCommunityDic = False def deactivatePersonalDictionary (self): "deactivate personal dictionary" self.bPersonalDic = False |
︙ | |||
118 119 120 121 122 123 124 | 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 | - + + + + + + + + + + + | for sElem in self.lexicographer.split(sWord): if sElem: lMorph = self.getMorph(sElem) sLex = self.lexicographer.analyze(sElem) if sLex: aRes = [ (" | ".join(lMorph), sLex) ] else: |
︙ | |||
231 232 233 234 235 236 237 | 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | - + | if sWord not in self._dLemmas: self.getMorph(sWord) return self._dLemmas[sWord] return { s[1:s.find("/")] for s in self.getMorph(sWord) } def suggest (self, sWord, nSuggLimit=10): "generator: returns 1, 2 or 3 lists of suggestions" |
︙ |