Completed
Branch master (87ccc1)
by Chris
10:18
created

tests.stemmer.test_stemmer_s_stemmer   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 23
dl 0
loc 63
rs 10
c 0
b 0
f 0
wmc 1
1
# -*- coding: utf-8 -*-
2
3
# Copyright 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_stemmer.
20
21
This module contains unit tests for abydos.stemmer
22
"""
23
24
from __future__ import unicode_literals
25
26
import unittest
27
28
from abydos.stemmer.s_stemmer import s_stemmer
29
30
31
class SStemmerTestCases(unittest.TestCase):
32
    """Test S-stemmer functions.
33
34
    abydos.stemmer.s_stemmer
35
    """
36
37
    def test_s_stemmer(self):
38
        """Test abydos.stemmer.s_stemmer."""
39
        # Base case
40
        self.assertEqual(s_stemmer(''), '')
41
42
        # Tests from Harman paper
43
        self.assertEqual(s_stemmer('panels'), 'panel')
44
        self.assertEqual(s_stemmer('subjected'), 'subjected')
45
        self.assertEqual(s_stemmer('aerodynamics'), 'aerodynamic')
46
        self.assertEqual(s_stemmer('heating'), 'heating')
47
48
        # Additional tests to complete coverage
49
        self.assertEqual(s_stemmer('dairies'), 'dairy')
50
        self.assertEqual(s_stemmer('census'), 'census')
51
        self.assertEqual(s_stemmer('boss'), 'boss')
52
        self.assertEqual(s_stemmer('bosses'), 'bosse')
53
        self.assertEqual(s_stemmer('raises'), 'raise')
54
        self.assertEqual(s_stemmer('fees'), 'fee')
55
        self.assertEqual(s_stemmer('attourneies'), 'attourneie')
56
        self.assertEqual(s_stemmer('portemonnaies'), 'portemonnaie')
57
        self.assertEqual(s_stemmer('foes'), 'foe')
58
        self.assertEqual(s_stemmer('sundaes'), 'sundae')
59
60
61
if __name__ == '__main__':
62
    unittest.main()
63