Package edu.stanford.nlp.io

Examples of edu.stanford.nlp.io.RuntimeIOException


        embedID.put(splits[0], i);
        for (int j = 0; j < dim; ++j)
          embeddings[i][j] = Double.parseDouble(splits[j + 1]);
      }
    } catch (IOException e) {
      throw new RuntimeIOException(e);
    } finally {
      IOUtils.closeIgnoringExceptions(input);
    }
  }
View Full Code Here


      try {
        input = inputFilename.equals("-")
                ? IOUtils.readerFromStdin(encoding)
                : IOUtils.readerFromString(inputFilename, encoding);
      } catch (IOException e) {
        throw new RuntimeIOException("No input file provided (use -textFile)", e);
      }

      String outputFilename = props.getProperty("outFile");
      PrintWriter output;
      try {
        output = outputFilename == null || outputFilename.equals("-")
            ? IOUtils.encodedOutputStreamPrintWriter(System.out, encoding, true)
            : IOUtils.getPrintWriter(outputFilename, encoding);
      } catch (IOException e) {
        throw new RuntimeIOException("Error opening output file", e);
      }

      parser.parseTextFile(input, output);
    }
  }
View Full Code Here

    BufferedReader rd = null;
    try {
      rd = IOUtils.readerFromString(mapping);
      entries = readEntries(rd, ignoreCase);
    } catch (IOException e) {
      throw new RuntimeIOException("Couldn't read RegexNER from " + mapping, e);
    } finally {
      IOUtils.closeIgnoringExceptions(rd);
    }

    this.ignoreCase = ignoreCase;
View Full Code Here

      validPosPattern = null;
    }
    try {
      entries = readEntries(reader, ignoreCase);
    } catch (IOException e) {
      throw new RuntimeIOException("Couldn't read RegexNER from reader", e);
    }

    this.ignoreCase = ignoreCase;
    myLabels = Generics.newHashSet();
    // Can always override background or none.
View Full Code Here

      DataOutputStream file = IOUtils.getDataOutputStream(filename);
      saveModel(file);
      file.close();
    } catch (IOException ioe) {
      System.err.println("Error saving tagger to file " + filename);
      throw new RuntimeIOException(ioe);
    }
  }
View Full Code Here

      DataInputStream rf = new DataInputStream(IOUtils.getInputStreamFromURLOrClasspathOrFileSystem(modelFileOrUrl));

      readModelAndInit(config, rf, printLoading);
      rf.close();
    } catch (IOException e) {
      throw new RuntimeIOException("Unrecoverable error while loading a tagger model", e);
    }
  }
View Full Code Here

      if (VERBOSE) {
        System.err.println(" prob read ");
      }
      if (printLoading) t.done();
    } catch (IOException e) {
      throw new RuntimeIOException("Unrecoverable error while loading a tagger model", e);
    } catch (ClassNotFoundException e) {
      throw new RuntimeIOException("Unrecoverable error while loading a tagger model", e);
    }
  }
View Full Code Here

    try {
      w.write(getXMLWords(sent, sentNum, outputLemmas));
    } catch (IOException e) {
      System.err.println("Error writing sentence " + sentNum + ": " +
                         Sentence.listToString(sent));
      throw new RuntimeIOException(e);
    }
  }
View Full Code Here

        break;
      default:
        throw new IllegalArgumentException("Unsupported output style " + outputStyle);
      }
    } catch (IOException e) {
      throw new RuntimeIOException(e);
    }
  }
View Full Code Here

        classifier = ErasureUtils.<LinearClassifier<String,String>>uncheckedCast(ois.readObject());
        myFlags = (Flags[]) ois.readObject();
        assert flags.length > 0;
        System.err.println("Done.");
      } catch (Exception e) {
        throw new RuntimeIOException("Error deserializing " + loadPath, e);
      } finally {
        IOUtils.closeIgnoringExceptions(ois);
      }
    } else {
      myFlags = new Flags[1];
View Full Code Here

TOP

Related Classes of edu.stanford.nlp.io.RuntimeIOException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.