Skip to content

Commit

Permalink
Simplify logic in PartialMatchRanker
Browse files Browse the repository at this point in the history
  • Loading branch information
thobson88 committed Dec 18, 2024
1 parent e84bd55 commit 2a41a29
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions t_res/geoparser/ranking.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,13 +335,7 @@ def matches(self, query: str) -> List[StringMatch]:
lambda row: self.matching_score(query, row), axis=1
)
mention_df = mention_df.dropna()

# currently hardcoded cutoff
top_scores = sorted(
list(set(list(mention_df["score"].unique()))), reverse=True
)[:1]

mention_df = mention_df[mention_df["score"].isin(top_scores)]
mention_df = mention_df.query('score == score.max()')
cands_dict = mention_df.set_index("mentions").to_dict()["score"]
matches = [StringMatch(k, v) for (k, v) in cands_dict.items()]
return matches
Expand Down

0 comments on commit 2a41a29

Please sign in to comment.