views:

180

answers:

5

Hi,

I'm looking for a way to analyze a string of text and find out in which tense it was written, for example : "I'm going to the store" == current, "I bought a car" == past ect..

Any tips on how I could this done?

+1  A: 

Tokenize / find action words from db/file (or at least, guess - *th=past, for example) / count tense hits?

Andrejs Cainikovs
+1  A: 

For such a task, I believe Regular expressions won't be enough : it's a pretty difficult task...

Either you won't get anything good at all from regex, or you'll end with some kind of super-monster-regex that not even you will understand and be able to maintain...

This probably requires more than regex... Something like some kind of "linguistic-engine", I suppose...

Pascal MARTIN
+1  A: 

This could be a rather tasking process. How detailed do you want to get? Do you want to consider only past, present, and future? Or do you want to consider Simple Present, Present Progressive, Simple Past, etc?

In any case, you'll also have to evaluate the Affirmative forms, Negative forms, and Question forms. A great chart online that can help can be found at http://www.ego4u.com/en/cram-up/grammar/tenses

Note the rules and signal words.

Jonathan Sampson
+2  A: 

Yes, this is going to be extremely difficult... I had started to do something similar for what was going to be a quick weekend project until I realized this... nonetheless here is a resource I found to be helpful.

Download the source code of Wordnet 3.0 from Princeton, which has a database of english words. The file /dict/index.verb is a list of present tense english verbs you should be able to import into your database as a CSV without too much trouble. From there, you're on your own, and will need to figure out how to handle the wierdness that is the English language.

postpostmodern
A: 

If you actually need it and aren't just playing around, you might take a look at nltk. Parsing is a complex matter. Parsing natural languages is even more complex. And parsing a highly irregular language, such as English, is even worse. If you can narrow the problem scope down, you stand a better chance at a solution.

What do you need it for?

troelskn