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

Method anchor_id

pattern/text/tree.py:371–386  ·  view source on GitHub ↗

Yields the anchor tag as parsed from the original token. Chunks that are anchors have a tag with an "A" prefix (e.g., "A1"). Chunks that are PNP attachmens (or chunks inside a PNP) have "P" (e.g., "P1"). Chunks inside a PNP can be both anchor and attachment (e.g.

(self)

Source from the content-addressed store, hash-verified

369
370 @property
371 def anchor_id(self):
372 """ Yields the anchor tag as parsed from the original token.
373 Chunks that are anchors have a tag with an "A" prefix (e.g., "A1").
374 Chunks that are PNP attachmens (or chunks inside a PNP) have "P" (e.g., "P1").
375 Chunks inside a PNP can be both anchor and attachment (e.g., "P1-A2"),
376 as in: "clawed/A1 at/P1 mice/P1-A2 in/P2 the/P2 wall/P2"
377 """
378 id = ""
379 f = lambda ch: filter(lambda k: self.sentence._anchors[k] == ch, self.sentence._anchors)
380 if self.pnp and self.pnp.anchor:
381 id += "-" + "-".join(f(self.pnp))
382 if self.anchor:
383 id += "-" + "-".join(f(self))
384 if self.attachments:
385 id += "-" + "-".join(f(self))
386 return id.strip("-") or None
387
388 @property
389 def modifiers(self):

Callers

nothing calls this directly

Calls 3

fFunction · 0.85
stripMethod · 0.80
filterFunction · 0.50

Tested by

no test coverage detected