3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-03 01:48:38 +02:00

Spinach: remove ^(THE|A|AN) in answer normalization; fix rolling average score calculation

This commit is contained in:
Pragmatic Software 2019-04-26 22:20:54 -07:00
parent c15740a820
commit 9707e133ff

View File

@ -1367,9 +1367,10 @@ sub commify {
sub normalize_text {
my ($self, $text) = @_;
$text=~ s/&/ AND /g;
$text =~ s/^\s+|\s+$//g;
$text =~ s/\s+/ /g;
$text =~ s/&/ AND /g;
$text =~ s/^(the|a|an) //i;
$text = lc substr($text, 0, 80);
@ -2028,6 +2029,7 @@ sub showfinalscore {
$player_data = $self->{stats}->get_player_data($player_id);
$player_data->{games_played}++;
$player_data->{avg_score} *= $player_data->{games_played} - 1;
$player_data->{avg_score} += $player->{score};
$player_data->{avg_score} /= $player_data->{games_played};
$player_data->{low_score} = $player->{score} if $player_data->{low_score} == 0;