if TYPE_CHECKING:
from .query import Phrase, QueryStruct
+
class AbstractQueryAnalyzer(ABC):
""" Class for analysing incoming queries.
""" Analyze the given phrases and return the tokenized query.
"""
-
@abstractmethod
def normalize_text(self, text: str) -> str:
""" Bring the given text into a normalized form. That is the
"""
-
async def make_query_analyzer(conn: SearchConnection) -> AbstractQueryAnalyzer:
""" Create a query analyzer for the tokenizer used by the database.
"""
log().comment(f"No tokenizer named '{name}' available. Database not set up properly.")
raise RuntimeError('Tokenizer not found')
- module = importlib.import_module(f'nominatim_api.api.search.{name}_tokenizer')
+ module = importlib.import_module(f'nominatim_api.search.{name}_tokenizer')
return cast(AbstractQueryAnalyzer, await module.create_query_analyzer(conn))