public static void trueMain(String... args) throws IOException { final Parameters params = Parameters.loadSerifStyle(new File(args[0])); final AnnotationStore store = AssessmentSpecFormats.openAnnotationStore( params.getExistingDirectory("annotationStore"), AssessmentSpecFormats.Format.KBP2015); for (Symbol docID : store.docIDs()) { log.info("processing document {}", docID.asString()); final AnswerKey answerKey = MakeAllRealisActual.forAnswerKey().apply(store.read(docID)); final HTMLRenderer htmlRenderer = new HTMLRenderer(docID.asString()); htmlRenderer.setCorefAnnotation(answerKey.corefAnnotation()); htmlRenderer.addResponses( overallOrdering.sortedCopy( FluentIterable.from(answerKey.annotatedResponses()) .filter(AssessedResponse.IsCorrectUpToInexactJustifications) .transform(AssessedResponse.Response))); final File output = params.getCreatableDirectory("output"); htmlRenderer.renderTo( Files.asCharSink(new File(output, docID.asString() + ".html"), Charset.defaultCharset())); } }
@Override public void onEnable() { instance = this; if (getBCBuild() < requiredBCBuild) { getLogger() .severe( "Your BungeeCord build (#" + getBCBuild() + ") is not supported. Please use at least BungeeCord #" + requiredBCBuild); getLogger().severe("BAT is going to shutdown ..."); return; } getLogger().setLevel(Level.INFO); config = new Configuration(); if (config.isDebugMode()) { try { final File debugFile = new File(getDataFolder(), "debug.log"); if (debugFile.exists()) { debugFile.delete(); } // Write header into debug log Files.asCharSink(debugFile, Charsets.UTF_8) .writeLines( Arrays.asList( "BAT log debug file" + " - If you have an error with BAT, you should post this file on BAT topic on spigotmc", "Bungee build : " + ProxyServer.getInstance().getVersion(), "BAT version : " + getDescription().getVersion(), "Operating System : " + System.getProperty("os.name"), "Timezone : " + TimeZone.getDefault().getID(), "------------------------------------------------------------")); final FileHandler handler = new FileHandler(debugFile.getAbsolutePath(), true); handler.setFormatter( new Formatter() { private final SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); private final String pattern = "time [level] message\n"; @Override public String format(LogRecord record) { return pattern .replace("level", record.getLevel().getName()) .replace("message", record.getMessage()) .replace("[BungeeAdminTools]", "") .replace("time", sdf.format(Calendar.getInstance().getTime())); } }); getLogger().addHandler(handler); getLogger().setLevel(Level.CONFIG); getLogger() .info( "The debug mode is now enabled ! Log are available in debug.log file located in BAT folder"); getLogger().config("Debug mode enabled ..."); getLogger().setUseParentHandlers(false); } catch (final Exception e) { getLogger() .log( Level.SEVERE, "An exception occured during the initialization of debug logging file", e); } } prefix = config.getPrefix(); loadDB( new Callback<Boolean>() { @Override public void done(final Boolean dbState, Throwable throwable) { if (dbState) { getLogger().config("Connection to the database established"); // Try enabling redis support. redis = new RedisUtils(config.isRedisSupport()); modules = new ModulesManager(); modules.loadModules(); } else { getLogger().severe("BAT is gonna shutdown because it can't connect to the database."); return; } // Init the I18n module I18n.getString("global"); } }); }