Beispiel #1
0
 def all_allowable_sets_(self):
     fsm_ = self.finite_state_machine()
     t = gen.gen_list(self.max_length(),
                      [x for x in range(0, self.num_categories())],
                      self.min_length())
     results = list()
     for i in t:
         if fsm_transversal(i, fsm_):
             results.append(i)
     return results
Beispiel #2
0
def gen_():
    # setting up the Finite State Machine for parsing...
    # for parse string "(S)(C2)C1(C1)(C1)"
    # will be using:
    # 1 for C1
    # 2 for C2
    # 3 for S
    # in the generator.
    fsm = [fsm_state(str(x), False) for x in range(0, 7)]
    fsm[0].remap(False, {1: fsm[1], 2: fsm[2], 3: fsm[3]})
    fsm[1].remap(False, {1: fsm[6], 2: fsm[2], 3: fsm[3]})
    fsm[2].remap(False, {1: fsm[6], 2: fsm[6], 3: fsm[3]})
    fsm[3].remap(True, {1: fsm[6], 2: fsm[6], 3: fsm[4]})
    fsm[4].remap(True, {1: fsm[6], 2: fsm[6], 3: fsm[5]})
    fsm[5].remap(True, {1: fsm[6], 2: fsm[6], 3: fsm[6]})
    fsm[6].remap(False, {1: fsm[6], 2: fsm[6], 3: fsm[6]})
    t = gen.gen_list(5, [1, 2, 3], 1)
    results = list()
    for i in t:
        if fsm_transversal(i, fsm[0]):
            results.append(i)
    return results
Beispiel #3
0
        ''' Generate the Categories Lists. '''
        pass

    @abstractmethod
    def replacment_map(self):
        ''' Generate the Replacement Map. '''
        pass

    def all_allowable_sets_(self):
        fsm_ = self.fsm_start()
        t = gen.gen_list( self.max_length() ,
                          [ x for x in range(0,self.num_categories()) ] ,
                          self.min_length() )
        results = list()
        for i in t:
            if fsm_transversal( i, fsm_ ):
                results.append(i)
        return results

    def actuals_per_set(self, set_):
		"""WARNING! this method takes up a Huge amount of memory!"""
        repl_map = self.replacment_map()
        return gen.gen_replace_str1( set_, repl_map )

    def actuals_per_set_to_file(self, set_, path, encoding_='utf-8'):
        repl_map = self.replacment_map()
        return gen.gen_replace_str_to_file( set_, repl_map, path, encoding_ )

    def all_actuals(self):
        """WARNING! this method takes up a Huge amount of memory!"""
        t = self.all_allowable_sets_()