tesseract.txt
faves.txt
composer.lock
+hashmap.txt
require('common.php');
+// $songHashMap = foldMap(
+// ☐(∘(field(0), delemit(' ')))(∘(field(5), delemit('/')))
+// )(foldMap(∘(lines, 'trim', 'file_get_contents'))(glob(PATH_TO_GROOVENET . '/songs.*.txt')));
+
$songHashMap = foldMap(
- ☐(∘(field(0), delemit(' ')))(∘(field(5), delemit('/')))
+ function($line) {
+ $delim = delemit('/')($line);
+ return [explode(' ', $line)[0] => $delim[4] . '/' . $delim[5]];
+ }
)(foldMap(∘(lines, 'trim', 'file_get_contents'))(glob(PATH_TO_GROOVENET . '/songs.*.txt')));
file_put_contents(__DIR__ . '/hashmap.txt', serialize($songHashMap));
}
$songs = map(function ($song) use ($arguments) {
+ $justTitle = explode('/', $song)[1];
similar_text(strtolower($arguments), strtolower($song), $perc);
return ['title' => $song, 'similarity' => $perc];
})(unserialize(file_get_contents(__DIR__ . '/hashmap.txt')));
$this->replyWithMessage(
[
- 'text' => "Here are the 5 most similar favourites I could find...\n\n" . $top5($songs)
+ 'text' => "Here are the 5 most similar songs I could find...\n\n" . $top5($songs)
]
);
}
$hashes = map(map(☐(produceValue(0))(null)))(array_values($faveFiles));
$songHashMap = unserialize(file_get_contents(__DIR__ . '/hashmap.txt'));
$faveMap = ∘(map(∘(flip(concat)("'s Faves"), 'ucwords', field(0), delemit('.'), 'basename')), foldMap(☐(field(1))(field(0))), foldMap(id))(zzipWith(∘(map, aaray_merge))($names)($hashes));
- $newFaves = zzipWith(∘(concat, flip(concat)(" in "), flip(field)($songHashMap)))(array_keys($faveMap))(array_values($faveMap));
+ $newFaves = zzipWith(∘(concat, flip(concat)(" in "), field(1), delemit(' '), flip(field)($songHashMap)))(array_keys($faveMap))(array_values($faveMap));
$thing = map(function ($fave) use ($arguments) {
$justTitle = join(' ', array_slice(explode(' ', $fave), 0 , -2));
"——————————————\n",
$diffEmojiMap[$k[1]],
$k[2] == 'dance-double' ? $diffEmojiMap[$k[1]] : '',
- ' ' . $songHashMap[$k[0]],
+ ' ' . explode('/', $songHashMap[$k[0]])[1],
"\n ",
truncate($v*100, 2) . "%"
]);
$diff = array_diff_assoc_recursive($scoreTesseract, $oldScoreTesseract);
$asdf = prefixKey('', $diff);
$pranks = [];
+
foreach ($asdf as $k => $v) {
$k = explode('.', $k);
"——————————————\n",
$diffEmojiMap[$k[1]],
$k[2] == 'dance-double' ? $diffEmojiMap[$k[1]] : '',
- ' ' . $songHashMap[$k[0]],
+ ' ' . explode('/', $songHashMap[$k[0]])[1],
"\n",
$k[3] . ": " . truncate($v*100, 2) . "%",
" (was $scorer: " . truncate($score*100, 2) . "%)"
}
$faveDiff = array_diff_assoc($faveMap, $oldFaveMap);
-$newFaves = zzipWith(∘(concat, flip(concat)(" in "), flip(field)($songHashMap)))(array_keys($faveDiff))(array_values($faveDiff));
+$newFaves = zzipWith(∘(concat, flip(concat)(" in "), field(1),delemit('/'), ∘(flip(field))($songHashMap)))(array_keys($faveDiff))(array_values($faveDiff));
if ($pranks || $newFaves) {
getTelegram()->sendMessage(