|
1
|
|
|
# -*- coding: utf-8 -*- |
|
2
|
|
|
|
|
3
|
|
|
# Copyright 2014-2018 by Christopher C. Little. |
|
4
|
|
|
# This file is part of Abydos. |
|
5
|
|
|
# |
|
6
|
|
|
# Abydos is free software: you can redistribute it and/or modify |
|
7
|
|
|
# it under the terms of the GNU General Public License as published by |
|
8
|
|
|
# the Free Software Foundation, either version 3 of the License, or |
|
9
|
|
|
# (at your option) any later version. |
|
10
|
|
|
# |
|
11
|
|
|
# Abydos is distributed in the hope that it will be useful, |
|
12
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14
|
|
|
# GNU General Public License for more details. |
|
15
|
|
|
# |
|
16
|
|
|
# You should have received a copy of the GNU General Public License |
|
17
|
|
|
# along with Abydos. If not, see <http://www.gnu.org/licenses/>. |
|
18
|
|
|
|
|
19
|
|
|
"""abydos.tests.test_phonetic_mra. |
|
20
|
|
|
|
|
21
|
|
|
This module contains unit tests for abydos.phonetic.mra |
|
22
|
|
|
""" |
|
23
|
|
|
|
|
24
|
|
|
from __future__ import unicode_literals |
|
25
|
|
|
|
|
26
|
|
|
import unittest |
|
27
|
|
|
|
|
28
|
|
|
from abydos.phonetic.mra import mra |
|
29
|
|
|
|
|
30
|
|
|
|
|
31
|
|
|
class MraTestCases(unittest.TestCase): |
|
32
|
|
|
"""Test MRA functions. |
|
33
|
|
|
|
|
34
|
|
|
test cases for abydos.phonetic.mra |
|
35
|
|
|
""" |
|
36
|
|
|
|
|
37
|
|
|
def test_mra(self): |
|
38
|
|
|
"""Test abydos.phonetic.mra.""" |
|
39
|
|
|
self.assertEqual(mra(''), '') |
|
40
|
|
|
|
|
41
|
|
|
# https://en.wikipedia.org/wiki/Match_rating_approach |
|
42
|
|
|
self.assertEqual(mra('Byrne'), 'BYRN') |
|
43
|
|
|
self.assertEqual(mra('Boern'), 'BRN') |
|
44
|
|
|
self.assertEqual(mra('Smith'), 'SMTH') |
|
45
|
|
|
self.assertEqual(mra('Smyth'), 'SMYTH') |
|
46
|
|
|
self.assertEqual(mra('Catherine'), 'CTHRN') |
|
47
|
|
|
self.assertEqual(mra('Kathryn'), 'KTHRYN') |
|
48
|
|
|
|
|
49
|
|
|
# length checks |
|
50
|
|
|
self.assertEqual(mra('Christopher'), 'CHRPHR') |
|
51
|
|
|
self.assertEqual(mra('Dickensianistic'), 'DCKSTC') |
|
52
|
|
|
self.assertEqual(mra('Acetylcholinesterase'), 'ACTTRS') |
|
53
|
|
|
|
|
54
|
|
|
|
|
55
|
|
|
if __name__ == '__main__': |
|
56
|
|
|
unittest.main() |
|
57
|
|
|
|