当前位置: 首页>>代码示例>>Java>>正文


Java AnnotationDiffer.Pairing方法代码示例

本文整理汇总了Java中gate.util.AnnotationDiffer.Pairing方法的典型用法代码示例。如果您正苦于以下问题:Java AnnotationDiffer.Pairing方法的具体用法?Java AnnotationDiffer.Pairing怎么用?Java AnnotationDiffer.Pairing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gate.util.AnnotationDiffer的用法示例。


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

示例1: isCellEditable

import gate.util.AnnotationDiffer; //导入方法依赖的package包/类
@Override
public boolean isCellEditable(int rowIndex, int columnIndex){
  if (pairings.size() == 0) { return false; }
  AnnotationDiffer.Pairing pairing = pairings.get(rowIndex);
  switch(columnIndex) {
    case COL_KEY_COPY:
    case COL_KEY_START:
    case COL_KEY_END:
    case COL_KEY_FEATURES: return pairing.getKey() != null;
    case COL_RES_COPY:
    case COL_RES_START:
    case COL_RES_END:
    case COL_RES_FEATURES: return pairing.getResponse() != null;
    default: return false;
  }
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:17,代码来源:AnnotationDiffGUI.java

示例2: getBackgroundAt

import gate.util.AnnotationDiffer; //导入方法依赖的package包/类
/**
 * Gets the background color of a cell
 * 
 * @param row
 * @param column
 * @return
 */
public Color getBackgroundAt(int row, int column) {
  AnnotationDiffer.Pairing pairing = pairings.get(row);
  switch(pairing.getType()) {
    case (AnnotationDiffer.CORRECT_TYPE):
      return BG;
    case (AnnotationDiffer.PARTIALLY_CORRECT_TYPE):
      return PARTIALLY_CORRECT_BG;
    case (AnnotationDiffer.MISMATCH_TYPE):
      if(column < COL_MATCH)
        return MISSING_BG;
      else if(column > COL_MATCH)
        return FALSE_POSITIVE_BG;
      else return BG;
    case (AnnotationDiffer.MISSING_TYPE):
      return MISSING_BG;
    case (AnnotationDiffer.SPURIOUS_TYPE):
      return FALSE_POSITIVE_BG;
    default:
      return BG;
  }
}
 
开发者ID:SemanticSoftwareLab,项目名称:TextMining-Rhetector,代码行数:29,代码来源:AnnotationDiffExporter.java

示例3: initLocalData

import gate.util.AnnotationDiffer; //导入方法依赖的package包/类
protected void initLocalData(){
  differ = new AnnotationDiffer();
  pairings = new ArrayList<AnnotationDiffer.Pairing>();
  keyCopyValueRows = new ArrayList<Boolean>();
  resCopyValueRows = new ArrayList<Boolean>();
  significantFeatures = new HashSet<String>();
  keyDoc = null;
  resDoc = null;
  Component root = SwingUtilities.getRoot(AnnotationDiffGUI.this);
  isStandalone = (root instanceof MainFrame);
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:12,代码来源:AnnotationDiffGUI.java

示例4: getBackgroundAt

import gate.util.AnnotationDiffer; //导入方法依赖的package包/类
public Color getBackgroundAt(int row, int column){
      AnnotationDiffer.Pairing pairing = pairings.get(row);
      switch(pairing.getType()){
        case(AnnotationDiffer.CORRECT_TYPE): return diffTable.getBackground();
        case(AnnotationDiffer.PARTIALLY_CORRECT_TYPE): return PARTIALLY_CORRECT_BG;
        case(AnnotationDiffer.MISMATCH_TYPE):
          if(column < COL_MATCH) return MISSING_BG;
          else if(column > COL_MATCH) return FALSE_POSITIVE_BG;
          else return diffTable.getBackground();
        case(AnnotationDiffer.MISSING_TYPE): return MISSING_BG;
        case(AnnotationDiffer.SPURIOUS_TYPE): return FALSE_POSITIVE_BG;
        default: return diffTable.getBackground();
      }
//      
//      Color colKey = pairing.getType() == 
//          AnnotationDiffer.CORRECT_TYPE ?
//          diffTable.getBackground() :
//          (pairing.getType() == AnnotationDiffer.PARTIALLY_CORRECT_TYPE ?
//           PARTIALLY_CORRECT_BG : MISSING_BG);
//      if(pairing.getKey() == null) colKey = diffTable.getBackground();
//      
//      Color colRes = pairing.getType() == AnnotationDiffer.CORRECT_TYPE ?
//                     diffTable.getBackground() :
//                       (pairing.getType() == AnnotationDiffer.PARTIALLY_CORRECT_TYPE ?
//                       PARTIALLY_CORRECT_BG :
//                         FALSE_POSITIVE_BG);
//      if(pairing.getResponse() == null) colRes = diffTable.getBackground();
//      switch(column){
//        case COL_KEY_START: return colKey;
//        case COL_KEY_END: return colKey;
//        case COL_KEY_STRING: return colKey;
//        case COL_KEY_FEATURES: return colKey;
//        case COL_MATCH: return diffTable.getBackground();
//        case COL_RES_START: return colRes;
//        case COL_RES_END: return colRes;
//        case COL_RES_STRING: return colRes;
//        case COL_RES_FEATURES: return colRes;
//        default: return diffTable.getBackground();
//      }
    }
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:41,代码来源:AnnotationDiffGUI.java

示例5: DiffTable

import gate.util.AnnotationDiffer; //导入方法依赖的package包/类
/**
 * Constructor
 * 
 * @param pairings results of annotation diff
 */
public DiffTable(List<AnnotationDiffer.Pairing> pairings) {
  matchLabel = new String[5];
  matchLabel[AnnotationDiffer.CORRECT_TYPE] = "=";
  matchLabel[AnnotationDiffer.PARTIALLY_CORRECT_TYPE] = "~";
  matchLabel[AnnotationDiffer.MISSING_TYPE] = "-?";
  matchLabel[AnnotationDiffer.SPURIOUS_TYPE] = "?-";
  matchLabel[AnnotationDiffer.MISMATCH_TYPE] = "<>";

  this.pairings = pairings;
}
 
开发者ID:SemanticSoftwareLab,项目名称:TextMining-Rhetector,代码行数:16,代码来源:AnnotationDiffExporter.java

示例6: getValueAt

import gate.util.AnnotationDiffer; //导入方法依赖的package包/类
/**
 * Gets a value of a particular cell
 * 
 * @param row
 * @param column
 * @return
 */
public Object getValueAt(int row, int column) {

  // result at the given row
  AnnotationDiffer.Pairing pairing = pairings.get(row);

  // key and response annotation
  Annotation key = pairing.getKey();
  Annotation res = pairing.getResponse();

  // find out the column
  switch(column) {
    case COL_KEY_START:
      return key == null ? "" : key.getStartNode().getOffset().toString();
    case COL_KEY_END:
      return key == null ? "" : key.getEndNode().getOffset().toString();
    case COL_KEY_STRING:
      String keyStr = "";
      if(key != null && document != null) {
        keyStr = Utils.stringFor(document, key);
      }
      // cut annotated text in the middle if too long
      if(keyStr.length() > maxCellLength) {
        keyStr = keyStr.substring(0, maxCellLength / 2) + "..."
                + keyStr.substring(keyStr.length() - (maxCellLength / 2));
      }
      // use special characters for newline, tab and space
      keyStr = keyStr.replaceAll("(?:\r?\n)|\r", "↓");
      keyStr = keyStr.replaceAll("\t", "→");
      keyStr = keyStr.replaceAll(" ", "·");
      return keyStr;
    case COL_KEY_FEATURES:
      return key == null ? "" : key.getFeatures().toString();
    case COL_MATCH:
      return matchLabel[pairing.getType()];
    case COL_RES_START:
      return res == null ? "" : res.getStartNode().getOffset().toString();
    case COL_RES_END:
      return res == null ? "" : res.getEndNode().getOffset().toString();
    case COL_RES_STRING:
      String resStr = "";
      if(res != null && document != null) {
        resStr = Utils.stringFor(document, res);
      }
      if(resStr.length() > maxCellLength) {
        resStr = resStr.substring(0, maxCellLength / 2) + "..."
                + resStr.substring(resStr.length() - (maxCellLength / 2));
      }
      // use special characters for newline, tab and space
      resStr = resStr.replaceAll("(?:\r?\n)|\r", "↓");
      resStr = resStr.replaceAll("\t", "→");
      resStr = resStr.replaceAll(" ", "·");
      return resStr;
    case COL_RES_FEATURES:
      return res == null ? "" : res.getFeatures().toString();
    default:
      return "?";
  }
}
 
开发者ID:SemanticSoftwareLab,项目名称:TextMining-Rhetector,代码行数:66,代码来源:AnnotationDiffExporter.java

示例7: AnnotationDiffExporter

import gate.util.AnnotationDiffer; //导入方法依赖的package包/类
/**
 * Constructor
 * 
 * @param differs a map containing instance of AnnotationDiffer
 *          objects (one for one annotation type) and a list of
 *          AnnotationDiffer.Pairing objects - each referring to an
 *          annotation in the document of that type
 * @param document document on which the annotation diff is performed.
 * @param keySetName name of the key annotation set
 * @param respSetName name of the response annotaiton set
 */
public AnnotationDiffExporter(
        Map<AnnotationDiffer, List<AnnotationDiffer.Pairing>> differs,
        Document document, String keySetName, String respSetName) {
  this.differs = differs;
  this.document = document;
  this.keySetName = keySetName;
  this.respSetName = respSetName;
}
 
开发者ID:SemanticSoftwareLab,项目名称:TextMining-Rhetector,代码行数:20,代码来源:AnnotationDiffExporter.java


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