Completed word_confidence.py implementation.