HazyResearch / bazaar

14 stars 11 forks source link

Exception and no TSV's #15

Open sgt101 opened 8 years ago

sgt101 commented 8 years ago

Hello, I get :

Exception in thread "main" java.lang.ClassCastException: play.api.libs.json.JsNull$ cannot be cast to play.api.libs.json.JsString at com.clearcut.nlp.JSONReader$$anonfun$1.apply(JSONReader.scala:40) at com.clearcut.nlp.JSONReader$$anonfun$1.apply(JSONReader.scala:40) at scala.Option.map(Option.scala:145) at com.clearcut.nlp.JSONReader.fetchNext(JSONReader.scala:40) at com.clearcut.nlp.JSONReader.next(JSONReader.scala:18) at com.clearcut.nlp.JSONReader.next(JSONReader.scala:7) at scala.collection.Iterator$class.foreach(Iterator.scala:727) at com.clearcut.nlp.JSONReader.foreach(JSONReader.scala:7) at com.clearcut.nlp.Main$delayedInit$body.apply(Main.scala:116) 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 com.clearcut.nlp.Main$.main(Main.scala:10) at com.clearcut.nlp.Main.main(Main.scala)

And no .tsv file appears. There are .parsed files that have data in them in my *.json.split directory, but only 2 out of 457 have any data in them.

What's gone wrong?

sgt101 commented 8 years ago

Hello - It looks like catching the exception at line 40 in JSONReader does the job here. I'm currently running a test case, so will update if I get a good result out of it.

sgt101 commented 8 years ago

Yes - that works, my scala is dire so although I've forked and committed a patch to my master others may want to write a proper handler and possibly a switch not to use it - some users might want to know that some nulls have crept in (whereas I don't care because the data is so noisy just getting sense out of a part of it makes me happy).