| Total Complexity | 2 |
| Total Lines | 19 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | """Simplemma analyzer for Annif, based on simplemma lemmatizer.""" |
||
| 2 | |||
| 3 | from __future__ import annotations |
||
| 4 | |||
| 5 | import annif.simplemma_util |
||
| 6 | |||
| 7 | from . import analyzer |
||
| 8 | |||
| 9 | |||
| 10 | class SimplemmaAnalyzer(analyzer.Analyzer): |
||
| 11 | name = "simplemma" |
||
| 12 | |||
| 13 | def __init__(self, param: str, **kwargs) -> None: |
||
| 14 | self.lang = param |
||
| 15 | super().__init__(**kwargs) |
||
| 16 | |||
| 17 | def _normalize_word(self, word: str) -> str: |
||
| 18 | return annif.simplemma_util.lemmatizer.lemmatize(word, lang=self.lang) |
||
| 19 |