Made score ratios much more consistent across the board
This commit is contained in:
parent
a15ae0fd11
commit
165cb7bc42
|
|
@ -14,7 +14,7 @@ job_range = "AllJobs" # Note that the first row is headers
|
|||
point_range = "PointRange"
|
||||
|
||||
# How tolerant of spelling errors in names to be
|
||||
SHEET_LOOKUP_THRESHOLD = 0.8
|
||||
SHEET_LOOKUP_THRESHOLD = 80.0
|
||||
|
||||
JOB_VAL = 1
|
||||
LATE_VAL = 0.5
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import slack_util
|
|||
|
||||
SHEET_ID = "1lPj9GjB00BuIq9GelOWh5GmiGsheLlowPnHLnWBvMOM"
|
||||
|
||||
MIN_RATIO = 0.8
|
||||
MIN_RATIO = 80.0
|
||||
|
||||
|
||||
def alert_user(slack: SlackClient, brother: scroll_util.Brother, saywhat: str) -> None:
|
||||
|
|
|
|||
|
|
@ -51,10 +51,7 @@ async def scroll_callback(slack: SlackClient, msg: dict, match: Match) -> None:
|
|||
sn = int(query)
|
||||
result = find_by_scroll(sn)
|
||||
except ValueError:
|
||||
try:
|
||||
result = await find_by_name(query)
|
||||
except BrotherNotFound:
|
||||
pass
|
||||
result = await find_by_name(query)
|
||||
if result:
|
||||
result = "Brother {} has scroll {}".format(result.name, result.scroll)
|
||||
else:
|
||||
|
|
@ -96,9 +93,9 @@ async def find_by_name(name: str, threshold: Optional[float] = None) -> Brother:
|
|||
|
||||
# Do fuzzy match
|
||||
found, score = process.extractOne(name, all_names)
|
||||
score = score / 100.0
|
||||
found_index = all_names.index(found)
|
||||
found_brother = brothers[found_index]
|
||||
print(score)
|
||||
if (not threshold) or score > threshold:
|
||||
return found_brother
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in New Issue