Completed
Push — master ( 8702ef...aa5044 )
by Osma
25s queued 17s
created

annif.analyzer.simplemma.SimplemmaAnalyzer.__getstate__()   A

Complexity

Conditions 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 5
Ratio 100 %

Importance

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