本文整理汇总了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;
}