Finding Tense of A sentence using stanford nlp

笑着哭i 提交于 2019-12-18 05:52:20

问题


Q1.I am trying to get tense of a complete sentence,just don't know how to do it using nlp. Any help appreciated.

Q2 .What all information can be extracted from a sentence using nlp?

Currently I can, I get : 1.Voice of sentence 2.subject object verb 3.POS tags.

Any more info can be extracted please let me know.


回答1:


The Penn treebank defines VBD and VBN as the past tense and the past participle of a verb, respectively. In many sentences, simply getting the POS tags and checking for the presence of these two tags will suffice. In others, however, there may be verbs in multiple tenses while the sentence as a whole is in the past tense. For these cases, you need to use constituency parsing. Stanford NLP also provides a parser. You can use this to detect the outermost verb phrase (tagged as VP). If a past tense/participle form of a verb is an ancestor of all other verbs in the verb phrase, the tense of your sentence should be marked as past tense.

The example given by Dror yields this:

(ROOT
  (S
    (NP (PRP I))
    (VP (VBD did) (RB n't)
      (VP (VB want)
        (NP (DT the) (NN dog)
          (S
            (VP (TO to)
              (VP (VB eat)
                (NP (PRP$ my) (NN homework))))))))
    (. .)))

Even though eat is not past tense, the topmost verb in the verb phrase is correctly tagged VBD (i.e. past tense).

edit (some additional information):

Complex sentences have what is called the primary tense and a secondary tense. For sentences like "By the time I will reach there, he'd have already left", there is no such thing as 'the complete tense'. You can only distinguish between the primary and the secondary.

If you want information about perfect, continuous, etc., then you will have to derive rules based on the POS tags. E.g. an auxiliary verb in present tense followed by a verb in the past tense will express the present perfect tense (if there are obvious counterexamples, please add to the answer ... I can't think of any right now).




回答2:


Basically the tense of a sentence in English is determined by the form of the verb that is the head of the sentence. You may read more about this topic in this post about The Contextors’ Tense Conjugator. Identifying the head verb and its form is possible using a parser.

The kind of information that can be extracted from a sentence depends on the analysis you perform. You can extract other components of the sentence such as prepositional complements, predicative complements and adjuncts, as well as other grammatical attributes such as aspect, secondary tense, modality and polarity. Some sentences contains embedded clauses, like in the example below from the Contextors API. In this case, you may want to extract this information also from the embedded clause.




回答3:


I want complete tense eg: simple present OR present perfect continuous tense ... as far as i know I cannot get simply from POS tags

Note that what you have in your examples above are not examples of tense, they are rather examples of certain tense/aspect configurations. While tense by itself (past, present, future) places an eventuality in time, aspect categories (progressive, continuous, perfective, and the like) rather relate the eventuality to the flow of time (i.e. whether it is bounded/completed, whether it was a continuous event, etc). Thus, tense and aspect are two distinct grammatical categories. In English, they both form part of the verbal complex, which makes it easy to confuse them as well as find/analyze them in a single method. In many other languages, they are realized separately (distinct structural positions, functional items, constructions, etc.). Beware.



来源:https://stackoverflow.com/questions/22139866/finding-tense-of-a-sentence-using-stanford-nlp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!