• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java TwoDimensionalCounter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: loadProbabilities

import edu.stanford.nlp.stats.TwoDimensionalCounter; //导入依赖的package包/类
private void loadProbabilities(String filename) throws IOException {
  
if (posDistortionProbabilities != null) return;
posDistortionProbabilities = new TwoDimensionalCounter<String,Integer>();
  
  File file = new File(filename);
  BufferedReader reader = new BufferedReader(new FileReader(file));
  String line = null;
  while ((line = reader.readLine()) != null) {
    String[] parts = line.split(" ");
    int bucket = Integer.parseInt(parts[1]);
    double val = Double.parseDouble(parts[2]);
    posDistortionProbabilities.setCount(parts[0], bucket, Math.log(val));
  }
  reader.close();
}
 
开发者ID:stanfordnlp,项目名称:phrasal,代码行数:17,代码来源:DistortionProbability.java


示例2: countMWEStatistics

import edu.stanford.nlp.stats.TwoDimensionalCounter; //导入依赖的package包/类
static public void countMWEStatistics(Tree t,
    TwoDimensionalCounter<String, String> unigramTagger,
    TwoDimensionalCounter<String, String> labelPreterm,
    TwoDimensionalCounter<String, String> pretermLabel,
    TwoDimensionalCounter<String, String> labelTerm,
    TwoDimensionalCounter<String, String> termLabel) 
{
  updateTagger(unigramTagger,t);

  //Count MWE statistics
  TregexMatcher m = pMWE.matcher(t);
  while (m.findNextMatchingNode()) {
    Tree match = m.getMatch();
    String label = match.value();
    if(RESOLVE_DUMMY_TAGS && label.equals(FrenchTreeReader.MISSING_PHRASAL))
      continue;
    
    String preterm = Sentence.listToString(match.preTerminalYield());
    String term = Sentence.listToString(match.yield());
    
    labelPreterm.incrementCount(label,preterm);
    pretermLabel.incrementCount(preterm,label);
    labelTerm.incrementCount(label,term);
    termLabel.incrementCount(term, label);
  }
}
 
开发者ID:amark-india,项目名称:eventspotter,代码行数:27,代码来源:MWEPreprocessor.java


示例3: OneSidedObjectiveFunction

import edu.stanford.nlp.stats.TwoDimensionalCounter; //导入依赖的package包/类
/**
 * Constructor.
 * 
 * @param input
 */
public OneSidedObjectiveFunction(ClustererState input) {
  // Setup delta data structures
  this.inputState = input;
  localWordToClass = new HashMap<>(input.vocabularySubset.size());
  deltaClassCount = new ClassicCounter<Integer>(input.numClasses);
  deltaClassHistoryCount = new TwoDimensionalCounter<Integer,NgramHistory>();
  for (IString word : input.vocabularySubset) {
    int classId = input.wordToClass.get(word);
    localWordToClass.put(word, classId);
  }
  this.objValue = input.currentObjectiveValue;
}
 
开发者ID:stanfordnlp,项目名称:phrasal,代码行数:18,代码来源:OneSidedObjectiveFunction.java


示例4: ClustererState

import edu.stanford.nlp.stats.TwoDimensionalCounter; //导入依赖的package包/类
public ClustererState(List<IString> vocabularySubset, Counter<IString> wordCount,
    TwoDimensionalCounter<IString, NgramHistory> historyCount, Map<IString, Integer> inWordToClass,
    Counter<Integer> inClassCount,
    TwoDimensionalCounter<Integer, NgramHistory> inClassHistoryCount, int numClasses, 
    double currentObjectiveValue) {
  this.vocabularySubset = vocabularySubset;
  this.wordCount = wordCount;
  this.historyCount = historyCount;
  this.wordToClass = inWordToClass;
  this.classCount = inClassCount;
  this.classHistoryCount = inClassHistoryCount;
  this.numClasses = numClasses;
  this.currentObjectiveValue = currentObjectiveValue;
}
 
开发者ID:stanfordnlp,项目名称:phrasal,代码行数:15,代码来源:ClustererState.java


示例5: updateTagger

import edu.stanford.nlp.stats.TwoDimensionalCounter; //导入依赖的package包/类
public static void updateTagger(TwoDimensionalCounter<String,String> tagger, 
                                Tree t) {
  List<CoreLabel> yield = t.taggedLabeledYield();
  for(CoreLabel cl : yield) {
    if(RESOLVE_DUMMY_TAGS && cl.tag().equals(FrenchTreeReader.MISSING_POS)) 
      continue;
    else
      tagger.incrementCount(cl.word(), cl.tag());
  }
}
 
开发者ID:amark-india,项目名称:eventspotter,代码行数:11,代码来源:MWEPreprocessor.java


示例6: PartialStateUpdate

import edu.stanford.nlp.stats.TwoDimensionalCounter; //导入依赖的package包/类
public PartialStateUpdate(Map<IString, Integer> wordToClass, Counter<Integer> classCount,
    TwoDimensionalCounter<Integer, NgramHistory> classHistoryCount) {
  this.wordToClass = wordToClass;
  this.deltaClassCount = classCount;
  this.deltaClassHistoryCount = classHistoryCount;
}
 
开发者ID:stanfordnlp,项目名称:phrasal,代码行数:7,代码来源:PartialStateUpdate.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ExecutionResult类代码示例发布时间:2022-05-22
下一篇:
Java SQLiteConstraintException类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap