se.lth.cs.srl.corpus.Yield.isContinuous()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(114)

本文整理了Java中se.lth.cs.srl.corpus.Yield.isContinuous()方法的一些代码示例,展示了Yield.isContinuous()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Yield.isContinuous()方法的具体详情如下:
包路径:se.lth.cs.srl.corpus.Yield
类名称:Yield
方法名:isContinuous

Yield.isContinuous介绍

[英]Checks whether this yield is continuous, ie they contain all the words in the sentence between this.first() and this.last(). Yields with 1 word are always continuous
[中]检查这个结果是否是连续的(它们包含这个句子中的所有单词)。首先是这个。最后()。一个单词的产出总是连续的

代码示例

代码示例来源:origin: com.googlecode.mate-tools/srl

if(!y.isContinuous()){ //Warn the user if we have discontinuous yields
  errors.append("((Discontinous yield of argument '"+y+"' of predicate '"+pred.getSense()+"'. Yield contains tokens [");
  for(Word w:y)

代码示例来源:origin: microth/PathLSTM

if (isContinuous())
  return Arrays.asList(this);
Collection<Yield> ret = new TreeSet<>();

代码示例来源:origin: com.googlecode.mate-tools/srl

/**
   * Breaks this yield down to continuous yields if this yield is discontinuous, otherwise it returns itself in a list.
   * Yields are labeled lab, C-lab, C-C-lab, etc in a sequential manner from left to right.
   * It follows algorithm 5.3 in Richard Johansson (2008), page 88
   * @return a collection of continuous yields 
   */
  public Collection<Yield> explode() {
    if(isContinuous())
      return Arrays.asList(this);
    Collection<Yield> ret=new TreeSet<Yield>();
    String curArgLabel=argLabel;
    Yield subYield=new Yield(pred,sen,curArgLabel);
    for(int i=sen.indexOf(this.first());i<=sen.indexOf(this.last());++i){
      Word curWord=sen.get(i);
      if(this.contains(curWord)){ //If this yield contain the word, add it, it's continuous.
        subYield.add(curWord);
      } else if(!subYield.isEmpty()) {   //If this yield doesn't contain the word, and we have an unempty subyield, then the subyield is completed
        ret.add(subYield);
        curArgLabel="C-"+curArgLabel;
        subYield=new Yield(pred,sen,curArgLabel);
      }
    }
    if(!subYield.isEmpty()) //Add the last subyield
      ret.add(subYield);
    return ret;
  }
}

相关文章