27
4
The next revolution in typing on laptops was released on the first of April, 2014 by SwiftKey. However, I want to be the first person to write a swiping nano clone, but, as I can't find a good swipe-text to real-text library, and I can't wait for them, I'm asking here.
Task
Write a program that takes in swipe-text and outputs the real-text equivalent. Example:
Input: hgrerhjklo
Output: hello
When the user does:

Other examples:
Input: wertyuioiuytrtjklkjhgfd
Output: world
Input: poiuytrtyuioiugrewsasdfgbhnmkijnbg
Output: programming
Input: poiuygfdzxcvhjklkjhgres
Output: puzzles
Input: cvhjioiugfde
Output: code
Input: ghiolkjhgf
Output: golf
Rules
- The program will take one swiped 'word' in on stdin or argv
- The first and last letter of the swiped input will equate to the first and last letter of the real word
- You can assume the user will make reasonably straight lines, but you can use the sample data to verify this (I made the sample data, and I will make the final test data)
- For ambiguous input, you can make select either output, but I will try to eradicate all ambiguousness from the test data
- This word will be in this word list (but swiped). The word list will be in the current directory, and can be read (newline separated, will be named
wordlist, no extension). - The swipe will only contain lowercase alphabetic characters
- The swipe may contain duplicated characters, if the user pauses on a key
- The program must output on stdout (case does not matter)
- The program must return
0as the return code - You must provide the run command, compile command (if needed), name and which input path to use
- Standard loopholes apply (they might not help, though)
- No non-builtin libraries allowed
- Deterministic, non golfed / obfuscated solutions preferred
- No file writing, networking, etc.
- Your code must run in one second or less (your code is run once per word)
- The scoring runs are run on a Intel i7 Haswell processor, with 4 virtual code (2 real ones), so you can use threads if you have to
- Maximum code length of 5000 bytes
- The language you use must have a free (non trial) version available for Linux (Arch Linux, if that matters)
Winning Criterion
- The winner is the most accurate solution (scored by the control program, using the provided test list)
- Popularity is the tie breaker
- The scoring table will be updated every few days
- Time-outs and crashes count as fails
- This challenge will run for two weeks or more, depending on popularity
- The final scoring will use a different, randomly selected list of words (same length, from same word list)
Other
- You can use the control program to test your program
- If you are impatient, and want your program updated / added quickly, start an issue or pull request at https://github.com/matsjoyce/codegolf-swipe-type/blob/master
- Entries are maintained at https://github.com/matsjoyce/codegolf-swipe-type/blob/master/entries
- Logs of each program run are maintained at https://github.com/matsjoyce/codegolf-swipe-type/blob/master/logs
- Main log at https://github.com/matsjoyce/codegolf-swipe-type/blob/master/log.log
- The position of each key will be provided as a csv file in the current directory called
keypos.csv, with the x and y values given as relative toQ(see https://github.com/matsjoyce/codegolf-swipe-type/blob/master/keypos.csv) - Each key is 1.5 x 1.5 cm (same unit as in keypos.csv)
Current Score Boards
Three Pass Optimizer:Errors: 0/250 Fails: 7/250 Passes: 243/250 Timeouts: 0/250
Corner Sim: Errors: 0/250 Fails: 9/250 Passes: 241/250 Timeouts: 0/250
Discrete Fréchet Distance:Errors: 0/250 Fails: 17/250 Passes: 233/250 Timeouts: 0/250
Turnaround: Errors: 0/250 Fails: 18/250 Passes: 232/250 Timeouts: 0/250
Direction Checker: Errors: 0/250 Fails: 19/250 Passes: 231/250 Timeouts: 0/250
Regex Solver: Errors: 0/250 Fails: 63/250 Passes: 187/250 Timeouts: 0/250
Corner Sim: Errors: 0/250 Fails: 10/250 Passes: 240/250 Timeouts: 0/250
Three Pass Optimizer:Errors: 2/250 Fails: 14/250 Passes: 234/250 Timeouts: 0/250
Turnaround: Errors: 0/250 Fails: 16/250 Passes: 234/250 Timeouts: 0/250
Direction Checker: Errors: 0/250 Fails: 17/250 Passes: 233/250 Timeouts: 0/250
Discrete Fréchet Distance:Errors: 0/250 Fails: 18/250 Passes: 232/250 Timeouts: 0/250
Regex Solver: Errors: 0/250 Fails: 67/250 Passes: 183/250 Timeouts: 0/250
Final Run
Corner Sim: Errors: 0/250 Fails: 14/250 Passes: 236/250 Timeouts: 0/250
Three Pass Optimizer:Errors: 0/250 Fails: 18/250 Passes: 232/250 Timeouts: 0/250
Direction Checker: Errors: 0/250 Fails: 20/250 Passes: 230/250 Timeouts: 0/250
Turnaround: Errors: 0/250 Fails: 23/250 Passes: 227/250 Timeouts: 0/250
Discrete Fréchet Distance:Errors: 0/250 Fails: 30/250 Passes: 220/250 Timeouts: 0/250
Regex Solver: Errors: 0/250 Fails: 55/250 Passes: 195/250 Timeouts: 0/250
Well done to everybody and hgfdsasdertyuiopoiuy swertyuiopoijnhg!
What is "A Solution"? Where is its code? – Doorknob – 2014-10-12T18:58:21.520
Let us continue this discussion in chat.
– Optimizer – 2014-10-12T20:13:11.6108Somewhat related. – wchargin – 2014-10-12T21:06:17.597
@Optimizer Not sure about the other cases, but "poiuytresaseresasdfghuioiugfdxcguiugcxsasdfghjklkuy" contains every letter of "paradoxically", in order, except for the
l, which is not doubled. – es1024 – 2014-10-13T01:51:06.953Sorry, my bad. I missed the first "d" there. – Optimizer – 2014-10-13T09:13:53.360
I am pretty sure that the
ErrorandTimeoutsection will always remain 0. You can remove that. Also, feel free to add mine too ... – Optimizer – 2014-10-13T15:35:09.913If I'm not mistaken there are two spelling mistakes in the test cases (
'cvbjkloiuhgfcvhjkjhgfds', expecting 'cloaks'and'ijnjuyfdsasrtre', expecting 'inundate') and at least a dozen genuine ambiguities (likebratsvs.breastsorapedvs.adopted). You could of cause say that any realistic test scenario should include such cases. ;) – Emil – 2014-10-13T20:56:24.980I'm getting a syntax error when trying the control program. It is pointing to
– Mhmd – 2014-10-14T19:08:07.920def print(.... I think it is this problem: http://stackoverflow.com/questions/937491/invalid-syntax-when-using-print but I can't fix it because I don't know python.@Mhmd Make sure you are using python 3. It will not work with python 2. – matsjoyce – 2014-10-14T19:20:02.083
@Optimizer The
Errorcategory hasn't remained zero... :) – matsjoyce – 2014-10-17T15:32:01.803That's a bug. I will fix it. – Optimizer – 2014-10-17T15:38:20.007
@Optimizer I'll run the final round as soon as you've fixed your bug. The test set is ready. – matsjoyce – 2014-10-25T17:16:33.873
Give me a day :) – Optimizer – 2014-10-25T17:21:11.760
@Optimizer Shall I go ahead with the final scoring then? – matsjoyce – 2014-10-31T13:47:00.500
Sorry, I wasn't able to fix the errors in time. Please proceed as it will not be fair to others – Optimizer – 2014-10-31T13:48:09.627
You are not going to choose your own submission as answer, right ? (Dunno if its possible) – Optimizer – 2014-11-03T16:39:48.670
1@Optimiser Well, I thought your submission would beat it, but it was just below (a little tweaking would have changed that, I'm sure). It seems I can accept it, so... should I (I don't appear to get rep from accepting it)? I'd like to accept someone else's, but that's not following the rules (unless you've got a good idea). – matsjoyce – 2014-11-03T17:38:14.707