MCPcopy
hub / github.com/apache/caldera / learn

Method learn

app/service/learning_svc.py:39–50  ·  view source on GitHub ↗
(self, facts, link, blob, operation=None)

Source from the content-addressed store, hash-verified

37 self.model = set(self.model)
38
39 async def learn(self, facts, link, blob, operation=None):
40 decoded_blob = b64decode(blob).decode('utf-8')
41
42 found_facts = []
43 for parser in self.parsers:
44 try:
45 for fact in parser.parse(decoded_blob):
46 found_facts.append(fact)
47 except Exception as e:
48 self.log.error(e)
49 await update_scores(operation=None, increment=len(found_facts), used=facts, facts=link.facts)
50 await self._store_results(link, found_facts, operation)
51
52 async def _store_results(self, link, facts, operation=None):
53 facts_covered = []

Callers 3

_saveMethod · 0.45
test_learnMethod · 0.45

Calls 4

_store_resultsMethod · 0.95
update_scoresFunction · 0.90
decodeMethod · 0.45
parseMethod · 0.45

Tested by 2

test_learnMethod · 0.36