/[Semantic-Engine]/EPrints/EPrints.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /EPrints/EPrints.pm

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

revision 4 by dpavlin, Fri Jun 29 09:52:53 2007 UTC revision 11 by dpavlin, Fri Jun 29 16:58:42 2007 UTC
# Line 37  sub id { Line 37  sub id {
37  sub lookup {  sub lookup {
38          my $self = shift;          my $self = shift;
39          my $field = shift;          my $field = shift;
40            my $table = shift;
41            my $where = '';
42    
43            if ( ! $table ) {
44                    $table = "archive_$field";
45                    $where = " and lang = 'hr'";
46            }
47    
48          my $sql = qq{          my $sql = qq{
49          SELECT $field          SELECT $field
50          FROM archive_$field          FROM $table
51          WHERE eprintid = $id          WHERE eprintid = $id $where
52          };          };
53          warn "# sql: $sql\n" if $debug;          warn "# sql: $sql\n" if $debug;
54          my @results = map { _x( $_->{$field} ) } @{ $dbh->selectall_arrayref($sql, { Slice => {} }) };          my @results = map { _x( $_->{$field} ) } @{ $dbh->selectall_arrayref($sql, { Slice => {} }) };
# Line 60  sub _x { Line 67  sub _x {
67    
68  sub slogovi {  sub slogovi {
69          my $text = shift;          my $text = shift;
70          my @s;  
71            my $count = 2;
72            my $out = '';
73    
74          foreach my $w ( split(/\W*\s+\W*/, $text ) ) {          foreach my $w ( split(/\W*\s+\W*/, $text ) ) {
75                  my $pos = 0;                  warn "w: $w\n" if $debug;
76                    my @s;
77                  while ( $w =~ s/^([^aeiou]*[aeiou])//i ) {                  while ( $w =~ s/^([^aeiou]*[aeiou])//i ) {
78                          push @s, $pos++ . $1;                          push @s, $1;
79                  }                  }
80                  push @s, $pos . $w if $w;                  push @s, $w if $w;
81                  warn "slogovi = ", dump( @s ), $/ if $debug;                  warn "slogovi = ", dump( @s ), $/ if $debug;
82                    foreach my $p ( 0 .. ( $#s - $count + 1 )  ) {
83                            map { $out .= $s[ $p + $_ ] } 0 .. $count - 1;
84                            $out .= ' ';
85                    }
86          }          }
87          return @s;          warn "$out\n" if $debug;
88            return $out;
89  }  }
90    
91  1;  1;

Legend:
Removed from v.4  
changed lines
  Added in v.11

  ViewVC Help
Powered by ViewVC 1.1.26