mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-16 15:47:58 +00:00
penalize name token splitting when phrases are used
This commit is contained in:
@@ -310,7 +310,8 @@ class _TokenSequence:
|
|||||||
if (not base.housenumber or first.end >= base.housenumber.start)\
|
if (not base.housenumber or first.end >= base.housenumber.start)\
|
||||||
and (not base.qualifier or first.start >= base.qualifier.end):
|
and (not base.qualifier or first.start >= base.qualifier.end):
|
||||||
base_penalty = self.penalty
|
base_penalty = self.penalty
|
||||||
if base.housenumber and base.housenumber.start > first.start:
|
if (base.housenumber and base.housenumber.start > first.start) \
|
||||||
|
or len(query.source) > 1:
|
||||||
base_penalty += 0.25
|
base_penalty += 0.25
|
||||||
for i in range(first.start + 1, first.end):
|
for i in range(first.start + 1, first.end):
|
||||||
name, addr = first.split(i)
|
name, addr = first.split(i)
|
||||||
@@ -327,6 +328,8 @@ class _TokenSequence:
|
|||||||
base_penalty = self.penalty
|
base_penalty = self.penalty
|
||||||
if base.housenumber and base.housenumber.start < last.start:
|
if base.housenumber and base.housenumber.start < last.start:
|
||||||
base_penalty += 0.4
|
base_penalty += 0.4
|
||||||
|
if len(query.source) > 1:
|
||||||
|
base_penalty += 0.25
|
||||||
for i in range(last.start + 1, last.end):
|
for i in range(last.start + 1, last.end):
|
||||||
addr, name = last.split(i)
|
addr, name = last.split(i)
|
||||||
penalty = base_penalty + PENALTY_TOKENCHANGE[query.nodes[i].btype]
|
penalty = base_penalty + PENALTY_TOKENCHANGE[query.nodes[i].btype]
|
||||||
|
|||||||
Reference in New Issue
Block a user