Part of speech tagging using exhaustive search