Monday 9 September 2013

How to Get the Past, Present and Future Tense of a Word in PHP?

How to Get the Past, Present and Future Tense of a Word in PHP?

As the title states I'm looking for a script in PHP or a method that will
allow me to get the past, present and future tense of any word. I'm also
looking for single and plural variations of a word however I've already
found a script that does this. So, now I just need to find various tenses
of a word.
What I thought of already..
I already thought of using regex to add "ing" and "ed" to different words.
However, this is not an ideal solution for two reasons.
First, certain words like "run" will need to be changed to "ran" and so
on. So the above regex won't help me. Also, we may have to add chars
before adding "ing" such as an "n" to the end of "running".
Second, you can't just add "ed" to all words. Some words need chars
removed first and I think it is pretty difficult to identify all different
situations.
So my questions stands how to go about this?
P.S
I've seen a similar question here identify tense in php but this is asking
how to identify the word, not change it.

No comments:

Post a Comment