Passed
Pull Request — master (#591)
by Osma
06:35 queued 13s
created

annif.analyzer.simplemma   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 17
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A SimplemmaAnalyzer.__init__() 0 4 1
A SimplemmaAnalyzer._normalize_word() 0 2 1
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