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

Method _do_conjunction

pattern/text/tree.py:847–858  ·  view source on GitHub ↗

Attach conjunctions. CC-words like "and" and "or" between two chunks indicate a conjunction.

(self)

Source from the content-addressed store, hash-verified

845 self.words[-1].custom_tags = Tags(self.words[-1], custom)
846
847 def _do_conjunction(self):
848 """ Attach conjunctions.
849 CC-words like "and" and "or" between two chunks indicate a conjunction.
850 """
851 if len(self.words) > 2 and self.words[-2].type == "CC":
852 if self.words[-2].chunk is None:
853 cc = self.words[-2].string.lower() == "and" and AND or OR
854 ch1 = self.words[-3].chunk
855 ch2 = self.words[-1].chunk
856 if ch1 is not None and ch2 is not None:
857 ch1.conjunctions.append(ch2, cc)
858 ch2.conjunctions.append(ch1, cc)
859
860 def get(self, index, tag=LEMMA):
861 """ Returns a tag for the word at the given index.

Callers 1

appendMethod · 0.95

Calls 2

lenFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected