Revision: 17679
          http://sourceforge.net/p/gate/code/17679
Author:   markagreenwood
Date:     2014-03-15 18:21:27 +0000 (Sat, 15 Mar 2014)
Log Message:
-----------
cleaned up the LingPipe plugin and turned on the compiler warnings

Modified Paths:
--------------
    gate/trunk/plugins/LingPipe/build.xml
    gate/trunk/plugins/LingPipe/src/gate/lingpipe/LanguageIdentifierPR.java
    gate/trunk/plugins/LingPipe/src/gate/lingpipe/NamedEntityRecognizerPR.java
    gate/trunk/plugins/LingPipe/src/gate/lingpipe/POSTaggerPR.java
    gate/trunk/plugins/LingPipe/src/gate/lingpipe/SentenceSplitterPR.java
    gate/trunk/plugins/LingPipe/src/gate/lingpipe/TokenizerPR.java

Modified: gate/trunk/plugins/LingPipe/build.xml
===================================================================
--- gate/trunk/plugins/LingPipe/build.xml       2014-03-15 18:12:14 UTC (rev 
17678)
+++ gate/trunk/plugins/LingPipe/build.xml       2014-03-15 18:21:27 UTC (rev 
17679)
@@ -17,6 +17,7 @@
   <property name="gate.home" location="../.." />
   <property name="gate.jar" location="${gate.home}/bin/gate.jar" />
   <property name="gate.lib" location="${gate.home}/lib" />
+  <property name="gate.compile.maxwarnings" value="10000" />
 
   <path id="classpath">
     <pathelement location="${gate.jar}" />
@@ -40,8 +41,11 @@
   <target name="compile" depends="init"
          description="compile the source " >
     <!-- Compile the java code from ${src} into ${build} -->
-    <javac srcdir="${src}" destdir="${build}" debug="true" source="1.5" 
target="1.5">
-      <classpath refid="classpath"/> 
+    <javac srcdir="${src}" destdir="${build}" debug="true" source="1.6" 
target="1.6">
+      <classpath refid="classpath"/>
+      <compilerarg value="-Xmaxwarns" />
+      <compilerarg value="${gate.compile.maxwarnings}" />
+      <compilerarg value="-Xlint:all" />
     </javac>
   </target>
 

Modified: 
gate/trunk/plugins/LingPipe/src/gate/lingpipe/LanguageIdentifierPR.java
===================================================================
--- gate/trunk/plugins/LingPipe/src/gate/lingpipe/LanguageIdentifierPR.java     
2014-03-15 18:12:14 UTC (rev 17678)
+++ gate/trunk/plugins/LingPipe/src/gate/lingpipe/LanguageIdentifierPR.java     
2014-03-15 18:21:27 UTC (rev 17679)
@@ -9,19 +9,28 @@
  */
 package gate.lingpipe;
 
-import gate.*;
+import gate.Annotation;
+import gate.AnnotationSet;
+import gate.ProcessingResource;
+import gate.Resource;
+import gate.Utils;
 import gate.creole.AbstractLanguageAnalyser;
 import gate.creole.ExecutionException;
 import gate.creole.ResourceInstantiationException;
+import gate.creole.metadata.CreoleParameter;
+import gate.creole.metadata.CreoleResource;
+import gate.creole.metadata.Optional;
+import gate.creole.metadata.RunTime;
 import gate.util.GateRuntimeException;
+
 import java.io.File;
 import java.io.IOException;
 import java.net.URISyntaxException;
 import java.net.URL;
+
 import com.aliasi.classify.Classification;
 import com.aliasi.classify.LMClassifier;
 import com.aliasi.util.AbstractExternalizable;
-import gate.creole.metadata.*;
 
 /**
  * A Processing resource to identify language of the document based on
@@ -62,6 +71,7 @@
   protected File modelFile;
 
   /** classifier object */
+  @SuppressWarnings("rawtypes")
   protected LMClassifier classifier;
 
   /** document feature name */
@@ -75,6 +85,7 @@
    * @return Resource
    * @throws ResourceInstantiationException
    */
+  @SuppressWarnings("rawtypes")
   public Resource init() throws ResourceInstantiationException {
     if(modelFileUrl == null)
       throw new ResourceInstantiationException("No model file provided!");

Modified: 
gate/trunk/plugins/LingPipe/src/gate/lingpipe/NamedEntityRecognizerPR.java
===================================================================
--- gate/trunk/plugins/LingPipe/src/gate/lingpipe/NamedEntityRecognizerPR.java  
2014-03-15 18:12:14 UTC (rev 17678)
+++ gate/trunk/plugins/LingPipe/src/gate/lingpipe/NamedEntityRecognizerPR.java  
2014-03-15 18:21:27 UTC (rev 17679)
@@ -30,6 +30,8 @@
 public class NamedEntityRecognizerPR extends AbstractLanguageAnalyser 
implements
                                                                      
ProcessingResource {
 
+  private static final long serialVersionUID = 6157830435067675635L;
+
   /** File which cotains model for NE */
   protected URL modelFileUrl;
 

Modified: gate/trunk/plugins/LingPipe/src/gate/lingpipe/POSTaggerPR.java
===================================================================
--- gate/trunk/plugins/LingPipe/src/gate/lingpipe/POSTaggerPR.java      
2014-03-15 18:12:14 UTC (rev 17678)
+++ gate/trunk/plugins/LingPipe/src/gate/lingpipe/POSTaggerPR.java      
2014-03-15 18:21:27 UTC (rev 17679)
@@ -150,6 +150,7 @@
         List<String> theTags = tags.get(score);
         for(int m = 0; m < theTags.size(); m++) {
           FeatureMap f = tokenList.get(m).getFeatures();
+          @SuppressWarnings("unchecked")
           Map<String, Set<Double>> scores = (Map<String, Set<Double>>) 
f.get("category");
           if(scores == null) {
             scores = new HashMap<String, Set<Double>>();
@@ -191,7 +192,7 @@
     Map<Double, List<String>> toReturn = new HashMap<Double, List<String>>();
     Iterator<ScoredTagging<String>> nBestIt = decoder.tagNBest(tokens, 5);
     for(int n = 0; n < nBest.intValue() && nBestIt.hasNext(); ++n) {
-      ScoredTagging<String> tagScores = (ScoredTagging<String>) nBestIt.next();
+      ScoredTagging<String> tagScores = nBestIt.next();
       double score = tagScores.score();
       List<String> tags = tagScores.tags();
       toReturn.put(new Double(score), tags);

Modified: gate/trunk/plugins/LingPipe/src/gate/lingpipe/SentenceSplitterPR.java
===================================================================
--- gate/trunk/plugins/LingPipe/src/gate/lingpipe/SentenceSplitterPR.java       
2014-03-15 18:12:14 UTC (rev 17678)
+++ gate/trunk/plugins/LingPipe/src/gate/lingpipe/SentenceSplitterPR.java       
2014-03-15 18:21:27 UTC (rev 17679)
@@ -27,6 +27,8 @@
 public class SentenceSplitterPR extends AbstractLanguageAnalyser implements
                ProcessingResource {
 
+  private static final long serialVersionUID = -1474263938869304875L;
+
   /**
    * Instance of the tokeniser
    */
@@ -105,7 +107,7 @@
 
                Chunking chunking = SENTENCE_CHUNKER.chunk(text.toCharArray(), 
0, text
                                .length());
-               Set sentences = chunking.chunkSet();
+               Set<Chunk> sentences = chunking.chunkSet();
                if (sentences.size() < 1) {
                        System.out.println("No sentence chunks found.");
                        return;
@@ -113,8 +115,8 @@
 
                FeatureMap map = gate.Factory.newFeatureMap();
                int i=1;
-               for (Iterator it = sentences.iterator(); it.hasNext();i++) {
-                       Chunk sentence = (Chunk) it.next();
+               for (Iterator<Chunk> it = sentences.iterator(); 
it.hasNext();i++) {
+                       Chunk sentence = it.next();
                        int start = sentence.start();
                        int end = sentence.end();
                        try {

Modified: gate/trunk/plugins/LingPipe/src/gate/lingpipe/TokenizerPR.java
===================================================================
--- gate/trunk/plugins/LingPipe/src/gate/lingpipe/TokenizerPR.java      
2014-03-15 18:12:14 UTC (rev 17678)
+++ gate/trunk/plugins/LingPipe/src/gate/lingpipe/TokenizerPR.java      
2014-03-15 18:21:27 UTC (rev 17679)
@@ -18,6 +18,9 @@
  */
 public class TokenizerPR extends AbstractLanguageAnalyser implements
                                                          ProcessingResource {
+
+  private static final long serialVersionUID = -6429885471274279223L;
+
   /**
    * Name of the output annotation set
    */

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


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to