Changeset 5648

Show
Ignore:
Timestamp:
01/27/08 22:48:31 (7 years ago)
Author:
hiroyukim
Message:

細かい修正と不要なコメントの削除

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/Mezasi/trunk/lib/Mezasi/Util.pm

    r5368 r5648  
    1313use Mezasi::Trie; 
    1414 
    15 our $MarkovKeySize = 1; 
     15our $MarkovKeySize = 2; 
    1616 
    1717sub markov { 
    1818    my ( $self, $src, $keywords, $trie ) = @_; 
    19  
    2019    my $mar    = $self->markov_generate( $src , $trie ); 
    2120    my $result = $self->markov_select($mar, $keywords ); 
     
    2827 
    2928    return '' if( scalar( @{$src} ) == 0 ); 
    30  
    3129    my @ary = @{$trie->split_into_terms( join( "\n", @{$src} )."\n", 'true')};  
    3230    my $size = scalar @ary; 
    3331    push @ary, grep {$_} map { $ary[$_] } (0..$MarkovKeySize); 
    34  
    3532    my %table;  
    36     for my $idx ( 0..$size - 1 ) {  
     33    for my $idx ( 0..($size - 1) ) {  
    3734        my $key = JSON::Syck::Dump([ grep {$_} map {  $ary[$_]  } ($idx..($idx+$MarkovKeySize - 1)) ]); 
    3835        $table{$key} = [] unless $table{$key}; 
     
    4744        } 
    4845        else { 
    49             # dup の挙動を追うと新規を作ることになる。 
    5046            $backup{$key} = [ @{$table{$key}} ]; 
    5147        }