Text completion: Difference between revisions
m
→Sorenson-Dice: better DRY
Thundergnat (talk | contribs) m (→Sorenson-Dice: add missing suffix) |
Thundergnat (talk | contribs) m (→Sorenson-Dice: better DRY) |
||
Line 550:
<lang perl6>sub sorenson ($phrase, %hash) {
my $match = bigram $phrase
%hash.race.map: {
my $this = .value;
Line 558:
sub bigram (\these) {
Bag.new( flat these.fc.words.map: { .comb.rotor(2 => -1)».join } )
}
# Load the dictionary
my %hash = './unixdict.txt'.IO.slurp
# Testing
|