refactored getWordScore