Package edu.stanford.nlp.io

Examples of edu.stanford.nlp.io.RuntimeIOException


    DVParser dvparser;
    try {
      dvparser = IOUtils.readObjectFromFile(filename);
      dvparser.op.setOptions(args);
    } catch (IOException e) {
      throw new RuntimeIOException(e);
    } catch (ClassNotFoundException e) {
      throw new RuntimeIOException(e);
    }
    System.err.println("... done");
    return dvparser;
  }
View Full Code Here


    // read the coref graph (old format)
    line = reader.readLine().trim();
    if(line.length() > 0){
      String [] bits = line.split(" ");
      if(bits.length % 4 != 0){
        throw new RuntimeIOException("ERROR: Incorrect format for the serialized coref graph: " + line);
      }
      List<Pair<IntTuple, IntTuple>> corefGraph = new ArrayList<Pair<IntTuple,IntTuple>>();
      for(int i = 0; i < bits.length; i += 4){
        IntTuple src = new IntTuple(2);
        IntTuple dst = new IntTuple(2);
View Full Code Here

  private static final String SPACE_HOLDER = "##";

  private static CoreLabel loadToken(String line, boolean haveExplicitAntecedent) {
    CoreLabel token = new CoreLabel();
    String [] bits = line.split("\t", -1);
    if(bits.length < 7) throw new RuntimeIOException("ERROR: Invalid format token for serialized token (only " + bits.length + " tokens): " + line);

    // word
    String word = bits[0].replaceAll(SPACE_HOLDER, " ");
    token.set(CoreAnnotations.TextAnnotation.class, word);
    token.set(CoreAnnotations.ValueAnnotation.class, word);
View Full Code Here

  public void outputXml(PrintWriter out, Annotation annotation) throws IOException {
    outputByWriter(writer -> {
      try {
        pipeline.xmlPrint(annotation, writer);
      } catch (IOException e) {
        throw new RuntimeIOException(e);
      }
    }, out);
  }
View Full Code Here

  public void outputJson(PrintWriter out, Annotation annotation) throws IOException {
    outputByWriter(writer -> {
      try {
        pipeline.jsonPrint(annotation, writer);
      } catch (IOException e) {
        throw new RuntimeIOException(e);
      }
    }, out);
  }
View Full Code Here

  public void outputCoNLL(PrintWriter out, Annotation annotation) throws IOException {
    outputByWriter(writer -> {
      try {
        pipeline.conllPrint(annotation, writer);
      } catch (IOException e) {
        throw new RuntimeIOException(e);
      }
    }, out);
  }
View Full Code Here

    try {
      new TextOutputter().print(annotation, os, getOptions(pipeline));
      // already flushed
      // don't close, might not want to close underlying stream
    } catch (IOException e) {
      throw new RuntimeIOException(e);
    }
  }
View Full Code Here

      BufferedReader bin = new BufferedReader(fin);
      readGrammar(bin);
      bin.close();
      fin.close();
    } catch (IOException e) {
      throw new RuntimeIOException(e);
    }
  }
View Full Code Here

          productions.incrementCount(Arrays.asList(sublist));
        }
        }
      }
    } catch (IOException e) {
      throw new RuntimeIOException(e);
    }
  }
View Full Code Here

      produceTrees(pout, numTrees);
      pout.close();
      bout.close();
      fout.close();
    } catch (IOException e) {
      throw new RuntimeIOException(e);
    }
  }
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.