Ejemplo n.º 1
0
    def __init__(self, A='a', B='b', max_length=10):
        assert len(A) == 1 and len(B) == 1, 'atom length should be one'

        self.A = A
        self.B = B

        FormalLanguage.__init__(self, max_length)
Ejemplo n.º 2
0
    def __init__(self, A='(', B=')'):
        assert len(A) == 1 and len(B) == 1, 'len(A) should be 1 and len(B) should be 1'

        FormalLanguage.__init__(self)

        self.A = A
        self.B = B
Ejemplo n.º 3
0
    def __init__(self, A='a', B='b', max_length=8):
        assert len(A) == 1 and len(B) == 1, 'atom length should be one'

        self.A = A
        self.B = B

        FormalLanguage.__init__(self, max_length)
Ejemplo n.º 4
0
    def __init__(self, A='a', B='bb', max_length=12):
        assert len(A) == 1 and len(B) == 2, 'len(A) should be 1 and len(B) should be 2'

        self.A = A
        self.B = B

        FormalLanguage.__init__(self, max_length)
Ejemplo n.º 5
0
    def __init__(self, max_length=5):
        """
        NOTE: we specify the size of pool from which we will draw our X in sampling strings instead of max_length
        """

        self.A = ['a', 'c', 'e']
        self.B = ['b', 'd', 'f']
        self.C = ['h', 'i', 'j', 'k']

        FormalLanguage.__init__(self, max_length)
Ejemplo n.º 6
0
    def __init__(self, A='a', B='bb'):
        """
        don't use char like | and ) currently
        """
        assert len(A) == 1 and len(B) == 2, 'len(A) should be 1 and len(B) should be 2'

        FormalLanguage.__init__(self)

        self.A = A
        self.B = B
Ejemplo n.º 7
0
    def __init__(self, max_length=5):
        """
        NOTE: we specify the size of pool from which we will draw our X in sampling strings instead of max_length
        """

        self.A = ['a', 'c', 'e']
        self.B = ['b', 'd', 'f']
        self.C = ['h', 'i', 'j', 'k']

        FormalLanguage.__init__(self, max_length)
Ejemplo n.º 8
0
    def __init__(self, A='a', B='b'):
        """
        don't use char like | and ) currently
        """
        assert len(A) == 1 and len(B) == 1, 'max_length should be divisible by len(A)+len(B)'

        FormalLanguage.__init__(self)

        self.A = A
        self.B = B
Ejemplo n.º 9
0
    def __init__(self, A='a', B='b', C='c'):
        """
        don't use char like | and ) currently
        """
        assert len(A) == 1 and len(B) == 1 and len(C) == 1, 'len of A, B, C'

        FormalLanguage.__init__(self)

        self.A = A
        self.B = B
        self.C = C
Ejemplo n.º 10
0
    def __init__(self, max_length=6):
        self.grammar = Grammar(start='S')
        self.grammar.add_rule('S', 'S', ['NP', 'VP'], 1.0)
        self.grammar.add_rule('NP', 'NP', ['d', 'AP', 'n'], 1.0)
        self.grammar.add_rule('AP', 'AP', ['a', 'AP'], 1.0)
        self.grammar.add_rule('AP', 'AP', None, 1.0)

        self.grammar.add_rule('VP', 'VP', ['v'], 1.0)
        self.grammar.add_rule('VP', 'VP', ['v', 'NP'], 1.0)
        self.grammar.add_rule('VP', 'VP', ['v', 't', 'S'], 1.0)

        FormalLanguage.__init__(self, max_length)
Ejemplo n.º 11
0
    def __init__(self, max_length=6):
        self.grammar = Grammar(start='S')
        self.grammar.add_rule('S', 'S', ['NP', 'VP'], 1.0)
        self.grammar.add_rule('NP', 'NP', ['d', 'AP', 'n'], 1.0)
        self.grammar.add_rule('AP', 'AP', ['a', 'AP'], 1.0)
        self.grammar.add_rule('AP', 'AP', None, 1.0)

        self.grammar.add_rule('VP', 'VP', ['v'], 1.0)
        self.grammar.add_rule('VP', 'VP', ['v', 'NP'], 1.0)
        self.grammar.add_rule('VP', 'VP', ['v', 't', 'S'], 1.0)

        FormalLanguage.__init__(self, max_length)
Ejemplo n.º 12
0
 def __init__(self, atom='a', max_length=10):
     self.atom = atom
     FormalLanguage.__init__(self, max_length)
Ejemplo n.º 13
0
 def __init__(self, atom='a'):
     """
     don't use char like | and ) currently
     """
     FormalLanguage.__init__(self)
     self.atom = atom