本文整理匯總了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);
}
示例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;
}
示例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;
}
示例4: getTopicInferencer
import cc.mallet.topics.TopicInferencer; //導入依賴的package包/類
public TopicInferencer getTopicInferencer() {
return topicInferencer;
}
示例5: setTopicInferencer
import cc.mallet.topics.TopicInferencer; //導入依賴的package包/類
public void setTopicInferencer(TopicInferencer topicInferencer) {
this.topicInferencer = topicInferencer;
}