mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-20 02:49:49 +01:00
Spinach: remove ^(THE|A|AN) in answer normalization; fix rolling average score calculation
This commit is contained in:
parent
c15740a820
commit
9707e133ff
@ -1367,9 +1367,10 @@ sub commify {
|
|||||||
sub normalize_text {
|
sub normalize_text {
|
||||||
my ($self, $text) = @_;
|
my ($self, $text) = @_;
|
||||||
|
|
||||||
$text=~ s/&/ AND /g;
|
|
||||||
$text =~ s/^\s+|\s+$//g;
|
$text =~ s/^\s+|\s+$//g;
|
||||||
$text =~ s/\s+/ /g;
|
$text =~ s/\s+/ /g;
|
||||||
|
$text =~ s/&/ AND /g;
|
||||||
|
$text =~ s/^(the|a|an) //i;
|
||||||
|
|
||||||
$text = lc substr($text, 0, 80);
|
$text = lc substr($text, 0, 80);
|
||||||
|
|
||||||
@ -2028,6 +2029,7 @@ sub showfinalscore {
|
|||||||
$player_data = $self->{stats}->get_player_data($player_id);
|
$player_data = $self->{stats}->get_player_data($player_id);
|
||||||
|
|
||||||
$player_data->{games_played}++;
|
$player_data->{games_played}++;
|
||||||
|
$player_data->{avg_score} *= $player_data->{games_played} - 1;
|
||||||
$player_data->{avg_score} += $player->{score};
|
$player_data->{avg_score} += $player->{score};
|
||||||
$player_data->{avg_score} /= $player_data->{games_played};
|
$player_data->{avg_score} /= $player_data->{games_played};
|
||||||
$player_data->{low_score} = $player->{score} if $player_data->{low_score} == 0;
|
$player_data->{low_score} = $player->{score} if $player_data->{low_score} == 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user