/** * Run Redwood with SLF4J as the console backend * @return A redwood configuration. Remember to call {@link RedwoodConfiguration#apply()}. */ public static RedwoodConfiguration slf4j() { return new RedwoodConfiguration().clear().handlers( Handlers.chain(Handlers.hideChannels(), Handlers.slf4j) ); }
/** * Show only these channels, as far as downstream handlers are concerned. */ public static LogRecordHandler showOnlyChannels(final Object... channelsToShow) { return new VisibilityHandler() {{ hideAll(); for (Object channel : channelsToShow) { alsoShow(channel); } }}; } /**
private Redwood.RecordHandlerTree buildChain(RedwoodConfiguration config, LogRecordHandler[] handlers, int i) { Redwood.RecordHandlerTree rtn = new Redwood.RecordHandlerTree(handlers[i]); if (i < handlers.length - 1) { rtn.addChildTree( buildChain(config, handlers, i + 1) ); } else { destination.apply(config, rtn); } return rtn; } @Override
@Override public void apply(RedwoodConfiguration config, Redwood.RecordHandlerTree root) { if (handlers.length == 0) { destination.apply(config, root); } else { root.addChildTree(buildChain(config, handlers, 0)); } } };
/** * Hide these channels, in addition to anything already hidden by upstream handlers. */ public static LogRecordHandler hideChannels(final Object... channelsToHide) { return new VisibilityHandler() {{ for (Object channel : channelsToHide) { alsoHide(channel); } }}; }
private void sayln(String s) { if (!quiet) { log.info(s); } }
/** * {@inheritDoc} */ public void prettyLog(RedwoodChannels channels, String description) { PrettyLogger.log(channels, description, map); } };
@Override public void apply(final RedwoodConfiguration config, Redwood.RecordHandlerTree root) { root.addChild(new Redwood.FileHandler(path){{ this.leftMargin = config.channelWidth; }}); } };
public ChineseNumberSequenceClassifier(Properties props, boolean useSUTime, Properties sutimeProps) { super(props); this.useSUTime = useSUTime; if(this.useSUTime) { // TODO: Need a Chinese version of SUTime log.warn("SUTime currently does not support Chinese. Ignore property ner.useSUTime."); } this.timexExtractor = null; }
/** * Run Redwood with java.util.logging * @return A redwood configuration. Remember to call {@link RedwoodConfiguration#apply()}. */ @SuppressWarnings("unused") public static RedwoodConfiguration javaUtilLogging() { return new RedwoodConfiguration().clear().handlers( Handlers.chain(Handlers.hideChannels(), Handlers.javaUtil) ); }
protected void sayln(String s) { if (!quiet) { log.info(s); } } }
/** * PrettyLog an object with a description using these channels. */ public void prettyLog(String description, Object obj) { PrettyLogger.log(this, description, obj); }
/** * The default Redwood configuration, which prints to the console without channels. * It does not show debug level messages (but shows warning and error messages). * This is the usual starting point for new configurations. * @return A basic Redwood Configuration. */ public static RedwoodConfiguration minimal() { return new RedwoodConfiguration().clear().handlers( Handlers.chain(Handlers.hideChannels(), Handlers.hideDebug, Handlers.stderr) ); }
protected void say(String s) { if (!quiet) { log.info(s); } }
/** * A standard Redwood configuration, which prints to the console with channels. * It does not show debug level messages (but shows warning and error messages). * This is the usual starting point for new configurations. * @return A basic Redwood Configuration. */ public static RedwoodConfiguration standard() { return new RedwoodConfiguration().clear().handlers( Handlers.chain(Handlers.hideDebug, Handlers.stderr)); }
private void verbose(String s) { if (verbose) { log.info(s); } }
private void sayln(String s) { if (!quiet) { log.info(s); } }
private static void printUsage() { log.info("This main method will let you variously manipulate and view a treebank."); log.info("Usage: java Treebanks [-flags]* treebankPath [fileRanges]"); log.info("Useful flags include:"); log.info("\t-maxLength n\t-suffix ext\t-treeReaderFactory class"); log.info("\t-pennPrint\t-encoding enc\t-tlp class\t-sentenceLengths"); log.info("\t-summary\t-decimate\t-yield\t-correct\t-punct"); log.info("\t-oneLine\t-words\t-taggedWords\t-annotate options"); }
private void sayln() { if (!quiet) { log.info(" "); // no argument seems to cause Redwoods to act weird (in 2016) } }