Need help to create a macro to Build Statements based on text

I am not a programmer but i'll try to describe what I am trying to accomplish.

Imagine some statements like these ones:

Mary mixed yellow and blue. ====> green

John mixed blue and red. ======> purple

Paul mixed yellow and red ======> orange

So, just as I said I am not a programmer, but i think we should search for keywords on text, using some kind of keycode to decript the appropriate colors.

Please help me!