How to parse conjunctions in Natural Language Processing in Python

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 its late and I\'m tired."

Into,

[
["its the weekend"]],
["its late", "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 ("its late" AND "I\'m tired"), but how could this be determined computationally?

Can an existing python/other library do this?

• its easy to implement as long as you follow the steps. – quintumnia Sep 8 '18 at 19:06

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. – tim_xyz Sep 10 '18 at 16:40
• I didn't use RegexpParser(). – user12075 Sep 10 '18 at 17:31