There is an entire field looking at this question called "computational linguistics" "http://en.wikipedia.org/wiki/Computational_linguisticsComputational Linguistics". Looking at any online translation tool you can see that they still have a ways to go, but there has been a lot done on parsing English.
Stanford provides a robust English parser here http://nlp.stanford.edu:8080/parser/here with the homepage here http://nlp.stanford.edu/software/lex-parser.shtmlhere.
I recommend using an established library for your script rather than writing your own. There is no reason to reinvent the wheel, especially a wheel that contains the complications of the English language.