예제 #1
0
class PhonemTestCases(unittest.TestCase):
    """Test Phonem functions.

    test cases for abydos.phonetic.Phonem
    """

    pa = Phonem()

    def test_phonem(self):
        """Test abydos.phonetic.Phonem."""
        self.assertEqual(self.pa.encode(''), '')

        # http://phonetik.phil-fak.uni-koeln.de/fileadmin/home/ritters/Allgemeine_Dateien/Martin_Wilz.pdf
        self.assertEqual(self.pa.encode('müller'), 'MYLR')
        self.assertEqual(self.pa.encode('schmidt'), 'CMYD')
        self.assertEqual(self.pa.encode('schneider'), 'CNAYDR')
        self.assertEqual(self.pa.encode('fischer'), 'VYCR')
        self.assertEqual(self.pa.encode('weber'), 'VBR')
        self.assertEqual(self.pa.encode('meyer'), 'MAYR')
        self.assertEqual(self.pa.encode('wagner'), 'VACNR')
        self.assertEqual(self.pa.encode('schulz'), 'CULC')
        self.assertEqual(self.pa.encode('becker'), 'BCR')
        self.assertEqual(self.pa.encode('hoffmann'), 'OVMAN')
        self.assertEqual(self.pa.encode('schäfer'), 'CVR')

        # http://cpansearch.perl.org/src/MAROS/Text-Phonetic-2.05/t/008_phonem.t
        self.assertEqual(self.pa.encode('mair'), 'MAYR')
        self.assertEqual(self.pa.encode('bäker'), 'BCR')
        self.assertEqual(self.pa.encode('schaeffer'), 'CVR')
        self.assertEqual(self.pa.encode('computer'), 'COMBUDR')
        self.assertEqual(self.pa.encode('pfeifer'), 'VAYVR')
        self.assertEqual(self.pa.encode('pfeiffer'), 'VAYVR')

        # Test wrapper
        self.assertEqual(phonem('müller'), 'MYLR')
예제 #2
0
 'koelner_phonetik_alpha': Koelner().encode_alpha,
 'lein': LEIN().encode,
 'lein_nopad_ml8': LEIN(max_length=8, zero_pad=False).encode,
 'metasoundex': MetaSoundex().encode,
 'metasoundex_es': MetaSoundex(lang='es').encode,
 'metaphone': Metaphone().encode,
 'mra': MRA().encode,
 'norphone': Norphone().encode,
 'nrl': NRL().encode,
 'nysiis': NYSIIS().encode,
 'nysiis_modified': NYSIIS(modified=True).encode,
 'nysiis_ml_inf': NYSIIS(max_length=-1).encode,
 'onca': ONCA().encode,
 'onca_nopad_ml8': ONCA(max_length=8, zero_pad=False).encode,
 'parmar_kumbharana': ParmarKumbharana().encode,
 'phonem': Phonem().encode,
 'phonet_1': Phonet().encode,
 'phonet_2': Phonet(mode=2).encode,
 'phonet_1_none': Phonet(lang='none').encode,
 'phonet_2_none': Phonet(mode=2, lang='none').encode,
 'phonetic_spanish': PhoneticSpanish().encode,
 'phonetic_spanish_ml4': PhoneticSpanish(max_length=4).encode,
 'phonex': Phonex().encode,
 'phonex_0pad_ml6': Phonex(max_length=6, zero_pad=True).encode,
 '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,
예제 #3
0
 'nrl':
 NRL().encode,
 'nysiis':
 NYSIIS().encode,
 'nysiis_modified':
 NYSIIS(modified=True).encode,
 'nysiis_ml_inf':
 NYSIIS(max_length=-1).encode,
 'onca':
 ONCA().encode,
 'onca_nopad_ml8':
 ONCA(max_length=8, zero_pad=False).encode,
 'parmar_kumbharana':
 ParmarKumbharana().encode,
 'phonem':
 Phonem().encode,
 'phonet_1':
 Phonet().encode,
 'phonet_2':
 Phonet(mode=2).encode,
 'phonet_1_none':
 Phonet(lang='none').encode,
 'phonet_2_none':
 Phonet(mode=2, lang='none').encode,
 'phonetic_spanish':
 PhoneticSpanish().encode,
 'phonetic_spanish_ml4':
 PhoneticSpanish(max_length=4).encode,
 'phonex':
 Phonex().encode,
 'phonex_0pad_ml6':
예제 #4
0
eudex = Eudex()
fonem = FONEM()
fuzzy_soundex = FuzzySoundex()
haase = Haase()
henry_early = HenryEarly()
koelner = Koelner()
lein = Lein()
metaphone = Metaphone()
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()