mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-03 23:04:08 +01:00
8752432de3
If a Makefile defines a dirty word list then a new python script is invoked to filter for and remove those words as the dict is being built. So far I have for English only, which makes sense because only English wordlists are built-in on Android and Google's rating system cares only about what's built in.
18 lines
479 B
Python
Executable file
18 lines
479 B
Python
Executable file
#!/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 )
|