Overview
| Comment: | [core][fr] rewriting with regex [fr] ajustements |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk | fr | core |
| Files: | files | file ages | folders |
| SHA3-256: |
3c8872804f97df2798d24fe0c845b769 |
| User & Date: | olr on 2021-01-30 15:15:31 |
| Other Links: | manifest | tags |
Context
|
2021-02-01
| ||
| 18:29 | [core][fr] suggVerb(): adapt suggestions for second functions -> change parameters order [fr] suggestions check-in: 6b0cfafe82 user: olr tags: trunk, fr, core | |
|
2021-01-30
| ||
| 15:15 | [core][fr] rewriting with regex [fr] ajustements check-in: 3c8872804f user: olr tags: trunk, fr, core | |
| 10:31 | [fr] faux positifs check-in: 52a13d282f user: olr tags: trunk, fr | |
Changes
Modified gc_core/js/lang_core/gc_functions.js from [75a3af0350] to [d31e5f26d5].
| ︙ | ︙ | |||
425 426 427 428 429 430 431 |
// Disambiguation: add a morphology to a token
let lMorph = (oToken.hasOwnProperty("lMorph")) ? oToken["lMorph"] : gc_engine.oSpellChecker.getMorph(oToken["sValue"]);
lMorph.push(...sNewMorph.split("|"));
oToken["lMorph"] = lMorph;
return true;
}
| | > > > > | > | 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 |
// Disambiguation: add a morphology to a token
let lMorph = (oToken.hasOwnProperty("lMorph")) ? oToken["lMorph"] : gc_engine.oSpellChecker.getMorph(oToken["sValue"]);
lMorph.push(...sNewMorph.split("|"));
oToken["lMorph"] = lMorph;
return true;
}
function g_rewrite (oToken, sToReplace, sReplace, bRegEx=false) {
// Disambiguation: rewrite morphologies
let lMorph = (oToken.hasOwnProperty("lMorph")) ? oToken["lMorph"] : gc_engine.oSpellChecker.getMorph(oToken["sValue"]);
if (bRegEx) {
oToken["lMorph"] = lMorph.map(sMorph => sMorph.replace(new RegExp(sToReplace), sReplace));
}
else {
oToken["lMorph"] = lMorph.map(sMorph => sMorph.replace(sToReplace, sReplace));
}
return true;
}
function g_define (oToken, sMorphs) {
// set morphologies of <oToken>, always return true
oToken["lMorph"] = sMorphs.split("|");
return true;
|
| ︙ | ︙ |
Modified gc_core/py/lang_core/gc_functions.py from [f53748ec4f] to [66b95f87c6].
| ︙ | ︙ | |||
373 374 375 376 377 378 379 |
"Disambiguation: add a morphology to a token"
lMorph = dToken["lMorph"] if "lMorph" in dToken else _oSpellChecker.getMorph(dToken["sValue"])
lMorph.extend(sNewMorph.split("|"))
dToken["lMorph"] = lMorph
return True
| | > > > | | 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 |
"Disambiguation: add a morphology to a token"
lMorph = dToken["lMorph"] if "lMorph" in dToken else _oSpellChecker.getMorph(dToken["sValue"])
lMorph.extend(sNewMorph.split("|"))
dToken["lMorph"] = lMorph
return True
def g_rewrite (dToken, sToReplace, sReplace, bRegEx=False):
"Disambiguation: rewrite morphologies"
lMorph = dToken["lMorph"] if "lMorph" in dToken else _oSpellChecker.getMorph(dToken["sValue"])
if bRegEx:
dToken["lMorph"] = [ re.sub(sToReplace, sReplace, sMorph) for sMorph in lMorph ]
else:
dToken["lMorph"] = [ sMorph.replace(sToReplace, sReplace) for sMorph in lMorph ]
return True
def g_define (dToken, sMorphs):
"Disambiguation: set morphologies of <dToken>, always return True"
dToken["lMorph"] = sMorphs.split("|")
#echo("DA:", dToken["sValue"], lMorph)
|
| ︙ | ︙ |
Modified gc_lang/fr/rules.grx from [4d8967331f] to [5138506e52].
| ︙ | ︙ | |||
19184 19185 19186 19187 19188 19189 19190 19191 19192 19193 19194 19195 19196 19197 |
<<- ~3:4>> *
[bien|mal|fort] @:[AQW]
<<- not value(<1, "|un|le|ce|du|mon|ton|son|notre|votre|leur|") ~1>> *
si @:[AQW]¬:G
<<- not (value(\2, "|bien|") and value(>1, "|que|qu’|")) and not value(\2, "|tant|") ~1>> *
un [chouia|chouïa|rien|tantinet] ?[trop|plus|moins]¿
<<- morph(>1, ":A", ":G") ~>> *
un [brin|minimum|poil|soupçon] ?[trop|plus|moins]¿
<<- morph(>1, ":A", ":(?:A.*:[me]:[si]|G)") ~>> *
| > | 19184 19185 19186 19187 19188 19189 19190 19191 19192 19193 19194 19195 19196 19197 19198 |
<<- ~3:4>> *
[bien|mal|fort] @:[AQW]
<<- not value(<1, "|un|le|ce|du|mon|ton|son|notre|votre|leur|") ~1>> *
si @:[AQW]¬:G
<<- not (value(\2, "|bien|") and value(>1, "|que|qu’|")) and not value(\2, "|tant|") ~1>> *
<<- __also__ and morph(\2, ":Q:A") =>> rewrite(\2, ":V[^:]+:Q", "", True)
un [chouia|chouïa|rien|tantinet] ?[trop|plus|moins]¿
<<- morph(>1, ":A", ":G") ~>> *
un [brin|minimum|poil|soupçon] ?[trop|plus|moins]¿
<<- morph(>1, ":A", ":(?:A.*:[me]:[si]|G)") ~>> *
|
| ︙ | ︙ | |||
19206 19207 19208 19209 19210 19211 19212 |
__purge_adverbes__
[assez|trop] ~ment$
<<- morph(\2, ":W", ":3p") ~>> *
@:[NAQ] [le|la] [plus|moins] ~.ment$ $:A
| | | 19207 19208 19209 19210 19211 19212 19213 19214 19215 19216 19217 19218 19219 19220 19221 |
__purge_adverbes__
[assez|trop] ~ment$
<<- morph(\2, ":W", ":3p") ~>> *
@:[NAQ] [le|la] [plus|moins] ~.ment$ $:A
<<- morph(\-2, ":W", ":A") ~2:-2>> *
complètement
<<- not morph(<1, ":D.*:m") ~>> *
~.ment$ ?[parlant|pas]¿
<<- morph(\1, ":W", ":(?:3p|N)") ~>> *
|
| ︙ | ︙ | |||
23536 23537 23538 23539 23540 23541 23542 23543 23544 23545 23546 23547 23548 23549 |
<<- /gn/ morph(\3, ":[NA].*:[fe]", ":(?:B|G|V0|m)") and morph(\4, ":[NA].*:m", "*") and not apposition(\3, \4)
-4>> =suggFemSing(\4, True) && Accord de genre erroné : le syntagme « \2 \3 » est féminin, « \4 » est masculin.
<<- /gn/ morph(\3, ":[NA].*:[si]", ":G") and morph(\4, ":[NA].*:p", ":[GWsi]") and not apposition(\3, \4)
-4>> =suggFemSing(\4) && Accord de nombre erroné avec « \2 \3 » : « \4 » devrait être au singulier.
TEST: La plus grande {{cinglé}}. ->> cinglée
TEST: il imaginait de la pluie {{noir}} tombant sur une terre dévastée. ->> noire
TEST: je voyais de la pluie {{noires}} ->> noire
TEST: Il faut donc examiner ensemble le panneau et la paroi latérale.
TEST: Il faut donc examiner ensemble le panneau et la paroi latéraux.
TEST: Il faut donc examiner ensemble les panneaux et la paroi latéraux.
TEST: Il faut donc examiner ensemble les panneaux et la paroi latérale.
| > | 23537 23538 23539 23540 23541 23542 23543 23544 23545 23546 23547 23548 23549 23550 23551 |
<<- /gn/ morph(\3, ":[NA].*:[fe]", ":(?:B|G|V0|m)") and morph(\4, ":[NA].*:m", "*") and not apposition(\3, \4)
-4>> =suggFemSing(\4, True) && Accord de genre erroné : le syntagme « \2 \3 » est féminin, « \4 » est masculin.
<<- /gn/ morph(\3, ":[NA].*:[si]", ":G") and morph(\4, ":[NA].*:p", ":[GWsi]") and not apposition(\3, \4)
-4>> =suggFemSing(\4) && Accord de nombre erroné avec « \2 \3 » : « \4 » devrait être au singulier.
TEST: La plus grande {{cinglé}}. ->> cinglée
TEST: il imaginait de la pluie {{noir}} tombant sur une terre dévastée. ->> noire
TEST: la place {{balayées}} par le vent ->> balayée
TEST: je voyais de la pluie {{noires}} ->> noire
TEST: Il faut donc examiner ensemble le panneau et la paroi latérale.
TEST: Il faut donc examiner ensemble le panneau et la paroi latéraux.
TEST: Il faut donc examiner ensemble les panneaux et la paroi latéraux.
TEST: Il faut donc examiner ensemble les panneaux et la paroi latérale.
|
| ︙ | ︙ | |||
32881 32882 32883 32884 32885 32886 32887 | TEST: les avoir consultées grâce à une personne y ayant accès sur le plan juridique. TEST: Être président d’une association demande beaucoup de temps. TEST: Venir vaincue ne lui épargna aucune indignité. TEST: Mais migrer un site et ses contenus prend du temps… TEST: y être sans ma femme ni les enfants fait monter en moi une certaine nervosité. | | | 32883 32884 32885 32886 32887 32888 32889 32890 32891 32892 32893 32894 32895 32896 32897 |
TEST: les avoir consultées grâce à une personne y ayant accès sur le plan juridique.
TEST: Être président d’une association demande beaucoup de temps.
TEST: Venir vaincue ne lui épargna aucune indignité.
TEST: Mais migrer un site et ses contenus prend du temps…
TEST: y être sans ma femme ni les enfants fait monter en moi une certaine nervosité.
__conj_le_la_leur_nom!5__
le *WORD @:V¬:(?:3s|P|Q|Y|3p!|G|M)
<<- /conj/ not tag(\2, "_enum_") and morph(<1, ":C|<start>|>,", ":[YP]") and morph(\2, ":[NA].*:[si]", ":G")
and not ( (value(\2, "|dizaine|douzaine|quinzaine|vingtaine|trentaine|quarantaine|cinquantaine|soixantaine|centaine|majorité|minorité|millier|partie|poignée|tas|paquet|moitié|")
or tagbefore(\1, "_ni_") or value(<1, "|et|ou|")) and morph(\3, ":3?p") ) and not agreement(\2, \3)
and not ( morph(\2, "(?:[123][sp]|P)") and not value(<1, "|<start>|,|") ) >>>
<<- /conj/ not tag(\-1, "_ngn_") and (morph(\3, ":A.*:p") or (morph(\3, ":N.*:p") and morph(\2, ":A")))
-3>> =suggVerb(\3, ":3s", suggMasSing) && Accord avec “\1 \2…” incorrect. Conjugaison erronée ou accord nom/adjectif incorrect.
|
| ︙ | ︙ | |||
32915 32916 32917 32918 32919 32920 32921 |
[le|la|l’|leur] *WORD qui @:V¬:(?:3s|P|3p!|G|M)
<<- /conj/ not tag(\2, "_enum_") and morph(<1, ":C|<start>|>,", ":[YP]") and morph(\2, ":[NA].*:[si]", ":G")
and not ( (value(\2, "|dizaine|douzaine|quinzaine|vingtaine|trentaine|quarantaine|cinquantaine|soixantaine|centaine|majorité|minorité|millier|partie|poignée|tas|paquet|moitié|")
or tagbefore(\1, "_ni_") or value(<1, "|et|ou|")) and morph(\4, ":3p") )
-4>> =suggVerb(\4, ":3s") && Conjugaison erronée. Accord avec “\1 \2…”. Le verbe devrait être à la 3ᵉ personne du singulier.
| < < > > > > > < > | > > | < < < < < | < < | | > > | 32917 32918 32919 32920 32921 32922 32923 32924 32925 32926 32927 32928 32929 32930 32931 32932 32933 32934 32935 32936 32937 32938 32939 32940 32941 32942 32943 32944 32945 32946 32947 32948 32949 32950 32951 32952 32953 32954 32955 32956 32957 |
[le|la|l’|leur] *WORD qui @:V¬:(?:3s|P|3p!|G|M)
<<- /conj/ not tag(\2, "_enum_") and morph(<1, ":C|<start>|>,", ":[YP]") and morph(\2, ":[NA].*:[si]", ":G")
and not ( (value(\2, "|dizaine|douzaine|quinzaine|vingtaine|trentaine|quarantaine|cinquantaine|soixantaine|centaine|majorité|minorité|millier|partie|poignée|tas|paquet|moitié|")
or tagbefore(\1, "_ni_") or value(<1, "|et|ou|")) and morph(\4, ":3p") )
-4>> =suggVerb(\4, ":3s") && Conjugaison erronée. Accord avec “\1 \2…”. Le verbe devrait être à la 3ᵉ personne du singulier.
TEST: Le chien n’{{es}} pas mort. ->> est
TEST: le chat {{finissent}} ->> finit
TEST: Le damné {{donnes}} ->> donne|donné
TEST: Le carré {{reviens}} à la mode ->> revient
TEST: Le chien y {{viens}} ->> vient
TEST: Le feu nous {{donnes}} chaud. ->> donne
TEST: tout le monde {{prends}} ses aises ->> prend
TEST: La Corée {{peux}} gagner. ->> peut
TEST: La Corée ne {{pourras}} pas gagner. ->> pourra
TEST: la femme {{donnes}} ->> donne
TEST: la petite {{arrives}} ->> arrive
TEST: La proscription de nager {{pourraient}} nous porter préjudice à long terme ->> pourrait
TEST: la marchande {{marchandes}} ->> marchande|marchande|marchandée
TEST: la grande se {{pensaient}} invincible ->> pensait
TEST: tu sais, la chatte {{passes}} par ce trou ->> passe
TEST: la femme {{pensent}} à ses filles ->> pense
TEST: La {{N.S.A.}} {{espionneras}} toujours tout le monde ->> NSA|||espionnera
TEST: La femme la {{prends}} ->> prend
TEST: La suspicion envers les élus {{accroissaient}}… ->> accroissait
TEST: leur chat qui {{torturent}} une souris ->> torture
TEST: leur homme à tout faire {{oublient}} toujours tout ->> oublie
TEST: leur fils ne {{parlez}} jamais ->> parle
TEST: leur petite {{donnes}} ->> donne
TEST: tu vois, leur donne {{donnes}} du fil à retordre ->> donne
TEST: L’homme sur le bateau de Patrick {{viens}} de temps en temps manger chez moi. ->> vient
TEST: L’homme y {{donnes}} ->> donne
TEST: L’homme le {{deviens}} ->> devient
TEST: L’hypothétique nouveau président
TEST: La moitié d’entre elles voient leurs loyers diminuer depuis le début de l’année
TEST: le loquet d’une des petites portes.
TEST: L’électricité, l’hydrogène, l’air comprimé n’existent pas…
TEST: la Syrie, l’Irak, la Mésopotamie tombaient.
TEST: Le sentiment d’humiliation, la colère nous indiquent que…
TEST: la majorité survenaient sous la contrainte
|
| ︙ | ︙ |