Merge pull request #3342 from mtmail/tyops

Correct some typos
This commit is contained in:
Sarah Hoffmann
2024-02-28 14:25:16 +01:00
committed by GitHub
45 changed files with 80 additions and 80 deletions

View File

@@ -94,7 +94,7 @@ class RankedTokens:
def with_token(self, t: Token, transition_penalty: float) -> 'RankedTokens':
""" Create a new RankedTokens list with the given token appended.
The tokens penalty as well as the given transision penalty
The tokens penalty as well as the given transition penalty
are added to the overall penalty.
"""
return RankedTokens(self.penalty + t.penalty + transition_penalty,

View File

@@ -5,7 +5,7 @@
# Copyright (C) 2023 by the Nominatim developer community.
# For a full list of authors see the git log.
"""
Implementation of the acutal database accesses for forward search.
Implementation of the actual database accesses for forward search.
"""
from typing import List, Tuple, AsyncIterator, Dict, Any, Callable, cast
import abc

View File

@@ -44,7 +44,7 @@ class LegacyToken(qmod.Token):
@property
def info(self) -> Dict[str, Any]:
""" Dictionary of additional propoerties of the token.
""" Dictionary of additional properties of the token.
Should only be used for debugging purposes.
"""
return {'category': self.category,

View File

@@ -169,7 +169,7 @@ class TokenList:
@dataclasses.dataclass
class QueryNode:
""" A node of the querry representing a break between terms.
""" A node of the query representing a break between terms.
"""
btype: BreakType
ptype: PhraseType

View File

@@ -19,7 +19,7 @@ if TYPE_CHECKING:
from nominatim.api.search.query import Phrase, QueryStruct
class AbstractQueryAnalyzer(ABC):
""" Class for analysing incomming queries.
""" Class for analysing incoming queries.
Query analyzers are tied to the tokenizer used on import.
"""

View File

@@ -72,7 +72,7 @@ class TokenAssignment: # pylint: disable=too-many-instance-attributes
class _TokenSequence:
""" Working state used to put together the token assignements.
""" Working state used to put together the token assignments.
Represents an intermediate state while traversing the tokenized
query.
@@ -132,7 +132,7 @@ class _TokenSequence:
# Name tokens are always acceptable and don't change direction
if ttype == qmod.TokenType.PARTIAL:
# qualifiers cannot appear in the middle of the qeury. They need
# qualifiers cannot appear in the middle of the query. They need
# to be near the next phrase.
if self.direction == -1 \
and any(t.ttype == qmod.TokenType.QUALIFIER for t in self.seq[:-1]):
@@ -238,10 +238,10 @@ class _TokenSequence:
def recheck_sequence(self) -> bool:
""" Check that the sequence is a fully valid token assignment
and addapt direction and penalties further if necessary.
and adapt direction and penalties further if necessary.
This function catches some impossible assignments that need
forward context and can therefore not be exluded when building
forward context and can therefore not be excluded when building
the assignment.
"""
# housenumbers may not be further than 2 words from the beginning.
@@ -277,10 +277,10 @@ class _TokenSequence:
# <address>,<postcode> should give preference to address search
if base.postcode.start == 0:
penalty = self.penalty
self.direction = -1 # name searches are only possbile backwards
self.direction = -1 # name searches are only possible backwards
else:
penalty = self.penalty + 0.1
self.direction = 1 # name searches are only possbile forwards
self.direction = 1 # name searches are only possible forwards
yield dataclasses.replace(base, penalty=penalty)