Attaches subjects, objects and verbs. If the previous chunk is a subject/object/verb, it is stored in Sentence.relations{}.
(self)
| 793 | self._relation = (relation, role) |
| 794 | |
| 795 | def _do_relation(self): |
| 796 | """ Attaches subjects, objects and verbs. |
| 797 | If the previous chunk is a subject/object/verb, it is stored in Sentence.relations{}. |
| 798 | """ |
| 799 | if len(self.chunks) > 0: |
| 800 | ch = self.chunks[-1] |
| 801 | for ch_relation, ch_role in [x for x in ch.relations if x[1] in ("SBJ", "OBJ")]: |
| 802 | self.relations[ch_role][ch_relation] = ch |
| 803 | if ch.type in ("VP",): |
| 804 | self.relations[ch.type][ch.relation] = ch |
| 805 | |
| 806 | def _do_pnp(self, pnp, anchor=None): |
| 807 | """ Attaches prepositional noun phrases. |