X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/f542d65da63cea44b2059913c4bb1c6550506449..a234d606c9dcd76db1d69909bb78940d3dbcd862:/nominatim/tokenizer/icu_tokenizer.py diff --git a/nominatim/tokenizer/icu_tokenizer.py b/nominatim/tokenizer/icu_tokenizer.py index 5a90edf5..c1821d7e 100644 --- a/nominatim/tokenizer/icu_tokenizer.py +++ b/nominatim/tokenizer/icu_tokenizer.py @@ -214,19 +214,20 @@ class ICUTokenizer(AbstractTokenizer): return list(s[0].split('@')[0] for s in cur) - def _install_php(self, phpdir: Path, overwrite: bool = True) -> None: + def _install_php(self, phpdir: Optional[Path], overwrite: bool = True) -> None: """ Install the php script for the tokenizer. """ - assert self.loader is not None - php_file = self.data_dir / "tokenizer.php" + if phpdir is not None: + assert self.loader is not None + php_file = self.data_dir / "tokenizer.php" - if not php_file.exists() or overwrite: - php_file.write_text(dedent(f"""\ - None: @@ -285,7 +286,7 @@ class ICUTokenizer(AbstractTokenizer): def _create_lookup_indices(self, config: Configuration, table_name: str) -> None: - """ Create addtional indexes used when running the API. + """ Create additional indexes used when running the API. """ with connect(self.dsn) as conn: sqlp = SQLPreprocessor(conn, config)