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

Method constraints

pattern/text/search.py:944–949  ·  view source on GitHub ↗

Returns a list of constraints that match the given Chunk.

(self, chunk)

Source from the content-addressed store, hash-verified

942 return self._map1[word.index]
943
944 def constraints(self, chunk):
945 """ Returns a list of constraints that match the given Chunk.
946 """
947 a = [self._map1[w.index] for w in chunk.words if w.index in self._map1]
948 b = []; [b.append(constraint) for constraint in a if constraint not in b]
949 return b
950
951 def constituents(self, constraint=None):
952 """ Returns a list of Word and Chunk objects,

Callers 1

test_matchMethod · 0.80

Calls 1

appendMethod · 0.45

Tested by 1

test_matchMethod · 0.64