class MraTestCases(unittest.TestCase): """Test MRA functions. test cases for abydos.phonetic.MRA """ pa = MRA() def test_mra(self): """Test abydos.phonetic.MRA.""" self.assertEqual(self.pa.encode(''), '') # https://en.wikipedia.org/wiki/Match_rating_approach self.assertEqual(self.pa.encode('Byrne'), 'BYRN') self.assertEqual(self.pa.encode('Boern'), 'BRN') self.assertEqual(self.pa.encode('Smith'), 'SMTH') self.assertEqual(self.pa.encode('Smyth'), 'SMYTH') self.assertEqual(self.pa.encode('Catherine'), 'CTHRN') self.assertEqual(self.pa.encode('Kathryn'), 'KTHRYN') # length checks self.assertEqual(self.pa.encode('Christopher'), 'CHRPHR') self.assertEqual(self.pa.encode('Dickensianistic'), 'DCKSTC') self.assertEqual(self.pa.encode('Acetylcholinesterase'), 'ACTTRS') # Test wrapper self.assertEqual(mra('Byrne'), 'BYRN')
'eudex': Eudex().encode, 'fonem': FONEM().encode, 'fuzzy_soundex': FuzzySoundex().encode, 'fuzzy_soundex_0pad_ml8': FuzzySoundex(max_length=8, zero_pad=True).encode, 'haase_phonetik': Haase().encode, 'haase_phonetik_primary': Haase(primary_only=True).encode, 'henry_early': HenryEarly().encode, 'henry_early_ml8': HenryEarly(max_length=8).encode, 'koelner_phonetik': Koelner().encode, '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,
lambda _: koelner._to_alpha(koelner.encode(_)) # noqa: SF01 ), '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':
bm = BeiderMorse() caverphone = Caverphone() davidson = Davidson() dm = DaitchMokotoff() dolby = Dolby() double_metaphone = DoubleMetaphone() 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()