Changes In Branch rg Through [3d50852f45] Excluding Merge-Ins
This is equivalent to a diff from f2d8271145 to 3d50852f45
2018-06-13
| ||
05:37 | [build] merge graph rules building and regex rules building check-in: cb88d3d2dc user: olr tags: build, rg | |
2018-06-12
| ||
19:55 | [fr] conversion: regex -> graph rules check-in: 3d50852f45 user: olr tags: fr, rg | |
18:22 | [build] graph builder: add comment check-in: 2f915c42dc user: olr tags: build, rg | |
2018-05-16
| ||
16:22 | [fr] pt: descente aux enfers/flambeaux check-in: b5310203be user: olr tags: trunk, fr | |
16:14 | [build][core] rules graph: first draft check-in: 061252f41e user: olr tags: core, build, rg | |
11:58 | [graphspell][bug] fix affixes occurrences calculation check-in: f2d8271145 user: olr tags: trunk, graphspell | |
2018-05-15
| ||
12:51 | [fr] test contre faux positif check-in: f8bf9c3922 user: olr tags: trunk, fr | |
Modified compile_rules.py from [1ea2b6d97a] to [8c11a24e22].
108 109 110 111 112 113 114 | 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 | - + + + + + + + + + | def createRule (s, nIdLine, sLang, bParagraph, dOptPriority): "returns rule as list [option name, regex, bCaseInsensitive, identifier, list of actions]" global dJSREGEXES global nRULEWITHOUTNAME |
341 342 343 344 345 346 347 | 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | + - - + + | print("# Unknown action at line " + sIdAction) return None def _calcRulesStats (lRules): d = {'=':0, '~': 0, '-': 0, '>': 0} for aRule in lRules: if aRule[0] != "@@@@": |
434 435 436 437 438 439 440 | 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 | - - + + + - + - + + + + - + + + + - + + + - + + | # removing comments, zeroing empty lines, creating definitions, storing tests, merging rule lines print(" parsing rules...") global dDEF lLine = [] lRuleLine = [] lTest = [] lOpt = [] |
540 541 542 543 544 545 546 | 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 | - - + + | displayStats(lParagraphRules, lSentenceRules) print("Unnamed rules: " + str(nRULEWITHOUTNAME)) d = { "callables": sPyCallables, "callablesJS": sJSCallables, |
Added compile_rules_graph.py version [a4f6103185].
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 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 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 168 169 170 171 172 173 174 175 176 177 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 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 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 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 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | # Create a Direct Acyclic Rule Graph (DARG) import re import traceback import json import darg dDEF = {} dACTIONS = {} dFUNCTIONS = {} def prepareFunction (s, bTokenValue=False): s = s.replace("__also__", "bCondMemo") s = s.replace("__else__", "not bCondMemo") s = re.sub(r"(select|exclude|define)[(][\\](\d+)", 'g_\\1(lToken[\\2+nTokenOffset]', s) s = re.sub(r"(morph|displayInfo)[(]\\(\d+)", 'g_\\1(lToken[\\2+nTokenOffset]', s) s = re.sub(r"token\(\s*(\d)", 'nextToken(\\1', s) # token(n) s = re.sub(r"token\(\s*-(\d)", 'prevToken(\\1', s) # token(-n) s = re.sub(r"before\(\s*", 'look(s[:m.start()], ', s) # before(s) s = re.sub(r"after\(\s*", 'look(s[m.end():], ', s) # after(s) s = re.sub(r"textarea\(\s*", 'look(s, ', s) # textarea(s) s = re.sub(r"before_chk1\(\s*", 'look_chk1(dDA, s[:m.start()], 0, ', s) # before_chk1(s) s = re.sub(r"after_chk1\(\s*", 'look_chk1(dDA, s[m.end():], m.end(), ', s) # after_chk1(s) s = re.sub(r"textarea_chk1\(\s*", 'look_chk1(dDA, s, 0, ', s) # textarea_chk1(s) s = re.sub(r"\bspell *[(]", '_oSpellChecker.isValid(', s) if bTokenValue: # token values are used as parameter s = re.sub(r"[\\](\d+)", 'lToken[\\1+nTokenOffset]["sValue"]', s) else: # tokens used as parameter s = re.sub(r"[\\](\d+)", 'lToken[\\1+nTokenOffset]', s) return s def genTokenLines (sTokenLine): "tokenize a string and return a list of lines of tokens" lToken = sTokenLine.split() lTokenLines = None for i, sToken in enumerate(lToken): if sToken.startswith("{") and sToken.endswith("}") and sToken in dDEF: lToken[i] = dDEF[sToken] if ( (sToken.startswith("[") and sToken.endswith("]")) or (sToken.startswith("([") and sToken.endswith("])")) ): bSelectedGroup = sToken.startswith("(") and sToken.endswith(")") if bSelectedGroup: sToken = sToken[1:-1] # multiple token if not lTokenLines: lTokenLines = [ [s] for s in sToken[1:-1].split("|") ] else: lNewTemp = [] for aRule in lTokenLines: lElem = sToken[1:-1].split("|") sElem1 = lElem.pop(0) if bSelectedGroup: sElem1 = "(" + sElem1 + ")" for sElem in lElem: if bSelectedGroup: sElem = "(" + sElem + ")" aNew = list(aRule) aNew.append(sElem) lNewTemp.append(aNew) aRule.append(sElem1) lTokenLines.extend(lNewTemp) else: # simple token if not lTokenLines: lTokenLines = [[sToken]] else: for aRule in lTokenLines: aRule.append(sToken) for aRule in lTokenLines: yield aRule def createRule (iLine, sRuleName, sTokenLine, sActions, nPriority): # print(iLine, "//", sRuleName, "//", sTokenLine, "//", sActions, "//", nPriority) for lToken in genTokenLines(sTokenLine): # Calculate positions dPos = {} # key: iGroup, value: iToken iGroup = 0 for i, sToken in enumerate(lToken): if sToken.startswith("(") and sToken.endswith(")"): lToken[i] = sToken[1:-1] iGroup += 1 dPos[iGroup] = i + 1 # we add 1, for we count tokens from 1 to n (not from 0) # Parse actions for nAction, sAction in enumerate(sActions.split(" <<- ")): sAction = sAction.strip() if sAction: sActionId = sRuleName + "_a" + str(nAction) aAction = createAction(sActionId, sAction, nPriority, len(lToken), dPos) if aAction: dACTIONS[sActionId] = aAction lResult = list(lToken) lResult.extend(["##"+str(iLine), sActionId]) yield lResult def changeReferenceToken (s, dPos): for i in range(len(dPos), 0, -1): s = s.replace("\\"+str(i), "\\"+str(dPos[i])) return s def createAction (sIdAction, sAction, nPriority, nToken, dPos): # Option sOption = False m = re.match("/(\\w+)/", sAction) if m: sOption = m.group(1) sAction = sAction[m.end():].strip() # valid action? m = re.search("(?P<action>[-~=])(?P<start>\\d+|)(?P<end>:\\d+|)>> ", sAction) if not m: print(" # Error. No action found at: ", sIdAction) print(" ==", sAction, "==") return None # Condition sCondition = sAction[:m.start()].strip() if sCondition: sCondition = prepareFunction(sCondition) sCondition = changeReferenceToken(sCondition, dPos) dFUNCTIONS["g_c_"+sIdAction] = sCondition sCondition = "g_c_"+sIdAction else: sCondition = "" # Action cAction = m.group("action") sAction = sAction[m.end():].strip() sAction = changeReferenceToken(sAction, dPos) if not m.group("start"): iStartAction = 1 iEndAction = nToken else: iStartAction = int(m.group("start")) iEndAction = int(m.group("end")[1:]) if m.group("end") else iStartAction if dPos: try: iStartAction = dPos[iStartAction] iEndAction = dPos[iEndAction] except: print("# Error. Wrong groups in: " + sIdAction) if cAction == "-": ## error iMsg = sAction.find(" # ") if iMsg == -1: sMsg = "# Error. Error message not found." sURL = "" print(sMsg + " Action id: " + sIdAction) else: sMsg = sAction[iMsg+3:].strip() sAction = sAction[:iMsg].strip() sURL = "" mURL = re.search("[|] *(https?://.*)", sMsg) if mURL: sURL = mURL.group(1).strip() sMsg = sMsg[:mURL.start(0)].strip() if sMsg[0:1] == "=": sMsg = prepareFunction(sMsg[1:], True) dFUNCTIONS["g_m_"+sIdAction] = sMsg for x in re.finditer("lToken\\[(\\d+)\\]", sMsg): if int(x.group(1)) > nToken: print("# Error in token index in message at line " + sIdAction + " ("+str(nToken)+" tokens only)") sMsg = "=g_m_"+sIdAction else: for x in re.finditer(r"\\(\d+)", sMsg): if int(x.group(1)) > nToken: print("# Error in token index in message at line " + sIdAction + " ("+str(nToken)+" tokens only)") if re.search("[.]\\w+[(]", sMsg): print("# Error in message at line " + sIdAction + ": This message looks like code. Line should begin with =") # checking consistancy if cAction == "=" or sAction[0:1] == "=": if "define" in sAction and not re.search(r"define\(\\\d+ *, *\[.*\] *\)", sAction): print("# Error in action at line " + sIdAction + ": second argument for define must be a list of strings") for x in re.finditer(r"\\(\d+)", sAction): if int(x.group(1)) > nToken: print("# Error in token index in replacement at line " + sIdAction + " ("+str(nToken)+" tokens only)") if sAction[0:1] != "=": if re.search("[.]\\w+[(]|sugg\\w+[(]", sAction): print("# Error in action at line " + sIdAction + ": This action looks like code. Line should begin with =") if cAction == "-": ## error detected --> suggestion if not sAction: print("# Error in action at line " + sIdAction + ": This action is empty.") if sAction[0:1] == "=": sAction = prepareFunction(sAction, True) dFUNCTIONS["g_s_"+sIdAction] = sAction[1:] sAction = "=g_s_"+sIdAction elif sAction.startswith('"') and sAction.endswith('"'): sAction = sAction[1:-1] if not sMsg: print("# Error in action at line " + sIdAction + ": The message is empty.") return [sOption, sCondition, cAction, sAction, iStartAction, iEndAction, nPriority, sMsg, sURL] elif cAction == "~": ## text processor if not sAction: print("# Error in action at line " + sIdAction + ": This action is empty.") if sAction[0:1] == "=": dFUNCTIONS["g_p_"+sIdAction] = sAction[1:] sAction = "=g_p_"+sIdAction elif sAction.startswith('"') and sAction.endswith('"'): sAction = sAction[1:-1] return [sOption, sCondition, cAction, sAction, iStartAction, iEndAction] elif cAction == "=": ## disambiguator if sAction[0:1] == "=": sAction = sAction[1:] if not sAction: print("# Error in action at line " + sIdAction + ": This action is empty.") sAction = prepareFunction(sAction) dFUNCTIONS["g_d_"+sIdAction] = sAction sAction = "g_d_"+sIdAction return [sOption, sCondition, cAction, sAction] elif cAction == ">": ## no action, break loop if condition is False return [sOption, sCondition, cAction, ""] else: print("# Unknown action at line " + sIdAction) return None def printBookmark (nLevel, sComment, nLine): print(" {:>6}: {}".format(nLine, " " * nLevel + sComment)) def make (spLang, sLang, bJavaScript): "compile rules, returns a dictionary of values" # for clarity purpose, don’t create any file here print("> read graph rules file...") try: lRules = open(spLang + "/rules_graph.grx", 'r', encoding="utf-8").readlines() except: print("Error. Rules file in project [" + sLang + "] not found.") exit() # removing comments, zeroing empty lines, creating definitions, storing tests, merging rule lines print(" parsing rules...") global dDEF lTest = [] lTokenLine = [] sActions = "" nPriority = 4 dAllGraph = {} sGraphName = "" for i, sLine in enumerate(lRules, 1): sLine = sLine.rstrip() if "\t" in sLine: # tabulation not allowed print("Error. Tabulation at line: ", i) exit() if sLine.startswith('#END'): # arbitrary end printBookmark(0, "BREAK BY #END", i) break elif sLine.startswith("#"): # comments pass elif sLine.startswith("GRAPH_NAME: "): # Graph name m = re.match("GRAPH_NAME: +([a-zA-Z_][a-zA-Z_0-9]*)+", sLine.strip()) if m: sGraphName = m.group(1) if sGraphName in dAllGraph: print("Error. Group name " + sGraphName + " already exists.") exit() dAllGraph[sGraphName] = [] else: print("Error. Graph name not found in", sLine.strip()) exit() elif sLine.startswith("DEF:"): # definition m = re.match("DEF: +([a-zA-Z_][a-zA-Z_0-9]*) +(.+)$", sLine.strip()) if m: dDEF["{"+m.group(1)+"}"] = m.group(2) else: print("Error in definition: ", end="") print(sLine.strip()) elif sLine.startswith("TEST:"): # test lTest.append("g{:<7}".format(i) + " " + sLine[5:].strip()) elif sLine.startswith("TODO:"): # todo pass elif sLine.startswith("!!"): # bookmarks m = re.search("^!!+", sLine) nExMk = len(m.group(0)) if sLine[nExMk:].strip(): printBookmark(nExMk-2, sLine[nExMk:].strip(), i) elif sLine.startswith("__") and sLine.endswith("__"): # new rule group m = re.match("__(\\w+)(!\\d|)__", sLine) if m: sRuleName = m.group(1) nPriority = int(m.group(2)[1:]) if m.group(2) else 4 else: print("Error at rule group: ", sLine, " -- line:", i) break elif re.match("[ ]*$", sLine): # empty line to end merging if not lTokenLine: continue if not sActions: print("Error. No action found at line:", i) exit() if not sGraphName: print("Error. All rules must belong to a named graph. Line: ", i) exit() for j, sTokenLine in lTokenLine: dAllGraph[sGraphName].append((j, sRuleName, sTokenLine, sActions, nPriority)) lTokenLine.clear() sActions = "" sRuleName = "" nPriority = 4 elif sLine.startswith((" <<-", " <<-")): # actions sActions += " " + sLine.strip() elif sLine.startswith((" ")): lTokenLine.append([i, sLine.strip()]) else: print("Unknown line:") print(sLine) # tests print(" list tests...") sGCTests = "\n".join(lTest) sGCTestsJS = '{ "aData2": ' + json.dumps(lTest, ensure_ascii=False) + " }\n" # processing rules print(" preparing rules...") for sGraphName, lRuleLine in dAllGraph.items(): lPreparedRule = [] for i, sRuleGroup, sTokenLine, sActions, nPriority in lRuleLine: for lRule in createRule(i, sRuleGroup, sTokenLine, sActions, nPriority): lPreparedRule.append(lRule) # Show rules for e in lPreparedRule: print(e) # Graph creation oDARG = darg.DARG(lPreparedRule, sLang) dAllGraph[sGraphName] = oDARG.createGraph() # 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 dFUNCTIONS.items(): if sFuncName.startswith("g_c_"): # condition sParams = "lToken, nTokenOffset, sCountry, bCondMemo" elif sFuncName.startswith("g_m_"): # message sParams = "lToken, nTokenOffset" elif sFuncName.startswith("g_s_"): # suggestion sParams = "lToken, nTokenOffset" elif sFuncName.startswith("g_p_"): # preprocessor sParams = "lToken" elif sFuncName.startswith("g_d_"): # disambiguator sParams = "lToken, nTokenOffset" else: print("# Unknown function type in [" + sFuncName + "]") continue sPyCallables += "def {} ({}):\n".format(sFuncName, sParams) sPyCallables += " return " + sReturn + "\n" #sJSCallables += " {}: function ({})".format(sFuncName, sParams) + " {\n" #sJSCallables += " return " + jsconv.py2js(sReturn) + ";\n" #sJSCallables += " },\n" #sJSCallables += "}\n" print(sPyCallables) for sActionName, aAction in dACTIONS.items(): print(sActionName, aAction) # Result d = { "graph_callables": sPyCallables, "graph_gctests": sGCTests, "rules_graphs": dAllGraph, "rules_actions": dACTIONS } return d |
Modified compile_rules_js_convert.py from [5ad87f3f46] to [f2cc9f3e39].
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | 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 | + + + + - - - - - - - - - - - + + + + + + + + + + + + + + + + | if not lNegLookBeforeRegex: lNegLookBeforeRegex = None return (sRegex, lNegLookBeforeRegex) def pyRuleToJS (lRule, dJSREGEXES, sWORDLIMITLEFT): lRuleJS = copy.deepcopy(lRule) # graph rules if lRuleJS[0] == "@@@@": return lRuleJS del lRule[-1] # tGroups positioning codes are useless for Python # error messages for aAction in lRuleJS[6]: if aAction[1] == "-": aAction[2] = aAction[2].replace(" ", " ") # nbsp --> nnbsp aAction[4] = aAction[4].replace("« ", "« ").replace(" »", " »").replace(" :", " :").replace(" :", " :") # js regexes lRuleJS[1], lNegLookBehindRegex = regex2js(dJSREGEXES.get(lRuleJS[3], lRuleJS[1]), sWORDLIMITLEFT) lRuleJS.append(lNegLookBehindRegex) return lRuleJS def writeRulesToJSArray (lRules): sArray = "[\n" for sOption, aRuleGroup in lRules: if sOption != "@@@@": |
Added darg.py version [5aaa4b1525].
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 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 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 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | #!python3 # RULE GRAPH BUILDER # # by Olivier R. # License: MPL 2 import json import time import traceback from graphspell.progressbar import ProgressBar class DARG: """DIRECT ACYCLIC RULE GRAPH""" # This code is inspired from Steve Hanov’s DAWG, 2011. (http://stevehanov.ca/blog/index.php?id=115) def __init__ (self, lRule, sLangCode): print("===== Direct Acyclic Rule Graph - Minimal Acyclic Finite State Automaton =====") # Preparing DARG print(" > Preparing list of tokens") self.sLangCode = sLangCode self.nRule = len(lRule) self.aPreviousRule = [] Node.resetNextId() self.oRoot = Node() self.lUncheckedNodes = [] # list of nodes that have not been checked for duplication. self.lMinimizedNodes = {} # list of unique nodes that have been checked for duplication. self.nNode = 0 self.nArc = 0 # build lRule.sort() oProgBar = ProgressBar(0, len(lRule)) for aRule in lRule: self.insert(aRule) oProgBar.increment(1) oProgBar.done() self.finish() self.countNodes() self.countArcs() self.displayInfo() # BUILD DARG def insert (self, aRule): if aRule < self.aPreviousRule: sys.exit("# Error: tokens must be inserted in order.") # find common prefix between word and previous word nCommonPrefix = 0 for i in range(min(len(aRule), len(self.aPreviousRule))): if aRule[i] != self.aPreviousRule[i]: break nCommonPrefix += 1 # Check the lUncheckedNodes for redundant nodes, proceeding from last # one down to the common prefix size. Then truncate the list at that point. self._minimize(nCommonPrefix) # add the suffix, starting from the correct node mid-way through the graph if len(self.lUncheckedNodes) == 0: oNode = self.oRoot else: oNode = self.lUncheckedNodes[-1][2] iToken = nCommonPrefix for sToken in aRule[nCommonPrefix:]: oNextNode = Node() oNode.dArcs[sToken] = oNextNode self.lUncheckedNodes.append((oNode, sToken, oNextNode)) if iToken == (len(aRule) - 2): oNode.bFinal = True iToken += 1 oNode = oNextNode oNode.bFinal = True self.aPreviousRule = aRule def finish (self): "minimize unchecked nodes" self._minimize(0) def _minimize (self, downTo): # proceed from the leaf up to a certain point for i in range( len(self.lUncheckedNodes)-1, downTo-1, -1 ): oNode, sToken, oChildNode = self.lUncheckedNodes[i] if oChildNode in self.lMinimizedNodes: # replace the child with the previously encountered one oNode.dArcs[sToken] = self.lMinimizedNodes[oChildNode] else: # add the state to the minimized nodes. self.lMinimizedNodes[oChildNode] = oChildNode self.lUncheckedNodes.pop() def countNodes (self): self.nNode = len(self.lMinimizedNodes) def countArcs (self): self.nArc = 0 for oNode in self.lMinimizedNodes: self.nArc += len(oNode.dArcs) def displayInfo (self): print(" * {:<12} {:>16,}".format("Rules:", self.nRule)) print(" * {:<12} {:>16,}".format("Nodes:", self.nNode)) print(" * {:<12} {:>16,}".format("Arcs:", self.nArc)) def createGraph (self): dGraph = { 0: self.oRoot.getNodeAsDict() } print(0, "\t", self.oRoot.getNodeAsDict()) for oNode in self.lMinimizedNodes: sHashId = oNode.__hash__() if sHashId not in dGraph: dGraph[sHashId] = oNode.getNodeAsDict() print(sHashId, "\t", dGraph[sHashId]) else: print("Error. Double node… same id: ", sHashId) print(str(oNode.getNodeAsDict())) return dGraph class Node: NextId = 0 def __init__ (self): self.i = Node.NextId Node.NextId += 1 self.bFinal = False self.dArcs = {} # key: arc value; value: a node @classmethod def resetNextId (cls): cls.NextId = 0 def __str__ (self): # Caution! this function is used for hashing and comparison! cFinal = "1" if self.bFinal else "0" l = [cFinal] for (key, oNode) in self.dArcs.items(): l.append(str(key)) l.append(str(oNode.i)) return "_".join(l) def __hash__ (self): # Used as a key in a python dictionary. return self.__str__().__hash__() def __eq__ (self, other): # Used as a key in a python dictionary. # Nodes are equivalent if they have identical arcs, and each identical arc leads to identical states. return self.__str__() == other.__str__() def getNodeAsDict (self): "returns the node as a dictionary structure" dNode = {} dReValue = {} dReMorph = {} dRules = {} dLemmas = {} for sArc, oNode in self.dArcs.items(): if sArc.startswith("@") and len(sArc) > 1: dReMorph[sArc[1:]] = oNode.__hash__() elif sArc.startswith("~") and len(sArc) > 1: dReValue[sArc[1:]] = oNode.__hash__() elif sArc.startswith(">") and len(sArc) > 1: dLemmas[sArc[1:]] = oNode.__hash__() elif sArc.startswith("##"): dRules[sArc[1:]] = oNode.__hash__() else: dNode[sArc] = oNode.__hash__() if dReValue: dNode["<re_value>"] = dReValue if dReMorph: dNode["<re_morph>"] = dReMorph if dLemmas: dNode["<lemmas>"] = dLemmas if dRules: dNode["<rules>"] = dRules #if self.bFinal: # dNode["<final>"] = 1 return dNode |
Modified gc_core/js/lang_core/gc_engine.js from [7ee1350cd7] to [12095116ac].
35 36 37 38 39 40 41 | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | - | // data let _sAppContext = ""; // what software is running let _dOptions = null; let _aIgnoredRules = new Set(); let _oSpellChecker = null; |
325 326 327 328 329 330 331 332 333 334 335 336 337 338 | 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | + | var spellchecker = require("resource://grammalecte/graphspell/spellchecker.js"); _oSpellChecker = new spellchecker.SpellChecker("${lang}", "", "${dic_main_filename_js}", "${dic_extended_filename_js}", "${dic_community_filename_js}", "${dic_personal_filename_js}"); } else { _oSpellChecker = new SpellChecker("${lang}", sPath, "${dic_main_filename_js}", "${dic_extended_filename_js}", "${dic_community_filename_js}", "${dic_personal_filename_js}"); } _sAppContext = sContext; _dOptions = gc_options.getOptions(sContext).gl_shallowCopy(); // duplication necessary, to be able to reset to default _oSpellChecker.activateStorage(); } catch (e) { helpers.logerror(e); } }, getSpellChecker: function () { |
374 375 376 377 378 379 380 | 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 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 | - - + + + - + - - - - - - - - - - - + - - - - + - + + - + - + - + + - + - + - - - - - - - - - - - | function displayInfo (dDA, aWord) { // for debugging: info of word if (!aWord) { helpers.echo("> nothing to find"); return true; } |
563 564 565 566 567 568 569 | 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 | - + - - - + - + - + - + - - - + - + - + | function select (dDA, nPos, sWord, sPattern, lDefault=null) { if (!sWord) { return true; } if (dDA.has(nPos)) { return true; } |
Modified gc_core/py/lang_core/gc_engine.py from [72ecd7c680] to [acd000b8ca].
8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 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 | + + + + + + + + + + + + + | #import unicodedata from itertools import chain from ..graphspell.spellchecker import SpellChecker from ..graphspell.echo import echo from . import gc_options from ..graphspell.tokenizer import Tokenizer from .gc_rules_graph import dAllGraph, dRule try: # LibreOffice / OpenOffice from com.sun.star.linguistic2 import SingleProofreadingError from com.sun.star.text.TextMarkupType import PROOFREADING from com.sun.star.beans import PropertyValue #import lightproof_handler_${implname} as opt _bWriterError = True except ImportError: _bWriterError = False __all__ = [ "lang", "locales", "pkg", "name", "version", "author", \ "load", "parse", "getSpellChecker", \ "setOption", "setOptions", "getOptions", "getDefaultOptions", "getOptionsLabels", "resetOptions", "displayOptions", \ "ignoreRule", "resetIgnoreRules", "reactivateRule", "listRules", "displayRules" ] __version__ = "${version}" |
29 30 31 32 33 34 35 36 | 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 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 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 168 169 170 171 172 173 174 175 176 177 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 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + - + + - + + + + + - + - + - - + + + + + + + + + + + + + + + - + + - + - + + - + - + | author = "${author}" _rules = None # module gc_rules # data _sAppContext = "" # what software is running _dOptions = None _oSpellChecker = None _oTokenizer = None _aIgnoredRules = set() # functions _createRegexError = None #### Initialization def load (sContext="Python"): global _oSpellChecker global _sAppContext global _dOptions global _oTokenizer global _createRegexError global _createTokenError try: _oSpellChecker = SpellChecker("${lang}", "${dic_main_filename_py}", "${dic_extended_filename_py}", "${dic_community_filename_py}", "${dic_personal_filename_py}") _sAppContext = sContext _dOptions = dict(gc_options.getOptions(sContext)) # duplication necessary, to be able to reset to default _oTokenizer = _oSpellChecker.getTokenizer() |
156 157 158 159 160 161 162 | 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 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | - - + - - - + - + - + - + - - - - - - + + - - + + - + - - - + - + | xErr.aSuggestions = () else: if bUppercase and m.group(iGroup)[0:1].isupper(): xErr.aSuggestions = tuple(map(str.capitalize, m.expand(sRepl).split("|"))) else: xErr.aSuggestions = tuple(m.expand(sRepl).split("|")) # Message |
259 260 261 262 263 264 265 | 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 | + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - | if sFilter: try: zFilter = re.compile(sFilter) except: echo("# Error. List rules: wrong regex.") sFilter = None for sOption, lRuleGroup in chain(_getRules(True), _getRules(False)): if sOption != "@@@@": |
332 333 334 335 336 337 338 | 382 383 384 385 386 387 388 389 390 391 392 393 394 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 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - + - - - - - - - - - - + - + + - - + - - + - - + + - + + - + - + - - - - - - - - + + + | global _dOptions _dOptions = dict(gc_options.getOptions(_sAppContext)) def getSpellChecker (): return _oSpellChecker |
532 533 534 535 536 537 538 | 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 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 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 774 775 776 777 778 779 780 781 782 783 784 785 786 787 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 896 897 898 899 900 901 902 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 | - + - - + - + - + - - - + - - + - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | #### Disambiguator def select (dDA, nPos, sWord, sPattern, lDefault=None): if not sWord: return True if nPos in dDA: return True |
Added gc_core/py/lang_core/gc_rules_graph.py version [b99ba93b1b].
1 2 3 4 5 | + + + + + | # generated code, do not edit dAllGraph = ${rules_graphs} dRule = ${rules_actions} |
Added gc_core/py/lang_core/gc_sentence.py version [c68dc1622f].
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 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 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 168 169 170 171 172 173 174 175 176 177 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 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 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | # Sentence checker from ..graphspell.tokenizer import Tokenizer from .gc_rules_graph import dGraph oTokenizer = Tokenizer("${lang}") class TokenSentence: def __init__ (self, sSentence, sSentence0, nOffset): self.sSentence = sSentence self.sSentence0 = sSentence0 self.nOffset = nOffset self.lToken = list(oTokenizer.genTokens()) def parse (self): dErr = {} lPointer = [] for dToken in self.lToken: for i, dPointer in enumerate(lPointer): bValid = False for dNode in self._getNextMatchingNodes(dToken, dPointer["dNode"]): dPointer["nOffset"] = dToken["i"] dPointer["dNode"] = dNode bValid = True if not bValid: del lPointer[i] for dNode in self._getNextMatchingNodes(dToken, dGraph): lPointer.append({"nOffset": 0, "dNode": dNode}) for dPointer in lPointer: if "<rules>" in dPointer["dNode"]: for dNode in dGraph[dPointer["dNode"]["<rules>"]]: dErr = self._executeActions(dNode, nOffset) return dErr def _getNextMatchingNodes (self, dToken, dNode): # token value if dToken["sValue"] in dNode: yield dGraph[dNode[dToken["sValue"]]] # token lemmas for sLemma in dToken["lLemma"]: if sLemma in dNode: yield dGraph[dNode[sLemma]] # universal arc if "*" in dNode: yield dGraph[dNode["*"]] # regex arcs if "~" in dNode: for sRegex in dNode["~"]: for sMorph in dToken["lMorph"]: if re.search(sRegex, sMorph): yield dGraph[dNode["~"][sRegex]] def _executeActions (self, dNode, nOffset): for sLineId, nextNodeKey in dNode.items(): for sArc in dGraph[nextNodeKey]: bCondMemo = None sFuncCond, cActionType, sWhat, *eAct = dRule[sArc] # action in lActions: [ condition, action type, replacement/suggestion/action[, iGroupStart, iGroupEnd[, message, URL]] ] try: bCondMemo = not sFuncCond or globals()[sFuncCond](self, sCountry, bCondMemo) if bCondMemo: if cActionType == "-": # grammar error nErrorStart = nSentenceOffset + m.start(eAct[0]) nErrorEnd = nSentenceOffset + m.start(eAct[1]) if nErrorStart not in dErrs or nPriority > dPriority[nErrorStart]: dErrs[nErrorStart] = _createError(self, sWhat, nErrorStart, nErrorEnd, sLineId, bUppercase, eAct[2], eAct[3], bIdRule, sOption, bContext) dPriority[nErrorStart] = nPriority elif cActionType == "~": # text processor self._rewrite(sWhat, nErrorStart, nErrorEnd) elif cActionType == "@": # jump self._jump(sWhat) elif cActionType == "=": # disambiguation globals()[sWhat](self.lToken) elif cActionType == ">": # we do nothing, this test is just a condition to apply all following actions pass else: print("# error: unknown action at " + sLineId) elif cActionType == ">": break except Exception as e: raise Exception(str(e), "# " + sLineId + " # " + sRuleId) def _createWriterError (self): d = {} return d def _createDictError (self): d = {} return d def _rewrite (self, sWhat, nErrorStart, nErrorEnd): "text processor: rewrite tokens between <nErrorStart> and <nErrorEnd> position" lTokenValue = sWhat.split("|") if len(lTokenValue) != (nErrorEnd - nErrorStart + 1): print("Error. Text processor: number of replacements != number of tokens.") return for i, sValue in zip(range(nErrorStart, nErrorEnd+1), lTokenValue): self.lToken[i]["sValue"] = sValue def _jump (self, sWhat): try: nFrom, nTo = sWhat.split(">") self.lToken[int(nFrom)]["iJump"] = int(nTo) except: print("# Error. Jump failed: ", sWhat) traceback.print_exc() return #### Analyse tokens def g_morph (dToken, sPattern, bStrict=True): "analyse a token, return True if <sPattern> in morphologies" if "lMorph" in dToken: lMorph = dToken["lMorph"] else: if dToken["sValue"] not in _dAnalyses and not _storeMorphFromFSA(dToken["sValue"]): return False if not _dAnalyses[dToken["sValue"]]: return False lMorph = _dAnalyses[dToken["sValue"]] zPattern = re.compile(sPattern) if bStrict: return all(zPattern.search(sMorph) for sMorph in lMorph) return any(zPattern.search(sMorph) for sMorph in lMorph) def g_morphex (dToken, sPattern, sNegPattern): "analyse a token, return True if <sNegPattern> not in morphologies and <sPattern> in morphologies" if "lMorph" in dToken: lMorph = dToken["lMorph"] else: if dToken["sValue"] not in _dAnalyses and not _storeMorphFromFSA(dToken["sValue"]): return False if not _dAnalyses[dToken["sValue"]]: return False lMorph = _dAnalyses[dToken["sValue"]] # check negative condition zNegPattern = re.compile(sNegPattern) if any(zNegPattern.search(sMorph) for sMorph in lMorph): return False # search sPattern zPattern = re.compile(sPattern) return any(zPattern.search(sMorph) for sMorph in lMorph) def g_analyse (dToken, sPattern, bStrict=True): "analyse a token, return True if <sPattern> in morphologies (disambiguation off)" if dToken["sValue"] not in _dAnalyses and not _storeMorphFromFSA(dToken["sValue"]): return False if not _dAnalyses[dToken["sValue"]]: return False zPattern = re.compile(sPattern) if bStrict: return all(zPattern.search(sMorph) for sMorph in _dAnalyses[dToken["sValue"]]) return any(zPattern.search(sMorph) for sMorph in _dAnalyses[dToken["sValue"]]) def g_analysex (dToken, sPattern, sNegPattern): "analyse a token, return True if <sNegPattern> not in morphologies and <sPattern> in morphologies (disambiguation off)" if dToken["sValue"] not in _dAnalyses and not _storeMorphFromFSA(dToken["sValue"]): return False if not _dAnalyses[dToken["sValue"]]: return False # check negative condition zNegPattern = re.compile(sNegPattern) if any(zNegPattern.search(sMorph) for sMorph in _dAnalyses[dToken["sValue"]]): return False # search sPattern zPattern = re.compile(sPattern) return any(zPattern.search(sMorph) for sMorph in _dAnalyses[dToken["sValue"]]) #### Go outside the rule scope def g_nextToken (i): pass def g_prevToken (i): pass def g_look (): pass def g_lookAndCheck (): pass #### Disambiguator def g_select (dToken, sPattern, lDefault=None): "select morphologies for <dToken> according to <sPattern>, always return True" if dToken["sValue"] not in _dAnalyses and not _storeMorphFromFSA(dToken["sValue"]): return True if len(_dAnalyses[dToken["sValue"]]) == 1: return True lMorph = dToken["lMorph"] or _dAnalyses[dToken["sValue"]] lSelect = [ sMorph for sMorph in lMorph if re.search(sPattern, sMorph) ] if lSelect: if len(lSelect) != len(lMorph): dToken["lMorph"] = lSelect elif lDefault: dToken["lMorph"] = lDefault return True def g_exclude (dToken, sPattern, lDefault=None): "select morphologies for <dToken> according to <sPattern>, always return True" if dToken["sValue"] not in _dAnalyses and not _storeMorphFromFSA(dToken["sValue"]): return True if len(_dAnalyses[dToken["sValue"]]) == 1: return True lMorph = dToken["lMorph"] or _dAnalyses[dToken["sValue"]] lSelect = [ sMorph for sMorph in lMorph if not re.search(sPattern, sMorph) ] if lSelect: if len(lSelect) != len(lMorph): dToken["lMorph"] = lSelect elif lDefault: dToken["lMorph"] = lDefault return True def g_define (dToken, lMorph): "set morphologies of <dToken>, always return True" dToken["lMorph"] = lMorph return True #### CALLABLES (generated code) ${graph_callables} |
Modified gc_lang/fr/modules-js/conj.js from [f544af05b0] to [8124143953].
83 84 85 86 87 88 89 | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | - + | return this._lVtyp[this._dVerb[sVerb][0]]; }, getSimil: function (sWord, sMorph, bSubst=false) { if (!sMorph.includes(":V")) { return new Set(); } |
Modified gc_lang/fr/modules-js/gce_analyseur.js from [e2613ddcd2] to [bdc2b54804].
18 19 20 21 22 23 24 | 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 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | - - + - - + - + + - + - + - - - + + - - + + - - - + + - - + + - - - + + - - + + | if (s2 == "vous") { return "vous"; } if (s2 == "eux") { return "ils"; } if (s2 == "elle" || s2 == "elles") { |
Modified gc_lang/fr/modules-js/gce_suggestions.js from [0c31bc1a27] to [6803550153].
8 9 10 11 12 13 14 | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | - - + - + - + | var phonet = require("resource://grammalecte/fr/phonet.js"); } //// verbs function suggVerb (sFlex, sWho, funcSugg2=null) { |
57 58 59 60 61 62 63 | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | - + | return Array.from(aSugg).join("|"); } return ""; } function suggVerbPpas (sFlex, sWhat=null) { let aSugg = new Set(); |
107 108 109 110 111 112 113 | 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 | - + - + - + | return Array.from(aSugg).join("|"); } return ""; } function suggVerbTense (sFlex, sTense, sWho) { let aSugg = new Set(); |
172 173 174 175 176 177 178 | 171 172 173 174 175 176 177 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 | - + - + + - + | if (!sWho) { if (sSuj[0].gl_isLowerCase()) { // pas un pronom, ni un nom propre return ""; } sWho = ":3s"; } let aSugg = new Set(); |
254 255 256 257 258 259 260 | 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | - - + | return Array.from(aSugg).join("|"); } return ""; } function suggMasSing (sFlex, bSuggSimil=false) { // returns masculine singular forms |
290 291 292 293 294 295 296 | 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | - - + | return Array.from(aSugg).join("|"); } return ""; } function suggMasPlur (sFlex, bSuggSimil=false) { // returns masculine plural forms |
331 332 333 334 335 336 337 | 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | - - + | } return ""; } function suggFemSing (sFlex, bSuggSimil=false) { // returns feminine singular forms |
365 366 367 368 369 370 371 | 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | - - + | return Array.from(aSugg).join("|"); } return ""; } function suggFemPlur (sFlex, bSuggSimil=false) { // returns feminine plural forms |
398 399 400 401 402 403 404 | 394 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 488 489 490 491 492 493 494 495 496 497 498 | - + - + - - + - + - + - + - + | if (aSugg.size > 0) { return Array.from(aSugg).join("|"); } return ""; } function hasFemForm (sFlex) { |
511 512 513 514 515 516 517 | 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 | - - + | if (sWord[0] == "h" || sWord[0] == "H") { return "ce|cet"; } return "ce"; } function suggLesLa (sWord) { |
Modified gc_lang/fr/modules-js/tests_data.json from [f05e835c66] to [ef6f6c1c40].
| 1 | - + |
|
Modified gc_lang/fr/modules/conj.py from [c668aaf269] to [96ddf4a9dc].
54 55 56 57 58 59 60 | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | - + | return None return _lVtyp[_dVerb[sVerb][0]] def getSimil (sWord, sMorph, bSubst=False): if ":V" not in sMorph: return set() |
Modified gc_lang/fr/modules/gce_analyseur.py from [39975de0ac] to [50ac148025].
13 14 15 16 17 18 19 | 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 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | - + - - + - - + - + - - + - + - - + - + - - + - + - - + - + | return "vous" if s2 == "nous": return "nous" if s2 == "vous": return "vous" if s2 == "eux": return "ils" |
Modified gc_lang/fr/modules/gce_suggestions.py from [79835965e4] to [a5e2b1d398].
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 | - + - - + + | #### GRAMMAR CHECKING ENGINE PLUGIN: Suggestion mechanisms from . import conj from . import mfsp from . import phonet ## Verbs def suggVerb (sFlex, sWho, funcSugg2=None): aSugg = set() |
38 39 40 41 42 43 44 | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | - + | if aSugg: return "|".join(aSugg) return "" def suggVerbPpas (sFlex, sWhat=None): aSugg = set() |
81 82 83 84 85 86 87 | 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | - + - + - + | if aSugg: return "|".join(aSugg) return "" def suggVerbTense (sFlex, sTense, sWho): aSugg = set() |
129 130 131 132 133 134 135 | 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 | - + + - + - + | return "" sWho = _dQuiEst.get(sSuj.lower(), None) if not sWho: if sSuj[0:1].islower(): # pas un pronom, ni un nom propre return "" sWho = ":3s" aSugg = set() |
189 190 191 192 193 194 195 | 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | - - + | if aSugg: return "|".join(aSugg) return "" def suggMasSing (sFlex, bSuggSimil=False): "returns masculine singular forms" |
217 218 219 220 221 222 223 | 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | - - + | if aSugg: return "|".join(aSugg) return "" def suggMasPlur (sFlex, bSuggSimil=False): "returns masculine plural forms" |
248 249 250 251 252 253 254 | 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | - - + | if aSugg: return "|".join(aSugg) return "" def suggFemSing (sFlex, bSuggSimil=False): "returns feminine singular forms" |
274 275 276 277 278 279 280 | 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | - - + | if aSugg: return "|".join(aSugg) return "" def suggFemPlur (sFlex, bSuggSimil=False): "returns feminine plural forms" |
299 300 301 302 303 304 305 | 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 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 | - + - + - - + - + - + - - + - - + - - + | aSugg.add(e) if aSugg: return "|".join(aSugg) return "" def hasFemForm (sFlex): |
Modified gc_lang/fr/rules.grx from [efca56ef6f] to [072f8fb4d5].
680 681 682 683 684 685 686 | 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 | - + | __[i>/virg(virgule_manquante_avant_etc)__ {w_1}( etc[.]) @@$ <<- -1>> , etc. # Avant « etc. », il faut mettre une virgule. __[i>/virg(virgule_manquante_avant_car)__ ({w_1})( car)(?= (?:j[e’]|tu|ils?|nous|vous|elles?|on|les?|l[a’]|ces?|des?|cette|[mts](?:on|a|es))\b) @@0,$ <<- not morph(\1, ":[DR]", False) -2>> , car # Si « car » est la conjonction de coordination, une virgule est peut-être souhaitable.|http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=3447 __[i>/virg(virgule_manquante_avant_mais)__ ({w_1})( mais)(?= (?:j[e’]|tu|ils?|nous|vous|elles?|on)\b) @@0,$ |
1230 1231 1232 1233 1234 1235 1236 | 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 | - + | !! !! !!!! Redondances !! !! __[i]/redon1(redondances_paragraphe)__ ({w_4})[ ,.;!?:].*[ ](\1) @@0,$ |
1501 1502 1503 1504 1505 1506 1507 | 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 | - + - + | !! !! __<i]/tu(tu_t_euphonique_incorrect)__ ([-–—− ]t(?:[’' ][-–—−]?|[-–—−][’' ]?))(ils?|elles?|on|tu) @@0,$ <<- re.search("(?i)^(?:ils|elles|tu)$", \2) -1>> - # Le “t” euphonique n’est pas nécessaire avec “\2”.|http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?T1=t+euphonique&id=2513 <<- __else__ and \1 != "-t-" and \1 != "-T-" -1>> -t- # Pour le “t” euphonique, il faut deux traits d’union. Pas d’apostrophe. Pas d’espace. |
1749 1750 1751 1752 1753 1754 1755 | 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 | - + | TEST: des {{stock options}} TEST: Un autre chantier important, celui si sensible de la préservation des données personnelles des élèves # est-ce … ? __[i]/tu(tu_est_ce)__ (?<![cCdDlL][’'])(est ce) ({w_2}) @@0,$ |
1888 1889 1890 1891 1892 1893 1894 | 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 | - + | TEST: {{Parce-qu}}’ils y croient plus que tout. TEST: Oui, ça{{-aussi}}. TEST: Peu {{d’entre-nous}} savent ce dont il s’agit. __[i]/tu(tu_y_attaché)__ (y[’-])({avoir_etre})(?:-(?:t-|)(?:ils?|elles?|je|tu|on|nous|vous)|) @@0,2 |
1931 1932 1933 1934 1935 1936 1937 | 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 | - + | TEST: donne{{-le-moi}} Camille. TEST: donne-moi Alice. TEST: Tape-toi Patrick. __[u]/virg(virgule_après_verbe_COD)__ l(?:es?|a) ({w_2}(?:[ei]r|re)) ([A-ZÉÂÔÈ][\w-]+) @@w,$ |
1954 1955 1956 1957 1958 1959 1960 | 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 | - + | !!!! A / À: accentuation la préposition en début de phrase __<s]/typo(typo_À_début_phrase1)__ ^ *(A) (?!t[’-](?:ils?|elles?|on))({w_2}) @@*,$ |
1992 1993 1994 1995 1996 1997 1998 | 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 | - + - + | !!! Désambiguïsation !!! !!! # mots grammaticaux __[i](d_dans)__ dans |
2042 2043 2044 2045 2046 2047 2048 | 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 | - + | __[i](d_tu_verbe)__ tu +(?:l(?:es? +|la +|’)|[nv]ous +|)({w_1}) @@$ <<- morph(word(-1), ":Cs", False, True) and not morph(\1, ":(?:Oo|X)", False) =>> select(\1, ":[123][sp]") __[s](d_nom_propre_verbe)__ ([A-ZÉÈ]{w_1}) +({w_1}) @@0,$ <<- morph(\1, ":M") and \2.islower() and morphex(\2, ":[123][sg]", ":Q") and morph(\2, ":N", False) and morph(word(-1), ":Cs", False, True) =>> select(\2, ":[123][sp]") |
2194 2195 2196 2197 2198 2199 2200 | 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 | - + | # cette / cotte __[i]/ocr(ocr_cette2)__ cotte <<- not morph(word(-1), ":D.*:f:[si]") ->> cette # Erreur de numérisation ? TEST: __ocr__ on poirautait, {{cotte}} mariée n’arrivait pas à se décider. # Comme / Gomme |
2457 2458 2459 2460 2461 2462 2463 | 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 | - + | # Mais / Hais / Mats / niais __[u]/ocr(ocr_mais1)__ Hais <<- ->> Mais # Erreur de numérisation ? __[i]/ocr(ocr_mais2)__ mats <<- not morph(word(-1), ":D:[me]:p", False, False) ->> mais # Erreur de numérisation ? __[i]/ocr(ocr_mais3)__ maïs <<- not morph(word(-1), ":D:(?:m:s|e:p)", False, False) ->> mais # Erreur de numérisation ? __[s]/ocr(ocr_mais4)__ |
2685 2686 2687 2688 2689 2690 2691 | 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 | - + | ## Casse __[s]/ocr(ocr_casse1)__ [A-ZÉÈÂÊÎÔ]{w_1} <<- \0.istitle() and before(r"(?i)\w") >>> <<- morphex(\0, ":G", ":M") ->> =\0.lower() # Erreur de numérisation ? Casse improbable. |
2770 2771 2772 2773 2774 2775 2776 | 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 | - + - + - + - + | TEST: {{Ces}} {{cette}} canaille qui nous a donné tant de fil à retordre. TEST: Mon {{il}} est une merveille. __[s](incohérence_globale_au_qqch)__ ([aA]u) ({w2}) @@0,$ <<- not \2.isupper() >>> |
2822 2823 2824 2825 2826 2827 2828 | 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 | - + - + | TEST: {{En}} Avignon TEST: {{En}} Agen # avoir été __[i]/bs(bs_avoir_été_chez)__ (?<!l’)({avoir}) été chez @@0 |
2919 2920 2921 2922 2923 2924 2925 | 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 | - - - + + + - + - + - - + + - - + + - + - + - + - - + + - - + + | !! !! !!!! Pléonasmes !! !! |
3051 3052 3053 3054 3055 3056 3057 | 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 | - + - + | TEST: {{vieilles hardes}} ->> hardes TEST: {{voire même}} ->> voire|même # d’avance / à l’avance __[i]/pleo(pleo_verbe_à_l_avance)__ ((?:pré[pvds]|pressen|pronostiqu|réserv|dev(?:an[cç]|in)|avert)\w+) (?:d’avance|à l’avance) @@0 |
3271 3272 3273 3274 3275 3276 3277 | 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 | - + - + | TEST: d’une {{habille}} femme TEST: plus d’un ont été traumatisés TEST: plus d’une sont parties aussi vite qu’elles étaient venues __[i]/conf(conf_il_on_pas_verbe)__ (?<!t’)(?:il|on) (?:l’|l(?:es?|a|eur|ui) +|[nv]ous +|)({w_2}) @@$ |
3329 3330 3331 3332 3333 3334 3335 | 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 | - + | # <<- morph(\1, ":W", False) and morphex(\2, ":[123][sp]", ":[GAQW]") -2>> _ # # Incohérence avec « très » : « \2 » n’est ni un adjectif, ni un participe passé, ni un adverbe. __[i]/conf(conf_très_verbe)__ très +(?!envie)({w_2}) @@$ <<- morphex(\1, ":(?:Y|[123][sp])", ":[AQW]") -1>> =suggSimil(\1, ":[AW]", True) # Incohérence avec « très » : « \1 » n’est ni un adjectif, ni un participe passé, ni un adverbe. |
3383 3384 3385 3386 3387 3388 3389 | 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 | - + | TEST: Ces gens sont si {{prit}} par leur travail qu’ils en oublient de vivre. TEST: Ça ira mieux demain, surtout si émerge une demande forte de la part des consommateurs. __[i]/conf(conf_de_plus_en_plus_verbe)__ de plus en plus +({w_2}) @@$ |
3405 3406 3407 3408 3409 3410 3411 | 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 | - + | __[i]/conf(conf_a_à_tout_à_coup)__ tout h?ah? co[uû][pt]? <<- ->> tout à coup # Confusion. __[i]/conf(conf_a_à_coup_sûr)__ a coup s[uû]r <<- ->> à coup sûr # Confusion. __[i]/conf(conf_a_à_face_à)__ face (a) @@5 <<- not before(r"(?i)\b(?:[lmts]a|leur|une|en) +$") -1>> à # Confusion. __[i]/conf(conf_a_à_pas_à_pas)__ pas (a) pas @@4 <<- -1>> à # Confusion. __[i]/conf(conf_a_à_par_rapport)__ par rapport (a) ({w_2}) @@12,$ <<- morph(\2, ":(?:D|Oo|M)", False) -1>> à # Confusion. __[i]/conf(conf_a_à_être_à)__ ({etre}) (a)(?! priori| posteriori| fortiori) @@0,$ |
3431 3432 3433 3434 3435 3436 3437 | 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 | - + | <<- re.search("(?i)^(?:côtés?|coups?|peu-près|pics?|propos|valoir|plat-ventrismes?)", \2) ->> l’à-\2 # Il faut un trait d’union. __[i]/conf(conf_a_à_il_on_à)__ (?:il|on) +(?:l(?:es +|’)|en +|y +(?:en +|)|[vn]ous +|)(à) @@$ <<- not morph(word(-1), ":3s", False, False) -1>> a # Confusion probable : “à” est une préposition. Pour le verbe avoir, écrivez : __[i]/conf(conf_a_à_elle_à)__ elle +(?:l(?:es +|’)|en +|y +(?:en |)|[vn]ous +|)(à) @@$ |
3568 3569 3570 3571 3572 3573 3574 | 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 | - + - + | TEST: Ceux {{a}} qui nous avons notifié le problème sont partis. TEST: Il y a qui au dîner ce soir ? __[i]/conf(conf_mener_à_bien)__ (m[eèé]n\w+) (a) bien @@0,w |
3628 3629 3630 3631 3632 3633 3634 | 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 | - + | # ça / çà / sa __[i]/conf(conf_ça_sa)__ (ça) ({w_2}) @@0,3 <<- morph(\2, ":[NAQ].*:f") and not re.search("^seule?s?", \2) -1>> sa # Confusion : “sa” (sa maison, sa passion) ≠ “ça” (ça vient, ça heurte). __[i]/conf(conf_sa_ça1)__ (sa) +({w_2}) @@0,$ |
3651 3652 3653 3654 3655 3656 3657 | 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 | - + - + - + - + | TEST: sa toute nouvelle application de synchronisation de fichiers # ce / se / ceux __[s]/conf(conf_se_verbe)__ ([cC]e) ({w_2}) @@0,3 <<- \2[0].islower() and \2 != "faire" |
3731 3732 3733 3734 3735 3736 3737 | 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 | - + | ([scSC]es) [ld]’(?![A-Z]) @@0 <<- -1>> c’est # Confusion. Écrivez « c’est » pour dire « ceci est… ». __[s]/conf(conf_c_est3)__ ([scSC]es) (?:qu(?:lle|el?|)|comme|ce(?:t|tte|)|[nv]os|les?|eux|elles) @@0 <<- -1>> c’est # Confusion probable. Écrivez « c’est » pour dire « ceci est… ». __[s]/conf(conf_c_est4)__ ([scSC]es) ({w_1}) ({w_1}) @@0,w,$ |
3770 3771 3772 3773 3774 3775 3776 | 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 | - + | loin du (co[mn]te) @@$ <<- -1>> compte # Confusion. Locution “loin du compte”.|https://fr.wiktionary.org/wiki/loin_du_compte __[i]/conf(règlement_de_comptes)__ r[éè]glements? de (co[mn]tes?) @@$ <<- -1>> comptes # Confusion.|https://fr.wiktionary.org/wiki/r%C3%A8glement_de_comptes __[i]/conf(régler_son_compte)__ (r[éè]gl\w+) +(?:[mts]on|leurs?|[vn]otre) (co[mn]tes?) @@0,$ |
3835 3836 3837 3838 3839 3840 3841 | 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 | - + - + | (?:peu|plein|beaucoup|trop|plus|moins|assez|suffisamment|tellement|obtentions?|régimes?) (davantage) @@$ <<- -1>> d’avantages # Confusion probable : “davantage” signifie “plus” ; un “avantage” signifie “faveur”, “bénéfice”, “profit”… __[i]/conf(conf_être_davantage_ppas)__ ({etre}) (d’avantages?) ({w_2}) @@0,w,$ <<- morph(\1, ":V0e", False) and morphex(\3, ":[NAQ]", ":G") -2>> davantage # Confusion possible : “davantage” signifie “plus” ; un “avantage” signifie “faveur”, “bénéfice”, “profit”… __[i]/conf(conf_davantage1)__ ({w1}) (d’avantages?) @@0,$ |
3919 3920 3921 3922 3923 3924 3925 | 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 | - + | TEST: et bien manger, c’est important. TEST: il a été vaincu, et bien vaincu. # faut / faux __[i]/conf(conf_faux)__ faut |
3954 3955 3956 3957 3958 3959 3960 | 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 | - + - + | __[i]/conf(conf_flanc)__ (flans?) (?:des? (?:la |)(?:colline|montagne)s?|gauches?|droites?|nord|sud|ouest) @@0 <<- -1>> =\0.replace("an", "anc").replace("AN", "ANC") # Confusion probable. Le flan est une pâtisserie.|https://fr.wiktionary.org/wiki/flanc __[i]/conf(conf_sur_le_flanc)__ ((?:attaqu|allong|bless|couch|étend|touch)\w+) +sur (?:les?|[mts](?:on|es)|[nv]o(?:tre|s)) (flans?) @@0,$ |
4017 4018 4019 4020 4021 4022 4023 | 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 | - + | TEST: Le peuple se sent hors jeu. # la / là __[s]/conf(conf_la_là)__ ([lL]a) (?:a(?:fin|lors|près|uprès|ux?|vant|vec)|au(?:-de(?:dans|hors|là|sso?us|vant)|x|)|c(?:e(?:t|te|s|)|ar|hez|omme)|ça|d(?:ans|evant|es?|ès|onc|urant|’{w_1})|e(?:lles?|n|t)|ils?|je?|l(?:es?|a|orsque?|’{w_1})|m(?:algré|es|on|a|e)|n(?:e|ous)|o[uùn]|par(?:ce|fois|mi|)|p(?:arce|endant|our|uisque)|qu(?:e?|and)|s(?:on|a|es?|ouvent|ur)|t(?:andis|on|a|es?|u)|un|vous) @@0 |
4069 4070 4071 4072 4073 4074 4075 | 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 | - + | TEST: je {{leurs}} apprends la programmation TEST: après qu’un des leurs ait été gravement blessé par un tir de grenade # loin s’en faut __[i]/conf(conf_loin_s_en_faut)__ loins? +(?:[sc]ens|san[gs]?s?|s[’ ]en) +fau[xt] |
4203 4204 4205 4206 4207 4208 4209 | 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 | - + - + - + - + | TEST: la {{plus part}} # par-dessus / pardessus __[i]/conf(conf_par_dessus)__ (pardessus) +({w1}) @@0,$ |
4279 4280 4281 4282 4283 4284 4285 | 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 | - - + + | <<- morphex(\2, ":[NAQ]", ":(?:G|[123][sp]|W)") -1>> =\1.replace(" ", "") # Confusion probable. Ex : Quelle femme ! Je crois qu’elle réussira. TEST: {{qu’elle}} emmerdeuse. __[i]/conf(conf_qu_elle_verbe)__ (quelles?) +({w_1}) @@0,$ |
4340 4341 4342 4343 4344 4345 4346 | 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 | - - + + | ne (?:l(?:e|eur|ui) |[nv]ous |)(son) @@$ <<- -1>> sont # Confusion : “son” est un déterminant ou un nom masculin. Le verbe “être” à la 3ᵉ personne du pluriel s’écrit “sont”. __[i]/conf(conf_me_te_se_son)!6__ [mts]e (son) @@3 <<- -1>> sont # Confusion : “son” est un déterminant ou un nom masculin. Le verbe “être” à la 3ᵉ personne du pluriel s’écrit “sont”. __[i]/conf(conf_son_qqch)__ (sont) ({w_2}) @@0,$ |
4421 4422 4423 4424 4425 4426 4427 | 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 | - + - + - + | # ->> voie __[i]/conf(conf_sur_la_bonne_voie)__ sur la bonne (voix) @@$ <<- -1>> voie # Confusion.|http://fr.wiktionary.org/wiki/voix __[i]/conf(conf_en_voie_de)__ en (voix) d(?:e (?:développement|disparition|guérison|résorption)|’(?:acquisition|achèvement|extinction|obtention)) @@3 <<- -1>> voie # Confusion.|http://fr.wiktionary.org/wiki/voie __[i]/conf(conf_ouvrir_la_voix)__ |
4480 4481 4482 4483 4484 4485 4486 | 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 | - + - + - + - + - + - + | __[i]/conf(conf_j_y_en_qqch)__ (j’(?:en +|y +|))({w_1}) @@0,$ <<- morphex(\2, ":", ":(?:[123][sp]|O[onw])") -2>> =suggSimil(\2, ":1s", False) # Incohérence avec « \1 » : « \2 » devrait être un verbe. __[i]/conf(conf_ne_qqch)__ (n(?:e +|’))({w_1}) @@0,$ |
4698 4699 4700 4701 4702 4703 4704 | 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 | - + - + - + - + - + - + | TEST: {{Toute}} celles qui viendront… TEST: et {{toute}} ce barouf ne nous a apporté que des ennuis. TEST: car {{toute}} mon savoir vient d’elle __[i]/gn(gn_toutes_déterminant_nom_fem_plur)__ (tous) +(?:[lcmtsd]es) +({w_2}) @@0,$ |
4791 4792 4793 4794 4795 4796 4797 | 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 | - + | __[i](p_ne_plus_pas_jamais_beaucoup_trop_rien)__ ne (?:pas|plus|jamais) +(beaucoup|trop|rien) @@$ <<- ~1>> * __[i]/infi(infi_ne)__ ne (?:pas|rien|jamais(?: rien| plus|)|plus(?: jamais| rien| guère|)|guère|point) (?:non plus |)(?:l(?:e(?:ur|s|)|a|ui) |nous |vous |[mtsl]’(?:en |y |)|[mts]e |en |y |)({w_1}) @@$ |
5271 5272 5273 5274 5275 5276 5277 | 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 | - + | __[i](p_mot_de_passe)__ mots? (de passe) @@$ <<- ~1>> * __[i](p_moteur_essence_diesel)__ moteurs? (essence|di[eé]sel)s? @@$ <<- ~1>> * __[i](p_motion_de)__ motions? (de (?:blâme|censure|défiance)) @@$ <<- ~1>> * __[i](p_noix_de)__ noix (de (?:cajou|p[ée]can|coco|lavage|muscade|veau|macadamia)) @@$ <<- ~1>> * __[i](p_nu_comme_un_ver)__ nue?s? (comme (?:un ver|des vers)) @@$ <<- ~1>> * __[i](p_numéro)__ numéro (un|deux|trois|quatre|cinq|six|sept|huit|neuf|dix(?:-sept|-huit|-neuf|)|onze|douze|treize|quatorze|quinze|seize|vingt|trente|quarante|cinquante|soixante(?:-dix|)|quatre-vingt(?:-dix|)|cent|mille|\d+) @@$ |
5418 5419 5420 5421 5422 5423 5424 | 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 | - + - + - + | (?:à|de) (?:d(?:eu|i)x|tr(?:ois|eize)|qu(?:at(?:re|orze)|inze)|cinq|s(?:ix|ept|eize)|huit|neuf|onze|douze|vingt) +heures(?: (?:d(?:eu|i)x|tr(?:ois|eize|ente)|qu(?:a(?:t(?:re|orze)|rante)|inze)|cinq(?:uante|)|s(?:ix|ept|eize)|huit|neuf|onze|douze|vingt)|) <<- ~>> * ## Conditionnel __[i](p_à_xxx_pour_cent)__ à ({w_2}) pour cent @@2 <<- morph(\1, ":B", False) ~>> * __[i](p_au_moins)__ (au moins) +({w_1}) @@0,$ <<- not morph(\2, ":[AQ].*:[me]:[si]", False) ~1>> * __[i](p_au_hasard)__ au hasard <<- isEndOfNG() ~>> * __[i](p_aussi_adv_que_possible)__ aussi ({w_2}) que (?:nécessaire|possible) @@6 <<- morph(\1, ":W", False) ~>> * |
5526 5527 5528 5529 5530 5531 5532 | 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 | - + | ({avoir}) +(besoin|bon (?:dos|pied,? bon œil)|carte blanche|confiance|conscience|crainte|faim|forme humaine|honte|partie (?:gagnée|liée)|peur|soif|voix au chapitre) @@0,$ <<- morph(\1, ":V0a", False) and not (\2 == "crainte" and before(r"\w")) ~2>> * __[i](p_avoir_pronom_loc_adv)__ ({avoir})-(?:je|tu|ils?|elles?|nous|vous|on) +(besoin|bon (?:dos|pied,? bon œil)|carte blanche|confiance|conscience|crainte|faim|forme humaine|honte|partie (?:gagnée|liée)|peur|soif|voix au chapitre) @@0,$ <<- morph(\1, ":V0a", False) ~2>> * __[i](p_avoir_tous_toutes_les)__ ({avoir}) +(tou(?:te|)s les ({w_2})) +({w_2}) @@0,w,>3:$,$ |
5559 5560 5561 5562 5563 5564 5565 | 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 | - + | la ({w_2}) (la plus) ({w_2}) @@3,w,$ <<- morphex(\1, ":[NAQ].*:[fe]", ":G") and morph(\3, ":[AQ].*:[fe]", False) ~2>> * __[i](p_les_xxx_les_plus_adj)__ (?:[lmts]es|nos|vos|leurs) ({w_2}) (les plus) ({w_2}) @@w,w,$ <<- morphex(\1, ":[NAQ].*:[pi]", ":[123][sp]") and morph(\3, ":A.*:[pi]", False) ~2>> * __[i](p_le_plus_le_moins)__ (le (?:plus|moins)) ({w_2}) @@0,$ |
5690 5691 5692 5693 5694 5695 5696 | 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 | - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - + - - + + - + - + - + - + | __[i](p_un_moment_instant)__ (un (?:instant|moment|jour)) +({w_1}) @@0,$ <<- not morph(\2, ":A.*:[me]:[si]", False) ~1>> * ## Simplication des locutions verbales __[i](loc_arriver)__ (arriv\w+) (([aà]) (?:échéance|point nommé)) @@0,$,w |
5871 5872 5873 5874 5875 5876 5877 | 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 | - + | # !!!! Redondances dans la phrase __[i]/redon2(redondances_phrase)__ ({w_4})[ ,].* (\1) @@0,$ |
5926 5927 5928 5929 5930 5931 5932 | 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 | - + - + | <<- __also__ and hasMasForm(\2) -2>> =suggMasSing(@, True) # Accord de genre erroné : « \1 » est un déterminant masculin. <<- __else__ and morph(\2, ":[NAQ].*:p") -2>> =suggMasSing(@) # Accord de nombre erroné : « \2 » devrait être au singulier. <<- __also__ -1>> les # Accord de nombre erroné : « \2 » est au pluriel. __[i]/gn(gn_le_accord2)__ ({w_1}) +(le) +({w_2}) @@0,w,$ <<- morph(\2, ":D", False) >>> <<- morphex(\3, ":[NAQ].*:f", ":(?:e|m|P|G|W|[123][sp]|Y)") |
6017 6018 6019 6020 6021 6022 6023 | 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 | - + - + | <<- morphex(\2, ":[NAQ].*:m", ":(?:e|f|P|G|W|[1-3][sp]|Y)") -1>> le # Accord de genre erroné : « \2 » est masculin. <<- __also__ and hasFemForm(\2) -2>> =suggFemSing(@, True) # Accord de genre erroné : « \1 » est un déterminant féminin. <<- __else__ and morph(\2, ":[NAQ].*:p") -2>> =suggFemSing(@) # Accord de nombre erroné : « \2 » devrait être au singulier. __[i]/gn(gn_la_accord2)__ ({w_1}) +(la) +({w_2}) @@0,w,$ <<- morph(\2, ":D", False) >>> <<- morphex(\3, ":[NAQ].*:m", ":(?:e|f|P|G|W|[1-3][sp]|Y)") |
6127 6128 6129 6130 6131 6132 6133 | 6127 6128 6129 6130 6131 6132 6133 6134 6135 6136 6137 6138 6139 6140 6141 | - + | __<i]/gn(gn_leur_accord1)__ , +(leur) +({w_2}) @@w,$ <<- morph(\2, ":[NAQ].*:p") -1>> leurs # Accord de nombre erroné avec « \2 ». <<- __also__ -2>> =suggSing(@) # Accord de nombre erroné : « \2 » devrait être au singulier. __[i]/gn(gn_leur_accord2)__ ({w_1}) +(leur) +({w_2}) @@0,w,$ <<- morph(\3, ":[NAQ].*:p") |
6166 6167 6168 6169 6170 6171 6172 | 6166 6167 6168 6169 6170 6171 6172 6173 6174 6175 6176 6177 6178 6179 6180 | - + | <<- ( morph(\2, ":[NAQ].*:s") and not (after("^ +(?:et|ou) ") and morph(word(2), ":[NAQ]", True, False)) ) or \2 in aREGULARPLURAL -2>> =suggPlur(@) # Accord de nombre erroné : « \2 » devrait être au pluriel. __[i]/gn(gn_les_accord2)__ ({w_1}) +(les) +({w_2}) @@0,w,$ <<- morph(\2, ":D", False) >>> <<- ( morph(\3, ":[NAQ].*:s") |
6455 6456 6457 6458 6459 6460 6461 | 6455 6456 6457 6458 6459 6460 6461 6462 6463 6464 6465 6466 6467 6468 6469 | - + | TEST: {{Quels}} que soit la force appliquée. ->> Quel TEST: {{Quel}} que soit la force appliquée. ->> Quelle ## trouver ça/ceci/cela + adj __[i]/gn(gn_trouver_ça_adj)__ (trouv\w+) +(ça|ce(?:ci|la)) +({w_2}) @@0,w,$ |
6592 6593 6594 6595 6596 6597 6598 | 6592 6593 6594 6595 6596 6597 6598 6599 6600 6601 6602 6603 6604 6605 6606 6607 6608 6609 6610 | - + - + | and not apposition(\1, \2) and not before(r"\b(?:et|ou|d’) *$") -2>> =suggMasSing(@) # Accord de nombre erroné avec « \1 » : « \2 » devrait être au singulier. __[i]/gn(gn_2m_un_après_et_ou_de)__ (?:et +|ou +|d’)un +({w_2}) +({w_2}) @@w,$ <<- not \2.startswith("seul") and morphex(\1, ":[NAQ].*:[me]", ":(?:B|G|V0|f)") and morph(\2, ":[NAQ].*:f") and not apposition(\1, \2) |
6621 6622 6623 6624 6625 6626 6627 | 6621 6622 6623 6624 6625 6626 6627 6628 6629 6630 6631 6632 6633 6634 6635 6636 6637 6638 6639 | - + - + | and not apposition(\1, \2) and not before(r"\b(?:et|ou|d’) *$") -2>> =suggFemSing(@) # Accord de nombre erroné avec « \1 » : « \2 » devrait être au singulier. __[i]/gn(gn_2m_une_après_et_ou_de)__ (?:et +|ou +|d’)une +({w_2}) +({w_2}) @@w,$ <<- not \2.startswith("seul") and morphex(\1, ":[NAQ].*:[fe]", ":(?:B|G|V0|m)") and morph(\2, ":[NAQ].*:m") and not apposition(\1, \2) |
6653 6654 6655 6656 6657 6658 6659 | 6653 6654 6655 6656 6657 6658 6659 6660 6661 6662 6663 6664 6665 6666 6667 6668 6669 6670 6671 | - + - + | and not apposition(\2, \3) and not before(r"\b(?:et|ou|de) +$") -3>> =suggMasSing(@) # Accord de nombre erroné avec « \2 » : « \3 » devrait être au singulier. __[i]/gn(gn_2m_le_après_et_ou_de)__ (?:et|ou) +(le) +({w_2}) +({w_2}) @@w,w,$ <<- morph(\1, ":D", False) >>> <<- not \3.startswith("seul") and morphex(\2, ":[NAQ].*:[me]", ":(?:B|G|V0|f)") and morph(\3, ":[NAQ].*:f") |
6679 6680 6681 6682 6683 6684 6685 | 6679 6680 6681 6682 6683 6684 6685 6686 6687 6688 6689 6690 6691 6692 6693 6694 6695 6696 6697 6698 6699 6700 6701 6702 6703 6704 6705 6706 6707 6708 6709 6710 6711 6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 | - + - + - + - + | and morphex(\1, ":[NAQ].*:[si]", ":G") and morphex(\2, ":[NAQ].*:p", ":[GWsi]") and not apposition(\1, \2) and not before(r"\b(?:et|ou|de) +$") -2>> =suggMasSing(@) # Accord de nombre erroné avec « \1 » : « \2 » devrait être au singulier. __[i]/gn(gn_2m_det_mas_sing_après_et_ou_de)__ (?:et|ou|de) +(?:cet?|quel|au|ledit) +({w_2}) +({w_2}) @@w,$ <<- not \2.startswith("seul") and morphex(\1, ":[NAQ].*:[me]", ":(?:B|G|V0|f)") and morph(\2, ":[NAQ].*:f") |
6732 6733 6734 6735 6736 6737 6738 | 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 6753 6754 6755 6756 6757 6758 6759 6760 6761 6762 6763 6764 6765 6766 6767 6768 6769 6770 6771 6772 6773 6774 6775 | - + - + - + - + | and not apposition(\2, \3) and not before(r"\b(?:et|ou|de) +$") -3>> =suggFemSing(@) # Accord de nombre erroné avec « \2 » : « \3 » devrait être au singulier. __[i]/gn(gn_2m_la_après_et_ou_de)__ (?:et|ou|de) +(la) +({w_2}) +({w_2}) @@w,w,$ <<- morph(\1, ":D", False) >>> <<- \2 != "fois" and not \3.startswith("seul") and morphex(\2, ":[NAQ].*:[fe]", ":(?:B|G|V0|m)") and morph(\3, ":[NAQ].*:m") |
6787 6788 6789 6790 6791 6792 6793 | 6787 6788 6789 6790 6791 6792 6793 6794 6795 6796 6797 6798 6799 6800 6801 6802 6803 6804 6805 6806 | - + - + | -3>> =suggSing(@) # Accord de nombre erroné avec « \2 » : « \3 » devrait être au singulier. __[i]/gn(gn_2m_leur_après_et_ou_de)__ (?:et|ou|de) +(leur) +({w_2}) +({w_2}) @@w,w,$ <<- morph(\1, ":D", False) >>> <<- \2 != "fois" and not \3.startswith("seul") and ((morphex(\2, ":[NAQ].*:m", ":(?:B|e|G|V0|f)") and morph(\3, ":[NAQ].*:f")) or (morphex(\2, ":[NAQ].*:f", ":(?:B|e|G|V0|m)") and morph(\3, ":[NAQ].*:m"))) and not apposition(\2, \3) |
6817 6818 6819 6820 6821 6822 6823 | 6817 6818 6819 6820 6821 6822 6823 6824 6825 6826 6827 6828 6829 6830 6831 6832 6833 6834 6835 6836 | - + - + | and not apposition(\1, \2) and not before(r"\b(?:et|ou|de) +$") -2>> =suggSing(@) # Accord de nombre erroné avec « \1 » : « \2 » devrait être au singulier. __[i]/gn(gn_2m_det_epi_sing_après_et_ou_de)__ (?:et|ou|de) +(?:chaque|quelque|[nv]otre) +({w_2}) +({w_2}) @@w,$ <<- \1 != "fois" and not \2.startswith("seul") and not re.search("(?i)quelque chose", \0) and ((morphex(\1, ":[NAQ].*:m", ":(?:B|e|G|V0|f)") and morph(\2, ":[NAQ].*:f")) or (morphex(\1, ":[NAQ].*:f", ":(?:B|e|G|V0|m)") and morph(\2, ":[NAQ].*:m"))) and not apposition(\1, \2) |
6845 6846 6847 6848 6849 6850 6851 | 6845 6846 6847 6848 6849 6850 6851 6852 6853 6854 6855 6856 6857 6858 6859 | - + | and not before(r"(?i)\bune de ") -2>> =suggMasPlur(@) # Accord de nombre erroné avec « \1 » : « \2 » devrait être au pluriel. __[i]/gn(gn_2m_det_mas_plur_après_et_ou_de)__ (?:et|ou|de) +(?:certains|quels|lesdits) +({w_2}) +({w_2}) @@w,$ <<- not \2.startswith("seul") and morphex(\1, ":[NAQ].*:[me]", ":(?:B|G|V0|f)") and morph(\2, ":[NAQ].*:f") and not apposition(\1, \2) |
6875 6876 6877 6878 6879 6880 6881 | 6875 6876 6877 6878 6879 6880 6881 6882 6883 6884 6885 6886 6887 6888 6889 | - + | and not before(r"(?i)\bune de ") -2>> =suggFemPlur(@) # Accord de nombre erroné avec « \1 » : « \2 » devrait être au pluriel. __[i]/gn(gn_2m_det_fem_plur_après_et_ou_de)__ (?:et|ou|de) +(?:certaines|quelles|lesdites) +({w_2}) +({w_2}) @@w,$ <<- \1 != "fois" and not \2.startswith("seul") and morphex(\1, ":[NAQ].*:[fe]", ":(?:B|G|V0|m)") and morph(\2, ":[NAQ].*:m") and not apposition(\1, \2) |
6905 6906 6907 6908 6909 6910 6911 | 6905 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 | - + | -3>> =suggPlur(@) # Accord de nombre erroné avec « \2 » : « \3 » devrait être au pluriel. __[i]/gn(gn_2m_les_après_et_ou_de)__ (?:et|ou) +(les) +({w_2}) +({w_2}) @@w,w,$ <<- morph(\1, ":D", False) >>> <<- \2 != "fois" and not \3.startswith("seul") and ((morphex(\2, ":[NAQ].*:m", ":(?:B|e|G|V0|f)") and morph(\3, ":[NAQ].*:f")) or (morphex(\2, ":[NAQ].*:f", ":(?:B|e|G|V0|m)") and morph(\3, ":[NAQ].*:m"))) and not apposition(\2, \3) |
6935 6936 6937 6938 6939 6940 6941 | 6935 6936 6937 6938 6939 6940 6941 6942 6943 6944 6945 6946 6947 6948 6949 6950 6951 6952 6953 6954 6955 6956 6957 6958 6959 6960 6961 6962 6963 6964 6965 6966 6967 6968 6969 6970 6971 6972 6973 6974 6975 | - + - + - + | and not before(r"(?i)\bune? de ") -2>> =suggPlur(@) # Accord de nombre erroné avec « \1 » : « \2 » devrait être au pluriel. __[i]/gn(gn_2m_det_epi_plur_après_et_ou_de)__ (?:et|ou|de) +(?:[cmts]es|[nv]os|leurs|quelques|plusieurs|aux|moult) +({w_2}) +({w_2}) @@w,$ <<- \1 != "fois" and not \2.startswith("seul") and ((morphex(\1, ":[NAQ].*:m", ":(?:B|e|G|V0|f)") and morph(\2, ":[NAQ].*:f")) or (morphex(\1, ":[NAQ].*:f", ":(?:B|e|G|V0|m)") and morph(\2, ":[NAQ].*:m"))) and not apposition(\1, \2) |
7229 7230 7231 7232 7233 7234 7235 | 7229 7230 7231 7232 7233 7234 7235 7236 7237 7238 7239 7240 7241 7242 7243 7244 7245 7246 7247 7248 7249 7250 7251 7252 7253 7254 7255 7256 7257 7258 7259 7260 7261 7262 7263 7264 7265 7266 | - + - + - + | #### Locutions # à __[i]/sgpl(sgpl_à_nu)__ (m[eiî]\w+) +([aà] nu(?:es?|s)) @@0,$ |
7311 7312 7313 7314 7315 7316 7317 | 7311 7312 7313 7314 7315 7316 7317 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 | - + - + - + | TEST: Elles sont tellement {{collets montées}} ! # coûter cher __[i]/sgpl(sgpl_coûter_cher)__ ((?:co[uû]t|pa)\w+) +(chers|chères?|chaire?s?) @@0,$ |
7367 7368 7369 7370 7371 7372 7373 | 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 | - + | TEST: On va procéder par {{intervalle}} # pied __[i]/sgpl(sgpl_avoir_pied)__ ([aeop]\w*) +(?:pas |)(pieds) @@0,$ |
7463 7464 7465 7466 7467 7468 7469 | 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 | - + | # vacances __[i]/sgpl(sgpl_bonnes_vacances)__ bonne vacance <<- not morph(word(-1), ":D.*:f:s", False, False) ->> bonnes vacances # Au pluriel. __[i]/sgpl(sgpl_en_vacances)__ ({w1}) +en (vacance) @@0,$ |
7501 7502 7503 7504 7505 7506 7507 | 7501 7502 7503 7504 7505 7506 7507 7508 7509 7510 7511 7512 7513 7514 7515 7516 7517 7518 7519 7520 7521 7522 7523 | - + - + | !!!! Confusions !! !! # à / a __[i]/conf(conf_suite_à)__ suite (a) ({w1}) @@w,$ |
7548 7549 7550 7551 7552 7553 7554 | 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 7558 7559 7560 7561 7562 7563 7564 7565 7566 7567 7568 7569 7570 7571 7572 | - + - + | # Confusion probable : “âcre” est un adjectif signifiant “irritant”. Pour l’unité de surface agraire, écrivez :|https://fr.wiktionary.org/wiki/%C3%A2cre TEST: un terrain de 3 {{âcres}}. __[i]/conf(conf_âcre)__ acres? |
7582 7583 7584 7585 7586 7587 7588 | 7582 7583 7584 7585 7586 7587 7588 7589 7590 7591 7592 7593 7594 7595 7596 | - + | # acquis / acquit __[i]/conf(conf_par_acquit_de_conscience)__ par (acquis) de conscience @@4 <<- -1>> acquit # Confusion. On écrit « par acquit de conscience ». <<- ~>> * __[i]/conf(conf_tenir_pour_acquit)__ |
7606 7607 7608 7609 7610 7611 7612 | 7606 7607 7608 7609 7610 7611 7612 7613 7614 7615 7616 7617 7618 7619 7620 7621 7622 7623 | - + - + | TEST: il descendait l’{{allé}} # amende / amande __[i]/conf(conf_yeux_en_amande)__ yeux en (amendes?) @@$ <<- -1>> amande # Confusion. Une amende est une peine.|http://www.cnrtl.fr/lexicographie/amende __[i]/conf(conf_à_l_amende)__ |
7649 7650 7651 7652 7653 7654 7655 | 7649 7650 7651 7652 7653 7654 7655 7656 7657 7658 7659 7660 7661 7662 7663 | - + | __[i]/conf(conf_sous_les_auspices1)__ sous [ldc]es (hospices) @@$ <<- -1>> auspices # Confusion probable. L’hospice est un centre de soins.|https://fr.wiktionary.org/wiki/auspice __[i]/conf(conf_sous_les_auspices2)__ sous (?:les \w+|d’\w+|des? \w+) +(hospices) @@$ <<- -1>> auspices # Confusion probable. L’hospice est un centre de soins.|https://fr.wiktionary.org/wiki/auspice __[i]/conf(conf_hospice1)__ |
7696 7697 7698 7699 7700 7701 7702 | 7696 7697 7698 7699 7700 7701 7702 7703 7704 7705 7706 7707 7708 7709 7710 7711 7712 7713 7714 | - + - + | (bancs?) d[ue] mariage @@0 <<- -1>> ban|bans # Confusion : les bans de mariage sont des publications, pas du mobilier.|https://fr.wiktionary.org/wiki/ban __[i]/conf(conf_en_rupture_de_ban)__ en ruptures? de (bancs?) @@$ <<- -1>> ban # Confusion. Locution “en rupture de ban”.|https://fr.wiktionary.org/wiki/en_rupture_de_ban __[i]/conf(conf_mettre_au_ban)__ (m[eiî]\w+) au (banc) @@0,$ |
7780 7781 7782 7783 7784 7785 7786 | 7780 7781 7782 7783 7784 7785 7786 7787 7788 7789 7790 7791 7792 7793 7794 | - + | (?:alcool|coup|sucre|sirop)s? de (canes?) @@$ <<- -1>> canne # Confusion. La cane est la femelle du canard.|https://fr.wiktionary.org/wiki/cane __[i]/conf(conf_nom_de_cane)__ (?:œuf|filet)s? de (cannes?) @@$ <<- -1>> cane # Confusion. La canne est un bâton ou un roseau. Pour la femelle du canard, écrivez|https://fr.wiktionary.org/wiki/canne __[i]/conf(conf_verbe_canne)__ ((?:appu|batt|frapp|l[eè]v|march)\w+) (?:avec|sur) (?:[dl]es|[mts](?:a|es)|une) (canes?) @@0,$ |
7808 7809 7810 7811 7812 7813 7814 | 7808 7809 7810 7811 7812 7813 7814 7815 7816 7817 7818 7819 7820 7821 7822 | - + | TEST: aéroport de {{cannes}} TEST: restaurant à {{cane}} # chair / chère __[i]/conf(conf_faire_bonne_chère)__ (f[aioîe]\w+) +(bonnes? ch(?:ai|e)re?) @@0,$ |
7926 7927 7928 7929 7930 7931 7932 | 7926 7927 7928 7929 7930 7931 7932 7933 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 | - + - + - + - + | TEST: J’ai pris un {{cou}} de bâton. TEST: Merci de calculer le {{coup}} de production avant d’établir une facture. TEST: Elle a un {{coût}} si gracile. __[i]/conf(conf_tordre_le_cou)__ |
7980 7981 7982 7983 7984 7985 7986 | 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 | - + - + - + - + - + | TEST: {{dés}} que nous sommes partis, il a piqué une crise TEST: {{des}} {{les}} premiers symptômes, appelez-moi # desceller / déceler / desseller __[i]/conf(conf_erreur_problème_decelé)__ (erreur|faute|incohérence|problème|bug|bogue|faille|maladie|défaut|défaillance|perturbation|irrégularité)s? .*(des[cs]ell\w+) @@0,$ |
8095 8096 8097 8098 8099 8100 8101 | 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 | - + | # foi / fois __[i]/conf(conf_bonne_mauvaise_foi)__ (mauvaise|bonne) (fois) @@0,$ <<- not ( \1 == "bonne" and before(r"(?i)\bune +$") and after("(?i)^ +pour toute") ) -2>> foi # Confusion probable.|http://fr.wiktionary.org/wiki/foi __[i]/conf(conf_faire_perdre_donner_foi)__ ((?:f[aieî]|perd|donn|[ae])\w*) (fois) @@0,$ |
8249 8250 8251 8252 8253 8254 8255 | 8249 8250 8251 8252 8253 8254 8255 8256 8257 8258 8259 8260 8261 8262 8263 8264 8265 8266 8267 8268 8269 | - + - + - + | TEST: il ne {{l’a}} {{connaît}} pas. TEST: elle ne {{l’a}} leur donne pas sans condition. TEST: elle se {{l’a}} {{réserve}} pour elle-même. __[i]/conf(conf_il_elle_on_l_a)__ (?:il|elle|on) (?:vous |nous |)(la)[ @]+({w_2}) @@*,$ |
8282 8283 8284 8285 8286 8287 8288 | 8282 8283 8284 8285 8286 8287 8288 8289 8290 8291 8292 8293 8294 8295 8296 8297 8298 8299 8300 8301 8302 8303 8304 8305 8306 8307 8308 8309 8310 8311 8312 8313 8314 8315 8316 8317 8318 8319 | - + - + - + | TEST: {{levée}} de soleil # lever un lièvre / soulever __[i]/conf(conf_lever_un_lièvre)__ (soul\w+) +(?:un|le) lièvre @@0 |
8472 8473 8474 8475 8476 8477 8478 | 8472 8473 8474 8475 8476 8477 8478 8479 8480 8481 8482 8483 8484 8485 8486 8487 8488 8489 8490 8491 8492 8493 8494 8495 8496 8497 8498 8499 8500 8501 8502 8503 8504 8505 8506 8507 8508 8509 8510 8511 8512 8513 8514 8515 8516 8517 8518 8519 8520 8521 8522 8523 8524 8525 8526 8527 8528 8529 | - + - + - + - + - + - + | # pain / pin __[i]/conf(conf_pain_qqch)__ (pins?) (?:d’épices?|perdus?|sans glutens?) @@0 <<- -1>> =\1.replace("pin", "pain") # Confusion. Le pin est un arbre résineux à aiguilles persistantes. Pour parler la pâte de farine et d’eau cuite au four, écrivez : __[i]/conf(conf_manger_pain)__ ((?:mang|dévor|aval|englout)\w+) +(?:les?|d(?:u|es)|un|[mts](?:on|es)|leurs?|[nv]o(?:s|tre)) +(pins?) @@0,$ |
8664 8665 8666 8667 8668 8669 8670 | 8664 8665 8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 | - + | TEST: Elle y parviendra, {{quoiqu’il}} en coûte. # raisonner / résonner __[i]/conf(conf_raisonner)__ (?:la|les?|[mts]e|[nv]ous) (résonn\w+) @@$ |
8726 8727 8728 8729 8730 8731 8732 | 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 | - + - + | # sceptique / septique __[i]/conf(conf_qqch_septique)__ (?:fosse|installation|choc|chirurgie|maladie|plaie|blessure|embolie|arthrite|isolement|pneumo-entérite)s? (sceptiques?) @@$ <<- -1>> =\1.replace("scep","sep") # Confusion possible. Septique = corrompu, infecté. Sceptique = ayant des doutes. __[i]/conf(conf_être_sceptique)__ ({etre}|demeur\w+) +(septiques?) @@0,$ |
8760 8761 8762 8763 8764 8765 8766 | 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 | - + | (?<!’)en (soit) @@3 <<- morph(word(1), ":[GY]", True, True) and not before("(?i)quel(?:s|les?|) qu $|on $|il $") and not after(" soit ") -1>> soi # Confusion probable. __[i]/conf(conf_quel_que_soit2)__ quel(?:le|)s? que (soi(?:es?|)) @@$ <<- -1>> soit|soient # Confusion probable. __[i]/conf(conf_soi_même1)__ (soi[tes]s? mêmes?) @@$ |
8817 8818 8819 8820 8821 8822 8823 | 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827 8828 8829 8830 8831 8832 8833 8834 8835 8836 8837 8838 8839 8840 8841 8842 8843 8844 8845 8846 8847 8848 8849 8850 8851 8852 8853 8854 8855 8856 8857 8858 8859 8860 8861 8862 8863 8864 8865 8866 8867 8868 8869 | - + - + - + - + | TEST: Il est tellement {{sur}} de la trouver. TEST: ils sont en lieu {{sur}} et introuvables. # tâche / tache (de chocolat / rousseur / vin / sang / café / gras / graisse / huile / etc.) __[i]/conf(conf_tache_de_qqch)__ (tâches?) d(?:e +|’)({w_2}) @@0,$ |
8877 8878 8879 8880 8881 8882 8883 | 8877 8878 8879 8880 8881 8882 8883 8884 8885 8886 8887 8888 8889 8890 8891 | - + | # tort / tord __[i]/conf(conf_à_tort)__ à (tor[de]?s?) @@2 <<- -1>> tort # Confusion : “tord” est une conjugaison du verbe tordre. __[i]/conf(conf_avoir_tort)__ ({avoir}|donn\w+) +(tor[ed]?s?) @@0,$ |
9046 9047 9048 9049 9050 9051 9052 | 9046 9047 9048 9049 9050 9051 9052 9053 9054 9055 9056 9057 9058 9059 9060 | - + | TEST: des {{parisiens}} en vacances # les langues __[s]/maj(maj_langues)__ ((?:parl|cours|leçon|appr|étud|tradu|enseign|professeur|enseignant|dictionnaire|méthode)\w*) (?:le |d[eu] |l’|d’|qu |)(Afrikaans|Albanais|Allemand|Alsacien|Anglais|Arabe|Aragonais|Arménien|Asturien|Basque|Bengali|Biélorusse|Birman|Bosniaque|Breton|Bulgare|Cantonais|Catalan|Cherokee|Chinois|Corse|Cornique|Coréen|Croate|Danois|Écossais|Espagnol|Espéranto|Estonien|Féroïen|Farsi|Finnois|Flamand|Français|Frison|Galicien|Gallois|Gaulois|Géorgien|Grec|Gujarati|Hakka|Hawaïen|Hébreu|Hindi|Hollandais|Hongrois|Javanais|Ido|Indonésien|Interlingua|Islandais|Italien|Irlandais|Japonais|Kazakh|Khmer|Kurde|Ladino|Laotien|Latin|Ligurien|Limbourgeois|Lituanien|Lombard|Luxembourgeois|Macédonien|Malais|Maldivien|Malgache|Maltais|Mandarin|Maori|Marathi|Marwari|Moldave|Mongol|Napolitain|Néerlandais|Norvégien|Occitan|Ourdou|Ouzbek|Persan|Peul|Piémontais|Polonais|Portugais|Provençal|Quichua|Romanche|Roumain|Russe|Sans[ck]rit|Sarde|Serbe|Sicilien|Sindhi|Slovaque|Slovène|Soudanais|Sorabe|Suédois|Swahili|Tagalog|Tahitien|Tamoul|Tatar|Tchèque|Thaï|Turc|Ukrainien|Vénitien|Vietnamien|Volapük|Wallon|Wo?u|Yiddish|Xhosa|Xiang|Zoulou) @@0,$ |
9185 9186 9187 9188 9189 9190 9191 | 9185 9186 9187 9188 9189 9190 9191 9192 9193 9194 9195 9196 9197 9198 9199 | - + | <<- morphex(\1, ":V", ":[123][sp]") -1>> _ # Le verbe ne devrait pas être un participe passé. TEST: y {{mangée}} était un supplice __[i]/infi(infi_pour)__ pour ({w_2}(?:ée?s?|ez)) @@5 |
9217 9218 9219 9220 9221 9222 9223 | 9217 9218 9219 9220 9221 9222 9223 9224 9225 9226 9227 9228 9229 9230 9231 9232 9233 9234 9235 9236 9237 9238 9239 9240 9241 9242 9243 9244 9245 9246 9247 9248 9249 9250 9251 9252 9253 9254 9255 9256 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 9276 9277 9278 9279 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 | - + - + - + - + - + - + - + | TEST: Nous {{intéressé}} à la question ne suffit pas à faire de nous des experts. TEST: nous {{ridiculisé}} TEST: vous {{mangé}} __[i]/infi(infi_devoir_savoir_pouvoir_interrogatif)__ (d[eouû]\w+|s[auû]\w+|p[eouû]\w+|v[eo]u\w+)-(?:ils?|elles?|on|je|tu|nous|vous) +(?:pas +|)(?:[mts](?:e +|’)|lui +|[nv]ous +|)({w_2}) @@0,$ |
9318 9319 9320 9321 9322 9323 9324 | 9318 9319 9320 9321 9322 9323 9324 9325 9326 9327 9328 9329 9330 9331 9332 9333 9334 9335 9336 9337 9338 9339 9340 9341 9342 9343 9344 9345 9346 9347 9348 9349 9350 9351 9352 9353 | - + - + | ({w1}) (pas|point|rien|bien|ensemble) @@0,$ <<- morph(\1, ":V", False) ~2>> * __[i](p_pas_point_rien_bien_ensemble2)__ \w+-(?:je|tu|ils?|elles?|on|[nv]ous) (pas|point|rien|bien|ensemble) @@$ <<- ~1>> * # sembler le croire/penser/présumer/supposer/envisager/imaginer __[i](p_que_semble_le_penser)__ que +(sembl\w+) +(l(?:e (?:penser|croire|présumer|supposer)|’(?:envisager|imaginer))) @@w,$ |
9393 9394 9395 9396 9397 9398 9399 | 9393 9394 9395 9396 9397 9398 9399 9400 9401 9402 9403 9404 9405 9406 9407 | - + | <<- morphex(\1, ":[NAQ]", ":G") and isEndOfNG() ~>> * ## doute que __[i](p_nul_doute_que)__ nul doute qu <<- isStart() ~>> * __[i](p_douter_que)__ |
9437 9438 9439 9440 9441 9442 9443 | 9437 9438 9439 9440 9441 9442 9443 9444 9445 9446 9447 9448 9449 9450 9451 | - + | -2>> =suggVerbPpas(\2, ":m:s") # Erreur de numérisation ? <<- __else__ and \2.endswith("s") and morphex(\2, ":V1.*:Ip.*:2s", ":(?:[GM]|A)") and not before(r"(?i)\belles +(?:ne +|n’|)$") -2>> =suggVerbPpas(\2, ":m:p") # Erreur de numérisation ? __[i]/ocr(ocr_avoir_participes_passés)__ ({avoir}) +({w_2}es?) @@0,$ <<- morph(\1, ":V0a", False) >>> |
9516 9517 9518 9519 9520 9521 9522 | 9516 9517 9518 9519 9520 9521 9522 9523 9524 9525 9526 9527 9528 9529 9530 9531 9532 9533 9534 9535 9536 9537 9538 9539 9540 9541 | - + - + | TEST: {{s’en}} est assez de ces foutaises. TEST: c’est tellement idiot, {{s’en}} est dérisoire… ## soit / soie / soi __[i]/conf(conf_aller_de_soi)__ ({aller}) +de (soi[tes]) @@0,$ |
9594 9595 9596 9597 9598 9599 9600 | 9594 9595 9596 9597 9598 9599 9600 9601 9602 9603 9604 9605 9606 9607 9608 9609 9610 9611 9612 9613 9614 9615 9616 9617 9618 9619 9620 9621 9622 9623 9624 9625 9626 9627 9628 9629 9630 9631 9632 9633 9634 9635 9636 9637 9638 9639 9640 9641 | - + - + - + | <<- ~>> * TEST: de me le {{facturez}} __[i]/infi(infi_faire_vouloir)__ ((?:fai|f[iî]|fer|fon|v[oe]u)\w+) +({w_2}(?:ée?s?|ez)) @@0,$ |
9665 9666 9667 9668 9669 9670 9671 | 9665 9666 9667 9668 9669 9670 9671 9672 9673 9674 9675 9676 9677 9678 9679 9680 9681 9682 9683 9684 9685 9686 9687 9688 9689 9690 9691 9692 9693 9694 9695 9696 9697 9698 9699 9700 9701 9702 | - + - + - + - + - + | !! !!!! Usage pronominal avec “avoir” au lieu d’“être” !! !! __[i]/conj(conj_se_conf_être_avoir)__ (s’)(?:en +|y+ |)({avoir}) @@0,$ |
9727 9728 9729 9730 9731 9732 9733 | 9727 9728 9729 9730 9731 9732 9733 9734 9735 9736 9737 9738 9739 9740 9741 9742 9743 9744 9745 9746 9747 9748 9749 9750 9751 9752 9753 9754 9755 9756 9757 9758 9759 9760 9761 9762 9763 9764 9765 9766 9767 9768 9769 9770 9771 9772 9773 9774 9775 9776 9777 9778 9779 9780 9781 9782 9783 9784 | - + - + - + - + - + - + | TEST: tu t’es finalement {{retrouvés}} en mauvaise posture. TEST: tu ne t’étais pas laissé le temps d’y réfléchir. __[i]/ppas(ppas_il_se_être_verbe)__ il +(?:ne +|)s(?:e +|’(?:y +|))(?:est?|soi[st]|étai[st]|fu(?:sses?|s|t)|serai?[st]?) +({w_3}) @@$ |
9800 9801 9802 9803 9804 9805 9806 | 9800 9801 9802 9803 9804 9805 9806 9807 9808 9809 9810 9811 9812 9813 9814 9815 9816 9817 9818 9819 9820 9821 9822 9823 9824 9825 9826 9827 9828 9829 9830 9831 9832 9833 9834 9835 9836 9837 9838 9839 9840 9841 9842 9843 9844 9845 9846 9847 9848 9849 9850 9851 9852 9853 9854 9855 9856 9857 9858 9859 9860 9861 9862 9863 9864 9865 9866 9867 9868 9869 9870 9871 9872 9873 9874 9875 9876 9877 9878 9879 9880 9881 9882 9883 9884 9885 9886 9887 9888 9889 9890 9891 9892 9893 9894 9895 9896 9897 9898 9899 9900 9901 9902 9903 9904 9905 9906 9907 9908 9909 9910 9911 9912 9913 9914 9915 9916 9917 9918 9919 9920 9921 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9933 9934 9935 9936 9937 9938 9939 9940 9941 9942 9943 9944 9945 9946 9947 9948 9949 9950 9951 9952 9953 9954 9955 9956 9957 9958 9959 9960 9961 9962 9963 9964 9965 9966 9967 9968 9969 9970 9971 9972 9973 9974 9975 9976 9977 9978 9979 9980 9981 9982 9983 9984 9985 9986 | - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + | !! !!!! Participes passés: se +laisser +adjectif !! !! __[i]/ppas(ppas_me_te_laisser_adj)__ ([mt]e|l[ae]) +(laiss\w*) +({w_3}) @@0,w,$ |
10016 10017 10018 10019 10020 10021 10022 | 10016 10017 10018 10019 10020 10021 10022 10023 10024 10025 10026 10027 10028 10029 10030 10031 10032 10033 10034 10035 10036 10037 10038 10039 10040 10041 10042 10043 10044 10045 10046 10047 10048 10049 10050 10051 10052 10053 10054 10055 10056 10057 10058 10059 10060 10061 10062 10063 10064 10065 10066 10067 10068 10069 10070 10071 10072 10073 10074 10075 10076 10077 10078 10079 10080 10081 10082 10083 10084 10085 10086 10087 10088 10089 10090 10091 10092 10093 10094 10095 10096 10097 10098 10099 10100 10101 10102 10103 10104 10105 10106 10107 10108 10109 10110 10111 10112 10113 10114 10115 10116 10117 10118 | - + - + - + - + - + - + - + - + - + | !! __[i](p_risque_d_être)__ risqu\w+ +(d’)être @@* <<- ~1>> * __[i]/ppas(ppas_je_verbe_être)__ j(?:e|’(?:y|en)) +(?:ne +|n’|)((?:p[aeouûr]|s(?:embl|ouhait)|cr[ouû]|d[eouûéiî]|estim|i(?:magin|r)|v(?:[eo]u|a)|a(?:ffirm|im|dor|ll)|risqu)\w*) +(?:être|avoir été) +({w_2}) @@w,$ |
10194 10195 10196 10197 10198 10199 10200 | 10194 10195 10196 10197 10198 10199 10200 10201 10202 10203 10204 10205 10206 10207 10208 10209 10210 10211 10212 10213 10214 10215 10216 10217 10218 10219 10220 10221 10222 10223 10224 10225 10226 10227 10228 | - + - + - + | -1>> =suggMasSing(@) # Si cet adjectif se réfère au pronom « il », l’adjectif devrait être au masculin singulier. TEST: — {{Déçue}}, il s’en est allé. __[i]/ppas(ppas_adj_accord_elle)__ ^ *({w_2}[éuitsx]),? elle @@* |
10247 10248 10249 10250 10251 10252 10253 | 10247 10248 10249 10250 10251 10252 10253 10254 10255 10256 10257 10258 10259 10260 10261 10262 10263 10264 10265 10266 10267 10268 10269 10270 10271 10272 10273 10274 10275 10276 10277 | - + - + - + - + | -1>> =suggSing(@) # Accord avec le sujet « je » : « \1 » devrait être au singulier. __[i]/ppas(ppas_inversion_être_tu)__ (?:es|étais|fus(?:ses|)|serai?s)-tu +({w_2}) @@$ <<- morphex(\1, ":(?:[123][sp]|Y|[NAQ].*:p)", ":[GWsi]") -1>> =suggSing(@) # Accord avec le sujet « tu » : « \1 » devrait être au singulier. __[i]/ppas(ppas_inversion_être_il_ce)__ (?:est|était|f[uû]t|sera(?:-t|it))-(il|ce) +({w_2}) @@*,$ |
10310 10311 10312 10313 10314 10315 10316 | 10310 10311 10312 10313 10314 10315 10316 10317 10318 10319 10320 10321 10322 10323 10324 10325 10326 10327 10328 10329 10330 10331 10332 10333 10334 10335 10336 10337 10338 10339 10340 10341 10342 10343 10344 10345 10346 10347 10348 10349 10350 10351 10352 10353 10354 10355 10356 10357 10358 10359 10360 10361 10362 10363 10364 10365 10366 10367 10368 10369 10370 10371 10372 10373 10374 10375 10376 10377 10378 10379 10380 10381 10382 10383 10384 10385 10386 10387 10388 10389 10390 10391 10392 10393 10394 10395 10396 10397 10398 10399 10400 10401 10402 10403 10404 10405 10406 10407 10408 10409 10410 10411 10412 10413 10414 10415 10416 10417 10418 10419 10420 10421 10422 10423 10424 10425 10426 10427 10428 10429 10430 10431 10432 10433 10434 | - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + | !! !!!! Se croire/considérer/montrer/penser/révéler/savoir/sentir/voir/vouloir + participe passé/adj !! !! __[i]/ppas(ppas_je_me_verbe)__ je +(?:ne +|)me +((?:s[eauû]|montr|pens|rév|v[oiîe])\w+) +({w_2}) @@w,$ |
10456 10457 10458 10459 10460 10461 10462 | 10456 10457 10458 10459 10460 10461 10462 10463 10464 10465 10466 10467 10468 10469 10470 10471 10472 10473 10474 10475 10476 10477 10478 10479 10480 10481 10482 10483 10484 10485 10486 10487 10488 10489 10490 10491 10492 10493 10494 10495 10496 10497 10498 10499 10500 10501 10502 | - + - + - + - + | !! !! #__[i]/conj__ fait(s|e|es) ({w1}) <<- morph(\2, ":V") and not morph(\2, ":Y") # ->> fait \1 # Le participe passé de faire reste au masculin singulier s’il est suivi par un verbe à l’infinitif. __[i](p_les_avoir_fait_vinfi)__ |
10539 10540 10541 10542 10543 10544 10545 | 10539 10540 10541 10542 10543 10544 10545 10546 10547 10548 10549 10550 10551 10552 10553 | - + | # Accord avec « \1’ ». Le participe passé « \3 » devrait être au singulier (et accordé en genre).|http://fr.wikipedia.org/wiki/Accord_du_participe_pass%C3%A9_en_fran%C3%A7ais TEST: ces livres m’avaient {{ennuyés}} au-delà du dicible. __[i]/ppas(ppas_qui_avoir)__ qui +(?:n’|l(?:ui|eur) |ne l(?:ui|eur) |ne +|)({avoir}) +({w_2}[es]) @@w,$ |
10587 10588 10589 10590 10591 10592 10593 | 10587 10588 10589 10590 10591 10592 10593 10594 10595 10596 10597 10598 10599 10600 10601 | - + | TEST: Le maire a {{créée}} un risque. TEST: nous avions quelque peu {{tempérés}} leurs ardeurs ## avoir avec participe passé __[i]/ppas(ppas_m_t_l_avoir)__ [lmt]’(?:en +|y +|)({avoir}) +({w_3}) @@2,$ |
10830 10831 10832 10833 10834 10835 10836 | 10830 10831 10832 10833 10834 10835 10836 10837 10838 10839 10840 10841 10842 10843 10844 10845 10846 10847 10848 10849 10850 10851 10852 10853 10854 10855 10856 10857 10858 10859 10860 10861 10862 10863 10864 | - + - + - + | __<i](p_premier_ne_pro_per_obj1)__ ^( *ne l(?:es?|a) l(?:ui|eur)) ({w_2}) @@0,$ <<- morph(\2, ":(?:[123][sp]|P)", False) =>> select(\2,":(?:[123][sp]|P)") <<- ~1>> * __<i](p_premier_ne_pro_per_obj2)__ ^( *ne (?:[mt]’|l(?:ui|eur) )en) ({w_2}) @@0,$ <<- morph(\2, ":(?:[123][sp]|P)", False) =>> select(\2,":(?:[123][sp]|P)") |
11042 11043 11044 11045 11046 11047 11048 | 11042 11043 11044 11045 11046 11047 11048 11049 11050 11051 11052 11053 11054 11055 11056 11057 11058 11059 11060 11061 11062 11063 11064 11065 11066 11067 11068 | - + - + | TEST: « C’est ainsi », résume la cyptologue (erreur orthographique délibérée sur “cyptologue” pour empêcher certains faux positifs) TEST: Notez le peu de cas qui en est fait en général dans les médias TEST: deux fois par an, souligne le Dr Assouline __[i]/imp(imp_laisser_le_la_les_infi)__ ((laiss\w+) l(?:es|a)) +({w_2}) @@0,0,$ |
11238 11239 11240 11241 11242 11243 11244 | 11238 11239 11240 11241 11242 11243 11244 11245 11246 11247 11248 11249 11250 11251 11252 | - + | __[i](p_pro_per_obj29)__ (t’(?:en|y)) {1,3}({w_2}) @@0,$ <<- morph(\2, ":(?:[123][sp]|P|Y)", False) =>> select(\2, ":(?:[123][sp]|P|Y)") <<- not morph(\2, ":2s", False) or before(r"(?i)\b(?:je|tu|on|ils?|elles?|nous) +$") ~1>> * __[i](p_pro_per_obj30)__ (t’)({w_2}) @@0,$ <<- morph(\2, ":(?:[123][sp]|P|Y)", False) =>> select(\2, ":(?:[123][sp]|P|Y)") |
11308 11309 11310 11311 11312 11313 11314 | 11308 11309 11310 11311 11312 11313 11314 11315 11316 11317 11318 11319 11320 11321 11322 11323 11324 11325 11326 11327 11328 11329 11330 11331 11332 11333 11334 | - + - + | TEST: Aller chercher l’air pur à la campagne est peine perdue. #### CONFUSION veillez/veuillez __[i]/conf(conf_veillez2)__ (veuillez) +à +(ne|{infi}) @@0,$ |
11362 11363 11364 11365 11366 11367 11368 | 11362 11363 11364 11365 11366 11367 11368 11369 11370 11371 11372 11373 11374 11375 11376 11377 11378 11379 11380 11381 11382 11383 11384 11385 11386 11387 11388 11389 11390 11391 11392 11393 11394 11395 11396 11397 11398 11399 11400 11401 11402 11403 11404 11405 11406 11407 11408 11409 11410 11411 11412 11413 11414 11415 11416 11417 11418 11419 11420 11421 11422 11423 11424 | - + - + - + - + | TEST: Nous étions en train de {{trouvé}} une solution à ces soucis récurrents. TEST: en train de {{demandées}} TEST: en train de {{mangez}} __[i]/infi(infi_verbe)__ ((?:aim|all|v|ir|désir|esp[éè]r|p(?:[eou]|réf[éè]r))\w*) +({w_2}(?:ée?s?|ez)) @@0,$ |
11448 11449 11450 11451 11452 11453 11454 | 11448 11449 11450 11451 11452 11453 11454 11455 11456 11457 11458 11459 11460 11461 11462 | - + | !!!! Conjugaison !! !! ## 1sg __[i]/conj(conj_j)__ j’({w_1}) @@2 |
11558 11559 11560 11561 11562 11563 11564 | 11558 11559 11560 11561 11562 11563 11564 11565 11566 11567 11568 11569 11570 11571 11572 | - + | TEST: Ce qui, la plupart du temps, {{donnes}} des maux de tête. TEST: Ce qui {{fâchent}} mes amis. TEST: celui qui {{pensent}} mal de toute chose __[i]/conj(conj_ça)__ (ça|chacune?|l’une?|ce(?:ci|la|lui-(?:ci|là)|lle-(?:ci|là))|n`importe quo?i|quelqu(?:’une?|e chose)) +(?:qui +|)({w_1}) @@0,$ |
11862 11863 11864 11865 11866 11867 11868 | 11862 11863 11864 11865 11866 11867 11868 11869 11870 11871 11872 11873 11874 11875 11876 | - + | TEST: Or parmi celles-ci on trouve typiquement d’un côté les structures # L’accord par syllepse est obligatoire après /la plupart/, ainsi qu’après /nombre/ et /quantité/ employés sans déterminant. L’accord se fait avec le « pseudo-complément ». __[i]/conj(conj_beaucoup_d_aucuns_la_plupart)__ (beaucoup|d’aucuns|la plupart) +({w_2}) @@0,$ |
11980 11981 11982 11983 11984 11985 11986 | 11980 11981 11982 11983 11984 11985 11986 11987 11988 11989 11990 11991 11992 11993 11994 | - + | TEST: certaines femmes {{danse}} beaucoup TEST: Sauf que l’un comme l’autre avaient dû y renoncer. TEST: L’un comme l’autre devaient y renoncer. __[i]/conj(conj_des_nom1)__ ^ *des +({w_2}) +({w_2}) @@w,$ |
12167 12168 12169 12170 12171 12172 12173 | 12167 12168 12169 12170 12171 12172 12173 12174 12175 12176 12177 12178 12179 12180 12181 12182 12183 12184 12185 12186 12187 12188 12189 12190 12191 12192 12193 | - + - + | ->> \1-je # Forme interrogative ? Mettez un trait d’union. __[i]/inte(inte_union_tu)__ ({w_1}s) tu @@0 <<- morphex(\1, ":V.*:2s", ":[GNW]") and not before(r"(?i)\b(?:je|tu) +$") and morphex(word(1), ":", ":2s", True) ->> \1-tu # Forme interrogative ? Mettez un trait d’union. __[i]/inte(inte_union_il_on)__ ({w_2}[td]) (?:il|on) @@0 |
12251 12252 12253 12254 12255 12256 12257 | 12251 12252 12253 12254 12255 12256 12257 12258 12259 12260 12261 12262 12263 12264 12265 12266 12267 12268 12269 12270 12271 12272 12273 12274 | - + - + | TEST: Était-ce des femmes de ce pays ? TEST: Eh ! dit Athos, ne sont-ce pas des braconniers qu’on arrête là-bas ? __[i]/inte(inte_nous)__ ({w1})-nous @@0 <<- morphex(\1, ":V", ":(?:1p|E:2[sp])") -1>> =suggVerb(@, ":1p") # Forme interrogative ou impérative incorrecte. |
12283 12284 12285 12286 12287 12288 12289 | 12283 12284 12285 12286 12287 12288 12289 12290 12291 12292 12293 12294 12295 12296 12297 12298 12299 12300 12301 12302 12303 12304 12305 12306 12307 12308 12309 12310 12311 12312 12313 12314 12315 12316 12317 12318 12319 12320 12321 | - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + | !!!! Verbe auxiliaire __[i]/conf(conf_avoir_sujet_participe_passé)__ ({avoir})-(?:je|tu|ils?|elles?|on) +({ppas}) @@0,$ |
12439 12440 12441 12442 12443 12444 12445 12446 12447 12448 12449 12450 12451 12452 | 12367 12368 12369 12370 12371 12372 12373 12374 12375 12376 12377 12378 12379 12380 12381 12382 12383 12384 12385 12386 | + + + + + + | (?:quand|lorsque?) ({w_2}) +({w_2}) @@w,$ <<- morph(\1, ":(?:Os|M)", False) and (morphex(\2, ":V.*:S", ":[GI]") or morph(\2, ":V0e.*:S", False)) -2>> =suggVerbMode(@, ":I", \1) # Après « quand » ou « lorsque », le verbe ne s’emploie pas au subjonctif mais à l’indicatif. TEST: quand elle {{rencontrât}} son créateur TEST: lorsqu’il y {{eût}} du grabuge, nous montâmes tous sur le pont. @@@@GRAPH: last_graph@@@@ @@@@GRAPH: test@@@@ !! !! !! !! |
16512 16513 16514 16515 16516 16517 16518 | 16446 16447 16448 16449 16450 16451 16452 16453 16454 16455 16456 16457 16458 16459 16460 | - - | TEST: Éliante, cousine de Célimène, TEST: Arsinoé, amie de Célimène, TEST: Acaste, TEST: Clitandre, marquis TEST: Basque, valet de Célimène, TEST: Un garde de la maréchaussée de France, TEST: Dubois, valet d’Alceste. |
Added gc_lang/fr/rules_graph.grx version [194981e3b2].
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 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 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 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | # # RÈGLES DE GRAMMAIRE FRANÇAISE POUR GRAMMALECTE # par Olivier R. # # Copyright © 2011-2017. # # This file is part of Grammalecte. # # Grammalecte is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Grammalecte is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Grammalecte. If not, see <http://www.gnu.org/licenses/> # # RÈGLES POUR LE GRAPHE DE TOKENS # DOCUMENTATION # Expressions régulières en Python : http://docs.python.org/library/re.html # [++] : séparateur des règles pour le paragraphe et des règles pour la phrase. # Types d’action: # ->> erreur # ~>> préprocesseur de texte # =>> désambiguïsateur # Fin d’interprétation du fichier avec une ligne commençant par #END # ERREURS COURANTES # http://fr.wikipedia.org/wiki/Wikip%C3%A9dia:Fautes_d%27orthographe/Courantes GRAPH_NAME: test __code_legacy__ legacy code code legacy <<- -1:2>> code hérité|code reliquat|\1-\2|\2-\1 # \1 \2. Anglicisme superflu. TEST: c’est du {{legacy code}}. TEST: ce {{code legacy}} est un cauchemar __être_en_xxxx__ [>être|>rester|>demeurer] an [désaccord|accord] <<- -2>> en # Confusion. Un an = une année. TEST: Je suis {{an}} désaccord avec lui. __faire_plaisir__ >faire plaisirs <<- -2>> plaisir # Faire plaisir : dans cette locution, “plaisir” doit être au singulier. <<- ~2>> * TEST: Ça me fait {{plaisirs}}. __test__ je ~co[mn]putes? [que|qu’] @(?::Os|:M)¬:X @:I <<- morph(\4, ":Os|:M", ":X") -5>> \1|\5 # SUBJONCTIF. TEST: je conpute que Isabelle {{est}} partie. GRAPH_NAME: last_graph !! !! !!!! Modes verbaux !! !! # conditionnel / futur __vmode_j_aimerais_vinfi__ [<start>|,] [je|j’|Je|J’] [aimerai|préférerai|préfèrerai|apprécierai|voudrai|souhaiterai|désirerai|adorerai] @:[YX]|>(?:y|ne|que?)/¬:R <<- /vmode/ -3>> \1s # Si vous exprimez un souhait, utilisez le conditionnel et non le futur. TEST: J’{{aimerai}} savoir ce dont il retourne. TEST: dans tous les cas j’{{aimerai}} ne rien savoir TEST: Je {{voudrai}} qu’il soit déjà là. TEST: J’aimerai ces cours-là autant que les autres. TEST: J’aimerai la danse et la musique, puisque vous l’exigez. TEST: Je sais que j’aimerai ça, tout comme lui. __vmode_j_aurais_aimé_que_vinfi__ [j’|J’] aurai [aimé|souhaité|préféré|voulu|apprécié|désiré|adoré] [que|qu’|qu|ne|n’|@:Y] <<- /vmode/ -2>> aurais|eusse # Pour un souhait passé, utilisez le conditionnel passé et non le futur antérieur. Exemple pour le futur antérieur : « quand j’aurai fini… » TEST: J’{{aurai}} aimé nous offrir ce magnifique cadeau. TEST: j’{{aurai}} voulu être un artiste. TEST: j’{{aurai}} préféré ne pas avoir à l’entendre. TEST: j’{{aurai}} préféré l’entendre un autre jour. TEST: j’{{aurai}} aimé que vous m’en parliez. TEST: Quand j’en aurai fini avec eux, vous aurez du mal à les reconnaître. TEST: Quand j’aurai fini ce boulot, je ne sais pas ce que je ferai. TEST: Quand j’aurai soif et faim, je m’arrêterai. # Si suivi du conditionnel ou du subjonctif __vmode_si_sujet__ [<start>|,] >si [j’|J’|t’|T’] @:[SK]¬:(?:G|V0|I) [<start>|,] >si @:(?:Os|M) @:[SK]¬:(?:G|V0|I) [<start>|,] [s’|S’] [il|ils] @:[SK]¬:(?:G|V0|I) <<- /vmode/ -4>> _ # Ce verbe ne devrait être ni au conditionnel, ni au subjonctif. TEST: Si Pierre {{avancerait}} sa voiture de quelques mètres, ça nous permettrait de passer. TEST: s’ils ne {{mangeraient}} pas tous les jours, ils seraient moins gros. TEST: Si j’{{irais}} le faire # Dès que + indicatif __vmode_dès_que__ [dès|Dès] [que|qu’|qu] @:(?:Os|M) @:S¬:[IG] <<- /vmode/ -4>> =suggVerbMode(\4, ":I", \3) # Ce verbe ne devrait pas être au subjonctif. # <<- morph(\1, ":(?:Os|M)", False) and morph(\2, ":K", False) -2>> =suggVerbMode(@, ":If", \1) # Ce verbe ne devrait pas être au conditionnel. #TEST: dès que je le {{verrais}} 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] >douter [que|qu’|qu] @:(?:Os|M) @:I¬:(?:[GYSK]|If) <<- -4>> =suggVerbMode(\4, ":S", \3) # Après « \1 que », ce verbe devrait être au subjonctif. TEST: Il suffit qu’il {{court}} plus TEST: Je veux qu’il {{finit}} son repas. TEST: quoi qu’il en {{conclut}} TEST: Je ne veux pas que tu {{es}} des ennuis TEST: Avant que tu {{pars}}, je voudrais qu’on discute. TEST: Nul doute qu’elle nourrira à brève échéance la haine de demain à notre égard. TEST: Je ne doute pas qu’ils réussiront leur mission. TEST: Je me doutais bien qu’Apple pourrait marcher TEST: il ne fait aucun doute qu’Amazon le sait. TEST: quoi que nous autres hommes ayons pu faire |
Modified graphspell-js/ibdawg.js from [241ce099fe] to [068f06a16d].
510 511 512 513 514 515 516 | 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 | - + | let sStem = ">" + this.funcStemming(sWord, this.lArcVal[nArc]); // Now , we go to the next node and retrieve all following arcs values, all of them are tags let iAddr2 = this._convBytesToInteger(this.byDic.slice(iEndArcAddr, iEndArcAddr+this.nBytesNodeAddress)); let nRawArc2 = 0; while (!(nRawArc2 & this._lastArcMask)) { let iEndArcAddr2 = iAddr2 + this.nBytesArc; nRawArc2 = this._convBytesToInteger(this.byDic.slice(iAddr2, iEndArcAddr2)); |
Modified graphspell-js/spellchecker.js from [3df103d578] to [5b9ccbbb56].
39 40 41 42 43 44 45 46 47 48 49 50 51 52 | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | + + + + | this.oExtendedDic = this._loadDictionary(extentedDic, sPath); this.oCommunityDic = this._loadDictionary(communityDic, sPath); this.oPersonalDic = this._loadDictionary(personalDic, sPath); this.bExtendedDic = Boolean(this.oExtendedDic); this.bCommunityDic = Boolean(this.oCommunityDic); this.bPersonalDic = Boolean(this.oPersonalDic); this.oTokenizer = null; // storage this.bStorage = false; this._dMorphologies = new Map(); // key: flexion, value: list of morphologies this._dLemmas = new Map(); // key: flexion, value: list of lemmas } _loadDictionary (dictionary, sPath="", bNecessary=false) { // returns an IBDAWG object if (!dictionary) { return null; } |
130 131 132 133 134 135 136 137 138 139 140 141 142 143 | 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 | + + + + + + + + + + + + + + + + | this.bCommunityDic = false; } deactivatePersonalDictionary () { this.bPersonalDic = false; } // Storage activateStorage () { this.bStorage = true; } deactivateStorage () { this.bStorage = false; } clearStorage () { this._dLemmas.clear(); this._dMorphologies.clear(); } // parse text functions parseParagraph (sText) { if (!this.oTokenizer) { this.loadTokenizer(); } |
201 202 203 204 205 206 207 | 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 252 253 254 255 256 257 258 259 260 261 262 263 264 | + + + - + - + - + - + + + + + + - + + + + + + + + + + + + | return true; } return false; } getMorph (sWord) { // retrieves morphologies list, different casing allowed if (this.bStorage && this._dMorphologies.has(sWord)) { return this._dMorphologies.get(sWord); } |
Modified graphspell-js/tokenizer.js from [bdd895b918] to [9bd60cca8a].
14 15 16 17 18 19 20 | 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 | - + - + | const aTkzPatterns = { // All regexps must start with ^. "default": [ [/^[ \t]+/, 'SPACE'], [/^\/(?:~|bin|boot|dev|etc|home|lib|mnt|opt|root|sbin|tmp|usr|var|Bureau|Documents|Images|Musique|Public|Téléchargements|Vidéos)(?:\/[a-zA-Zà-öÀ-Ö0-9ø-ÿØ-ßĀ-ʯfi-st_.()-]+)*/, 'FOLDERUNIX'], [/^[a-zA-Z]:\\(?:Program Files(?: \(x86\)|)|[a-zA-Zà-öÀ-Ö0-9ø-ÿØ-ßĀ-ʯfi-st.()]+)(?:\\[a-zA-Zà-öÀ-Ö0-9ø-ÿØ-ßĀ-ʯfi-st_.()-]+)*/, 'FOLDERWIN'], |
58 59 60 61 62 63 64 | 58 59 60 61 62 63 64 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 91 | - + - + + - + - - - - - + - - + - - + + | this.sLang = "default"; } this.aRules = aTkzPatterns[this.sLang]; } * genTokens (sText) { let m; |
Added graphspell/fr.py version [06350887f2].
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 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | # French language dSugg = { "bcp": "beaucoup", "ca": "ça", "cad": "c’est-à-dire", "cb": "combien|CB", "cdlt": "cordialement", "construirent": "construire|construisirent|construisent|construiront", "càd": "c’est-à-dire", "dc": "de|donc", "email": "courriel|e-mail|émail", "emails": "courriels|e-mails", "Etes-vous": "Êtes-vous", "Etiez-vous": "Étiez-vous", "Etions-nous": "Étions-nous", "parce-que": "parce que", "pcq": "parce que", "pd": "pendant", "pdq": "pendant que", "pdt": "pendant", "pdtq": "pendant que", "pk": "pourquoi", "pq": "pourquoi|PQ", "prq": "presque", "prsq": "presque", "qcq": "quiconque", "qq": "quelque", "qqch": "quelque chose", "qqn": "quelqu’un", "qqne": "quelqu’une", "qqs": "quelques", "qqunes": "quelques-unes", "qquns": "quelques-uns", "tdq": "tandis que", "tj": "toujours", "tjs": "toujours", "tq": "tant que|tandis que", "ts": "tous", "tt": "tant|tout", "tte": "toute", "ttes": "toutes", "y’a": "y a" } |
Modified graphspell/ibdawg.py from [a255097656] to [71ae57c736].
485 486 487 488 489 490 491 | 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 | - + | sStem = ">" + self.funcStemming(sWord, self.lArcVal[nArc]) # Now , we go to the next node and retrieve all following arcs values, all of them are tags iAddr2 = int.from_bytes(self.byDic[iEndArcAddr:iEndArcAddr+self.nBytesNodeAddress], byteorder='big') nRawArc2 = 0 while not (nRawArc2 & self._lastArcMask): iEndArcAddr2 = iAddr2 + self.nBytesArc nRawArc2 = int.from_bytes(self.byDic[iAddr2:iEndArcAddr2], byteorder='big') |
590 591 592 593 594 595 596 | 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 | - + | while not (nRawArc & self._lastArcMask): nRawArc = int.from_bytes(self.byDic[iAddr2:iAddr2+self.nBytesArc], byteorder='big') iAddr2 += self.nBytesArc + self.nBytesNodeAddress nRawArc2 = 0 while not (nRawArc2 & self._lastArcMask): iEndArcAddr2 = iAddr2 + self.nBytesArc nRawArc2 = int.from_bytes(self.byDic[iAddr2:iEndArcAddr2], byteorder='big') |
702 703 704 705 706 707 708 | 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 | - + | iAddr2 = int.from_bytes(self.byDic[iEndArcAddr:iEndArcAddr+self.nBytesNodeAddress], byteorder='big') else: iAddr2 = iAddrNode + int.from_bytes(self.byDic[iEndArcAddr:iEndArcAddr+self.nBytesOffset], byteorder='big') nRawArc2 = 0 while not (nRawArc2 & self._lastArcMask): iEndArcAddr2 = iAddr2 + self.nBytesArc nRawArc2 = int.from_bytes(self.byDic[iAddr2:iEndArcAddr2], byteorder='big') |
Modified graphspell/spellchecker.py from [cbd22d2c4d] to [e03172e122].
1 2 3 4 5 6 7 8 9 10 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | - + | # Spellchecker # Wrapper for the IBDAWG class. # Useful to check several dictionaries at once. # To avoid iterating over a pile of dictionaries, it is assumed that 3 are enough: # - the main dictionary, bundled with the package # - the extended dictionary # - the community dictionary, added by an organization # - the personal dictionary, created by the user for its own convenience |
32 33 34 35 36 37 38 39 40 41 42 43 44 45 | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | + + + + + + + | self.oExtendedDic = self._loadDictionary(sfExtendedDic) self.oCommunityDic = self._loadDictionary(sfCommunityDic) self.oPersonalDic = self._loadDictionary(sfPersonalDic) self.bExtendedDic = bool(self.oExtendedDic) self.bCommunityDic = bool(self.oCommunityDic) self.bPersonalDic = bool(self.oPersonalDic) self.oTokenizer = None # Default suggestions self.dDefaultSugg = None self.loadSuggestions(sLangCode) # storage self.bStorage = False self._dMorphologies = {} # key: flexion, value: list of morphologies self._dLemmas = {} # key: flexion, value: list of lemmas def _loadDictionary (self, source, bNecessary=False): "returns an IBDAWG object" if not source: return None try: return ibdawg.IBDAWG(source) |
95 96 97 98 99 100 101 102 103 104 105 106 107 108 | 102 103 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 | + + + + + + + + + + + + + + + + + + + + + + + + | def deactivateCommunityDictionary (self): self.bCommunityDic = False def deactivatePersonalDictionary (self): self.bPersonalDic = False # Default suggestions def loadSuggestions (self, sLangCode): try: suggest_module = importlib.import_module("."+sLangCode, "graphspell") except: print("No suggestion module for language <"+sLangCode+">") return self.dDefaultSugg = suggest_module.dSugg # Storage def activateStorage (self): self.bStorage = True def deactivateStorage (self): self.bStorage = False def clearStorage (self): self._dLemmas.clear() self._dMorphologies.clear() # parse text functions def parseParagraph (self, sText, bSpellSugg=False): if not self.oTokenizer: self.loadTokenizer() aSpellErrs = [] |
167 168 169 170 171 172 173 | 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 | + + - + - + - + - - + + + + + + + + + + - + + + + + + + + - + + + | return True if self.bPersonalDic and self.oPersonalDic.lookup(sWord): return True return False def getMorph (self, sWord): "retrieves morphologies list, different casing allowed" if self.bStorage and sWord in self._dMorphologies: return self._dMorphologies[sWord] |
Modified graphspell/tokenizer.py from [17f452887e] to [30951f1c9c].
1 2 3 4 5 6 7 8 9 | 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 | - + - + | # Very simple tokenizer import re _PATTERNS = { "default": ( r'(?P<FOLDERUNIX>/(?:bin|boot|dev|etc|home|lib|mnt|opt|root|sbin|tmp|usr|var|Bureau|Documents|Images|Musique|Public|Téléchargements|Vidéos)(?:/[\w.()-]+)*)', r'(?P<FOLDERWIN>[a-zA-Z]:\\(?:Program Files(?: [(]x86[)]|)|[\w.()]+)(?:\\[\w.()-]+)*)', |
40 41 42 43 44 45 46 | 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | - - - + + + + + + + + + | def __init__ (self, sLang): self.sLang = sLang if sLang not in _PATTERNS: self.sLang = "default" self.zToken = re.compile( "(?i)" + '|'.join(sRegex for sRegex in _PATTERNS[sLang]) ) |
Modified make.py from [14e0172bf2] to [5704755499].
15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | + | import json import platform from distutils import dir_util, file_util import dialog_bundled import compile_rules import compile_rules_graph import helpers import lex_build sWarningMessage = "The content of this folder is generated by code and replaced at each build.\n" |
189 190 191 192 193 194 195 | 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | - - + + + + + | spLang = "gc_lang/" + sLang dVars = xConfig._sections['args'] dVars['locales'] = dVars["locales"].replace("_", "-") dVars['loc'] = str(dict([ [s, [s[0:2], s[3:5], ""]] for s in dVars["locales"].split(" ") ])) ## COMPILE RULES |
225 226 227 228 229 230 231 | 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | + + + - + + | helpers.copyAndFileTemplate(spLang+"/modules/"+sf, spLangPack+"/"+sf, dVars) print(sf, end=", ") print() # TEST FILES with open("grammalecte/"+sLang+"/gc_test.txt", "w", encoding="utf-8", newline="\n") as hDstPy: hDstPy.write("# TESTS FOR LANG [" + sLang + "]\n\n") hDstPy.write("# REGEX RULES\n\n") hDstPy.write(dVars['regex_gctests']) hDstPy.write("\n\n\n# GRAPH RULES\n\n") |
Modified misc/grammalecte.sublime-syntax from [f7dfed6343] to [d9f6420285].
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | 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 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | + + + + + + + + + + - + - + + + + + + + + + + + + + | - match: '\b(-)?[0-9.]+\b' scope: constant.numeric # Bookmarks - match: '^!!.*|^\[\+\+\].*' scope: bookmark # Bookmarks - match: '^GRAPH_NAME:.*' scope: bookmark # Bookmarks - match: '^@@@@GRAPH: *(\w+)@@@@ *' scope: bookmark captures: 1: string.graphname # Keywords are if, else. # Note that blackslashes don't need to be escaped within single quoted # strings in YAML. When using single quoted strings, only single quotes # need to be escaped: this is done by using two single quotes next to each # other. - match: '\b(?:if|else|and|or|not|in)\b' scope: keyword.python - match: '\b(?:True|False|None)\b' scope: constant.language |
82 83 84 85 86 87 88 | 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 | - + - + + + + + + + + + + + + + + + + + + + + + + + + - + | # rule delimiters - match: '<<-|>>>' scope: keyword.action - match: '__also__' scope: keyword.condition.green - match: '__else__' scope: keyword.condition.red |
Modified misc/grammalecte.tmTheme from [7305de87f8] to [2b48e41d1f].
289 290 291 292 293 294 295 296 297 298 299 300 301 302 | 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 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | <key>settings</key> <dict> <key>foreground</key> <string>#A0A0A0</string> </dict> </dict> <dict> <key>name</key> <string>Keyword Valid</string> <key>scope</key> <string>keyword.valid</string> <key>settings</key> <dict> <key>fontStyle</key> <string>bold</string> <key>foreground</key> <string>hsl(150, 100%, 80%)</string> <key>background</key> <string>hsl(150, 100%, 20%)</string> </dict> </dict> <dict> <key>name</key> <string>Keyword Invalid</string> <key>scope</key> <string>keyword.invalid</string> <key>settings</key> <dict> <key>fontStyle</key> <string>bold</string> <key>foreground</key> <string>hsl(0, 100%, 80%)</string> <key>background</key> <string>hsl(0, 100%, 20%)</string> </dict> </dict> <dict> <key>name</key> <string>Rule options</string> <key>scope</key> <string>rule.options</string> <key>settings</key> <dict> |
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 | 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 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 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | <dict> <key>fontStyle</key> <string>italic</string> <key>foreground</key> <string>#A0A0A0</string> </dict> </dict> <dict> <key>name</key> <string>Rule name</string> <key>scope</key> <string>rule.rulename2</string> <key>settings</key> <dict> <key>foreground</key> <string>#F0D080</string> </dict> </dict> <dict> <key>name</key> <string>Rule priority</string> <key>scope</key> <string>rule.priority</string> <key>settings</key> <dict> <key>foreground</key> <string>#F06060</string> </dict> </dict> <dict> <key>name</key> <string>String lemma</string> <key>scope</key> <string>string.lemma</string> <key>settings</key> <dict> <key>foreground</key> <string>hsl(210, 100%, 80%)</string> <key>background</key> <string>hsl(210, 100%, 15%)</string> </dict> </dict> <dict> <key>name</key> <string>String regex</string> <key>scope</key> <string>string.regex</string> <key>settings</key> <dict> <key>foreground</key> <string>hsl(60, 100%, 80%)</string> <key>background</key> <string>hsl(60, 100%, 10%)</string> </dict> </dict> <dict> <key>name</key> <string>String morph pattern</string> <key>scope</key> <string>string.morph.pattern</string> <key>settings</key> <dict> <key>foreground</key> <string>hsl(150, 80%, 90%)</string> <key>background</key> <string>hsl(150, 80%, 10%)</string> </dict> </dict> <dict> <key>name</key> <string>String morph antipattern</string> <key>scope</key> <string>string.morph.antipattern</string> <key>settings</key> <dict> <key>foreground</key> <string>hsl(0, 80%, 90%)</string> <key>background</key> <string>hsl(0, 80%, 10%)</string> </dict> </dict> <dict> <key>name</key> <string>JavaScript Dollar</string> <key>scope</key> <string>variable.other.dollar.only.js</string> <key>settings</key> |