Revision 4498
Added by Aaron Marcuse-Kubitza over 12 years ago
join | ||
---|---|---|
6 | 6 |
import csv |
7 | 7 |
import operator |
8 | 8 |
import os.path |
9 |
import re |
|
9 | 10 |
import sys |
10 | 11 |
import warnings |
11 | 12 |
|
... | ... | |
15 | 16 |
import opts |
16 | 17 |
import util |
17 | 18 |
|
19 |
def simplify(str_): return re.sub(r'[\W_]+', r'', str_.lower()) |
|
20 |
|
|
18 | 21 |
def main(): |
19 | 22 |
env_names = [] |
20 | 23 |
def usage_err(): |
... | ... | |
36 | 39 |
map_1_cols = reader.next() |
37 | 40 |
for row in reader: |
38 | 41 |
if map_1_core_only: row = row[:2] |
39 |
if row[0] != '': map_1.setdefault(row[0].lower(), []).append(row)
|
|
42 |
if row[0] != '': map_1.setdefault(simplify(row[0]), []).append(row)
|
|
40 | 43 |
stream.close() |
41 | 44 |
|
42 | 45 |
# Join map 1 to map 0 |
... | ... | |
63 | 66 |
suffix = '' |
64 | 67 |
while True: |
65 | 68 |
try: |
66 |
out_rows = map_1[row[1].lower()]
|
|
69 |
out_rows = map_1[simplify(row[1])]
|
|
67 | 70 |
break |
68 | 71 |
except KeyError: |
69 | 72 |
# Heuristically look for a match on a parent path. |
Also available in: Unified diff
join: Match terms with non-alphanumeric chars removed