Stick with the American spelling of Analyze.
from nominatim.errors import UsageError
from nominatim.tokenizer.place_sanitizer import PlaceSanitizer
from nominatim.tokenizer.icu_token_analysis import ICUTokenAnalysis
from nominatim.errors import UsageError
from nominatim.tokenizer.place_sanitizer import PlaceSanitizer
from nominatim.tokenizer.icu_token_analysis import ICUTokenAnalysis
-from nominatim.tokenizer.token_analysis.base import AnalysisModule, Analyser
+from nominatim.tokenizer.token_analysis.base import AnalysisModule, Analyzer
import nominatim.data.country_info
LOG = logging.getLogger()
import nominatim.data.country_info
LOG = logging.getLogger()
- def create(self, normalizer: Any, transliterator: Any) -> Analyser:
+ def create(self, normalizer: Any, transliterator: Any) -> Analyzer:
""" Create a new analyser instance for the given rule.
"""
return self._analysis_mod.create(normalizer, transliterator, self.config)
""" Create a new analyser instance for the given rule.
"""
return self._analysis_mod.create(normalizer, transliterator, self.config)
from typing import Mapping, Optional, TYPE_CHECKING
from icu import Transliterator
from typing import Mapping, Optional, TYPE_CHECKING
from icu import Transliterator
-from nominatim.tokenizer.token_analysis.base import Analyser
+from nominatim.tokenizer.token_analysis.base import Analyzer
if TYPE_CHECKING:
from typing import Any
if TYPE_CHECKING:
from typing import Any
class ICUTokenAnalysis:
""" Container class collecting the transliterators and token analysis
class ICUTokenAnalysis:
""" Container class collecting the transliterators and token analysis
- modules for a single NameAnalyser instance.
+ modules for a single Analyser instance.
"""
def __init__(self, norm_rules: str, trans_rules: str,
"""
def __init__(self, norm_rules: str, trans_rules: str,
for name, arules in analysis_rules.items()}
for name, arules in analysis_rules.items()}
- def get_analyzer(self, name: Optional[str]) -> Analyser:
+ def get_analyzer(self, name: Optional[str]) -> Analyzer:
""" Return the given named analyzer. If no analyzer with that
name exists, return the default analyzer.
"""
""" Return the given named analyzer. If no analyzer with that
name exists, return the default analyzer.
"""
from nominatim.typing import Protocol
from nominatim.typing import Protocol
-class Analyser(Protocol):
+class Analyzer(Protocol):
""" The `create()` function of an analysis module needs to return an
object that implements the following functions.
"""
""" The `create()` function of an analysis module needs to return an
object that implements the following functions.
"""
used freely by the analysis module as needed.
"""
used freely by the analysis module as needed.
"""
- def create(self, normalizer: Any, transliterator: Any, config: Any) -> Analyser:
+ def create(self, normalizer: Any, transliterator: Any, config: Any) -> Analyzer:
""" Create a new instance of the analyser.
A separate instance of the analyser is created for each thread
when used in multi-threading context.
""" Create a new instance of the analyser.
A separate instance of the analyser is created for each thread
when used in multi-threading context.
config: The object that was returned by the call to configure().
Returns:
config: The object that was returned by the call to configure().
Returns:
- A new analyzer instance. This must be a class that implements
- the Analyser protocol.
+ A new analyzer instance. This must be an object that implements
+ the Analyzer protocol.