as far as I know, more often than not keywords will not have any variables and use correct spacing, so we should store keywords in a dict (lowercase name => keyword) and an array as well. we can then lookup in dict first, and then do matching against the array if that fails.
(there's probably problems with doing this but it might work) we could even store in the array only keywords that embed variables, and store everything else in dict. then remove all spaces when matching the dict, and match the array if that fails