Skip to content

Commit

Permalink
trace for debugging weights
Browse files Browse the repository at this point in the history
  • Loading branch information
flammie committed Nov 15, 2024
1 parent 4a626b0 commit cfc1038
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions divvunspell/src/speller/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,15 @@ where
+ strsim::damerau_levenshtein(&word.as_str(), sugg.value());
let penalty_middle = reweight.mid_penalty * distance as f32;
let additional_weight = penalty_start + penalty_end + penalty_middle;
log::trace!("Penalty: +{} = {} + {} * {} + {}",
additional_weight, penalty_start, distance,
reweight.mid_penalty, penalty_end);

best.entry(sugg.value.clone())
.and_modify(|entry| {
let weight = sugg.weight + additional_weight;
log::trace!("Reweighting: {} = {} + {}", weight,
sugg.weight, additional_weight);
if entry as &_ > &weight {
*entry = weight
}
Expand Down

2 comments on commit cfc1038

@snomos
Copy link
Member

@snomos snomos commented on cfc1038 Nov 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice. Could you also add the lemma weight to the debug output?

@flammie
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah doog idea.

Please sign in to comment.