Overview
Comment: | [build][core] regex rules now use tokens for disambiguation |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | core | build | rg |
Files: | files | file ages | folders |
SHA3-256: |
1184e8ba6d44299b56d10d9e778ca03e |
User & Date: | olr on 2018-06-13 09:26:32 |
Original Comment: | [build][core] merge regex rules now use tokens for disambiguation |
Other Links: | branch diff | manifest | tags |
Context
2018-06-13
| ||
17:10 | [fr] conversion regex rules -> graph rules check-in: edf852434a user: olr tags: fr, rg | |
09:26 | [build][core] regex rules now use tokens for disambiguation check-in: 1184e8ba6d user: olr tags: core, build, rg | |
07:57 | [core] gc engine: dictionary of tokens position for disambiguation check-in: ff58bafc4d user: olr tags: core, rg | |
Changes
Modified compile_rules.py from [856372255b] to [a5c1ea137d].
︙ | |||
26 27 28 29 30 31 32 | 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 | - - + + - + - - - + + + - - - - - - + + + + + + | s = re.sub(r"isRealStart *\(\)", 'before("^ *$")', s) s = re.sub(r"isStart0 *\(\)", 'before0("^ *$|, *$")', s) s = re.sub(r"isRealStart0 *\(\)", 'before0("^ *$")', s) s = re.sub(r"isEnd *\(\)", 'after("^ *$|^,")', s) s = re.sub(r"isRealEnd *\(\)", 'after("^ *$")', s) s = re.sub(r"isEnd0 *\(\)", 'after0("^ *$|^,")', s) s = re.sub(r"isRealEnd0 *\(\)", 'after0("^ *$")', s) |
︙ | |||
547 548 549 550 551 552 553 | 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 | - + - + | # creating file with all functions callable by rules print(" creating callables...") sPyCallables = "# generated code, do not edit\n" sJSCallables = "// generated code, do not edit\nconst oEvalFunc = {\n" for sFuncName, sReturn in lFUNCTIONS: cType = sFuncName[0:1] if cType == "c": # condition |
︙ |
Modified gc_core/py/lang_core/gc_engine.py from [f48195d439] to [8eb4241441].
︙ | |||
104 105 106 107 108 109 110 | 104 105 106 107 108 109 110 111 112 113 114 115 116 117 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 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | - - + - - + - + + | #### Parsing def parse (sText, sCountry="${country_default}", bDebug=False, dOptions=None, bContext=False): "analyses the paragraph sText and returns list of errors" #sText = unicodedata.normalize("NFC", sText) aErrors = None sRealText = sText |
︙ | |||
179 180 181 182 183 184 185 | 178 179 180 181 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 211 212 | - + + - - - + + + | for zRegex, bUppercase, sLineId, sRuleId, nPriority, lActions in lRuleGroup: if sRuleId not in _aIgnoredRules: for m in zRegex.finditer(s): bCondMemo = None for sFuncCond, cActionType, sWhat, *eAct in lActions: # action in lActions: [ condition, action type, replacement/suggestion/action[, iGroup[, message, URL]] ] try: |
︙ | |||
395 396 397 398 399 400 401 | 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 | - + - - + + - + - + - + - + | #### common functions def option (sOpt): "return True if option sOpt is active" return _dOptions.get(sOpt, False) |
︙ | |||
513 514 515 516 517 518 519 | 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 574 575 576 577 578 579 580 581 582 583 584 | - + - - + + - + - + + - + - + - + - + + - + - + - - + + + + + | if sNegPattern and re.search(sNegPattern, s): return False if re.search(sPattern, s): return True return False |
︙ |
Modified gc_lang/fr/rules.grx from [8fec34a927] to [413f581a35].
︙ | |||
388 389 390 391 392 393 394 | 388 389 390 391 392 393 394 395 396 397 398 399 400 401 | - | # URL __<i>(p_URL)__ https?://[\w./?&!%=+*"'@$#-]+ <<- ~>> * __<i](p_URL2)__ ((?:{w_1}[.])*)({w_2})([.](?:com|net|org|info|fr|ca|be|ch|i[ot]|co[.]uk|tk|es|jp|zh|ru|us|nl|xyz)) @@0,**,$ <<- ~1>> * <<- ~2>> =\2.capitalize() |
︙ | |||
12396 12397 12398 12399 12400 12401 12402 | 12395 12396 12397 12398 12399 12400 12401 12402 12403 12404 12405 12406 12407 12408 12409 12410 12411 12412 | + + - - + + | TEST: dès qu’il le {{voie}} TEST: donnant à entendre qu’il avait l’intention de violer Laura dès qu’il en aurait l’occasion # verbe que + subjonctif __vmode_qqch_que_subjonctif1__ [>afin|>avant|>pour|>quoi|>permettre|>falloir|>vouloir|>ordonner|>exiger|>désirer|>préférer|>suffire] [que|qu’|qu] @:(?:Os|M) @:I¬:[GYS] <<- /vmode/ -4>> =suggVerbMode(\4, ":S", \3) # Après « \1 que », ce verbe devrait être au subjonctif. |
︙ |