1
$\begingroup$

I am very new to NLP, hence require some help on extracting imperative sentences from a document. I am working on a project where I need to get all the imperative sentences from the entire document(English documents). I understand I need to use POS tagging. But how do I proceed further.

Thanks.

$\endgroup$

1 Answer 1

0
$\begingroup$

In order to maximize accuracy you would need to use not only a POS tagger but also a syntactic parser. Nevertheless for this task POS tags can probably give you reasonable results indeed, here is a general method:

  1. Segment the data into sentences and tokens
  2. Apply the POS tagger (it predicts a POS tag for every token)
  3. A sentence is (likely) imperative if the following conditions are satisfied:
    • the sentence ends with a full stop or exclamation mark
    • the POS for the first token corresponds to a verb

This heuristic is probably all you need, but if you want to go further you could generate instances containing these features (and possibly add a few others) for every sentence, annotate a training set and train a supervised model.

$\endgroup$
3
  • $\begingroup$ Thanks @Erwan. Your suggestion is very helpful. $\endgroup$
    – Diya
    Commented Aug 30, 2019 at 6:12
  • $\begingroup$ POS of the first token corresponds to a verb is not always true. Consider this sentence: "You should go either late or early to avoid tourists." Not sure how much it will give false negatives. $\endgroup$
    – CKM
    Commented Dec 12, 2019 at 12:23
  • $\begingroup$ @chandresh I agree that the method I proposed is far from perfect, it would certainly miss some cases indeed. but from a strict grammatical point of view your sentence is not in imperative mood. $\endgroup$
    – Erwan
    Commented Dec 12, 2019 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.