MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / record_from_text

Method record_from_text

src/knowledge/graph.py:58–72  ·  view source on GitHub ↗

Extract entities from ``text``; returns the number of mentions recorded.

(self, text: str, now: float = 0.0)

Source from the content-addressed store, hash-verified

56 ent.last_seen = now
57
58 def record_from_text(self, text: str, now: float = 0.0) -> int:
59 """Extract entities from ``text``; returns the number of mentions recorded."""
60 if not text:
61 return 0
62 n = 0
63 for m in _FILE_RE.finditer(text):
64 self.add(m.group(1), "file", now)
65 n += 1
66 for m in _SYMBOL_RE.finditer(text):
67 self.add(m.group(1), "symbol", now)
68 n += 1
69 for m in _URL_RE.finditer(text):
70 self.add(m.group(0), "url", now)
71 n += 1
72 return n
73
74 def stats(self) -> dict[str, int]:
75 by_type: dict[str, int] = {}

Callers 5

test_count_and_topFunction · 0.95
test_clearFunction · 0.95
_record_knowledgeMethod · 0.80

Calls 1

addMethod · 0.95

Tested by 4

test_count_and_topFunction · 0.76
test_clearFunction · 0.76