Message Boards Message Boards

Avoid Java exception from scaling TextStructure[]?

Posted 8 years ago

This function is listed as EXPERIMENTAL anyway (ref/TextStructure), so I am mostly documenting the occurrence, so when the engineer who works on this does investigate, this is another test case.

This gnarly sentence causes TextStructure[] to blow up with a java exception.

The University may terminate this lease when the Lessee, having made application and executed this lease in advance of enrollment, is not eligible to enroll or fails to enroll in the University or leaves the University at any time prior to the expiration of this lease, or for violation of any provisions of this lease, or for violation of any University regulation relative to resident Halls, or for health reasons, by providing the student with written notice of this termination 30 days prior to the effective data of termination, unless life, limb, or property would be jeopardized, the Lessee engages in the sales of purchase of controlled substances in violation of federal, state or local law, or the Lessee is no longer enrolled as a student, or the Lessee engages in the use or possession of firearms, explosives, inflammable liquids, fireworks, or other dangerous weapons within the building, or turns in a false alarm, in which cases a maximum of 24 hours notice would be sufficient.

Of course, this sentence is very difficult for humans to read. Mma V11 on Mac ElCap gives this error:

error received from TextStructure

Any help is appreciated.

Attachments:
POSTED BY: Aeyoss Antelope

It takes more than a minute even for Stanfords nlp package, but it does work when restarting Java with special JVMArguments. I tried to just use InstallJava, but that was not enough, somehow. I have to first initialize the TextStructure code by calling something simple like TextStructure["JLink is fantastic"]; Then use ReinstallJava with extra JVMArguments arguments. Credits go to Vitalii Fedorenko

AbsoluteTiming[TextStructure["JLink is fantastic"];
 JLink`ReinstallJava[
  JLink`JVMArguments -> {"-Xmx1g -XX:+UseConcMarkSweepGC"}];
 TextStructure[
  "The University may terminate this lease when the Lessee, having \
made application and executed this lease in advance of enrollment, is \
not eligible to enroll or fails to enroll in the University or leaves \
the University at any time prior to the expiration of this lease, or \
for violation of any provisions of this lease, or for violation of \
any University regulation relative to resident Halls, or for health \
reasons, by providing the student with written notice of this \
termination 30 days prior to the effective data of termination, \
unless life, limb, or property would be jeopardized, the Lessee \
engages in the sales of purchase of controlled substances in \
violation of federal, state or local law, or the Lessee is no longer \
enrolled as a student, or the Lessee engages in the use or possession \
of firearms, explosives, inflammable liquids, fireworks, or other \
dangerous weapons within the building, or turns in a false alarm, in \
which cases a maximum of 24 hours notice would be sufficient."]]

enter image description here

POSTED BY: Rolf Mertig
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract