To start: I know this system will have flaws!
NOTE: Im adding a few other languages because I don\'t find this problem specific to php
I have been working on parsing menus and recipes (not finished) and this is my approach:
key words that you need (light/bulbs/etc.., on/off)extra words that some people might use (bright, colorful, etc...)I.E.: Turn the lights on in the bedroom and in the kitchen
what_2 is empty, then what_2 is lights on
keep in mind that sometime needs to fill up the array with the next results (depending on how the sentence is structured, but it is rare), I add a "+" or "-" to it so I know if I have to go forward or backwards to find the missing parts while parsing it