| Conditions | 3 |
| Total Lines | 13 |
| Code Lines | 12 |
| Lines | 13 |
| Ratio | 100 % |
| Changes | 0 | ||
| 1 | """spaCy analyzer for Annif which uses spaCy for lemmatization""" |
||
| 14 | def __init__(self, param, **kwargs): |
||
| 15 | self.param = param |
||
| 16 | try: |
||
| 17 | self.nlp = spacy.load(param, exclude=['ner', 'parser']) |
||
| 18 | except IOError as err: |
||
| 19 | raise OperationFailedException( |
||
| 20 | f"Loading spaCy model '{param}' failed - " + |
||
| 21 | f"please download the model.\n{err}") |
||
| 22 | if _KEY_LOWERCASE in kwargs: |
||
| 23 | self.lowercase = annif.util.boolean(kwargs[_KEY_LOWERCASE]) |
||
| 24 | else: |
||
| 25 | self.lowercase = False |
||
| 26 | super().__init__(**kwargs) |
||
| 27 | |||
| 37 |