This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| my Bag %confusable; | |
| my Str @chars; | |
| say 'processing confusables.txt ...'; | |
| for <confusables.txt>.&open.lines[10..*] { | |
| my @s = .split("\t"); | |
| if not defined $_.index('#') and @s == 4 or | |
| @s == 5 && defined @s[4].index('#') | |
| { | |
| @chars.push: @s[2].words.map({ :16(~$_).chr }).join; | |
| } elsif @chars { | |
| my $b = bag @chars; | |
| %confusable{$_} := $b for @chars; | |
| undefine @chars; | |
| } | |
| } | |
| say 'done processing'; | |
| for lines() { | |
| say .comb.map({ ( %confusable{$_} // $_ ).pick }).join; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment