-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run "monkeytype apply --pep_563" on all modules
- Loading branch information
1 parent
4f6994b
commit f5f32dd
Showing
44 changed files
with
1,254 additions
and
386 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
"""Simple analyzer for Annif. Only folds words to lower case.""" | ||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING | ||
|
||
from . import analyzer | ||
|
||
|
||
class SimpleAnalyzer(analyzer.Analyzer): | ||
name = "simple" | ||
|
||
def __init__(self, param, **kwargs): | ||
def __init__(self, param: None, **kwargs) -> None: | ||
self.param = param | ||
super().__init__(**kwargs) | ||
|
||
def _normalize_word(self, word): | ||
def _normalize_word(self, word: str) -> str: | ||
return word.lower() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,22 @@ | ||
"""Snowball analyzer for Annif, based on nltk Snowball stemmer.""" | ||
from __future__ import annotations | ||
|
||
import functools | ||
from typing import TYPE_CHECKING | ||
|
||
from . import analyzer | ||
|
||
|
||
class SnowballAnalyzer(analyzer.Analyzer): | ||
name = "snowball" | ||
|
||
def __init__(self, param, **kwargs): | ||
def __init__(self, param: str, **kwargs) -> None: | ||
self.param = param | ||
import nltk.stem.snowball | ||
|
||
self.stemmer = nltk.stem.snowball.SnowballStemmer(param) | ||
super().__init__(**kwargs) | ||
|
||
@functools.lru_cache(maxsize=500000) | ||
def _normalize_word(self, word): | ||
def _normalize_word(self, word: str) -> str: | ||
return self.stemmer.stem(word.lower()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.