Revision 4626
Added by Aaron Marcuse-Kubitza over 12 years ago
canon | ||
---|---|---|
21 | 21 |
stream = open(vocab_path, 'rb') |
22 | 22 |
reader = csv.reader(stream) |
23 | 23 |
reader.next() # skip header |
24 |
for term, in reader: dict_[simplify(term)] = term
|
|
24 |
for row in reader: dict_[simplify(row[0])] = row[0]
|
|
25 | 25 |
stream.close() |
26 | 26 |
|
27 | 27 |
# Canonicalize input |
Also available in: Unified diff
canon, translate, filter_out_ci: Support vocabularies/dictionaries with additional columns in addition to the functional column(s) used by the program. These columns can contain comments, etc. This was not originally supported because Python 2's iterable unpacking only supports "an iterable with the same number of items as there are targets in the target list" (http://docs.python.org/reference/simple_stmts.html#assignment-statements). We now use numeric array indexes instead to get around this limitation, and for consistency with other map-manipulation scripts.