当前位置: 首页>>代码示例>>Java>>正文


Java CommandLine.fail方法代码示例

本文整理汇总了Java中eu.fbk.utils.core.CommandLine.fail方法的典型用法代码示例。如果您正苦于以下问题:Java CommandLine.fail方法的具体用法?Java CommandLine.fail怎么用?Java CommandLine.fail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eu.fbk.utils.core.CommandLine的用法示例。


在下文中一共展示了CommandLine.fail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import eu.fbk.utils.core.CommandLine; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    try {
        // Parse command line
        final CommandLine cmd = provideParameterList().parse(args);

        final String output = cmd.getOptionValue(OUTPUT, String.class);
        final String consumerKey = cmd.getOptionValue(CONSUMER_KEY, String.class);
        final String consumerSecret = cmd.getOptionValue(CONSUMER_SECRET, String.class);

        GetSuggestions script = new GetSuggestions(consumerKey, consumerSecret);
        script.run(output);
    } catch (final Throwable ex) {
        // Handle exception
        CommandLine.fail(ex);
    }
}
 
开发者ID:Remper,项目名称:sociallink,代码行数:17,代码来源:GetSuggestions.java

示例2: main

import eu.fbk.utils.core.CommandLine; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    try {
        // Parse command line
        final CommandLine cmd = provideParameterList().parse(args);

        final String endpointUri = cmd.getOptionValue(ENDPOINT, String.class);
        final String workingFile = cmd.getOptionValue(WORKING, String.class);

        Endpoint endpoint = new Endpoint(endpointUri);
        CleanupGold script = new CleanupGold(endpoint);

        script.run(workingFile);
    } catch (final Throwable ex) {
        // Handle exception
        CommandLine.fail(ex);
    }
}
 
开发者ID:Remper,项目名称:sociallink,代码行数:18,代码来源:CleanupGold.java

示例3: main

import eu.fbk.utils.core.CommandLine; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    try {
        // Parse command line
        final CommandLine cmd = provideParameterList().parse(args);

        final String dbConnection = cmd.getOptionValue(DB_CONNECTION, String.class);
        final String dbUser = cmd.getOptionValue(DB_USER, String.class);
        final String dbPassword = cmd.getOptionValue(DB_PASSWORD, String.class);
        final String endpointUri = cmd.getOptionValue(ENDPOINT, String.class);
        final String workingDir = cmd.getOptionValue(WORKING, String.class);
        final String lsaPath = cmd.getOptionValue(LSA_PATH, String.class);

        DataSource source = DBUtils.createPGDataSource(dbConnection, dbUser, dbPassword);
        Endpoint endpoint = new Endpoint(endpointUri);
        FileProvider provider = new FileProvider(workingDir);
        Scaler scaler = new Gson().fromJson(new FileReader(provider.scaler), Scaler.class);
        ScoringStrategy strategy = new ISWC17Strategy(source, lsaPath);
        ScoreEntities script = new ScoreEntities(source, endpoint, scaler, strategy);

        script.run();
    } catch (final Throwable ex) {
        // Handle exception
        CommandLine.fail(ex);
    }
}
 
开发者ID:Remper,项目名称:sociallink,代码行数:26,代码来源:ScoreEntities.java

示例4: main

import eu.fbk.utils.core.CommandLine; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    try {
        // Parse command line
        final CommandLine cmd = provideParameterList().parse(args);

        final String dbConnection = cmd.getOptionValue(DB_CONNECTION, String.class);
        final String dbUser = cmd.getOptionValue(DB_USER, String.class);
        final String dbPassword = cmd.getOptionValue(DB_PASSWORD, String.class);
        final String endpointUri = cmd.getOptionValue(ENDPOINT, String.class);
        final String input = cmd.getOptionValue(INPUT, String.class);

        DataSource source = DBUtils.createPGDataSource(dbConnection, dbUser, dbPassword);
        Endpoint endpoint = new Endpoint(endpointUri);
        SubmitEntities script = new SubmitEntities(source, endpoint);

        script.run(input);
    } catch (final Throwable ex) {
        // Handle exception
        CommandLine.fail(ex);
    }
}
 
开发者ID:Remper,项目名称:sociallink,代码行数:22,代码来源:SubmitEntities.java

示例5: main

import eu.fbk.utils.core.CommandLine; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    try {
        // Parse command line
        final CommandLine cmd = provideParameterList().parse(args);

        final String dbConnection = cmd.getOptionValue(DB_CONNECTION, String.class);
        final String dbUser = cmd.getOptionValue(DB_USER, String.class);
        final String dbPassword = cmd.getOptionValue(DB_PASSWORD, String.class);

        DataSource source = DBUtils.createPGDataSource(dbConnection, dbUser, dbPassword);
        DumpResource script = new DumpResource(source);

        script.run();
    } catch (final Throwable ex) {
        // Handle exception
        CommandLine.fail(ex);
    }
}
 
开发者ID:Remper,项目名称:sociallink,代码行数:19,代码来源:DumpResource.java

示例6: main

import eu.fbk.utils.core.CommandLine; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    try {
        // Parse command line
        final CommandLine cmd = provideParameterList().parse(args);

        final String dbConnection = cmd.getOptionValue(DB_CONNECTION, String.class);
        final String dbUser = cmd.getOptionValue(DB_USER, String.class);
        final String dbPassword = cmd.getOptionValue(DB_PASSWORD, String.class);
        final String endpointUri = cmd.getOptionValue(ENDPOINT, String.class);
        String query = cmd.getOptionValue(QUERY, String.class);
        if (query == null) {
            query = "http://wikidata.dbpedia.org/resource/Q359442";
        }

        FullyResolvedEntry entry = new FullyResolvedEntry(new DatasetEntry(query, null));
        new FillFromIndex(new Endpoint(endpointUri), new AllNamesStrategy(), dbConnection, dbUser, dbPassword).fill(entry);

        LOGGER.info("List of candidates for entity: "+entry.entry.resourceId);
        for (User candidate : entry.candidates) {
            LOGGER.info("  "+candidate.getName()+" (@"+candidate.getScreenName()+")");
        }
    } catch (final Throwable ex) {
        // Handle exception
        CommandLine.fail(ex);
    }
}
 
开发者ID:Remper,项目名称:sociallink,代码行数:27,代码来源:FillFromIndex.java

示例7: main

import eu.fbk.utils.core.CommandLine; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    try {
        // Parse command line
        final CommandLine cmd = provideParameterList().parse(args);

        final String dbConnection = cmd.getOptionValue(DB_CONNECTION, String.class);
        final String dbUser = cmd.getOptionValue(DB_USER, String.class);
        final String dbPassword = cmd.getOptionValue(DB_PASSWORD, String.class);
        final String endpointUri = cmd.getOptionValue(ENDPOINT, String.class);
        final String lsaPath = cmd.getOptionValue(LSA_PATH, String.class);
        String query = cmd.getOptionValue(QUERY, String.class);
        if (query == null) {
            query = "http://wikidata.dbpedia.org/resource/Q359442";
        }

        DataSource source = DBUtils.createPGDataSource(dbConnection, dbUser, dbPassword);
        LSM lsm = new LSM(lsaPath + "/X", 100, true);
        UserLSAInteractive script = new UserLSAInteractive(new Endpoint(endpointUri), source, lsm);

        script.run(query);
    } catch (final Throwable ex) {
        // Handle exception
        CommandLine.fail(ex);
    }
}
 
开发者ID:Remper,项目名称:sociallink,代码行数:26,代码来源:UserLSAInteractive.java

示例8: main

import eu.fbk.utils.core.CommandLine; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    BuildUserLSA extractor = new BuildUserLSA();

    try {
        // Parse command line
        final CommandLine cmd = provideParameterList().parse(args);

        //noinspection ConstantConditions
        final Path tweetsPath = new Path(cmd.getOptionValue(TWEETS_PATH, String.class));
        //noinspection ConstantConditions
        final String results = cmd.getOptionValue(RESULTS_PATH, String.class);
        //noinspection ConstantConditions
        final String lsaPath = cmd.getOptionValue(LSA_PATH, String.class);

        final Configuration parameters = new Configuration();
        parameters.setString("db.file", results);
        parameters.setString("lsa.file", lsaPath);

        extractor.startPipeline(tweetsPath, parameters);
    } catch (final Throwable ex) {
        // Handle exception
        CommandLine.fail(ex);
    }
}
 
开发者ID:Remper,项目名称:sociallink,代码行数:25,代码来源:BuildUserLSA.java

示例9: main

import eu.fbk.utils.core.CommandLine; //导入方法依赖的package包/类
public static void main(final String... args) {
    try {
        final CommandLine cmd = CommandLine
                .parser()
                .withName("index-senticnet-lexicon")
                .withHeader("Processes the RDF data of eu.fbk.dkm.pikes.resources.SenticNet, " //
                        + "producing a TSV file with an indexed version of it that can " //
                        + "be used with the eu.fbk.dkm.pikes.resources.SenticNet Java API class.")
                .withOption("i", "input", "the input file name", "FILE", Type.FILE_EXISTING,
                        true, false, true)
                .withOption("o", "output", "the output file name", "FILE", Type.FILE, true,
                        false, true) //
                .withLogger(LoggerFactory.getLogger("eu.fbk")) //
                .parse(args);

        final File inputFile = cmd.getOptionValue("i", File.class);
        final File outputFile = cmd.getOptionValue("o", File.class);

        final SenticNet lexicon = index(inputFile.getAbsolutePath());
        lexicon.writeTo(outputFile.getAbsolutePath());

    } catch (final Throwable ex) {
        CommandLine.fail(ex);
    }
}
 
开发者ID:dkmfbk,项目名称:pikes,代码行数:26,代码来源:SenticNet.java

示例10: main

import eu.fbk.utils.core.CommandLine; //导入方法依赖的package包/类
public static void main(String[] args) {
	try {
		final CommandLine cmd = CommandLine
				.parser()
				.withName("sentiwordnet-loader")
				.withHeader(
						"Produces NAF files, a TSV file with sentiment annotations "
								+ "and an HTML file with annotated sentences "
								+ "starting from the MPQA v.2 corpus")
				.withOption("i", "input", "the corpus file", "DIR",
						CommandLine.Type.FILE_EXISTING, true, false, true)
				.withLogger(LoggerFactory.getLogger("eu.fbk.fssa")).parse(args);

		final File inputFile = cmd.getOptionValue("input", File.class);

		SentiWordNet.setPath(inputFile);
		SentiWordNet.init();
		System.out.println(SentiWordNet.searchValue("00478311-a"));

	} catch (final Throwable ex) {
		CommandLine.fail(ex);
	}

}
 
开发者ID:dkmfbk,项目名称:pikes,代码行数:25,代码来源:SentiWordNet.java

示例11: main

import eu.fbk.utils.core.CommandLine; //导入方法依赖的package包/类
public static void main(String[] args) {

        try {
            final CommandLine cmd = CommandLine
                    .parser()
                    .withName("./tint-server")
                    .withHeader("Run the Tint Server")
                    .withOption("c", "config", "Configuration file", "FILE", CommandLine.Type.FILE_EXISTING, true,
                            false, false)
                    .withOption("p", "port", String.format("Host port (default %d)", DEFAULT_PORT), "NUM",
                            CommandLine.Type.INTEGER, true, false, false)
                    .withOption("h", "host", String.format("Host address (default %s)", DEFAULT_HOST), "NUM",
                            CommandLine.Type.STRING, true, false, false)
//                    .withOption(null, "properties", "Additional properties", "PROPS", CommandLine.Type.STRING, true,
//                            true, false)
                    .withLogger(LoggerFactory.getLogger("eu.fbk")).parse(args);

            String host = cmd.getOptionValue("host", String.class, DEFAULT_HOST);
            Integer port = cmd.getOptionValue("port", Integer.class, DEFAULT_PORT);
            File configFile = cmd.getOptionValue("config", File.class);

//            List<String> addProperties = cmd.getOptionValues("properties", String.class);

            Properties additionalProps = new Properties();
//            for (String property : addProperties) {
//                try {
//                    additionalProps.load(new StringReader(property));
//                } catch (Exception e) {
//                    LOGGER.warn(e.getMessage());
//                }
//            }

            TintServer server = new TintServer(host, port, configFile, additionalProps);

        } catch (Exception e) {
            CommandLine.fail(e);
        }

    }
 
开发者ID:dhfbk,项目名称:tint,代码行数:40,代码来源:TintServer.java

示例12: main

import eu.fbk.utils.core.CommandLine; //导入方法依赖的package包/类
public static void main(String[] args) {
    try {
        final CommandLine cmd = CommandLine
                .parser()
                .withName("./annotate-sentences")
                .withHeader("Annotate sentences")
                .withOption("i", "input", "Input file", "FILE",
                        CommandLine.Type.FILE_EXISTING, true, false, true)
                .withOption("o", "output", "Output file", "FILE",
                        CommandLine.Type.FILE_EXISTING, true, false, true)
                .withLogger(LoggerFactory.getLogger("eu.fbk")).parse(args);

        File input = cmd.getOptionValue("input", File.class);
        File output = cmd.getOptionValue("output", File.class);

        String text = new String(Files.readAllBytes(input.toPath()), Charsets.UTF_8);
        BufferedWriter writer = new BufferedWriter(new FileWriter(output));

        Properties props = new Properties();
        props.setProperty("annotators", "ita_toksent");
        props.setProperty("customAnnotatorClass.ita_toksent",
                "eu.fbk.dh.tint.tokenizer.annotators.ItalianTokenizerAnnotator");

        StanfordCoreNLP ITApipeline = new StanfordCoreNLP(props);
        Annotation annotation = new Annotation(text);
        ITApipeline.annotate(annotation);

        List<CoreMap> sents = annotation.get(CoreAnnotations.SentencesAnnotation.class);
        for (CoreMap thisSent : sents) {
            writer.append(thisSent.get(CoreAnnotations.TextAnnotation.class)).append("\n");
        }

        writer.close();

    } catch (Exception e) {
        CommandLine.fail(e);
    }
}
 
开发者ID:dhfbk,项目名称:tint,代码行数:39,代码来源:SplitSentences.java

示例13: main

import eu.fbk.utils.core.CommandLine; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    try {
        // Parse command line
        final CommandLine cmd = provideParameterList().parse(args);

        final String output = cmd.getOptionValue(OUTPUT, String.class);

        Follow script = new Follow();
        script.run(output);
    } catch (final Throwable ex) {
        // Handle exception
        CommandLine.fail(ex);
    }
}
 
开发者ID:Remper,项目名称:sociallink,代码行数:15,代码来源:Follow.java

示例14: main

import eu.fbk.utils.core.CommandLine; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    BuildUserIndex extractor = new BuildUserIndex();

    try {
        // Parse command line
        final CommandLine cmd = provideParameterList().parse(args);

        // Extract tweets path
        if (!cmd.hasOption(TWEETS_PATH)) {
            throw new Exception("Insufficient configuration");
        }
        //noinspection ConstantConditions
        final Path tweetsPath = new Path(cmd.getOptionValue(TWEETS_PATH, String.class));

        if (cmd.hasOption(RESULTS_PATH)) {
            //noinspection ConstantConditions
            final Path results = new Path(cmd.getOptionValue(RESULTS_PATH, String.class));
            extractor.start(tweetsPath, results);
            return;
        }

        // Extract connection if necessary
        if (!cmd.hasOption(DB_CONNECTION)
                || !cmd.hasOption(DB_USER)
                || !cmd.hasOption(DB_PASSWORD)) {
            throw new Exception("Insufficient configuration");
        }

        final Configuration parameters = new Configuration();
        parameters.setString("db.connection", cmd.getOptionValue(DB_CONNECTION, String.class));
        parameters.setString("db.user", cmd.getOptionValue(DB_USER, String.class));
        parameters.setString("db.password", cmd.getOptionValue(DB_PASSWORD, String.class));

        extractor.start(tweetsPath, parameters);
    } catch (final Throwable ex) {
        // Handle exception
        CommandLine.fail(ex);
    }
}
 
开发者ID:Remper,项目名称:sociallink,代码行数:40,代码来源:BuildUserIndex.java

示例15: main

import eu.fbk.utils.core.CommandLine; //导入方法依赖的package包/类
public static void main(final String... args) {

        try {
            // Define and parse command line options
            final CommandLine cmd = CommandLine.parser().withName("rdf-exporter")
                    .withHeader("Export the alignments in the database to an RDF file")
                    .withOption("d", "db", "the database JDBC URL", "URL", CommandLine.Type.STRING,
                            true, false, true)
                    .withOption("u", "username", "the database username", "STRING",
                            CommandLine.Type.STRING, true, false, false)
                    .withOption("p", "password", "the database password", "STRING",
                            CommandLine.Type.STRING, true, false, false)
                    .withOption("o", "output", "the RDF file to emit", "PATH",
                            CommandLine.Type.FILE, true, false, true)
                    .withLogger(LoggerFactory.getLogger("eu.fbk")).parse(args);

            // Read options
            final String url = cmd.getOptionValue("d", String.class);
            final String username = cmd.getOptionValue("u", String.class, "");
            final String password = cmd.getOptionValue("p", String.class, "");
            final Path path = cmd.getOptionValue("o", Path.class);

            // Acquire a connection to the DB and export the data
            Class.forName("org.postgresql.Driver");
            try (Connection connection = DriverManager.getConnection(url, username, password)) {
                export(connection, path);
            }

        } catch (final Throwable ex) {
            // Abort execution, returning appropriate error code
            CommandLine.fail(ex);
        }

    }
 
开发者ID:Remper,项目名称:sociallink,代码行数:35,代码来源:RDFExporter.java


注:本文中的eu.fbk.utils.core.CommandLine.fail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。