示例#1
0
 def iterate( self, steps, shuffler=None, **kwds ):
     """
     Iterates over the lines 'steps' times. 
     """
     shuffler = shuffler or self.shuffler
     for index in xrange(steps):
         self.parser.RULE_START_ITERATION( index, self )
         BoolModel.state_update(self)
         lines = shuffler( )
         map( self.local_parse, lines ) 
示例#2
0
 def iterate(self, steps, shuffler=None, **kwds):
     """
     Iterates over the lines 'steps' times. 
     """
     shuffler = shuffler or self.shuffler
     for index in xrange(steps):
         self.parser.RULE_START_ITERATION(index, self)
         BoolModel.state_update(self)
         lines = shuffler()
         map(self.local_parse, lines)
示例#3
0
 def initialize(self, missing=None, defaults={} ):
     "Initializes the TimeModel"
     self.mode = ruleparser.TIME
     BoolModel.initialize( self, missing=missing, defaults=defaults )
     
     if not self.label_tokens:
         util.error( 'this mode of operation requires time labels for rules' )
     
     self.gcd   = util.list_gcd( self.ranks )
     self.step  = 0
     self.times = [ 0 ]
示例#4
0
    def initialize(self, missing=None, defaults={}):
        "Initializes the TimeModel"
        self.mode = ruleparser.TIME
        BoolModel.initialize(self, missing=missing, defaults=defaults)

        if not self.label_tokens:
            util.error('this mode of operation requires time labels for rules')

        self.gcd = util.list_gcd(self.ranks)
        self.step = 0
        self.times = [0]