3
$\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 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?

$\endgroup$
  • $\begingroup$ its easy to implement as long as you follow the steps. $\endgroup$ – quintumnia Sep 8 '18 at 19:06
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$
  • 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 '18 at 16:40
  • $\begingroup$ I didn't use RegexpParser(). $\endgroup$ – user12075 Sep 10 '18 at 17:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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