4
$\begingroup$

Is there an accepted way in NLP to parse conjunctions (and/or) in a sentence?

By following the example below, how would I parse

I drink orange juice if its the weekend or if it's late and I'm tired.

into

it's the weekend

and

it's late

and

I'm tired

?

Implying an action will be taken when one of the above elements at the 1st level of depth is true.

I know when I hear the sentence that it means "its the weekend" OR ("it's late" AND "I'm tired"), but how could this be determined computationally?

Can an existing python/other library do this?

$\endgroup$
0

1 Answer 1

1
$\begingroup$

This seems not easy for NLP. I doubt that state-of-the-art NLP tools can reliably determine the correct hierarchical structure of independent clauses. Examples below.

The Berkeley parser gets it basically right in the sense that it can put its late and I'm tired on parallel, and they together on parallel with the weekend. But still not perfect (the weekend should be in the same subtree with It's rather than if its late and I'm tired)

enter image description here

The Stanford parser, which is available in Python (NLTK), incorrectly parsed I\'m tired to the same level of I drink orange juice.

enter image description here

$\endgroup$
3
  • 1
    $\begingroup$ Would you mind sharing your grammar rule for nltk.RegexpParser()? I'm still trying to wrap my head around that. $\endgroup$
    – tim_xyz
    Sep 10, 2018 at 16:40
  • $\begingroup$ I didn't use RegexpParser(). $\endgroup$
    – user12075
    Sep 10, 2018 at 17:31
  • $\begingroup$ The question and answer both ignore that "its" is a PRP$ (possessive pronoun), while "it's" is required for a legitimate parse. $\endgroup$
    – amI
    Apr 11, 2020 at 8:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .