def test_enumerate_gsimple_VP(self, gsimple): sentences = es._enumerate(gsimple, [Nonterminal('VP')], 3) assert es.flattened(sentences) == \ ['saw the man', 'saw the park', 'saw the dog', 'saw the telescope', 'saw a man', 'saw a park', 'saw a dog', 'saw a telescope', 'walked the man', 'walked the park', 'walked the dog', 'walked the telescope', 'walked a man', 'walked a park', 'walked a dog', 'walked a telescope']
def test_enumerate_gsimple_P(self, gsimple): sentences = es._enumerate(gsimple, [Nonterminal('P')], 1) assert es.flattened(sentences) == ['in', 'with']
def test_enumerate_gsimple_NP(self, gsimple): sentences = es._enumerate(gsimple, [Nonterminal('NP')], 2) assert es.flattened(sentences) == \ ['the man', 'the park', 'the dog', 'the telescope', 'a man', 'a park', 'a dog', 'a telescope']
def test_enumerate_gsimple_V(self, gsimple): sentences = es._enumerate(gsimple, [Nonterminal('V')], 1) assert es.flattened(sentences) == ['saw', 'walked']
def test_enumerate_gsimple_N(self, gsimple): sentences = es._enumerate(gsimple, [Nonterminal('N')], 1) assert es.flattened(sentences) == ['man', 'park', 'dog', 'telescope']
def test_enumerate_gsimple_Det(self, gsimple): sentences = es._enumerate(gsimple, [Nonterminal('Det')], 1) assert es.flattened(sentences) == ['the', 'a']
def test_enumerate_gtong_IVsing(self, gtong): sentences = es._enumerate(gtong, [Nonterminal('IVsing')], 1) assert es.flattened(sentences) == ['walks', 'lives']
def test_enumerate_gtong_PropN(self, gtong): sentences = es._enumerate(gtong, [Nonterminal('PropN')], 1) assert es.flattened(sentences) == ['John', 'Mary']