| Total Complexity | 2 | 
| Total Lines | 19 | 
| Duplicated Lines | 57.89 % | 
| Changes | 0 | ||
Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
| 1 | """Simplemma analyzer for Annif, based on simplemma lemmatizer."""  | 
            ||
| 2 | |||
| 3 | import functools  | 
            ||
| 4 | import simplemma  | 
            ||
| 5 | from . import analyzer  | 
            ||
| 6 | |||
| 7 | |||
| 8 | View Code Duplication | class SimplemmaAnalyzer(analyzer.Analyzer):  | 
            |
| 
                                                                                                    
                        
                         | 
                |||
| 9 | name = "simplemma"  | 
            ||
| 10 | |||
| 11 | def __init__(self, param, **kwargs):  | 
            ||
| 12 | self.lang = param  | 
            ||
| 13 | self.langdata = simplemma.load_data(self.lang)  | 
            ||
| 14 | super().__init__(**kwargs)  | 
            ||
| 15 | |||
| 16 | @functools.lru_cache(maxsize=500000)  | 
            ||
| 17 | def _normalize_word(self, word):  | 
            ||
| 18 | return simplemma.lemmatize(word, self.langdata)  | 
            ||
| 19 |