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(); } } } }
/* (non-Javadoc) * @see SketchMaster.gui.Events.HandleStroke#HandleNewStroke(SketchMaster.gui.Events.NewStrokeEvent) */ public void HandleNewStroke(NewStrokeEvent Evt) { Stroke stroke = sheet.PreProcessStroke(Evt.getEventStroke()); GuiShape segmentation = segmentStoke(stroke); // divide the stroke using algoirithms // add strokes in a list sheet.addStrokeToCluster(stroke, segmentation); CurrentStrokesCount++; // do nothing // setChanged(); // notifyObservers(); ///// to add // // GuiShape segmentation = segmentStoke(Evt.getEventStroke()); // addStrokeToCluster(Evt.getEventStroke(), segmentation); }