示例#1
0
class RethSchekTestCases(unittest.TestCase):
    """Test Reth-Schek Phonetik functions.

    test cases for abydos.phonetic.RethSchek
    """

    pa = RethSchek()

    def test_reth_schek_phonetik(self):
        """Test abydos.phonetic.RethSchek."""
        # Base cases
        self.assertEqual(self.pa.encode(''), '')

        # equivalents
        self.assertEqual(self.pa.encode('Häschen'), self.pa.encode('Haeschen'))
        self.assertEqual(self.pa.encode('Schloß'), self.pa.encode('Schloss'))
        self.assertEqual(self.pa.encode('üben'), self.pa.encode('ueben'))
        self.assertEqual(
            self.pa.encode('Eichörnchen'), self.pa.encode('Eichoernchen')
        )

        self.assertEqual(self.pa.encode('Häschen'), 'HESCHEN')
        self.assertEqual(self.pa.encode('Eichörnchen'), 'AIGHOERNGHEN')
        self.assertEqual(self.pa.encode('Hexe'), 'HEXE')
        self.assertEqual(self.pa.encode('Chemie'), 'GHEMI')
        self.assertEqual(self.pa.encode('Brille'), 'BRILE')
        self.assertEqual(self.pa.encode('Brilleille'), 'BRILAILE')
        self.assertEqual(self.pa.encode('Niveau'), 'NIFEAU')
        self.assertEqual(self.pa.encode('Korb'), 'GORB')
        self.assertEqual(self.pa.encode('Heino'), 'HAINO')
        self.assertEqual(self.pa.encode('Nekka'), 'NEKA')
        self.assertEqual(self.pa.encode('Aleph'), 'ALEF')
        self.assertEqual(self.pa.encode('Aleppo'), 'ALEBO')
        self.assertEqual(self.pa.encode('Endzipfel'), 'ENDZIBFL')
        self.assertEqual(self.pa.encode('verbrandt'), 'FERBRAND')
        self.assertEqual(self.pa.encode('Cent'), 'GEND')
        self.assertEqual(self.pa.encode('addiscendae'), 'ADISGENDE')
        self.assertEqual(self.pa.encode('kickx'), 'GIGX')
        self.assertEqual(self.pa.encode('sanctionen'), 'SANGDIONEN')
        self.assertEqual(self.pa.encode('Kuh'), 'GU')
        self.assertEqual(self.pa.encode('lecker'), 'LEGR')
        self.assertEqual(self.pa.encode('rödlich'), 'ROEDLIG')

        # Test wrapper
        self.assertEqual(reth_schek_phonetik('Häschen'), 'HESCHEN')
示例#2
0
 'phonic': PHONIC().encode,
 'phonic_0pad_ml6': PHONIC(max_length=6, zero_pad=True).encode,
 'phonic_ext': PHONIC(extended=True).encode,
 'phonix': Phonix().encode,
 'phonix_0pad_ml6': Phonix(max_length=6, zero_pad=True).encode,
 'pshp_soundex_first': PSHPSoundexFirst().encode,
 'pshp_soundex_first_german': PSHPSoundexFirst(german=True).encode,
 'pshp_soundex_first_ml8': PSHPSoundexFirst(max_length=8).encode,
 'pshp_soundex_last': PSHPSoundexLast().encode,
 'pshp_soundex_last_german': PSHPSoundexLast(german=True).encode,
 'pshp_soundex_last_ml8': PSHPSoundexLast(max_length=8).encode,
 'refined_soundex': RefinedSoundex().encode,
 'refined_soundex_vowels': RefinedSoundex(retain_vowels=True).encode,
 'refined_soundex_0pad_ml6': RefinedSoundex(zero_pad=True,
                                            max_length=6).encode,
 'reth_schek_phonetik': RethSchek().encode,
 'roger_root': RogerRoot().encode,
 'roger_root_nopad_ml8': RogerRoot(max_length=8, zero_pad=False).encode,
 'russell_index': RussellIndex().encode,
 'russell_index_alpha': RussellIndex().encode_alpha,
 'sfinxbis': SfinxBis().encode,
 'sfinxbis_ml6': SfinxBis(max_length=6).encode,
 'sound_d': SoundD().encode,
 'sound_d_ml8': SoundD(max_length=8).encode,
 'soundex': Soundex().encode,
 'soundex_reverse': Soundex(reverse=True).encode,
 'soundex_0pad_ml6': Soundex(zero_pad=True, max_length=6).encode,
 'soundex_special': Soundex(var='special').encode,
 'soundex_census': Soundex(var='Census').encode,
 'soundex_br': SoundexBR().encode,
 'spanish_metaphone': SpanishMetaphone().encode,
示例#3
0
 'pshp_soundex_first_ml8':
 PSHPSoundexFirst(max_length=8).encode,
 'pshp_soundex_last':
 PSHPSoundexLast().encode,
 'pshp_soundex_last_german':
 PSHPSoundexLast(german=True).encode,
 'pshp_soundex_last_ml8':
 PSHPSoundexLast(max_length=8).encode,
 'refined_soundex':
 RefinedSoundex().encode,
 'refined_soundex_vowels':
 RefinedSoundex(retain_vowels=True).encode,
 'refined_soundex_0pad_ml6':
 RefinedSoundex(zero_pad=True, max_length=6).encode,
 'reth_schek_phonetik':
 RethSchek().encode,
 'roger_root':
 RogerRoot().encode,
 'roger_root_nopad_ml8':
 RogerRoot(max_length=8, zero_pad=False).encode,
 'russell_index':
 russell.encode,
 'russell_index_num_to_alpha': (
     lambda _: russell._to_alpha(russell.encode(_))  # noqa: SF01
 ),
 'russell_index_alpha':
 russell.encode_alpha,
 'sfinxbis':
 lambda _: ', '.join(sfinxbis.encode(_)),
 'sfinxbis_ml6':
 lambda _: ', '.join(sfinxbis_6.encode(_)),
示例#4
0
metasoundex = MetaSoundex()
mra = MRA()
norphone = Norphone()
nrl = NRL()
nysiis = NYSIIS()
onca = ONCA()
parmar_kumbharana = ParmarKumbharana()
phonem = Phonem()
phonet = Phonet()
phonetic_spanish = PhoneticSpanish()
phonex = Phonex()
phonix = Phonix()
pshp_soundex_first = PSHPSoundexFirst()
pshp_soundex_last = PSHPSoundexLast()
refined_soundex = RefinedSoundex()
reth_schek = RethSchek()
roger_root = RogerRoot()
russell = RussellIndex()
sfinxbis = SfinxBis()
sound_d = SoundD()
soundex = Soundex()
soundex_br = SoundexBR()
spanish_metaphone = SpanishMetaphone()
spfc = SPFC()
statistics_canada = StatisticsCanada()

algorithms = {
    'russell_index':
    lambda _: str(russell.encode(_)),
    'russell_index_num_to_alpha':
    lambda _: russell._to_alpha(  # noqa: SF01