Code Duplication    Length = 44-44 lines in 2 locations

abydos/phonetic.py 2 locations

@@ 4837-4880 (lines=44) @@
4834
    word = word.replace('ILLE', 'I')
4835
4836
    for i in range(len(word)):
4837
        if word[i] in _vowels:
4838
            sdx += '9'
4839
        elif word[i] == 'B':
4840
            sdx += '1'
4841
        elif word[i] == 'P':
4842
            if _before(word, i, {'H'}):
4843
                sdx += '3'
4844
            else:
4845
                sdx += '1'
4846
        elif word[i] in {'D', 'T'}:
4847
            if _before(word, i, {'C', 'S', 'Z'}):
4848
                sdx += '8'
4849
            else:
4850
                sdx += '2'
4851
        elif word[i] in {'F', 'V', 'W'}:
4852
            sdx += '3'
4853
        elif word[i] in {'G', 'K', 'Q'}:
4854
            sdx += '4'
4855
        elif word[i] == 'C':
4856
            if _after(word, i, {'S', 'Z'}):
4857
                sdx += '8'
4858
            elif i == 0:
4859
                if _before(word, i, {'A', 'H', 'K', 'L', 'O', 'Q', 'R', 'U',
4860
                                     'X'}):
4861
                    sdx += '4'
4862
                else:
4863
                    sdx += '8'
4864
            elif _before(word, i, {'A', 'H', 'K', 'O', 'Q', 'U', 'X'}):
4865
                sdx += '4'
4866
            else:
4867
                sdx += '8'
4868
        elif word[i] == 'X':
4869
            if _after(word, i, {'C', 'K', 'Q'}):
4870
                sdx += '8'
4871
            else:
4872
                sdx += '48'
4873
        elif word[i] == 'L':
4874
            sdx += '5'
4875
        elif word[i] in {'M', 'N'}:
4876
            sdx += '6'
4877
        elif word[i] == 'R':
4878
            sdx += '7'
4879
        elif word[i] in {'S', 'Z'}:
4880
            sdx += '8'
4881
4882
    sdx = _delete_consecutive_repeats(sdx)
4883
@@ 571-614 (lines=44) @@
568
        return sdx
569
570
    for i in range(len(word)):
571
        if word[i] in _vowels:
572
            sdx += '0'
573
        elif word[i] == 'B':
574
            sdx += '1'
575
        elif word[i] == 'P':
576
            if _before(word, i, {'H'}):
577
                sdx += '3'
578
            else:
579
                sdx += '1'
580
        elif word[i] in {'D', 'T'}:
581
            if _before(word, i, {'C', 'S', 'Z'}):
582
                sdx += '8'
583
            else:
584
                sdx += '2'
585
        elif word[i] in {'F', 'V', 'W'}:
586
            sdx += '3'
587
        elif word[i] in {'G', 'K', 'Q'}:
588
            sdx += '4'
589
        elif word[i] == 'C':
590
            if _after(word, i, {'S', 'Z'}):
591
                sdx += '8'
592
            elif i == 0:
593
                if _before(word, i, {'A', 'H', 'K', 'L', 'O', 'Q', 'R', 'U',
594
                                     'X'}):
595
                    sdx += '4'
596
                else:
597
                    sdx += '8'
598
            elif _before(word, i, {'A', 'H', 'K', 'O', 'Q', 'U', 'X'}):
599
                sdx += '4'
600
            else:
601
                sdx += '8'
602
        elif word[i] == 'X':
603
            if _after(word, i, {'C', 'K', 'Q'}):
604
                sdx += '8'
605
            else:
606
                sdx += '48'
607
        elif word[i] == 'L':
608
            sdx += '5'
609
        elif word[i] in {'M', 'N'}:
610
            sdx += '6'
611
        elif word[i] == 'R':
612
            sdx += '7'
613
        elif word[i] in {'S', 'Z'}:
614
            sdx += '8'
615
616
    sdx = _delete_consecutive_repeats(sdx)
617