Revision: 16629
          http://sourceforge.net/p/gate/code/16629
Author:   ggorrell
Date:     2013-04-04 09:53:48 +0000 (Thu, 04 Apr 2013)
Log Message:
-----------
ML fixes:
- trying to apply a non-existent model is worth more than a printout on 
System.err
- delete pre-existing model dir before writing out the new version.

Modified Paths:
--------------
    gate/trunk/plugins/Learning/src/gate/learning/LearningAPIMain.java
    
gate/trunk/plugins/Learning/src/gate/learning/learners/MultiClassLearning.java

Modified: gate/trunk/plugins/Learning/src/gate/learning/LearningAPIMain.java
===================================================================
--- gate/trunk/plugins/Learning/src/gate/learning/LearningAPIMain.java  
2013-04-04 01:47:53 UTC (rev 16628)
+++ gate/trunk/plugins/Learning/src/gate/learning/LearningAPIMain.java  
2013-04-04 09:53:48 UTC (rev 16629)
@@ -14,6 +14,7 @@
 import gate.creole.ExecutionException;
 import gate.creole.ResourceInstantiationException;
 import gate.util.*;
+
 import java.io.*;
 import java.net.URISyntaxException;
 import java.net.URL;
@@ -319,9 +320,8 @@
                   wdResults.toString() + File.separator
                           + ConstantParameters.FILENAMEOFModels;
           if(!new File(modelFileName).exists()) {
-            System.out
-                    .println("Warning: the model is not available at the 
moment!!");
-            return;
+            throw new ExecutionException("The model is not available at " + 
+                modelFileName + "!");
           }
           BufferedWriter outNLPFeatures = null;
           BufferedReader inNLPFeatures = null;
@@ -660,9 +660,8 @@
                     wdResults.toString() + File.separator
                             + ConstantParameters.FILENAMEOFModels;
             if(!new File(modelFileName).exists()) {
-              System.out
-                      .println("Warning: the model is not available at the 
moment!");
-              return;
+              throw new ExecutionException("The model is not available at " + 
+                  modelFileName + "!");
             }
             if(endDocIdApp > startDocIdApp) {
               if(LogService.minVerbosityLevel > 0)

Modified: 
gate/trunk/plugins/Learning/src/gate/learning/learners/MultiClassLearning.java
===================================================================
--- 
gate/trunk/plugins/Learning/src/gate/learning/learners/MultiClassLearning.java  
    2013-04-04 01:47:53 UTC (rev 16628)
+++ 
gate/trunk/plugins/Learning/src/gate/learning/learners/MultiClassLearning.java  
    2013-04-04 09:53:48 UTC (rev 16629)
@@ -134,10 +134,14 @@
       + array1.size(), 1);
     // Open the mode file for writing the model into it
     try {
-      if(modelFile.exists() && !modelFile.isDirectory()) {
-        if(!modelFile.delete()) { throw new IOException(
-          "Existing single-file model " + modelFile + " could not be 
deleted."); }
+      if(modelFile.exists()) {
+        deleteRecursively(modelFile);
       }
+      
+//      if(modelFile.exists() && !modelFile.isDirectory()) {
+//        if(!modelFile.delete()) { throw new IOException(
+//          "Existing single-file model " + modelFile + " could not be 
deleted."); }
+//      }
       if(!modelFile.exists()) {
         if(!modelFile.mkdirs()) { throw new IOException(
           "Couldn't create directory for model files"); }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to