java.io.IOExceptionjava.io.FileNotFoundException



Project stanfordnlp/CoreNLP in file ...tanford.nlp.pipeline.AnnotatorImplementations.java (2015-03-10)
@@ -6,7 +6,7 @@ import edu.stanford.nlp.naturalli.NaturalLogicAnnotator;
 import edu.stanford.nlp.util.PropertiesUtils;
 import edu.stanford.nlp.util.ReflectionLoading;
 
-import java.io.IOException;
+import java.io.FileNotFoundException;
 import java.util.*;
 
 /**
@@ -68,7 +68,7 @@ public class AnnotatorImplementations {
   /**
    * Annotate for named entities -- note that this combines multiple NER tag sets, and some auxiliary things (like temporal tagging)
    */
-  public Annotator ner(Properties properties) throws IOException {
+  public Annotator ner(Properties properties) throws FileNotFoundException {
 
     List<String> models = new ArrayList<String>();
     String modelNames = properties.getProperty("ner.model");
Project stanfordnlp/CoreNLP in file ...tanford.nlp.pipeline.AnnotatorImplementations.java (2015-03-02)
@@ -6,7 +6,7 @@ import edu.stanford.nlp.naturalli.NaturalLogicAnnotator;
 import edu.stanford.nlp.util.PropertiesUtils;
 import edu.stanford.nlp.util.ReflectionLoading;
 
-import java.io.IOException;
+import java.io.FileNotFoundException;
 import java.util.*;
 
 /**
@@ -68,7 +68,7 @@ public class AnnotatorImplementations {
   /**
    * Annotate for named entities -- note that this combines multiple NER tag sets, and some auxiliary things (like temporal tagging)
    */
-  public Annotator ner(Properties properties) throws IOException {
+  public Annotator ner(Properties properties) throws FileNotFoundException {
 
     List<String> models = new ArrayList<String>();
     String modelNames = properties.getProperty("ner.model");
Project stanfordnlp/CoreNLP in file ....edu.stanford.nlp.pipeline.AnnotatorFactories.java (2015-03-10)
@@ -8,7 +8,7 @@ import edu.stanford.nlp.process.WordToSentenceProcessor;
 import edu.stanford.nlp.util.Generics;
 import edu.stanford.nlp.util.PropertiesUtils;
 
-import java.io.IOException;
+import java.io.FileNotFoundException;
 import java.util.Arrays;
 import java.util.Properties;
 import java.util.Set;
@@ -71,8 +71,7 @@ public class AnnotatorFactories {
         } else {
           os.append(StanfordCoreNLP.NEWLINE_SPLITTER_PROPERTY + ':');
           os.append(properties.getProperty(StanfordCoreNLP.NEWLINE_SPLITTER_PROPERTY, "false"));
-          os.append("ssplit.isOneSentence" + ':');
-          os.append(properties.getProperty("ssplit.isOneSentence", "false"));
+          os.append("ssplit.isOneSentence" + ':' + properties.getProperty("ssplit.isOneSentence", "false"));
           os.append(StanfordCoreNLP.NEWLINE_IS_SENTENCE_BREAK_PROPERTY + ':');
           os.append(properties.getProperty(StanfordCoreNLP.NEWLINE_IS_SENTENCE_BREAK_PROPERTY, StanfordCoreNLP.DEFAULT_NEWLINE_IS_SENTENCE_BREAK));
         }
@@ -331,7 +330,7 @@ public class AnnotatorFactories {
       public Annotator create() {
         try {
           return annotatorImplementation.ner(properties);
-        } catch (IOException e) {
+        } catch (FileNotFoundException e) {
           throw new RuntimeIOException(e);
         }
       }
@@ -591,8 +590,6 @@ public class AnnotatorFactories {
   //
   public static AnnotatorFactory quote(Properties properties, final AnnotatorImplementations annotatorImpl) {
     return new AnnotatorFactory(properties, annotatorImpl) {
-      private static final long serialVersionUID = -2525567112379296672L;
-
       @Override
       public Annotator create() {
         return annotatorImpl.quote(properties);
Project stanfordnlp/CoreNLP in file ....edu.stanford.nlp.pipeline.AnnotatorFactories.java (2015-03-02)
@@ -8,7 +8,7 @@ import edu.stanford.nlp.process.WordToSentenceProcessor;
 import edu.stanford.nlp.util.Generics;
 import edu.stanford.nlp.util.PropertiesUtils;
 
-import java.io.IOException;
+import java.io.FileNotFoundException;
 import java.util.Arrays;
 import java.util.Properties;
 import java.util.Set;
@@ -71,8 +71,7 @@ public class AnnotatorFactories {
         } else {
           os.append(StanfordCoreNLP.NEWLINE_SPLITTER_PROPERTY + ':');
           os.append(properties.getProperty(StanfordCoreNLP.NEWLINE_SPLITTER_PROPERTY, "false"));
-          os.append("ssplit.isOneSentence" + ':');
-          os.append(properties.getProperty("ssplit.isOneSentence", "false"));
+          os.append("ssplit.isOneSentence" + ':' + properties.getProperty("ssplit.isOneSentence", "false"));
           os.append(StanfordCoreNLP.NEWLINE_IS_SENTENCE_BREAK_PROPERTY + ':');
           os.append(properties.getProperty(StanfordCoreNLP.NEWLINE_IS_SENTENCE_BREAK_PROPERTY, StanfordCoreNLP.DEFAULT_NEWLINE_IS_SENTENCE_BREAK));
         }
@@ -331,7 +330,7 @@ public class AnnotatorFactories {
       public Annotator create() {
         try {
           return annotatorImplementation.ner(properties);
-        } catch (IOException e) {
+        } catch (FileNotFoundException e) {
           throw new RuntimeIOException(e);
         }
       }
@@ -591,8 +590,6 @@ public class AnnotatorFactories {
   //
   public static AnnotatorFactory quote(Properties properties, final AnnotatorImplementations annotatorImpl) {
     return new AnnotatorFactory(properties, annotatorImpl) {
-      private static final long serialVersionUID = -2525567112379296672L;
-
       @Override
       public Annotator create() {
         return annotatorImpl.quote(properties);
Project stanfordnlp/CoreNLP in file ....edu.stanford.nlp.pipeline.AnnotatorFactories.java (2015-03-20)
@@ -8,7 +8,7 @@ import edu.stanford.nlp.process.WordToSentenceProcessor;
 import edu.stanford.nlp.util.Generics;
 import edu.stanford.nlp.util.PropertiesUtils;
 
-import java.io.IOException;
+import java.io.FileNotFoundException;
 import java.util.Arrays;
 import java.util.Properties;
 import java.util.Set;
@@ -29,19 +29,15 @@ public class AnnotatorFactories {
       @Override
       public Annotator create() {
         String extraOptions = null;
-        boolean keepNewline = Boolean.valueOf(properties.getProperty(StanfordCoreNLP.NEWLINE_SPLITTER_PROPERTY, "false")); // ssplit.eolonly
+        boolean keepNewline = Boolean.valueOf(properties.getProperty(StanfordCoreNLP.NEWLINE_SPLITTER_PROPERTY,
+            "false"));
 
         String hasSsplit = properties.getProperty("annotators");
-        if (hasSsplit != null && hasSsplit.contains(StanfordCoreNLP.STANFORD_SSPLIT)) { // ssplit
-          // Only possibly put in *NL* if not all one (the Boolean method treats null as false)
-          if ( ! Boolean.parseBoolean(properties.getProperty("ssplit.isOneSentence"))) {
-            // Set to { NEVER, ALWAYS, TWO_CONSECUTIVE } based on  ssplit.newlineIsSentenceBreak
-            String nlsbString = properties.getProperty(StanfordCoreNLP.NEWLINE_IS_SENTENCE_BREAK_PROPERTY,
-                    StanfordCoreNLP.DEFAULT_NEWLINE_IS_SENTENCE_BREAK);
-            WordToSentenceProcessor.NewlineIsSentenceBreak nlsb = WordToSentenceProcessor.stringToNewlineIsSentenceBreak(nlsbString);
-            if (nlsb != WordToSentenceProcessor.NewlineIsSentenceBreak.NEVER) {
-              keepNewline = true;
-            }
+        if (hasSsplit != null && hasSsplit.contains(StanfordCoreNLP.STANFORD_SSPLIT)) {
+          WordToSentenceProcessor.NewlineIsSentenceBreak nlsb = WordToSentenceProcessor.stringToNewlineIsSentenceBreak(properties.getProperty(StanfordCoreNLP.NEWLINE_IS_SENTENCE_BREAK_PROPERTY,
+              StanfordCoreNLP.DEFAULT_NEWLINE_IS_SENTENCE_BREAK));
+          if (nlsb != WordToSentenceProcessor.NewlineIsSentenceBreak.NEVER) {
+            keepNewline = true;
           }
         }
         if (keepNewline) {
@@ -64,17 +60,17 @@ public class AnnotatorFactories {
         if (properties.getProperty("tokenize.class") != null) {
           os.append(":tokenize.class:").append(properties.getProperty("tokenize.class"));
         }
-        if (Boolean.valueOf(properties.getProperty("tokenize.whitespace", "false"))) {
-          os.append(TokenizerAnnotator.EOL_PROPERTY + ':').append(properties.getProperty(TokenizerAnnotator.EOL_PROPERTY, "false"));
-          os.append(StanfordCoreNLP.NEWLINE_SPLITTER_PROPERTY + ':');
-          os.append(properties.getProperty(StanfordCoreNLP.NEWLINE_SPLITTER_PROPERTY, "false"));
+        if (Boolean.valueOf(properties.getProperty("tokenize.whitespace",
+            "false"))) {
+          os.append(TokenizerAnnotator.EOL_PROPERTY + ':').append(properties.getProperty(TokenizerAnnotator.EOL_PROPERTY,
+              "false"));
+          os.append(StanfordCoreNLP.NEWLINE_SPLITTER_PROPERTY + ':').append(properties.getProperty(StanfordCoreNLP.NEWLINE_SPLITTER_PROPERTY,
+              "false"));
+          return os.toString();
         } else {
-          os.append(StanfordCoreNLP.NEWLINE_SPLITTER_PROPERTY + ':');
-          os.append(properties.getProperty(StanfordCoreNLP.NEWLINE_SPLITTER_PROPERTY, "false"));
-          os.append("ssplit.isOneSentence" + ':');
-          os.append(properties.getProperty("ssplit.isOneSentence", "false"));
-          os.append(StanfordCoreNLP.NEWLINE_IS_SENTENCE_BREAK_PROPERTY + ':');
-          os.append(properties.getProperty(StanfordCoreNLP.NEWLINE_IS_SENTENCE_BREAK_PROPERTY, StanfordCoreNLP.DEFAULT_NEWLINE_IS_SENTENCE_BREAK));
+          os.append(StanfordCoreNLP.NEWLINE_SPLITTER_PROPERTY + ':').append(Boolean.valueOf(properties.getProperty(StanfordCoreNLP.NEWLINE_SPLITTER_PROPERTY,
+              "false")));
+          os.append(StanfordCoreNLP.NEWLINE_IS_SENTENCE_BREAK_PROPERTY + ':').append(properties.getProperty(StanfordCoreNLP.NEWLINE_IS_SENTENCE_BREAK_PROPERTY, StanfordCoreNLP.DEFAULT_NEWLINE_IS_SENTENCE_BREAK));
         }
         return os.toString();
       }
@@ -331,7 +327,7 @@ public class AnnotatorFactories {
       public Annotator create() {
         try {
           return annotatorImplementation.ner(properties);
-        } catch (IOException e) {
+        } catch (FileNotFoundException e) {
           throw new RuntimeIOException(e);
         }
       }
@@ -373,18 +369,18 @@ public class AnnotatorFactories {
   //
   // Mentions annotator
   //
-  public static AnnotatorFactory entityMentions(Properties properties, final AnnotatorImplementations annotatorImplementation) {
+  public static AnnotatorFactory mentions(Properties properties, final AnnotatorImplementations annotatorImplementation) {
     return new AnnotatorFactory(properties, annotatorImplementation) {
       private static final long serialVersionUID = 1L;
       @Override
       public Annotator create() {
-        return annotatorImplementation.mentions(properties, Annotator.STANFORD_ENTITY_MENTIONS);
+        return annotatorImplementation.mentions(properties, Annotator.STANFORD_MENTIONS);
       }
 
       @Override
       public String additionalSignature() {
         // keep track of all relevant properties for this annotator here!
-        return PropertiesUtils.getSignature(Annotator.STANFORD_ENTITY_MENTIONS, properties, EntityMentionsAnnotator.SUPPORTED_PROPERTIES);
+        return PropertiesUtils.getSignature(Annotator.STANFORD_MENTIONS, properties, MentionsAnnotator.SUPPORTED_PROPERTIES);
       }
     };
   }
@@ -572,8 +568,6 @@ public class AnnotatorFactories {
   //
   public static AnnotatorFactory natlog(Properties properties, final AnnotatorImplementations annotatorImpl) {
     return new AnnotatorFactory(properties, annotatorImpl) {
-      private static final long serialVersionUID = 4825870963088507811L;
-
       @Override
       public Annotator create() {
         return annotatorImpl.natlog(properties);
@@ -586,40 +580,4 @@ public class AnnotatorFactories {
     };
   }
 
-  //
-  // RelationTriples
-  //
-  public static AnnotatorFactory openie(Properties properties, final AnnotatorImplementations annotatorImpl) {
-    return new AnnotatorFactory(properties, annotatorImpl) {
-      @Override
-      public Annotator create() {
-        return annotatorImpl.openie(properties);
-      }
-
-      @Override
-      protected String additionalSignature() {
-        return "";
-      }
-    };
-  }
-
-  //
-  // Quote Extractor
-  //
-  public static AnnotatorFactory quote(Properties properties, final AnnotatorImplementations annotatorImpl) {
-    return new AnnotatorFactory(properties, annotatorImpl) {
-      private static final long serialVersionUID = -2525567112379296672L;
-
-      @Override
-      public Annotator create() {
-        return annotatorImpl.quote(properties);
-      }
-
-      @Override
-      protected String additionalSignature() {
-        return "";
-      }
-    };
-  }
-
 }