Exemplo n.º 1
0
  private void addCategoryNegativeExample(int i, SegmentCluster ink) {
    String currentCategory;
    if (Categories.contains(i)) currentCategory = Categories.get(i);
    else currentCategory = CurrentCategory;
    //    (InkInterface)
    //   if (ink instanceof  SegmentCluster) {
    SegmentCluster segment = (SegmentCluster) ink;
    SegmentClusterFeatureSet example = new SegmentClusterFeatureSet();
    example.setSegmentCluster(segment);
    example.initAll();
    SVMFeatureSet feats = example.computeSVMFeatures();
    String temp;
    for (int j = 0; j < Categories.size(); j++) {
      temp = Categories.get(j);
      if (!temp.equals(currentCategory)) trainSet.addNegativeExample(temp, feats);
      if (Interactive) TrainSetStrokes.addNegativeExample(temp, ink.getStrokeInSymbol());
    }

    logger.info("  SVM  adding -ve example for  " + currentCategory);
    // segment.
    trained = false;
    //  }
  }