mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-04 23:02:02 +01:00
19 lines
479 B
Python
19 lines
479 B
Python
|
#!/usr/bin/python
|
||
|
|
||
|
# Invoked with path to bad words list as single parameter, and with a
|
||
|
# stream of words via stdin, loads the bad words into a map and for
|
||
|
# every word in stdin echos it to stdout IFF it's not in the map.
|
||
|
|
||
|
import sys
|
||
|
|
||
|
dirtyMap = {}
|
||
|
dirtyList = sys.argv[1]
|
||
|
for f in open(dirtyList):
|
||
|
dirtyMap[f] = True
|
||
|
|
||
|
for word in sys.stdin:
|
||
|
if word in dirtyMap:
|
||
|
sys.stderr.write( sys.argv[0] + ": dropping: " + word )
|
||
|
else:
|
||
|
sys.stdout.write( word )
|