# How to parse conjunctions in natural language processing?

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?

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)

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

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