@Override public void flush() throws IOException { super.flush(); monitor.info("{}:\n{}", AbstractDocumentGraphFormatConsumer.class.getName(), toString()); } };
@Override public void flush() throws IOException { super.flush(); monitor.info("{}:\n{}", AbstractDocumentGraphFormatConsumer.class.getName(), toString()); } };
@Override public void flush() throws IOException { super.flush(); monitor.info("{}:\n{}", AbstractDocumentGraphFormatConsumer.class.getName(), toString()); } };
@Override protected void doProcess(JCas jCas) throws AnalysisEngineProcessException { JCasUtil.select(jCas, clazz) .stream() .map(this::print) .filter(Objects::nonNull) .forEach(s -> getMonitor().info("{}:\n{}", clazz.getName(), s)); }
@Override public void flush() throws IOException { super.flush(); monitor.info("{}:\n{}", AbstractDocumentGraphFormatConsumer.class.getName(), toString()); } };
@Override public void flush() throws IOException { super.flush(); monitor.info("{}:\n{}", AbstractDocumentGraphFormatConsumer.class.getName(), toString()); } };
@Override protected boolean doInitialize( final ResourceSpecifier specifier, final Map<String, Object> additionalParams) throws ResourceInitializationException { jedisPool = new JedisPool(redisServer, redisPort); getMonitor().info("Initialised Jedis resources"); return true; }
@Override public void flush() throws IOException { super.flush(); monitor.info("{}:\n{}", AbstractDocumentGraphFormatConsumer.class.getName(), toString()); } };
/** Check whether there are files present (which don't start with key-) */ public File[] checkFilesExist() throws BaleenException { final File[] files = new File(mucPath).listFiles(f -> !f.getName().startsWith("key-") && f.isFile()); if (files == null || files.length == 0) { getMonitor().info("No MUC files found is the path correct: {}", mucPath); throw new BaleenException("No MUC files found to process"); } return files; }
/** Check whether there are files present (which don't start with key-) */ public File[] checkFilesExist() throws BaleenException { final File[] files = new File(mucPath).listFiles(f -> !f.getName().startsWith("key-") && f.isFile()); if (files == null || files.length == 0) { getMonitor().info("No MUC files found is the path correct: {}", mucPath); throw new BaleenException("No MUC files found to process"); } return files; }
@Override public void doInitialize(final UimaContext aContext) throws ResourceInitializationException { super.doInitialize(aContext); getMonitor() .info("Will be writing to " + Paths.get(outputDirectory).toAbsolutePath().toString()); }
@Override protected int getQueueLength() { try { return consumer.getQueueCount(); } catch (IOException e) { getMonitor().info("Unable to check queue length"); return 0; } } }
@Override public void doGetNext(JCas jCas) throws IOException, CollectionException { if (queue.isEmpty()) { getMonitor().error("No documents on the queue - this method should not have been called"); throw new CollectionException(); } Path path = queue.remove(0); getMonitor().info("Processing file {}", path.toString()); try (InputStream is = new FileInputStream(path.toFile()); ) { extractor.processStream(is, path.toString(), jCas); } }
@Override protected int getQueueLength() { try { return consumer.getQueueCount(); } catch (IOException e) { getMonitor().info("Unable to check queue length"); return 0; } } }
@Override public void doGetNext(JCas jCas) throws IOException, CollectionException { if (queue.isEmpty()) { getMonitor().error("No documents on the queue - this method should not have been called"); throw new CollectionException(); } Path path = queue.remove(0); getMonitor().info("Processing file {}", path.toString()); try (InputStream is = new FileInputStream(path.toFile()); ) { extractContent(is, path.toString(), jCas); } }
@Override public void write(InteractionDefinition interaction, Collection<String> alternatives) { monitor.info( "Interaction {} {} {} {} {}", interaction.getType(), interaction.getSubType(), interaction.getSource(), interaction.getTarget(), alternatives.stream().collect(Collectors.joining(";"))); } }
@Override protected void doProcess(ItemHierarchy<Structure> structureHierarchy) throws AnalysisEngineProcessException { final String result = print(structureHierarchy.getRoot()); getMonitor().info("{}:\n{}", Structure.class.getName(), result); } }
private void logAccuracyMetrics(Classifier classifier, Trial trial) { getMonitor().info("Accuracy: {}", trial.getAccuracy()); for (String label : (String[]) classifier.getLabelAlphabet().toArray(new String[0])) { getMonitor().info("F1 for class '{}': {}", label, trial.getF1(label)); getMonitor().info("Precision for class '{}' : {}", label, trial.getPrecision(label)); } }
private void logAccuracyMetrics(Classifier classifier, Trial trial) { getMonitor().info("Accuracy: {}", trial.getAccuracy()); for (String label : (String[]) classifier.getLabelAlphabet().toArray(new String[0])) { getMonitor().info("F1 for class '{}': {}", label, trial.getF1(label)); getMonitor().info("Precision for class '{}' : {}", label, trial.getPrecision(label)); } }
@Test public void testLogger() { UimaMonitor monitor = new UimaMonitor(PIPELINE, this.getClass()); monitor.trace("test"); monitor.debug("test"); monitor.info("test"); monitor.warn("test"); monitor.error("test"); } }