Attach conjunctions. CC-words like "and" and "or" between two chunks indicate a conjunction.
(self)
| 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. |