10
2
Introduciton
Some of you might have realised that I am a sloppy typer when using my phone. That's why I want you to write a program which corrects my typos.
Chalkrnge
Given a misspelled word, output all of the possible words which I meant to write.
Typso
The main cause of my typos is down to the fact that I hit the wrong keys and often hit the key next door. The following is my keyboard layout:
q w e r t y u i o p
a s d f g h j k l
z x c v b n m
, [ space ] .
Note that the bottom row, , [ space ] .
will never be used in this challenge
For some reason, I only make mistakes horizontally: I would never hit the n instead of the j, but I might hit an f instead of a d.
For example, I could end up spelling the word sloppy as:
akioot
Where I've gone left of each key.
However, don't forget that I may not necessarily make a mistake on every letter in the word.
Ezsmple
Let's say the input is:
vid
The possibilities that the word could have been are:
vid cid bid
vis cis bis
vif cif bif
vod cod bod
vos cos bos
vof cof bof
vud cud bud
vus cus bus
vuf cuf buf
Out of those, the following are in the dictionary:
cod
cud
bid
bud
bus
So that should be your output.
Rulws
You should only use the text file found here as your dictionary: http://mieliestronk.com/corncob_lowercase.txt. You do not have to count this file as part of your byte count.
All input will be a single word. You may display your output in any way you wish (as long as there is some kind of separator).
Assume that with all input, you will find a variant which is in the dictionary.
Wibninf
The shortest code in bytes wins.
11When I saw the title, I thought this was gonna be another challenge about Welsh... – Martin Ender – 2016-09-12T09:27:48.087
I presume that compressing the dictionary is part of the challenge, and that if I choose to read the dictionary from a file I should count its length towards my score, but that should be made explicit for the benefit of people who haven't read the whole of meta. PS If you're going to post something to the sandbox, leave it there long enough to get feedback. – Peter Taylor – 2016-09-12T09:50:14.837
@PeterTaylor Well not really, it's mainly just the parsing of the dictionary which can be done uncompressed. – Beta Decay – 2016-09-12T09:53:55.657
So if I inline the file, what do I count? Two bytes for the delimiting
""
? – Peter Taylor – 2016-09-12T11:08:35.703@PeterTaylor Well yes – Beta Decay – 2016-09-12T11:42:36.857
@BetaDecay May I take the dictionary as a large string argument to a function, or do I have to read it from a file? "You do not have to count this file as part of your byte count." <--- does this mean that I can exclude the part where I read the contents to a variable (probably not) in the byte count? – Yytsi – 2016-09-12T11:50:35.837
@TuukkaX Yes, it does mean you can exclude the reading of the contents – Beta Decay – 2016-09-12T12:17:24.783