[Bio] / Sprout / BioWords.pm Repository:
ViewVC logotype

Diff of /Sprout/BioWords.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3, Sat Oct 18 16:20:59 2008 UTC revision 1.4, Mon Jan 19 21:46:21 2009 UTC
# Line 525  Line 525 
525      my $len = length $lowered;      my $len = length $lowered;
526      Trace("Processing \"$lowered\".") if T(4);      Trace("Processing \"$lowered\".") if T(4);
527      # Check to see what type of word it is.      # Check to see what type of word it is.
528      if ($lowered =~ /[^$self->{WORD}]/) {      if (! $self->IsWord($lowered)) {
529          # It's delimiters. Return it unchanged and don't record it.          # It's delimiters. Return it unchanged and don't record it.
530          $retVal = $lowered;          $retVal = $lowered;
531      } elsif ($len < $self->{SHORT}) {      } elsif ($len < $self->{SHORT}) {
# Line 539  Line 539 
539          if ($retVal ne EMPTY) {          if ($retVal ne EMPTY) {
540              $entry->{count}++;              $entry->{count}++;
541          }          }
542      } elsif ($len == $self->{SHORT}) {      } elsif ($len <= $self->{SHORT}) {
543          # It's already the minimum length. The stem is the word itself.          # It's already the minimum length. The stem is the word itself.
544          $retVal = $lowered;          $retVal = $lowered;
545          # Store it if we're using the cache.          # Store it if we're using the cache.
# Line 828  Line 828 
828      # EC number.      # EC number.
829      my @retVal = $number;      my @retVal = $number;
830      # Bust the EC number into pieces.      # Bust the EC number into pieces.
831      my @pieces = split '.', $number;      my @pieces = split /\./, $number;
832      # Put it back together with hyphens.      # Put it back together with hyphens.
833      for (my $i = 1; $i <= $#pieces; $i++) {      for (my $i = 1; $i <= $#pieces; $i++) {
834          if ($pieces[$i] ne '-') {          if ($pieces[$i] ne '-') {
835              my @wildPieces;              my @wildPieces;
836              for (my $j = 0; $j <= $#pieces; $j++) {              for (my $j = 0; $j <= $#pieces; $j++) {
837                  push @wildPieces, ($j < $i ? $pieces[$i] : '-');                  push @wildPieces, ($j < $i ? $pieces[$j] : '-');
838              }              }
839              push @retVal, join(".", @wildPieces);              push @retVal, join(".", @wildPieces);
840          }          }
# Line 869  Line 869 
869      # Find all the EC numbers in the string.      # Find all the EC numbers in the string.
870      my @ecs = ($string =~ /ec\s+(\d+(?:\.\d+|\.-){3})/gi);      my @ecs = ($string =~ /ec\s+(\d+(?:\.\d+|\.-){3})/gi);
871      # Get the wild versions.      # Get the wild versions.
872      my @retVal = map { WildsOfEc($_) } @ecs;      my @retVal = map { WildsOfEC($_) } @ecs;
873      # Return the result.      # Return the result.
874      return @retVal;      return @retVal;
875  }  }
# Line 968  Line 968 
968      ($retVal, $suffix, $ruleValue) = FindRule($retVal, q('s') => EMPTY, q('s) => EMPTY, q(') => EMPTY);      ($retVal, $suffix, $ruleValue) = FindRule($retVal, q('s') => EMPTY, q('s) => EMPTY, q(') => EMPTY);
969      # Process latin endings.      # Process latin endings.
970      ($prefix, $suffix, $ruleValue) = FindRule($retVal, us => 'i', um => 'a', ae => 'a');      ($prefix, $suffix, $ruleValue) = FindRule($retVal, us => 'i', um => 'a', ae => 'a');
     # Latin endings only apply if they follow a consonant.  
     if ($prefix =~ /[^aeiou]$/) {  
971          $retVal = "$prefix$ruleValue";          $retVal = "$prefix$ruleValue";
     }  
972      # Convert plurals to singular.      # Convert plurals to singular.
973      ($prefix, $suffix, $ruleValue) = FindRule($retVal, sses => 'ss', ied => 'i', ies => 'i', s => 's');      ($prefix, $suffix, $ruleValue) = FindRule($retVal, sses => 'ss', ied => 'i', ies => 'i', s => 's');
974      if ($ruleValue eq 'i') {      if ($ruleValue eq 'i') {

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3