Refactor python to use functions.recognizeWords