Skip to content

Commit

Permalink
Fix issue where long strings would result in error (#7)
Browse files Browse the repository at this point in the history
Co-authored-by: Raoul Schram <r.d.schram@uu.nl>
  • Loading branch information
qubixes and qubixes authored Oct 3, 2023
1 parent 049206c commit fc9cbdf
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions regexmodel/regexclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ def score(series: pl.Series, regex: BaseRegex, count_thres: int,
fraction_cover = n_unique/regex.n_possible

expected_finish = fraction_match**avg_len_next*next_not_null
expected_finish = max(1e-12, expected_finish)
split_penalty = 1/(1 + count_thres/expected_finish)
cur_score = regex.subrange_penalty*split_penalty*fraction_cover*fraction_match
return cur_score, next_series, first_char
Expand Down

0 comments on commit fc9cbdf

Please sign in to comment.