コード例 #1
0
ファイル: AnB2n.py プロジェクト: joshrule/LOTlib
    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)
コード例 #2
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)
コード例 #3
0
ファイル: Dyck.py プロジェクト: joshrule/LOTlib
    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)
コード例 #4
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)
コード例 #5
0
ファイル: LongDependency.py プロジェクト: flrgsr/LOTlib
    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)
コード例 #6
0
ファイル: SimpleEnglish.py プロジェクト: mmolta/LOTlib
    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)