Text completion: Difference between revisions
Content added Content deleted
(Text completion en FreeBASIC) |
SqrtNegInf (talk | contribs) m (→{{header|Perl}}: works with recent Perl) |
||
Line 699: | Line 699: | ||
use feature 'say'; |
use feature 'say'; |
||
use Path::Tiny; |
use Path::Tiny; |
||
use List::Util |
use List::Util <uniq head>; |
||
sub bi_gram { (lc shift) =~ /(?<=\K.)./g } |
# sub bi_gram { (lc shift) =~ /(?<=\K.)./g } ## doesn't work in recent versions of Perl |
||
sub bi_gram { |
|||
my $line = lc shift; |
|||
uniq map { substr $line,$_,2 } 0 .. length($line)-2; |
|||
} |
|||
sub score { |
sub score { |