laito / cleartk

Automatically exported from code.google.com/p/cleartk
0 stars 0 forks source link

ClearNLP Semantic Role Labeler throws null pointer exception when dependency parser is unable to handle target sentence #344

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Occasionally when the dependency parser is given a "bad" sentence, produces a 
parse with only a TopDependencyNode that has a null pointer for its head 
relations array.   When it comes time to prepare the data for the Semantic Role 
Labeler, this causes a null pointer exception at this line:

          DependencyRelation headRelation = (DependencyRelation) casDepNode.getHeadRelations().get(0);

Even if this line is skipped, this condition causes problems downstream when 
actually running ClearNLP.  A sentence consisting solely of a URL will produce 
this kind of condition.  

The simplest solution is to add a skipSentence boolean flag, that skips both 
setup and execution of ClearNLP for these kinds of sentences.

Original issue reported on code.google.com by lee.becker on 5 Dec 2012 at 11:20

GoogleCodeExporter commented 9 years ago
This issue was closed by revision f876bbe42a25.

Original comment by lee.becker on 2 Jan 2013 at 11:10