gateplugin-LearningFramework
gateplugin-LearningFramework copied to clipboard
Implement our own options parsing class and use in Parms
Currently we use a modified version of apache commons-cli: originally it looked like the best match, then we had to hack it and now it turns out this was a very bad idea: GCP also uses commons-cli which gets loaded first so our code throws an exception:
java.lang.IllegalAccessError: tried to access method
org.apache.commons.cli.Options.getOptionGroups()Ljava/util/Collection;
from class org.apache.commons.cli.DefaultParser
at org.apache.commons.cli.DefaultParser.parse(DefaultParser.java:113)
at org.apache.commons.cli.DefaultParser.parse(DefaultParser.java:80)
at org.apache.commons.cli.DefaultParser.parse(DefaultParser.java:64)
at gate.plugin.learningframework.engines.Parms.<init>(Parms.java:93)
at gate.plugin.learningframework.engines.EngineLibSVM.trainModel(EngineLibSVM.java:157)
at gate.plugin.learningframework.LF_TrainClassification.afterLastDocument(LF_TrainClassification.java:201)
at gate.plugin.learningframework.AbstractDocumentProcessor.controllerExecutionFinished(AbstractDocumentProcessor.java:100)
at gate.creole.ConditionalSerialAnalyserController.invokeControllerExecutionFinished(ConditionalSerialAnalyserController.java:554)
at gate.cloud.batch.PooledDocumentProcessor.dispose(PooledDocumentProcessor.java:367)
at gate.cloud.batch.BatchRunner$JobMonitor.run(BatchRunner.java:364)
at java.lang.Thread.run(Thread.java:745)
Or move your hacked version into a different package.
my question would be why do you need to hack it? surely there must be a way of using it "as is"
Yes, changing the package name is probably a good idea until a proper fix is found. The change is small anyway, currently I just include the diff in the LF distribution
https://github.com/GateNLP/gateplugin-LearningFramework/blob/master/commons-cli.diff
Mark, I needed something to work differently in an urgency and hacking the right version was the fastest way to do this - I had always been planning on replacing it anyway (for other reasons as well) so I did not bother to make an attempt to do it right.
There is even an issue for part of what I need, but my impression is that commons-cli did not receive much love recently: https://issues.apache.org/jira/browse/CLI-257
Accidently added wrong commit message