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

Method loop

pattern/text/tree.py:884–891  ·  view source on GitHub ↗

Iterates over the tags in the entire Sentence, For example, Sentence.loop(POS, LEMMA) yields tuples of the part-of-speech tags and lemmata. Possible tags: WORD, LEMMA, POS, CHUNK, PNP, RELATION, ROLE, ANCHOR or a custom word tag. Any order or combination of tags

(self, *tags)

Source from the content-addressed store, hash-verified

882 return None
883
884 def loop(self, *tags):
885 """ Iterates over the tags in the entire Sentence,
886 For example, Sentence.loop(POS, LEMMA) yields tuples of the part-of-speech tags and lemmata.
887 Possible tags: WORD, LEMMA, POS, CHUNK, PNP, RELATION, ROLE, ANCHOR or a custom word tag.
888 Any order or combination of tags can be supplied.
889 """
890 for i in range(len(self.words)):
891 yield tuple([self.get(i, tag=tag) for tag in tags])
892
893 def indexof(self, value, tag=WORD):
894 """ Returns the indices of tokens in the sentence where the given token tag equals the string.

Callers

nothing calls this directly

Calls 2

getMethod · 0.95
lenFunction · 0.85

Tested by

no test coverage detected