Determine time in php

I’m looking for a way to analyze a line of text and find out what voltage it was written in, for example: “I go to the store” == current, “I bought a car” == past ect ..

Any tips on how I could do this?

+4
source share
6 answers

Yes, it will be very difficult ... I started to do something similar for what would be a quick weekend project until I realize it ... however, there is a resource that I found useful.

Download the Wordnet 3.0 source code from Princeton , which has a database of English words. The file /dict/index.verb is a list of real English verbs that you can import into your database as CSV without any problems. From there, you are on your own, and you will need to figure out how to deal with the strangeness that is English.

+4
source

This can be a rather complicated process. How detailed do you want to receive? Do you want to consider only the past, present and future? Or do you want to consider Simple Present, Present Progressive, Simple Past, etc.

In any case, you will also have to evaluate Positive Forms, Negative Forms and Question Forms. A great online timeline that can help can be found at http://www.ego4u.com/en/cram-up/grammar/tenses

Pay attention to the rules and signal words.

+3
source

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

+2
source

For such a task, I believe that regular expressions will not be enough: this is a rather difficult task ...

Either you won’t get anything good from the regular expression, or you end up with some kind of super-monster-regular expression that even you don’t understand and cannot support ...

This probably requires more than a regular expression ... Something like some kind of "linguistic engine", I suppose ...

+2
source

If you really need it and you are not just playing, you can take a look at nltk . Parsing is a difficult question. Parsing natural languages ​​is even more difficult. And parsing a highly irregular language such as English is even worse. If you can narrow the scope of the problem, you will have a better chance of a solution.

Why do you need this?

+1
source

You can find the basic Brill Parser implementation for PHP at the Ian Barber PHP / ir website. The algorithm marks your words.

If you enter the words “I think,” the result will be:

I / NN think / VBP

NN = Noun, VBP = Present Verb

0
source

All Articles