當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。