Skip to content

Commit

Permalink
add penalty for single words that look like stop words
Browse files Browse the repository at this point in the history
  • Loading branch information
lonvia committed Mar 18, 2024
1 parent 07b7fd1 commit ff3230a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nominatim/api/search/db_search_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ def yield_lookups(self, name: TokenRange, address: List[TokenRange])\
name_fulls = self.query.get_tokens(name, TokenType.WORD)
if name_fulls:
fulls_count = sum(t.count for t in name_fulls)
if len(name_partials) == 1:
penalty += min(1, max(0, (exp_count - 50 * fulls_count) / (1000 * fulls_count)))
# At this point drop unindexed partials from the address.
# This might yield wrong results, nothing we can do about that.
if not partials_indexed:
Expand Down

0 comments on commit ff3230a

Please sign in to comment.