Overview
Comment: | [graphpspell] ibdawg: fix dictionary building |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | graphspell |
Files: | files | file ages | folders |
SHA3-256: |
b76283a8765751df5e32991b706ad0af |
User & Date: | olr on 2020-10-03 19:40:02 |
Other Links: | manifest | tags |
Context
2020-10-03
| ||
19:59 | [fr] mise à jour du dictionnaire check-in: f11700d693 user: olr tags: trunk, fr | |
19:40 | [graphpspell] ibdawg: fix dictionary building check-in: b76283a876 user: olr tags: trunk, graphspell | |
19:20 | [fr] gendicfr: update tags check-in: 80224c9502 user: olr tags: trunk, fr | |
Changes
Modified graphspell-js/ibdawg.js from [5c5b2cad28] to [280555859f].
︙ | |||
177 178 179 180 181 182 183 184 185 | 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 | + - - + - + - | https://github.com/mozilla/addons-linter/issues/1361 */ /* Performance trick: Instead of converting bytes to integers each times we parse the binary dictionary, we do it once, then parse the array */ this.lByDic = []; let nAcc = 0; let lBytesBuffer = []; |
︙ | |||
317 318 319 320 321 322 323 | 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 | - + | return false; } iAddr = this._lookupArcNode(this.dChar.get(c), iAddr); if (iAddr === null) { return false; } } |
︙ | |||
390 391 392 393 394 395 396 | 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 | - + | } } } _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 |
︙ | |||
500 501 502 503 504 505 506 | 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 | - + | } _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) { |
︙ | |||
572 573 574 575 576 577 578 | 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 | - + - + - + - + | return []; } iAddr = this._lookupArcNode(this.dChar.get(c), iAddr); if (iAddr === null) { return []; } } |
︙ | |||
611 612 613 614 615 616 617 | 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 | - + - + - + - + - - + + | return []; } iAddr = this._lookupArcNode(this.dChar.get(c), iAddr); if (iAddr === null) { return []; } } |
Modified graphspell/ibdawg.py from [cae8eca48c] to [2cf8f6a51c].
︙ | |||
130 131 132 133 134 135 136 | 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 | - + - + - + - | 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"" |
︙ | |||
298 299 300 301 302 303 304 | 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | - + | 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 |
︙ | |||
355 356 357 358 359 360 361 | 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | - + | 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) |
︙ | |||
422 423 424 425 426 427 428 | 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 | - + | 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: |
︙ | |||
494 495 496 497 498 499 500 | 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 577 578 579 580 581 582 583 | - + - + - + - + - + - + - + - + - - + + - + - + - + - + | iAddr = 0 for c in sWord: if c not in self.dChar: return [] iAddr = self._lookupArcNode(self.dChar[c], iAddr) if iAddr is None: return [] |