Grammalecte  Check-in [0318bd422b]

Overview
Comment:[build][fr] extra tests
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | fr | build
Files: files | file ages | folders
SHA3-256: 0318bd422b82bbd35cb010a11acdd8e8df1e2ae01b91435efa8d3d8a66e60bce
User & Date: olr on 2025-09-16 12:20:49
Other Links: manifest | tags
Context
2025-09-16
13:21
[fr] faux positifs et ajustements check-in: f1d1d013a1 user: olr tags: trunk, fr
12:20
[build][fr] extra tests check-in: 0318bd422b user: olr tags: trunk, fr, build
11:51
[fr] faux positifs check-in: ac21b7279c user: olr tags: trunk, fr
Changes

Added gc_lang/fr/tests/formateur_de_texte.odt version [034bf5f587].

cannot compute difference between binary files

Added gc_lang/fr/tests/test_wiktionary_citations.txt version [72491ca1dd].

more than 10,000 changes

Modified make.py from [2c13d42c51] to [f482d01042].

355
356
357
358
359
360
361

362
363
364
365
366
367
368
369
370
371

372
373
374
375
376
377
378
379

380
381
382
383
384
385
386
387
            sDescription = dVars['dic_personal_description']
        lex_build.build(spfLexSrc, dVars['lang'], dVars['lang_name'], sfDictDst, bJavaScript, sDicName, sDescription, "", dVars['stemming_method'], int(dVars['fsa_method']))


def extraTest (sLang):
    "test grammar checker with files in <gc_lang/xx/tests>"
    if os.path.isdir(f"gc_lang/{sLang}/tests"):

        grammalecte = importlib.import_module("grammalecte")
        oGrammarChecker = grammalecte.GrammarChecker(sLang)
        for sf in os.listdir(f"gc_lang/{sLang}/tests"):
            if sf.startswith("test_") and sf.endswith(".txt"):
                spf = f"gc_lang/{sLang}/tests/" + sf
                with open(spf, "r", encoding="utf-8") as hSrc:
                    print(f"> Test text: {spf}", end="")
                    nLine = sum(1 for _ in hSrc)
                    nPercent = max(nLine // 100, 1)
                    hSrc.seek(0) # rewind to start of file

                    for i, sLine in enumerate(hSrc, 1):
                        if (i % nPercent == 0):
                            print(f"\r> Test text: {spf} ({i // nPercent} %)", end="")
                        aGrammErrs, aSpellErrs = oGrammarChecker.getParagraphErrors(sLine)
                        if aGrammErrs:
                            sText, _ = grammalecte.text.generateParagraph(sLine, aGrammErrs, aSpellErrs, 160)
                            print(f"\n# Line {i}")
                            print(sText)

                    print(f"\r> Test text: {spf} ({i // nPercent} %): {i} lines.")
    else:
        print(f"# Error. No folder <gc_lang/{sLang}/tests>. With option -tt, all texts named <test_*.txt> in this folder will be parsed by the grammar checker.")


def main ():
    "build Grammalecte with requested options"
    print("Python: " + sys.version)







>






|


|
>








>
|







355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
            sDescription = dVars['dic_personal_description']
        lex_build.build(spfLexSrc, dVars['lang'], dVars['lang_name'], sfDictDst, bJavaScript, sDicName, sDescription, "", dVars['stemming_method'], int(dVars['fsa_method']))


def extraTest (sLang):
    "test grammar checker with files in <gc_lang/xx/tests>"
    if os.path.isdir(f"gc_lang/{sLang}/tests"):
        print(">>>>>>>>>> EXTRA TESTS: parsing texts in <gc_lang/{sLang}/tests>\n")
        grammalecte = importlib.import_module("grammalecte")
        oGrammarChecker = grammalecte.GrammarChecker(sLang)
        for sf in os.listdir(f"gc_lang/{sLang}/tests"):
            if sf.startswith("test_") and sf.endswith(".txt"):
                spf = f"gc_lang/{sLang}/tests/" + sf
                with open(spf, "r", encoding="utf-8") as hSrc:
                    print(f"\n>>>>>>>>>> TEST TEXT: {spf} <<<<<<<<<<\n")
                    nLine = sum(1 for _ in hSrc)
                    nPercent = max(nLine // 100, 1)
                    hSrc.seek(0) # rewind to the beginning of the file
                    nTotError = 0
                    for i, sLine in enumerate(hSrc, 1):
                        if (i % nPercent == 0):
                            print(f"\r> Test text: {spf} ({i // nPercent} %)", end="")
                        aGrammErrs, aSpellErrs = oGrammarChecker.getParagraphErrors(sLine)
                        if aGrammErrs:
                            sText, _ = grammalecte.text.generateParagraph(sLine, aGrammErrs, aSpellErrs, 160)
                            print(f"\n# Line {i}")
                            print(sText)
                            nTotError += 1
                    print(f"\r> Test text: {spf} ({i // nPercent} %): {i} lines. Grammar errors in {nTotError} lines.")
    else:
        print(f"# Error. No folder <gc_lang/{sLang}/tests>. With option -tt, all texts named <test_*.txt> in this folder will be parsed by the grammar checker.")


def main ():
    "build Grammalecte with requested options"
    print("Python: " + sys.version)