Revision 10278
Added by Aaron Marcuse-Kubitza over 11 years ago
canon | ||
---|---|---|
17 | 17 |
if key in self: raise KeyError(key) |
18 | 18 |
dict.__setitem__(self, key, value) |
19 | 19 |
|
20 |
def simplify(str_): return re.sub(r'[\W_]+', r'', str_.lower())
|
|
20 |
def simplify(str_): return re.sub(r'[^[:alnum:]]+', r'', str_.lower())
|
|
21 | 21 |
|
22 | 22 |
def main(): |
23 | 23 |
try: _prog_name, col_num, vocab_path = sys.argv |
Also available in: Unified diff
bin/*: replaced confusing regexp constructs involving \W inside [] with the much clearer explicit character class [:alnum:] . this avoids adding or subtracting from an inverted class in order to reach a subset of the corresponding positive class, because the subset can just be named explicitly instead.