Help for this page

Select Code to Download


  1. or download this
      use Text::Ngram qw(ngram_counts add_to_counts);
      my $text   = "abcdefghijklmnop";
      my $hash_r = ngram_counts($text, 3); # Window size = 3
      # $hash_r => { abc => 1, bcd => 1, ... }