<p>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.</p>

<p>The <a href="http://tomato.banatao.berkeley.edu:8080/parser/parser.html" rel="nofollow noreferrer">Berkeley parser</a> gets it basically right in the sense that it can put <code>its late</code> and <code>I'm tired</code> on parallel, and they together on parallel with <code>the weekend</code>. But still not perfect (<code>the weekend</code> should be in the same subtree with <code>It's</code> rather than <code>if its late and I'm tired</code>)</p>

<p><a href="https://i.sstatic.net/u7Dct.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/u7Dct.png" alt="enter image description here"></a></p>

<p>The <a href="http://nlp.stanford.edu:8080/parser/index.jsp" rel="nofollow noreferrer">Stanford parser</a>, which is available in Python (NLTK), incorrectly parsed <code>I\'m tired</code> to the same level of <code>I drink orange juice</code>.</p>

<p><a href="https://i.sstatic.net/jQZ9c.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/jQZ9c.png" alt="enter image description here"></a></p>

CC BY-SA 4.0
2020-04-11T08:19:29.217Z
The question and answer both ignore that "its" is a PRP$ (possessive pronoun), while "it's" is required for a  legitimate parse.
amI
CC BY-SA 4.0
2018-09-10T16:40:45.947Z
Would you mind sharing your grammar rule for `nltk.RegexpParser()`? I'm still trying to wrap my head around that.
tim_xyz
CC BY-SA 4.0
2018-09-10T17:31:49.407Z
I didn't use `RegexpParser()`.
user12075
CC BY-SA 4.0
2018-09-08T01:37:08.420Z
2018-09-08T01:37:08.420Z
user12075
<p>Is there an accepted way in NLP to parse conjunctions (and/or) in a sentence?</p>

<p>By following the example below, how would I parse</p>

<blockquote>
  <p>I drink orange juice if its the weekend or if it's late and I'm tired.</p>
</blockquote>

<p>into</p>

<blockquote>
  <p>it's the weekend</p>
</blockquote>

<p>and </p>

<blockquote>
  <p>it's late</p>
</blockquote>

<p>and </p>

<blockquote>
  <p>I'm tired</p>
</blockquote>

<p>?</p>

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

<p>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?</p>

<p>Can an existing python/other library do this?</p>

<natural-language-processing><python><computational-linguistics>
How to parse conjunctions in natural language processing?
tim_xyz
# How to parse conjunctions in natural language processing?

(Asked by: username_0 on 2018-09-07)

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?

**Tags:** natural-language-processing, python, computational-linguistics


---

## 1 answers

### Answer by username_1 on 2018-09-08. Score: 1 | Accepted answer

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](http://tomato.banatao.berkeley.edu:8080/parser/parser.html) 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](https://i.sstatic.net/u7Dct.png)](https://i.sstatic.net/u7Dct.png)

The [Stanford parser](http://nlp.stanford.edu:8080/parser/index.jsp), which is available in Python (NLTK), incorrectly parsed `I\'m tired` to the same level of `I drink orange juice`.

[![enter image description here](https://i.sstatic.net/jQZ9c.png)](https://i.sstatic.net/jQZ9c.png)

> **Comments:**
> **username_0**: Would you mind sharing your grammar rule for `nltk.RegexpParser()`? I'm still trying to wrap my head around that.  
> **username_1**: I didn't use `RegexpParser()`.  
> **username_2**: The question and answer both ignore that "its" is a PRP$ (possessive pronoun), while "it's" is required for a  legitimate parse.  

---

