#!/usr/bin/raku # This is a numbers station script # It converts letters into numbers and says those numbers # # Based on the Major System # 0 : s z # 1 : t d th # 2 : n # 3 : m # 4 : r # 5 : l # 6 : ch g sh c # 7 : k g ch (like, bach the musician) ck # 8 : f v # 9 : p b # : h j w # # This script will need to: # 1. somehow know the proper puncication of each word ( probably impossible to accurately impliment :( # 2. convert each word into numbers # 3. play the sound for each numbers # 3.1. add a space between each number set my $audio_location = './audio/'; my $audio_extension = '.wav'; my %numberlist = (1 => <1a 1b 1c>, 2 => <2a 2b 2c>, 3 => <3a 3b 3c>, 4 => <4a 4b 4c>, 5 => <5a 5b 5c>, 6 => <6a 6b 6c>, 7 => <7a 7b 7c>, 8 => <8a 8b 8c>, 9 => <9a 9b 9c>, 0 => <0a 0b 0c>); my $file = w2n(open('country_roads.txt')); #say "$audio_location, $audio_extension, " ~ %numberlist{1}[].roll; # words to number sub w2n($file) { my @n = $file.words; for @n <-> $word { $word ~~ s :g:i /(ch)|g|(sh)|c/6/; $word ~~ s :g:i /s|z/0/; $word ~~ s :g:i /t|d|(th)/1/; $word ~~ s :g:i /n/2/; $word ~~ s :g:i /m/3/; $word ~~ s :g:i /r/4/; $word ~~ s :g:i /l/5/; $word ~~ s :g:i /k|g|ck/7/; $word ~~ s :g:i /f|v/8/; $word ~~ s :g:i /p|b/9/; $word ~~ tr/A..Za..z',//; if $word.chars == 1 { $word = ''; } } return @n; } print $file ~ "\n";