I have explored mallet and it is working good. What I am trying to do is making a model twice in a program scope and facing exception. My program code is as:
List<String> commands = new ArrayList<String>();
commands.add("--input input.mallet --output-classifier output_classifier.classifier --trainer MaxEnt --report train:accuracy");
commands.add("--input input.mallet --output-classifier output_classifier.classifier --trainer MaxEnt --report train:accuracy");
for( int index = 0; index < commands.size(); index++ ) {
try {
Vectors2Classify.main(commands.get(index).split(" "));
} catch (EvalError e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
First one command is running successfully. On second command I am getting following exception.
Exception in thread "main" java.lang.IllegalArgumentException: Alphabets don't match: Instance: [9327, 3], InstanceList: [9327, 3]
at cc.mallet.types.InstanceList.add(InstanceList.java:335)
at cc.mallet.types.InstanceList.shallowClone(InstanceList.java:213)
at cc.mallet.types.InstanceList.split(InstanceList.java:513)
at cc.mallet.classify.tui.Vectors2Classify.main(Vectors2Classify.java:397)
I have searched this problem but did not found any solution till now. It look like that no one have tried until now making a model twice in a program scope.
If anyone can help me on this, will be thankful to you.