improves partialwordthreshold.py