Grammalecte  Check-in [f667bcada7]

Overview
Comment:[core] tests: extend neutralization for spellchecker
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | core
Files: files | file ages | folders
SHA3-256: f667bcada7e8d8b47d49d7de540e169d1f71837f6721f2eabd2c0ecd3e6d1c2f
User & Date: olr on 2020-11-27 09:52:08
Other Links: manifest | tags
Context
2020-11-27
09:54
[core] suggVerbMode() update check-in: 03e53a9de3 user: olr tags: trunk, core
09:52
[core] tests: extend neutralization for spellchecker check-in: f667bcada7 user: olr tags: trunk, core
2020-11-26
12:30
[build][core][fr] rename function check-in: 261ec1c90b user: olr tags: trunk, fr, core, build
Changes

Modified gc_core/py/lang_core/tests_core.py from [9b4b6039ba] to [a6e208a4a9].

142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
            sRes = sRes[:dErr["nStart"]] + "~" * (dErr["nEnd"] - dErr["nStart"]) + sRes[dErr["nEnd"]:]
            sListErr += "    * {sLineId} / {sRuleId}  at  {nStart}:{nEnd}\n".format(**dErr)
            lAllSugg.append("|".join(dErr["aSuggestions"]))
            self._aTestedRules.add(dErr["sRuleId"].rstrip("0123456789"))
            # test messages
            aGramErrs = gc_engine.parse(purgeMessage(dErr["sMessage"]))
            aGramErrs = [ dMsgErr  for dMsgErr in sorted(aGramErrs, key=lambda d: d["nStart"])  if self._zRuleEnd.sub("", dMsgErr["sRuleId"]) != self._zRuleEnd.sub("", dErr["sRuleId"]) ]
            aSpellErrs = self._oSpellChecker.parseParagraph(re.sub("‹[\\w ’-]+›", lambda m: " " * len(m.group(0)), dErr["sMessage"]))
            if aGramErrs or aSpellErrs or "<start>" in dErr["sMessage"] or "<end>" in dErr["sMessage"]:
                print("\n# Error in: <" + dErr["sMessage"] + ">\n    " + dErr["sLineId"] + " / " + dErr["sRuleId"])
                for dMsgErr in aGramErrs:
                    print("        error: {sLineId} / {sRuleId}  at  {nStart}:{nEnd}".format(**dMsgErr))
                for dMsgErr in aSpellErrs:
                    print("        spelling mistake: <{sValue}>  at {nStart}:{nEnd}".format(**dMsgErr))
        return sRes, sListErr, "|||".join(lAllSugg)







|







142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
            sRes = sRes[:dErr["nStart"]] + "~" * (dErr["nEnd"] - dErr["nStart"]) + sRes[dErr["nEnd"]:]
            sListErr += "    * {sLineId} / {sRuleId}  at  {nStart}:{nEnd}\n".format(**dErr)
            lAllSugg.append("|".join(dErr["aSuggestions"]))
            self._aTestedRules.add(dErr["sRuleId"].rstrip("0123456789"))
            # test messages
            aGramErrs = gc_engine.parse(purgeMessage(dErr["sMessage"]))
            aGramErrs = [ dMsgErr  for dMsgErr in sorted(aGramErrs, key=lambda d: d["nStart"])  if self._zRuleEnd.sub("", dMsgErr["sRuleId"]) != self._zRuleEnd.sub("", dErr["sRuleId"]) ]
            aSpellErrs = self._oSpellChecker.parseParagraph(re.sub("‹[^›]+›", lambda m: " " * len(m.group(0)), dErr["sMessage"]))
            if aGramErrs or aSpellErrs or "<start>" in dErr["sMessage"] or "<end>" in dErr["sMessage"]:
                print("\n# Error in: <" + dErr["sMessage"] + ">\n    " + dErr["sLineId"] + " / " + dErr["sRuleId"])
                for dMsgErr in aGramErrs:
                    print("        error: {sLineId} / {sRuleId}  at  {nStart}:{nEnd}".format(**dMsgErr))
                for dMsgErr in aSpellErrs:
                    print("        spelling mistake: <{sValue}>  at {nStart}:{nEnd}".format(**dMsgErr))
        return sRes, sListErr, "|||".join(lAllSugg)