# Pastebin wTnhCbiF use Cro::HTTP::Client; use YAMLish; my $request = await Cro::HTTP::Client.get('https://raw.githubusercontent.com/mybb/mybb.com/gh-pages/_data/team_members.yml'); my %team = (gather for load-yaml(await $request.body-text)[] {take Pair.new(., $_); }).Hash; sub qgram (\a, \b, \q = (a.chars + b.chars) div 4 ) { my &ngrams = -> \t, \n { my \s = ~ (' ' x n - 1) ~ t ~ (' ' x n - 1); do for ^(t.chars + n) { s.substr: $_, n } } my \aₙ = &ngrams(a,q).BagHash; my \bₙ = &ngrams(b,q).BagHash; (aₙ ∩ bₙ) / (aₙ ∪ bₙ) } my &i = method ($i) {$i ?? self.fc !! self} my &m = method ($i) {$i ?? self.samemark(' ') !! self} my &ws = method ($i) {$i ?? self !! self.words.join } my &p = method ($i) {$i ?? self !! self.split(/<:P>/).join } my $subject = 'omar'; my @results = %team.keys .map({ $^word, qgram $^word.&i(True), $subject }) .sort( *.tail ); my %r = @results.sort( -*.[1] ).head(1).kv; say %r;