Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

code cleanup

  • Loading branch information...
commit 22becfdf12eff99fc0a9576b0b27a8b74fc3a9ce 1 parent a3cd9ed
@rkitover authored
Showing with 8 additions and 11 deletions.
  1. +3 −0  Changes
  2. +5 −11 lib/Lingua/EN/Inflect/Phrase.pm
View
3  Changes
@@ -1,5 +1,8 @@
Revision history for Lingua-EN-Inflect-Phrase
+0.03 2010-03-16 20:09:31
+ - clean up code
+
0.02 2010-03-16 16:28:39
- some improvements and fixes for DBIx::Class::Schema::Loader
View
16 lib/Lingua/EN/Inflect/Phrase.pm
@@ -12,7 +12,7 @@ Lingua::EN::Inflect::Phrase - Inflect short English Phrases
=cut
-our $VERSION = '0.02';
+our $VERSION = '0.03';
=head1 SYNOPSIS
@@ -72,18 +72,12 @@ sub _inflect {
$tagger ||= Lingua::EN::Tagger->new;
my $tagged = $tagger->get_readable($phrase);
+ my $noun;
# last noun before a preposition/conjunction
- if (my ($noun) = $tagged =~ m{$NOUN (?!.*/(?:NN|CD|JJ).*/(?:CC|IN)) .* /(?:CC|IN)}x) {
- my $is_plural = Lingua::EN::Inflect::Number::number($noun) ne 's';
- my $inflected_noun = _inflect_noun($noun, $is_plural, $want_plural, $method);
-
- substr($tagged, $-[1], ($+[1] - $-[1])) = $inflected_noun if $inflected_noun;
-
- ($phrase = $tagged) =~ s{/[A-Z]+}{}g;
- }
-# last noun
- elsif (($noun) = $tagged =~ m{$NOUN (?!.*/(?:NN|CD|JJ))}x) {
+# or last noun
+ if ((($noun) = $tagged =~ m{$NOUN (?!.*/(?:NN|CD|JJ).*/(?:CC|IN)) .* /(?:CC|IN)}x) or
+ (($noun) = $tagged =~ m{$NOUN (?!.*/(?:NN|CD|JJ))}x)) {
my $is_plural = Lingua::EN::Inflect::Number::number($noun) ne 's';
my $inflected_noun = _inflect_noun($noun, $is_plural, $want_plural, $method);
Please sign in to comment.
Something went wrong with that request. Please try again.