roman-kutlak/nlglib

Unable to run simplenlg.jar locally

pjain188 opened this issue · 1 comments

Hi Roman,
I tried using simplenlg.jar to run the realizer locally. I have changed the path which was hard coded , but then I am getting the below error. Though lexAccess2013.data is downloaded from simplenlg . Pease suggest the steps how you had run it locally or if I am doing some mistake

(base) C02Q49E6FVH5:simplenlg_jar_to extract pjain188$ java -jar simplenlg.jar
Port Number used by Server is: 50007
Server is using the following lexicon: /Users/pjain188/Documents/simplenlg_jar_to extract/lexAccess2013.data
[Fatal Error] lexAccess2013.data:1:1: Content is not allowed in prolog.
org.xml.sax.SAXParseException; systemId: file:/Users/pjain188/Documents/simplenlg_jar_to%20extract/lexAccess2013.data; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
:>Waiting for client on port 50007...

Thanks and Regards,
Priyanka

Hello Priyanka,

I had another look at this and I don't think simplenlg (server) will run under the new java versions. It is using some java-internal API which was removed in java 11 (https://stackoverflow.com/questions/43574426/how-to-resolve-java-lang-noclassdeffounderror-javax-xml-bind-jaxbexception-in-j). It results in exception like this:

[java] :>Waiting for client on port 50007... [java] simplenlg.xmlrealiser.XMLRealiserException: XML unmarshal error [java] at simplenlg.xmlrealiser.UnWrapper.getNLGSpec(Unknown Source) [java] at simplenlg.xmlrealiser.XMLRealiser.getRequest(Unknown Source) [java] at simplenlg.server.RealisationRequest.doRealisation(Unknown Source) [java] at simplenlg.server.RealisationRequest.run(Unknown Source) [java] at java.base/java.lang.Thread.run(Thread.java:844) [java] Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBContext [java] ... 5 more [java] Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBContext [java] at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582) [java] at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190) [java] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499) [java] ... 5 more

On older java versions of java (java 7 and possibly 8) you should only need to install the java tool ant and run ant run in the simplenlg folder (my fork). Ant will compile and start the simplenlg server with some default parameters.

Other options are to use a different realiser. There is a basic string realiser that does a little inflection and there are some bindings to pynlg (although that project is also no longer maintained and it currently only has French grammar).

If I ever have time, I will look into merging pynlg into this repo and use custom realiser instead of simplenlg but that is on my "if I ever have time" list so don't hold your breath.

Sorry to disappoint.

Best,
Roman