• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java UnflaggedOption类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.martiansoftware.jsap.UnflaggedOption的典型用法代码示例。如果您正苦于以下问题:Java UnflaggedOption类的具体用法?Java UnflaggedOption怎么用?Java UnflaggedOption使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UnflaggedOption类属于com.martiansoftware.jsap包,在下文中一共展示了UnflaggedOption类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: main

import com.martiansoftware.jsap.UnflaggedOption; //导入依赖的package包/类
public static void main(String[] arg) throws IOException, JSAPException {
	final SimpleJSAP jsap = new SimpleJSAP(GZIPIndexer.class.getName(), "Computes and stores a quasi-succinct index for a compressed archive.",
			new Parameter[] {
				new UnflaggedOption("archive", JSAP.STRING_PARSER, JSAP.REQUIRED, "The name a GZIP's archive."),
				new UnflaggedOption("index", JSAP.STRING_PARSER, JSAP.REQUIRED, "The output (a serialized LongBigList of pointers to the records in the archive) filename."),
			}
	);

	final JSAPResult jsapResult = jsap.parse(arg);
	if (jsap.messagePrinted()) return;

	final FastBufferedInputStream input = new FastBufferedInputStream(new FileInputStream(jsapResult.getString("archive")));
	ProgressLogger pl = new ProgressLogger(LOGGER, 1, TimeUnit.MINUTES, "records");
	pl.start("Scanning...");
	final EliasFanoMonotoneLongBigList list = new EliasFanoMonotoneLongBigList(index(input, pl));
	pl.done();
	BinIO.storeObject(list, jsapResult.getString("index"));
}
 
开发者ID:LAW-Unimi,项目名称:BUbiNG,代码行数:19,代码来源:GZIPIndexer.java


示例2: main

import com.martiansoftware.jsap.UnflaggedOption; //导入依赖的package包/类
public static void main(String[] args) throws IOException, JSAPException {

	SimpleJSAP jsap = new SimpleJSAP(GZIPArchiveReader.class.getName(), "Writes some random records on disk.",
		new Parameter[] {
			new Switch("fully", 'f', "fully",
				"Whether to read fully the record (and do a minimal cosnsistency check)."),
			new UnflaggedOption("path", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY,
				"The path to read from."), });

	JSAPResult jsapResult = jsap.parse(args);
	if (jsap.messagePrinted())
	    System.exit(1);

	final boolean fully = jsapResult.getBoolean("fully");
	GZIPArchiveReader gzar = new GZIPArchiveReader(new FileInputStream(jsapResult.getString("path")));
	for (;;) {
	    ReadEntry e = gzar.getEntry();
	    if (e == null)
		break;
	    InputStream inflater = e.lazyInflater.get();
	    if (fully)
		ByteStreams.toByteArray(inflater);
	    e.lazyInflater.consume();
	    System.out.println(e);
	}
    }
 
开发者ID:LAW-Unimi,项目名称:BUbiNG,代码行数:27,代码来源:GZIPArchiveWriterTest.java


示例3: main

import com.martiansoftware.jsap.UnflaggedOption; //导入依赖的package包/类
public static void main(String[] rawArguments) throws JSAPException, IOException, ReflectiveOperationException {
	SimpleJSAP jsap = new SimpleJSAP(
			ScorerStatisticsSummarizer.class.getName(),
			"Compute summary statistics for a scorer ",
			new Parameter[] {
		new UnflaggedOption( "scorer", JSAP.STRING_PARSER, JSAP.REQUIRED,
					"Specification for the scorer" ),
		new UnflaggedOption( "output", JSAP.STRING_PARSER, JSAP.REQUIRED,
					"Filepath of the saved statistics summary, saved as a Property file." ),
		
	});
	
	// parse arguments
	JSAPResult args = jsap.parse( rawArguments );
	if ( jsap.messagePrinted() ) System.exit( 1 );
	
	String scorerSpec = args.getString("scorer");
	UnexpectednessScorer scorer = (UnexpectednessScorer) PoolSpecification.SCORER_PARSER.parse(scorerSpec);
	SummaryStatistics stat = computeStatistics(scorer);
	save(stat, new File(args.getString("output")), scorerSpec);
	System.out.println(scorer + " " + stat);
}
 
开发者ID:corradomonti,项目名称:llamafur,代码行数:23,代码来源:ScorerStatisticsSummarizer.java


示例4: main

import com.martiansoftware.jsap.UnflaggedOption; //导入依赖的package包/类
public static void main( final String[] arg ) throws IOException, JSAPException {
	final SimpleJSAP simpleJSAP = new SimpleJSAP( JungAdapter.class.getName(), "Reads a graph with a given basename, optionally its transpose, and writes it on standard output in Pajek format.", 
			new Parameter[] { 
				new Switch( "offline", 'o', "offline", "Use the offline load method to reduce memory consumption. It usually works, but your mileage may vary." ),
				new UnflaggedOption( "basename", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The basename of the source graph." ),
				new UnflaggedOption( "transpose", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED, JSAP.NOT_GREEDY, "The basename of the transpose. If unspecified, the JungAdapter constructor will be provided with null as a parameter. This usually works, but your mileage may vary." )
	});

	final JSAPResult jsapResult = simpleJSAP.parse( arg );
	if ( simpleJSAP.messagePrinted() ) System.exit( 1 );
	final boolean offline = jsapResult.userSpecified( "offline" );

	final ImmutableGraph graph = offline ? ImmutableGraph.loadOffline( jsapResult.getString( "basename" ) ) : ImmutableGraph.load( jsapResult.getString( "basename" ) );
	final ImmutableGraph transpose = jsapResult.userSpecified( "transpose" ) ? ( offline ? ImmutableGraph.loadOffline( jsapResult.getString( "transpose" ) ) : ImmutableGraph.load( jsapResult.getString( "transpose" ) ) ) : null; 
	
	final PrintWriter printWriter = new PrintWriter( System.out );
	new PajekNetWriter<Integer, Long>().save( new JungAdapter( graph, transpose ), printWriter );
	printWriter.flush();
}
 
开发者ID:lhelwerd,项目名称:WebGraph,代码行数:20,代码来源:JungAdapter.java


示例5: main

import com.martiansoftware.jsap.UnflaggedOption; //导入依赖的package包/类
public static void main( String args[] ) throws IllegalArgumentException, SecurityException, JSAPException, UnsupportedEncodingException, FileNotFoundException {

		final SimpleJSAP jsap = new SimpleJSAP( ImmutableSubgraph.class.getName(), "Writes the property file of an immutable subgraph.",
				new Parameter[] {
						new UnflaggedOption( "supergraphBasename", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The basename of the supergraph." ),
						new FlaggedOption( "subgraphNodes", JSAP.STRING_PARSER, null, JSAP.NOT_REQUIRED, 's', "subgraph-nodes", "Sets a subgraph node file (a list integers in DataInput format). If not specified, the name will be stemmed from the basename." ),
						new UnflaggedOption( "basename", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The basename of resulting immutable subgraph." ),
					}		
				);
		
		final JSAPResult jsapResult = jsap.parse( args );
		if ( jsap.messagePrinted() ) System.exit( 1 );

		final PrintWriter pw = new PrintWriter( new OutputStreamWriter( new FileOutputStream( jsapResult.getString( "basename" ) + ImmutableGraph.PROPERTIES_EXTENSION ), "UTF-8" ) );
		pw.println( ImmutableGraph.GRAPHCLASS_PROPERTY_KEY + " = " + ImmutableSubgraph.class.getName() );
		pw.println( "supergraphbasename = " + jsapResult.getString( "supergraphBasename" ) );
		if ( jsapResult.userSpecified( "subgraphNodes" )  ) pw.println( "subgraphnodes = " + jsapResult.getString( "subgraphNodes" ) );	
		pw.close();
	}
 
开发者ID:lhelwerd,项目名称:WebGraph,代码行数:20,代码来源:ImmutableSubgraph.java


示例6: main

import com.martiansoftware.jsap.UnflaggedOption; //导入依赖的package包/类
public static void main( String arg[] ) throws IOException, JSAPException, IllegalArgumentException, ClassNotFoundException, IllegalAccessException, InvocationTargetException, InstantiationException, NoSuchMethodException {
	SimpleJSAP jsap = new SimpleJSAP( SequentialHyperBall.class.getName(), "Prints an approximation of the neighbourhood function.",
		new Parameter[] {
			new FlaggedOption( "log2m", JSAP.INTEGER_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, 'l', "log2m", "The logarithm of the number of registers." ),
			new FlaggedOption( "upperBound", JSAP.LONGSIZE_PARSER, Long.toString( Long.MAX_VALUE ), JSAP.NOT_REQUIRED, 'u', "upper-bound", "An upper bound to the number of iteration (default: the graph size)." ),
			new FlaggedOption( "threshold", JSAP.DOUBLE_PARSER, Double.toString( 1E-3 ), JSAP.NOT_REQUIRED, 't', "threshould", "A threshould that will be used to stop the computation by absolute or relative increment." ),
			new Switch( "spec", 's', "spec", "The source is not a basename but rather a specification of the form <ImmutableGraphImplementation>(arg,arg,...)." ),
			new UnflaggedOption( "basename", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The basename of the graph." ),
		}		
	);

	JSAPResult jsapResult = jsap.parse( arg );
	if ( jsap.messagePrinted() ) System.exit( 1 );
	
	final boolean spec = jsapResult.getBoolean( "spec" );
	final String basename = jsapResult.getString( "basename" );
	final ProgressLogger pl = new ProgressLogger( LOGGER );
	final int log2m = jsapResult.getInt( "log2m" );
	
	final ImmutableGraph graph = spec ? ObjectParser.fromSpec( basename, ImmutableGraph.class, GraphClassParser.PACKAGE ) : ImmutableGraph.loadOffline( basename );
	
	SequentialHyperBall shb = new SequentialHyperBall( graph, log2m, pl, Util.randomSeed() );
	TextIO.storeDoubles( shb.approximateNeighbourhoodFunction( jsapResult.getLong( "upperBound" ), jsapResult.getDouble( "threshold" ) ), System.out );
	shb.close();
}
 
开发者ID:lhelwerd,项目名称:WebGraph,代码行数:26,代码来源:SequentialHyperBall.java


示例7: main

import com.martiansoftware.jsap.UnflaggedOption; //导入依赖的package包/类
public static void main( String arg[] ) throws IOException, JSAPException, IllegalArgumentException, ClassNotFoundException, IllegalAccessException, InvocationTargetException, InstantiationException, NoSuchMethodException {
	SimpleJSAP jsap = new SimpleJSAP( ExactNeighbourhoodFunction.class.getName(), "Prints the neighbourhood function.",
		new Parameter[] {
			new Switch( "spec", 's', "spec", "The source is not a basename but rather a specification of the form <ImmutableGraphImplementation>(arg,arg,...)." ),
			new UnflaggedOption( "basename", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The basename of the graph." ),
		}		
	);

	JSAPResult jsapResult = jsap.parse( arg );
	if ( jsap.messagePrinted() ) System.exit( 1 );
	
	final boolean spec = jsapResult.getBoolean( "spec" );
	final String basename = jsapResult.getString( "basename" );
	final ProgressLogger pl = new ProgressLogger( LOGGER );
	
	final ImmutableGraph graph = spec ? ObjectParser.fromSpec( basename, ImmutableGraph.class, GraphClassParser.PACKAGE ) : ImmutableGraph.loadOffline( basename );
	
	final ExactNeighbourhoodFunction neighbourhoodFunction = new ExactNeighbourhoodFunction( graph, pl );
	pl.start( "Computing..." );
	TextIO.storeDoubles( neighbourhoodFunction.neighbourhoodFunction(), System.out );
	pl.done();
}
 
开发者ID:lhelwerd,项目名称:WebGraph,代码行数:23,代码来源:ExactNeighbourhoodFunction.java


示例8: main

import com.martiansoftware.jsap.UnflaggedOption; //导入依赖的package包/类
public static void main(final String arg[]) throws Exception {
	final SimpleJSAP jsap = new SimpleJSAP(Agent.class.getName(), "Starts a BUbiNG agent (note that you must enable JMX by means of the standard Java system properties).",
			new Parameter[] {
				new FlaggedOption("weight", JSAP.INTEGER_PARSER, "1", JSAP.NOT_REQUIRED, 'w', "weight", "The agent weight."),
				new FlaggedOption("group", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, 'g', "group", "The JGroups group identifier (must be the same for all cooperating agents)."),
				new FlaggedOption("jmxHost", JSAP.STRING_PARSER, InetAddress.getLocalHost().getHostAddress(), JSAP.REQUIRED, 'h', "jmx-host", "The IP address (possibly specified by a host name) that will be used to expose the JMX RMI connector to other agents."),
				new FlaggedOption("rootDir", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED, 'r', "root-dir", "The root directory."),
				new Switch("new", 'n', "new", "Start a new crawl"),
				new FlaggedOption("properties", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, 'P', "properties", "The properties used to configure the agent."),
				new UnflaggedOption("name", JSAP.STRING_PARSER, JSAP.REQUIRED, "The agent name (an identifier that must be unique across the group).")
		});

		final JSAPResult jsapResult = jsap.parse(arg);
		if (jsap.messagePrinted()) System.exit(1);

		// JMX *must* be set up.
		final String portProperty = System.getProperty(JMX_REMOTE_PORT_SYSTEM_PROPERTY);
		if (portProperty == null) throw new IllegalArgumentException("You must specify a JMX service port using the property " + JMX_REMOTE_PORT_SYSTEM_PROPERTY);

		final String name = jsapResult.getString("name");
		final int weight = jsapResult.getInt("weight");
		final String group = jsapResult.getString("group");
		final String host = jsapResult.getString("jmxHost");
		final int port = Integer.parseInt(portProperty);

		final BaseConfiguration additional = new BaseConfiguration();
		additional.addProperty("name", name);
		additional.addProperty("group", group);
		additional.addProperty("weight", Integer.toString(weight));
		additional.addProperty("crawlIsNew", Boolean.valueOf(jsapResult.getBoolean("new")));
		if (jsapResult.userSpecified("rootDir")) additional.addProperty("rootDir", jsapResult.getString("rootDir"));

		new Agent(host, port, new RuntimeConfiguration(new StartupConfiguration(jsapResult.getString("properties"), additional)));
		System.exit(0); // Kills remaining FetchingThread instances, if any.
}
 
开发者ID:LAW-Unimi,项目名称:BUbiNG,代码行数:36,代码来源:Agent.java


示例9: main

import com.martiansoftware.jsap.UnflaggedOption; //导入依赖的package包/类
public static void main(String[] arg) throws JSAPException, URISyntaxException, NoSuchAlgorithmException, ClientProtocolException, IOException, InterruptedException, ConfigurationException, IllegalArgumentException, ClassNotFoundException {

		SimpleJSAP jsap = new SimpleJSAP(HttpResponseWarcRecordTest.class.getName(), "Outputs an URL (given as argument) as the UncompressedWarcWriter would do",
			new Parameter[] {
				new UnflaggedOption("url", JSAP.STRING_PARSER, JSAP.REQUIRED, "The url of the page."),
			});

		JSAPResult jsapResult = jsap.parse(arg);
		if (jsap.messagePrinted()) System.exit(1);

		final String url = jsapResult.getString("url");

		final URI uri = new URI(url);
		final WarcWriter writer = new UncompressedWarcWriter(System.out);

		// Setup FetchData
		final RuntimeConfiguration testConfiguration = Helpers.getTestConfiguration(null);
		final HttpClient httpClient = FetchDataTest.getHttpClient(null, false);
		final FetchData fetchData = new FetchData(testConfiguration);

		fetchData.fetch(uri, httpClient, null, null, false);
		final HttpResponseWarcRecord record = new HttpResponseWarcRecord(uri, fetchData.response());
		writer.write(record);
		fetchData.close();
		System.out.println(record);

		writer.close();
	}
 
开发者ID:LAW-Unimi,项目名称:BUbiNG,代码行数:29,代码来源:HttpResponseWarcRecordTest.java


示例10: main

import com.martiansoftware.jsap.UnflaggedOption; //导入依赖的package包/类
public static void main(String[] args) throws JSAPException, IOException, InterruptedException {
	final SimpleJSAP jsap = new SimpleJSAP(RandomReadWritesTest.class.getName(), "Writes some random records on disk.",
		new Parameter[] {
			new FlaggedOption("random", JSAP.INTEGER_PARSER, "100", JSAP.NOT_REQUIRED, 'r', "random", "The number of random record to sample from."),
			new FlaggedOption("body", JSAP.INTSIZE_PARSER, "4K", JSAP.NOT_REQUIRED, 'b', "body", "The maximum size of the random generated body (in bytes)."),
			new Switch("fully", 'f', "fully", "Whether to read fully the record (and do a minimal sequential cosnsistency check)."),
			new Switch("writeonly", 'w', "writeonly", "Whether to skip the read part (if present, 'fully' will be ignored."),
			new UnflaggedOption("path", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The path to write to."),
			new UnflaggedOption("records", JSAP.INTSIZE_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The numer of records to write."),
	});

	final JSAPResult jsapResult = jsap.parse(args);
	if (jsap.messagePrinted()) System.exit(1);

	final String path = jsapResult.getString("path");
	final boolean compress = path.endsWith(".gz");
	final boolean fully = jsapResult.getBoolean("fully");
	final int parallel = compress ? 1 : 0;

	final int body = jsapResult.getInt("body");

	final WarcRecord[] rnd = prepareRndRecords(jsapResult.getInt("random"), RESPONSE_PROBABILITY, MAX_NUMBER_OF_HEADERS, MAX_LENGTH_OF_HEADER, body);
	final int[] sequence = writeRecords(path, jsapResult.getInt("records"), rnd, parallel);
	if (! jsapResult.getBoolean("writeonly"))
		readRecords(path, sequence, body, fully, compress);

}
 
开发者ID:LAW-Unimi,项目名称:BUbiNG,代码行数:28,代码来源:RandomReadWritesTest.java


示例11: main

import com.martiansoftware.jsap.UnflaggedOption; //导入依赖的package包/类
public static void main(String[] rawArguments) throws Exception {
	SimpleJSAP jsap = new SimpleJSAP(
			WikipediaTextArchiveProducer.class.getName(),
			"Build wikipedia graph.",
			new Parameter[] {
		new UnflaggedOption( "input", JSAP.STRING_PARSER, JSAP.REQUIRED,
					"The pages-articles.xml input file, from Wikipedia." ),
		new Switch("bzip", 'z', "bzip", "Interpret the input file as bzipped"),
		new UnflaggedOption( "resolver", JSAP.STRING_PARSER, JSAP.REQUIRED,
				"resolver" ),	
		new UnflaggedOption( "output", JSAP.STRING_PARSER, JSAP.REQUIRED,
				"output graph basename" )
	});
	
	JSAPResult args = jsap.parse( rawArguments );
	if ( jsap.messagePrinted() ) System.exit( 1 );
	
	WikipediaDocumentSequence wikipediaDocumentSequence = new WikipediaDocumentSequence(
			args.getString("input"), 
			args.getBoolean("bzip"), 
			"http://en.wikipedia.org/wiki/",
			true, // parse text article
			false // do not keep all namespaces
		);
	
	DocumentSequenceImmutableGraph g = new DocumentSequenceImmutableGraph(
			wikipediaDocumentSequence,
			8, // should be the anchor field
			(VirtualDocumentResolver) SerializationUtils.read(args.getString("resolver"))
			);
	
	BVGraph.store(g, args.getString("output"));
}
 
开发者ID:corradomonti,项目名称:llamafur,代码行数:34,代码来源:WikipediaGraphProducer.java


示例12: main

import com.martiansoftware.jsap.UnflaggedOption; //导入依赖的package包/类
public static void main(String[] rawArguments) throws Exception {
	
	SimpleJSAP jsap = new SimpleJSAP(
			WikipediaCategoryProducer.class.getName(),
			"Read a wikipedia dump and produces 3 files with " +
			"serialized Java objects: \n" +
			" * pageId2Name.ser, an Int2ObjectMap from page ids to " +
			"wikipedia page names \n" +
			" * catName2Id.ser, an Object2IntMap from category ids to " +
			"category names \n" +
			" * page2cat.ser, an Int2ObjectMap from page ids to an IntSet" +
			"of category ids",
			new Parameter[] {
		new UnflaggedOption( "input", JSAP.STRING_PARSER, JSAP.REQUIRED,
					"The pages-articles.xml input file, from Wikipedia." ),
		new UnflaggedOption( "basename", JSAP.STRING_PARSER, JSAP.REQUIRED,
					"The basename of the output files (p.e. a Directory with / in the end)" ),
		new Switch("bzip", 'z', "bzip", "Interpret the input file as bzipped"),
		new Switch("verbose", 'v', "verbose", "Print every category found to StdErr") 
	});
	
	// Initializing input read
	JSAPResult args = jsap.parse( rawArguments );
	if ( jsap.messagePrinted() ) System.exit( 1 );
	
	WikipediaDocumentSequence wikipediaDocumentSequence = new WikipediaDocumentSequence(
			args.getString("input"),
			args.getBoolean("bzip"),
			"http://en.wikipedia.org/wiki/", true,
			true // keep all namespaces
		);
	WikipediaCategoryProducer reader =
			new WikipediaCategoryProducer(wikipediaDocumentSequence);
	reader.setPlainUrisFile(args.getString("basename") + "pages.uris");
	reader.extractAllData();
	reader.saveAllTo(args.getString("basename"));

	
}
 
开发者ID:corradomonti,项目名称:llamafur,代码行数:40,代码来源:WikipediaCategoryProducer.java


示例13: main

import com.martiansoftware.jsap.UnflaggedOption; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static void main(String[] rawArguments) throws Exception {
	SimpleJSAP jsap = new SimpleJSAP(
			ScorerComparison.class.getName(),
			"Compare the score computed by one or more scorers with groundtruth,"
			+ " and save the result as a tsv file (where each column is a score,"
			+ " and the last column is the groundtruth).",
			new Parameter[] {
		new UnflaggedOption( "pageName2id", JSAP.STRING_PARSER, JSAP.REQUIRED,
				"The serialized pageName2id map." ),
		new UnflaggedOption( "groundruth", JSAP.STRING_PARSER, JSAP.REQUIRED,
					"The tsv file contining the human-evaluated dataset." ),
		new UnflaggedOption( "output", JSAP.STRING_PARSER, JSAP.REQUIRED,
			"The output tsv file path." ),
		new UnflaggedOption( "scorer", PoolSpecification.SCORER_PARSER, 
				JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.GREEDY,
				"A scorer specification." ),
		
	});
	
	// parse arguments
	JSAPResult args = jsap.parse( rawArguments );
	if ( jsap.messagePrinted() ) System.exit( 1 );
	
	Object2IntMap<String> pageName2id = (Object2IntMap<String>) SerializationUtils.read(args.getString("pageName2id"));
	GroundTruth groundtruth = GroundTruth.fromUTF8FilePath(args.getString("groundruth"), 
			pageName2id);
	
	File output = new File(args.getString("output"));
	UnexpectednessScorer[] scorers = (UnexpectednessScorer[]) args.getObjectArray("scorer", new UnexpectednessScorer[0]);
	new ScorerComparison(groundtruth, scorers)
		.saveComparisons(output);
}
 
开发者ID:corradomonti,项目名称:llamafur,代码行数:34,代码来源:ScorerComparison.java


示例14: main

import com.martiansoftware.jsap.UnflaggedOption; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static void main(final String[] arg) throws IOException, JSAPException, ClassNotFoundException {
	final SimpleJSAP jsap = new SimpleJSAP(SignedFunctionStringMap.class.getName(), "Saves a string map wrapping a signed function on character sequences.",
			new Parameter[] {
		new UnflaggedOption("function", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The filename of a signed function defined on character sequences."),
		new UnflaggedOption("map", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The filename of the resulting string map."),
	});

	final JSAPResult jsapResult = jsap.parse(arg);
	if (jsap.messagePrinted()) return;

	final String functionName = jsapResult.getString("function");
	final String mapName = jsapResult.getString("map");
	BinIO.storeObject(new SignedFunctionStringMap((Object2LongFunction<? extends CharSequence>)BinIO.loadObject(functionName)), mapName);
}
 
开发者ID:vigna,项目名称:Sux4J,代码行数:16,代码来源:SignedFunctionStringMap.java


示例15: main

import com.martiansoftware.jsap.UnflaggedOption; //导入依赖的package包/类
public static void main(final String[] arg) throws IOException, JSAPException, ClassNotFoundException {

		final SimpleJSAP jsap = new SimpleJSAP(ListSpeedTest.class.getName(), "Test the speed of a list",
				new Parameter[] {
					new Switch("random", 'r', "random", "Do a random test on at most 1 million strings."),
					new UnflaggedOption("list", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The filename for the serialised list.")
		});

		JSAPResult jsapResult = jsap.parse(arg);
		if (jsap.messagePrinted()) return;

		final String listName = jsapResult.getString("list");

		final LongList list = (LongList)BinIO.loadObject(listName);
		long total = 0;
		int n = list.size();
		for(int k = 13; k-- != 0;) {
			long time = -System.currentTimeMillis();
			for(int i = 0; i < n; i++) {
				list.getLong(i);
				if (i++ % 100000 == 0) System.out.print('.');
			}
			System.out.println();
			time += System.currentTimeMillis();
			if (k < 10) total += time;
			System.out.println(time / 1E3 + "s, " + (time * 1E3) / n + " \u00b5s/item");
		}
		System.out.println("Average: " + Util.format(total / 10E3) + "s, " + Util.format((total * 1E3) / (10 * n)) + " \u00b5s/item");
	}
 
开发者ID:vigna,项目名称:Sux4J,代码行数:30,代码来源:ListSpeedTest.java


示例16: Actuary

import com.martiansoftware.jsap.UnflaggedOption; //导入依赖的package包/类
public Actuary() {
	try {
		jsap = new SimpleJSAP(
					"actuary",
				    "Reads in LOAN ontologies and performs inferences upon them.",
				    new Parameter[] {
							//new Switch("displayhelp", 'h', "help", "Display this help message."),
					    new FlaggedOption("verbosity", JSAP.INTEGER_PARSER, "0", true, 'v',"verbosity", "The higher the verbosity, the more the system will output"),
							new UnflaggedOption("files", JSAP.STRING_PARSER, null, true, true, "The files to load.")
					}
				);
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:automenta,项目名称:opennars,代码行数:16,代码来源:Actuary.java


示例17: main

import com.martiansoftware.jsap.UnflaggedOption; //导入依赖的package包/类
public static void main( String arg[] ) throws JSAPException, IOException {
	final SimpleJSAP jsap = new SimpleJSAP( IntegerTriplesArcLabelledImmutableGraph.class.getName(), 
			"Reads from standard input a list of triples <source,dest,label>, where the three " +
			"components are separated by a TAB, and saves the " +
			"corresponding arc-labelled graph using a BVGraph and a BitStreamArcLabelledImmutableGraph. " +
			"Labels are represeted using GammaCodedIntLabel.",
			new Parameter[] {
					//new FlaggedOption( "graphClass", GraphClassParser.getParser(), null, JSAP.NOT_REQUIRED, 'g', "graph-class", "Forces a Java class for the source graph." ),
					new UnflaggedOption( "basename", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The basename of the resulting arc-labelled graph." ),
				}		
			);
	
	final JSAPResult jsapResult = jsap.parse( arg );
	if ( jsap.messagePrinted() ) System.exit( 1 );
	final String basename = jsapResult.getString( "basename" );

	// We read triples from stdin, parse them and feed them to the constructor.
	BufferedReader br = new BufferedReader( new InputStreamReader( System.in, "ASCII" ) );
	ObjectArrayList<int[]> list = new ObjectArrayList<int[]>();
	
	String line;
	while( ( line = br.readLine() ) != null ) {
		final String p[] = line.split( "\t" );
		list.add( new int[] { Integer.parseInt(  p[ 0 ] ),Integer.parseInt( p[ 1 ] ), Integer.parseInt(  p[ 2 ] ) } ); 
	}
	
	final ArcLabelledImmutableGraph g = new IntegerTriplesArcLabelledImmutableGraph( list.toArray( new int[0][] ) );
	BVGraph.store( g, basename + ArcLabelledImmutableGraph.UNDERLYINGGRAPH_SUFFIX );
	BitStreamArcLabelledImmutableGraph.store( g, basename, basename + ArcLabelledImmutableGraph.UNDERLYINGGRAPH_SUFFIX );
}
 
开发者ID:lhelwerd,项目名称:WebGraph,代码行数:31,代码来源:IntegerTriplesArcLabelledImmutableGraph.java


示例18: main

import com.martiansoftware.jsap.UnflaggedOption; //导入依赖的package包/类
public static void main( String arg[] ) throws IOException, JSAPException {		
	SimpleJSAP jsap = new SimpleJSAP( ErdosRenyiGraph.class.getName(), "Generates an Erd\u0151s-R\u00E9nyi random graph and stores it as a BVGraph.",
			new Parameter[] {
		new Switch( "loops", 'l', "loops", "Whether the graph should include self-loops." ), 
		new FlaggedOption( "p", JSAP.DOUBLE_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED, 'p', "The probability of generating an arc." ),
		new FlaggedOption( "m", JSAP.LONGSIZE_PARSER, JSAP.NO_DEFAULT, JSAP.NOT_REQUIRED, 'm', "The expected number of arcs." ),
		new UnflaggedOption( "basename", JSAP.STRING_PARSER, JSAP.REQUIRED, "The basename of the output graph file." ),
		new UnflaggedOption( "n", JSAP.INTEGER_PARSER, JSAP.REQUIRED, "The number of nodes." ),
	});
	JSAPResult jsapResult = jsap.parse( arg );
	if ( jsap.messagePrinted() ) System.exit( 1 );

	final String baseName = jsapResult.getString( "basename" );
	final int n = jsapResult.getInt( "n" );
	final boolean loops = jsapResult.getBoolean( "loops" );
	
	if ( jsapResult.userSpecified( "p" ) && jsapResult.userSpecified( "m" ) ) {
		System.err.println( "Options p and m cannot be specified together" );
		System.exit( 1 );
	}
	if ( ! jsapResult.userSpecified( "p" ) && ! jsapResult.userSpecified( "m" ) ) {
		System.err.println( "Exactly one of the options p and m must be specified" );
		System.exit( 1 );
	}
	
	BVGraph.store( ( jsapResult.userSpecified( "p" ) ? new ErdosRenyiGraph( n, jsapResult.getDouble( "p" ), loops ) : new ErdosRenyiGraph( n, jsapResult.getLong( "m" ), loops ) ), baseName, new ProgressLogger() );
}
 
开发者ID:lhelwerd,项目名称:WebGraph,代码行数:28,代码来源:ErdosRenyiGraph.java


示例19: main

import com.martiansoftware.jsap.UnflaggedOption; //导入依赖的package包/类
public static void main( String args[] ) throws IllegalArgumentException, SecurityException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, IOException, JSAPException  {
	String sourceBasename, destBasename;
	Class<?> graphClass;
	
	SimpleJSAP jsap = new SimpleJSAP( ArcListASCIIGraph.class.getName(), "Reads a graph with a given basename and writes it out in ASCII format with another basename",
			new Parameter[] {
					new FlaggedOption( "graphClass", GraphClassParser.getParser(), null, JSAP.NOT_REQUIRED, 'g', "graph-class", "Forces a Java class for the source graph" ),
					new FlaggedOption( "shift", JSAP.INTEGER_PARSER, null, JSAP.NOT_REQUIRED, 'S', "shift", "A shift that will be added to each node index." ),
					new FlaggedOption( "logInterval", JSAP.LONG_PARSER, Long.toString( ProgressLogger.DEFAULT_LOG_INTERVAL ), JSAP.NOT_REQUIRED, 'l', "log-interval", "The minimum time interval between activity logs in milliseconds." ),
					new UnflaggedOption( "sourceBasename", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The basename of the source graph" ),
					new UnflaggedOption( "destBasename", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The basename of the destination graph" ),
				}		
			);
			
	JSAPResult jsapResult = jsap.parse( args );
	if ( jsap.messagePrinted() ) System.exit( 1 );
	
	graphClass = jsapResult.getClass( "graphClass" );
	sourceBasename = jsapResult.getString( "sourceBasename" );
	destBasename = jsapResult.getString( "destBasename" );

	final ProgressLogger pl = new ProgressLogger( LOGGER, jsapResult.getLong( "logInterval" ), TimeUnit.MILLISECONDS );

	final ImmutableGraph graph = graphClass != null 
		? (ImmutableGraph)graphClass.getMethod( "loadOffline", CharSequence.class, ProgressLogger.class ).invoke( null, sourceBasename, pl )
		: ImmutableGraph.loadOffline( sourceBasename, pl );
	if ( jsapResult.userSpecified( "shift" ) ) ArcListASCIIGraph.store( graph, destBasename, jsapResult.getInt( "shift" ) );
	else ArcListASCIIGraph.store( graph, destBasename );
}
 
开发者ID:lhelwerd,项目名称:WebGraph,代码行数:30,代码来源:ArcListASCIIGraph.java


示例20: main

import com.martiansoftware.jsap.UnflaggedOption; //导入依赖的package包/类
public static void main( String arg[] ) throws IOException, JSAPException {
	SimpleJSAP jsap = new SimpleJSAP( NeighbourhoodFunction.class.getName(), 
			"Prints the neighbourhood function of a graph, computing it via breadth-first visits.",
			new Parameter[] {
		new FlaggedOption( "logInterval", JSAP.LONG_PARSER, Long.toString( ProgressLogger.DEFAULT_LOG_INTERVAL ), JSAP.NOT_REQUIRED, 'l', "log-interval", "The minimum time interval between activity logs in milliseconds." ),
		new Switch( "expand", 'e', "expand", "Expand the graph to increase speed (no compression)." ),
		new FlaggedOption( "threads", JSAP.INTSIZE_PARSER, "0", JSAP.NOT_REQUIRED, 'T', "threads", "The number of threads to be used. If 0, the number will be estimated automatically." ),
		new UnflaggedOption( "basename", JSAP.STRING_PARSER, JSAP.NO_DEFAULT, JSAP.REQUIRED, JSAP.NOT_GREEDY, "The basename of the graph." ),
	}		
	);

	JSAPResult jsapResult = jsap.parse( arg );
	if ( jsap.messagePrinted() ) System.exit( 1 );

	final String basename = jsapResult.getString( "basename" );
	final int threads = jsapResult.getInt( "threads" );
	ProgressLogger pl = new ProgressLogger( LOGGER, jsapResult.getLong( "logInterval" ), TimeUnit.MILLISECONDS );
	ImmutableGraph g =ImmutableGraph.load( basename );
	if ( jsapResult.userSpecified( "expand" ) ) g = new ArrayListMutableGraph( g ).immutableView();
	TextIO.storeLongs( computeExact( g, threads, pl ), System.out );
}
 
开发者ID:lhelwerd,项目名称:WebGraph,代码行数:22,代码来源:NeighbourhoodFunction.java



注:本文中的com.martiansoftware.jsap.UnflaggedOption类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SAMTag类代码示例发布时间:2022-05-22
下一篇:
Java ContainerScrollType类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap