mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
housenumber and postcode cross penalties for partials
This commit is contained in:
@@ -309,6 +309,9 @@ class ICUQueryAnalyzer(AbstractQueryAnalyzer):
|
|||||||
len(query.nodes[end].term_lookup) > 4):
|
len(query.nodes[end].term_lookup) > 4):
|
||||||
for token in tokens:
|
for token in tokens:
|
||||||
token.penalty += 0.39
|
token.penalty += 0.39
|
||||||
|
if (start + 1 == end):
|
||||||
|
if partial := query.nodes[start].partial:
|
||||||
|
partial.penalty += 0.39
|
||||||
|
|
||||||
# If it looks like a simple housenumber, prefer that.
|
# If it looks like a simple housenumber, prefer that.
|
||||||
if qmod.TOKEN_HOUSENUMBER in tlist:
|
if qmod.TOKEN_HOUSENUMBER in tlist:
|
||||||
@@ -319,6 +322,9 @@ class ICUQueryAnalyzer(AbstractQueryAnalyzer):
|
|||||||
if ttype != qmod.TOKEN_HOUSENUMBER:
|
if ttype != qmod.TOKEN_HOUSENUMBER:
|
||||||
for token in tokens:
|
for token in tokens:
|
||||||
token.penalty += penalty
|
token.penalty += penalty
|
||||||
|
if (start + 1 == end):
|
||||||
|
if partial := query.nodes[start].partial:
|
||||||
|
partial.penalty += penalty
|
||||||
|
|
||||||
# rerank tokens against the normalized form
|
# rerank tokens against the normalized form
|
||||||
norm = ''.join(f"{n.term_normalized}{'' if n.btype == qmod.BREAK_TOKEN else ' '}"
|
norm = ''.join(f"{n.term_normalized}{'' if n.btype == qmod.BREAK_TOKEN else ' '}"
|
||||||
|
|||||||
Reference in New Issue
Block a user