Overview
Comment: | [graphspell][core][fr] code cleaning (pylint) |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | fr | core | graphspell |
Files: | files | file ages | folders |
SHA3-256: |
a186cf9261887f6571761c857a38e246 |
User & Date: | olr on 2019-05-10 19:44:08 |
Original Comment: | [graphspell][core][fr] code cleaning |
Other Links: | manifest | tags |
Context
2019-05-10
| ||
20:52 | [graphspell][core][fr] code cleaning (pylint) check-in: a85f64f6f8 user: olr tags: trunk, fr, core, graphspell | |
19:44 | [graphspell][core][fr] code cleaning (pylint) check-in: a186cf9261 user: olr tags: trunk, fr, core, graphspell | |
18:56 | [fx] code cleaning check-in: b03eadae9f user: olr tags: trunk, fx | |
Changes
Modified gc_core/py/text.py from [137c7cc30f] to [36660e74f0].
︙ | |||
131 132 133 134 135 136 137 138 139 140 141 142 | 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | + + - - - - - + + + + + | return sText, lLineSet def convertToXY (aGrammErrs, aSpellErrs, lLineSet): """Converts errors position as an y and x position in a text (y is line number, x is row number). lLineSet is a list of sets (line_number_y, start_x, end_x) describing how the paragraph is divided.""" for dErr in chain(aGrammErrs, aSpellErrs): i = 0 for i, elem in enumerate(lLineSet, 1): if dErr['nEnd'] <= elem[2]: dErr['nEndY'] = elem[0] dErr['nEndX'] = dErr['nEnd'] - elem[1] break if i: |
Modified gc_lang/fr/modules/conj.py from [fb581126e7] to [13badc6c7d].
︙ | |||
350 351 352 353 354 355 356 | 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | - + | return "" if bTpsCo: sPartPre = _getConjWithTags(self.sVerbAux, self._tTagsAux, ":PQ", ":P") if not bPro else getConj("être", ":PQ", ":P") else: sPartPre = self.dConj[":P"][":"] if not sPartPre: return "" |
︙ | |||
383 384 385 386 387 388 389 | 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | - + | sWho = ":1ś" if bTpsCo: sConj = _getConjWithTags(self.sVerbAux, self._tTagsAux, sTemps, sWho) if not bPro else getConj("être", sTemps, sWho) else: sConj = self.dConj[sTemps][sWho] if not sConj: return "" |
︙ | |||
418 419 420 421 422 423 424 | 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 | - + - + | def _getPronomSujet (self, sWho, bFem): try: if sWho == ":3s": if self._sRawInfo[5] == "r": return "on" elif bFem: return "elle" |
︙ | |||
471 472 473 474 475 476 477 478 479 480 481 482 483 484 | 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 | + | return self.dConj[":Q"][":Q3"] if self.dConj[":Q"][":Q3"] else self.dConj[":Q"][":Q1"] return self.dConj[":Q"][":Q4"] if self.dConj[":Q"][":Q4"] else self.dConj[":Q"][":Q1"] except: traceback.print_exc() return "# erreur" def createConjTable (self, bPro=False, bNeg=False, bTpsCo=False, bInt=False, bFem=False): "return a dictionary of all conjugations with titles, according to options (used to be displayed as is)" dConjTable = { "t_infi": "Infinitif", "infi": self.infinitif(bPro, bNeg, bTpsCo, bInt, bFem), "t_ppre": "Participe présent", "ppre": self.participePresent(bPro, bNeg, bTpsCo, bInt, bFem), "t_ppas": "Participes passés", "ppas1": self.participePasse(":Q1"), |
︙ |
Modified gc_lang/fr/modules/gce_suggestions.py from [4e59fa697e] to [6333a4318e].
︙ | |||
345 346 347 348 349 350 351 | 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | - + | return True return False def switchGender (sFlex, bPlur=None): "return feminine or masculine form(s) of <sFlex>" aSugg = set() |
︙ |
Modified graphspell/dawg.py from [bace844224] to [0b6cd0b1ae].
︙ | |||
665 666 667 668 669 670 671 | 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 | - + | ┃ ┃ ┃ ┗━━━ if 1, last arc of this node ┗━━━━━ if 1, this node is final (only on the first arc) """ nArc = len(self.arcs) nFinalNodeMask = 1 << ((nBytesArc*8)-1) nFinalArcMask = 1 << ((nBytesArc*8)-2) |
︙ | |||
687 688 689 690 691 692 693 | 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 | - + | def getTxtRepr1 (self, nBytesArc, lVal): "return representation as string of node (method 1)" nArc = len(self.arcs) nFinalNodeMask = 1 << ((nBytesArc*8)-1) nFinalArcMask = 1 << ((nBytesArc*8)-2) s = "i{:_>10} -- #{:_>10}\n".format(self.i, self.addr) |
︙ | |||
727 728 729 730 731 732 733 | 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 | - + | ┃ ┗━━━━ if 1, last arc of this node ┗━━━━━━ if 1, this node is final (only on the first arc) """ nArc = len(self.arcs) nFinalNodeMask = 1 << ((nBytesArc*8)-1) nFinalArcMask = 1 << ((nBytesArc*8)-2) nNextNodeMask = 1 << ((nBytesArc*8)-3) |
︙ | |||
754 755 756 757 758 759 760 | 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 | - + | def getTxtRepr2 (self, nBytesArc, lVal): "return representation as string of node (method 2)" nArc = len(self.arcs) nFinalNodeMask = 1 << ((nBytesArc*8)-1) nFinalArcMask = 1 << ((nBytesArc*8)-2) nNextNodeMask = 1 << ((nBytesArc*8)-3) s = "i{:_>10} -- #{:_>10}\n".format(self.i, self.addr) |
︙ | |||
804 805 806 807 808 809 810 | 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 | - + | ┗━━━━━━ if 1, this node is final (only on the first arc) """ nArc = len(self.arcs) nFinalNodeMask = 1 << ((nBytesArc*8)-1) nFinalArcMask = 1 << ((nBytesArc*8)-2) nNextNodeMask = 1 << ((nBytesArc*8)-3) nMaxOffset = (2 ** (nBytesOffset * 8)) - 1 |
︙ | |||
833 834 835 836 837 838 839 | 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 | - + | "return representation as string of node (method 3)" nArc = len(self.arcs) nFinalNodeMask = 1 << ((nBytesArc*8)-1) nFinalArcMask = 1 << ((nBytesArc*8)-2) nNextNodeMask = 1 << ((nBytesArc*8)-3) nMaxOffset = (2 ** (nBytesOffset * 8)) - 1 s = "i{:_>10} -- #{:_>10} ({})\n".format(self.i, self.addr, self.size) |
︙ |
Modified graphspell/ibdawg.py from [4586b340c3] to [b4fbad68fc].
︙ | |||
263 264 265 266 267 268 269 | 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 | - - + | if sWord.istitle(): return self.lookup(sWord.lower()) if sWord.isupper(): if self.bAcronymValid: return True return self.lookup(sWord.lower()) or self.lookup(sWord.capitalize()) return self.lookup(sWord[:1].lower() + sWord[1:]) |
︙ | |||
333 334 335 336 337 338 339 | 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 | - + | #logging.info((nDeep * " ") + sNewWord + ":" + sRemain) if int.from_bytes(self.byDic[iAddr:iAddr+self.nBytesArc], byteorder='big') & self._finalNodeMask: if not sRemain: oSuggResult.addSugg(sNewWord, nDeep) for sTail in self._getTails(iAddr): oSuggResult.addSugg(sNewWord+sTail, nDeep) return |
︙ | |||
373 374 375 376 377 378 379 380 381 382 383 384 385 386 | 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 | + | self._suggest(oSuggResult, sRepl, nMaxSwitch, nMaxDel, nMaxHardRepl, nMaxJump, nDist, nDeep+1, iAddr, sNewWord, True) elif len(sRemain) == 1: self._suggest(oSuggResult, "", nMaxSwitch, nMaxDel, nMaxHardRepl, nMaxJump, nDist, nDeep+1, iAddr, sNewWord, True) # remove last char and go on for sRepl in cp.dFinal1.get(sRemain, ()): self._suggest(oSuggResult, sRepl, nMaxSwitch, nMaxDel, nMaxHardRepl, nMaxJump, nDist, nDeep+1, iAddr, sNewWord, True) def isNgramsOK (self, sChars): "returns True if sChars in known 2grams" if len(sChars) != 2: return True if not self.a2grams: return True return sChars in self.a2grams #@timethis |
︙ |
Added pylintrc version [d17ba29c21].