Changes In Branch bdic_opt Through [9df0f3e6b2] Excluding Merge-Ins
This is equivalent to a diff from 4a19028115 to 9df0f3e6b2
2020-09-14
| ||
13:29 | [graphspell] distance Jaro-Winkler check-in: 45fdbe84fa user: olr tags: graphspell, bdic_opt | |
07:55 | [fr] ajustements check-in: cd8c458e7b user: olr tags: trunk, fr | |
2020-09-12
| ||
12:54 | [graphspell] code cleaning check-in: 9df0f3e6b2 user: olr tags: graphspell, bdic_opt | |
12:45 | [graphspell][py] ibdawg: code cleaning, remove version 2 and 3, never used check-in: 4fa9631623 user: olr tags: graphspell, bdic_opt | |
2020-09-11
| ||
19:20 | merge trunk check-in: 43afb8b856 user: olr tags: bdic_opt | |
19:18 | [fr] tests: spellchecker.suggest() check-in: 4a19028115 user: olr tags: trunk, fr | |
14:21 | [fr] faux positif check-in: 86f302f4ef user: olr tags: trunk, fr | |
Modified gc_lang/fr/modules/tests_modules.py from [1156e862bc] to [8a9c45807b].
︙ | |||
18 19 20 21 22 23 24 | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | - + | def timeblock (label, hDst=None): "performance counter (contextmanager)" start = time.perf_counter() try: yield finally: end = time.perf_counter() |
︙ | |||
47 48 49 50 51 52 53 | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | - + | self.assertTrue(self.oDic.isValid(sWord), sWord) def test_isvalid_failed (self): for sWord in ["BranchE", "BRanche", "BRAnCHE", "émilie", "éMILIE", "émiLie"]: self.assertFalse(self.oDic.isValid(sWord), sWord) def test_suggest (self): |
︙ |
Modified gc_lang/fr/perf_memo.text from [6a0d81df00] to [ad156793c1].
︙ | |||
26 27 28 29 30 31 32 | 26 27 28 29 30 31 32 33 34 35 | - - + + + | 0.6.2 2018.02.19 19:06 5.51302 1.29359 0.874157 0.260415 0.271596 0.290641 0.684754 0.376905 0.0815201 0.00919633 (spelling normalization) 1.0 2018.11.23 10:59 2.88577 0.702486 0.485648 0.139897 0.14079 0.148125 0.348751 0.201061 0.0360297 0.0043535 (x2, with new GC engine) 1.1 2019.05.16 09:42 1.50743 0.360923 0.261113 0.0749272 0.0763827 0.0771537 0.180504 0.102942 0.0182762 0.0021925 (×2, but new processor: AMD Ryzen 7 2700X) 1.2.1 2019.08.06 20:57 1.42886 0.358425 0.247356 0.0704405 0.0754886 0.0765604 0.177197 0.0988517 0.0188103 0.0020243 1.6.0 2020.01.03 20:22 1.38847 0.346214 0.240242 0.0709539 0.0737499 0.0748733 0.176477 0.0969171 0.0187857 0.0025143 (nouveau dictionnaire avec lemmes masculins) 1.9.0 2020.04.20 19:57 1.51183 0.369546 0.25681 0.0734314 0.0764396 0.0785668 0.183922 0.103674 0.0185812 0.002099 (NFC normalization) 1.9.2 2020.05.12 08:43 1.62465 0.398831 0.273012 0.0810811 0.080937 0.0845885 0.204133 0.114146 0.0212864 0.0029547 |
Modified graphspell-js/ibdawg.js from [69d7490b82] to [8da6e7122c].
︙ | |||
120 121 122 123 124 125 126 | 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 | - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + - - - + - - - + + + + - - - - - - - + + + - - - - - - - - - - - - - + - | } /* Properties: sName, nCompressionMethod, sHeader, lArcVal, nArcVal, sByDic, sLang, nChar, nBytesArc, nBytesNodeAddress, nEntry, nNode, nArc, nAff, cStemming, nTag, dChar, nBytesOffset, */ |
︙ | |||
304 305 306 307 308 309 310 | 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 | - + - + - + - + | return false; } iAddr = this._lookupArcNode(this.dChar.get(c), iAddr); if (iAddr === null) { return false; } } |
︙ | |||
376 377 378 379 380 381 382 | 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 | - + | } } } _suggest (oSuggResult, sRemain, nMaxSwitch=0, nMaxDel=0, nMaxHardRepl=0, nMaxJump=0, nDist=0, nDeep=0, iAddr=0, sNewWord="", bAvoidLoop=false) { // returns a set of suggestions // recursive function |
︙ | |||
486 487 488 489 490 491 492 | 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 | - + - - - - | } _getTails (iAddr, sTail="", n=2) { // return a list of suffixes ending at a distance of <n> from <iAddr> let aTails = new Set(); for (let [nVal, jAddr] of this._getArcs(iAddr)) { if (nVal <= this.nChar) { |
︙ | |||
528 529 530 531 532 533 534 | 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 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 | - + - - - + - + - + - + - + - + - - + + - + - - + + - + - + - + - + - - + + - + - + - - + + - + - + - + - - - + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - | zFlexPattern = (sFlexPattern !== "") ? new RegExp(sFlexPattern) : null; zTagsPattern = (sTagsPattern !== "") ? new RegExp(sTagsPattern) : null; } catch (e) { console.log("Error in regex pattern"); console.log(e.message); } |
Modified graphspell/ibdawg.py from [d16ed0d683] to [bda5a789eb].
︙ | |||
116 117 118 119 120 121 122 123 124 125 | 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 | + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - | else: raise OSError("# Error. Unknown file type: "+source) else: self._initJSON(source) self.sFileName = source if isinstance(source, str) else "[None]" # Performance trick: # Instead of converting bytes to integers each times we parse the binary dictionary, # we do it once, then parse the array nAcc = 0 byBuffer = b"" lTemp = [] nDivisor = (self.nBytesArc + self.nBytesNodeAddress) / 2 for i in range(0, len(self.byDic)): byBuffer += self.byDic[i:i+1] if nAcc == (self.nBytesArc - 1): lTemp.append(int.from_bytes(byBuffer, byteorder="big")) byBuffer = b"" elif nAcc == (self.nBytesArc + self.nBytesNodeAddress - 1): lTemp.append(round(int.from_bytes(byBuffer, byteorder="big") / nDivisor)) byBuffer = b"" nAcc = -1 nAcc = nAcc + 1 self.byDic = lTemp; # masks self._arcMask = (2 ** ((self.nBytesArc * 8) - 3)) - 1 self._finalNodeMask = 1 << ((self.nBytesArc * 8) - 1) self._lastArcMask = 1 << ((self.nBytesArc * 8) - 2) |
︙ | |||
200 201 202 203 204 205 206 | 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | - | self.cStemming = l.pop(0) self.nTag = self.nArcVal - self.nChar - self.nAff # <dChar> to get the value of an arc, <dCharVal> to get the char of an arc with its value self.dChar = {} for i in range(1, self.nChar+1): self.dChar[self.lArcVal[i]] = i self.dCharVal = { v: k for k, v in self.dChar.items() } |
︙ | |||
244 245 246 247 248 249 250 | 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | - | "nNode": self.nNode, "nArc": self.nArc, "nArcVal": self.nArcVal, "lArcVal": self.lArcVal, "nCompressionMethod": self.nCompressionMethod, "nBytesArc": self.nBytesArc, "nBytesNodeAddress": self.nBytesNodeAddress, |
︙ | |||
296 297 298 299 300 301 302 | 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 | - + - + - + - + | iAddr = 0 for c in sWord: if c not in self.dChar: return False iAddr = self._lookupArcNode(self.dChar[c], iAddr) if iAddr is None: return False |
︙ | |||
352 353 354 355 356 357 358 | 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 | - + | sWord1, sWord2 = sWord.split(cSplitter, 1) if self.isValid(sWord1) and self.isValid(sWord2): oSuggResult.addSugg(sWord1+" "+sWord2) def _suggest (self, oSuggResult, sRemain, nMaxSwitch=0, nMaxDel=0, nMaxHardRepl=0, nMaxJump=0, nDist=0, nDeep=0, iAddr=0, sNewWord="", bAvoidLoop=False): # recursive function #logging.info((nDeep * " ") + sNewWord + ":" + sRemain) |
︙ | |||
419 420 421 422 423 424 425 | 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 | - + | yield (self.dCharVal[nVal], jAddr) def _getTails (self, iAddr, sTail="", n=2): "return a list of suffixes ending at a distance of <n> from <iAddr>" aTails = set() for nVal, jAddr in self._getArcs(iAddr): if nVal <= self.nChar: |
︙ | |||
467 468 469 470 471 472 473 | 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 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 | - + - - - - - + - + - + - + - + - + - - + + - + - - + + - - + + - + - + - - + + - + - + - - + + - + - + - + - - - + + + - + - + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | if sFlexPattern: zFlexPattern = re.compile(sFlexPattern) if sTagsPattern: zTagsPattern = re.compile(sTagsPattern) except re.error: print("# Error in regex pattern") traceback.print_exc() |