2 Implementation of the 'special-phrases' command.
5 from nominatim.tools import SpecialPhrasesImporter
6 from nominatim.db.connection import connect
8 LOG = logging.getLogger()
10 # Do not repeat documentation of subcommand classes.
11 # pylint: disable=C0111
13 class ImportSpecialPhrases:
15 Import special phrases.
19 group = parser.add_argument_group('Input arguments')
20 group.add_argument('--import-from-wiki', action='store_true',
21 help='Import special phrases from the OSM wiki to the database.')
25 from ..tokenizer import factory as tokenizer_factory
27 if args.import_from_wiki:
28 LOG.warning('Special phrases importation starting')
29 tokenizer = tokenizer_factory.get_tokenizer_for_db(args.config)
30 with connect(args.config.get_libpq_dsn()) as db_connection:
31 SpecialPhrasesImporter(
32 args.config, args.phplib_dir, db_connection
33 ).import_from_wiki(tokenizer)