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


Java IScopeExtractor类代码示例

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


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

示例1: main

import codemining.languagetools.IScopeExtractor; //导入依赖的package包/类
/**
 * @param args
 * @throws IllegalAccessException
 * @throws InstantiationException
 * @throws ClassNotFoundException
 */
public static void main(String[] args) throws InstantiationException,
		IllegalAccessException, ClassNotFoundException {
	if (args.length < 5) {
		System.err
				.println("Usage: <projectDir> <tokenizerClass> variable|method|class examplesToGenerate <renamerClass> [renamerParams]");
		return;
	}

	final File directory = new File(args[0]);
	final IScopeExtractor extractor = ScopesTUI
			.getScopeExtractorByName(args[2]);
	final long nExamples = Long.parseLong(args[3]);

	final Class<? extends ITokenizer> tokenizerName = (Class<? extends ITokenizer>) Class
			.forName(args[1]);
	final ITokenizer tokenizer = tokenizerName.newInstance();

	final String renamerClass = args[4];

	final HumanEvaluationOutput heo = new HumanEvaluationOutput(directory,
			extractor, renamerClass, args.length == 5 ? null : args[5],
			tokenizer, nExamples);
	heo.getOutput();

}
 
开发者ID:mast-group,项目名称:naturalize,代码行数:32,代码来源:HumanEvaluationOutput.java

示例2: main

import codemining.languagetools.IScopeExtractor; //导入依赖的package包/类
/**
 * @param args
 */
public static void main(String[] args) {
	if (args.length < 3) {
		System.err
				.println("Usage <directory> <renamerClass> variable|method");
		return;
	}

	final IScopeExtractor scopeExtractor = ScopesTUI
			.getScopeExtractorByName(args[2]);

	final String renamerClass = args[1];

	final File directory = new File(args[0]);

	final PerturbationEvaluator pe = new PerturbationEvaluator(directory,
			new JavaTokenizer(), scopeExtractor, renamerClass);

	pe.performEvaluation();
	pe.er.printStats();

}
 
开发者ID:mast-group,项目名称:naturalize,代码行数:25,代码来源:PerturbationEvaluator.java

示例3: getVariableSuggestions

import codemining.languagetools.IScopeExtractor; //导入依赖的package包/类
public static SortedSet<Suggestion> getVariableSuggestions(
		final File currentFile, final File directory, final boolean useUNK)
		throws IOException {
	final ITokenizer tokenizer = new JavaTokenizer();

	final AbstractIdentifierRenamings renamer = new BaseIdentifierRenamings(
			tokenizer);

	final Collection<java.io.File> trainingFiles = FileUtils.listFiles(
			directory, tokenizer.getFileFilter(),
			DirectoryFileFilter.DIRECTORY);

	trainingFiles.remove(currentFile);

	renamer.buildRenamingModel(trainingFiles);

	final IScopeExtractor scopeExtractor = new VariableScopeExtractor.VariableScopeSnippetExtractor();

	final SegmentRenamingSuggestion suggestion = new SegmentRenamingSuggestion(
			renamer, scopeExtractor, useUNK);

	return suggestion.rankSuggestions(currentFile);
}
 
开发者ID:mast-group,项目名称:naturalize,代码行数:24,代码来源:SegmentRenamingSuggestion.java

示例4: main

import codemining.languagetools.IScopeExtractor; //导入依赖的package包/类
/**
 * @param args
 * @throws IOException
 */
public static void main(String[] args) throws IOException {
	if (args.length < 2) {
		System.err.println("Usage <projectFolder> variable|method");
		return;
	}

	final IScopeExtractor scopeExtractor = ScopesTUI
			.getScopeExtractorByName(args[1]);

	final File directory = new File(args[0]);
	final VariableUsageStatistics vus = new VariableUsageStatistics(
			directory, new JavaTokenizer(), scopeExtractor);
	vus.extractStats();
	vus.printStats();
}
 
开发者ID:mast-group,项目名称:naturalize,代码行数:20,代码来源:VariableUsageStatistics.java

示例5: getScopeExtractorByName

import codemining.languagetools.IScopeExtractor; //导入依赖的package包/类
/**
 * @param name
 * @return
 * @throws UnsupportedOperationException
 */
public static IScopeExtractor getScopeExtractorByName(final String name)
		throws UnsupportedOperationException {
	final IScopeExtractor scopeExtractor;
	if (name.equals("variable")) {
		scopeExtractor = new VariableScopeExtractor.VariableScopeSnippetExtractor();
	} else if (name.equals("method")) {
		scopeExtractor = new MethodScopeExtractor.MethodScopeSnippetExtractor(
				true);
	} else if (name.equals("type")) {
		scopeExtractor = new TypenameScopeExtractor.TypenameSnippetExtractor(
				true);
	} else if (name.equals("all")) {
		scopeExtractor = new AllScopeSnippetExtractor();
	} else {
		throw new UnsupportedOperationException(
				"Unknown type of identifier.");
	}
	return scopeExtractor;
}
 
开发者ID:mast-group,项目名称:tassal,代码行数:25,代码来源:ScopesTUI.java

示例6: main

import codemining.languagetools.IScopeExtractor; //导入依赖的package包/类
public static void main(final String args[]) {
	if (args.length < 3) {
		System.err
				.println("Usage <directory> class|method|variable|all <renamerClass> [renamerArgs]");
		return;
	}
	final IScopeExtractor extractor = ScopesTUI
			.getScopeExtractorByName(args[1]);
	final File directory = new File(args[0]);
	final String renamerClass = args[2];
	final String renamerConstructorParams;
	if (args.length < 4) {
		renamerConstructorParams = null;
	} else {
		renamerConstructorParams = args[3];
	}

	final SortedMap<SnippetSuggestions, String> methodScores = getSnippetRanking(
			extractor, directory, renamerClass, renamerConstructorParams);

	final List<Entry<SnippetSuggestions, String>> topRenamings = getTop10pct(methodScores);

	int i = 1;
	for (final Entry<SnippetSuggestions, String> entry : topRenamings
			.subList(
					0,
					topRenamings.size() < NUM_EXAMPLES_TO_PRODUCE ? topRenamings
							.size() : NUM_EXAMPLES_TO_PRODUCE)) {
		CodeReviewAssistant.printRenaming(entry.getKey(), entry.getValue(),
				i);
		i++;
	}
}
 
开发者ID:mast-group,项目名称:naturalize,代码行数:34,代码来源:UnecessaryNamesHumanEvalOutput.java

示例7: main

import codemining.languagetools.IScopeExtractor; //导入依赖的package包/类
/**
 * @param args
 */
public static void main(String[] args) {
	if (args.length < 2) {
		System.err.println("Usge <projectDir> all|variable|method|type");
		return;
	}

	final File prj = new File(args[0]);
	final IScopeExtractor extractor = ScopesTUI
			.getScopeExtractorByName(args[1]);

	final UnkRenamingsEval eval = new UnkRenamingsEval(prj, extractor);
	eval.runExperiment();
}
 
开发者ID:mast-group,项目名称:naturalize,代码行数:17,代码来源:UnkRenamingsEval.java

示例8: UnkRenamingsEval

import codemining.languagetools.IScopeExtractor; //导入依赖的package包/类
/**
 * 
 */
public UnkRenamingsEval(final File directory,
		final IScopeExtractor extractor) {
	allFiles = FileUtils.listFiles(directory,
			(new JavaTokenizer()).getFileFilter(),
			DirectoryFileFilter.DIRECTORY);
	scopeExtractor = extractor;
}
 
开发者ID:mast-group,项目名称:naturalize,代码行数:11,代码来源:UnkRenamingsEval.java

示例9: HumanEvaluationOutput

import codemining.languagetools.IScopeExtractor; //导入依赖的package包/类
/**
 * 
 */
public HumanEvaluationOutput(final File directory,
		final IScopeExtractor extractor, final String renamerClass,
		final String renamerConstructorParam, final ITokenizer tokenizer,
		final long nExamples) {
	allFiles = Lists.newArrayList(FileUtils.listFiles(directory,
			tokenizer.getFileFilter(), DirectoryFileFilter.DIRECTORY));
	Collections.shuffle(allFiles);
	this.tokenizer = tokenizer;
	this.nExamples = nExamples;
	this.renamerClass = renamerClass;
	this.renamerConstructorParam = renamerConstructorParam;
	scopeExtractor = extractor;
}
 
开发者ID:mast-group,项目名称:naturalize,代码行数:17,代码来源:HumanEvaluationOutput.java

示例10: performEvaluation

import codemining.languagetools.IScopeExtractor; //导入依赖的package包/类
public void performEvaluation(final Collection<File> files,
		final IScopeExtractor scopeExtractor) {
	final ParallelThreadPool threadPool = new ParallelThreadPool();
	int fileNo = 0;
	for (final File fi : files) {
		threadPool.pushTask(new RenamingEvaluator(fi, scopeExtractor));
		fileNo++;
		if (fileNo % 50 == 0) {
			threadPool.pushTask(new Printer());
		}
	}
	threadPool.waitForTermination();
	(new Printer()).run();
}
 
开发者ID:mast-group,项目名称:naturalize,代码行数:15,代码来源:NamingEvaluator.java

示例11: SelectionSuggestionEval

import codemining.languagetools.IScopeExtractor; //导入依赖的package包/类
/**
 * 
 */
public SelectionSuggestionEval(final File directory,
		final ITokenizer codeTokenizer, final IScopeExtractor extractor) {
	tokenizer = codeTokenizer;
	allFiles = FileUtils.listFiles(directory, tokenizer.getFileFilter(),
			DirectoryFileFilter.DIRECTORY);
	scopeExtractor = extractor;
}
 
开发者ID:mast-group,项目名称:naturalize,代码行数:11,代码来源:SelectionSuggestionEval.java

示例12: StylishEval

import codemining.languagetools.IScopeExtractor; //导入依赖的package包/类
/**
 * 
 */
public StylishEval(final File directory, final ITokenizer codeTokenizer,
		final IScopeExtractor extractor) {
	tokenizer = codeTokenizer;
	allFiles = FileUtils.listFiles(directory, tokenizer.getFileFilter(),
			DirectoryFileFilter.DIRECTORY);
	scopeExtractor = extractor;
}
 
开发者ID:mast-group,项目名称:naturalize,代码行数:11,代码来源:StylishEval.java

示例13: main

import codemining.languagetools.IScopeExtractor; //导入依赖的package包/类
/**
 * @param args
 * @throws IllegalAccessException
 * @throws InstantiationException
 * @throws ClassNotFoundException
 */
public static void main(String[] args) throws InstantiationException,
		IllegalAccessException, ClassNotFoundException,
		SerializationException {
	if (args.length < 5) {
		System.err
				.println("Usage <folder> <tokenizerClass> <wrapperClass> variable|method <renamingClass> [<renamerConstrParams> ..]");
		return;
	}

	final File directory = new File(args[0]);

	final Class<? extends ITokenizer> tokenizerName = (Class<? extends ITokenizer>) Class
			.forName(args[1]);
	final ITokenizer tokenizer = tokenizerName.newInstance();

	final Class<? extends AbstractNGramLM> smoothedNgramClass = (Class<? extends AbstractNGramLM>) Class
			.forName(args[2]);

	final LeaveOneOutEvaluator eval = new LeaveOneOutEvaluator(directory,
			tokenizer, smoothedNgramClass);

	final IScopeExtractor scopeExtractor = ScopesTUI
			.getScopeExtractorByName(args[3]);

	eval.performEvaluation(scopeExtractor, args[4],
			args.length == 6 ? args[5] : null);
}
 
开发者ID:mast-group,项目名称:naturalize,代码行数:34,代码来源:LeaveOneOutEvaluator.java

示例14: performEvaluation

import codemining.languagetools.IScopeExtractor; //导入依赖的package包/类
public void performEvaluation(final IScopeExtractor scopeExtractor,
		final String renamerClass, final String additionalParams) {
	final ParallelThreadPool threadPool = new ParallelThreadPool();
	int fileNo = 0;
	for (final File fi : allFiles) {
		threadPool.pushTask(new ModelEvaluator(fi, scopeExtractor,
				renamerClass, additionalParams));
		fileNo++;
		if (fileNo % 40 == 0) {
			threadPool.pushTask(new Printer());
		}
	}
	threadPool.waitForTermination();
}
 
开发者ID:mast-group,项目名称:naturalize,代码行数:15,代码来源:LeaveOneOutEvaluator.java

示例15: DynamicRangeEval

import codemining.languagetools.IScopeExtractor; //导入依赖的package包/类
/**
 * 
 */
public DynamicRangeEval(final File directory, final ITokenizer tokenizer,
		final IScopeExtractor ex) {
	allFiles = FileUtils.listFiles(directory, tokenizer.getFileFilter(),
			DirectoryFileFilter.DIRECTORY);
	scopeExtractor = ex;
}
 
开发者ID:mast-group,项目名称:naturalize,代码行数:10,代码来源:DynamicRangeEval.java


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