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


Java TopicInferencer类代码示例

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


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

示例1: main

import cc.mallet.topics.TopicInferencer; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
		
		java.util.logging.Logger.getLogger("com.gargoylesoftware").setLevel(Level.OFF); 
		System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog");
		XMLWikipediaExtractor xwe=new XMLWikipediaExtractor();
		int bestTopic=xwe.getAllArticlesUnderCategory(WikiHelper.getSpecificProperty("categoryForTraining"));
		JtopiaUsage.loadComponents();
	    URLCrawlerForTopic.loadStanfordComponents();
//	    //SummarizationSolver.loadCoreNLP();
	    SummarizationSolver.loadLM();
	    SummarizationSolver.loadStanfordComponents();
	    //Load the topic model
		//int bestTopic=40;
	    TopicInferencer inferencer=TopicModelGenerator.getBestTopicModelInferer(WikiHelper.getSpecificProperty("categoryForTraining"), bestTopic);
		RandomForest classifier=PassageClassifier.getRFBestClassifier(bestTopic, WikiHelper.getSpecificProperty("categoryForTraining"));
		ExistingArticleGenerator eag=new ExistingArticleGenerator();
		xwe.storeStubArticles(WikiHelper.getSpecificProperty("categoryToGenerate"));
		eag.chooseRandomArticlesToCreate(WikiHelper.getSpecificProperty("categoryToGenerate"),bestTopic,
				inferencer,classifier);
		
	}
 
开发者ID:siddBanPsu,项目名称:WikiKreator,代码行数:22,代码来源:ExistingArticleGenerator.java

示例2: getMultipleAssociations

import cc.mallet.topics.TopicInferencer; //导入依赖的package包/类
public Map<Integer, List<String>> getMultipleAssociations(InstanceList instances) {
	Map<Integer, List<String>> associations = new TreeMap<Integer, List<String>>();
	
	if(_model == null)
		return associations;
	
	TopicInferencer inferencer = _model.getInferencer();
	for(Instance instance : instances) {
		String id = instance.getName().toString();
		
		double[] probabilities = inferencer.getSampledDistribution(instance, 100, 10, 10);
		for(int i=0; i<probabilities.length; i++) {
			if(probabilities[i] > minProbability) {
				List<String> list = associations.get(i);
				if(list == null) {
					list = new ArrayList<String>();
					associations.put(i, list);
				}
				list.add(id);
			}
		}
		
	}
	return associations;
}
 
开发者ID:MKLab-ITI,项目名称:mgraph-summarization,代码行数:26,代码来源:LDA.java

示例3: getTopicAssociations

import cc.mallet.topics.TopicInferencer; //导入依赖的package包/类
public Map<Integer, List<String>> getTopicAssociations(InstanceList instances) {
	Map<Integer, List<String>> associations = new TreeMap<Integer, List<String>>();
	
	if(_model == null)
		return associations;
	
	TopicInferencer inferencer = _model.getInferencer();
	for(Instance instance : instances) {
		String id = instance.getName().toString();
		
		double[] probabilities = inferencer.getSampledDistribution(instance, 100, 10, 10);
		int index = 0;
		double maxProb = 0;
		for(int i=0; i<probabilities.length; i++) {
			if(probabilities[i] > maxProb) {
				index = i;
				maxProb = probabilities[i];
			}
		}
		if(maxProb > minProbability) {
			List<String> list = associations.get(index);
			if(list == null) {
				list = new ArrayList<String>();
				associations.put(index, list);
			}
			list.add(id);
		}
	}
	return associations;
}
 
开发者ID:MKLab-ITI,项目名称:mgraph-summarization,代码行数:31,代码来源:LDA.java

示例4: getTopicInferencer

import cc.mallet.topics.TopicInferencer; //导入依赖的package包/类
public TopicInferencer getTopicInferencer() {
	return topicInferencer;
}
 
开发者ID:siddBanPsu,项目名称:WikiKreator,代码行数:4,代码来源:TopicInferenceObject.java

示例5: setTopicInferencer

import cc.mallet.topics.TopicInferencer; //导入依赖的package包/类
public void setTopicInferencer(TopicInferencer topicInferencer) {
	this.topicInferencer = topicInferencer;
}
 
开发者ID:siddBanPsu,项目名称:WikiKreator,代码行数:4,代码来源:TopicInferenceObject.java


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