Passed
Pull Request — master (#591)
by Osma
03:16
created

SimplemmaAnalyzer.__init__()   A

Complexity

Conditions 1

Size

Total Lines 4
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nop 3
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
"""Simplemma analyzer for Annif, based on simplemma lemmatizer."""
2
3
import simplemma
4
from . import analyzer
5
6
7
class SimplemmaAnalyzer(analyzer.Analyzer):
8
    name = "simplemma"
9
10
    def __init__(self, param, **kwargs):
11
        self.lang = param
12
        self.langdata = simplemma.load_data(self.lang)
13
        super().__init__(**kwargs)
14
15
    def _normalize_word(self, word):
16
        return simplemma.lemmatize(word, self.langdata)
17