MCPcopy Index your code
hub / github.com/clips/pattern / test_chunk

Method test_chunk

test/test_en.py:619–643  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

617 print "pattern.en.Slice"
618
619 def test_chunk(self):
620 # Assert chunk with multiple words ("a fork").
621 v = self.text[0].chunks[4]
622 self.assertTrue(v.start == 5)
623 self.assertTrue(v.stop == 7)
624 self.assertTrue(v.string == "a fork")
625 self.assertTrue(v.lemmata == ["a", "fork"])
626 self.assertTrue(v.words == [self.text[0].words[5], self.text[0].words[6]])
627 self.assertTrue(v.head == self.text[0].words[6])
628 self.assertTrue(v.type == "NP")
629 self.assertTrue(v.role == None)
630 self.assertTrue(v.pnp != None)
631 # Assert chunk that is subject/object of the sentence ("pizza").
632 v = self.text[0].chunks[2]
633 self.assertTrue(v.role == "OBJ")
634 self.assertTrue(v.relation == 1)
635 self.assertTrue(v.related == [self.text[0].chunks[0], self.text[0].chunks[1]])
636 self.assertTrue(v.subject == self.text[0].chunks[0])
637 self.assertTrue(v.verb == self.text[0].chunks[1])
638 self.assertTrue(v.object == None)
639 # Assert chunk traversal.
640 self.assertEqual(v.nearest("VP"), self.text[0].chunks[1])
641 self.assertEqual(v.previous(), self.text[0].chunks[1])
642 self.assertEqual(v.next(), self.text[0].chunks[3])
643 print "pattern.en.Chunk"
644
645 def test_chunk_conjunctions(self):
646 # Assert list of conjunct/disjunct chunks ("black cat" AND "white cat").

Callers

nothing calls this directly

Calls 3

nearestMethod · 0.80
previousMethod · 0.80
nextMethod · 0.45

Tested by

no test coverage detected