| @@ 4851-4894 (lines=44) @@ | ||
| 4848 | word = word.replace('ILLE', 'I') |
|
| 4849 | ||
| 4850 | for i in range(len(word)): |
|
| 4851 | if word[i] in _vowels: |
|
| 4852 | sdx += '9' |
|
| 4853 | elif word[i] == 'B': |
|
| 4854 | sdx += '1' |
|
| 4855 | elif word[i] == 'P': |
|
| 4856 | if _before(word, i, {'H'}): |
|
| 4857 | sdx += '3' |
|
| 4858 | else: |
|
| 4859 | sdx += '1' |
|
| 4860 | elif word[i] in {'D', 'T'}: |
|
| 4861 | if _before(word, i, {'C', 'S', 'Z'}): |
|
| 4862 | sdx += '8' |
|
| 4863 | else: |
|
| 4864 | sdx += '2' |
|
| 4865 | elif word[i] in {'F', 'V', 'W'}: |
|
| 4866 | sdx += '3' |
|
| 4867 | elif word[i] in {'G', 'K', 'Q'}: |
|
| 4868 | sdx += '4' |
|
| 4869 | elif word[i] == 'C': |
|
| 4870 | if _after(word, i, {'S', 'Z'}): |
|
| 4871 | sdx += '8' |
|
| 4872 | elif i == 0: |
|
| 4873 | if _before(word, i, {'A', 'H', 'K', 'L', 'O', 'Q', 'R', 'U', |
|
| 4874 | 'X'}): |
|
| 4875 | sdx += '4' |
|
| 4876 | else: |
|
| 4877 | sdx += '8' |
|
| 4878 | elif _before(word, i, {'A', 'H', 'K', 'O', 'Q', 'U', 'X'}): |
|
| 4879 | sdx += '4' |
|
| 4880 | else: |
|
| 4881 | sdx += '8' |
|
| 4882 | elif word[i] == 'X': |
|
| 4883 | if _after(word, i, {'C', 'K', 'Q'}): |
|
| 4884 | sdx += '8' |
|
| 4885 | else: |
|
| 4886 | sdx += '48' |
|
| 4887 | elif word[i] == 'L': |
|
| 4888 | sdx += '5' |
|
| 4889 | elif word[i] in {'M', 'N'}: |
|
| 4890 | sdx += '6' |
|
| 4891 | elif word[i] == 'R': |
|
| 4892 | sdx += '7' |
|
| 4893 | elif word[i] in {'S', 'Z'}: |
|
| 4894 | sdx += '8' |
|
| 4895 | ||
| 4896 | sdx = _delete_consecutive_repeats(sdx) |
|
| 4897 | ||
| @@ 583-626 (lines=44) @@ | ||
| 580 | return sdx |
|
| 581 | ||
| 582 | for i in range(len(word)): |
|
| 583 | if word[i] in _vowels: |
|
| 584 | sdx += '0' |
|
| 585 | elif word[i] == 'B': |
|
| 586 | sdx += '1' |
|
| 587 | elif word[i] == 'P': |
|
| 588 | if _before(word, i, {'H'}): |
|
| 589 | sdx += '3' |
|
| 590 | else: |
|
| 591 | sdx += '1' |
|
| 592 | elif word[i] in {'D', 'T'}: |
|
| 593 | if _before(word, i, {'C', 'S', 'Z'}): |
|
| 594 | sdx += '8' |
|
| 595 | else: |
|
| 596 | sdx += '2' |
|
| 597 | elif word[i] in {'F', 'V', 'W'}: |
|
| 598 | sdx += '3' |
|
| 599 | elif word[i] in {'G', 'K', 'Q'}: |
|
| 600 | sdx += '4' |
|
| 601 | elif word[i] == 'C': |
|
| 602 | if _after(word, i, {'S', 'Z'}): |
|
| 603 | sdx += '8' |
|
| 604 | elif i == 0: |
|
| 605 | if _before(word, i, {'A', 'H', 'K', 'L', 'O', 'Q', 'R', 'U', |
|
| 606 | 'X'}): |
|
| 607 | sdx += '4' |
|
| 608 | else: |
|
| 609 | sdx += '8' |
|
| 610 | elif _before(word, i, {'A', 'H', 'K', 'O', 'Q', 'U', 'X'}): |
|
| 611 | sdx += '4' |
|
| 612 | else: |
|
| 613 | sdx += '8' |
|
| 614 | elif word[i] == 'X': |
|
| 615 | if _after(word, i, {'C', 'K', 'Q'}): |
|
| 616 | sdx += '8' |
|
| 617 | else: |
|
| 618 | sdx += '48' |
|
| 619 | elif word[i] == 'L': |
|
| 620 | sdx += '5' |
|
| 621 | elif word[i] in {'M', 'N'}: |
|
| 622 | sdx += '6' |
|
| 623 | elif word[i] == 'R': |
|
| 624 | sdx += '7' |
|
| 625 | elif word[i] in {'S', 'Z'}: |
|
| 626 | sdx += '8' |
|
| 627 | ||
| 628 | sdx = _delete_consecutive_repeats(sdx) |
|
| 629 | ||