Answers.Body: <p>Grammars in NLP basically correspond to <a href="https://en.wikipedia.org/wiki/Context-free_grammar" rel="nofollow noreferrer">Context-free Grammars(CFG)</a> in formal Language theory. And, in case the CFG corresponding to the NLP task is <a href="https://en.wikipedia.org/wiki/Ambiguous_grammar" rel="nofollow noreferrer">ambiguous</a>, then corresponding to a single sentence (more formally <em>derivation</em>), there can be multiple Parse Trees.<br>
  Hence, it depends on the grammar whether there can be more than one valid parse tree.  </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-02T06:56:22.500Z
Answers.LastActivityDate: 2019-03-02T06:56:22.500Z
Answers.UserDisplayName: programmer
Answers.Body: <blockquote>
  <p>But, is that correct? Is it possible a sentence has more than one valid parse tree (e.g. constituency-based)?</p>
  </blockquote>
  <p>The fact that a single sequence of words can be parsed in different ways depending on context (or &quot;grounding&quot;) is a common basis of miscommunication, misunderstanding, innuendo and jokes.</p>
  <p>One classic NLP-related &quot;joke&quot; (around longer than modern AI and NLP) is:</p>
  <blockquote>
  <p>Time flies like an arrow.</p>
  <p>Fruit flies like a banana.</p>
  </blockquote>
  <p>There are actually <a href="https://en.wikipedia.org/wiki/Time_flies_like_an_arrow;_fruit_flies_like_a_banana" rel="nofollow noreferrer">several valid parse trees</a> for even these simple sentences. Which ones come &quot;naturally&quot; will depend on context - anecdotally I only half got the joke when I was younger, because I did not know there were such things as <em><a href="https://entomology.ca.uky.edu/ef621" rel="nofollow noreferrer">fruit flies</a></em>, so I was partly confused by literal (but still validly parsed, and <em>somewhat</em> funny) meaning that all fruit can fly about as well as a banana does.</p>
  <p>Analysing these kinds of ambiguous sentences leads to the <a href="http://www.scholarpedia.org/article/Symbol_grounding_problem" rel="nofollow noreferrer">grounding problem</a> - the fact that without some referent for symbols, a grammar is devoid of meaning, even if you know the rules and can construct valid sequences. For instance, the above joke works partly because the nature of time, when referred in a particular way (singular noun, not as a possession or property of another object), leads to a well-known metaphorical reading of the first sentence.</p>
  <p>A statistical ML parser could get both sentences correct through training on many relevant examples (or trivially by including the examples themselves with correct parse trees). This has not solved the grounding problem, but may be of practical use for any machine required to handle natural language input and map it to some task.</p>
  <p>I did check a while ago though, and most Parts Of Speech taggers in Pythons NLTK get both sentences wrong - I suspect because resolving sentences like those above and AI &quot;getting language jokes&quot; is not a high priority compared to more practical uses for chatbots/summarisers, etc.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-03-02T09:29:25.477Z
Answers.LastActivityDate: 2021-01-18T15:48:30.780Z
Answers.LastEditDate: 2021-01-18T15:48:30.780Z
Answers.UserDisplayName: Neil Slater
Body: <p>I just read about the concept of a <a href="https://en.wikipedia.org/wiki/Parse_tree" rel="nofollow noreferrer">parse tree</a>.</p>
  <p>In my understanding, a valid parse tree of a sentence needs to be validated by a linguistic expert. So, I concluded, a sentence only has one parse tree.</p>
  <p>But, is that correct? Is it possible a sentence has more than one valid parse tree (e.g. constituency-based)?</p>
  
Tags: <natural-language-processing>
Title: Can a sentence have different parse trees?
UserDisplayName: malioboro
ThreadText: # Can a sentence have different parse trees?
  
  (Asked by: username_0 on 2019-03-02)
  
  I just read about the concept of a [parse tree](https://en.wikipedia.org/wiki/Parse_tree).
  
  In my understanding, a valid parse tree of a sentence needs to be validated by a linguistic expert. So, I concluded, a sentence only has one parse tree.
  
  But, is that correct? Is it possible a sentence has more than one valid parse tree (e.g. constituency-based)?
  
  **Tags:** natural-language-processing
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2019-03-02. Score: 4 | Accepted answer
  
  > But, is that correct? Is it possible a sentence has more than one valid parse tree (e.g. constituency-based)?
  
  The fact that a single sequence of words can be parsed in different ways depending on context (or "grounding") is a common basis of miscommunication, misunderstanding, innuendo and jokes.
  
  One classic NLP-related "joke" (around longer than modern AI and NLP) is:
  
  > Time flies like an arrow.
  >
  > Fruit flies like a banana.
  
  There are actually [several valid parse trees](https://en.wikipedia.org/wiki/Time_flies_like_an_arrow;_fruit_flies_like_a_banana) for even these simple sentences. Which ones come "naturally" will depend on context - anecdotally I only half got the joke when I was younger, because I did not know there were such things as *[fruit flies](https://entomology.ca.uky.edu/ef621)*, so I was partly confused by literal (but still validly parsed, and *somewhat* funny) meaning that all fruit can fly about as well as a banana does.
  
  Analysing these kinds of ambiguous sentences leads to the [grounding problem](http://www.scholarpedia.org/article/Symbol_grounding_problem) - the fact that without some referent for symbols, a grammar is devoid of meaning, even if you know the rules and can construct valid sequences. For instance, the above joke works partly because the nature of time, when referred in a particular way (singular noun, not as a possession or property of another object), leads to a well-known metaphorical reading of the first sentence.
  
  A statistical ML parser could get both sentences correct through training on many relevant examples (or trivially by including the examples themselves with correct parse trees). This has not solved the grounding problem, but may be of practical use for any machine required to handle natural language input and map it to some task.
  
  I did check a while ago though, and most Parts Of Speech taggers in Pythons NLTK get both sentences wrong - I suspect because resolving sentences like those above and AI "getting language jokes" is not a high priority compared to more practical uses for chatbots/summarisers, etc.
  
  
  ---
  
  ### Answer by username_1 on 2019-03-02. Score: 1
  
  Grammars in NLP basically correspond to [Context-free Grammars(CFG)](https://en.wikipedia.org/wiki/Context-free_grammar) in formal Language theory. And, in case the CFG corresponding to the NLP task is [ambiguous](https://en.wikipedia.org/wiki/Ambiguous_grammar), then corresponding to a single sentence (more formally *derivation*), there can be multiple Parse Trees.  
  Hence, it depends on the grammar whether there can be more than one valid parse tree.
  
  
  ---
  
  