Subject: | no-double list drops the last value in each line |
At the end of Conjugate.pm, there is a list of verbs that shouldn't be
doubled in the past tense. The last verb in each line, however, is
ignored, as it seems to include some sort of control char.
When adding the test:
ok(conjugate('verb'=>'suffer', 'tense'=>'past', 'pronoun'=>'I'), "I
suffered");
You see:
t/testconj....NOK 7/27# Test 7 got: "I sufferred" (t/testconj.t at line 16)
# Expected: "I suffered"
# t/testconj.t line 16 is: ok(conjugate('verb'=>'suffer',
'tense'=>'past', 'pronoun'=>'I'), "I suffered");
The fix is simple - instead of just stripping ' ', strip '\s'
diff -u /usr/local/share/perl/5.10.0/Lingua/EN/Conjugate.pm
blib/lib/Lingua/EN/Conjugate.pm
--- /usr/local/share/perl/5.10.0/Lingua/EN/Conjugate.pm 2009-10-30
23:59:19.000000000 -0700
+++ blib/lib/Lingua/EN/Conjugate.pm 2009-12-02 21:27:35.000000000 -0800
@@ -126,7 +126,7 @@
while (<DATA>) {
my $line = $_;
chomp $line;
- $line =~ s/^ *| *$//g;
+ $line =~ s/^\s*|\s*$//g;
my @nd = split / /, $line;
$no_double{$_} = 1 for @nd;
}
And the test patch:
diff -ru Lingua-EN-Conjugate-0.308.orig/t/testconj.t
Lingua-EN-Conjugate-0.308/t/testconj.t
--- Lingua-EN-Conjugate-0.308.orig/t/testconj.t 2007-10-29
12:21:11.000000000 -0700
+++ Lingua-EN-Conjugate-0.308/t/testconj.t 2009-12-02
21:16:25.000000000 -0800
@@ -1,7 +1,7 @@
use Test;
-BEGIN { plan tests => 26 }
+BEGIN { plan tests => 27 }
use Lingua::EN::Conjugate qw( conjugate conjugations );
use Data::Dumper;
@@ -13,6 +13,7 @@
ok(conjugate('verb'=>'do', 'tense'=>'past_prog', 'pronoun'=>'we',
'no_pronoun'=>1), 'were doing');
ok(conjugate('verb'=>'could', 'tense'=>'past', 'pronoun'=>'I'), undef);
ok(conjugate('verb'=>'could', 'tense'=>'present', 'pronoun'=>'I'), "I
could");
+ok(conjugate('verb'=>'suffer', 'tense'=>'past', 'pronoun'=>'I'), "I
suffered");
ok(conjugate( 'verb' => 'walk', 'tense' => 'present_prog', 'pronoun' =>
'he', 'negation'=>'n_t', 'allow_contractions'=>1 ),
"he isn't walking");