def __init__(self, board, circularity_threshold=0.90): # TODO: we may wish to add the ability to expose/centralize these thresholds # so that they can be tuned differently for various enviornments BoardObserver.__init__(self, board) self.getBoard().AddBoardObserver( self , [CircleAnnotation]) self.getBoard().RegisterForStroke( self ) self.threshold = circularity_threshold;
def __init__(self, board, item_annotype_list, collection_annotype, other_target_annos = []): BoardObserver.__init__(self, board) self.getBoard().AddBoardObserver( self , [collection_annotype]) for annotype in item_annotype_list: self.getBoard().RegisterForAnnotation( annotype, self ) self.getBoard().RegisterForAnnotation( collection_annotype, self ) self.all_collections = set([]) self.item_annotype_list = item_annotype_list # types of the "items" (e.g. CircleAnnotation, ArrowAnnotation) self.collection_annotype = collection_annotype # type of the "collection" (e.g. DiGraphAnnotation)
def __init__(self, board): BoardObserver.__init__(self, board) self.getBoard().AddBoardObserver( self, [ExpressionAnnotation] ) self.getBoard().RegisterForAnnotation( PlusAnnotation, self ) self.getBoard().RegisterForAnnotation( MinusAnnotation, self ) self.getBoard().RegisterForAnnotation( DivideAnnotation, self ) self.getBoard().RegisterForAnnotation( MultAnnotation, self ) self.getBoard().RegisterForAnnotation( NumAnnotation, self ) self.getBoard().RegisterForAnnotation( ExpressionAnnotation, self )
def __init__(self, board): BoardObserver.__init__(self, board) self.getBoard().AddBoardObserver( self , [ArrowAnnotation]) self.getBoard().RegisterForStroke( self ) #For multistroke arrows, keep track of arrowheads and line endpoints # and match them up into arrows self._arrowHeads = [] #tuples of (arrowhead_tip, arrowhead_stroke) self._endpoints = [] #tuples of (endpoint, tail_stroke), one for each endpoint of a tail self.arrowHeadMatcher = Template.TemplateDict(filename = "Utils/arrowheads.templ")
def __init__(self, board): BoardObserver.__init__(self, board) fname = "RL10dash.xml" self.getBoard().AddBoardObserver( self , [TextAnnotation]) self.getBoard().RegisterForStroke( self ) #self.getBoard().RegisterForAnnotation( RubineAnnotation , self) rubineDataFile = open(fname, "r") featureSet = Rubine.BCPFeatureSet() self.classifier = Rubine.RubineClassifier(featureSet = featureSet) self.classifier.loadWeights(rubineDataFile) rubineDataFile.close()
def __init__(self, board, fname, debug=False): """ Initiates the Rubine classifier. fname is the name of a file containing the training data to be used. """ BoardObserver.__init__(self, board) #featureSet = Rubine.RubineFeatureSet() rubineDataFile = open(fname, "r") featureSet = Rubine.BCPFeatureSet() #featureSet = Rubine.BCPFeatureSet_Combinable() self.classifier = Rubine.RubineClassifier(featureSet = featureSet, debug = debug) logger.debug("Loading weights from %s" % (fname)) self.classifier.loadWeights(rubineDataFile) rubineDataFile.close() self.getBoard().AddBoardObserver( self , [RubineAnnotation]) self.getBoard().RegisterForStroke( self ) self.allStrokes = {} #Dict of {<stroke> : <set of connected strokes>}
def __init__( self, board): # this will register everything with the board, and we will get the proper notifications BoardObserver.__init__(self, board) self.getBoard().AddBoardObserver(self, [TuringMachineAnnotation]) self.getBoard().RegisterForAnnotation(TextObserver.TextAnnotation, self) self.getBoard().RegisterForAnnotation(TextObserver.TextAnnotation, self) self.getBoard().RegisterForAnnotation(DiGraphObserver.DiGraphAnnotation, self) #BoxVisualizer() #BoxMarker() self.labelMap = {} #Maps textAnno to set of TMAnno self.graphMap = {} #Maps DGAnno to TMAnno self.tmMap = {} #Maps TMAnno to set of component DGAnno and TextAnno
def __init__(self, board): BoardObserver.__init__(self, board) self.getBoard().AddBoardObserver( self, [MultAnnotation]) self.getBoard().RegisterForAnnotation( DirectedLine.BT_LineAnnotation, self ) self.getBoard().RegisterForAnnotation( DirectedLine.TB_LineAnnotation, self )
def __init__(self, board): BoardObserver.__init__(self, board) self.getBoard().AddBoardObserver( self ) self.getBoard().RegisterForAnnotation( EqualsAnnotation, self ) self.getBoard().RegisterForAnnotation( BinAnnotation, self )
def __init__(self, board): BoardObserver.__init__(self, board) self.getBoard().AddBoardObserver( self, [EqualsAnnotation]) self.getBoard().RegisterForAnnotation( DirectedLine.H_LineAnnotation, self )
def __init__(self, board): BoardObserver.__init__(self, board) self.getBoard().AddBoardObserver( self, [] ) self.watchSet = set([]) # set of annotation types to track self.seenBefore = {} # set of particular annotation that we have already drawn
def __init__(self, board): BoardObserver.__init__(self, board) self.getBoard().AddBoardObserver( self, [NumAnnotation] ) self.getBoard().RegisterForAnnotation( RubineObserver.RubineAnnotation, self )
def __init__(self, board): BoardObserver.__init__(self, board) self.getBoard().AddBoardObserver( self , []) self.getBoard().RegisterForStroke( self ) self.strokeObservers = set() #A set of functions to classify raw strokes
def __init__(self, board): BoardObserver.__init__(self, board) self.getBoard().AddBoardObserver( self, [H_LineAnnotation, V_LineAnnotation, TB_LineAnnotation, BT_LineAnnotation] ) self.getBoard().RegisterForAnnotation( LineObserver.LineAnnotation, self )
def __init__(self, board, deferredAnnoQueue): BoardObserver.__init__(self, board) self.getBoard().AddBoardObserver(self, [EquationAnnotation]) self.getBoard().RegisterForStroke(self) self.deferredAnnoQueue = deferredAnnoQueue
def __init__(self, board, linearity_threshold=0.85): BoardObserver.__init__(self, board) self.getBoard().AddBoardObserver( self , [LineAnnotation]) self.getBoard().RegisterForStroke( self ) self.threshold = linearity_threshold;
def __init__(self, board): BoardObserver.__init__(self, board) self.getBoard().AddBoardObserver( self ) self.getBoard().RegisterForStroke( self )
def __init__(self, board): BoardObserver.__init__(self, board) self.getBoard().AddBoardObserver( self, [] ) self.getBoard().RegisterForAnnotation( LineAnnotation, self ) self.annotation_list = []
def __init__(self): BoardObserver.__init__(self) BoardSingleton().AddBoardObserver( self ) BoardSingleton().RegisterForStroke( self )