X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/554d25e2e508c57fe763cee95b574b8e7c66eb0b..dbaf215feacb6ca82ec8c1bf3821ba5ebf218778:/nominatim/clicmd/special_phrases.py?ds=sidebyside diff --git a/nominatim/clicmd/special_phrases.py b/nominatim/clicmd/special_phrases.py index 626c0053..a2c346de 100644 --- a/nominatim/clicmd/special_phrases.py +++ b/nominatim/clicmd/special_phrases.py @@ -1,3 +1,9 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# This file is part of Nominatim. (https://nominatim.org) +# +# Copyright (C) 2022 by the Nominatim developer community. +# For a full list of authors see the git log. """ Implementation of the 'special-phrases' command. """ @@ -35,6 +41,13 @@ class ImportSpecialPhrases: An example file can be found in the Nominatim sources at 'test/testdb/full_en_phrases_test.csv'. + + The import can be further configured to ignore specific key/value pairs. + This is particularly useful when importing phrases from the wiki. The + default configuration excludes some very common tags like building=yes. + The configuration can be customized by putting a file `phrase-settings.json` + with custom rules into the project directory or by using the `--config` + option to point to another configuration file. """ @staticmethod def add_args(parser): @@ -45,6 +58,9 @@ class ImportSpecialPhrases: help='Import special phrases from a CSV file') group.add_argument('--no-replace', action='store_true', help='Keep the old phrases and only add the new ones') + group.add_argument('--config', action='store', + help='Configuration file for black/white listing ' + '(default: phrase-settings.json)') @staticmethod def run(args): @@ -72,5 +88,5 @@ class ImportSpecialPhrases: should_replace = not args.no_replace with connect(args.config.get_libpq_dsn()) as db_connection: SPImporter( - args.config, args.phplib_dir, db_connection, loader + args.config, db_connection, loader ).import_phrases(tokenizer, should_replace)