Exemplo n.º 1
0
  private void SegmentTrainSetStrokes() {

    SystemSettings.CurrentRecognizierOperation = this.RECGONIZE_OPERATION_TRAIN;
    CaptureStrokes = true;

    ExmapleType = EXAMPLE_POS;

    if (TrainSetStrokes != null) {

      Interactive = false;
      int count = 0;
      int catCount = 0;
      for (Iterator iterator = TrainSetStrokes.types(); iterator.hasNext(); ) {
        String type = (String) iterator.next();
        logger.info(" segmeting the type " + type);
        CurrentCategory = type;
        CurrentCat = getCategoryide(type);
        ArrayList<ArrayList<Stroke>> catArray = TrainSetStrokes.getExamples(CurrentCategory);
        count = 0;
        catCount = 0;

        for (int i = 0; i < catArray.size(); i++) {
          Stroke stroke = null;

          //				catCount++;
          //				if (catCount>20){
          //					break;
          //				}
          //
          if (count % 50 == 0) {
            logger.info(" Example number " + count);
            logger.info("  example count in strokes trains set is  " + trainSet.getExamplesCount());
          }
          count++;
          ArrayList<Stroke> strokeArray = catArray.get(i);

          for (int j = 0; j < strokeArray.size(); j++) {
            stroke = strokeArray.get(j);
            // for strokes do
            NewStrokeEvent newStroke = new NewStrokeEvent(this);
            newStroke.setEventStroke(stroke);
            newStroke.setFlagConsumed(false);
            HandleNewStroke(newStroke);
          } //
          /// after stroke do the follwoing
          createClusterFromStrokes();
        }
      }
    }
  }
Exemplo n.º 2
0
  public void ReadTrainingSetXML(String filename) {

    logger.info("Reading the xml data ");
    xmlRead = true;
    TrainSetStrokes.readXML(filename);
    Categories = new Hashtable<Integer, String>();
    Iterator<String> iterator = TrainSetStrokes.types();
    int i = 0;
    for (; iterator.hasNext(); ) {
      String cat = iterator.next();

      Categories.put(i, cat);

      i++;
    }
    // Categories.put(i, )

  }