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_schinke. |
20
|
|
|
|
21
|
|
|
This module contains unit tests for abydos.stemmer.schinke |
22
|
|
|
""" |
23
|
|
|
|
24
|
|
|
from __future__ import unicode_literals |
25
|
|
|
|
26
|
|
|
import unittest |
27
|
|
|
|
28
|
|
|
from abydos.stemmer.schinke import schinke |
29
|
|
|
|
30
|
|
|
from .. import _corpus_file |
31
|
|
|
|
32
|
|
|
|
33
|
|
|
class SchinkeTestCases(unittest.TestCase): |
34
|
|
|
"""Test Schinke functions. |
35
|
|
|
|
36
|
|
|
abydos.stemmer.schinke |
37
|
|
|
""" |
38
|
|
|
|
39
|
|
|
def test_schinke(self): |
40
|
|
|
"""Test abydos.stemmer.schinke. |
41
|
|
|
|
42
|
|
|
These tests are copied from the Snowball testset at |
43
|
|
|
http://snowball.tartarus.org/otherapps/schinke/schinke.tgz |
44
|
|
|
""" |
45
|
|
|
with open(_corpus_file('snowball_schinke.csv')) as schinke_ts: |
46
|
|
|
for schinke_line in schinke_ts: |
47
|
|
|
word, noun, verb = schinke_line.strip().split(',') |
48
|
|
|
nv = schinke(word) |
49
|
|
|
self.assertEqual(nv['n'], noun) |
50
|
|
|
self.assertEqual(nv['v'], verb) |
51
|
|
|
|
52
|
|
|
|
53
|
|
|
if __name__ == '__main__': |
54
|
|
|
unittest.main() |
55
|
|
|
|