Пример #1
0
    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;
Пример #2
0
 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)
Пример #3
0
 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 )
Пример #4
0
 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")
Пример #5
0
    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()
Пример #6
0
    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>}
Пример #7
0
    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
Пример #8
0
 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 )
Пример #9
0
 def __init__(self, board):
     BoardObserver.__init__(self, board)
     self.getBoard().AddBoardObserver( self )
     self.getBoard().RegisterForAnnotation( EqualsAnnotation, self )
     self.getBoard().RegisterForAnnotation( BinAnnotation, self )
Пример #10
0
 def __init__(self, board):
     BoardObserver.__init__(self, board)
     self.getBoard().AddBoardObserver( self, [EqualsAnnotation])
     self.getBoard().RegisterForAnnotation( DirectedLine.H_LineAnnotation, self )
Пример #11
0
    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
Пример #12
0
 def __init__(self, board):
     BoardObserver.__init__(self, board)
     self.getBoard().AddBoardObserver( self, [NumAnnotation] )
     self.getBoard().RegisterForAnnotation( RubineObserver.RubineAnnotation, self )
Пример #13
0
 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
Пример #14
0
 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 )
Пример #15
0
 def __init__(self, board, deferredAnnoQueue):
     BoardObserver.__init__(self, board)
     self.getBoard().AddBoardObserver(self, [EquationAnnotation])
     self.getBoard().RegisterForStroke(self)
     self.deferredAnnoQueue = deferredAnnoQueue
Пример #16
0
    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;
Пример #17
0
 def __init__(self, board):
     BoardObserver.__init__(self, board)
     self.getBoard().AddBoardObserver( self )
     self.getBoard().RegisterForStroke( self )
Пример #18
0
 def __init__(self, board):
     BoardObserver.__init__(self, board)
     self.getBoard().AddBoardObserver( self, [] )
     self.getBoard().RegisterForAnnotation( LineAnnotation, self )
     self.annotation_list = []
Пример #19
0
 def __init__(self):
     BoardObserver.__init__(self)
     BoardSingleton().AddBoardObserver( self )
     BoardSingleton().RegisterForStroke( self )