• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java Tagging类的典型用法和代码示例

java 1次浏览

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

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

示例1: visit

点赞 3

import com.aliasi.tag.Tagging; //导入依赖的package包/类
private static void visit(final ObjectHandler<Tagging<String>> handler, final InMemoryPosTagCorpus<String,String> corpus)
{
	PosTagCorpusReader<String,String> reader = corpus.iterator();
	while (reader.hasNext())
	{
		List<? extends TaggedToken<String, String>> sentence = reader.next();
		List<String> tokens = new ArrayList<String>(sentence.size());
		List<String> tags = new ArrayList<String>(sentence.size());
		for (TaggedToken<String, String> taggedToken : sentence)
		{
			tokens.add(taggedToken.getToken());
			tags.add(taggedToken.getTag());
		}
		Tagging<String> tagging = new Tagging<String>(tokens,tags);
		handler.handle(tagging);
	}
}
 

开发者ID:asher-stern,
项目名称:CRF,
代码行数:18,
代码来源:LingPipeCorpusCreator.java

示例2: getTagging

点赞 2

import com.aliasi.tag.Tagging; //导入依赖的package包/类
@Override
public Tagging<String> getTagging(String sentence) {
	// TODO Auto-generated method stub
	return null;
}
 

开发者ID:dice-group,
项目名称:RDF2PT,
代码行数:6,
代码来源:TreeTagger.java

示例3: tagPartOfSpeech

点赞 2

import com.aliasi.tag.Tagging; //导入依赖的package包/类
@Override
public void tagPartOfSpeech(JCas jcas, List<Token> tokens) {
  List<String> tokenTexts = tokens.stream().map(Token::getCoveredText).collect(toList());
  Tagging<String> tagging = decoder.tag(tokenTexts);
  IntStream.range(0, tokens.size()).forEach(i -> tokens.get(i).setPartOfSpeech(tagging.tag(i)));
}
 

开发者ID:oaqa,
项目名称:bioasq,
代码行数:7,
代码来源:LingPipeParserProvider.java

示例4: train

点赞 2

import com.aliasi.tag.Tagging; //导入依赖的package包/类
@Override
public void train(InMemoryPosTagCorpus<String,String> corpus)
{
	LingPipeCorpusCreator corpusCreator = new LingPipeCorpusCreator();
	Corpus<ObjectHandler<Tagging<String>>> lingPipeCorpus = corpusCreator.createTrainCorpus(corpus);
       ChainCrfFeatureExtractor<String> featureExtractor = new LingPipeSimpleChainCrfFeatureExtractor();
       
       boolean addIntercept = true;
       int minFeatureCount = 1;
       boolean cacheFeatures = false; // true - faster, but uses more space.
       boolean allowUnseenTransitions = true;
       double priorVariance = 4.0;
       boolean uninformativeIntercept = true;
       RegressionPrior prior = RegressionPrior.gaussian(priorVariance, uninformativeIntercept);
       //int priorBlockSize = 3; // update every X instances. Perhaps high value can be faster.
       int priorBlockSize = 20;
       
       //double initialLearningRate = 0.05;
       double initialLearningRate = 0.8;
       //double learningRateDecay = 0.995;
       //double learningRateDecay = 0.9;
       //AnnealingSchedule annealingSchedule = AnnealingSchedule.exponential(initialLearningRate, learningRateDecay);
       AnnealingSchedule annealingSchedule = AnnealingSchedule.inverse(initialLearningRate, 20.0);
       //AnnealingSchedule annealingSchedule = AnnealingSchedule.constant(initialLearningRate);
       
       // double minImprovement = 0.00001; // if improvement is less than X, then stop (but run at list minEpochs epochs). I guess high value might save time.
       double minImprovement = 0.001;
       int minEpochs = 2;
       int maxEpochs = 2000;
       
       Reporter reporter = Reporters.stdOut().setLevel(LogLevel.DEBUG);
       
       try
       {
       	lingPipeCrf = ChainCrf.estimate(lingPipeCorpus,
       			featureExtractor,
       			addIntercept,
       			minFeatureCount,
       			cacheFeatures,
       			allowUnseenTransitions,
       			prior,
       			priorBlockSize,
       			annealingSchedule,
       			minImprovement,
       			minEpochs,
       			maxEpochs,
       			reporter);
       	
       	
       }
       catch (IOException e)
       {
       	throw new PosTaggerException("Ling pipe training failed.",e);
       }
}
 

开发者ID:asher-stern,
项目名称:CRF,
代码行数:56,
代码来源:LingPipeWrapperPosTaggerTrainer.java

示例5: POSTag

点赞 2

import com.aliasi.tag.Tagging; //导入依赖的package包/类
public String[] POSTag(String tokens[]) {
    List<String> tokenList = Arrays.asList(tokens);
    Tagging<String> tagging = tagger.tag(tokenList);
    String pos_tags[] = tagging.tags().toArray(new String[tokens.length]);
    return pos_tags;
}
 

开发者ID:dbmi-pitt,
项目名称:pk-ddi-role-identifier,
代码行数:7,
代码来源:ShallowParser.java

示例6: firstBest

点赞 1

import com.aliasi.tag.Tagging; //导入依赖的package包/类
/**
 * Obtains only the first best result.
 * @param tokens
 * @param decoder
 * @return an array of pos tags.
 */
private List<String> firstBest(List<String> tokens, HmmDecoder decoder) {
  Tagging<String> tagging = decoder.tag(tokens);
  return tagging.tags();
}
 

开发者ID:Network-of-BioThings,
项目名称:GettinCRAFTy,
代码行数:11,
代码来源:POSTaggerPR.java

示例7: getTagging

点赞 1

import com.aliasi.tag.Tagging; //导入依赖的package包/类
Tagging<String> getTagging(String sentence); 

开发者ID:dice-group,
项目名称:RDF2PT,
代码行数:2,
代码来源:PartOfSpeechTagger.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)