public Event next() throws IOException { Event event = eventStream.next(); try { digest.update(event.toString().getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { throw new IllegalStateException("UTF-8 encoding is not available!", e); } return event; }
public boolean hasNext() throws IOException { return eventStream.hasNext(); }
public Event next() throws IOException { Event event = eventStream.next(); try { digest.update(event.toString().getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { throw new IllegalStateException(e); } return event; }
public boolean hasNext() throws IOException { return eventStream.hasNext(); }
public Event next() throws IOException { Event event = eventStream.next(); try { digest.update(event.toString().getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { throw new IllegalStateException("UTF-8 encoding is not available!", e); } return event; }
public boolean hasNext() throws IOException { return eventStream.hasNext(); }
public static void main(String[] args) throws IOException { if (args.length == 0) { System.err.println("Usage: AnswerTypeEventStream eventfile"); System.exit(1); } int ai=0; String eventFile = args[ai++]; String modelsDirProp = System.getProperty("models.dir", "book/src/main" + File.separator + "opennlp-models" + File.separator + "english"); File modelsDir = new File(modelsDirProp); File wordnetDir = new File(System.getProperty("wordnet.dir", "book/src/main" + File.separator + "WordNet-3.0" + File.separator + "dict")); InputStream chunkerStream = new FileInputStream( new File(modelsDir,"en-chunker.bin")); ChunkerModel chunkerModel = new ChunkerModel(chunkerStream); ChunkerME chunker = new ChunkerME(chunkerModel); InputStream posStream = new FileInputStream( new File(modelsDir,"en-pos-maxent.bin")); POSModel posModel = new POSModel(posStream); POSTaggerME tagger = new POSTaggerME(posModel); Parser parser = new ChunkParser(chunker, tagger); AnswerTypeContextGenerator actg = new AnswerTypeContextGenerator(wordnetDir); EventStream es = new AnswerTypeEventStream(eventFile,actg,parser); while(es.hasNext()) { System.out.println(es.next().toString()); } } }