docs: fix typos

This commit is contained in:
Kian-Meng Ang
2022-07-20 22:05:25 +08:00
parent b7f6c7c76a
commit f5e52e748f
44 changed files with 64 additions and 64 deletions

View File

@@ -185,7 +185,7 @@ class Configuration:
config: Optional[str] = None) -> Any:
""" Load additional configuration from a file. `filename` is the name
of the configuration file. The file is first searched in the
project directory and then in the global settings dirctory.
project directory and then in the global settings directory.
If `config` is set, then the name of the configuration file can
be additionally given through a .env configuration option. When
@@ -266,7 +266,7 @@ class Configuration:
""" Handler for the '!include' operator in YAML files.
When the filename is relative, then the file is first searched in the
project directory and then in the global settings dirctory.
project directory and then in the global settings directory.
"""
fname = loader.construct_scalar(node)

View File

@@ -63,7 +63,7 @@ class Cursor(psycopg2.extras.DictCursor):
def drop_table(self, name: str, if_exists: bool = True, cascade: bool = False) -> None:
""" Drop the table with the given name.
Set `if_exists` to False if a non-existant table should raise
Set `if_exists` to False if a non-existent table should raise
an exception instead of just being ignored. If 'cascade' is set
to True then all dependent tables are deleted as well.
"""
@@ -141,7 +141,7 @@ class Connection(psycopg2.extensions.connection):
def drop_table(self, name: str, if_exists: bool = True, cascade: bool = False) -> None:
""" Drop the table with the given name.
Set `if_exists` to False if a non-existant table should raise
Set `if_exists` to False if a non-existent table should raise
an exception instead of just being ignored.
"""
with self.cursor() as cur:

View File

@@ -12,7 +12,7 @@ from typing import Optional, cast
from nominatim.db.connection import Connection
def set_property(conn: Connection, name: str, value: str) -> None:
""" Add or replace the propery with the given name.
""" Add or replace the property with the given name.
"""
with conn.cursor() as cur:
cur.execute('SELECT value FROM nominatim_properties WHERE property = %s',

View File

@@ -175,7 +175,7 @@ class Indexer:
def index_postcodes(self) -> None:
"""Index the entries ofthe location_postcode table.
"""Index the entries of the location_postcode table.
"""
LOG.warning("Starting indexing postcodes using %s threads", self.num_threads)
@@ -221,7 +221,7 @@ class Indexer:
# asynchronously get the next batch
has_more = fetcher.fetch_next_batch(cur, runner)
# And insert the curent batch
# And insert the current batch
for idx in range(0, len(places), batch):
part = places[idx:idx + batch]
LOG.debug("Processing places: %s", str(part))

View File

@@ -18,7 +18,7 @@ class ProgressLogger:
""" Tracks and prints progress for the indexing process.
`name` is the name of the indexing step being tracked.
`total` sets up the total number of items that need processing.
`log_interval` denotes the interval in seconds at which progres
`log_interval` denotes the interval in seconds at which progress
should be reported.
"""

View File

@@ -5,7 +5,7 @@
# Copyright (C) 2022 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Abstract class defintions for tokenizers. These base classes are here
Abstract class definitions for tokenizers. These base classes are here
mainly for documentation purposes.
"""
from abc import ABC, abstractmethod
@@ -113,7 +113,7 @@ class AbstractAnalyzer(ABC):
the search index.
Arguments:
place: Place information retrived from the database.
place: Place information retrieved from the database.
Returns:
A JSON-serialisable structure that will be handed into
@@ -141,7 +141,7 @@ class AbstractTokenizer(ABC):
init_db: When set to False, then initialisation of database
tables should be skipped. This option is only required for
migration purposes and can be savely ignored by custom
migration purposes and can be safely ignored by custom
tokenizers.
TODO: can we move the init_db parameter somewhere else?

View 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

View File

@@ -38,7 +38,7 @@ def create(dsn: str, data_dir: Path) -> 'ICUTokenizer':
class ICUTokenizer(AbstractTokenizer):
""" This tokenizer uses libICU to covert names and queries to ASCII.
""" This tokenizer uses libICU to convert names and queries to ASCII.
Otherwise it uses the same algorithms and data structures as the
normalization routines in Nominatim 3.
"""
@@ -431,7 +431,7 @@ class ICUNameAnalyzer(AbstractAnalyzer):
def _remove_special_phrases(self, cursor: Cursor,
new_phrases: Set[Tuple[str, str, str, str]],
existing_phrases: Set[Tuple[str, str, str, str]]) -> int:
""" Remove all phrases from the databse that are no longer in the
""" Remove all phrases from the database that are no longer in the
new phrase list.
"""
to_delete = existing_phrases - new_phrases
@@ -620,7 +620,7 @@ class ICUNameAnalyzer(AbstractAnalyzer):
def _retrieve_full_tokens(self, name: str) -> List[int]:
""" Get the full name token for the given name, if it exists.
The name is only retrived for the standard analyser.
The name is only retrieved for the standard analyser.
"""
assert self.conn is not None
norm_name = self._search_normalized(name)

View File

@@ -59,7 +59,7 @@ class _PostcodeSanitizer:
def scan(self, postcode: str, country: Optional[str]) -> Optional[Tuple[str, str]]:
""" Check the postcode for correct formatting and return the
normalized version. Returns None if the postcode does not
correspond to the oficial format of the given country.
correspond to the official format of the given country.
"""
match = self.matcher.match(country, postcode)
if match is None:

View File

@@ -90,7 +90,7 @@ class SanitizerConfig(_BaseUserDict):
True when the item passes the filter.
If the parameter is empty, the filter lets all items pass. If the
paramter is a string, it is interpreted as a single regular expression
parameter is a string, it is interpreted as a single regular expression
that must match the full kind string. If the parameter is a list then
any of the regular expressions in the list must match to pass.
"""

View File

@@ -58,7 +58,7 @@ def get_variant_config(in_rules: Any,
class _VariantMaker:
""" Generater for all necessary ICUVariants from a single variant rule.
""" Generator for all necessary ICUVariants from a single variant rule.
All text in rules is normalized to make sure the variants match later.
"""

View File

@@ -23,7 +23,7 @@ def _zigzag(outer: Iterable[str], inner: Iterable[str]) -> Iterator[str]:
class MutationVariantGenerator:
""" Generates name variants by applying a regular expression to the name
and replacing it with one or more variants. When the regular expression
matches more than once, each occurence is replaced with all replacement
matches more than once, each occurrence is replaced with all replacement
patterns.
"""

View File

@@ -163,7 +163,7 @@ def check_placex_table(conn: Connection, config: Configuration) -> CheckResult:
return CheckState.FATAL, dict(config=config)
@_check(hint="""placex table has no data. Did the import finish sucessfully?""")
@_check(hint="""placex table has no data. Did the import finish successfully?""")
def check_placex_size(conn: Connection, _: Configuration) -> CheckResult:
""" Checking for placex content
"""
@@ -181,7 +181,7 @@ def check_tokenizer(_: Connection, config: Configuration) -> CheckResult:
tokenizer = tokenizer_factory.get_tokenizer_for_db(config)
except UsageError:
return CheckState.FAIL, dict(msg="""\
Cannot load tokenizer. Did the import finish sucessfully?""")
Cannot load tokenizer. Did the import finish successfully?""")
result = tokenizer.check_database(config)

View File

@@ -53,7 +53,7 @@ def migrate(config: Configuration, paths: Any) -> int:
for version, func in _MIGRATION_FUNCTIONS:
if db_version <= version:
title = func.__doc__ or ''
LOG.warning("Runnning: %s (%s)", title.split('\n', 1)[0],
LOG.warning("Running: %s (%s)", title.split('\n', 1)[0],
version_str(version))
kwargs = dict(conn=conn, config=config, paths=paths)
func(**kwargs)
@@ -241,7 +241,7 @@ def create_interpolation_index_on_place(conn: Connection, **_: Any) -> None:
def add_step_column_for_interpolation(conn: Connection, **_: Any) -> None:
""" Add a new column 'step' to the interpolations table.
Also convers the data into the stricter format which requires that
Also converts the data into the stricter format which requires that
startnumbers comply with the odd/even requirements.
"""
if conn.table_has_column('location_property_osmline', 'step'):

View File

@@ -126,7 +126,7 @@ PHP_CONST_DEFS = (
def import_wikipedia_articles(dsn: str, data_path: Path, ignore_errors: bool = False) -> int:
""" Replaces the wikipedia importance tables with new data.
The import is run in a single transaction so that the new data
is replace seemlessly.
is replace seamlessly.
Returns 0 if all was well and 1 if the importance file could not
be found. Throws an exception if there was an error reading the file.

View File

@@ -59,7 +59,7 @@ class SPImporter():
self.black_list, self.white_list = self._load_white_and_black_lists()
self.sanity_check_pattern = re.compile(r'^\w+$')
# This set will contain all existing phrases to be added.
# It contains tuples with the following format: (lable, class, type, operator)
# It contains tuples with the following format: (label, class, type, operator)
self.word_phrases: Set[Tuple[str, str, str, str]] = set()
# This set will contain all existing place_classtype tables which doesn't match any
# special phrases class/type on the wiki.

View File

@@ -11,7 +11,7 @@ Complex type definitions are moved here, to keep the source files readable.
"""
from typing import Any, Union, Mapping, TypeVar, Sequence, TYPE_CHECKING
# Generics varaible names do not confirm to naming styles, ignore globally here.
# Generics variable names do not confirm to naming styles, ignore globally here.
# pylint: disable=invalid-name,abstract-method,multiple-statements
# pylint: disable=missing-class-docstring,useless-import-alias

View File

@@ -30,7 +30,7 @@ NOMINATIM_VERSION = (4, 0, 99, 6)
POSTGRESQL_REQUIRED_VERSION = (9, 5)
POSTGIS_REQUIRED_VERSION = (2, 2)
# Cmake sets a variabe @GIT_HASH@ by executing 'git --log'. It is not run
# Cmake sets a variable @GIT_HASH@ by executing 'git --log'. It is not run
# on every execution of 'make'.
# cmake/tool-installed.tmpl is used to build the binary 'nominatim'. Inside
# there is a call to set the variable value below.