]> git.openstreetmap.org Git - nominatim.git/blobdiff - nominatim/tokenizer/factory.py
Merge pull request #2906 from lonvia/move-data-dirs-into-module
[nominatim.git] / nominatim / tokenizer / factory.py
index 67e221949911b19dcd10943d5833f5430194da1d..d6bc51638019cd31281260a68402348f03954a13 100644 (file)
@@ -9,11 +9,11 @@ Functions for creating a tokenizer or initialising the right one for an
 existing database.
 
 A tokenizer is something that is bound to the lifetime of a database. It
-can be choosen and configured before the intial import but then needs to
+can be chosen and configured before the initial import but then needs to
 be used consistently when querying and updating the database.
 
 This module provides the functions to create and configure a new tokenizer
-as well as instanciating the appropriate tokenizer for updating an existing
+as well as instantiating the appropriate tokenizer for updating an existing
 database.
 
 A tokenizer usually also includes PHP code for querying. The appropriate PHP
@@ -55,6 +55,7 @@ def create_tokenizer(config: Configuration, init_db: bool = True,
         module_name = config.TOKENIZER
 
     # Create the directory for the tokenizer data
+    assert config.project_dir is not None
     basedir = config.project_dir / 'tokenizer'
     if not basedir.exists():
         basedir.mkdir()
@@ -80,6 +81,7 @@ def get_tokenizer_for_db(config: Configuration) -> AbstractTokenizer:
         The function looks up the appropriate tokenizer in the database
         and initialises it.
     """
+    assert config.project_dir is not None
     basedir = config.project_dir / 'tokenizer'
     if not basedir.is_dir():
         # Directory will be repopulated by tokenizer below.