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

Method previous

pattern/text/tree.py:426–433  ·  view source on GitHub ↗

Returns the next previous chunk in the sentence with the given type.

(self, type=None)

Source from the content-addressed store, hash-verified

424 i += 1
425
426 def previous(self, type=None):
427 """ Returns the next previous chunk in the sentence with the given type.
428 """
429 i = self.start-1
430 while i > 0:
431 if self.sentence[i].chunk is not None and type in (self.sentence[i].chunk.type, None):
432 return self.sentence[i].chunk
433 i -= 1
434
435 # Chunk.string and unicode(Chunk) are Unicode strings.
436 # repr(Chunk) is a Python string (with Unicode characters encoded).

Callers 1

test_chunkMethod · 0.80

Calls

no outgoing calls

Tested by 1

test_chunkMethod · 0.64