title: GATE machine learning doesn't work
body: <p>I want to use batch learning PR to conduct text classification in GATE. I firstly write this configure XML and it can work.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?xml version="1.0"?&gt;
  &lt;ML-CONFIG&gt;
    &lt;VERBOSITY level="1"/&gt;
    &lt;SURROUND value="false"/&gt;
    &lt;PARAMETER name="thresholdProbabilityClassification" 
        value="0.5"/&gt;
    &lt;multiClassification2Binary method="one-vs-others"/&gt;
    &lt;EVALUATION method="kfold" 
         runs="5"
         ratio="0.66" /&gt;
    &lt;ENGINE nickname="PAUM" 
     implementationName="PAUM"
     options=" -p 50 -n 5 -optB 0.0  "/&gt;
    &lt;DATASET&gt;
      &lt;INSTANCE-TYPE&gt;emotion&lt;/INSTANCE-TYPE&gt;
      
      &lt;NGRAM&gt;
        &lt;NAME&gt;ngram&lt;/NAME&gt;
        &lt;NUMBER&gt;1&lt;/NUMBER&gt;
        &lt;CONSNUM&gt;4&lt;/CONSNUM&gt;
        
        &lt;CONS-1&gt;
          &lt;TYPE&gt;Token&lt;/TYPE&gt;
          &lt;FEATURE&gt;string&lt;/FEATURE&gt;
        &lt;/CONS-1&gt;
     
     &lt;CONS-2&gt;
          &lt;TYPE&gt;word_bag&lt;/TYPE&gt;
          &lt;FEATURE&gt;feature&lt;/FEATURE&gt;
        &lt;/CONS-2&gt;
     
     &lt;CONS-3&gt;
          &lt;TYPE&gt;hashtag&lt;/TYPE&gt;
          &lt;FEATURE&gt;feature&lt;/FEATURE&gt;
        &lt;/CONS-3&gt;
     
      &lt;CONS-4&gt;
          &lt;TYPE&gt;Token&lt;/TYPE&gt;
          &lt;FEATURE&gt;category&lt;/FEATURE&gt;
        &lt;/CONS-4&gt;
     &lt;WEIGHT&gt;2&lt;/WEIGHT&gt;
      &lt;/NGRAM&gt;
      
      &lt;ATTRIBUTE&gt;
        &lt;NAME&gt;Class&lt;/NAME&gt;
        &lt;SEMTYPE&gt;NOMINAL&lt;/SEMTYPE&gt;
        &lt;TYPE&gt;emotion&lt;/TYPE&gt;
        &lt;FEATURE&gt;feature&lt;/FEATURE&gt;
        &lt;POSITION&gt;0&lt;/POSITION&gt;
        &lt;CLASS/&gt;
      &lt;/ATTRIBUTE&gt;
      
    &lt;/DATASET&gt;
  &lt;/ML-CONFIG&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>However, when I change the order of CONS, like the following, It doesn't work.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?xml version="1.0"?&gt;
  &lt;ML-CONFIG&gt;
    &lt;VERBOSITY level="1"/&gt;
    &lt;SURROUND value="false"/&gt;
    &lt;PARAMETER name="thresholdProbabilityClassification" 
        value="0.5"/&gt;
    &lt;multiClassification2Binary method="one-vs-others"/&gt;
    &lt;EVALUATION method="kfold" 
         runs="5"
         ratio="0.66" /&gt;
    &lt;ENGINE nickname="PAUM" 
     implementationName="PAUM"
     options=" -p 50 -n 5 -optB 0.0  "/&gt;
    &lt;DATASET&gt;
      &lt;INSTANCE-TYPE&gt;emotion&lt;/INSTANCE-TYPE&gt;
      
      &lt;NGRAM&gt;
        &lt;NAME&gt;ngram&lt;/NAME&gt;
        &lt;NUMBER&gt;1&lt;/NUMBER&gt;
        &lt;CONSNUM&gt;4&lt;/CONSNUM&gt;
          
     &lt;CONS-1&gt;
          &lt;TYPE&gt;word_bag&lt;/TYPE&gt;
          &lt;FEATURE&gt;feature&lt;/FEATURE&gt;
        &lt;/CONS-1&gt;
     
     &lt;CONS-2&gt;
          &lt;TYPE&gt;hashtag&lt;/TYPE&gt;
          &lt;FEATURE&gt;feature&lt;/FEATURE&gt;
        &lt;/CONS-2&gt;
     
      &lt;CONS-3&gt;
          &lt;TYPE&gt;Token&lt;/TYPE&gt;
          &lt;FEATURE&gt;category&lt;/FEATURE&gt;
        &lt;/CONS-3&gt;
    
     &lt;CONS-4&gt;
          &lt;TYPE&gt;Token&lt;/TYPE&gt;
          &lt;FEATURE&gt;string&lt;/FEATURE&gt;
        &lt;/CONS-4&gt;
  
  
     
     &lt;WEIGHT&gt;2&lt;/WEIGHT&gt;
      &lt;/NGRAM&gt;
      
      &lt;ATTRIBUTE&gt;
        &lt;NAME&gt;Class&lt;/NAME&gt;
        &lt;SEMTYPE&gt;NOMINAL&lt;/SEMTYPE&gt;
        &lt;TYPE&gt;emotion&lt;/TYPE&gt;
        &lt;FEATURE&gt;feature&lt;/FEATURE&gt;
        &lt;POSITION&gt;0&lt;/POSITION&gt;
        &lt;CLASS/&gt;
      &lt;/ATTRIBUTE&gt;
      
    &lt;/DATASET&gt;
  &lt;/ML-CONFIG&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>However, the last one can be loaded into GATE and every time I run the batch learning PR, there goes the following error information:</p>
  
  <blockquote>
    <p>java.lang.NullPointerException
        at gate.learning.NLPFeaturesOfDoc.writeNLPFeaturesToFile(NLPFeaturesOfDoc.java:818)
        at gate.learning.LightWeightLearningApi.annotations2NLPFeatures(LightWeightLearningApi.java:198)
        at gate.learning.EvaluationBasedOnDocs.oneRun(EvaluationBasedOnDocs.java:388)
        at gate.learning.EvaluationBasedOnDocs.kfoldEval(EvaluationBasedOnDocs.java:197)
        at gate.learning.EvaluationBasedOnDocs.evaluation(EvaluationBasedOnDocs.java:118)
        at gate.learning.LearningAPIMain.execute(LearningAPIMain.java:776)
        at gate.util.Benchmark.executeWithBenchmarking(Benchmark.java:291)
        at gate.creole.ConditionalSerialController.runComponent(ConditionalSerialController.java:163)
        at gate.creole.SerialController.executeImpl(SerialController.java:157)
        at gate.creole.ConditionalSerialAnalyserController.executeImpl(ConditionalSerialAnalyserController.java:225)
        at gate.creole.ConditionalSerialAnalyserController.execute(ConditionalSerialAnalyserController.java:132)
        at gate.util.Benchmark.executeWithBenchmarking(Benchmark.java:291)
        at gate.gui.SerialControllerEditor$RunAction$1.run(SerialControllerEditor.java:1728)
        at java.lang.Thread.run(Unknown Source)</p>
  </blockquote>
  
  <p>Does anyone have any idea for this problem?</p>
  
  <p>Thanks a lot!</p>