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

Method _do_relation

pattern/text/tree.py:795–804  ·  view source on GitHub ↗

Attaches subjects, objects and verbs. If the previous chunk is a subject/object/verb, it is stored in Sentence.relations{}.

(self)

Source from the content-addressed store, hash-verified

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.

Callers 1

appendMethod · 0.95

Calls 1

lenFunction · 0.85

Tested by

no test coverage detected