-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Scrappy little script looking for ocr derp
- Loading branch information
Oliver Smith
committed
Jan 23, 2015
1 parent
3a234d9
commit ab4a12c
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env python | ||
|
||
import tradedb | ||
tdb = tradedb.TradeDB() | ||
|
||
names = set() | ||
|
||
for sys in tdb.systemByID.values(): | ||
for stn in sys.stations: | ||
names.add(stn.name().upper()) | ||
|
||
mutators = { | ||
'D': [ 'O', '0' ], | ||
'W': [ 'VV' ], | ||
} | ||
|
||
def mutate(text, pos): | ||
for i in range(pos, len(text)): | ||
char = text[i] | ||
if char not in mutators: | ||
continue | ||
yield from mutate(text, i+1) | ||
for mutant in mutators[char]: | ||
t2 = text[:i] + mutant + text[i+1:] | ||
yield from mutate(t2, i+1) | ||
yield t2 | ||
|
||
for name in names: | ||
for mutant in mutate(name, 0): | ||
if mutant in names: | ||
print("{} <-> {}".format(name, mutant)) | ||
|