dair-iitd / OpenIE-standalone

Other
565 stars 73 forks source link

Null Pointer Exception on some sentences that do not end with a "." Full stop. #21

Closed hthuwal closed 5 years ago

hthuwal commented 5 years ago

Steps to Reproduce Error

java -jar openie-assembly.jar

Input Sentences
  1. India is Great
    • Output: 0.84 (India; is; Great)
  2. The United State of America
    • Output: The United State of America
  3. Chemical Reaction and Equations
    • Output: Null Pointer Exception
  4. Chemical Reaction and Equations.
    • Output: Chemical Reaction and Equations.
Stack Trace for 3
Error on sentence: Chemical Reaction and Equations
Exception in thread "main" java.lang.NullPointerException
    at edu.iitd.cse.open_nre.onre.domain.OnrePatternNode.<init>(OnrePatternNode.java:47)
    at edu.iitd.cse.open_nre.onre.helper.OnreHelper_graph.convertGraph2PatternTree_helper(OnreHelper_graph.java:98)
    at edu.iitd.cse.open_nre.onre.helper.OnreHelper_graph.convertGraph2PatternTree(OnreHelper_graph.java:51)
    at edu.iitd.cse.open_nre.onre.helper.MayIHelpYou.runMe(MayIHelpYou.java:32)
    at edu.knowitall.openie.OpenIE$$anonfun$extract$1.apply(OpenIE.scala:176)
    at edu.knowitall.openie.OpenIE$$anonfun$extract$1.apply(OpenIE.scala:166)
    at scala.collection.Iterator$class.foreach(Iterator.scala:727)
    at scala.collection.AbstractIterator.foreach(Iterator.scala:1157)
    at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
    at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
    at edu.knowitall.openie.OpenIE.extract(OpenIE.scala:166)
    at edu.knowitall.openie.OpenIE.extract(OpenIE.scala:61)
    at edu.knowitall.openie.OpenIECli$$anonfun$run$1$$anonfun$apply$mcV$sp$2$$anonfun$apply$4$$anonfun$apply$6.apply(OpenIECli.scala:227)
    at edu.knowitall.openie.OpenIECli$$anonfun$run$1$$anonfun$apply$mcV$sp$2$$anonfun$apply$4$$anonfun$apply$6.apply(OpenIECli.scala:222)
    at scala.collection.Iterator$class.foreach(Iterator.scala:727)
    at scala.collection.AbstractIterator.foreach(Iterator.scala:1157)
    at edu.knowitall.openie.OpenIECli$$anonfun$run$1$$anonfun$apply$mcV$sp$2$$anonfun$apply$4.apply(OpenIECli.scala:222)
    at edu.knowitall.openie.OpenIECli$$anonfun$run$1$$anonfun$apply$mcV$sp$2$$anonfun$apply$4.apply(OpenIECli.scala:214)
    at resource.AbstractManagedResource$$anonfun$5.apply(AbstractManagedResource.scala:86)
    at scala.util.control.Exception$Catch$$anonfun$either$1.apply(Exception.scala:124)
    at scala.util.control.Exception$Catch$$anonfun$either$1.apply(Exception.scala:124)
    at scala.util.control.Exception$Catch.apply(Exception.scala:102)
    at scala.util.control.Exception$Catch.either(Exception.scala:124)
    at resource.AbstractManagedResource.acquireFor(AbstractManagedResource.scala:86)
    at resource.ManagedResourceOperations$class.acquireAndGet(ManagedResourceOperations.scala:25)
    at resource.AbstractManagedResource.acquireAndGet(AbstractManagedResource.scala:48)
    at resource.ManagedResourceOperations$class.foreach(ManagedResourceOperations.scala:45)
    at resource.AbstractManagedResource.foreach(AbstractManagedResource.scala:48)
    at edu.knowitall.openie.OpenIECli$$anonfun$run$1$$anonfun$apply$mcV$sp$2.apply(OpenIECli.scala:214)
    at edu.knowitall.openie.OpenIECli$$anonfun$run$1$$anonfun$apply$mcV$sp$2.apply(OpenIECli.scala:213)
    at resource.AbstractManagedResource$$anonfun$5.apply(AbstractManagedResource.scala:86)
    at scala.util.control.Exception$Catch$$anonfun$either$1.apply(Exception.scala:124)
    at scala.util.control.Exception$Catch$$anonfun$either$1.apply(Exception.scala:124)
    at scala.util.control.Exception$Catch.apply(Exception.scala:102)
    at scala.util.control.Exception$Catch.either(Exception.scala:124)
    at resource.AbstractManagedResource.acquireFor(AbstractManagedResource.scala:86)
    at resource.ManagedResourceOperations$class.acquireAndGet(ManagedResourceOperations.scala:25)
    at resource.AbstractManagedResource.acquireAndGet(AbstractManagedResource.scala:48)
    at resource.ManagedResourceOperations$class.foreach(ManagedResourceOperations.scala:45)
    at resource.AbstractManagedResource.foreach(AbstractManagedResource.scala:48)
    at edu.knowitall.openie.OpenIECli$$anonfun$run$1.apply$mcV$sp(OpenIECli.scala:213)
    at edu.knowitall.openie.OpenIECli$$anonfun$run$1.apply(OpenIECli.scala:213)
    at edu.knowitall.openie.OpenIECli$$anonfun$run$1.apply(OpenIECli.scala:213)
    at edu.knowitall.common.Timing$.time(Timing.scala:50)
    at edu.knowitall.common.Timing$.timeThen(Timing.scala:72)
    at edu.knowitall.openie.OpenIECli$.run(OpenIECli.scala:241)
    at edu.knowitall.openie.OpenIECli$delayedInit$body.apply(OpenIECli.scala:176)
    at scala.Function0$class.apply$mcV$sp(Function0.scala:40)
    at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
    at scala.App$$anonfun$main$1.apply(App.scala:71)
    at scala.App$$anonfun$main$1.apply(App.scala:71)
    at scala.collection.immutable.List.foreach(List.scala:318)
    at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:32)
    at scala.App$class.main(App.scala:71)
    at edu.knowitall.openie.OpenIECli$.main(OpenIECli.scala:30)
    at edu.knowitall.openie.OpenIECli.main(OpenIECli.scala)
swarnaHub commented 5 years ago

I don't think it's an issue with full stop. "Chemical Reaction and Equations" is not a complete sentence and hence the parsing error. I tried many complete sentences without full stops and they are working fine.

If the exceptions are causing your program to stop, you can get rid of it by passing "--ignore-errors" as an argument to the jar. The sentences you referred to are anyways not supposed to generate any extractions, so this solution should work for you.

hthuwal commented 5 years ago

Yeah, I was expecting it to just ignore the incomplete sentence. Thanx for pointing out the --ignore-errors flag. I missed it in the Readme.